How do I merge Pages documents

Question: I have an iMac running High Sierra with Pages 8.1. I am having a problem merging two Pages documents into one. I have several Pages files that I'd like to merge into a single document. These Pages files have a lot of graphics and spreadsheet tables. When I try to copy file #2 and paste it at the end of file #1, all of the spreadsheet tables and some of the other graphics get left behind or moved around.  Is there another way to merge 2 or more Pages files into one single Pages file. I can't convert them into PDFs because the final document must be in Pages. I have tried copying and pasting the Thumbnails but the graphics still get messed up. Does anyone know how to do this?
Answer: I am on Pages 10.1 and no longer have access to anything that still has v8.1.  This means the precise instructions might be a little different, but Pages 8.1 does support these features (even if the menus or wording might be a little different).
Pages has a two major modes of operation.

Word Processing mode:  This is the default mode for most documents.  In this mode, document text is added directly to the page. If you reach the end of a page but continue typing, a new pages is added and you continue to type on the new page.  If you delete some of the text from the first page, all text is moved up (including text from adjacent pages).
Page Layout mode:  This mode works like a publishing system and is easier to use if you are creating newspapers, newsletters, or magazine style documents... where you have multiple articles and an article might start on one page, but finish on a later page -- even with other articles interspersed between them.  In this mode, you don't type directly onto a page.  Instead you create a text frame and place it on the page and type only within the frame.  If you run out of space, the frame will not automatically grow nor will new pages automatically get created.  You manually added pages as needed and add more text frames as needed... but you link text frames together if they all belong to the same article in the publication.  When a text frame is full, text automatically flows into and continues in the next text frame (provided you linked it to the same article).

You do a little more setup to use Page Layout mode because you have to manually create and size your text frames where you want them ... but the advantage is that things go exactly where you want them.
Also, in Page Layout mode, each page is a discrete thing.  If you move a page, the whole page and everything on it moves along with it and everything is exactly as you placed.  This is true wether you are moving it to a new location within the same document, or copying it to a completely different document (assuming the destination document is also using Page Layout mode.)
Convert to Page Layout Mode
Before you do this, beware the danger... in Page Layout mode, you cannot apply text directly onto a page.  E.g. if you create a new blank document, switch it to Page Layout mode, and then try to type... you'll notice it won't let you.  You must drop a text box onto the page and then you can type inside the text box.  It's probably worth doing some experiments with this to understand how it works before attempting to convert a document you care about (make a backup before you make any changes).
When you ultimately do perform a conversion from Word Processing mode to Page Layout mode, any text you had typed directly onto a page will disappear.  It will not automatically create text boxes for you and move your text into those boxes.  This is something you have to do manually.
There are two ways to perform the conversion (but I'm using Pages 10.1 and cannot promise this looked the same in Pages 8.1):
Using the 'File' Menu to Convert
Navigate to the 'File' menu and you should notice a menu choice that will either say "Convert to Page Layout" or "Convert to Word Processing".  If you see "Convert to Page Layout" it means you are currently in Word Processing mode.  If you see "Convert to Word Processing" it means you are in Page Layout mode.
Using the Document Inspector Panel
The other method is to use the Document inspector.  I've added an image for clarity.

To use this method,

Select the 'Document' inspector panel icon on the tool-bar.
Select the 'Document' tab within the Document inspector panel.
Check to see if 'Document Body' is enabled.

If Document Body is enabled, you are in Word Processing mode (and can type directly on the page).  If Document Body is not enabled, you are in Page Layout mode and can only type text within a text-frame.
If you attempt to change the mode you will be asked to confirm that you really want to change.  Remember... any text that was directly on a page (not within a text frame) will be lost.  Make sure you manually copy this text, create text boxes, and then paste your text into the text box(es).
Linking Text Boxes
When you create a new text box, if you select the box you'll notice the control points located not the sides and corners, and a round empty circle in the top-center of the box.  Click that circle and it will turn into a number '1' and get a color assignment.  This means it is the 1st text box associated with your thread (a thread represents an article).
Create a new text box and repeat by clicking the circle.  It will automatically fill in with a '2' (indicating it is the 2nd text frame in the thread.)  But notice if you hover-over the '2', a tiny arrow appears.   This means this text box is now "linked" to the first text box.  As you type and fill the box, text will autoflow into the next box that is linked to the same thread.  If you click on the colored number in the top-center of any text box you get a sub-menu and can choose to link that box to a different thread/article or create a new thread, or just unlink the box (remove from thread).
Copy & Paste
In Page Layout mode (and only in Page Layout mode) you can move entire pages "as is" -- the page will look exactly the same in the new destination.  You cannot do this in Word Processing mode.

Select "View" -> "Page Thumbnails"
Select the individual page or pages that you want to copy (it is only possible to select individual pages if you are in Page Layout mode).
Select "Edit" -> "Copy"
In the destination document, select "Edit" -> "Paste"

The pages will come across as they were.  This is because in this mode, pages simply hold "objects" -- objects are things like text boxes, images, charts or graphs, etc. etc.  Each page knows which objects are located on that page and the relative positioning or layout of each object.  Hence the name "Page Layout" mode.
Nuances of Either Mode
You can insert objects inline within text in either mode.  E.g. insert a picture in the middle of an article in Word Processing mode or in Page Layout mode and that image placement is relative to the point in your article ... not to a spot on the page.  In other words, add or delete some text in the article located above the image and you'll see the image moves up or down.
But you can also create an object on a page (such as an image) where it's location is pinned to the page itself and not tied to a location within an article (it wont move as you edit the article... the article will move and flow around the other object -- depending on the rules you set.
If you copy a range of an text in an article and that range includes an "inline" image, the image will get copied along with the text.  If you copy a range of text where the image is it's own object (not inline), then you'll only get the text and the other objects are left behind.  You have to manually copy those separate objects in a separate operation.
Comment: I really appreciate the lowdown on Pages.  My situation is that I wrote a book using Pages in word processing mode. i made a separate file for each of the 9 chapters.  It sounds like from your answer that there is no easy way to combine them.  Do you concur?

How do I merge Pages documents


UITextField IOS7 not setting font color during input

Question: I have some simple code that worked fine under iOS6. In a UITextField when the event editingDidBegin arrived I executed a simple piece of code that changed the color of the text that was entered:
textField.textColor = [UIColor redColor];

Although this code is executed, the text color does not change to red, but remains unchanged at its default color as the text is being entered.
If I call this method on editingDidEnd, the text is entered in the default color, but changes to red when editingDidEnd kicks off the same piece of code:
textField.textColor = [UIColor redColor];

It seems as though I can not change the textColor property when the textField is the first responder.
Any help here would be greatly appreciated.
Comment: Text field or view? You seem to use both interchangeably.
Comment: It is a UITextField. I will need to change the first line of the question.
Comment: Then please update the title, question, and tags so all reference to "text view" are "text field".
Answer: You should do some subclassing for that
Here is a good solution that works both on ios6 and ios7
http://www.brightec.co.uk/blog/how-change-colour-uitextfields-placeholder-text-ios7-and-still-support-ios6
Answer: I found another way of accomplishing this. I used the UITextField delegate method and added the following code. Seems like my original method should have worked moving to IOS7, but this now works fine.
-(BOOL)textFieldShouldBeginEditing:(UITextField *)textField
{
    textField.textColor = [UIColor redColor];
    return YES;
}

Answer: [textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];

This will change the place holder color of UITextField,


When you download an Xbox One game from the store, is it available to all users of that Xbox?

Question: If I buy a game on the Xbox One from the store, will it be available to all users on that Xbox? Is it the same as if I purchased a disc, where it is available to any user?
Comment: So if I buy a game, download it and purchase it on Xbox A, will it not be registered to that console? If I download it to Xbox B, I should be able to play it as Live will recognise my ownership. But Xbox A should have it registered for offline use in theory. Must test this. Anyone?
Comment: I know it is a question though the answer will elaborate on this question more thouroughly.
Answer: The best answer I can find is this quote from the Microsoft Xbox One Support Site:

Q: Can multiple people share the same console?
A: An unlimited number of people can share the same console.
Note: Your friends and family will only be able to play your games if the sharing feature is enabled.

Source: http://support.xbox.com/en-NZ/xbox-one/games/my-home-xbox
There is also this page regarding playing your Digital Purchases on OTHER Xbox One consoles.
Note: The link to "About sharing games & Gold" is a dead link, but I believe it was meant to point to my previous link.
Answer: A digital download can be used by any/all users of the purchasers "home" Xbox One console. It can also be downloaded and played on any other console but only as long as the purchaser is signed into that other console.
Answer: You need to set a family in the xbox.
In the Xbox settings you can find 'Family'. That's where you can set that all your users are in family.


After upgrading the preview of text messages on my lockscreen feature disappeared

Question: I have a HTC One Mini and recently upgraded from Android version 4.2 to 4.3,. Everything went fine, but I noticed when people were sending me messages that I couldn't see a preview of them or who sent them on my lock screen. I went into Settings and Personalized settings and my lock screen feature has disappeared.
Answer: The settings have moved to the "Security" list, rather than the "Personalisation" list, but I've been unable to see previews on my lockscreen since the update even with these settings. Others that I know have experienced the same issue.
HTC just recommend a factory reset... -_-


Boss removed my overtime shift and gave it to someone else

Question: My boss offered me a weekend shift outside of my normal working hours, as overtime on a Sunday. I am contracted to work Mon-Fri with occasional weekends when required.The week prior to the Sunday I was ill on Monday and Tuesday and returned to work Wednesday. On returning to work on Wednesday I saw my boss had covered my overtime shift without checking whether I would be able to do it, is this allowed?
Comment: Is overtime guaranteed?
Comment: No it is not guaranteed
Answer: You state in a comment that overtime is not guaranteed in your job/locale so yes your boss can do this. While I can understand that it's unfortunate for you to miss out here it sounds as though your boss was just doing their job. The business needs the shift covered and with you out ill (and without knowledge of when you'd be returning) it makes sense to reassign the shift sooner rather than later and avoid getting to later on in the week and scrambling to get cover at short notice.
Yes your boss could have contacted you to see if you were still going to work the Sunday but you'd be surprised how many people would be annoyed by their boss ringing them up, while they were sick to ask if they were still going to work overtime.
Comment: Haha.. I really liked your answer!
Answer: Look at it from the bosses point of view.
You were ill. With illness, the boss would be unsure that you would be well enough by the weekend. Therefore, to make sure they would ask somebody else to cover. A person would reasonably need 3-4 days advanced warning for working on the weekend.
Comment: "You were ill"...


Negative response 00000436 found

Question: I got this error when I'm trying to send sms via SMPP connection.
org.jsmpp.extra.NegativeResponseException: Negative response 00000436 found
    at org.jsmpp.session.AbstractSession.validateResponse(AbstractSession.java:215)
    at org.jsmpp.session.AbstractSession.executeSendCommand(AbstractSession.java:271)
    at org.jsmpp.session.SMPPSession.submitShortMessage(SMPPSession.java:320)

I'm using jsmpp-2.1.0.jar
Here is SMS push code
messageId = GlobalConstants.SMPP_SESSION_BULK.submitShortMessage("CMT", TypeOfNumber.INTERNATIONAL.ALPHANUMERIC, NumberingPlanIndicator.UNKNOWN, mtport, TypeOfNumber.INTERNATIONAL, NumberingPlanIndicator.UNKNOWN, sentNumber, new ESMClass(), (byte)0, (byte)1,  null, null, new RegisteredDelivery(SMSCDeliveryReceipt.SUCCESS_FAILURE), (byte)0, new GeneralDataCoding(), (byte)0, message.getBytes());

Does "SMSC returned error code 0x00000436" and "Negative response 00000436 found" are same errors? I couldn't find error code : 00000436 on smpp error list.
Answer: According to the Short Message Peer to PeerProtocol Specification v3.4
errors 0x00000400-0x000004FF Are Reserved for SMSC vendor specific
errors. So you might need to check with your SMSC to get the exact problem.
In our case we got the  Negative response 00000436 because we were sending the destination address with + 5520000000804 which needs to be sent without the +
Answer: Make sure that the credentials/username/password/system id are correct.

Negative response 00000436 found


Is it possible for the owner of a chat room that has been frozen, to edit or delete it?

Question: Is this functionality available? If not, has it been considered already?
Comment: I seem to have full control of my contributions elsewhere on the site - including the ability to, to a point, edit them and/or remove them. I think that's a good thing, since it allows for self - moderation.
Answer: Only mods and developers can operate on frozen chat rooms, and only they can delete rooms (that answer is a year old, but I don't think it's inaccurate). This holds true even if you're an owner of the room.
Here on Meta, I can read the contents of frozen and deleted rooms (assuming the room isn't private), but that's it.
I think this behaviour is appropriate -- moderators should have ultimate control over this state of a chat room. If a room owner was allowed to override this, that would be akin to allowing a post owner to override a moderator lock on that post, which doesn't make sense from the perspective of moderation.
The only thing that might be a bit annoying is the auto-freeze after a week of inactivity. But on balance, I think that's alright to keep the chat room list cleaned up.
Comment: Do moderators get to decide, elsewhere on the site, whether my contributions should remain on the site or be deleted (and override my judgement)? Maybe a more appropriate functionality would be to "edit or remove my own contributions to a chat-room"
Comment: Yes, they do. They have the ability to lock posts, which prevents any kind of modification, including deletion/undeletion. If you can't trust the mods, who can you trust on the site?
Comment: I can easily see a post with 25 answers getting locked, where it contains comments or responses buried in its thread, which the poster might find embarrassing or otherwise not want to have around anymore, and want removed.
Comment: It's up to the mod's discretion. FYI: it's rarer to see, but individual answers can be locked as well.


git fetch remote not updating project?

Question: So I am trying to fetch one of my repositories into my project but the files are not updating on my local machine.
git fetch TheCore <-- my Core on Github
returns saying nothing in terminal, just puts me back at prompt

No files have updated on my machine, still has old code.
My as12 projects remote repos:
origin  https://github.com/mine/as12.git (fetch)
origin  https://github.com/mine/as12.git (push)
thecore https://github.com/mine/TheCore.git (fetch)
thecore https://github.com/mine/TheCore.git (push)

So I am trying to fetch TheCore so it will update my local project with new code. Not sure why fetch is not working.
Answer: When you want your working directory to be updated, follow that git fetch with a git merge, or just use git pull instead.
More reading: What is the difference between 'git pull' and 'git fetch'?
Answer: Fetch only has the effect of updating the references on your local repository. It does not automatically update local branches. To update local branches you need to use pull, merge or rebase depending on the situation.
More info here

git fetch remote not updating project?


Weird / arbitrarily behavior of Collabora Online

Question: So I've been experiencing some very strange behavior alongside Collabora Online. Since migrating to a new Collabora Online Server (version 21.11.3), nothing works reliably anymore. All the abnormalities described in the following follow no pattern, are totally unpredictable and therefore cannot be reproduced.
The save button sometimes work and sometimes it does not. Meaning the changes sometimes get saved on the file server as it should be and sometimes no http request to the wopi host is made. I tried to manually save with the help of the PostMessageAPI. When adding an event listener to the iframe window the Collabora Online editor is embedded in, I notice that it rarely gets trigered upon user actions such as "saving the document." Feels very buggy to me.
Often the document is loaded and rendered instantly without any problems. When trying to load the same document some time later, it sometimes happens that the content of the iframe schows me some weird error messages. I attached them to this thread. The first error message says that it is cleaning up the document from the last session. Whatever that means, it can last for hours. The second error message says it cannot establish a connection to the document (although it worked minutes before).
Could this be a configuration error on a server Collabora Online is running/depending on?
Error1
Error2
Answer: this might be a bug → https://github.com/CollaboraOnline/online/issues/4773
please participate there!


In old Greek did γγ ever replace κκ in the way Attic uses ττ for Ionic σσ?

Question: This question is prompted by a word used in botanical nomenclature: coggygria.
Liddell and Scott show κοκκυγρεα and κοκκυγρια, words used for the tree in question. Is there any evidence that the word κογγυγρια might have existed?
Also, were there such a word as κογγυγρια, in pronunciation would the first γ be treated as a nasal γ (and thus romanized as congygria)?
Comment: Why the "close" votes?
Answer: The classical Latin name for this plant is coccygia (it occurs once in Pliny); the Greek name is κοκκυγία (occurs once in a Byzantine dictionary) and *κοκκυγέα (an emendation in one passage in Theophrastes). None of these has an -r-. The Botanical name coggyrgia (sic, with -gg- and -r-) seems to have been coined by Scopoli in the 18th century. It is quite misguided to attempt to explain it as an ancient Greek dialect form. It is probably a mistake on the part of Scopoli.
Answer: To answer your second question first -- yes, in the combination γγ the first gamma is always pronounced as a nasal, e.g. ἄγγελος angelos (not aggelos).
To the question in your title, no, there is no dialectal interchange of κκ~γγ, and I can't think of any Greek word that shows such variation. I have no explanation for the origin of the gg in coggygria, but note that the form coccygria also gets some Google hits.


What assembly reference should I add in order to be able to create an instance of the Image-class (C#, WPF)?

Question: I have created a Class Library containing several classes.
What assembly reference should I add in order to be able to create an instance of the Image-class?
It is a WPF-application created in Visual Studio 2010 using C#.
My code follows if anyone is interested.
Thanks in advance!
Anders Branderud
<code>    /// <summary>
    /// Create an image with certain image address and return it.
    /// </summary>
    /// <param name="imageAddress">Name of image file without jpg ending.</param>
    /// <returns></returns>
    ///<remarks>Adapted code from Microsoft-website</remarks>
    public static BitmapImage CreateAndDisplayImage(string imageAddress)
    {
        // Create Image Element
        Image myImage = new Image();
        myImage.Width = 200;

        // Create source
        BitmapImage myBitmapImage = new BitmapImage();

        myBitmapImage.BeginInit();
        //Image address
        Uri relativeUri = new Uri(IMAGE_DIRECTORY + imageAddress + ".jpg", UriKind.Relative);
        myBitmapImage.UriSource = relativeUri;

        // IMAGE_DIRECTORY + "/"
        // To save significant application memory, set the DecodePixelWidth or
        // DecodePixelHeight of the BitmapImage value of the image source to the desired
        // height or width of the rendered image. If you don't do this, the application will
        // cache the image as though it were rendered as its normal size rather then just
        // the size that is displayed.
        // Note: In order to preserve aspect ratio, set DecodePixelWidth
        // or DecodePixelHeight but not both.
        myBitmapImage.DecodePixelWidth = 200;
        myBitmapImage.EndInit();
        //set image source
        return myBitmapImage;
</code>
}
Answer: Image (as in System.Drawing.Image) is abstract. Use Bitmap (System.Drawing.Bitmap) which derives from it instead. Unless, for whatever the reason, you're doing your own implementation of Bitmap.


How to get a single uv island

Question: I have created a circle pipe and converted to mesh and get all the square uv. I want this all uv to me merge or to be overlap on each other to have a single uv island. I want to have a single texture on all island. With the snapping on and grab i can but they are 100 island. Any addon or suggestion to get a single island.

Answer: Preferably I would do this by setting custom seams and unwrap it from a certain viewport (orthograpgic camera top - left etc 5 on numpad and then the voewport of your choice).
If you have a seameless tiled texture instead, you may just want to avoid uv mapping completely or use it afterwards to bake your textures on your model, which means that you will be in need of a very nice and well unfolded pelt.
So, if you tend to follow the second method (since you have one seamless texture) use the mapping node in your material node editor and in case you insist for a quick unwrap, use unwrap from viewport w

How to get a single uv island


Can't break blocks when I change my gamemode back to survival

Question: I have been in survival and then I changed it to lan world so I can use cheats.  all the sudden, when I turn my gamemode back to survival I can't break blocks!!!!
This has been happening for the past few months and I want to fix my world.  I do not like when this happens to me because then I can't play my own survival/hardcore game.  How do I change this random glitch in my world back to normal?
Comment: What command do you type to change back to survival?
Answer: Maybe when you change it to survival, it changes it to Adventure Mode.  If you don't know what that it, its when you are in survival, but you can't break blocks without the correct tool. i.e - you have to use an ax to chop wood, pickaxe for stone. etc
With cheats, use the command  /gamemode 0  to change it to regular survival.
Hope it helps


Synchronous Buck Converter Mathematics

Question: Ive been trying to find a mathematical explanation on how a Synchronous Buck converter maintains continuous operation under ideal steady state conditions. I understand the underlying concept but i want to know how i can explain it mathematically (ideal case).
Comment: You can have a look at the answer I gave [here](https://electronics.stackexchange.com/questions/509898/where-does-the-negative-inductor-current-go-during-ccm-at-no-load-in-synchronous/509906#509906). There is nothing mysterious, it is just that the controlled low-side switch keeps conducting while the inductor current is zero (the diode would spontaneously block) and brings the inductor current negative until the high-switch turns back on again. In a no-load situation, the inductor average current is zero and it peaks above and below ground.
Comment: if you're looking for an ideal case and not concerned about switching losses / behavior then its exactly the same as a regular buck converter except your 1-Duty cycle is now your on time for the lower switch instead of the diode path. every single equation would still apply, again ideally.
Comment: Could you please provide this explanation mathematically possibly ?
Answer: This is the simplest and easiest switching converter to understand: -

The input voltage is modulated by the switch's duty cycle to produce an average value that corresponds with the required output voltage.

The LC acts as a low pass filter and converts the modulated duty cycle from above into a steady DC value.

There are mathematics involved if you want them to be but the words are simple enough and 100% accurate in defining the operation of two switches selecting either Vin or 0 volts.
If you want the maths of the LC filter then there are plenty of resources for this and a calculator to help you visualize things. The theory is not that involved so I've not bothered to repeat it here but, if you need it or help with it please ask.

Synchronous Buck Converter Mathematics


can resistance be found without knowing length?

Question: is it possible to find to resistance without knowing the length?
i am tryigng to solve a problem that requires me to find the resistance.I cant seem do so without knowing the length of the circuit which is not given.Is there something that shows resistance without knowing the length or am i just looking at problem all wrong?other details include: resistivity of the upper resistance=4ohm metre,resistivity of the lower resistance=2ohm metre,battery emf V=10pi ohm, radius of the circle=1m,angle between A and B is 60.is there a special relation between resistances in parallel?
Comment: Here's a hint: what do you know about the relationship between the radius of a circle and its diameter?
Comment: If all you know is the resistivity then you need to know the length because resistance = resitivity * length/area. However this is a somewhat special case. If you edit your question to give more details of the problem, and the ways in which you've attempted to solve it, then I'll have a look.
Comment: other details include: rho of the upper resistance=4ohm metre,resistivity of the lower resistance=2ohm metre,battery emf V=10ohm, radius of the circle=1m,angle between A and B is 60.
Comment: Using the arc-sector relationship for a circle.
Comment: See http://physics.stackexchange.com/q/78771/
Comment: Does the same apply here if the wires are identical?
Comment: See the related question http://physics.stackexchange.com/q/80933/ Resistances in a circular loop.
Answer: Some good things to remember for basic circuits are that parallel pathways have the effect of increasing the area available to current flow, and because of this always lower resistance -- at least in the basic circuits I know about.
Another thing I remember is adding inverses always amounts to the product over the sum:
(1/R1 + 1/R2 + 1/R3 + ...)^-1 = R1R2R3.../R1+R2+R3... } this is a relationship seen in many areas of physics, most notably (imo) for the reduced mass of a system, which can make many calculations much simpler. Since other people have basically already answered your question (the angle reveals the length), I thought I would give my two cents, I hope it moves your studying along a bit faster.
Also, unless I missed something too, I think the lower length should be 5 pi/3. If the path from A to B is a circle, then depending on how you write your fractions, the sum should be 6 pi / 3 or 2 pi. Does this also suggest how, simple as it may be, one of my suggestions might speed things up?
Comment: i tried and i too got 5pi/3 as the lower length.It has helped me. thank you
Answer: Hint
Length of the upper half is,
$$\pi /3*r$$
And the length of the lower half is
$$2\pi/3*r$$
$R_1$ and $R_2$ are in parallel.


iCloud and non-UIDocument files

Question: My app reads and writes audio files, using AVFoundation's methods for file operation.
I would like to incorporate iCloud sync, with the intended outcome of having my app's entire root Documents directory synced to the cloud.
I'm not really sure how to implement this. The Apple documentation says that iCloud syncing is free with files managed by UIDocument and that NSFileCoordinator needs to be implemented for all other file operations.
Do I need to somehow 'wrap' AVPlayer and AVRecorder's file reading and creation calls in that file coordinator?
Answer: In case of UIDocument you may get NSData after it is opened. Saving the data by UIDocument also convenient. This approach is preferable, IMHO.
In case of NSFileCoordination you should implement also NSFilePresenter protocol in the wrapper object of resource.
Also, you may use NSFileManager for download state handling and resource availability verification. Also, you may place your local files in iCloud by - (BOOL)setUbiquitous:(BOOL)flag itemAtURL:(NSURL *)url destinationURL:(NSURL *)destinationURL error:(NSError **)errorOut. In this case you   handle synchronization process by yourself.

iCloud and non-UIDocument files


Divergence theorem and periodic boundary conditions

Question: So, this is probably a very basic question, but nevertheless here it goes. Suppose we have a function $\phi$ defined on a spatial domain $V$ with closed boundary $\partial V$. Suppose also that $\phi$ satisfies periodic boundary conditions on $\partial V$. Then, divergence theorem states that:
\begin{equation}
\int\limits_V\nabla\cdot\phi(\vec{x}) d^3\vec{x} = \oint\limits_{\partial V}\nabla\phi\cdot\hat{n}dS\,,
\end{equation}
where $\hat{n}$ is the normal vector pointing outside of $\partial V$ (meaning, at least in my understanding, that $\partial V$ is orientable). So my question is, why is everyone assuming, in basically all of the textbooks I've read, that given the periodic boundary conditions, the term on the right vanishes? Why is $\oint\limits_{\partial V}\nabla\phi\cdot\hat{n}dS=0$? Feel like I'm missing some other condition on $\phi$, or something really simple is happening that I fail to see.
Answer: For the special case of $V$ being cuboid, $\partial V$ is made up of three pairs of opposite faces. Each pair of opposite faces are actually the same face because of periodic boundary condition. Therefore, the value of $\nabla \phi$ is the same on opposite faces. However, the normal vector in the surface integral is, by convention, outward-pointing. Therefore, $\nabla \phi \cdot \hat{n}$ will have opposite signs (but equal in absolute value) on opposite faces. The surface integral over one face will be exactly canceled by the integral over the opposite face.
Answer: I think the answer is rather simple in this case. PBC means that your scalar field $\phi(x)$ has the same value $\forall x \in \partial V$. Thus, if you "move along" this $\partial V$ curve, you are moving along curve where the function is constant, therefore gradient must be zero. You can think of the integral as an infinitesimal sum of terms which are all zero.
Comment: Thank you for your answer. So, in the case of three dimensions, if $V=L^3$ and, say, $\phi(y,x,0) = \phi(x,y,L)$, for the cases $\hat{n} = \hat{z}$ we would have, for example in the top face, $\int_0^Ldx\int_0^Ldy\frac{\partial \phi(x,y,L)}{\partial z} = 0$ because $\phi(x,y,L)$ does not depend on $z$? I'm asking this because $\phi(x,y,L)$ is certainly not constant (only respect to $z$)! Also, I fail to see the connection with periodic boundary conditions in that case...! Sorry, maybe I'm messing something up.
Comment: Sorry for the late reply. Yes, that is correct, $\phi$ is not constant overall, but it is constant along the curve you're moving on.


Any radio waves in spectrum of heat radiation?

Question: I'll like to know if heat radiation may also involve radio wave frequencies. If a battery is connected to a resistor,
does the radiation from the resistor also have frequencies in the radio wave ranges?
Comment: Yes, but only a negligibly small amount.
Answer: Checking out this link to Wikipedia, you see that (if you approximate) the resistor as a black body, then "Black-body radiation has a characteristic, continuous frequency spectrum that depends only on the body's temperature, called the Planck spectrum or Planck's law" given as:
$$B_f(T) = \frac{Cf^3 }{\exp(Df/T) - 1}$$
where $C, D$ are constants and $B_f(T)$ is (roughly speaking) "the amount of radiation emitted by the body at the frequency $f$ when its (absolute) temperature is $T$". The shape of this distributions is shown in a figure in the link, with the curve called the "classical result" is an approximation and what was thought to be correct before Planck derived the correct law). The $x-$axis is labelled "wavelength" and the relationship between wavelength $\lambda$ and frequency $f$ is $\lambda f = c$, where $c$ is the speed of light. From the figure, you can see a continuous distribution over the whole electromagnetic spectrum. The peak value of emission is given by Wien's Displacement law (also mentioned in the article) and for the resistor would be probably be in the (far)infra-red region of the spectrum, far from the frequency range of radio waves.
Answer:
does the radiation from the resistor also have frequencies in the radio wave range?

When you remember how a radio wave is produced you can recognize wether it is possible or not to produce radio waves with a resistor. For the sake of simplicity I'll talk about flat resistors (not coils). Connect one pole of your electric source to one end of the resistor and the second pole to earth and switch your source on and of. Pushing by this way electrons forth and back the resistor you get a periodical lost of energy with the frequency of your switch (or the alternating current frequency). The efficiency of our radio generator and the radiated power depends from the length of your resistor, the resistance and the frequency of the source.

If a battery is connected to a resistor

you get a half radio wave and nothing more. What you get - if you connect both ends of a resistor to a battery - is electromagnetic radiation. The flow of electrons through the resistor is accompanied by permanent collisions and by this with permanent accelerations. And as you perhaps know any acceleration of electrons is accompanied with the emission of photons respectively EM radiation. This EM radiation is of very different wavelengths (EM radiation from thermic sources) in contrast to radio waves which are produced by a radio generator.


How to change the position of docky notifications?

Question: I'm using docky in Ubuntu 11.10 with gnome-shell and sometimes the notifications cover the dock. It would be great if the position of the notifications can be changed.
Answer: There is a tweaking tool just for this purpose. However, it seems to involve installing a different version of notify-osd. This is from the link above:

Install the patched (configurable) NotifyOSD in Ubuntu 11.10 or 11.04:
sudo add-apt-repository ppa:leolik/leolik
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install libnotify-bin
pkill notify-osd

Install NotifyOSD Config:
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install notifyosdconfig


What is the recommended page size for GETting sales orders through REST API calls?

Question: I am trying to make a GET call to the Magento 2 REST API to get all the sales orders. What is the recommended page size I should be using? Is there any upper limit on the page size?
Comment: "Is there any upper limit on the page size" i don't think so. but use minimal to speed up  process.
Comment: It really depends on your app... pick a lower number to start with (eg. 20). if you need to just increase it later.. you could also provide a dropdown where the user can select the preferred amount.
Answer: Page size is not limited by Magento. However, at some Page sizes your Magento instance will start running out of memory and will not be able to process the request. The limit obviously depends on your hardware.
There are two options:

Implement proper pagination on your application with configurable
page size
Try "Infinite scroll". This approach may not work
perfectly on instances with frequently created orders, because
Magento REST API does not support cursor-based pagination (which is designed for such scenarios)


Did Hadrat Muhammad (SAW) marry any slave?

Question: He had intercourse with slave https://sunnah.com/nasai:3959 but did he marry any slave? Can you tell me names of his slave wives?
Answer: No.
A man can have lawful relations with a slave woman by the following means:

Concubinage (تسري) rather than marriage. This can be done with a slave that he owns himself completely as ownership is inclusive of and greater than the rights granted by a marriage contract. The Prophet ﷺ did have concubines like Mariyah al-Qibtiyyah and Rayhaanah. The hadith you have linked to is about his concubine Mariyah. If you are asking about this instead of marriage then see: Did the Prophet (SAW) have a sex slave?

Marriage with a slave woman after freeing her, in which case she no longer remains a slave. The Prophet ﷺ did have wives who were once captives\slaves before they were freed and then married, such as Juwayriyah bint al-Harith and Safiyyah bint Huyayy.

Marriage to a woman while she remains a slave. The Prophet ﷺ did not have any slave wives.

The last one is because the Quran says the following about such a marriage:

ومن لم يستطع منكم طولا أن ينكح المحصنات المؤمنات فمن ما ملكت أيمانكم من فتياتكم المؤمنات والله أعلم بإيمانكم بعضكم من بعض فانكحوهن بإذن أهلهن وآتوهن أجورهن بالمعروف محصنات غير مسافحات ولا متخذات أخدان فإذا أحصن فإن أتين بفاحشة فعليهن نصف ما على المحصنات من العذاب ذلك لمن خشي العنت منكم وأن تصبروا خير لكم والله غفور رحيم
And whoever among you cannot [find] the means to marry free, believing women, then [he may marry] from those whom your right hands possess of believing slave girls. And Allah is most knowing about your faith. You [believers] are of one another. So marry them with the permission of their people and give them their due compensation according to what is acceptable. [They should be] chaste, neither [of] those who commit unlawful intercourse randomly nor those who take [secret] lovers. But once they are sheltered in marriage, if they should commit adultery, then for them is half the punishment for free [unmarried] women. This [allowance] is for him among you who fears sin, but to be patient is better for you. And Allah is Forgiving and Merciful.
— Quran 4:25

This means that it is not permitted to marry a slave woman unless the following conditions are met:

The person can not afford to marry a free woman. The Prophet ﷺ had free wives such as Sawdah, Aisha, Hafsa,  Umm Habibah, Zaynab bint Jahsh etc. Further it was permitted for him to marry without mahr and consent so he could always afford to marry a free woman. So this condition was not fulfilled.
The person fears committing fornication. The Prophet ﷺ was infallible and so did not risk committing adultery or any other sin and so this condition was not fulfilled.

So it was forbidden for him to marry slave women, and hence he did not ever marry any slave woman.
Ref:

وأما ما حرم عليه ... نكاح الأمة
The things that were forbidden to the Prophet ﷺ as his specialty include: ... marrying a slave woman
— Tafsir al-Qurtubi also see Kashshaaf al-Qinaa' and Mawaahib al-Jaleel, and  Asna al-Mataalib


Is energy conserved?

Question: Let's say that I am lifting an object upwards against gravity , let's say that the force which I apply is greater than the force of gravity ,so the object accelerates , now when I want to stop the object in mid air I simply decrease my force which I am applying and let the object decelerate to a stop . I know my applied force is non-conservative and hence alters the mechanical energy , however if I drop the object the energy conversion will be from mgh to kinetic energy , however my problem is when gravity did negative work during the deceleration where did the extra kinetic energy which I applied go , was it conserved or not?
Answer: Suppose that you want the object to stop then all you need to do is to no longer apply a force on the object, if you continue applying an ever decreasing force then the process described below will take longer.
The object will continue to rise and eventually stop due to the attractive force of the Earth acting on the mass.
The Earth-mass system therefore gained gravitational potential energy at the expense of the kinetic energy of the mass or you could say that for the mass alone system the gravitational force did negative work on the mass which resulted in the kinetic energy of the mass becoming zero.
Now on top of that if you did some work on the mass then all that would have happened is that the mass would have gained more height.

Is energy conserved?


MySecureShell SFTP "Authentication Failed"

Question: I am trying to connect to my SFTP server (Configured with MySecureShell), but keep getting the response "Authentication Failed". The username and password is correct.
I created an SFTP group:
groupadd sftp

Then made a user for that group with the shell:
useradd WebFiles -m -s /usr/bin/MySecureShell -g sftp

And gave him a password
Then appended the /etc/ssh/sftp_config file with:
<Group sftp>
    Download                0
    Upload                  0
    StayAtHome              true
    VirtualChroot           true
    LimitConnectionByUser   10
    LimitConnectionByIP     10
    IdleTimeOut             300
    HideNoAccess            true
</Group>

But it wont let me connect
My final aim is to have the user WebFiles to have access to the /var/www directory, but first I just need to get him to be able to connect Lol
Any help appreciated :D
Answer: Have you tried to add the home path here :

Home /var/www/

Download                0
Upload                  0
StayAtHome              true
VirtualChroot           true
LimitConnectionByUser   10
LimitConnectionByIP     10
IdleTimeOut             300
HideNoAccess            true

Tell me if that works.


How to use a 10 pin dip switch on a 8x3 Encoder (IC 74LS148)?

Question: I've been trying to get an 8x3 encoder (IC 74LS148) working using a 10 pin dip switch, I simply connect the 1-7 ON sides of the switch as inputs for the encoder and the OFF sides of the switch to the VCC. The A0 output of the Encoder I get is always a High logic level or "1" (LED light turns on) regardless if any switch is on or not.
Comment: what is the part number for your DIP switch?
Comment: there's no part number, the only writing I can see are "EGE" (logo maybe) "ON" and numbers "1-10"
Comment: If it has 10 switches, then I assume you mean 20-pin, not 10-pin.
Answer: Since the the inputs to the 74LS148 are active low, you actually want the common lead of all the switches to go to ground, instead of VCC.
This is why the outputs of the encoder are always high -- if the switches are off, the floating inputs act as high inputs, and when a switch is on it is also driving the input high.  So there is no way to drive any of the inputs low.
Besides tying the common lead of the switches to ground, I would also connect 4.7K pull-up resistors between each of the inputs of the encoder to VCC, rather than leaving them floating.  It's just better practice for TTL (74LS series), and required for CMOS (74HC or 74HCT series).  This way it will work for both types of chips.
Comment: To be honest, I didn't really know how to use the dip switches, but I get it now, thanks.. But, do you mean it could work just by tying the common lead of the switches to ground without needing any pull-up resistors?
Comment: @user2868984 yes, it will probably work with a 74LS148 chip.  So you can just move your common lead from VCC to ground and try it.  I'd still add the pull-ups though.
Comment: well, yes I think I need to add the pull ups because now it does the opposite (output always low).. Thanks..
Comment: @user2868984 First of all, the resistor values can be anything from 1K to 10K, don't worry about making them exactly 4.7K.  Second, make sure your switches are all off to begin with, and then turn only one on at a time (if you do turn on more than one, there is a table in the 74LS148 datasheet which will indicate what the output should be).
Answer: With your DIP switch connected as described you will need to provide a way for the inputs of the decoder chip to go low when the switch is off. That said, when using a chip like the LS148 you may want to rearrange the connections as shown below and use pullup resistors to establish the high levels on the inputs to the chip.
Comment: The 74LS138 you show is doing just the opposite of what he wants, the 138 takes 3 inputs and expands it to 8, he is taking 8 inputs and encoding it as 3.  In any case, in your example only inputs A, B and C should come from switches.  I don't know why you are connecting the enable lines of the '138 (G1, G2A and B) to switches also.
Comment: @tcrosley - I fixed for '148. I read the question in dyslexic manner.


Android: How to link my own static libraries correctly?

Question: I have an Android project written in C++ and have a problem in linking phase. The code is put in some static libraries which should be linked together.
I have found a lot of questions and answers on the net about this topic and most of them suggest to put my libraries to LOCAL_STATIC_LIBRARIES in the Android.mk file. But, if I do this, I found the content of LOCAL_STATIC_LIBRARIES is simply ignored: my libraries are not linked, and adding any dummy text here does not generate any error or warning message.
I tried it this way:
LOCAL_STATIC_LIBRARIES := MyLib.a

or with full path:
LOCAL_STATIC_LIBRARIES := $(LOCAL_PATH)/MyLib.a

none of them worked.
If I put my static libraries to LOCAL_LDLIBS then it is linked, but I got a warning message about non-system libraries are used, and probably the build will be wrong.
The content of my Android.mk file is:
LOCAL_LDLIBS := $(LOCAL_PATH)/MyLib.a ...

and I got this message:
Android NDK: WARNING:jni/Android.mk:myapp: non-system libraries in linker flags: jni/MyLib.a
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the
Android NDK:     current module

I could not find how to use LOCAL_STATIC_LIBRARIES right way, please help me!
I have android-ndk-r9 and android-sdk_r22.2.1 on a OpenSuSE x86 and using target=android-18
Comment: hello did you solve your problem ?? coz i am also facing the same. If you can help me ///
Answer: See JBL's answer here.
The LOCAL_STATIC_LIBRARIES variable does not work that way. First you need a section that defines the library you want to include:
include $(CLEAR_VARS)
LOCAL_PATH = .
LOCAL_MODULE := curl
LOCAL_EXPORT_C_INCLUDES := ../curl/include
LOCAL_SRC_FILES := ../curl/lib/libcurl.a
include $(PREBUILT_STATIC_LIBRARY)

THEN, you can include it using
include $(CLEAR_VARS)
LOCAL_MODULE = mylib
CFLAGS = ...
...
LOCAL_STATIC_LIBRARIES = curl
include $(BUILD_STATIC_LIBRARY)

Answer: Most probably the problem lies in that you are giving the extension of the library:
LOCAL_STATIC_LIBRARIES := MyLib.a

I think, it should be written as:
LOCAL_STATIC_LIBRARIES := MyLib


Can't access my own windows 7 backup image? (Want to only restore dropbox folder)

Question: I just got windows 8. Since dropbox takes a bit of time to download 100GB I just wanted to transfer the dropbox folder from the windows backup image. But that doesn't work!! Is it possible that the dropbox folder was not included? Regardless I cannot even access my older user folder when mounting the disk image. Explorer just works and works and never gains access. The backup is there, because I have restored it completely to another HDD. Is there some security feature I've missed? I have tried searching for the dropbox folder using windows own backup tutorial, still nothing.
Answer: Download Total Commander, open it as Administrator, and you'll have access to, at the very least, copy the files.
Moving them will require additional privileges, which means writing to the VHD, which won't work.
That's why it's not working in Explorer, because Explorer needs privileges to access the files under your current user context.
Comment: Perfect. Amazing that windows 8 can't do this.
Comment: It can, but it's more complicated. You'd need to elevate your Explorer to higher privileges, and it doesn't always work. TC always works though, which is why I use it for this sort of thing.


Can I transfer pre-installed apps from a device with a broken screen to a different one?

Question: So I have an Ematic Funtab Mini running Android 4.0 (Ice Cream Sandwich) OS that now has a broken screen that is totally unresponsive. I also have a Craig 7" TouchScreen Tablet running Google Android 4.0, Flash 11.1. I can't access anything on the Funtab, or find any place that can replace the screen. It came with a bunch of kids apps including a full versions of Angry Birds, Cut the rope, Where's My Water and a few more. Is it possible to transfer those apps (and maybe the data, but particularly the apps) to the Craig? I didn't have the Funtab long enough to use Google Play to back up the apps. So, any help in finding out if it's possible to transfer the apps would be greatly appreciated!
Comment: Is it really the apps you want to back up, or the data? You can just install any apps from Google Play onto your new device, even apps you paid for.
Comment: It's really the apps. The Funtab came with a bunch of kids apps including a full versions of Angry Birds, Cut the rope, Where's My Water and a few more. We didn't have the tablet but a few says before the screen cracked! If GooglePlay was even on it i didn't have time to back up to it.
Answer: You can't transfer system apps (that is, the apps that came preinstalled) to another device or back them up. The apps will be built into the Funtab's ROM (or system image), and even if you could extract the files, they almost certainly will have copy protection to stop you using them on a different device.
To make an analogy, imagine you bought a PC and it came with PowerDVD. Now imagine you were to break the PC and buy a completely different one from a different manufacturer. You wouldn't have an install disk for PowerDVD, and the old installation would have copy protection so you can only use it on that specific model of PC. If you wanted to install PowerDVD on your new PC, you'd have to go out and buy it. Preinstalled apps on Android are no different.
If you'd downloaded Angry Birds from Google Play (or most other marketplaces), you'd be able to install it on any device with your account. You wouldn't need to back it up: Google would know that you'd bought it, so they would let you download it again for free. Preinstalled apps don't work that way, though.


Making certain GameObjects visible for a camera

Question: I have 2 cameras in my 2D game.
One displays gameobjects normally, and the other camera draws some of these gameobjects reflected (scale.y *= -1). The reflected camera would draw only objects in the "Water" layer, and I would change the layer of the GameObjects I want to reflect on the precull and postrender functions. This way I can decide which GameObjects would be reflected, changing the layer on the fly at runtime, which is a requirement.
<code>-Precull: Change the desired GameObjects layer to "water", and apply scale.y*= -1

-OnPostRender:  Change the Gameobjects layer to their original value, and apply scale*= -1
</code>
This was working correctly when my objects were simple, but now my objects are more complex, and I can't rely on changing the layer of the gameobjectson the fly, as I can't tell what their original layer was for each part of the object, in order to revert the changes applied during the precull.
Is there anyway to tell a camera which objects should it render besides using the culling mask?
Answer: You could use shaders instead.
Here is a link of one that may help
http://wiki.unity3d.com/index.php/SurfaceReflection.


What determines starting TP in Chain Attacks

Question: When starting a chain attack, each character starts with some number of TP.  The amount is different for each character, and it's not clear what influences it.  Knowing what changes this number could help ensure more powerful or consistent chain attacks.
Answer: The initial TP is always a set number during the first chain attack order under normal conditions:

Main character: Noah (30), Mio (25), Eunie (25), Taion (35), Lanz (15), and Sena (15)

Heros: Ethel (25), Valdi (20), Zeon (25), Teach (30), Riku & Manana (15), Gray (35), Isurd (40), Juniper (25), Ashera (15), Alexandria (30), Monica (30), Fiona (15), Triton (10), Ghondor (35),  Cammuravi (15), Segiri (20)

 Miyabi (15), Nia (15), Melia (35)

There are ways to increase the base TP for the characters, and this is can be done through various means:
Ways to increased the starting base

Equipping the Lost Vanguard skill Now That's Tactics can increase the base TP by 5 at rank 5, and then 7 at rank 10.

Equipping the Soul Hacker skill Deeply Tactical can increase the base TP by 5.

Equipping the Veneris Rings accessory can increase the base TP by 10.

Ways to increase the TP during chain orders

Teach's heroic chain bonus can increase all active characters base TP by 10, including the first chain order

Riku & Manana's heroic chain bonus can increase everyone's TP by 7

 Miyabi's heroic chain bonus can increase Mio's TP, including the first chain order
Comment: I'm not sure if these are all of the conditions that apply, and I'll update as i find them
Comment: I can't believe I didn't realize it was just fixed, but in retrospect, that must be correct.  Poor Lanz and Sena just aren't tactical enough, I suppose!
Comment: @Tal On the contrary, I would say it's even *more* tactical.  I often start the chain order off with the lower TP attackers to ensure I don't go over 100% in a single attack, and save the higher TP values once I reach a higher chain order percentage
Comment: Base TP is also fixed for each hero, not just the main six. [(full list with spoilers)](https://www.xenoserieswiki.org/wiki/Chain_Attack_(XC3)#TP)


Polyakov Loop and Chemical Potential

Question: I have read in a paper (http://arxiv.org/abs/1203.3556) that in a thermal field theory, the chemical potential is $\mu=T \ln P$ where $$T^{-1}=\int_{0}^{\beta} \sqrt{-\xi^2}dt,$$ $\xi$ is $\partial_t$, and $P$ is the Polyakov Loop: $$P=e^{\int_{0}^{\beta} A_a \xi^a dt}.$$ How chemical potential is related to the Polaykov Loop? I did not find anything related in the web that's why I asked.
Comment: Comparing with thermodynamics, T must be the temperature and P must represent the pressure. Also, that "xi" over there should be a Killing vector associated with time translations, right? I don't understand the integral giving the temperature. What is beta? Is it the inverse temperature? If yes, then the integral may say something like T=T I guess which isn't very useful. I'm not even sure what you are integrating over there. Excuse my many questions, but I believe your question needs more clarification and explanation of the equations you wrote.
Comment: @PanosC. Yes, that's right. The first equation is almost obvious but the second is my question.
Answer: I think the second formula is also not very profound. This is just based on the fact that the chemical potential
$$
\Delta S = \int dt \, \mu Q
$$
enters the action like the zeroth component of an (imaginary) $U(1)$  gauge field $A_\beta=(i\mu,\vec{0})$. Note that this is the Polyakov line for a $U(1)$ background field, not the Polyakov line of (for example) the dynamical gauge field in QCD.
Comment: It has profound consequences though!

Polyakov Loop and Chemical Potential


Poisson regression residuals diagnostic

Question: I have done a poisson regression on my data set and am now looking to investigate the model fit. I notice that the fitted values from predict() in r give me the pre exp transformed values. For diagnostic purposes, should I use the predict() values or the estimated response(a la type=response) to pair up with deviance, pearson or response residuals?
Comment: While your question is really a general one about suitable GLM diagnostic plots, I'm curious -- was there something about the default given by plotting the fitted model that makes you disinclined to use it? ... as in `myglmmodelfit <- glm(y~x1+x2,family=poisson)` (or whatever) followed by `plot(myglmmodelfit)`?
Answer: As explained here, neither deviance nor Pearson residuals are ideal for diagnosing Poisson models, as they will appear visually inhomogeneous for low count rates, even if the model is entirely correct.
Instead, you can use the DHARMa package, which implements the idea of randomized quantile residuals by Dunn and Smyth (1996). Here an example with a missing quadratic predictor in the glm. Note the comments about testing for overdispersion in the vignette.
<code>library(DHARMa)

dat = createData(replicates = 1, sampleSize = 300, intercept = 0,
           fixedEffects = 1, quadraticFixedEffects = 2,
           randomEffectVariance = 0, family = poisson())

fit = glm(observedResponse ~ Environment1 , data = dat, family = poisson)
res = simulateResiduals(fit)
plot(res)
</code>

Poisson regression residuals diagnostic


Ubuntu server installer with SSHD

Question: I really want to get a fresh, network install of Ubuntu server on my old computer. No cable laying around, so is there some network installer for Ubuntu server that starts up a SSH server as soon as the thing starts so it can be remotely installed?
Answer: try:
https://help.ubuntu.com/community/Installation/Netboot
what os are you currently running?

Ubuntu server installer with SSHD


Guessing the correct answer of a multiple choice question based on the responses

Question: I have around 50K multiple-choice questions and each has been answered by three different students. Each question has 5 options. There is a high chance that a student answered more than one question (1-300 questions). We do NOT know what the correct answers are and we want to guess them based on the behaviour of the respondents. I was wondering if there is any field in the math that can handle questions like this. I hope here is the right place to raise this question.
Comment: Three students each answered 50,000 questions?  Your Institutional Review Board allowed this?
Comment: No, there are more than three respondents in this problem (something around 500 respondents). This is a crowdsourcing project, there is no restriction on the number of questions per respondent.
Answer: I really enjoy your question.
Since we want to know the answers we kind of need to know who we can or can not trust. Let $s_1, s_2,\cdots, s_n$ be the students ($n\sim 500$). Now let $t_i$ be how much we trust student $s_i$, if $t_i<0$, $s_i$ is a bad student, if $t_i= 0$, $s_i$ is ordinary and if $t_i>0$, $s_i$ is a good student
. If we can trust in $s_i$ and $s_j$ gives the same answer as $s_i$ then we can trust $s_j$ a bit more. I'll assume that $t_i$ is the mean between all agreements (with positive weights) and disagreements (with negative weights) between $s_i$ and the others, then
$$ t_i = \frac{1}{|Q_i|}\sum_{q\in Q_i}\frac{1}{2}\left( \sum_{ j: s_i\text{ agree with }s_j\text{ in }q }t_j - \sum_{ j: s_i\text{ disagree with }s_j\text{ in }q }t_j \right) $$
where $Q_i$ is the set of all questions $s_i$ answered. We can also assume that, overall, we can trust people's answers, so
$$ t_1+t_2+\cdots + t_n = 1 > 0 $$
That gives you a linear system. The system has $n$ variables and $n+1$ equations, I don't know if it is possible that this system has no solution or has multiple solutions. It need to be studied. But you can code and see what happens.
If the system has a solution we can rank the answers by how reliable the students are. That also gives us an indicator of how much we can trust the solution.
That was my approach. But a lot of mature things exist in the literature.
You can also see this problem as a "propagation of trustiness" were the more reliable are the individuals that agree with you, the more reliable you are. That is exactly what Google Page rank originally did, the students were webpages and links between webpages were answers in commom. It can be solved with a bit of linear algebra and Markov Chains, see this or this or even this (with the Python code, but in Portuguese). Other ways of propagating trustiness and distrustiness can be viewed here.
After solving the trustiness problem, you will always need to guess if the more trusted people were the bad or the good students, or just good representants of the commom sense. If they are students answering about math, history, etc., like SAT questions, then, I think, it makes sense to assume that the most trusted are the best.
Comment: In the end it is all about finding the final distribution of a Markov chain :)
Comment: Thank you so much for the detailed answer. I found this article "Maximum likelihood estimation of observer error-rates using the EM algorithm" as something that I was looking for. It makes a. confusion matrix for each respondent to measure their error rates and iteratively estimates the correct answer until convergence.


Effect of rectifier input frequency on output voltage

Question: Does changing the input frequency of a transformer rectifier change the output voltage, given that the input voltage is constant with no voltage regulator or protection circuit on the output?
Answer: Assuming all components are perfect, and there are no other components involved, the answer is no.
However, you will usually have an output filter/resevoir capacitor. If the input frequency is increased, this will droop less between half-cycles, and so increase output voltage slightly.
The transformer may have a low primary inductance, and be loading the input supply. Raising the frequency will reduce this effect, and raise the output voltage slightly.
The transformer may be close to saturation, and so be loading the input supply. Raising the frequency will reduce this effect.
The transformer may be operating somewhere near to resonance (unlikely if it's iron and mains, but possible if it's ferrite and driven at 10s to 100s of kHz). If so, increasing the input frequency can dramatically alter the output voltage, either up or down, as it swings through resonance.
Answer: Assuming a basic system consisting of transformer, rectifier and output filter, we can make the following considerations:
The transformer
Transformers made to operate at line frequency, having a magnetic core (an iron-silicon alloy) material, which can accept a magnetic flux density of about 15000 Gauss or less. This applies to line frequency (50/60 Hz).
When the frequency increases, so do the losses by hysteresis and eddy currents. The effect is that the core accepts less magnetic flux density and saturates quickly, increasing its temperature and losing performance.
The rectifier
Common rectifier diodes used to rectify power (from 1 A to ~ 300 A) have maximum operating frequency in the order of 1 kHz. When this level is exceeded, the response of the diode becomes critical (reverse recovery time), which drastically reduces its output due to the switching.
The output filter
The output filter may be capacitive or inductive-capacitive. In either case, the cutoff frequency is quite low, so input frequency increase implies that the output will be much attenuated by filtering.

In the case that the operation frequency is lower, the rectifier system critical component is the transformer which saturates quickly.


question about orphan transaction pool

Question: Suppose I am a full node and a transaction C arrives at me. I didn't find its father, so I put it in the orphan transaction pool. After a while, C's father B arrived at me. But I also didn't find B's father. Assuming these transactions are legitimate, what should I do with the orphan transaction pool in this case?
Should I kick C out of the orphan transaction pool since C has father?
Or both B and C stay in the orphan transaction pool?
Answer: For a transaction to be valid, the UTXOs being spent in its inputs must exist. This is a transitive property. If the parent transaction is an orphan, you cannot be sure that its inputs exist, and therefore transitively, you cannot make any determination about the child.
All transactions that you cannot fully connect to the UTXO set should remain in the orphan pool.

question about orphan transaction pool


2005 toyota tundra double cab special edition - rear axle seal replacement

Question: Is this vehicle safe to drive if needing a rear axle seal replaced? It is leaking and unsure what oil needs to go back in her ... appointment booked for next week, but wondering if its safe for use until then?
Answer: Your truck should be fine to drive as long as you take the following precautions. The main thing is you ensure you keep the gear oil topped off to where it should be. Gear oil doesn't leak like out like engine oil. You should only need to top it off once or twice to maintain the gear oil level (unless it's really leaking --- I'm assuming it isn't gushing out, lol). The only other precaution to take is making sure the gear oil isn't getting on your brakes, which is a possibility. If it looks like it's getting onto your brakes, you'll want to stop driving it as a safety precaution.
NOTE: Images and directions were obtained from this website. Full instructions for replacing the gear oil can be found there.
I believe your truck requires 75w85 gear oil, but 75w90 should work just fine for the mean time. You can get the gear oil at pretty much any parts store or Walmart.
To check your fluid, there should be a 24mm plug in the rear differential which will be below centerline (half way point of the differential) on the back cover:

You'll want to use this hole to fill this up the gear oil level until you have less than 5mm of space between the drain hole and the top of the gear oil. If you use the tip of your little finger (to the first joint) and can feel the gear oil through the hole, you should be in good shape.
Answer: Axles don't hold much oil and if you don't know how much is left in I wouldn't risk it without topping it up


Beginning jasperReport/iReport with Grails

Question: I want to create a report for my domain class instances but not all, just the ones user selected in the GSP table (selecting checkboxes). On my report  I will also have some logic - few conditionals, some calculations etc. I would also have to get some additional data from database. How do I do this? Should I get values of selected checkboxes in cotroller and pass it to jasper cotroller? Something like this:
GSP:
 <g:each in="${books}" var="bookInstance">
         <g:checkBox name="book_${bookInstance.id}"/>
 </g:each>

Action:
def bookReport = {
    def bookList = []
    params.each {
        if(it.key.startsWith("book_")){
            bookList.add((it.key - "book_") as Long)
        }
    }

    def bookCriteria = Book.createCriteria()
    def books = bookCriteria.list {
        'in'('id',bookList)
    }
    chain(controller:'jasper', data:books, action:'index', params:params)
}

I used iReport for report creation. I've tried creating report without SQL query and parameters. My logic was that if I pass a map of domain instances to jasper controller as I did in the example above I dont need to specify data source in report. But I get an empty report.
I also tried seting the report datasource to my database and report query to this: select * from book where $X{IN,id,books}. In that case, no matter what I select report is created for all book instances.
Answer: Have you tried...
chain(controller:'jasper', model:[data:books], action:'index', params:params)

...while leaving the SQL string empty in your .jrxml?


Standard sorting functions in SML?

Question: Are there standard sorting functions in SML? The documentation on the Internet is so scarce I couldn't find any.
Comment: what are you trying to sort?
Comment: I don't know what you mean by scarse, but the [SML Basis Library](http://www.standardml.org/Basis/) homepage is a good place to look up functionality
Answer: There is no sorting functionality defined in the SML Basis Library, but most implementations extend the basis library and add extra functionality.
As such MosML has both an ArraySort and a Listsort module, and SML/NJ has a LIST_SORT signature with a ListMergeSort implementation. It also features some other sorting features on arrays as MosML. See the toc of the SML/NJ Library Manual, for a full list.
Answer: As Jesper Reenberg points out, Standard ML compilers have each their own (non-standard, ironically) sorting libraries. Since the documentation for these lacks examples, here is how to sort a list of strings in ascending order using the various modules:

In SML/NJ and MLton, using the ListMergeSort.sort function:
- fun sortStrings ss = ListMergeSort.sort (fn (s : string, t) => s > t) ss;
[autoloading]
[library $SMLNJ-LIB/Util/smlnj-lib.cm is stable]
[autoloading done]
val sortStrings = fn : string list -> string list
- sortStrings ["World","Hello"];
val it = ["Hello","World"] : string list

The quirk with this library function is that it takes a "greater than" boolean predicate. Since Standard ML's > operator is overloaded, but defaults to int, I have to somehow explicitly annotate that I'm comparing strings.
In Moscow ML, using the Listsort.sort function:
- load "Listsort";
> val it = () : unit
- fun sortStrings ss = Listsort.sort String.compare ss;
> val sortStrings = fn : string list -> string list
- sortStrings ["World", "Hello"];
> val it = ["Hello", "World"] : string list

The quirk with this library is that Moscow ML's interactive REPL does not auto-load Listsort. Typing load "Listsort"; is only necessary in the interactive REPL; when compiling programs, load is not used.
In Poly/ML, there is no library for sorting, so you have to define your own sorting function.

If neither of these sorting functions are sufficient, here is a number of other sorting functions written in Standard ML:

True QuickSort in Standard ML compares a naive QuickSort (that isn't really a QuickSort) with an implementation of Hoare's algorithm by John Coleman.
Rosetta Code's MergeSort in Standard ML:
fun merge cmp ([], ys) = ys
  | merge cmp (xs, []) = xs
  | merge cmp (xs as x::xs', ys as y::ys') =
      case cmp (x, y) of
           GREATER => y :: merge cmp (xs, ys')
         | _       => x :: merge cmp (xs', ys)

fun sort cmp [] = []
  | sort cmp [x] = [x]
  | sort cmp xs =
    let
      val ys = List.take (xs, length xs div 2)
      val zs = List.drop (xs, length xs div 2)
    in
      merge cmp (sort cmp ys, sort cmp zs)
    end

Answer: Here is a standard quicksort
fun qsort(func) =
    let fun sort [] = []
          | sort (lhd :: ltl) =
                sort (List.filter (fn x => func (x, lhd)) ltl)
              @ [lhd]
              @ sort (List.filter (fn x => not (func(x, lhd)) ltl)
    in sort
    end

Just throw in some comparator (function that takes two elements with same type and return boolean) and it will return a sort function for you
If you got anymore question don't hesitate to ask. :)
Comment: by the way, this sorter will preserve order if and only if func(x,y) = false for x = y
Answer: How about this for sorting a list? You could always use reverse to get the reverse.
- fun sort(L) =
   if L=[] then []
   else if tl(L)=[] then L
   else merge(sort(take(L)), sort(skip(L)));
 val sort = fn : int list -> int list

See here.
Comment: No you have to create your own
Comment: What are merge, take and skip? Sorry to ask, but there's really zilch documentation out there.
Comment: So I assume there isn't a standard sort function in SML, right?
Answer: here is my sml sorting algorithm
fun sort list = foldr (fn (x,lst)=> List.filter (fn a => a < x) lst @ [x] @ List.filter (fn a => a >= x) lst ) [] list;

sort [5,1,5,0,2,5,~2,5,~10,0];

output: [~10,~2,0,0,1,2,5,5,5,5]

I hope it helps

Standard sorting functions in SML?


Optical activity

Question: I was studying about the optical activity of compounds. And I found , it is written that the chirality of a molecule is the necessary and sufficient condition for a molecule to be optically active. I mean if  a molecule is chiral then it ia optically active. But to check chirality of a compound we have assure that the molecule is unsymmetrical and to check whether it is super imposable on ita mirror image or not. I think this process of checking the optical activity of a molecule is very cumbersome. I mean when there will be more than one chiral centres in the compound . Is there any other aid to check the optical activity easily?
Comment: Meh, I wonder what you'd tell about chiral compounds *without* chiral center...
Answer: If you find imagining and superimposing mirror images cumbersome, buy a molecular set. This will help. There is no short-cut in science and you are right sometimes very experienced people have difficulties in imagining these things especially if the molecules are complex. Models help them. There are various types of chiralities-having a chiral center is not a necessary condition. You will study a subject called group theory which will provide you a rigorous test for predicting optical activity. There are many molecules which do not have a single chiral center yet they are optical active. A simple example is that of binapthol (check Google images to see its structure). They are called atropoisomers and they are optically active.
Measuring optical activity by an experiment hardly takes 5-10 minutes in a polarimeter.

Optical activity


Placement of Electrodes for Electrochemistry?

Question: I'm kind of curious as to the relationship between resistance and the yield of electrochemical methods. If I have my electrodes rather close together in a conductive solution the resistance will be smaller than if I had them further apart and more current can flow. Would there be any penalty for having the electrodes close together like this? Will I miss some ions in solution, or are they distributed equally in solution and so will always move towards the electrodes as some will be taken out of the solution as gases (such as electrolysis of (H2O -> 2H2 + O2))?
Answer: It really depends on the process and how
homogeneous electric filed is needed. The more are electrodes close together, the inhomogeneity will be greater.
The second problem will be with the homogenity of the solution. You can assume, that electrolyte is kinda homogeneous in a bulk. But more close you get to the electrode, the more is the electrolyte separated.
Ions, as a charged particles, are transferred to near electrode surface.


Can the first zombie player spawn the second zombie player's zombies?

Question: With the card "There's too many", in a two zombie player game, can zombie player 1 spawn zombie player 2's zombies if their remaining figures are out or are they forced to move the existing ones already on the board?
Answer: No.
According to the rules:

If there are two Zombie Players, each of them has a separate Zombie Pool of 7 Zombies each. One player takes all the Green Zombies, the other all of the Brown Zombies. Players may never use Zombies from the other player's pool (only their own color of Zombie).
Answer: It wouldn't matter if you could, since you are only allowed to place zombies if you roll higher than the number of zombies you personally control.
The rules state the following:

Place Starting Zombies -  The Zombie Player starts the game with 2d6 Zombies on the board (or 1d6 each if there are two Zombie Players). Place the rolled number of Zombies on the board from your Zombie Pool. [...] If there are two Zombie Players, they are only limited in this way by their own color of Zombie (that is, the two players may double up Zombies on a Spawning Pit before each pit has a Zombie on it). (page 8)
3) Roll To Spawn New Zombies - [...] If there are two Zombie players, each of them instead only rolls 1d6, needing to roll over the number of Zombies that they personally control on the board. (page 9)

Since each player starts with 6 zombies of their color, and you need to roll a 1d6 higher than the number you personally control, you cannot roller higher than '6'.
Comment: I beleive the card being asked about allows you to spawn additional zombies without havbing to roll for them


Get token standard type knowing the contract address and tokenId

Question: How can I implement code that returns whether a token is in the ERC721 or ERC1155 standard, knowing both the contract address and the tokenId? What I tried is that I call a function that exists only on ERC1155 standard and if it fails then it's obviously an ERC721 token. But this is probably not the best solution.
Any tips?
Answer: Please study ERC-165 and see the interface detection discussed in both ERC-721 and ERC-1155.
0xcert and OpenZeppelin both include implementations so I would not want to paste everything in here.
Comment: Looked it up, probably that's what I need ,although I don't really understand how to use it. As I understand, I need the ERC165Checker library's _supportsInterface function  which tells me if a specific contract at address has a specific interface. But how can I use this function outside of solidity in js with web3?
Comment: Please see here https://eips.ethereum.org/EIPS/eip-165#how-to-detect-if-a-contract-implements-erc-165. And then as how to implement that using web3js, please see https://web3js.readthedocs.io/en/v1.3.4/web3-eth-contract.html#methods-mymethod-call
Answer: I have an implementation which doesn't rely on erc-165, but we get the code and check if certain function signature exists, check the implementation here: https://github.com/botfi-app/token-standard-detector


Overhead cable vs batteries for vehicles

Question: This mainly would concern Europe, since part of the infrastructure is already in place (trolleys overhead cables). What economic reasons prevent electric autos sans large  batteries from being feasible in European cities? Lithium is considered by most environmental unfriendly, both extraction, usage(flammable), and disposal. I would see Europe being forefront of electric autos without batteries if it were feasible.
Comment: How many european cities have an overhead cable structure?
Comment: What if you want to go another route?  What about parking?
Comment: I got the question. Solar mike and paparazzo are being critical. Also welcome and please visit often.
Answer: The main problem is the extremely peaky load. Your gas tank stores power for a week, batteries store power for days, and can be charged off peak. OLEs deliver on demand, and that sort of power is expensive to dispatch compared to more balanced loads. You really need to look at what this sort of recharging infrastructure consists of. How many combined cycle gas turbine peaker plants would you need to build to supply Munich, say? Maybe six of these would do.
On a slightly brighter note, there are some limited uses that have been looked at. For longer distances, an intermittent charge-on-the-go system that dump charges supercaps which then discharge to batteries can reduce vehicle weight and improve the versatility of electric vehicles. Using intelligent vehicles to plan routes and use the resources evenly can help. Recharging on straightish uphill segments would be a good exploit.
Comment: Another main problem is the cost per kilometer of the grid. This won't be justified without user base, and there won't be any user base without extensive grid. Trolleybus grids are built with municipal/central funding because the users are guaranteed to appear along with the grid - the municipal transport investment is governed by the same entities as the grid investment. If it was to be based on private cars, the demand may never justify the expense.
Answer: One thing about using overhead trolley wires to power vehicles is traffic congestion.
I can remember riding on trolley buses when I was very young & if a trolley bus had to pull over at a bus stop to drop off or pick up passengers it blocked the vehicles behind it. All vehicles behind it had to wait until the bus moved again.
Any vehicle connected to an overhead trolley wire, whether it be bus or car, has restricted movement. It cannot deviate significantly from the line of the overhead trolley wire.
Currently, if something is blocking the path of a self powered vehicle whether it be a combustion engine of a battery the vehicle can go around the obstacle. But vehicles powered by an overhead trolley wire cannot move around. They have to stay where they are until the obstacle is removed.
Comment: Good point, not specifically an economic reason, though, unless you count the lost time/productivity that would result :P
Answer: Batteries are limited and can explode, short or need service vs while wires do not. The best batteries can only charge about 3000 times before they are depleted. Problems in the wire can be viewed easily vs where a battery has to be tested.
Comment: This is not an answer to the question - paulj specifically requested *economic* reasons


Mixamo import edit clothing textures

Question: Thank you in advance for any help.
My question is regarding editing the colour of an mixamo armatures clothes.
I looked up some related questions and could not find anything that helped me.
I don't think this should be difficult but I have spent countless hours just trying to change the colour of the clothing of an import from mixamo.
I can't find anything that explains how to do this.
I am relatively new to blender and I'm looking to import a mixamo character that has a suit on and I'd like to change colours of clothing items.  I played around with materials and nodes but could not figure it out.  I'm hoping there is a simple way to change colours.  I was able to apply some colour changes with texture painting but none of those changes were permanent.  They did not show up if I went to render or animation render.
Thank you for any help!
Answer: Okay, so I figure out a solution for now.  I was able to use texture paint and switch to vertex mode to paint each part of the armature (shirt, body, tie, etc..)
These changes were permanent.   FYI it is not as good as textures but I am still trying to figure out how to change the colour of the original textures.  If I figure it out I will update.

Mixamo import edit clothing textures


received a credit to the card used to purchase a trip —how do I access that amount into my own checking account

Question: I received a credit to a credit card account I used to purchase a airline ticket.  Trip was cancelled and the refund went into that credit card account and there is a zero balance, but a $560 credit balance.  How do I retrieve that amount
Comment: Have you called the bank?
Answer: Generally, credit card issuing banks will not automatically refund balances in your favor. Policies on how this is handled will vary from bank to bank, but it's typical that they would leave the credit on your account for several months - essentially using it to offset any new purchases you make.
If you'd rather be given cash, you can call or write to the bank and request a refund. Typically they would do this by sending you a paper check, but there may be other options and your best bet is to call and ask.
Answer: Between gas and groceries, why not just use the card for these regular essential purchases? In my opinion, that's far easier than picking up the phone.
Comment: @Eric Not sure it's a wash. (1) You buy airline ticket, and possibly get some rewards. (2) The ticket is refunded, and the rewards for it (if any) are reversed. (3) You buy groceries, gas, etc. using the refunded balance, and get rewards for these. Summary: you're left with rewards for (3). All the more reason to follow this advice.
Comment: Yes, the points on the original purchase are lost, but this is a chance to essentially re-earn them vs lose them for good, on money you're probably going to spend anyways. I guess that's the long winded and more correct version of my first comment!
Comment: This has the advantage of getting rewards points if the card has a rewards program!
Comment: @dwizum A refund of a previous purchase will typically reverse any rewards for that purchase so it's probably a wash.
Comment: @dwizum: You're assuming that everyday purchases and travel expenses earn at the same rate.... which is predominantly not true in today's credit card ecosystem.
Comment: Ben, while I agree 100% with your comment, I suspect the OP is not playing "the game". Else, they would not have been likely to post this question here.
Answer: Simply phone customer service
And have them mail you a check, or e-transfer if you have an account linked.  This is no trouble at all, it happens all the time.
The reason they don't do it automatically is most people use their cards regularly, and so this credit balance will soon be consumed by other purchases.  Therefore the expense and trouble of mailing a check is simply not worth it.
You could just do that, you know.  If it is not currently your habit to use the credit card for routine purchases, go ahead and do so until the credit is consumed.
By the way, speaking generally, a credit balance is your money. For instance I find it tedious to pay the $20 water bill every month.  So I simply send them $150 as needed. After about 8 months the balance goes above zero and I send them another $150. And I've done this -- when I cancel service, they cheerfully send me a refund check for the balance.
Comment: I think it's less about the expense of mailing a check and more about the potential for surprised (and angry) customers who know they have a credit covering their purchases, don't make a payment, and if the credit had been refunded would now have missed making a minimum payment, resulting in late fees, credit report dings, and penalty rates (possibly also on unrelated accounts).
Comment: @BenVoigt Very good point. However on my very first credit card, I learned that a return posting to your account does not substitute for a minimum payment.  This was awhile ago, and was on a Sears store card.
Comment: It does void the minimum payment *if it brings you into a credit balance*.  The minimum payment is never more than the total amount owed (at least, on any credit card I've ever seen, which is quite a few).
Comment: @BenVoigt True, that.
Answer: Since your credit card shows both a zero balance and a $560 credit balance, the actual amount of your own money in the credit card account is zero and the $560 is the amount you can borrow on your card. Unless you have transactions pending, the $560 is also your credit limit.
Say you started with a fresh card, nil balance and $560 credit limit. Then you bought tickets worth $200. You now have a balance of $200 that you owe the bank, and $360 credit limit remaining. Then you get the refund, which puts the $200 back, leaving you with nothing owing to the bank and the full $560 credit limit available.
If you pull this $560 into your checking account, you are borrowing $560 at cash-advance rates, which can be higher than credit card rates on purchases. You will also have to pay back the $560 at some time.
Comment: I'm not sure this matches the scenario the OP is describing. If I have a $500 limit, and I charge $300, *then pay my bill in full* - and after paying the bill, I get a $300 refund, I will truly have a $300 credit balance in my favor, in addition to the $500 limit.
Comment: @dwizum That's possible as well, and I think the other answers have used that assumption. I've presented the alternate interpretation. Credit card statements can be tricky to read. I'll let the OP pick whichever suits the situation better.
Comment: What you describe in this answer is a credit limit, not a credit balance.  Whereas with an actual credit balance, the monthly statement would show $0 as "balance due".
Comment: @BenVoigt That's right. The OP didn't use the term "balance due", just "balance" and "credit balance". The other answers are probably correct; I'm leaving this answer up for now in case the OP used the terms informally. If the OP didn't make any other purchases on the credit card, then having the refund take the balance back to zero makes sense.


Homeomorphism of the circle with rational rotation number

Question: I am sorry because it is probably a trivial question. I consider a homeomorphism of the circle that preserves orientation and that has a rational rotation number p/q (it is an irreducible fraction). I assume that ALL the orbits are periodic. Then we know that all the orbits have the same period q. I want to know if such a homeomorphism is conjugate to the rotation of angle p/q.
Is that true ? If yes, can you tell me how to construct such a conjugacy ? I tried but I failed... If it is not true, can you give me a counterexample ?
Thanks in advance.
Comment: @BenoîtKloeckner I don't agree with the "borderline" label. Nobody is assumed to know everything on every subject, even on its own subject. I appreciate when specialists give their input even for some "naive" questions because sometime (depending on the qualities of the specialist) it can be enlightening.
Comment: @PatrickI-Z: I find this question borderline not because everybody should know the answer, but because it seemed to me that any mathematician could find the answer, or at least explain what he or she tried in the question. And borderline does not mean clearly out of scope.
Comment: This exchange reminds me of a classic Andre Weil anecdote. A mathematician addresses Weil: "Can I ask you a stupid question?" - "You just did", Weil snaps back.
Comment: This questions seems borderline for this site, but let me give you hint : What happens when you look at the interval $[x,x'[$ where $x$ is any point and $x'$ is the closest point forward that lies in the orbit of $x$, and then at iterates of $x+\varepsilon$ for small positive $\varepsilon$?
Comment: Thank you for your hint. It is the first time I ask a question on this site, so can you explain what it seems borderline ?
Thanks in advance?
Comment: @Maxence: You could consider accepting the answer if it was helpful to you. The question was borderline because it is about a fairly classical fact that you should have found in introductory books on the topic…
Comment: @BenoîtKloeckner If people can teach me and prevent me to go open a book, I'm thankful. You see my point. OK then, I think we understand each other.
Answer: The answer is "yes". Consider $\mathbb S^1$ as the quotient $\mathbb R/\mathbb Z$. Your homeomorphism $f$ lifts to a homeomorphism $\phi : \mathbb R \to \mathbb R$ such that $\phi(x+1)=\phi(x)+1$. Form the map $h:=\frac{1}{q} \sum _{n=1} ^q (\phi^{\circ n}-pn)$, where $\phi ^{\circ n}$ is the composition $n$ times of $\phi$ with itself. By construction $h\circ \phi = h+\frac{p}{q} $ and $h(x+1)=1+h(x)$, so that $h$ factors as a homeomorphism of the circle conjugating $f$ to the rotation.
  By the way this approach wors in $\mathbb R^n$ too.


Is it possible to detect if Windows Sandbox has been used on a PC?

Question: I understand that Windows Sandbox 'provides a lightweight desktop environment to safely run applications in isolation and that software installed inside the Windows Sandbox environment remain "sandboxed" and run separately from the host machine' etc, etc, however, surely it must leave a 'footprint' somewhere.  How do I find this footprint on a PC running Windows 10?
Answer: Any machine made with Windows Sandbox goes away at Restart or Shutdown.
Sandbox is not an Installed Program.
Look in Programs and Features, Windows Features. Scroll down to "W" and look for Windows Sandbox.
If it was used, it will have been enabled and likely will remain enabled.
A user (with Admin Credentials) could have enabled, made a Windows 10 sandbox, deleted it, and removed the setting, but that does not seem completely reasonable.
So look in Windows Features and see if Sandbox has been enabled.


Scheme, what is the difference in the call stack

Question: <code>(define d
  (append '(a) (call/cc
          (lambda (k) (k (append '(b) '(c)))))))

(define e
  (append '(a) (append '(b) '(c))))
</code>
What is the difference in the call stack between d and e?
Comment: As the first can be reduced to the second, they are the same. The reduction is `(call/cc (lambda (k) (k v)))` => `v`.
Comment: Since you are using `call/cc` you need to use the term call *tree* rather than call stack. :-)
Comment: At what point do you want to examine the call stack? The call stacks during execution of these two functions will be different at certain points.
Comment: So what are the advantages/disadvantages of using either or then? What is the difference in the tree? Just that one more branch is made in the first other than the second?
Answer: You forgot one:
<code>(define d
  (append '(a) (call/cc
          (lambda (k) (append '(b) '(c))))))
</code>
Your examples and the one above shows variations of the same code. A Compiler would reduce those to the exact same expressions.
As with eval, you shouldn't use call/cc if you can avoid it. Imagine that you are taking one of those lists as input from the user:
Imagine this example:
<code>(define d
    (call/cc
         (lambda (abort)
              (append    '(a)
                         '(b)
                         (let ((c (read)))
                            (if (list? c)
                                       c
                                       (abort #f)))))))
</code>
Here if you input a list d will become '(a b ...), but if you don't supply it with a list (eg. you write 5) it will use the continuation (abort) to return #f instead of letting append do it's thing. This example could be written without call/cc (by doing read and if part first, but in some circumstances the alternative to a continuation is to complete a calculation that you half way know is going to be trown away.
call/cc is like a goto in other languages and can be used to make exceptions, cooperative multitasking, iterations, ++. See Matt Might's Continuations by example


How do I create a filter based on the current user's role in a search_api based view?

Question: I would like to filter a search_api based view using the current user's roles as input.
I don't see a contextual filter for the current user in my search_api based content view at all.
How can I accomplish something like the "Published or has role" feature of this contrib module? This one seems to only work on non-search_api views.
Comment: This sounds like a node access issue. If you have node access properly sorted out so that only appropriate roles see restricted content Views will honor that.
Comment: Try adding a Relationship for User ID, then the Contextual may appear. Sorry I haven't checked this, flying blind for now.
Comment: @prkos There is an option to add a relationship to the Author but I am not interested in the Author. I just want the current site user.
Comment: What is the connection between user roles and your content?
Comment: If they are staff they can see it even if it is unpublished. If not the view should be filtered by published. I can't use the trick of putting two views on one path since this view is embedded in a block field.
Answer: Thanks to @prkos reminding me that this is a regular node access setup issue. This was solved when I found this issue in the search_api queue about incompatibility with "View All Unpublshed content"