Can we charge a ray of light? Can photons never be charged under any circumstances?

Question: can quantum theory never explain the hypothetical phenomena of charging photons? were there any experiments in this feild?
Comment: Photons are the force carrier between charge particles. In a way "charging a photon" would be like "adding air to a sound wave", its nonsensical imho.
Comment: There is no hypothetical phenomenon of a charged photon.
Comment: It is unclear what you are asking. Redshift changes the frequency and energy of photons. Mirrors and lenses change the direction.
Answer: Light does not have charge and cannot be given charge under any circumstances. Light is produced by accelerating charge, but doesn't and can't itself have charge.
So photons are electrically neutral particles. The only force-carrying bosons that have electrical charge are the $W^+$ and $W^-$ bosons of the weak nuclear force which have charge $+e$ and $-e$ respectively.
You can, however, charge a battery using photons, such as with a wireless cellphone charger. The photons are not carrying charge; they are carrying energy to "charge" the battery by separating charges already in the battery.
Answer: Photons are elementary particles, pointlike, and EM neutral. This is the currently accepted theory of the SM.
Though I asked a question about why only the W is the only elementary boson with EM charge.
Why is the W boson (and none other elementary boson) the only with EM charge?

The gauge group of the electroweak part of the standard model is SU(2) × U(1). The group SU(2) is the group of all 2-by-2 unitary matrices with unit determinant; all the orthonormal changes of coordinates in a complex two dimensional vector space. This combination of generators (a z rotation in the SU(2) and a simultaneous U(1) rotation by half the angle) preserves the vacuum, and defines the unbroken gauge group in the standard model, namely the electric charge group. The part of the gauge field in this direction stays massless, and amounts to the physical photon.

Now in a functional reasoning, the W is the only elementary boson with EM charge, because whenever it is mediated between particles, the emitting particle gains or loses EM charge.
Now with the photon, the mediator of the EM force, there is no such EM charge gain or loss. Whenever a particle emits (real) photons, it does not gain or lose EM charge. When an electron emits the photon, the electron's intrinsic property, the elementary charge stays constant. Thus the photon needs to be EM neutral.

It is true that gauge fields are always in the adjoint, except when the gauge group is Abelian (e.g. U(1) EM) in which case the adjoint is just the singlet (or 'trivial') representation. This is why the photon is neutral.

https://physics.stackexchange.com/a/462738/132371
Comment: why the downvote?


Transparent bar along my render

Question: This is a new one for me.... For some reason, my renders are creating this transparent bar on the far right. I have no compositing happening.

UPDATE: I've never seen this before but I think this was the issue as it's fixed but I'm very confused why it's even there in the first place as I've never seen it on any of my other projects before. These weird corner cropping things were moved. I don't know what this is or how it became visible (I must of accidentally turned it on and moved it or something) Any idea what this is?
Answer: I found the solution. I had render region selected.

Transparent bar along my render


Granting Permissions for a limited period of time

Question: Is it possible to grant permissions to a user for just a certain period of time? For example, I ran into a situation the other day where I wanted to grant a user the ability to modify data in a table for only a couple hours. I haven't found a native way to do this, but thought I'd ask anyway. This would be specifically for Azure SQL Database.
Comment: Also see https://stackoverflow.com/questions/27309474/best-way-to-schedule-sql-job-in-microsoft-azure
Answer: A very simple approach would be to open up an SSMS query window that's connected to the instance you want and use either WAITFOR DELAY or WAITFOR TIME
WAITFOR DELAY '00:01:00' --waits for 1 minute
PRINT 'FINISHED' --revoke permission code
--(optional TSQL code to send an email when complete

or ------
WAITFOR TIME '08:00'  --waits until 8am
PRINT 'FINISHED' --revoke permission code
--(optional TSQL code to send an email when complete

You could even include TSQL code to send you an email indicating the process had completed.
Keep in mind that if your SSMS session dies for any reason, the revoke code will not be executed.
A more robust (and more complex) solution would be to use Service Broker BEGIN CONVERSATION TIMER
Answer: There is no "native" way to do this.  In addition to Scott's answer, you could also create a job with T-SQL commands to revoke the permissions, and schedule it to run at the specified time.  This would remove the dependency on your SSMS client staying connected, ensuring that it runs, assuming that the server stays running.
Comment: I didn't think that Azure supported the SQL Server agent, so I did not include that in my answer.  I don't actually work on Azure, so you may know better than me.
Comment: If you have any server (or even your workstation) that can connect to it--you could create a Windows scheduled task to run a PowerShell script.  I don't have experience with Azure SQL, but we have cloud Exchange and we do quite a few things from on-premise servers running scheduled tasks.  Once you figure out how to do it then you'd just need to change the task schedule and the .sql script to according to the situation.
Comment: @ScottHodgin - You are correct. Azure doesn't support the SQL Agent, yet. However, as soon as Managed Instances goes live, it will.
Comment: Alternatively, you can use a local SQL Server agent job to invoke `SQLCMD` to talk to Azure and do what @TonyHinkle is suggesting - see [How to Run Scheduled Jobs in Azure SQL Databases](http://www.sqlservercentral.com/articles/Azure+SQL+database/143461/)


No heat overheating when moving

Question: Hey car overheating and have no heat,it doesn't over hit when idle.but when the car start moving them temp rise quick.I check the radiator the top hose is warm and the bottom hose is cold
Comment: Doggy. Looks like your first time posting here.   Welcome. It's not clear at all what's going on with your car.  Year/ Make/ Model, odometer mileage and your location would be very helpful.  Possible clogged radiator, low coolant, bad pump or cooling fan issue?
Comment: Thank you for the enlightenment.I have 2004 Honda civic lx 5 speed coupe....175k miles on it I live in Massachusetts.
Comment: This seems to be an overwhelming problem with the D17A1 engines. I can say this because mine (I have an '03 LX) does the same exact thing. The largest problem I see right now with my Civic is it continually eats coolant. As long as I keep it full at the radiator, it won't overheat and it will blow hot air from the heater. It doesn't matter what the amount of coolant you have in the overflow, either. I don't have a fix for it, but I'm going to be putting a new engine in the car because the previous owner let it overheat one too many times.
Answer:
Hey car overheating and have no heat

I take that to mean that your temp gauge rises very high (perhaps a warning light) and that you are unable to get warm in the passenger compartment in the winter.
If I understand that correctly, I believe that you've got a huge air bubble inside the cooling system, and the coolant level is way low.
I'm pretty sure your system uses an overflow bottle to ensure that the cooling system is ALWAYS topped up.  My guess is you've got a bad radiator cap, or perhaps a cracked overflow hose. You may well have a coolant leak as well.
Its important to top of the coolant system when the engine is cold. Use a 50/50% mix of distilled water and antifreeze. Don't use plain tap water, that will cause sludge in your radiator over time.
When you do the initial top off you will also want to open a coolant bleeder valve.  It should be somewhere near the top of the engine.  This enables you to fill the coolant system and get out most of the air inside.
Check both springs on the radiator cap.  My guess is on your cap, that small disk hangs loose.

The way this should work is you have a nearly topped off radiator (when engine is totally cold) and an overflow bottle filled to mark on the side of the bottle. What should happen is that when you drive the car, the engine warms up and the coolant expands a bit.  After you park the car at night, the engine cools down.  As it cools it shrinks a bit.  When it does this it creates a vacuum in the cooling system and should suck coolant from the overflow bottle back into the engine.
After a proper initial fill and two or three drive cycles there should be absolutely no air trapped inside your cooling system.
Now if I've misunderstood your comment about have no heat that changes the conversation.
A couple of tips.

I recommend you purchase a Haynes or Chilton type repair manual for your car.  $30 well spent.  That book should also detail the coolant fill / bleed operation in detail.
If they have one near you, AutoZone has this amazing tool loaner program.  You leave a 100% refundable deposit on special tools.  One of the tools they have is a really nice coolant tester.  You place it on the radiator fill (engine off!), pump the thing to 13 psi and look for coolant leaks. Very easy and safe to use.

No heat overheating when moving


How to Execute a program from anywhere in terminal

Question: How could I execute a program which I downloaded from website and able to execute from $HOME directory or anywhere in terminal?
Comment: if you want to run a locally installed application by its application name (as command) take a look here http://askubuntu.com/a/440247/72216, I think it covers your question. (especially the third paragraph)
Answer: Lets say the command you have to run to execute the program is ./path/to/file and programs name is xyz
So create a .bash_aliases file in your home directory.
Add the line to the file create a alias for the command.
alias xyz="./path/to/file"

Save the file and restart terminal.
Next time you can run the program by typing just xyz
Comment: Thanks for the answer. Additionally I had to execute 2 separate commands: source ~/.bashrc, and, source ~/.bash_aliases; thanks to this post: https://stackoverflow.com/a/55817651
Answer: If you currently have to run your program by giving the full path (say, /home/john/someprogram-1.0/someprogram), you can make it so the program runs by just typing someprogram. For this, you need the program to be somewhere in your PATH, which is a list of directories the shell searches for executables that aren't given as full paths.
There are three ways of accomplishing this:

Install the program. Depending on where it came from, it probably has installation instructions which will place it in a directory already in the path, like /usr/bin. Be aware that installing it this way needs using sudo, or having root privileges.
Add the directory where the program is right now to your path. You can try this manually by first doing export PATH=$PATH:/home/john/someprogram-1.0, then trying to run someprogram only, it should work. TO make this change permanent, add the export command as shown above to your .profile file (this file already exists in your home directory).
Put the program in your private bin directory. Create bin in your home diretory, then copy the someprogram file into this directory. This may not work if the program needs access to other data files.
Comment: Hi roadmr, no I can't execute because the tar file I downloaded does not have executable file untill I make one and put into usr/bin/ , thanks for your advise:)


Looking for links to projects where video decoders are used as general purpose ADCs

Question: The pricing for high speed ADCs is very high. However, since video decoders are used in just about every flat panel display, and these generally contain a couple of ADCs, their prices are very low.
So, the obvious question arises. Is it possible to use a video decoder as a multichanneled general purpose ADC....and even interleaving the channels to increase the bandwidth further.
I've been scouring the web and haven't been able to find any papers or DIY projects doing this. If anyone reading this is aware of any such projects, then please point me towards them. I'd love to see if this is possible (both using them channel by channel and interleaving the channels to get an even higher sampling rate).
In terms of pricing, a video speed general purpose ADC would cost in the order of $30 per chip, whereas the video decoder would be priced at about $3 per chip, a pricing order of 10:1 !!!!
So, if you know of a project or paper related to this, please pass on the link. Many thanks in advance.
Answer: I like this idea.  You may find that the level clamping and line buffer xcircuitry may prevent you from using it as a general purpose ADC device.
Check as many data sheets as you can find, some chip might have a debug, or level aquisition mode that streams raw samples.
I would see if there is any information relating to the opensource Software Defined Radios that makes use of commodity interfaces.  Something in this line may be able to serve your purposes.  Also there are some DIY digital scopes that may serve but this may be exactly what you are trying to replace.
Comment: Yes! Someone did discover that a common satellite DVB decoder could be used as a software defined radio (SDR) chip and now you can get a $15 SDR solution, instead of the previous $1000 solutions. So, that is very similar to what I'm thinking. Making use of chips for uses that they were not designed for can occasionally result in innovative solutions to previously unsolved problems. On your 2nd point, most of the DIY scope projects don't handle more than audio frequency ranges. I'm looking for things like 250MS/s .... So, thank you and anyone else reading, keep the ideas coming....


Why not use the KEK directly to encrypt data?

Question: This answer seems to suggest that the KEK (Key Encrypting Key) can be used to securely encrypt data. Why have a DEK (Data Encryption Key) at all?
Comment: KEK allows you to change keys without re-encrypting the data.
Comment: Welcome to the community. I would recommend adding your use case and some background for a more clear and focused answer.
Answer: You need the two. You create a random symmetric key (the DEK), encrypt all data with it. You create a keypair (the KEK) and use it to encrypt the DEK. You store both the data and the encrypted DEK together.
When you try to decrypt something, you first use the KEK to decrypt the encrypted DEK, and use the DEK to decrypt the data.
Two main reasons:

The DEK is a symmetric key: that means encryption and decryption will be way faster than using an asymmetric key.

The DEK never changes: you don't want to re-encrypt every single file, so you don't change the DEK.

You may want to change the KEK: if your KEK expires, got compromised, or you transfer ownership of the data to someone, you can re-encrypt the DEK with another key.

That's how Full Disk Encryption works. Imagine changing the password of the FDE and having to decrypt and re-encrypt the entire disk...
Comment: What system uses a keypair for KEK?  I thought that was also a symmetric key.  (The indirection provided by the two separate keys is still important because of your second and third bullets.)
Comment: @BenVoigt: Within full-disk encryption, I remember PGP 8.x used to have "PGPdisk" FDE which used your PGP keypair as the KEK; for file-level encryption, Windows' EFS uses a per-user X.509 RSA certificate (usually self-signed). Both allow granting access to multiple users.
Answer: A KEK enables separation of duties.
Managing sensitive data, such as customer credit cards or bank balances, is not a trivial task.   It starts with people who own the sensitive data wanting to encrypt their data, and only to decrypt it when there's a business need to do so.  The data owners want to govern exactly who can access their data; who can encrypt new information, and who can decrypt old information. They want a log of the users so that if something goes awry they can identify who had access and when. And they want the people and systems who manage those keys to not have access to their sensitive data.
Separation of duties is an assignment of roles such that no one person has unfettered access to the protected data. If someone wants to steal the data, they have to collude with other people to make it happen. So the data owner assigns one person (or team) the tasks of handling the sensitive data, and a different person (or team) handles the keys.
A key custodian is a person who holds the keys on behalf of the key owners.  They use a KEK to encrypt and decrypt DEKs that belong to the key owners.  A key owner then grants access to their DEK to a key user, who is someone authorized by the key owner to use the key to do their day job.
This is not quite as simple as keeping the keys locked in a safe.
KEKs are usually stored inside a Hardware Security Module (HSM), which is a tamper-sensitive dedicated cryptographic computer module that will erase the KEK if it detects an attack.  An HSM is designed to keep the KEK internally secured, never exporting it from the secure environment.  To use it, you authenticate to it, pass in an encrypted DEK, and it returns the unencrypted DEK.
(A YubiKey is an example of a small personal HSM that protects your passwords instead of DEKs. So-called "enterprise grade" HSMs are usually expensive rack mounted devices that are locked in special cages inside corporate data centers.)
This arrangement allows the key custodian to manage the database of encrypted keys, where all users are authenticated, all access is logged, and everything that the administrator uses to manage the keys is only handling encrypted DEKs.  The HSM is often initialized by a different set of people with various roles such as the Hardware Owner, Security Officer, and/or Crypto Officer, all of whom have to gather around a PIN Entry Device to unlock it during an elaborate ceremony.  The custodian who manages the database is then a Crypto User, and is granted permission to access the KEK after they've unlocked it.
All this together is called a Key Management system, and they are commonly used by banks, financial institutions, and large corporations.  The key custodians then operate the key management system on behalf of the key owners.
The key user first authenticates to the key management system using something much less elaborate than the PIN Entry Device, such as their corporate credentials.  They then have access to certain keys in the key manager, and can use them only to encrypt or decrypt data, or to sign documents, depending on the rights the key owner grants them.  Optionally the key owner might grant someone permission to export a copy of their DEK so they can do the cryptography remotely, but this risks exposure of the DEKs.


Best Backup System for Ubuntu

Question: Is Clonezilla the best backup system for Ubuntu 12.04.5? And if so, what do I need to do to download it...ie: Do I need to partition files? If so, how to do this. Thanks.
Comment: You could try this question: [Comparison of backup tools](http://askubuntu.com/q/2596/178596)
Comment: flagging this too broad
Answer: Backups is kind of complicated, because everybody has different needs.
Clonezilla is an option, as you mentioned, but for a desktop system something lighter like Duplicity or Deja-Dup might be a better fit, as smaller, incrimental backups can be stored on a remote server or an external drive.
Tarsnap is a lighter, secure alternative.
If you've got multiple systems in your environement, something like Bacula might also be useful, but requires a much more complicated setup.
Comment: Thank you K. Daien Freeheart. I'm going with Clonezilla after researching all of your suggestions.
Comment: Note: Dega-Dup seems to work fine for /home, but so far fails to backup protected system files.  People suggest sudo deja-dup --backup but that can't find my plug in USB drive.

Best Backup System for Ubuntu


What percentage of troops support President Trump according to latest polls?

Question: The following Newsmax article says:

A majority of America's military troops are backing Donald Trump –
with career-minded forces favoring him by a 3-to-1 margin over Hillary
Clinton, a Military.com poll shows.
The survey, released Wednesday, shows of more than 1,300 active-duty
members of the National Guard or Reserve, 67 percent plan to vote for
Trump compared with 21 percent who say they will vote for Clinton.

But, these numbers are disputed by many Twitter users:

What percentage of troops support President Trump according to latest polls?
Comment: Politics/polls can change over night. That article was from November 2nd, and those tweets are from Feb 9th.
Comment: Please do not confuse "support" as in popularity with "support" as in directly supporting unconstitutional acts. When I was in the US Navy, I supported Jimmy Carter. If his administration had asked us to fire into peaceful protestors, or surround congress, or those kinds of things you see in dictatorships, many of us would have refused. The first part of the US military oath is, "I will support and defend the Constitution of the United States against all enemies, foreign and domestic; that I will bear true faith and allegiance to the same". The president comes after that.
Comment: @RichF  You'd better be absolutely 100% certain that an order is unlawful before disobeying it.  Even in your contrived examples, I can think of circumstances where you would have been wrong to disobey.
Comment: @MichaelJ. True. Such disobedience would quite possibly lead to getting shot on the spot. But the world, including the USA, has already established, and even mocks, the defense, "I was just following orders."  A good soldier **must** think.
Answer: The original source for the 3:1 number is military.com, and it is worth looking at the source. The poll is from Oct. 24 - Oct. 31 2016.

Career-oriented troops favor Republican presidential candidate Donald Trump over his Democratic opponent Hillary Clinton by a 3:1 margin, a new Military.com reader survey has found.
  [...]
Trump's lead narrows when the results are filtered for the active component. For example, among only active-duty respondents, 63 percent said they plan to vote for him.
  [...]
  Military.com conducted a voluntary online survey of readers [...] The sample is not a perfect representation of the military as a whole. It includes a higher percentage of airmen, soldiers, officers and noncommissioned officers, and a lower percentage of women, minorities and junior enlisted personnel than are in the force.

NBC News also had a poll around the same time via survey monkey (see here). The poll is from Aug. 29 - Sept. 4 2016.

Donald Trump leads Hillary Clinton by 19 points — 55 percent to 36 percent — among voters who are currently serving or have previously served in the U.S.
  [...]
  A sizable number of military and veteran voters say they would not be confident in Clinton or Trump's ability to be an effective commander-in-chief of the nation's military — but a slight majority would be confident in Trump (53 percent).

Militarytimes.com also had a poll (also online, and also unscientific like the military.com poll). The poll is from Nov. 10 - 14 2016.

The poll surveyed 2,790 active-duty troops. Among those who voted, 51 percent said they supported Trump.

They also had a number of previous polls (eg here or here). qz.com notes that the high percentage for Trump is mainly due to the demographic markup of the military (more men than women).
Fox News also had a poll. It did not ask active military personell, but veterans. The result was 46% for Trump, 34% for Clinton.
The claim that exit polls show 60% for Trump is correct. Looking at the military.com poll, the fact that many voted by mail would likely reduce that percentage, not increase it, as those currently active are more likely to need to vote by mail, and according to that poll, they are less likely to vote for Trump.
There do not seem to be any polls that are more recent than these.
Comment: This useful answer would even better if it included the dates of the polls.  It's possible to follow the links, but links are impermanent shifty things...
Comment: Historically, the main divide has been between officers and enlisted men. Enlisted men tend to have the politics of a demographically similar slice of Americans or to be only slightly more conservative. Officers have tended to be extremely conservative with GOP v. Democratic shares (excluding don't know and don't answer) as much as 9-1 for which even a 3-1 would be a remarkably poor performance relative to historical trends.
Comment: See *Time* (2012) http://swampland.time.com/2012/11/05/does-the-military-vote-really-lean-republican/ "between 1976 and 1996, the share of senior military officers identifying itself as Republican jumped from one-third to two-thirds, while those claiming to be moderates fell from 46% to 22%. Senior military officers who described themselves as liberal fell from 16% in 1976 to 3% in 1996."
Answer: The Cooperative Congressional Election Study includes data which provides an insight into this. Looking at the most recent study available, 2018, we can split out respondents based on the following:

I am currently serving in the U.S. military - 368 respondents.
I have immediate family members currently serving in the U.S. military - 3812 respondents.
I previously served in the U.S. military but I am no longer active - 6768 respondents.
Members of my immediate family have served in the U.S. military but are no longer active - 23159 respondents
Neither myself nor any members of my immediate family have ever served in the U.S. military - 29659

If we then look at how these respondents reported voting in the 2016 Presidential Election, we can produce the following:

This clearly shows a preference for Trump among those with a military background, and a preference for Clinton with those who have none.
We can also look at how these groups responded when asked whether they approve of how Donald Trump is doing his job, this also reveals some interesting data:

This shows, again, a large difference in approval for Trump between those with a military background, and those without, but also a significant difference between those who have served or are serving in the military themselves, and those who just have their immediate family serving/previously having served.


What is an approach in computer vision that can be used for tracking players in hockey games?

Question: It differs from human tracking in random environment in that detail that we have fixed environment. And players move pretty fast and it is important to resolve collisions and occlusions, keep track of right person. So please tell me what you think about this problem. Or what paper can be used to implement state-of-the-art approach for human tracking that you are aware of?
Comment: Your question has beeen answered. Do not hesitate to vote for the useful ones and accept the most suitable
Answer: Regarding speed and occlusions, I would suggest you to take a look at this work on basketball: Locate and Track People in a Network of Fixed Overlapping Cameras, and notably published in A. Alahi, Y. Boursier, L. Jacques, and P. Vandergheynst. Sparsity Driven People Localization with a Heterogeneous Network of Cameras, in Journal of Mathematical Imaging and Vision, 2011. Then by looking at its citation network, you could find other relevant work.


Chainlink VRFv2 - How is gas cost determined?

Question: What determines verification gas cost for vrf v2? I understand from the documentation that the gas limit is hardcoded at 200,000 but how is the actual cost calculated?
Answer: For Chainlink VRFv2, there are two cost considerations when it comes to the oracle gas cost (the LINK paid):

The premium
A calculation based on the price of the L1's gas costs at the moment. See a link to the Chainlink contracts here.

The premium you can find in the Chainlink docs, and it's just some flat value added to requests so that node operators have an incentive to have uptime.
The calculation is so that when gas prices get volatile, node operators are still able to cover the costs of returning data to contracts, since the nodes are paying the gas costs themselves.

A note on gas limit, the callbackGasLimit is actually a value that the user can select. However, there are "gas lanes" for calls, where a call will not be created if the gas price is higher than the threshold of the lane. You can specify the lane using that lane's keyhash.
ETH Mainnet example (as of writing)
200 gwei Key Hash   0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef

500 gwei Key Hash   0xff8dedfbfa60af186cf3c830acbc32c05aae823045ae5ea7da1e45fbfaba4f92

1000 gwei Key Hash  0x9fe0eebf5e446e3c998ec9bb19951541aee00bb90ea201ae456421a2ded86805

Comment: Will the "Premium" ever go down/up based on the current LINK price? e.g today the .25 LINK premium roughly equals $1.8, but if LINK goes back to its all time high price of around $50 that same call would cost $12.5 (just for the premium). I am working on a project that is estimating a total need of 4,000 LINK for 10k VRFv2 calls -- would we be better off buying all the LINK now that the price is low or does Chainlink constantly update the LINK premium to account for price movement?


How to generate faster local notification in iOS?

Question: I am generating Local notification when Push notification(Actionable) are received but app is closed or in background. I have used following code to generate local notification in objective-c.
<code> - (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void (^)())completionHandler {

        UILocalNotification* localNotification = [[UILocalNotification alloc] init];
       // localNotification.fireDate = [NSDate date];
        localNotification.timeZone = [NSTimeZone defaultTimeZone];
        localNotification.alertBody = @"Security settings enabled, tap to start the application";
        localNotification.category = @"LOCAL_NOTIFICATION"; //  Same as category identifier
       // [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
        [[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];

}
</code>
1.When i drag notification trey down(Notification Center) not from alert it generate local notification fine in 1 sec.
2.But while press action from alert(while at home) it
 it takes 3-4 seconds for local notification to appear.
Why there is time difference between action from alert(press action from home) and Notification center(swipe down notification trey)
generating local notification?
How to make it faster? Thanks in advance.
Answer: Try to use the presentLocalNotificationNow method instead of scheduleLocalNotification to make your notification fire instantly:
<code>[[UIApplication sharedApplication] presentLocalNotificationNow:localNotification];
</code>


Displaylink USB monitor on Lubuntu 18.04

Question: System is an old Acer Aspire One running Lubuntu 18.04.
Hoping to use an AOC e1649Fwu USB monitor as 2nd display.
This page says the latest Displaylink driver (4.2) works with 16.04 + 17.10 -- no mention of 18.04.
The Displaylink driver alone did not work on another system on 16.04, however after running the script from Adnan Hodzic here, it's working fine.
I then tried Adnan's script on the Acer, the result of which was a bricked OS.  Now I've rebuilt the Acer on 18.04.
The question is- has anyone gotten a Displaylink monitor working on 18.04 yet, and if so, can you share your steps. I'd appreciate knowing what others have done, hoping to avoid bricking this new 18.04 build.
Answer: I used Adnan Hodzic script to make my displaylink usb-vga working on Ubuntu 18
After launching the script, I chose [U]ninstall in the first time, because I already tried to install the driver manually without success, then I relaunched the script to install drivers, after restarting the machine I got it working.
After restarting I typed
<code>$ xrandr --listproviders
</code>
It should show only one provider, then I plugged the device, then retype
<code>$ xrandr --listproviders
</code>
This time I got two providers, which means that the device has been detected. Finally I activated the device :
<code>$ sudo xrandr --setprovideroutputsource 1 0
</code>
Hope this will work for you.
I did something that I do not know if it was necessary, I edited xconf.org  by putting inside:
<code>Section "Device"
  Identifier "DisplayLink"
  Driver     "modesetting"
  Option     "PageFlip" "false"
EndSection
</code>
p.s. If I do unplug the device, it wont work until I restart the computer.
Answer: FYI - I'm using ubuntu 18.04.01 and kernel 5.4.0-91-generic with the ubuntu 20 driver (ver 5.4.1).
While trying to get an external monitor going I found

https://www.displaylink.org/forum/showthread.php?t=67228&page=2
and Displaylink driver do not work after kernel upgrade

The gist being:

DisplayLink's 5.2 driver and earlier seems to be targeting linux kernel < 5.4
DisplayLink 5.3 > seems to be kernel 5.4 or newer.

(or maybe kernel 5.3 is the mark. It looks like a basic driver was included in 5.3. I don't know what my previous kernel was I was using the last time this monitor worked. It's been a few months.)


Showing Section on custom Vf Page to some user through Permission set

Question: I have a vf page in that i included another VF page i.e
<apex:include pageName="2nd_vfpage"/>
I want to show that "2nd vfpage" to only allowed user. How we can do this through permission set.
Thanks for your help
Answer: If I understand it correctly you want to show parent page to all users and included page to specific user. Currently even if user does not has permission to child page he would be able to access it since user has access to parent page. There is a solution if you want to manage access to included page by permission set.
Lets consider an example. Here is my page which is available for every user.
EveryUserPage:
<apex:page controller="EveryUserController">

This page is for every user.

   <apex:include rendered="{!hasAccessToSpecialPage}" pageName="SpecialUser"/>
</apex:page>

This page can be accessed by any user. Now you can control access to included page which by setting a boolean variable and then you can check if current user has access to the page which are going to include by below code.
EveryPageController:
public class EveryUserController {
    public Boolean hasAccessToSpecialPage {get;set;}

    public EveryUserController(){
        checkIfCurrentUserHasAccessToSpecialPage();
    }

    public void checkIfCurrentUserHasAccessToSpecialPage(){
        hasAccessToSpecialPage = true;
        try{
            PageReference pg = Page.SpecialUser;
            pg.getContent();//if user does not have access to this page then it will throw exception
        }catch(Exception ex){
            hasAccessToSpecialPage = false;
        }
    }

}

Here we are making user of getContent. Whenever a user who does not have access to page tries to call getCOntent he gets an exception. If there is exception means user has no access to the page either by profile or permission set. Based on this information you can decide when to show page and when not to.
Just posting specialUser page:
<apex:page >

This page is visible to only speical users.

</apex:page>

Now you would be able to use permission set to manage access to speicalUser page for users to which you want to give access to.
Please mark this as solution if this helps you so that others could be benefited from this.


ImageMagick leaving behind temp files - is this by design or should they be automatically deleted?

Question: I've installed ImageMagick on OS X using macports (I don't think these makes any difference but just in case)
I use the following:
<code>$im = new imagick($src . '[0]');
$im->setImageFormat('png');

header("Content-Type: image/png" );

echo $im;
</code>
and I get a nice conversion of a pdf to a png.
Every time I do that however, I end up with a file like:
<code>magick-23Iwt3tG
</code>
in /private/var/tmp.  They do not seem to delete automatically.
Do I need to delete these manually or is there an option I can set to have them automatically deleted?  (I don't want to end up with tons of these files hanging around)
Answer: The contents of /private/var/temp can be safely deleted but are not included in the /etc/rc.cleanup and /etc/weekly scripts which remove temporary files.
You can either do it manually or there is a script here which should do it for you.
Answer: I think you should use Imagick::clear() or Imagick::destroy() at the end of your script, it takes care of cleaning up everything.
I know it is a bit of a late response to your question, sorry about that :).
Answer: You have to write your own script to delete them. For example cron, or sth.
Check this link http://www.webmasterworld.com/forum88/4135.htm


Can't merge results of query to create instant messaging inbox that shows latest messages

Question: I am working on a thread/conversation-based instant messaging feature (much like Facebook, Hangouts, etc.). I am trying to get my API to serve a list of conversations the authenticated user is a participant in, along with the most recent message in each of those conversations.
I have been stuck on this for a few days now, and I have tried quite a few things. I haven't had luck with aggregates. I could do this if I made my messages a subdocument of the conversations, but what I have read has said to avoid nesting boundless arrays like that. I am curious if I should consider a schema redesign, but first I want to see if there is a query that can get me where I need to be.
This is my schema setup:
Conversation.js:
const mongoose = require('mongoose'),
      Schema = mongoose.Schema;

// Schema defines how chat messages will be stored in MongoDB
const ConversationSchema = new Schema({
  participants: [{ type: Schema.Types.ObjectId, ref: 'User'}],
});

module.exports = mongoose.model('Conversation', ConversationSchema);

Message.js:
const mongoose = require('mongoose'),
      Schema = mongoose.Schema;

const MessageSchema = new Schema({
  conversationId: {
    type: Schema.Types.ObjectId,
    required: true
  },
  body: {
    type: String,
    required: true
  },
  author: {
    type: Schema.Types.ObjectId,
    ref: 'User'
  }
},
{
  timestamps: true // Saves createdAt and updatedAt as dates. createdAt will be our timestamp.
});

module.exports = mongoose.model('Message', MessageSchema);

Here is the query that has gotten me closest to my desired result so far:
// Only return one message from each conversation to display as snippet
  Conversation.find({ participants: req.user._id })
   .select('_id')
   .exec(function(err, conversations) {
     if (err) {
       res.send({ error: err });
       return next(err);
     }

     let fullConversations = [];
     conversations.forEach(function(conversation) {
       Message.find({ 'conversationId': conversation._id })
        .sort('-createdAt')
        .limit(1)
        .exec(function(err, message) {
          fullConversations.concat(message);
          console.log(message);
       });
     });

    res.status(200).json({ conversations: fullConversations });
});
}

The right information is logging in the console. I have tried pushing and concatenating to the fullConversations array, but it ends up being empty in the response. I am also not sure about running a separate query for each individual conversation with that forEach. It doesn't seem efficient to me, but I'm struggling to find another way that works. Any help or advice would be much appreciated. Thank you!
Answer: I am going to guess that you're functions that are updating the fullConversations array are being run asynchronously so you return the fullConversations array before the functions actually add any data to it.
let fullConversations = [];
var notCompleted = conversations.length;
conversations.forEach(function(conversation) {
  Message.find({ 'conversationId': conversation._id })
   .sort('-createdAt')
   .limit(1)
   .exec(function(err, message) {
     fullConversations.push(message);
     notCompleted--;
     console.log(message);
  });
});

while (notCompleted > 0) {
    // Wait
}

res.status(200).json({ conversations: fullConversations });

Comment: You were right about the problem! Here's the code that fixed it:
https://gist.github.com/anonymous/ffe3ae049dcc2fee341a46fddf8d7f91

Thank you for your help.
Answer: According to the Mozilla docs, concat actually returns a new array without updating the current one (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat)
var new_array = old_array.concat(value1[, value2[, ...[, valueN]]])

Try using push instead because it will change the current array (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push)
fullConversations.push(message);

Edit: NVM, you said you tried pushing. I think it might have to do with stuff by async. I'll post a better answer soon.


Finding critical points and maxima and minima for multivariable functions

Question:
This problem has given me a lot of difficulties. It shouldn't be hard, as I know how to do part A by just taking the partial derivatives with respect to x and y and solving those systems of equations to find the critical points. However, I have completely no idea how to do part b or part c for that matter.
Comment: You should read about a theorem that talks about the hessian matrix(its the matrix that consists of the second partial derivatives of f)
Comment: In the future, please take the time to enter the content of your question as text instead of posting a picture of it. It's only fair that you should take some of your own time to formulate the question if you expect others to spend their time to help you. Images are neither searchable nor accessible to people who use screen readers. Use MathJax to format your mathematical expressions; you can find a quick reference [here](http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference).
Answer: solve the equation System
$$3x^2-6x+y+1=0$$
and
$$x-2y+1=0$$
Answer: For part b. it really just wants you to check all of the critical points and check it with the boundaries to find the absolute max/min, just like in a function of one variable. To check the boundaries, you need to find the four functions that represent each edge of $S$. To do this, we find the intersections:
$$\begin{aligned}f(x,y)&=x^3-3x^2+xy-y^2+x+y\\f(0,y)&=-y^2+y && \text{Bottom edge of }S\\f(2,y)&=-y^2+3y-2 && \text{Top edge of }S\\f(x,0)&=x^3-3x^2+x && \text{Left edge of }S\\f(x,2)&=x^3-3x^2+3x-2 && \text{Right edge of }S\end{aligned}$$ Now, we have 4 single-variable functions to represent the boundaries of $S$. If we find the maxima and minima of these, we can test it with our critical points. We can't forget to find the boundaries of these functions too, which are really just the 4 corners of $S$. Let's find them all:
Bottom Edge:
$$\begin{aligned}\frac{d}{dy}\left(-y^2+y\right)=-2y+1=0\to (y,z)&=\left(\frac12,\frac14\right)\\y=0\to(y,z)&=(0,0)\\y=2\to(y,z)&=(2,-2)\end{aligned}$$
Top Edge:
$$\begin{aligned}\frac{d}{dy}\left(-y^2+3y-2\right)=-2y+3=0\to (y,z)&=\left(\frac32,\frac14\right)\\y=0\to(y,z)&=(0,-1)\\y=2\to(y,z)&=(2,0)\end{aligned}$$
Left Edge:
$$\begin{aligned}\frac{d}{dx}\left(x^3-3x^2+x\right)=3x^2-6x+1=0\to(x,z)&=\left(\frac{3+\sqrt{6}}{3},\frac{-9-4\sqrt{6}}{9}\right)\\3x^2-6x+1=0\to(x,z)&=\left(\frac{3-\sqrt{6}}{3},\frac{-9+4\sqrt{6}}{9}\right)\\x=0\to(x,z)&=(0,0)\\x=2\to(x,z)&=(2,-2)\end{aligned}$$
Right Edge:
$$\begin{aligned}\frac{d}{dx}\left(x^3-3x^2+3x-2\right)=3x^2-6x+3=0\to(x,z)&=\left(1,-1\right)\\x=0\to(x,z)&=(0,-2)\\x=2\to(x,z)&=(2,0)\end{aligned}$$
At this point all we have to do is compare the maxima/minima with the values we found on these boundaries.
Part c. requires you to find the determinant of the Hessian matrix, below:
$$D = \text{det}\left(\left[\begin{aligned}\frac{\partial^2 f}{\partial x^2} && \frac{\partial^2 f}{\partial x y}\\\frac{\partial^2 f}{\partial y x} && \frac{\partial^2 f}{\partial y^2}\end{aligned}\right]\right)$$
The theorem states if $D>0$ and $f_{xx}>0$, then its a local minimum; if $D>0$ and $f_{xx}<0$, then its a local maximum; if $D<0$, then its a saddle point; and if $D=0$, then there is no conclusion.


Reopen Last Closed Tab on Mac in Safari v15.1 (Monterey)

Question: I used to use CMD + Z to reopen a recently closed tab. From what I can tell - this feature has been removed from Safari at some point. Now seemingly the only option is CMD+SHIFT+T which exclusively reopens the last closed window. Is there any way to natively reopen last closed tab in Safari?
Comment: Great answers will come of this. In a nutshell, many actions get queued for undo. This requires a dedicated last window shortcut since you can't skip past all the other items queued by undo/redo. Why not map the exclusive command to shift+command+Z or option+command+Z?
Comment: As far as I can tell - reopening closed tabs has been entirely removed from the cmd+z queue. Nothing I do can bring this back. I am not sure if this is specific to the latest Safari on Monterey
Comment: You will want to change your browser or if you stick with safari,  or change the shortcuts and/or habits.  I'm not sure there's another way yet…
Answer: This isn't a new feature. Cmd/Z is a kind of 'smart' undo [& also universal to all apps & indeed all platforms]
Cmd/Shift/T is a specific command [though it does change between Tab & Window depending on what was last closed.] It's located in the History menu rather than Edit.
To test -
Start to type an answer or comment into this page. Check the Edit menu.
Close this tab, check the menu again.
Undo…

In other apps it can do even more, it is context-sensitive…

History Undo…

I've checked this back to Safari 11 on El Capitan.
It is possible to change these commands in System Prefs > Keyboard > Shortcuts but I would advise against it.
Comment: I understand this functionality - and this is what I used to expect when using the command. However, it has now been removed entirely as far as I can tell - hence me making this post. I have just tested to make absolutely sure - directly after closing a tab - the History menu bar only has Reopen Last Closed Window (SHIFT+CMD+T) and the edit menu only has a greyed-out 'Undo (CMD+Z) option.

There is no functional way to reopen a closed tab outside if finding the url in your history.
Comment: Okay upon further inspection I have figured out what happened. However, I still believe this to be a bug.

macOS seems to get hung on a certain window closing sometimes. Regardless of how many tabs you open in other windows after closing that window - that window is always brought back, with further CMD+shift+T's then reopening that windows closed tabs.

If I go to the previous window I wanted to reopen closed tabs from, exit it (so that it is the most recently closed window) and hit the shortcut now - it only reopens tabs from window I'm already in, not reopening the last closed window
Comment: That,  as far as I can determine from your description, Is also expected behaviour. I'll need to have a closer look when I get back to my computer.


What could cause the Nikon D7500 display to look like a cartoon/colour blocking?

Question: All of a sudden the display on my Nikon D7500 is showing photos in a "cartoonish" and colour blocking - the pictures are OK when I see them on my computer or my phone, but I can of course not see them and check them properly as I'm shooting. Can this be fixed? Is it a setting? Or do I have to bring the camera in for service?
Answer: It's hard to diagnose without a picture of the problem, but one possibility comes to mind. Make sure that you don't have the "Photo Illustration" special effect turned on (p 64 in the manual). This effect will be shown in the EVF but if you have both NEF and JPG enabled the NEF may not show the effect.
Comment: (Just in case you're not watching, the question has now been updated with an image)
Comment: Thank you. Have checked them. Can't find the Photo Illustrator option anywhere though. Thanks for taking the time. Lisa
Answer: A few things could cause the display on your Nikon D7500 to look like a cartoon/color blocking.

The Photo Illustration special effect is turned on. This effect can be found in the camera's menu system. If it is turned on, it will cause the display to show photos in a cartoonish style. To turn off this effect, go to the Photo Shooting Menu > Image Effects > Photo Illustration and set it to Off.

The camera's color space is set to something other than sRGB. The sRGB color space is the default color space for the Nikon D7500. If the camera's color space is set to something else, such as Adobe RGB, the display may show photos differently than on a computer or phone. To change the camera's color space, go to the Photo Shooting Menu > Image Quality > Color Space and select sRGB.

The camera's display is damaged. Photos may be distorted or incorrect if the camera's display is damaged. If you think the camera's display is damaged, you should bring it in for service.

To troubleshoot the issue, you can try the following:

Turn off the Photo Illustration special effect.

Change the camera's color space to sRGB.

Reset the camera to its factory settings. This will erase all your custom settings but may fix the issue.

If you have tried all these things and the issue is still there, you may need to bring the camera in for service.
Answer: I cannot be 100% sure but:

evidently, display uses all pixels to display image
there's no non-uniform noise
there's no evidence of damage

what follows me to the conclusion that it's camera software bug. You definitely need to have it serviced since the pictures look fine out of the camera.


Do Cedric Diggory and Charles Weasley have the same personalities (as demonstrated by which wands chose them)?

Question: Since Cedric Diggory's wand and Charles' Weasley's wand have the same wand wood and same wand core, can we assume their personalities to be similar? Since wands choose the wizard, and the two wands are the same type of wood and core, does that imply a similarity in their personalities, as the similar wands chose them?
Comment: Fairly sure Olivander says that the wand chooses the wizard/witch
Comment: @SpacePhoenix - Sure, but based on their personalities
Answer: Yes and no. If we take Ollivander's word (via JKR) as gospel on the subject there are essentially four separate characteristics of a wand that determine its suitability for an individual wizard and (critically) none can be considered entirely in isolation of the others;

However, no single aspect of wand composition should be considered in isolation of all the others, and the type of wood, the core and the flexibility may either counterbalance or enhance the attributes of the wand's length.
Wand Lengths & Flexibility By J.K. Rowling

While we would certainly expect both Cedric and Charles to have similar personality types, the fact that Charles Weasley's wand was slightly smaller and less flexible than Cedric Diggory's wand may well have something to say about their ways in which these attributes are expressed in the individual.

The ash wand cleaves to its one true master and ought not to be passed on or gifted from the original owner, because it will lose power and skill. This tendency is extreme if the core is of unicorn. Old superstitions regarding wands rarely bear close examination, but I find that the old rhyme regarding rowan, chestnut, ash and hazel wands (rowan gossips, chestnut drones, ash is stubborn, hazel moans) contains a small nugget of truth. Those witches and wizards best suited to ash wands are not, in my experience, lightly swayed from their beliefs or purposes. However, the brash or over-confident witch or wizard, who often insists on trying wands of this prestigious wood, will be disappointed by its effects. The ideal owner may be stubborn, and will certainly be courageous, but never crass or arrogant.
Wand Woods By J.K. Rowling

and

Wand flexibility or rigidity denotes the degree of adaptability and willingness to change possessed by the wand-and-owner pair – although, again, this factor ought not to be considered separately from the wand wood, core and length, nor of the owner's life experience and style of magic, all of which will combine to make the wand in question unique.
Wand Lengths & Flexibility By J.K. Rowling
Answer: I would say yes, because wand woods and cores indicate very similar, and specific, personality traits (see these links to Pottermore https://www.wizardingworld.com/writing-by-jk-rowling/wand-woods  and https://www.wizardingworld.com/writing-by-jk-rowling/wand-cores) but the length and flexibility were different, insinuating that
Cedric Driggorys wand, that was more flexible and a bit longer, was more open-minded and had a bigger personality, whereas Charlie Weasley was a bit close minded and had a "smaller personality."
However, they would still be similar because Ash wands prefer owners who are bold but never arrogant, and also very kind, so thats where the similaritys would be.


What should a WordPress developer know about MySQL?

Question: During my 1 year job, I usually get to work with the front end and rarely get a chance to run any query. I have written 0 queries so far. What knowledge of MySQL should a WordPress developer have?
Comment: Start here: https://codex.wordpress.org/Class_Reference/wpdb
Comment: What should a wordpress developer know about http? what about linux, what about web servers, network protocols, internet infrastructure, OOP, design patterns, and much much more? If most of your work is at the front end then why should you know anything, but people that need to manipulate or write sql queries themself need o know at least SQL if not the specifics of MySQL. So this is an opinion based question which do not fit the Q&A format here.
Answer: Questions like this usually yield a lot of discussions, but let me give it a shot:
If you're talking about SQL queries:

If you're only adding content, managing plugins, themes and WordPress updates, there's a 99.9% chance that you will never need to write a single line of it. I don't want to put 100% only for cosmetics :)
If you are developing (or just tweaking existing) themes, there's also a big chance that you will not need SQL queries, unless you're developing advanced themes which will require new database tables, etc.
If you're developing plugins, especially advanced ones, there's a big chance that you will need them (depending on the plugin, this may not be the case at all, though). But on the other hand, if you're developing plugins and advanced themes, it is likely that you already know SQL needed to perform basic operations such as create table, insert, update, etc.

If you're talking about managing MySQL database, it is also unlikely that you will need to know anything about it, unless some error occurs (usually during  WordPress transfers when you need to change URL or you forget username and password so you want to change those through database). But even if you to get your hands dirty, many hosting companies offer cPanel where you can perform a number of tasks without writing a single line of SQL code.
Because a WordPress developer is a very broad term - some people who only input text and update plugins consider themselves as "developers".
Nowadays, there are plugins for everything - you can do advanced SQL queries without needing to know what SQL actually is! How? you can use plugins such as Better Search Replace that work just like search-and-replace in Microsoft Word, but actually perform quite advanced queries under the hood. Also, I remember the days when you couldn't perform a simple WordPress transfer if not exporting and importing database manually through phpMyAdmin or in other ways. Now you have plugins for complete WordPress transfers, even for complicated ones where again, you don't need need to know what MySQL is.


How to design the Controller for an Ajax(Extjs)-PHP Application?

Question: The application is being designed with ExtJs, (Json), PHP, and MySQL.  More than half of the logic/Model will be on the server side.  While significant chunk of the logic is with the ExtJs Frontend.  This is mostly a Single Page Application, so the traditional MVC Front End Controller/Routing does not work here.  I would still like to design a php Controller that manages the interactions with the server.  How best to do this?
Answer: I would suggest thinking of the server in terms of a "web service". Essentially, your ExtJS front-end code would be the application, and your back-end "web service" would only provide ways to fetch and store data.
Basically it would be something like this:

ExtJS based "UI layer"
JavaScript based "controller layer" works with the UI layer
PHP based "service layer"
The UI layer interacts with the controller layer, which then interacts with the service layer

The service layer would essentially be the same as in any typical PHP web app: It would contain data validation, input filtering, database queries, all the usual stuff. The main difference would be that instead of using PHP to generate HTML that would then be sent to the browser, the service layer would only serialize the results into JSON.
The controller layer in the JS code would perform Ajax requests to the services. It would process the JSON results, and tell the UI layer what it should display. It would also contain methods which handle events from the UI.
The UI layer would simply act sort of like a template engine or your HTML code. It would display data assigned to it from the controller layer, and it would call functions in the controller layer to handle events like pressing buttons.


Install OS X inside a VMware ESXi server (hypervisor)

Question: Say you have a apple hardware, that you installed a VMware ESXi server, is it legal and possible to install a Mac OS X on that hypervisor, and access it remotely, say with RDP or Logmein or whatever to use it as a remote desktop environment?
Answer: Apple loosened restrictions around OS X and virtualization with Lion. Previously on OS X Server could be virtualized and even then, only in narrow circumstances. With Lion you could virtualize the non-Server OS X version.
The Mavericks EULA maintains the Lion virtualization clause. Specifically it says:

(iii) to install, use and run up to two (2) additional copies or
  instances of the Apple  Software within virtual operating system
  environments on each Mac Computer you own  or control that is already
  running the Apple Software, for purposes of: (a) software
  development; (b) testing during software development; (c) using OS X
  Server; or (d)  personal, non-commercial use.

So you can:

Only virtualize on Apple hardware (which you say you're doing);
Only virtualize non-Server for development, testing or "personal, non-commercial use" otherwise you have to use the Server version of OS X (which is a $20 add-on to Mavericks from the App Store)

Fall within the bounds of the above-mentioned restrictions and yes, you can virtualize OS X in your ESXi environment.
Answer: Legally you cannot install OS X on a non-apple branded computer without writen permisson from Apple. You didn't specify which version of OS X you would installing but I'm assuming Mavericks, see the licensing agreement section 2(A). I'm sure there is similar wording in most of there software licensing agreements.
Comment: He *did* state he's running ESXi on Apple hardware.
Comment: @IanC.You are correct, and 2(B)iii of the license agreement I attached above allows for 2 virtual OS X machines to be ran as long as the host system is a Mac computer and is also running Apple software. I was unclear if he was referring to a Mac host, or some kind of virtual Apple hardware. Hope this is more clear.
Answer: As others have noted, it's legal to install one OS X virtual machine on Apple hardware. According to VMware, it's possible to install Mavericks in ESXi 5.5.
(Note that OS X has some secret sauce which prevents it from booting unmodified on VMs which are not hosted on Macs. For example, an OS X VM will shut down if you try to start it on a Windows host.)
Answer: It's a limitation set in the esxi local.sh corefile. There is an unlocker available to permit OS X on non-Apple hardware, but it will break the EULA licence terms.


dishwasher install with standpipe

Question: I am working on installing a new dishwasher. The location of the install is also the location of an old washing machine (and not directly adjacent to the sink) so I was hoping to use the old dishwasher standpipe for the drain (1.5" pvc pipe). The top of the standpipe is only a few inches above floor level and the p-trap (2") is about 35" below floor level in the basement (photo below). I know this is not necessarily standard installation for dishwasher drainage, but can it be done this way? Will I need to add an AAV to the line? And where would I add the AAV? Possibly replace the current trap with something like this?
Answer: Yes you can put a dishwasher here, yes you need a vent so the trap doesn't get sucked empty.  Something like the trap kit that you linked would work, IE a trap and an AAV.  I'm not sure if that specific one should be used.  Usually standpipes, for laundry machines without basins are bigger than the 1-1/2" you have there.   But it's normal for dishwashers to drain into 1-1/2" traps without overflowing into the sink above, so perhaps it will work.
There are practical reasons dishwashers are plumbed into sink drains: a sink is very useful near a dishwasher.  Are you not going to have one nearby?
Comment: Again, your linked one might be ok but if you search for "2 inch AAV" then glue up a trap and AAV similar to the one in your link using 2 inch parts, that might be an improvement.  I say "might" because it may not be necessary, the 1.5" might be ok.  Either way you can get rid of the existing trap and tie into the 3 inch pipe.
Comment: Hooked over the top and held firmly to it.  Not shoved in too much and not sealed.    Like a laundry drain.  Keep an eye on it for the first couple of loads.
Comment: do you have any recommendations for another AAV that might be better suited for the situation?
Comment: thanks very much for the info. thoughts on the 3/4" dishwasher drain meeting the top of the 1.5" stand pipe: should that be sealed, or left open, or it doesn't matter?
Answer: The dishwasher hose is 3/4 inch rubber tube.
If you insert it into 1.5 inch stand pipe and DO not seal it (leave the air gap) it will provide enough air vent.
Not so long ago and even today, there was a simple air vent mounted on counter top
Comment: The purpose of the AAV is to avoid precisely what you describe here, by admitting air *after* the trap.  It's needed.

dishwasher install with standpipe


How to add a button that jumps to an external link in the content type?

Question: I would like to add a purchase button in the content type, the button is an internal link, for example:www.example.com/go/nodeid. And then add an external purchase link to the text field, for example:https://item.jd.com/2385876.html. Click the buy button (internal link) JS jump to the external links, because I do not want to search engine crawling the external link address.
For example,
 open the page(http://www.chong4.com.cn/read.php?18818), showing the link(http://www.chong4.com.cn/cydb/go.php?18818_127334_22s), click will jump to(https://detail.tmall.com/item.htm?id=536478627694&ali_trackid=2:mm_13376157_4604749_42838263,22s18818:1479362916_3k2_69258376)
Answer:
nofollow: Links to an unendorsed document, like a paid link. ("nofollow" is used by Google, to specify that the Google search
  spider should not follow that link)
source: HTML  rel Attribute

All you have to do is write your link like this:
Buy Now
Answer: Implement the internal link jump to external link logic as per requirement. Now to avoid indexing of external links, you can install and configure Noindex External Links module.

Module let's you take full control of external links indexing. Pages
  could also pass HTML-validation.
Comment: A whole module just to add a nofollow property seems a bit heavy handed.
Answer: Alternatively, you can use the Redirect module
Which allows you to redirec to external urls.
Answer: For add links in content type you can use link module. That provide you link field.Add link field in your content type.


Best tips for writing sessions

Question: I've got a fair amount of writing ahead of me in the coming months and I'm here to ask you all for some strategies for grinding some good writing. I know only of the pomodoro technique, which sometimes works for me, but I'd be curious and eager to hear of any other good tips people here have from their experience. Thanks in advance!
Comment: Separate the writing from the editing.
Comment: Search for _academic writing strategies_ and find some that match your personality and style. Consider Joan Bolker's Writing Your Dissertation in 15 Minutes a Day. (This comment may be removed by a moderator since it recommends a product. I think that the recommendation is reasonable in this case, but understand if it's removed.)
Answer: I think one key to successful writing is to make it a regular habit, to lose the  fear of the white page. The pomodoro method is a good start. But anything that helps you to write regularly, even if it is just a few sentences you write every day.
Setting up weekly writing clubs with peers and colleagues during which you concentrate on writing and discuss your progress or difficulties and support each other can also be really helpful.
When I start writing I usually outline my report/paper and generate very detailed headers and section breaks which I then fill with text. It helps focus my thoughts and reduces the feeling of being overwhelmed by the thought of writing a longer piece of work.
Comment: Would add to this that I like the pomodoro method (concentrated bits of focused time with small breaks between), but the alarm from online timers drove me mad. I found a podcast called 'Flow State' where ambient/techno music goes for pomodoro-amounts of time. Helpful for me to encourage focus.

Best tips for writing sessions


Am I doing something wrong when I shuffle guild cards into the Age 3 cards

Question: In 7 Wonders Duel, the instructions say when you are preparing the Age 3 deck you should remove 3 cards from the deck and add 3 random guild cards. I assume the guild cards should be shuffled in so I usually just put the 3 cards in random positions and shuffle the deck. However, the guild cards have different colored backs (they are purple like the Age 3 cards but are darker) so I can clearly see where the guild cards are and know where they are going to be when I build the oval-shaped layout. This seems wrong to me. Should I close my eyes when I shuffle the deck or is there a reason why they stand out? Should they go in a certain position when the cards are placed?
Comment: You might know they're guild cards, but you won't know *which* guilds they are.
Comment: @BrootsWaymb yea but it's easy to memorize what those cards are, and one of them might be exactly what a player needs and there is a 1/3 chance of getting it. If that player is shuffling and their turn is next, they might, subconsciously or not so subconsciously, arrange the cards so that they get a guild card next.
Comment: It's only a 1/3 chance if you looked at the guild cards you put away and thereby know which 3 were added. *Technically* I don't think the rules strictly say that you can't look at the ones that don't get added... but it doesn't seem to be in the spirit of the game to look at them. After all, you aren't allowed to look at the removed age cards. Until a guild card is flipped up, you should never have a way of knowing which of the 7 guilds it is.
Comment: @BrootsWaymb ah yea I forgot that there was a pool of 7 guild cards. Haven't played in a while.
Answer: You are not doing anything wrong.
Looking at rules here it says :-

Return to the box, without looking at them, 3 cards from each Age deck.
  Then randomly draw 3 Guild cards and add them to the Age III deck without
  looking at them. Return the remaining Guilds to the box.

My other reference for this is playing the 7 Wonders Duel app.  I can confirm that also places the guilds in random positions and the face down ones have a visible darker back.
As for the reasons you would have to ask the designer for the certain answer.  However as a player its very useful to know if a face down card is a guild.  Lets say your opponent is close to achieving military or scientific supremacy?  if you are going to be forced to reveal a card on your turn wouldn't be better to reveal a card that you know cant give them an automatic win?
Like wise if you as a player are close to winning with military or scientific supremacy, would it be better to build a wonder granting those all important extra turns in the hope you reveal the exact card you need and knowing its not a guild increases that chance.


Howto check on arcgisserver if service (published map) is started?

Question: I have an ArcGIS Server from Esri running and I need to check every hour if some published services (maps) are running. WMS and WFS.
Answer: Here's an example (albeit in VB6) from the ESRI website that demonstrates how to get a reference to the IServerObjectConfigurationStatus interface on a specific map service.
Once you have that reference, use the Status property on the IServerObjectConfigurationStatus interface to check the status of the service. If the value is esriConfigurationStatus.esriCSStarted, then the service is started.
Then, it's just a matter of choosing the type of application you want to use to perform the check, whether a service or a scheduled application or a component of a larger application.


Height of printed part is incorrect

Question: I have a weird problem with my old 3D printer, it is a Prusa/Mendel type.
When I print a 20 mm cube, X and Y are correct, Z is resulting 16 to 17 mm.
I have checked the correctness of the movement on Z using the manual controls and there are no issues.
I played a bit with the layer thickness, I have a 0.4 mm nozzle, setting the layer height to 0.12 mm (normally is on 0.16 mm) but no changes in the result.
I am printing PLA on a cold bed at 180 °C without any other particular defect.
I would appreciate some direction on how to solve such problem.
Comment: Is the Z travel consistent across prints?  Z travel must be at the root of the problem as the nozzle wouldn't finish the print if there were a 3mm gap towards the end of the print.
Comment: @TormodHaugene, thanks. Unfortunately the result is inconsitent. I printe out a 20 mm and it came out 17, the next one was 40 mm and final result is 30. I am starting to consider a problem on the ramp.
Comment: @emackey there are not other defects on the printed part. I am not sure how to verify such consistency while printing. As i said, I verified it with the manual control and in that modality it is correct. Thanks fornyour opinion about excluding the extruder settings.
Comment: Hi, Felice! I think what @emackey mean about Z-travel is whether the height *difference ratio* is consistent. So, if you print a box that is supposed to be 50mm high, and it turns out that it is 40mm, you have a 20% error. If the error is consistent, printing a box that is supposed to be 100mm should give you a 80mm result (also 20% error), etc..
Comment: Is this consistent on different Filaments? I once had a bad filament that caused to short prints.
Comment: This could be related to missing steps
Answer: You should check that the steps per mm for your Z-axis are set correctly. This depends on the pitch of the leadscrews/threaded rods driving the axis and parameters of your steppers (microstepping and raw steps/revolution). This Calculator.
Make sure that your layer height is a multiple of a full step of the Z-stepper. The Z-stepper may be disabled intermittently, and when re-enabled it may "snap" to the nearest full step position. If your layer height requires microstepping, you may notice it getting rounded down or up due to this.
For instance, if a full step were 0.08 mm, then 0.16 mm layers would require 2 full steps, printing fine. 0.12 mm layers would require 1 full step and a half microstep. Due to rounding, some layers might be reduced to 0.08 mm instead. This might account for the height discrepancy you're seeing (though 0.08 mm is quite a high, unrealistic amount for a full-step).
Comment: Thanks for your nswer. As you said the steps calculation are the result of the mechanical components, so there is no reason to adjust it to compensate a problem coming from somewhere elese. I also tried with 0,16 and 0,2 mm extrusion but the problem is still the same. I am considering the problem coming from the ramp i will try to play a bit with the ramp current. Thanks for your answer, i will check carefully your hints and share the results.
Answer: You could check that the stepper driver IC for the z direction is not getting too hot while printing. If this is the case it may be that the current adjustment of the stepper driver is set incorrect causing it to skip steps. however you would expect the same behaviour in manual operation.
Answer: Thanks to your advices I pointed my effort on the root of the possible cause on the Z axis.
I swapped the Polou driver between x and z and clearly noted that now the problem is on x. I had to conclude that the problem is with the Polou driver which randomly looses steps.
What is surprising me is that on the Z axis I have two motor type Nema 14 which should work at 0,75A therefore 1,5 A total. The Polou driver, old type, is rated at 1A. So it is not a surprise, now that I have learned about this configuration, that the z driver is giving troubles. The problem was there since the beginning and with the ageing of the components it revealed itself.
I will replace the actual Polou drivers with the new type rated at 2 A and restart from there.
Thanks for the advices.
Comment: Maybe adjusting the current (via the potentiometer) to be lower/higher will fix the problem without replacing the stepper drivers.
Comment: @TomvanderZanden, thanks but I tried. The driver is faulty because gives the same problem also on x where i have only one motor. I even tried to adjust the current but no success. I am replacing it.
Answer: A suitable test part for this problem, to check if the bad scaling is linear or the result of missing steps (as was identified in this case) would be a ramp, or sequence of steps. You can check the linearity using a straight edge, and would be able to perform repeated tests to identify of there was a specific Z location where steps were more likely to be lost (for example due to some tightness in the motion system).

Height of printed part is incorrect


How do I detect wheter the audio cable is connected?

Question: I'm using Ubuntu Lucid (10.04). In my shell script running as root I want to detect whether an audio cable (analog jack) is connected to the laptop or not. How do I do that? I don't need a portable solution, I need something, no matter how hacky, that works on my laptop.
Comment: What makes you think this is possible?
Comment: Cables cannot be detected. Depending on the hardware, a device at the other end of the cable can be detected; in practice, this is only used for headphones detection. Show which HDA codec you have and how it is wired up to the jack.
Comment: @CL: The device at the other end is an externally powered speaker, which is turned on. I don't think it has any smart self-announcement capabilities. How do I figure out which HDA codec I have?
Comment: The hardware can detect it, because it mutes the internal speaker as soon as I connect the external speaker.
Comment: But usually that switch-over is handled by an analog switch which is not instrumented for programatic access. As michas noted, it probably isn't possible.
Comment: Run the [`alsa-info` script](https://wiki.ubuntu.com/Audio/AlsaInfo).
Answer: One way could perhaps be to use amixer.
Jack plugged in:
$ amixer -c 0 contents
numid=29,iface=CARD,name='Front Headphone Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=on
...

Jack not plugged in:
$ amixer -c 0 contents
numid=29,iface=CARD,name='Front Headphone Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
...

So for that specific one I could do:
amixer -c 0 contents | \
awk -F"," '
$1 == "numid=29" {
    c=1
} c && /: values/ {
   split($0, a, "=")
   print a[2];
   exit
}'

giving output of on or off.

One can also use commands and specify by iface + name etc. e.g.:
Get list by:
$ amixer -c 0 controls

Where -c 0 specifies card, not needed if default or only one. Then e.g.:
$ amixer -c 0 cget numid=29,iface=CARD

$ amixer -c 0 cget numid=29,iface=CARD | awk -F"=" 'NR == 3 {print $2;}'

I came across a piece of software once, believe it used Tcl/Tk, that displayed pin-power for all ports on the computer + lots of other HW information. It was a nice piece of software – but I can't find it again. I have looked trough 12 old HDD's with no luck. I used it to debug some jack-ports. So yes, it is definitively possible to poll status of a specific port.
Jack is a pain to search the web for due to JACK. It makes it close to impossible.

I have some C-code that do some Soundcard information polling. Have to look if I can find it.
Comment: amixer output is subject to change, parsing /proc/asound/card0/codec#0 directly may work better. Alternatively, see http://unix.stackexchange.com/questions/25776/detecting-headphone-connection-disconnection-in-linux
Answer: Since you said "no matter how hacky" . . .
Get an external sound card that you can connect to your laptop via USB. Plug the analog jack into that. Plug in your external sound card when you want to connect the audio jack and have your bash script detect whether or not the external sound card is connected via USB.
Comment: Thank you for trying to help! I can't use your answer because it detects whether an external sound card is connected, rather than whether the analog jack audio cable is connected.


How I can test the power supply across the load?

Question: I want to test my power supply at the 12 V 10 A specification. I had tried with connect a 100-watt 0.7-ohm load resistor across it, but by that time the voltage went down to 3 to 4 volt. How does it happen? And how can I test this power supply?
Answer: how can i test this power supply?
Start by using the right load.  The supply is rated for 10 A maximum at 12 V.  By Ohm's law, that means the smallest valid load resistance is (12 V)/(10 A) = 1.2 Ω.
By connecting a 700 mΩ resistor to the supply, you violated it's current spec.  Again by Ohm's law, (12 V)/(700 mΩ) = 17 A.  The supply dropping its output voltage when you attempt to draw more than rated current from it is a totally reasonable thing for it to do.
You really need to look up Ohms's Law and understand what it means.
Also consider the power the load resistor must dissipate.  If you manage to load the supply to its maximum rating, then the power into the resistor will be (12 V)(10 A) = 120 W.  Even if your resistor were the right resistance, it doesn't have enough power handling capability.
You could get a second 700 mΩ 100 W resistor and put them in series.  That effectively makes a 1.4 Ω 200 W resistor.  That is within what the supply can drive and the combined resistance can handle.  By Ohm's law again (yes this comes up a lot and is really useful), (12 V)/(1.4 Ω) = 8.6 A.  That's what the current will be thru the combined resistor.  It doesn't test the supply to the limit, but it's a good start.
Comment: [What happens if you use a resistor without the ability to dissipate enough power](https://youtu.be/sI5Ftm1-jik?t=180)
Comment: @OlinLathrop Did you miss that that was not a question, but a link to a video of someone (stupidly) burning themselves on a resistor and then using pliers to hold the resistor as it gets red hot?
Comment: @imm: It will get hotter than it was designed to get, and any specs from the manufacturer no longer apply.  It could just go out of tolerance, or it could melt, catch fire, or vanish into a small mushroom cloud.  It could also cause other things it is in contact with to catch fire.
Answer: Is that 12V @ 10A ? Your 0.7 Ohm resistor will try to draw 17A which will overload the power supply. Most power supplies have a current limit of some sort which will reduce the output voltage until the current is at a safe level. Try loading your power supply with 1.2 Ohm. That should give you 10A.
Answer: If your power supply were going to be able to drive full output voltage of 12V to a 0.7 ohm resistor it would have to source over 17A. Since you said your design was for 10A it was unable to source the 17A and something inside the supply is causing the output to be drug down to the 3 to 4V. May be caused by current limiting or source impedance.
To test the supply you need to think about realistic loads. Use multiple of the 0.7 ohm resistors in series or find resistors with a higher ohms value.
For testing power supplies I have built myself an electronic load which is basically controllable current sink. The load is powered from a separate low current 12V wall wart. The circuit consists of a mongo power MOSFET in series with a small value sense resistor to GND. An opamp compares the voltage drop across the sense resistor to the setting of a multi-turn pot and then drives the gate of the mongo FET to keep the load current through the FET constant as per the pot setting. Separate small digital panel meters monitor the load current and load voltage. When testing at high currents and higher load voltages the mongo FET can generate an appreciable amount of heat so the FET is mounted to a good size heatsink which is then cooled by two 12V fans which are powered off the wall wart supply.
This is a picture of the type of N-MOSFET used for the electronic load.

A device like that can handle 10A to 20A easily and support a power level well over 100W. FETs of this type are very expensive but I got lucky and happened upon a box of them at a surplus store for $4 to $5 each. At mail order retail a part of that type could be over 10X that price.
Answer: If we consider that your power supply is ideal you get 17.12 A, and 12v between the terminal if you connect a 0.7 Ω across your power source

But in reality you have just a physical power source with internal resistance about 2 Ω, and in this case you got a 3v at the terminal of your power supply


Want to make changes in Sub Admin and their views in admin panel

Question: I created a one main admin account name xyz ( Full Access of all modules) and three different sub-admin user account names are xyz1, xyz2 and xyz3 and this three sub-admin have only access of only modules (Dashboard, Sales, Catalogue, Customers, and Reports).
My requirement is all three sub-admin has a separate admin panel of the module of because all three sub-admins are sited in three different our country offices.
So, obliviously they are individual sales, customers, and products and they are not interrelated to each other.
Our aim is to make the separate view of backend admin for all three sub-admins. E.g. xyz has a separate admin panel view and he can't see either xyz1 & xyz2 admin panel & vice versa.
Answer: In Magento add new role with "Resource Access" and assign to admin user:
GoTo :
Magento admin -> Permissions -> Roles -> create new roles -> got to "Role Resources" -> set "Resource Access" as you want to show of other admin
GoTo :
Magento admin -> Permissions -> Users -> sub-admin-user -> User Role -> Assign your new roles
Comment: Hello Sir,Thanks for your reply but there is still one problem and that is sub admin1 can see the details of sub admin2 if admin gives same module access to both sub admins 1 & 2.lets say admin gives "customer" or "dashboard" module access to both admins so i want each sub admin should get their own details like daily sell or customers under him.So if you have any solutions for this please let me know sir


Does $\sum_{n=1}^\infty(-1)^{n}\frac{n^n}{n!}$ converge or diverge

Question: $\sum_{n=1}^\infty(-1)^{n}\frac{n^n}{n!} $
I got that it diverges but I am not sure
Comment: ${n^n\over n!}={n\over n}\cdot {n\over n-1}\cdot{n\over n-2}\cdots {n\over 2}\cdot {n\over1}>1$ for each $n$.
Answer: There are already four answers on the page, but all of them refer to either Stirling's approximation, or to the famous limit for $e$. Here is a totally elementary argument. Compare two terms with indexes $n$ and $n+1$:
$$
a_n=\frac{n^n}{n!}\quad ?\quad a_{n+1}=\frac{(n+1)^{n+1}}{(n+1)!}
$$
Note that
$$
a_{n+1}=\frac{(n+1)^{n+1}}{(n+1)!}=\frac{(n+1)^n(n+1)}{(n+1)!}>\frac{n^n(n+1)}{(n+1)!}=\frac{n^n}{n!}=a_n,
$$
which proves that the terms of the series do not tend to zero. Hence the series diverge.
Comment: Everyone is so quick to appeal to Stirling.
Answer: By Stirling formula
$$n!\sim_\infty \left(\frac{n}{e}\right)^n\sqrt{2\pi n}$$
we have
$$\left|(-1)^{n}\frac{n^n}{n!}\right|\sim\frac{e^n}{\sqrt{2\pi n}}\not\to0$$
hence your series is divergent.
Answer: The ratio of the absolute value of consecutive summands is
$$
\frac{(n+1)^{n+1}/(n+1)!}{n^n/n!} = \bigg(1+\frac1n\bigg)^n,
$$
the limit of which is $e$ as $n\to\infty$. Since $e>1$, the Ratio Test tells us that the series diverges.
It is true that the summand does not tend to $0$ (which also implies divergence of the series); but establishing that the summand does not tend to $0$ is more complicated than this Ratio Test argument, I believe.
Answer: By Stirling $$\frac{{{n^n}}}{{n!}} \approx \frac{{{n^n}}}{{{n^n}{e^{ - n}}\sqrt {2\pi n} }} = \frac{{{e^n}}}{{\sqrt {2\pi n} }}$$ so the series cannot converge.
Alternatively, $${a_n} = \frac{{{n^n}}}{{n!}} \to \frac{{{a_{n + 1}}}}{{{a_n}}} = {\left( {1 + \frac{1}{n}} \right)^n} \to e > 1$$ so $a_n\to\infty$.
Answer: If a series $\sum_{n = 0}^\infty a_n$ converges then $\displaystyle \lim_{n\to \infty}a_n = 0$ is necessary condition. Calculate $\lim_{n\to \infty}a_n$. Stirling approximation might be helpful to calculate the limit.
Comment: +1 for offering a hint and not just throwing out the answer for problems like this.
Answer: Simply expand the numerator and the denominator as products.  Can you find a lower bound for $\frac{n^n}{n!}$? Does this lower bound tend to $0$ as $n\rightarrow\infty$? What does this say about the terms of $(-1)^n \frac{n^n}{n!}$?


What's the current input from each leg of a portable generator into my main panel?

Question: I am connecting a portable generator to my electric sub-panel in my garage.  My generator is a 6kw running watt unit with a 30amp 220 volt output.  I will be using this connection (L14-30) to a box outside my garage.  This box will be connected to a shut-off panel inside the garage.  This shut-off panel will be connected to the sub-panel, via a 30 amp double pole breaker (220 volt).  I would like to measure each leg for volts, amps and watts.  Am I correct in that I can measure each (2)"hot" wire for volts, and amps, or do I need to include the "common" wire and add the amps from that for my total?  I also want to keep an eye on the total running watts from each leg to keep from overloading the generator.  I may need to remove some devices as they start, because of their starting current.
I am not using an automatic transfer switch, so I will be shutting off the Main breaker before I start the generator.  I will then shut off ALL breakers, before I switch the shut-off switch to ON.  I will then switch individual breakers to feed certain areas of my house, during a power outage.
Comment: The experts will come along soon enough with the details. But (a) you measure the hots, no need to measure the neutral and (b) you **must** have an interlock such that you **can't** have the generator and utility power running at the same time. Otherwise, you could start the generator because "power is out" and zap the linemen trying to restore power.
Comment: What make and model are your panels and can you post photos of them, including the labeling on the inside of their doors, please?  We can probably rearrange this into something useful, but we'll need to know *far* more about what you have for equipment, as your "checklist" approach simply won't fly.
Comment: I appreciate your input.  My panels are both Square D panels.  I will get photos this weekend to show the current set up.  I am planning on adding the outside L14-13 box, as well as the inside shut-off switch in the coming weeks.  I will check to see what kind of interlok I can find.
Answer: No. You can't do that.
You have to have an interlock in the main panel.
Your idea is clever, and you think "Why not a checklist"?  The answer is people got hurt doing it that way, often enough that they changed the Electrical Code to stop the carnage.
In a crisis people do not "rise to the occasion". They descend to the level of their training, and if they aren't well trained, the result is chaos.  Code requires your system be built to endure through that.  Simple as that.
Since your inlet equipment must be at the main house anyway (you can trench a separate cable to send it to the garage if you really want to), you can simply select commercially available inlets that include amp meters.  You are interested in amp meters; there's no need to monitor voltage (plus, it's pretty easy to do with other devices such as a Kill-a-Watt).
Answer: As mentioned by manassehkatz, a reliable mechanical interlock is mandatory ( users with less technical know how, misunderstandings in the operational procedures, etc.) in order to avoid  injuring or killing people.
The interconnection locking device must ensure that the generator can only be connected to the building's net if all connections to the grid are disconnected.
For total wattage and each leg wattage 2 Ampere meter and 2 Voltage meter in each leg are sufficient.
The current through Neutral is always the difference of both leg currents - and thus does not reveal any new/additional  information.
In the specification of the generator, there should be information if and how much asymmetric load is allowed.
In case of an older or defective generator, many devices could be destroyed in case of a missing spike/overvoltage protection.
All GFCI must work as before, i.e. Ground/Protection Earth and Neutral connections of the generator must be done according to the instructions.
All GFCIs must be tested when the generator is running.
The exhaust must not get into the building - CO is odorless.
A CO and CO2 alarm sensor is not very expensive.
Most frequent problem with generators is that they do not work just when they are needed, since they are not tested/maintained regularly.
Comment: My generator is a Champion Model 40023.  It is rated as 6000 Watts running, 7000 Watts Start.  This generator will be sitting outside the detached garage, in a covered (open) patio with the exhaust facing away from all buildings.
Answer: Aside from needing to comply with the code issues others have stated, you should only have to calculate or measure the watts per leg. Measuring the neutral will just tell you the difference between the hot legs.
But 6000 watts / 240 volts = 25A, so even though the generator may have a L14-30 it won't be capable of 30A simultaneously on both legs. The engineering of the generator is likely not available to determine if it will sustain an imbalance exceeding 25A on one leg.
Comment: Since the generator is capable of 7000 Watts Start, it will generate up to 30 Amps.  Thus I am installing a 30 Amp breaker for my connection in the panel.  One of my biggest concerns in the fact the Champion does not do a good job in providing me with accurate information regarding the THD.  I may have to replace this Champion with a unit that addresses this issue showing me it is <6%.


Cake pattern with Java8 possible?

Question: I just wonder: with Java 8, and the possibility to add implementation in interfaces (a bit like Scala traits), will it be possible to implement the cake pattern, like we can do in Scala?
If it is, can someone provide a code snippet?
Answer: With inspiration from other answers I came up with the following (rough) class hierarchy that is similar to the cake pattern in Scala:
interface UserRepository {
    String authenticate(String username, String password);
}

interface UserRepositoryComponent {
    UserRepository getUserRepository();
}

interface UserServiceComponent extends UserRepositoryComponent {
    default UserService getUserService() {
        return new UserService(getUserRepository());
    }
}

class UserService {
    private final UserRepository repository;

    UserService(UserRepository repository) {
        this.repository = repository;
    }

    String authenticate(String username, String password) {
        return repository.authenticate(username, password);
    }
}

interface LocalUserRepositoryComponent extends UserRepositoryComponent {
    default UserRepository getUserRepository() {
        return new UserRepository() {
            public String authenticate(String username, String password) {
                return "LocalAuthed";
            }
        };
    }
}

interface MongoUserRepositoryComponent extends UserRepositoryComponent {
    default UserRepository getUserRepository() {
        return new UserRepository() {
            public String authenticate(String username, String password) {
                return "MongoAuthed";
            }
        };
    }
}

class LocalApp implements UserServiceComponent, LocalUserRepositoryComponent {}
class MongoApp implements UserServiceComponent, MongoUserRepositoryComponent {}

The above compiles on Java 8 as of Jan.9 2013.

So, can Java 8 do a cake-like pattern? Yes.
Is it as terse as Scala, or as effective as other patterns in Java (i.e. dependency injection)?
Probably not, the above sketch required a whole lot of files and is not as terse as Scala.
In summary:

Self-types (as needed for the cake pattern) can be emulated by extending the base interface we expect.
Interfaces cannot have inner classes (as noted by @Owen), so instead we can use anonymous classes.
val and var can be emulated by using a static hashmap (and lazy initialization), or by the client of the class simply storing the value on their side (like UserService does).
We can discover our type by using this.getClass() in a default interface method.
As @Owen notes, path dependent types are impossible using interfaces, so a full cake pattern is inherently impossible. The above shows, however, that one could use it for dependency injection.
Comment: You should be able to access `this` and `this.getClass()` in a default method body, and you can add extra state through a weak identity map. However in the logging example, it is just not the java way; nothing wrong with the plain/old solution of adding an instance field `final Logger logger=Logger.of(this);` to achieve the mixin effect.
Answer: I did a small proof-on-concept on this recently. You can see the blog post here: http://thoredge.blogspot.no/2013/01/cake-pattern-in-jdk8-evolve-beyond.html and the github repo here: https://github.com/thoraage/cake-db-jdk8
Basically you can do it, but you face at least two obstacles that makes it less slick than Scala. Firstly the Scala traits can have state and Java's interface can't. Many modules need state. This can be fixed by creating a general state component to hold this information, but this will need to be in a class. At least in part. Second issue is that a nested class in an interface is more akin to a static nested class in class. So you can't access the interfaces methods directly from the module class. The default interface method have access to this scope and can add this to the constructor of the module class.
Comment: State can be handled (in a very inelegant manner) by using static identity maps, mapping from (instance -> value) for each field, and then lazily initializing it in the getters for each field.
Answer: Maybe you can do something like this in Java 8
interface DataSource
{
    String lookup(long id);
}

interface RealDataSource extends DataSource
{
    default String lookup(long id){ return "real#"+id; }
}

interface TestDataSource extends DataSource
{
    default String lookup(long id){ return "test#"+id; }
}

abstract class App implements DataSource
{
    void run(){  print( "data is " + lookup(42) ); }
}

class RealApp extends App implements RealDataSource {}

new RealApp().run();  // prints "data is real#42"

class TestApp extends App implements TestDataSource {}

new TestApp().run();  // prints "data is test#42"

But it is in no way better than the plain/old approach
interface DataSource
{
    String lookup(long id);
}

class RealDataSource implements DataSource
{
    String lookup(long id){ return "real#"+id; }
}

class TestDataSource implements DataSource
{
    String lookup(long id){ return "test#"+id; }
}

class App
{
    final DataSource ds;
    App(DataSource ds){ this.ds=ds; }

    void run(){  print( "data is " + ds.lookup(42) ); }
}

new App(new RealDataSource()).run();  // prints "data is real#42"

new App(new TestDataSource()).run();  // prints "data is test#42"

Comment: Your first example compiles and runs as expected in Java 8.
Answer: A few experiments suggest no:

Nested classes are automatically static. This is inherently uncakelike:
interface Car {
    class Engine { }
}

// ...
    Car car = new Car() { };
    Car.Engine e = car.new Engine();

error: qualified new of static class
    Car.Engine e = car.new Engine();

So, apparently, are nested interfaces, although it's harder to coax out the error messages:
interface Car {
    interface Engine { }
}

// ...
    Car car = new Car() { };
    class Yo implements car.Engine {
    }

 error: package car does not exist
        class Yo implements car.Engine {

 // ...

class Yo implements Car.Engine {
}

 // compiles ok.

So, without instance member classes, you do not have path dependent types, which is
basically necessary for the cake pattern. So at least, no, not in the straightforward way,
it is not possible.
Answer: Ignoring the new functionality in Java 8 you can in theory do the Cake Pattern in Java 5 and above using compile time AspectJ ITDs.
AspectJ DTO's allow you to make Mixins. The only annoying thing is that you will have to make two artifacts: the aspect (ITD) and the interface. However ITDs allow you to do some crazy stuff like add annotations to classes that implement an interface.

Cake pattern with Java8 possible?