When should I initialize a view controller using initWithNibName?

Question: When should I use init: and when should I use initWithNibName:bundle: when creating a view controller?
Comment: You should change the selected answer on this question
Answer: -initWithNibName:bundle: is the designated initializer for UIViewController. Something should eventually call it. That said, and despite Apple's examples (which favor brevity over maintainability in many cases), it should never be called from outside the view controller itself.
You will often see code like this:
MYViewController *vc = [[MYViewController alloc] initWithNibName:@"Myview" bundle:nil];

I say this is incorrect. It puts implementation details (the name of the NIB and the fact that a NIB is even used) into the caller. That breaks encapsulation. The correct way to do this is:
MYViewController *vc = [[MYViewController alloc] init];

Then, in MYViewController:
- (instancetype)init
{
   self = [super initWithNibName:@"Myview" bundle:nil];
   if (self != nil)
   {
       // Further initialization if needed
   }
   return self;
}

- (instancetype)initWithNibName:(NSString *)nibName bundle:(NSBundle *)bundle
{
    NSAssert(NO, @"Initialize with -init");
    return nil;
}

This moves the key implementation details back into the object, and prevents callers from accidentally breaking encapsulation. Now if you change the name of the NIB, or move to programmatic construction, you fix it in one place (in the view controller) rather than in every place the view controller is used.
Comment: If this is the intended way, why does XCode4 generate a initWithNibName:bundle: stub for every empty ViewController class, yet no init method?
Comment: Same reason that the templates haven't included class prefixes, even though you're definitely supposed to prefix your classes, and the template creates the dumbest possible name for your app delegate, which is a real headache to fix. And IB forces an ivar declaration when you auto-create properties, even though you shouldn't declare ivars in the new ABI. The templates are not always best practice. They're often the least-common-denominator that works somewhat in most cases, but nowhere particularly well. Apple's example code is improving recently, but it still has a way to go.
Comment: @CharlesA If you use this approach, you can pass `nil` as the nib name and it'll figure it out based on the view controller class. See the docs for `UIViewController -nibName` that explains the heuristics it uses to find the file.
Comment: If you follow the convention of naming your nibs the same as the class then this code works well: `- (id)init {
    return [super initWithNibName:NSStringFromClass([self class]) bundle:nil];
}`
Comment: I've been using this approach for some time now. It's fantastic, thanks Rob!
Comment: ditto, this is also my approach.
Answer: Use initWithNibName: bundle: if you are... initializing with a nib file! That is, a file that you made using Interface Builder.
If you aren't using IB to layout your views, you can just use init.
Answer: You can just call init, as long as the xib has the same name as the view controller class. The encapsulation is not necessary. This saves typing, but may not serve clarity.
 NUDMainViewController *mainVC = [[NUDMainViewController alloc] init];

Answer: using init when there is no nib/xib file, e.g. UI are created by coding
using initWithNibName , if we have an nib/xib or same controller share by more than 1 nib/xib
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
     self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPhone" bundle:nil];
 } else {
    self.viewController = [[ViewController alloc] initWithNibName:@"ViewController_iPad" bundle:nil];
 }

that's what I think..
Comment: You know if you add ~iphone or ~ipad to your nib names you can just call initWithNibName@"ViewController" and it will pick the correct one.


What's the meaning of the general solution and the particular solution in differential equations?

Question: Can anybody cast some physical insight into this? I've been studying differential equations on my own and don't understand how you can have a whole host of general solutions. It seems like a rather curious situation which we don't come across in other areas of mathematics. Is there anything more to the discussion that I'm missing?
Comment: To study differential equations, you should look at a numerical book, to learn to simulate them. The analytic methods are generally primitive and misleading outside of one and two dimensional phase spaces, because of chaotic behavior.
Answer: The solutions of a homogeneous linear ordinary differential equation form a vector space, ie $0$ is always a valid solution and arbitrary linear combinations of solutions will yield another valid solution. Finding the general solution of such an equation means finding a basis for that vector space.
In contrast, solutions to an inhomogeneous linear ordinary differential equation form an affine space over the space of homogeneous solutions. This means that $0$ is in general not a solution, and the difference between two solutions of the inhomogeneous equation will be a solution of the homogeneous one.
Thus, you only need to find a single inhomogeneous solution: The general solution of the inhomogeneous equation can be expressed of the sum of that particular solution and the general solution of the homogeneous one.
In case of non-linear differential equations, the integration constants (or equivalently, the choice of initial conditions) still parametrize the space of general solutions, and choosing values for these parameters will get you a particular one. However, the simple relation between the general solution of an inhomogeneous equation and the general solution of the corresponding homogeneous one does not hold for arbitrary differential equations.
Comment: This answer is giving an answer specific to linear ODEs, while the phenomenon is general. But it's a fine answer for the linear case.
Comment: @Ron: added a small note about the non-linear case
Comment: I don't agree it is a small note--- the reason I wrote a separate answer is because the linear case is misleading, the real reason for the arbitrary constants is not a vector space argument, it's an initial conditions argument, and it works regardless of the linearity of the equation. Neither are nonlinear equations "more complicated", they are just nonlinear. Sometimes they are simpler.
Comment: @Ron: I slightly reworded the last part
Answer: The differential equation needs initial conditions to simulate on a computer (which you should do once, if you want to understand what they are). A differential equation is a rule on a time-grid of size $\epsilon$ for $x(t+\epsilon)$, given $x(t)$. For example;
$$ {dx\over dt}= x + x^2 + x^3 $$
means
$$ x(t+\epsilon) = x(t) + \epsilon ( x(t) + x(t)^2 + x(t)^3) $$
in the limit $\epsilon\rightarrow 0$.
You can use the equation above to step forward in time, but you need to give the value of $x(0)$. Then from this value, you calculate $x(\epsilon)$, then $x(2\epsilon)$, then $x(3\epsilon)$ and so on into the future. A special solution is one for a given initial value, while the general solution is expressed in terms of $x(0)$ or some equivalent arbitrary constant that can be used to find $x(0)$.
The theorem you want is the uniqueness theorem for the initial value problem of ordinary differential equations. The mathematical proof tends to use a less useful approximation technique than lattice stepping, but people who do computer simulations or computer games always use some sort of lattice for ODE's.
Answer: To answer your remark about the host of solutions for an ode: try to solve for (x,y) the equation:  x+y=1. There is an infinity of solutions,  (x,y)=(x, 1-x).
But you can write them as follow: (x,y)=(0,1)+x*(1,-1)
(0,1) is a peculiar solution of the full equation.
(1,-1) is solution of the homogenous equation: x+y=0 and x in the expression x*(1,-1) plays the role of the constant C you introduce in the solution of an ode.
For linear ode, the situation is quite similar. If you want a physical meaning, one can say that the homogeneous equation (without rhs) is used to study instabilities, if any of its solutions are an increasing function of time, then the system is instable. Any perturbation will blow out with time. Once you know the system is stable, it is worth studying the full equation with a rhs that describes the driving external force.
Mathematically the full solution is the sum of the solutions of the homogeneous equation (general solution) plus the solution of the non homogeneous one (peculiar solution) exactly as in the exemple above.
Why do we need the general solution if for time long enough they become negligeable in the stable case? Mathematicians were assigned the task to solve the ode, not to discuss their interest, but even in physics, sometimes the transiants (homogenous solutions) are important, especialy when you have to deal with the boundary conditions. For instance, if you study the flow in a pipe, you must impose a zero velocity at the wall. This can be achieved with a proper choice of the constants which appears in the solution of the homogeneous equation.
Comment: This answer is giving an answer specific to linear ODEs, while the phenomenon is general. But it's a fine answer for the linear case.


Recover files from formatted drive

Question: I have just installed a fresh copy of Windows as my previous version was corrupted. My drive C was formatted whereas my other drives are still there. I want to get some of my files back from my drive C. Is there any possible way to do this, such as with file recovery software like Remo Recover?
Comment: I used the trial version for Data Recovery Wizard Professional v3.3.4 and it restored ALL of my documents by doing a filter search for documents (.pdf,.doc, .xls etc) and I recommend it to everyone.
Comment: Glad it worked out for you, but you may not be that lucky again in the future. Maybe you learned a lesson about making sure you back up (or at least copy out) important data before formatting your drive. :-)
Answer: Well from their page I would say it is worth a shot, however it depends greatly on how the drive was formatted I would presume.
If a real format was completed then the drive was wiped completely. If a partial format was completed then the allocation table was wiped and there is a potential that Remo could find something.
At this point I would say you have a 50/50 shot.
Comment: No. Formats *never* wipe the drive. They just re-write the drive's "index". You need special tools to wipe a drive. The largest problem is data being overwritten by the install, not data being wiped.
Comment: @Bart: Quick formats just rewrite the MFT (drive's "index"). A full format will affect most sectors, although it doesn't overwrite every single one, which is why some (but seldom all) data can be recovered. See [this article](http://en.wikipedia.org/wiki/Disk_formatting), in particular the second paragraph.
Comment: agreed, wiped is a bad choice of words.
Answer: files that were not overwritten by your OS install MAY be recoverable. in this case look at this document explaining TestDisk and Photorec.
I usually use Ubuntu Rescue Remix for data recovery tasks, but there are many live CDs available with these two tools. PhotoRec is probably your best bet since you've already overwritten a good portion of your old partition.
Comment: I still have my Time Machine backups on an external drive, so nothing has been *lost* per se, I just want to log onto my now-restored system.

Recover files from formatted drive


Retrieving jobs of an expired access device

Question: I had private access to a quantum computer, but the access is expired. So Can I access to my jobs done on it ?
The '''backend.retrieve_job('')''' can't work because I cant load the backend (no access).
Answer: Assuming you have the job id, you can do provider.backend.retrieve_job(job_id).
Answer: If you log into your IBMQ account and then go to your Quantum Lab, on the left hand menu you will see an icon that looks like a "play" symbol with a counterclockwise circle around it.  If you click this, you will have access to the results of your past jobs.
I have never used a paid device, so I am not sure if those results will also be found here, but I can find anything I have ran in this list.


Developing Access DB to SQL?

Question: I built a database several years ago in Access to track over 4K pieces of equipment in and out of a shop, where it was going, current status, etc. It's dying. I would like to upgrade it, but unsure if a split Access DB or a SQL Server 2008 back with Access front would be better/sufficient. I'm leaning towards the latter.
At most 35 simultaneous users, but only on rare occasions.
Would like to track (log) changes to items each time data/status changes.
Print reports, etc.
Keep it SIMPLE for users.
Comment: Welcome to the site. I think you have a reasonable question in there somewhere if you could [make it specific](http://dba.stackexchange.com/help/dont-ask).
Answer: How large is your database? If you expect that your database will not grow to larger than 10 GB, and you are familiar with SQL Server, then you can use SQL Server Express Edition. If you don't need any of the enterprise features (page/row compression, HA/DR, encryption, table partitioning, etc), it's a great way to manage smaller amounts of data...and its free!
I've never personally used a set-up with Access ADP as a front-end, but I've heard it works fine for straight-forward data management. If you have the time/resources, creating a simple web-based front end for management (or buying something out of the box that sits on SQL Server) might allow you to reduce the complexity even further.

Developing Access DB to SQL?


Can I extend an existing tile tub surround to create a shower surround?

Question: I have a bathroom that is tiled halfway up the wall with 50s teal tile and finished with a bullnose. Right now there is only a tub but I am planning to add a shower  and would like to tile farther up the wall. Right now there is drywall above the tile. Are there any recommendations on the best way to do this?
Comment: The problem may be that the original tile is over drywall, which isn't suitable for a shower. You can waterproof the new tile all you want, but that's half the solution. I think you'll need to strip the walls and start fresh with a moisture barrier and cement board throughout.
Comment: Do you want to keep the original tile?
Comment: @isherwood that should be an answer it is the best way to do this project.
Comment: I doubt you will find tile to match if they are that old.
Comment: I'd like to not tear the bathroom apart. I was thinking about using white tile not matching tile
Comment: I was hoping to hear from HallieH whether or not that's the case. Do you know what's behind the existing tile?
Comment: I will have to try to pry off a tile to see what they tiled on
Answer: To do it well (so you won't regret it later) you will need to strip back to the studs and start with cement-board. More mess now, less trouble later.
In replacing a ~1964 tub which had a tile surround up to "shower height" I found that the whole thing was built on drywall. In that case I was having to rip tile to replace the rusted-out sheet-steel tub, but wanted to minimize offense to the rest of the tiled bathroom - I was able to salvage enough tile to trim around a fiberglass tub surround and maintain the overall look of the bathroom. I cement-boarded behind the surround, in the event that someone might ever want to tile the whole thing. Finding matching tile was not happening, and not all the tiles came off intact.
Answer: I recently had to deal with a shower that was tile on drywall ("moisture resistant" - yeah right!) so I'll echo that you'd regret doing this.
But I also have a tub with half-height tile that I want to convert to a full-height shower, and I've seen different ways of doing this. The worst was a vinyl sheet placed above the tile to extend the "waterproofing" upward a few feet; this was a disaster as it's not actually waterproof, looks bad, and will disintegrate the wall over time.
If you're going to go with tile, test whether it's all drywall and replace it with some kind of cement board or tile backer board, then use new tile.
My favorite solution and probably the one I'll use - is a tub/shower dressing that's a single piece of fiberglass or something similar; these are molded to have soap dishes and shelves and cover the entire wall down to the tub - some cover the tub also.
It'll probably come down to cost and the aesthetic you're looking for - the fiberglass may need to be custom-sized which would be expensive - but I wouldn't count on keeping your existing tile.


How to add data from custom list view from sqlite database?

Question: In android application i have a custom listview and sqlite database.
I want to display the database table value to custom listview.Please any one help me some code
Answer: you need to do something along the lines of this
<code>          String[] fields = new String[] {Database.NAME};
    SimpleCursorAdapter  mAdapter = new SimpleCursorAdapter(getActivity(),R.layout.names_listview,null,fields,
              new int[] {R.id.bListTextView});
      setListAdapter(mAdapter);
</code>
Answer: Here is a website that might help
SimpleCursorAdapters and ListViews


Websocket listener returns no response

Question: I am trying to listen to a UniSwap v3 Swap event but I get no response from the network. I am connected to polygon network via websocket and after firing up the listener I get no callbacks even though Polygonscan shows recent emitted events. I even log the active listeners and it shows "1".
Any thoughts?
Polygonscan address events: https://polygonscan.com/address/0x45dDa9cb7c25131DF268515131f647d726f50608#events
UniSwap v3 documentation: https://docs.uniswap.org/protocol/reference/core/interfaces/pool/IUniswapV3PoolEvents#swap
<code>const wsProvider = new ethers.providers.WebSocketProvider(WS_ALCHEMY);
const wallet = new ethers.Wallet(PRIVATE_KEY);
const signer = wallet.connect(wsProvider);

const address = "0x45dDa9cb7c25131DF268515131f647d726f50608";
const abi = "event Swap(address sender, address recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick)";

const contract = new ethers.Contract(address, [abi], signer);
contract.on("Swap", (sender: string, recipient: string, amount0: number, amount1: number, sqrtPriceX96: number, liquidity: number, tick: number) => {
  console.log("asd");
});
console.log(contract.listenerCount("Swap"));
</code>
Answer: For future users, make sure to copy the abi from etherscan/polygonscan as an object. While the above example might work, this time it caused the event to not get called without any errors.

Websocket listener returns no response


Can you take 10 on Aid Another?

Question: I've only seen the "take 10" specifically disabled for ritual checks (PH1, p. 300).
Are they allowed for Aid Another?
Answer: Technically yes, in practice usually no
From the RC, p127:

Taking 10: When creatures are not in a rush or not involved in an encounter or a skill challenge, they can choose to take 10 on a skill check. ...

Nothing in that list forbids you from taking 10 when you aid another. It does, however, ban taking 10 in most of the situations in which you would actually want to use the aid another action, skill challenges in particular.
Technically, you can use aid another to provide an ally a bonus on an attack roll.  This is almost always a bad idea.  If you were to do this, however, you could not take 10 because attack rolls are not skill checks and you can only take 10 on skill checks, in addition to generally being rushed and threatened in situations wherein you are making attack rolls.
Comment: @Squera it can be used as such (though it's not exactly a good action economy item). It's more proper use is in a skill challenge or skill check attempt in order to allow other characters to get involved.
Comment: But your cited text says "when creatures are not ... involved in an encounter"!
Unless i'm missing something, generally Aid another is done in combat in order to get the +2 to hit, right?
Comment: @Squera Taking 10 is limited to when `not involved in an encounter`, but Aid Another is not. So you can take 10 on Aid Another, but not during an encounter or a skill challenge, or when rushed. Which is most of the times you'd use it.

Can you take 10 on Aid Another?


What is the difference between classical nonlinear optics and multiphoton physics?

Question: Nonlinear optics is usually looked at through a classical lens for most purposes. I do a Taylor expansion of the material polarization in terms of light-field strengths and we can derive all the essential mathematics for second-harmonic generation, sub-harmonic generation etc. Another way to look at high-harmonic generation is through multi-photon physics. For instance, I can look at second-harmonic generation as two photon emission. Is this the correct way to understand this? Is the classical description of nonlinear optics analogous to multi-photon physics? Are they just two ways of describing the same thing? Or am I missing a subtle difference in the terminology here? This is more of a terminology than a physics question.
Comment: If you think about it, the if you let the Hamiltonian of the system have a nonlinear term, that leads to coupling between modes and by using ladder operators you can see it leads to terms like $\hat{a_2}^{\dagger}\hat{a_1}^2$ which is the quantum way to describe SHG. Meaning, quantum non-linear optics (NLO) describes well classical NLO phenomena and can only add things that couldn't be described earlier, like generation of spontaneous parametric down conversion (which has non-classical features)
Answer: The difference is that multi-photon physics incorporates quantum phenomena whereas classical nonlinear optics does not. For example, multi-photon phenomena can yield entangled pairs of photons which have no classical analog.


Safe to Delete Mobile Applications

Question: I back up my iPhone 4 and iPad 2 to iCloud.
Is it necessary to keep my Mobile Applications Folder?
There are over 12GBs of space being used by this folder on my Macbook.
Could it be thrown out?
Comment: This entire folder being on my Macbook is a ridiculous concept. This afternoon I synced my iPad and that filled up my disk and made me lose data. Why does this exist at all?
Answer: I would be careful. You may be backing up to iCloud, but syncing locally with iTunes. If you DO NOT sync your Apps with iTunes, you can throw it away.
Personally, I would keep it and maybe just delete some of the old apps you no longer use.
Answer: Absolutely.  If you aren't syncing apps from your Macbook to your iOS devices, it really isn't necessary for them to be there.  And, if you ever need them on your Macbook again, you can always redownload them from iTunes (unless the app is removed from the App Store, which is rare).
Answer: Hopefully this helps people in the future, it's ok to delete it locally from your Mac and it won't affect your iOS devices. Backup everything to iCloud and redownload from Apple Store. You can even do the same with iMovie and GarageBand (two apps I really don't use but take a bunch of space on my Mac Air 120GB).
Directly copied from iTunes below.

Are you sure you want to delete the selected apps from your iTunes library?
  These apps will not be deleted from any iOS device that synchronizes with your iTunes library.
Answer: Edit 2016-06-07: the behavior described here is no longer valid, at least for iTunes 184.108.40.206 and iOS 9.3.2 (both the most up-to-date at the time of this edit). It is completely safe to go into iTunes and delete iOS apps, they will not be removed from your phone when you sync. (Just tested this on my own phone.)
Original answer left intact below:

Do you sync your iPhone and iPad with iTunes (even occasionally)?
If the answer is no, you can go ahead and delete the iOS apps stored on your Macbook?
If the answer is yes, you need to check if your apps get synced too while syncing your iPhone and iPad? If the answer is no, you can delete the iOS apps on your Macbook. If the answer is yes, you need to connect your iOS device to iTunes, click on your device in the column on the left, click on the 'apps' pane, and uncheck synchronising of your apps. The problem is that when you do that, the apps on your iOS device will be deleted and you'll have to redownload your apps on your device through the appstore. If you don't want to do that, you can choose to not sync your iOS device with iTunes anymore but that means you won't be able to sync anything (movies, tv-shows, ...) with iTunes.

Safe to Delete Mobile Applications


What is the dripping noise that my fridge is making?

Question: My fridge has started to make a dripping noise. I can only hear it when it's really quiet. My fridge does not have an ice maker or a water/ice station on the outside. Recently the freezer has had poor performance. It can freeze ice but ice cream is always soft and the ice eventually fuses together.
What could this dripping noise be and how to fix it? I took an audio recording of it if that would help with the diagnosis…
Thanks!
Answer: It is probably a problem with the defrost cycle.
Yes you fridge has one of those.
It is fully automated and you have noting to do.
It goes on every 8 hours or so to defrost the compressor lines. It will not defrost your fridge.
Every opening and closing of the doors allows air from the room to enter.  Cold surfaces inside the freezer will cause moisture in the air to condense and form frost on the food items and cooling coils. Putting hot food in the fridge is a crime. A defrost problem is confirmed if the cooling coils are covered with ice.
Normally you would not notice it working, but if the ice build up is high it can drip water for a while.
A fancy thermometer will not help you. What will help is to move the food and let the fridge defrost (with open doors) for a day or two.
Knowing that Ice is actually a thermal insulator (just ask Eskimos who build huts (igloo) out of ice to keep it warm inside, it will block the cooling from the compressor lines.
Answer: A useful diagnostic is a thermometer. For example, after some power problems where I was concerned about refrigerator temperatures, I picked up a couple of these Accurite thermometers from Amazon:

so I could keep tabs on both refrigerator and freezer temperatures.
In your case, you already know your freezer is having issues. The dripping is likely water that condenses and freezes and then melts and drips. Together with bad ice and ice cream, there is no doubt it is getting too warm. What you don't know - because most people are bad judges of temperature - is whether everything is too warm (freezer at 25 and sometimes higher, refrigerator at 50, etc.) or if the freezer is too warm but the refrigerator is staying cold (32 - 40). Once you know that, you can narrow down the cause.
This could be a bad thermostat. It could be bad airflow (depending on design, some refrigerator/freezers rely on air flowing between the two compartments to get everything to the right temperature). It could be something else. You can even have ice blocking something to the point where something else gets too warm!
Need more details - make/model/type (side-by-side vs top/bottom makes a big difference), temperature readings, etc. to give a more specific answer.
Comment: Thank you for the detailed answer. I'll do the investigations you mention!


brushless dc motor connection

Question: i am connecting 2 brushless dc motors to a raspberry pi B and need help on connecting the correct pins . I saw a video on how to connect one motor but don't know which ones to use to connect the second one . I need to connect 3 pins via L298N motor driver i need a in1 in2 and ground pin . I got the ground pin but don't know which ones to use for the other . I saw a tutorial but only for connecting one and in that video he connected it to the GPIO 23 and 24 which other GPIO pins can i use for the second one ?
Comment: Does this answer your question? [RasPi3 and L298n PWM Speed Control](https://raspberrypi.stackexchange.com/questions/82328/raspi3-and-l298n-pwm-speed-control)
Comment: https://raspberrypi.stackexchange.com/questions/82328/raspi3-and-l298n-pwm-speed-control
Answer: I don't think it is a good idea to drive the mototrs directly form the GPIO pins. It i s better tu use line direvers, Motor control hat etc. Because motors could draw more current when they startup and create problems.
This is being said. What pins you'd connect them depends on the program. Please refer to them and see which GPIO pins you need to connect them. As a rule of thumb + polarity will be connected to GPIO pins and - terminal will be common and will be attached one of the GND pins on the GPIO.
Comment: L298N is the poster's driver.  "This" (half of your answer) did not need to be said.

brushless dc motor connection


MVC should buttons go in Controller or View

Question: Hello I have read an example that I found on my school database about MVC in Java. there is this example where the buttons go into the Controller part. but isn't it correct that the buttons need to be in the VIEW because everything that the user can see must be in the view or am I understanding it wrong and is it different in Java?
Comment: Show some context - do you mean the code to generate the buttons in a GUI, or do you mean the binding actions to the buttons?
Comment: i Mean the code to generate the buttons etc
Answer: This image is a generalization of MVC from the Model-View-Controller page on Wikipedia:

In general, if you're dealing with drawing/rendering UI elements, that belongs in the view.  Actions/events that let the user interact with the button would belong in the controller (and may have functionality delegated to services as necessary).
You don't want to put any code that draws/renders buttons in the controller - that tightly couples the controller to a specific view, which goes against the principle of using this design pattern.
Answer: You are correct in saying Buttons belong to the View. However, there may be specific cases where you have to define buttons in the controller. For example, in case of dynamic UI, buttons may need to be instantiated in the controller based on a condition.
One main reason for the View/Controller separation, is to make the view "dumb", and be a UI representation that doesn't require testing. UI components are often heavy-weight, and must be abstracted out for testing. This is done by replacing it with light-weight mocks that mirror the original components' interface, and presenting those to the tests for the controller.
If conditions or business logic are involved, the code should be tested for the different scenarios, and hence belongs in the controller.
Answer: My advice to you - have a look at MVC implementation for Java by PureMVC Project. You'll find that it's an amazing thing! The infrastructure is implemented according to MVC architecture described here.


Where can I find a proof of identity of $H^1(X,T_X)$ and a quotient by the jacobian?

Question: I'm reading some notes on hodge theory by Charles Siegel which makes a claim on page 16 relating the space of deformations of a smooth projective hypersurface $X$ with the jacobian ideal. More specifically, let
$$
Proj(\mathbb{C}[x_1,\ldots, x_n]/(f)) = Proj(S_\bullet) = X
$$
then
$$
H^1(X,T_X) = \frac{S_d}{\text{Jac}(f)_d}
$$
where can I find a proof of this and are there any generalizations?
Comment: $X$ is smooth and $d$ is the degree of $f$? Have you tried smashing the conormal and Euler short exact sequences against this?
Comment: @Hoot I would assume the degree condition would be true, but this is not clear from the notes. I'll try and see what I get from these.
Comment: Yes, $d$ is the degree of $f$, and this is indeed immediate from the two exact sequences mentioned by Hoot.
Answer: This is just a standard application of Griffiths's Residue theory.
For a complete treatment you may consult Claire Voisin's book no.2 on Hodge Theory, but let me just give you the idea.
In general, under some mild hypotheses, the whole Jacobian ring $R=S/Jac(f)$ describes the (embedded) deformations of the affine cone $A_X$ over $X$.
Morally speaking you have to imagine that an element $g \in R_k$ gives rise to a deformation given by, say, $A_{\epsilon}= V(f+\epsilon g)$.
With this in mind, is not difficult for an hypersurface to convince yourself that $R_d \cong H^1(X, T_X)$ (just think to what deformations move the affine cone over $X$ to another affine cone over an $X'$).
Actually what you can prove is that $R_k \cong H^1(X, T_X(-d+k))$. To do this you might either try tangent/normal sequence as said above or write down the sequence associated to $c_1(\mathcal{O}_X(1)) \in$ Ext$^1(T_X, \mathcal{O}_X)$ (the so-called Atiyah extension).


dynamically adding unlimited fields to wordpress custom post

Question: does anybody know a plugin for wordpress custom fields that will allow me dynamically  add unlimited number of custom field for post in post adding/editing page. for example "Key Features field/child post" of some product which is post itself and must be added dynamically and unlimited while adding parent post.
Answer: You could use Gravity Forms and the Gravity Forms and the Gravity Forms Custom Post Type Plugin. Most form controls allow "if..then" logic to be applied. Advanced Custom Fields may also be an option. However, either way you will have to add a custom post type. If you edit post.php then you will lose your changes the next time WP updates.
Start by creating a custom post type with http://generatewp.com/post-type/. I know its not a plug in like you asked for but You might find a way to accomplish the functionality.
Comment: i used plugin called Types and configured relationship. but thnx anyways


What is the status of the purported proof of the ABC conjecture?

Question: Back in August 2012, Japanese mathematician Shinichi Mochizuki announced a proof of the abc conjecture using Inter-universal Teichmüller Theory. What has been the status of his proof?  Has there been any progress made in verifying it?
Comment: Have you seen [this](https://www.math.columbia.edu/~woit/wordpress/?p=6514)?
Comment: Previous question on related matters: http://math.stackexchange.com/questions/770507/so-can-anybody-indicate-whether-it-is-worthwhile-trying-to-understand-what-mochi
Comment: 2016 now, are there any updates?
Comment: @Ovi: As of 2018, there are developments: see  documents at http://www.kurims.kyoto-u.ac.jp/~motizuki/IUTch-discussions-2018-03.html of discussions in March 2018 between Shinichi Mochizuki and Yuichiro Hoshi (expounding IUTT) and Peter Scholze and Jakob Stix (questioning its methods). Basically, Scholze and Stix are _not convinced_ in a pretty strong sense. See also Quanta magazine: https://www.quantamagazine.org/titans-of-mathematics-clash-over-epic-proof-of-abc-conjecture-20180920.
Answer: An update by Brian Conrad is here:
http://mathbabe.org/2015/12/15/notes-on-the-oxford-iut-workshop-by-brian-conrad/
Answer: There is no real update here.   At the moment no experts outside a somewhat close
circle have made any positive claims regarding the arguments, and if anything they are (on average) somewhat doubtful.
There is a basic difficulty that no-one knows where to really begin in order to understand what is going on in the argument, and Mochizuki more-or-less refuses to explain how the argument goes other than to say "read the papers".
The situation is peculiar; indeed, it may well be unprecedented.  One possible outcome is that a group of researchers around Mochizuki accept his argument and techniques, and publish results building on it (say in relatively minor journals, where the fact that many people don't accept the results won't interfere with refereeing/publication), while the majority of researchers remain
agnostic or skeptical.     This would be pretty unfortunate!
Go Yamashita has been promising a write-up for a long time; perhaps when that appears the situation will become clearer.
Comment: Given the tone of Mochizuki's "On the Verification of Inter-universal Teichmüller Theory: A Progress Report", I think he would be none too pleased to hear people continuing to say that he has refused to explain his work. In his own words, he has personally given three talks and two seminars on the subject. Granted, he is not going on the "world tour" which might have been expected for such an important result, but I think this is a cultural difference: Mochizuki appears to me to be excessively cautious, to the point that others have considered obstinate.
Comment: I don't deny that it's a deliberate choice. I deny that it is uncooperative. I admit I have an inexpert grasp of Japanese culture. However, it seems reasonable to think that he interprets this action — possibly, of asking for (valid) insight into an unverified and possibly false result; or possibly, of asking for a useful summary of a decade of mental labor so soon after its completion, particularly after having ignored it for that time period — to be overstepping an obvious boundary.
Comment: @EricStucky: I think people are making too much of the cultural aspects.  Mochizuki spent a good part of his life (including graduate school) in the US, and some of the experts now trying to discuss this with him are people he went to graduate school with.  Japanese mathematicians have been world leaders in number theory for 100 years now, and this kind of issue has never arisen before.  (There was no problem when Takagi proved class field theory; there was no problem with people understanding Iwasawa theory; there was no problem with people learning about Kato's Euler system.)  My sense ...
Comment: @EricStucky: In emails to experts he has more or less written "read the papers".  It is not a question of being cautious; it is a deliberate choice to not attempt to summarize his new ideas and point of view.  (The generous interpretation is that the ideas are so novel as to not summarizable.) This is why Go Yamashita's write-up will be so important; it will hopefully provide some insight into what is going on, insight which Mochizuki has basically refused to cooperate in providing.
Comment: ... is that it's much more to do with the particular individual than anything cultural.  But I am a westerner, viewing this from a western cultural viewpoint, so perhaps I'm wrong.
Answer: 2020 update: Quanta magazine published this article in September 2018 essentially saying that Fields medalist Peter Scholze had had doubts from the beginning, where after reading the entire work he could already say exactly where the heart of the proof was and this was exactly where he ceased to understand the argument.
He and Jakob Stix, an expert in the relevant field of anabelian geometry, visited Mochizuki in March 2018. In the end, they both remained convinced that there is an unfillable gap in the proof, while Mochizuki keeps claiming that it is true.
Here is a report written by Scholze and Stix where they explain their point.
In April 2020, the material is finally going to be published, even though the issue was not really settled.
Comment: The link to the report is not working anymore. But the report can still be read here : https://www.kurims.kyoto-u.ac.jp/~motizuki/protectedpdf-2018-05/SS2018-05.pdf
Answer: The persistent confusion over the status of the proof remains even in 2023, showing no sign of abating with one part of the mathematical community trying to build additional work over the method used and another part denying any value to the proof. Brief Report on the Current Situation Surrounding Inter-universal Teichmüller Theory (IUT)


Forecasting with a Machine Learning Algorithm

Question: I am sorry if this is too general of a question, but I am stuck somewhere between perfect and adequate in my model. So, I wanted to ask here. If it is not a suitable question, your negative feedbacks are all welcome, sorry. But theoretically subject is inside a gray area and all comments are valuable I think. It is not a widespread approach to use ML for forecasting, as far as I know.
Our sales team publishes a forecasting report at the beginning of each year. But it is mostly far from reality, not very scientific. It includes subjective assesments also.
We decided to construct a ML model to make a forecasting. Not a classical forecasting because there are many input variables that can effect the output. So, it is an experimental project actually.
So far, I have developed an adequate model, which is already far more better than sales one. But still I think it is not a good one, only adequate.
Data includes Customer-FromCountry-ToCountry based sales. So there are many combinations. By looking at similar applications at MachineLearningMastery.com, I have developed my model like that:
customer-from-to-M9-M8.....M1 - month - quarter - movingavg3 - mov6 - mov9 - dptcountryholidaycount - arvcountryholidaycount
m9 to m1 are previous 9 month sales of predicted month M(output variable) M's vary from 0 to 800 mostly. Holidays are from 0 to 6 for example. I Scaled all of these numerical variables between 0-1
Customer-From-To-Month-Quarter variables are categorical and I used OneHotEncoding for these.
I shuffled all the data, so there is not a time ordered dependency inside my dataset.
I have divided the data into 3 segments.
1: above 100 average for last 3 months;
2:10-100 average
3: below 0 average for 3 months.
I run different models for each 3 segments.
There are many 0 values, so I am using a LGBClassifier first to determine if the sales is 0 or not. Then if it is not 0, I am using a LGBRegressor to determine the sales value for that input row. (SGDRegressor for segment 1, it performs better)
I tried to add MonthSeasonality index and QuarterSeasinality index for each combination into dataset as variables. But it didn't perform well.
What can I try to get better score, I am not asking about algorithms etc. My main purpose here is to get insights about construction of dataset, preprocessing. Your precious ideas about preprocessing tricks before applying a ML algorithm.
Thanks
Answer: I'm afraid your data is probably too complex and specific for somebody else to understand exactly what's going on.
The only idea I can suggest is to try to analyze manually the errors that your model makes:

Are there any patterns, like a kind of errors which happens quite often? For instance a country which tends to be overestimated, a month which tends to be under-estimated, this kind of thing.
If yes try to investigate why: for instance is there some additional feature that could help the model make better predictions for these cases?


How are unused/outdated smart contracts handled on Cardano?

Question: How will unused, outdated smart contracts be handled? Or say a developer makes a mistake in the contract and needs to redeploy it, what happens to that old contract? Would a lot of Unused contracts cause a lot problems for storage?
Answer: For one thing, the validator script associated with a smart contract is not stored on the blockchain; the blockchain only stores the hash just like for a lot of other things. When the code of the validator script changes, the script address also changes, but because the script is not stored on the blockchain, the cost of abandoning a smart contract is like that of abandoning a regular address.
So, there will be no blockchain storage problems with having a lot of unused smart contracts, no more than with having a lot of abandoned regular addresses, and the requirement that each UTXO contains at least a certain amount of ADA limits the number of addresses with non-zero balance.
To avoid losing assets, the developer should move the balance from the old script address to the new script address when he updates the validator script though that may not always be securely feasible without giving the developer/maintainer too much centralized power over the smart contract's operations.
However, someone may build an off-chain metadata service that allows registering validator scripts to facilitate lookups by hash and such a service may accumulate junk and get storage problems unless they address the issue.
Comment: are you sure the contract is not stored? how could a node revialidate tha chain? What about this? https://cardano.stackexchange.com/questions/24/how-can-a-node-verify-a-transaction-with-a-script-address-without-the-script
Comment: At the top level, there is `block`, which contains `transaction_bodies` & `transaction_witness_sets`. Similarly, a `transaction` contains `transaction_body` & `transaction_witness_set`. `transaction_body` is all about hashes and `transaction_witness_set` enables mapping script hashes to actual scripts. The `transaction_witness_set` is like a proof that the `transaction_body` is valid. I think a node may choose to delete the `transaction_witness_set` after some time to save space.


Samsung Galaxy Exhibit - Email Photo Problem

Question: I have a Samsung Galaxy Exhibit. When my husband sends me photos in email I can see the small preview picture but when I click on it it reverts to an older picture that he sent me. I think I accidentally locked it to that older picture. How do I unlock it? I can see others pictures with no problem. Thank you!!
Answer: I think the original Samsung application is not good enough and has some bugs.
So you can use apps from your mail service like Gmail and Yahoo applications or use applications which support multiple email services like Aqua Mail.
Comment: You could provide links to the apps you mention to make your answer more useful.


Number of ordered ways to pick 3 balls out of an urn with 2 black and 3 white balls without replacement

Question: The answer is 7: WWW, WWB, WBW, BWW, WBB, BWB, BBW. Is there an elegant way of calculating it in a way that scales to picking M balls out of K black and N white balls?
Answer: There isn't really a nice expression for it, no. What you want in general is a sum of binomial coefficients
$$
\sum_{i = \max(0, M-N)}^{\min(K, M)}\binom{M}{i}
$$
where each term is the number of orders in which you can pick $i$ black balls and $M-i$ white balls, and the boundaries of the sum are the given by how many black balls you could possibly draw.
A sum of consecutive binomial coefficients like this has no nice closed form in general. For the three cases $\sum_{i = 0}^M$, $\sum_{i = 0}^{M/2}$ and $\sum_{i = M/2}^M$ (in other words, either there are more than enough balls of both colors, or exactly one of the colors is limited, to exactly $M/2$) there is a nice expression (it's just a power of $2$), and cases close to those can be calculated from there, but that's the only special cases that I know of.
Comment: There ir a common name to the combinatory problems with "limited replacement" depending of the objects?
Answer: $$\sum_{k=\max\{0,M-N\}}^{k=\min\{K,N\}}\dfrac{ M!}{k!(M-k)!}$$
For each $k$ balls of the color with smaller number chosen, $(M-k)$ balls of the other color is chosen. Order the balls, account for the identical objects.
Comment: @RafaelGonzalezLopez my bad just now, misread the question
Comment: Can you explain it?
Answer: The generating function for all words without restrictions is
$GF(x,y,t) = {1 \over 1 - xt - yt}$
where the coefficient of $x^ny^kt^m$ encodes the number of word of length $m$ that contain $n$ letters W and $k$ letters B.
$$\sum_{0 \leqslant n}^{N} coeff(x^n)\ \sum_{0 \leqslant k}^{K} coeff(y^k)\ \sum_{m=M}coeff(t^m) \ GF(x,y,t) $$
for the given case, this "viewport" will extract the polynomials:
$x^3+3x^2y+3xy^2+y^3$
$x^3+3x^2+3x+1$
$7$
Answer: Oh dear me !
here is a nice one :
We have to partition in two subsets a string of length M $x_1x_2...x_M$
then the exponential generating function is :
$$ (1 + x + {x^2 \over 2!} + \cdots + {x^K \over K!}).(1 + x + {x^2 \over 2!} + \cdots + {x^N \over N!}) $$
Just take the coefficient of $x^M \over M!$
see here How many arrangements of k items from n items when there are duplicate items


Copying url file from Windows 10 computer to Samsung Galaxy A5 fails, system sound sounds

Question: I have created a .url file using Windows Explorer on a Windows 10 computer. When I try to copy the .url file to my Samsung Galaxy A5 phone the file cannot be copied to my phone. I just hear a strange sound, which is either SystemSound.Asterisk or SystemSound.Exclamation. I cannot tell the difference between these two sounds.
What causes that I am not able to copy the .url file and why does the sound sound (as specified above) instead?
Comment: I just want to know why I am not able to copy an url File to my phone, but other files as well.There must be a reason for this.
Comment: For sending an URL from your PC to a smartphone I would not use a URL file - it is very generic, and I don't think many apps can handle this file format. better try one of the various playlist formats (M3U, PLS, what ever your player on Android supports).
Answer: I use URL Opener to open the file in Firefox for Android. It works great. Copying via FTP or WEBDAV works, but not when Windows PC is connected to Android via USB.
Comment: Could you please explain the last sentence of your answer?
Comment: Norbert... to add to my last sentence... copying a .URL file via FTP or WEBDAV works, but using Win10, regular file explorer i.e. via MTP does not seem to work...
It is still very annoying to me since the USB method is the fastest.
Comment: example: A Folder with Show/Movie... which includes .url files for the Show/Movie, its actors, etc... like links to imdb,com.
Windows File Explorer (via USB) will copy the folder and its contents, BUT will "bleep" for the .url files and not copy those over.
Frustrating, but there is probably a simple solution.


Is it safe to use my personal password as my password in work related accounts?

Question: For example I have this complex personal password cary1bondoc21cary2bondoc as my password and because I am forgetful I also want to used that in work related accounts like company email, etc. Is there a chance that my company can record the strokes that I've made while I am in their offices, which will eventually to them knowing my personal passwords?
Comment: No, it isn't. Single point of failure. One ring to rule them all and all that. The first assumption in hacking is that the mark is doing exactly that, using the same password everywhere.
Comment: That's going to be up to your organization
Comment: No, it is not safe... Always use different password for different account. The world is a dangerous place.
Answer: I think this question can begin to be answered by this graphic, which shows what security people think versus average people about best practices for information security.
Note that the average person thinks using a strong password (meaning a complex, difficult-to-guess gibberishy password) is a priority, while security professionals view a unique password (meaning one that you only use for that particular purpose) as a priority.
In corporate environments, sometimes IT staff have a legitimate need to request your password (although it's not a good practice, they still do it..).  Also you cannot be sure of the security of the database holding your password, or if monitoring software is installed that would give IT staff access to that password.  So, having a unique password for your corporate environment is certainly a better practice for your own safety.
In general, it is a poor practice to reuse any password on different sites.  I prioritize using unique passwords, as you never know if the site you have logged into will be hacked.  If you use the same password on a site that is compromised, attackers may try to use that password against other known sites like PayPal, facebook etc.
This is where security professionals' 5th preference comes in: use a password manager.  If you use a password manager like KeePass or LastPass, you can more easily utilize unique and strong passwords.  Then, you can use your complex password as your "master password," and for no other reason as you do not want this password to ever become known.  You can also enable two factor authentication (security professionals' #3 preference!) to better secure that master database.  This is a better practice in the real-world than re-using passwords, or using formulaic passwords (e.g. that include the name of the site at the end of the password).
Comment: That's a very good explanation regarding your link.
Answer: You should never reuse passwords, because this way, if someone somehow steals you the password for a personal account, they have immediate access to other accounts. Also, this way he/she would also get access to your work account and could impersonate you there.
Also, yes, your company can be recording your password, it could even store it in plaintext. It varies among companies.
And for your personal passwords, so that different sites get a different password, use a password manager. This way you only need to remember one personal password.
Comment: In fact that is the case. If you really need to access those accounts, better use a personal phone with mobile Internet access.
Comment: So to be more careful I should never open any of my personal accounts like online banking, facebook, etc in a company premises?
Answer: It's never a good idea to use the same password in different places. If you're having trouble remembering your passwords, have a base password, then append something to it and make that your actual password.
For example, let's say your base password is cary1bondoc21cary2bondoc
At work, you'll use cary1bondoc21cary2bondocworking
Your facebook can be cary1bondoc21cary2bondoconfacebook
Your gmail can be cary1bondoc21cary2bondocatgmail
That way, one compromised account doesn't necessary lead to another compromised account. Of course you can, and I suggest, you append something that's not as guessable as the example I gave above.
Comment: I would not recommend formulaic passwords like this, as hackers know that people do this and may be able to predict the password based on this.
Answer: Whatever the strength of your password is, do not reuse it for the simple reason that positively reputed ecommerce websites may store your password in plaintext (which thing I personally experienced). So in case the database of such websites is compromised then the common reflexe of a hacker is to try reusing your password elsewhere.


Can you optmize/configure TCP inside your controlled network so it becomes as fast as UDP?

Question: I am considering writing my own implementation of reliable UDP (packet ordering and retransmission for packet drops). This is for internal systems inside my controlled network. I wonder if it is possible on a Linux system to optimize TCP so much that it becomes as fast as UDP? If it is I will just use super-optimized TCP and not worry about implementing reliable UDP.
Answer: There are different measures of performance (throughput, latency, jitter, robustness to packet drop).
You can't get packet delivery and ordering guarantees without introducing arbitrary delay.  In that sense, reliable UDP cannot be "faster" than TCP.
It's possible to use FEC to reduce the number of retransmits, at the expense of additional bandwidth.  That would only improve throughput over a very lossy link though.  It will reduce jitter and maximum latency over a link with any drops.
Or are you talking about TCP fairness vs UDP greediness?
In any case, your OS TCP layer is already very highly optimized, it's unlikely you can do better without changing the rules of the game (e.g. sacrificing fairness).
Answer: There are a few things that you can do to adapt TCP to your specific needs. You can increase the maximum buffer size, change the congestion algorithm and much more. I think it's really worth trying before re-inventing the wheel, especially since you seem to have a good control over your internal network. This article describe a few of those things. Another good source of information for all those parameters is Documentation/networking/ip-sysctl.txt in your Linux source code.
You can also check that the TCP Selective Acknowledgement (SACK) is enabled on your Linux by looking at /proc/sys/net/ipv4/tcp_sack.


Bring windows to default boot?

Question: I just want to try Linux mint. I already have Windows 10 installed and I installed Linux mint 17 rosa alongside it. Problem is on boot it automatically set Linux mint and doesn't show any option. Can someone help me how to have a list of boot options, or just set Windows to default boot?
Comment: You can either manually edit your grub2 configuration files (not recommended but not too hard) or you'll need to install ntsf so that your Linux system can read the windows file system. Then you can automatically remake the grub2 configuration file.  If no one else answers this,  I'll answer when I get to a computer.
Comment: Ntsf-3g can be found here http://www.tuxera.com/community/open-source-ntfs-3g/
Comment: @LiamNoronha ntfs support has been part of the kernel for a few years now, there's no reason to install anything.
Comment: Please [edit] your question and tell us: i) is this a BIOS or UEFI install? You should be able to check in your BIOS boot settings. ii) do you have fastboot enabled in your BIOS?
Answer: You can try to install and use grub-customizer
To install grub-customizer:
sudo add-apt-repository ppa:danielrichter2007/grub-customizer

sudo apt-get update

sudo apt-get install grub-customizer

To launch it just type sudo grub-customizer
If you can see windows boot manager, try to up it in the list.
More details here:
http://linuxg.net/how-to-install-grub-customizer-4-0-6-on-ubuntu-linux-mint-elementary-os-and-their-derivative-systems/

Bring windows to default boot?


Is that possible to call batch class from trigger for more than 2K records to do callouts?

Question: We want to do call to batch apex from trigger. And in that batch apex class we want to do callouts.  So we are giving batch size 50 in scope parameter. but we have more that 2K records which we update in bulk. And in one link they have said that we can only have 5 jobs running at a time.

So is that possible to call batch apex class from trigger for more that 2K records in bulk.
Please help us and give us a advice ASAP.
Comment: Welcome to Salesforce Stack Exchange (SFSE). Have you read these questions & answers to see if they have the information you are looking for? https://salesforce.stackexchange.com/q/143294/81648, https://salesforce.stackexchange.com/q/54986/81648
Answer: Use Queueable instead of Batchable for anything you want to do in a trigger. These have much higher limits per transaction (50), and can do pretty much everything a batch can do, except automatically handle millions of records. What you can do from there is pass in all 200 records into the queueable, and it can chain itself repeatedly to make the 200 callouts (e.g. you could chain 4 times to handle 50 callouts per iteration).
Also note that the normal API limit for records is 200, so if you upload 2k records "at once", there's actually 10 API calls, each with their own governor limits. The only time you need to worry about more than 200 records is when you're using Apex, since you can theoretically update many thousands of records that all share the same governor limits.


Getting the system start time in Java?

Question:
Possible Duplicate:
time since JVM started

Is there a way to get the system start time in Java?
I am trying to make some animations using the Alpha class. Alpha is a Java3D API function that models a time-dependent function into [0,1]. An Alpha instance needs to be told how many milliseconds from the system start to wait before it begins running. It calls this its triggerTime.
I want to be able to write a line of code that starts the Alpha immediately upon execution of the line. It follows that I need to know how much time has passed since the system started. In other words, I need to set alpha.triggerTime to System.currentTimeMillis() - startTime.
So how do I find this startTime? I know that I could call System.currentTimeMillis() as the first line of my code, but this animation is happening in a thread called by a different class than the one that starts the program, and I don't want to have to pass the startTime around to all of these objects. There has to be a cleaner solution.
Thanks,
Jeff
Comment: What do you mean by the "system" start time? The time that the _computer_ was turned on, or the time that the _program_ started running?
Comment: @Bohemian Thanks very much for the tip. I did some searches but didn't turn up that thread.
Answer: 'myAlpha' will start immediately upon execution of following line assuming that 'triggerTime' is '0' (startTime + triggerTime >= currentTime) :
<code>
myAlpha.setStartTime(System.currentTimeMillis());
</code>
August, InteractiveMesh

Getting the system start time in Java?


Idle state in RTOS, sleep state or lowest frequency?

Question: In real time systems using an RTOS, what how would the RTOS handle an idle period? Would it run nop instructions at the lowest frequency supported by a Dynamic Voltage Scaling capable processor? or would it turn to a sleep state? Can anyone refer me to actual practical implementations. Thanks
Answer: I depends entirely on the system requirements. Systems that need to operate at very low power could go to sleep until the next interrupt. Other systems might have plenty of power but need to be very reliable...these could be doing self-tests in the background task.
Answer: It would most likely go to for one of the device's sleep mode.
It's very quick (often a matter of a single instruction) and designed to do exactly that: fill inactive periods with inactivity ;) This in turn helps to save power.
However, if power is not a concern to you, you may simply "halt" in a polling loop until a continue condition occurs.
Clocking the system down seems like a "half-way solution" - doesn't make much sense to me.
Answer: You asked about a practical implementation. Here are the QNX power management definitions. It's highly customizable.

General CPU Power Mode Definitions
Our sample power policy is based on four general power mode
  definitions: Active/Run, Idle, Standby, and Shutdown. Because the QNX
  power management framework is completely customizable, these power
  mode definitions are used for convenience only. There are no
  assumptions or dependencies on these definitions. The general CPU
  power modes can be defined as follows:
Active/Run - The system is actively running applications. Some
  peripherals or devices may be idle or shutdown.
Idle - System is not running applications. CPU is halted. Code is all
  or partially resident in memory.
Standby - System is not running applications. CPU is halted. Code is
  NOT resident in memory.
Shutdown - Minimal or zero power state. CPU, memory, and devices are
  all powered off.
These definitions are used as a guideline only. Multiple subsets can
  be defined for each state (i.e. Idle1, Idle2, etc.). Further, not all
  these CPU power modes may be required or even possible for a specific
  board or CPU.


Any suggestion for Classical Arabic language online dictionary or PDF?

Question: Can anybody suggest me the websites or PDFs from where I can get the meaning and etymology of Classical Arabic terms or any online dictionary of Classical Arabic language or any PDF of that dictionary?
Comment: Not quite what you need, unless you're linguistically-trained. Brill has *The Encyclopedia of Arabic Language and Linguistics Online* behind a paywall (not free), http://brillonline.nl/browse/encyclopedia-of-arabic-language-and-linguistics
Answer: There are no etymological dictionaries of Arabic, on line or in print. For a good collection of ordinary dictionaries see here: http://ejtaal.net/
Answer: If you want an English-Arabic dictionary for Classical Arabic then I recommend Lane's lexicon or Hans wehr dictionary.
If you want Classical Arabic dictionaries with only Arabic in it then I have a lot of dictionaries to recommend for you;

Lisan al-Arab ( لسان العرب)
Taj al-arus (تاج العروس)
Tahdhib al-Lugha (تهذيب اللغة)
Jamhara al-Lugha ( one of the five OLDEST arabic dictionaries in the world.
Kitab al-ayn  (كتاب العين, the OLDEST Arabic dictionary, it is writen in the 8th century)

You really don't have to worry about the content if these olde dictionaries. I also recommend you to visit http://arabiclexicon.hawramani.com/ and https://books.rafed.net/m/ and http://www.baheth.info/. These are very good websites.
Answer: try http://lex.sibawayhi.org
it's a little rough but it contains the full text of both Lane and Lisaan al-Arab, in parallel.
It's not designed as a dictionary, i.e. something where you just look up a "word".  It's a tool for exploring the lexicon.  it only understands roots, and will show you all permutations for a root, so you can examine Eg all words that start with "kt" and ponder whether they share a common semantic kernel - a very old theory in Arabic lexicology.  you need to read the help screen carefully and experiment.  E.g. Lane and the Lisaan pick different roots for some words that have "weak" letters, and I have not yet unified them.
Comment: The link did not work for me, internal server error.
Comment: That's odd; I've tried it on two machines with several browsers and it worked.  Maybe its a windows/mac thing? I'm using Mac (and Android).
Comment: Next try, entering the word for two اثنان Result: not found. Looks still very very beta to me.
Comment: it only understands roots so far.  try ktb, you'll get all 6 permutations.  read the help screen carefully and you'll see how to find roots with weak letters using wildcards.
Comment: try ثن. i.e use . as wildcard.


Gdm3 doesn't start after installing ATI d

Question: I have just installed some graphics drivers on my Debian 6. I used sgfxi script which generated /etc/X11/xorg.conf file and installed ATI drivers. After installation which was succeeded I couldn't start Gnome again. I saw only blinking cursor on the plain screen. When I rebooted system it looked the same. I used to use Debian about two years ago but I had never such problems with X-server.
Answer: It is because of the compatibility problems between your display manager gdm3 and your Graphics driver. Here is a tutorial which explains how to install ATI graphics card drivers without causing an Issue with your display manager : How to Install ATI drivers in debian ?
If you want to boot back in to your machine again, you have to un-install the existing drivers by going to the recovery mode and Un-installing the drivers. [Fix]Gdm3 doesn't start after installing ATI/AMD drivers in Debian !


Sync .IMG To Dropbox Without Reuploading Entire File When Changes Are Made?

Question: I have an issue, which is that when I try to sync an .img file to Dropbox on Android (via DropSync app), the entire file is reuploaded when even a single byte is changed. This doesn't happen with other files. I get the same behavior when using the DB for Windows desktop app. The files were created by Linux Deploy, an app that allows to run a Linux distro on rooted Android devices, in a chroot jail. LD uses the standard 'dd' utility to create the file. The file in question is 6+GB, so reuploading all of it when changes are made is undesirable. Is there something unique/different about img files that causes this? How can upload only the changes?
Comment: Can your break your IMG files into smaller pieces, such as 500MB a piece? Have you considered using an encryptor that works on the file level? This way if a file changes, only the modified files are sent again for syncing. This might be a better approach than IMG -- although your provider may be able to see your file names. https://play.google.com/store/apps/details?id=com.boxcryptor.android
Answer: Dropbox works by splitting the file into pieces (like Bittorrent). I don't know if the iOS or Android apps work the same, but Dropbox will just verify the split 4MB file pieces are identical and not upload it again. The .IMG file is most likely changing the content enough so that the file pieces do not match the previous upload.
Comment: @Enigma83 Are you sure that only a single byte of the _resulting_ file is being changed? Depending on the format, a single-byte change of "decoded" data may cause a larger change to the final resulting file.
Comment: @ sunk818: Nice answer, but I'm not quite sure I understand the rationale behind your explanation. I also have a TrueCrypt container file, I get exactly the same behavior when trying to sync that to Dropbox. At first I thought it was something peculiar/different about img files that caused this behavior. I apologize to everyone in advance for not responding quickly, been very busy and forgot I posted, especially since noone answered for a few days. Surely there must be a way to only sync the changes.........
Answer: Dropbox uses 'delta sync' which means only modified portions of files are downloaded/uploaded, instead of transferring entire files every time they're changed. However, the Android app DropSync does not support delta sync.
The reason this doesn't work with a TrueCrypt container (or any other encryption program worth it's salt) or some disk imaging solutions is that changing even one bye of the file in the container or disk image is going to change the entire container or disk image. The encryption would be severely compromised if you could change only one byte in the container and only one byte changed in the resulting container file.
Comment: @ Bert: Technically, you've answered my question, or at least provided a concise explanation that makes sense. I'll mark as solved here in a bit, but can you (or anyone else) maybe give some suggestions on alternative approaches I can try to sync this? I think next I'll try installing Linux to an ext4 partition on my SD card, then either use DB or rsync to try to upload it online. I would just have to make sure all files retain the correct permissions during this process.


there's no valid distribution profile for target

Question: I don't see the distribution under target settings but it's visible under project settings.
My login name on the system is Mac User
1) I made a new request for request certificate
2) I downloaded the distribution certificate from portal and drag into my keychain, I verified the Mac User named private key is underneath the certificate
3)I made a distribution profile under portal and dragged into xcode.
it says cosign error the identity ipone Distribution doesn't match identity  in any profile
Comment: Yet another codesign error question
Answer: Maybe your bundle ID does not match?


Mirror Production Mongo Data for Analytics

Question: I have a Mongo cluster that backs an application that I use in production. It's very important to my business and clustered across a number of boxes to optimize for speed and redundancy. I'd like to make the data in said cluster available for running analytical queries and enqueued tasks, but I definitely don't want these to harm production performance. Is it possible to just mirror all of my data against a single box I throw into the cluster with some special tag that I can then use for analytics? It's fine if it's slow. I just want it to be cheap and not to affect production read/write speeds.
Comment: is your production mongod part of a replica set?
Answer: Since you're talking about redundancy, I assume you have a replica set.
In that case you can use a hidden replica set member to perform the calculations you need.
Just keep in mind that the member count must be odd. If you add a node you might need to also add an arbiter. Or maybe you can just hide one of the already existing members.
Answer: If you are looking for a way to increase querying speed having a lot of data, you have to look might look into sharding with mongodb. Basically what it does is dividing your big amount of data into small shards and stores them on different machines.
If you are looking to increase redundancy (in order to make backup or to be able to do offline processing without touching primary servers) you have to look into replication with mongodb. If you are doing replication, keep in mind that the data on the replicas will be always lagging behind a primary (nothing to worry about, but just need to know this fact to decide can you allow read from the replicas). As it was pointed by Rafa, hidden replica sets are well suited for backup and offline data processing. They will still be able to get all the data from primary (with small lag), but are invisible to secondary reads and can not become primary.
There is a nice mongodb course which is talking in depth about replication and sharding, so may be it is worth listening and trying it.
Comment: that's not at all relevant to the question asked - he doesn't want to handle more data, he wants to handle an additional query pattern on existing data.


Is it acceptable to wear kit from old team?

Question: When I was in college I was on the club cycling team and it was fun, I went to a good share of races, was pretty involved with the team, etc.  Now I'm out of college and it's a few years later...is it acceptable for me to wear my old university team kits when I'm out riding casually on my own or with a few friends (not at events)?
Comment: I think it'd be fine because you have that historical connection.  Personally I prefer plain clothes without wording or gauche patterns, and I've gone to the point of unpicking stitching to remove names.
Answer: I guess it's a matter of opinion, and cyclists have a lot of rules, but personally I would go for it. You were actually on the team after all. I think that the rule #17 from the above link applies here. Personally, I'd rather wear old kit from a team I was personally on than wear kit from a pro team that I have no affiliation with, or even non-pro-kit with logos plastered all over it.
Might even be a great way to start up a conversation with people who recognize the kit, either riders who are currently on the team or even just people who went to that school.
Comment: I think the only case where you shouldn't wear your old team kit is if there was a case of dishonorable discharge, like being kicked off the team for some reason.  That's the only time I could see it being in bad taste. From the way you worded the question I'm quite certain this is not the case.
Comment: Absolutely go for it! It's no different from wearing an old 'varsity top. Think of it as advertising for your old club.
Comment: Cool, that makes sense.  I guess I just felt unsure about it since I'm not on the team anymore!


calculation of binary power like $a^b$ where a,b are binary numbers

Question: Is it possible to calculate power of binary number like $a ^ b$where a,b both are binary numbers.
Comment: Yes.  It is possible.
Answer: One of the faster and simpler methods is exponentiation by squaring. It is based on taking advantage of the fact that an integer power can be easily reduced by dividing the power by two (possibly with remainder):
$$
a^b = a^{\left \lfloor \frac{b}{2} \right \rfloor  2 + b \% 2}
$$
where $\left \lfloor \frac{b}{2} \right \rfloor$ denotes the integer quotient of $b$ and $2$, and $b \% 2$ denotes the remainder (i.e. $1$ for an odd number, $0$ for and even number). We can then rewrite this as:
$$
a^b = (a^2)^{\left \lfloor \frac{b}{2} \right \rfloor} a^{b \% 2}
$$
Which now reduces the problem into squaring $a$ (which is trivial), and repeating the same algorithm with power $\left \lfloor \frac{b}{2} \right \rfloor$ and base $a^2$. This will recursively reduce the exponent at each step, ensuring termination.
Comment: In exponentiation by squaring method only the component $b$ is in binary. however i want the method in which $a$ as well as $b$ both the term is in binary form.
Comment: @Aria Only $b$ needs to be an integer, but $a$ can certainly be an integer (in binary form or not). You then just use binary multiplication to calculate $a^2 = a * a$ (and to multiply by $a$ if $b$ is odd). The fact that these numbers are in binary doesn't really matter in this case. The binary aspect is only relevant here in that it makes calculating $b/2$ and $b \% 2$ far more efficient than an arbitrary division, because they can be done with a right shift of one bit (i.e. `>> 1` in most programming languages) and by taking only the lowest bit (i.e. `& 1`) respectively.
Comment: What this algorithm does is give an efficient way of computing an integer power of anything (even matrices or other groups/associative operations), using only multiplication.
Comment: can you please give example with binary numbers like 0010^ 0111.
Comment: I'm not sure why you see the need to do it by hand with binary numbers; binary is mostly useful when doing things by computer, but here it goes:
Comment: $0010^{0111} = (0010*0010)^{0011} * 0010 = 0100^{0011} * 0010 = (0100*0100)^{0001} * 0100 * 0010 = 10000 * 0100 * 0010 = 1000000 = 128_{10}$. If you found that hard to follow, that is because binary is not a good way to do calculations by hand; its much easier to just compute $2^7$.
Comment: in my coding everything is in terms of binary, so for raising power i have to convert it in decimal. that's why i need it.
Comment: Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/23797/discussion-between-john-colanduoni-and-aria).


In Xcode, is there a way to sort the dropdown list for methods

Question: In Xcode, there is a preferences option to sort the Editor Function pop-up alphabetically which is great. However, this does not take into consideration the #pragma mark headings which also appear in this list. It would be great to have this list sorted alphabetically first by #pragma heading, then by method. Is this possible? Perhaps with a script?
Answer: I can help you a little bit:
Just hold Cmd while you click on the methods-list-item in Jump Bar. Now they are all sorted alphabetically.
Only Pragma marks are grouped together at the end of the list. That's ugly. The rest is fine.
If you want to go further you're able to click on the list-item and then start typing any search for a method name and you instantly get the search results for the appropriate methods.
Enjoy.
Answer: Assuming you are talking about the method list at the top of an editor window: not in XCode 4 - scripting is broke so there is no way to applescript it either. The list appears in order of the methods in your source file. File a bugreport asking for this as a feature, in theory it shouldn't be difficult for Apple to implement since the index of methods is already built.


16th Century English

Question: I was wondering that how was the pronunciation of the word "about" in 16th century England. I know that it is different now and is this difference occurred because of The Great Vowel Shift?
Comment: Note that England is a big place with a lot of varying accents. This is true today, and it was much, **much** truer in the 16th century, before widespread travel among English speakers, or widespread printing, or even widespread literacy in English. So the answer to the question is that they pronounced it a lot of different ways, only a few of which have been preserved in writing, or in modern English.
Answer: The main change happening at this time was, as you mentioned, the Great Vowel Shift. Before the GVS, the second vowel in "about" was /u:/; this went through something like [ou], to [əu], before turning into modern /au/.
In the 16th century, it would probably be somewhere between [ou] and [əu].
This diagram (from Wikipedia) might help, though it writes the diphthongs a bit differently than I do.

16th Century English


Stop WP from creating "Sample Page" and "Hello World!" post

Question: Is it possible to stop WP from creating the "Sample Page" and "Hello World!" post when creating a new blog?
Answer: Create a file install.php in your wp-content directory. In that file you declare the wp_install_defaults() function. If you just leave that function empty no default categories, links, posts or pages will be created.
The default (pluggable) wp_install_defaults() function can be found in wp-admin/includes/upgrade.php.
Also see: https://stackoverflow.com/questions/550086/how-to-delete-the-default-hello-world-post-before-wordpress-install
Comment: Thank you! Do you have an idea to solve the problem with WP Multisite? After adding the install.php in the wp-content directory I get a 500 Error when creating new site.
Comment: Sorry, ignore my comment—the 500 Error was caused by something else! Also works for Multisite!
Comment: This will also cancel the creation of the 'Uncategorized' category, and a host of other settings. check the function at the following link to see what exactly you'll be overriding: https://core.trac.wordpress.org/browser/tags/4.8/src/wp-admin/includes/upgrade.php#L130
Comment: Please see my answer below for a less destructive way of doing this _for multisite installs_ https://wordpress.stackexchange.com/a/272252/13118
Answer: If you're using Multisite
The accepted answer is destructive in that it cancels all other set-up items in the overridden function. A less destructive way to do it for multisite installs is to delete the default content during new blog creation by hooking in to wpmu_new_blog
add_action( 'wpmu_new_blog', 'delete_wordpress_defaults', 100, 1 );

function delete_wordpress_defaults(){

    // 'Hello World!' post
    wp_delete_post( 1, true );

    // 'Sample page' page
    wp_delete_post( 2, true );
}


How to test the equality of two Pearson correlation coefficients computed from the same sample?

Question: Is there a reliable way to say if two Pearson correlations from the same sample (do not) differ significantly? More concrete, I calculated the correlation between a total score on a questionnaire and an other variable, and a subscore of the same questionnaire and the variable. The correlations are respectively .239 and .234, so they look quite similar to me. (The other two subscales did not significantly correlate with the variable). Could I use a fisher Z to check if the two correlations indeed do not significantly differ, or is the fact that they are not independent a problem?
Answer: Firstly I would point out that these correlations are fairly low.
Second, have you plotted the data to investigate possible non-linear associations?
Third, I would say that common sense should dictate that correlations of 0.239 and 0.234 are essentially the same and searching for a test to confirm this, unless the sample size is absolutely enormous, is folly.
Fourth, you could calculate confidence intervals for both statistics, and if they do not overlap, then you can conclude that they are statistically significantly different. However, this would be invalid since the 2 samples are not independent. Moreover, as per my third point, even if you did have such an enormous sample and a test which validly concluded that a significant difference exists, I would find it hard to belive that the difference was practically significant.
Comment: Thanks for your reply. I am indeed aware that the correlations are small. I have checked for non-linear associations. I also feel like the difference is not meaningfull, but I just wanted make I do everything in the best possible way. Thanks!
Comment: @ChaFo that's OK, but you don't always have to make a formal test, especially where it seems obvious that they are essentially the same. How many observations do you have?
Answer: Expanding on Robert Long's answer (+1 to Robert) I'd say that testing for a difference between these is folly, regardless of sample size. Look! Is 0.239 different from 0.234? Well, maybe it is. There are situations where a very small effect size is very important. If a plane crashes 1 in 1,000 flights, that's a big big problem.  I can't think, offhand, of a situation where this tiny difference in correlations could be meaningful, but maybe there is one. Whether it is significant or not is not the point.
Also, the dependence will surely be a problem. If you really wanted to see something like this, I'd find a third correlation: The correlation between the test after removing the subtest. Then you can compare that to the correlation with the subtest.
Finally, it's unclear to me what you are trying to show, but I think you are trying to show that these are not different. In that case, the usual null hypothesis tests are inappropriate. You should be looking at tests of equivalence (if, in fact you want to look at significance at all).
Comment: Excellent points, Peter (+1)
Comment: Peter Flom, the *population perspective* in epidemiology says, in effect, that a tiny change in risk—one that is so small as to be effectively inconsequential clinically—is a big deal if it is multiplied across an entire population. Changing someone's risk of stroke by 1 in 10,000 per year is kinda meh. Changing 10,000,000 people's risk of stroke by 1 in 10,000 is a change of a 1,000 strokes per year: a big deal. See Rose, G. (1985). [Sick individuals and sick populations](https://academic.oup.com/ije/article/30/3/427/736897). *International Journal of Epidemiology*, 14(1), 32–28.
Comment: Of course, Pearson's correlation coefficient alone isn't likely to be the most used measure of contrasts in risk, but I think small associations can matter.
Answer: Yes, it is possible to perform a significance test using the Fisher transform. This also depends on $N$, the number of samples used to compute the Pearson correlations. This blog post describes the method in more detail, and provides R code for it.
Comment: Your reference is inappropriate for comparing correlation coefficients that share data, as is the case here.  The OP points out that "the fact they are not independent" is the problem.
Comment: Yes, I see. OP's situation involves overlap between the two datasets, but is not a case of paired data. Therefore, my answer is inappropriate.
Comment: Actually, it sounds like the data are *triples:* that's what makes it possible to compute more than one correlation coefficient.


How can I get my XBox 360 data off of a RROD console?

Question: My older-style XBox finally died with the Red Ring Of Death (RROD). It has an external hard drive attached. The newer XBox 360s don't support that style of hard drive? I guess I could get another old one, but won't that just mean another RROD is around the corner? Are there ways of transferring the data with a transfer cable or something? Can I take the hard drive apart and somehow transmit it with my computer or something? Anything else I might be able to do?
Comment: Be sure it is a REAL RROD, I had one caused by my hard drive not being pushed in all the way, and another by the fans getting stuck by a cat. Another time was the power cable not being pushed all the way in, similar instance occurred with screen cable.
Answer: You are correct that the older hard drives are not directly compatible with the newer models. They won't just plug in.
Microsoft sells an official Xbox 360 Transfer Cable which will allow you to attach your old hard drive to a newer Xbox 360 model and move the data over. It can be purchased online from them, or a few other places.
The full instructions to do the transfer can be found at http://support.xbox.com/en-US/xbox-360/accessories/set-up-transfer-cable
Comment: @Mario The hard drive disconnects from the console (in old consoles, and new ones too), and if it's truly the RROD, it has nothing to do with an error on the hard drive. The data should be fine. The transfer cable connects directly to the old hard drive, not the old Xbox, so it doesn't require the old machine to be working, just the drive.
Comment: Are you sure this works? I'd assume the RROD means the console is essentially halted (similar to a bluescreen), so it will no longer talk to other components (like controllers or the USB cable) or do/access anything.


How can I share OS X fonts with Windows XP when using vmware-fusion?

Question: When using VMware Fusion, is there any way to share fonts between the base OS (i.e., OS X) and the virtualized OS (e.g., Windows XP)?  If so, how?
Answer: You'll need to copy them to Windows's disk and add them to the Fonts folder in the Control Panel. There is no provision for "sharing" fonts.
Comment: Thank you CajonLuke.  I tried copying the font from the OS X font folder to the Windows font folder, but only the bold version of the font is visible on the Windows VM.
Comment: Is the font file just the one weight or is is a "suitcase" with multiple weights? How does Font Book on the Mac handle the font?
Comment: Font Book shows that it has [Regular, Italic, Bold, ExtraBlack, Bold Italic].  And when I look at the file name it has a `ttc` extension, where most of the other fonts in my library have a `ttf` extension or no extension at all.
Comment: It appears that Windows doesn't support .ttc font collections. I tried to move one to my Windows 7 VM and it claims that the file is invalid.