How to create a Ubuntu Netbook 10.10 Unity VM under VirtualBox

Question: I'd like to run the new Unity interface from Ubuntu 10.10 inside of a VirtualBox VM (host is Ubuntu 10.04).  Is that possible?  Thanks!
Answer: So you want to help test the Ubuntu distribution that is customised specifically for netbooks but don't have a netbook to test it on? That's not a problem. What you need is a virtual machine and an Ubuntu Netbook Remix (UNR) image.
Getting the image STEP 1
http://www.ubuntu.com/netbook/get-ubuntu/download
Installing a Virtual Machine

sudo apt-get install virtualbox-ose

Setting up the Virtual Machine
Virtualbox -> New -> Next ->
Name: UbuntuNetbook
Operating System: Linux
Version: Ubuntu
-> Next -> Memory: Base memory size: 512 Mb
Note: Use the amount of RAM for the virtual machine that you can afford. Linux requires less memory to run than does Windows, but the amount of RAM that you dedicate to the virtual machine in this step will not be available to the Windows host. On my laptop, I have 3 Gb RAM, so I dedicate 1024 Mb (1 Gb) to the virtual machine in this step and leave 2 Gb for Windows. You should always leave at least 1 Gb RAM for Windows (or it will run painfully slowly). Linux is able to run with only 512 Mb in server mode or 1 Gb in desktop mode (perhaps even less).
-> Next -> Virtual Hard Disk ->
Boot Hard Disk (Primary Master): (ticked)
Create new hard disk: (ticked)
-> Next -> Next -> Hard disk storage type:Dynamically expanding storage: (ticked)
-> Next -> Virtual Disk Location and Size:
Once this is download you want to make sure your virtual machine image will boot into UNR when it first runs. To do this select the "Settings" icon from the VirtualBox screen (first make sure you have selected your image in the left-hand column).
What you are presented with now is a list of options for your virtual machine image. The one we are interested in is CD/DVD-ROM. Select this option. and select ISO and find where you download the UNR iso image.
p.d :
.. but there are 2 virtual box If you are interested in using VirtualBox -- either for private or business use --, you have the choice between two versions:

The full VirtualBox package is available in binary (executable) form free of charge from the Downloads page. This version is free for personal use and evaluation under the terms of the VirtualBox Personal Use and Evaluation License.

Closed-source features
The following list shows the enterprise features that are only present in the closed-source edition. Note that this list may change over time as some of these features will eventually be made available with the open-source version as well.

Remote Display Protocol (RDP) Server
This component implements a complete RDP server on top of the virtual hardware and allows users to connect to a virtual machine remotely using any RDP compatible client.
USB support
VirtualBox implements a virtual USB controller and supports passing through USB 1.1 and USB 2.0 devices to virtual machines.
SB over RDP
This is a combination of the RDP server and USB support allowing users to make USB devices available to virtual machines running remotely.

The VirtualBox Open Source Edition (OSE) is the one that has been released under the GPL and comes with complete source code. It is functionally equivalent to the full VirtualBox package, except for a few features that primarily target enterprise customers. This gives us a chance to generate revenue to fund further development of VirtualBox. problem with this version :

Open-source features
The following list shows the features that are only present in the open-source edition. The licensing conditions of the necessary libraries prevent inclusion in the full-featured product.

Virtual Network Computing (VNC) Server

This component implements a complete VNC server on top of the virtual hardware and allows users to connect to a virtual machine remotely using any VNC client.
Install virtualbox no ose
follow this instruction :
http://www.virtualbox.org/wiki/Linux_Downloads
Comment: I don't have VirtualBox installed currently, but are you sure it supports OpenGL / hardware acceleration?
Comment: @janc http://www.virtualbox.org/manual/ch04.html#guestadd-3d
Comment: @janc i found this http://forums.virtualbox.org/viewtopic.php?f=3&t=35237
Answer: So, to answer the title of this article:
"How to create a Ubuntu Netbook 10.10 Unity VM under VirtualBox"
You can't.  The Unity interface can't run in a VirtualBox guest.  You can, however, use the default gnome shell common to the regular Ubuntu distribution -- but that is not trying out UNR...
Answer: I installed VirtualBox and tried the steps below and it doesn't work.  Testing shows that Unity uses OpenGL features that are not supported by the 3D driver for VirtualBox guests:
$ unity
OpenGL Warning: glXChooseFBConfigSGIX not implemented by Chromium
Segmentation fault (core dumped)

Chromium is the library that Virtualbox uses for its 3D support, and apparently it lacks this feature...

It should be possible to run Unity in an Ubuntu guest inside VirtualBox provided that you enable 3D virtualization inside the virtual machine configuration and VirtualBox runs on a machine with OpenGL support.
I think the best way to do it is to install the desktop edition first, then install:

the virtualbox-ose-guest-x11 package (and probably the other virtualbox-ose-guest-* packages too).
the ubuntu-netbook package (which will make sure Unity and everything it needs gets installed)

After a reboot of the guest inside the virtual machine, you will be able to select the "netbook session" from the login screen (after selecting your user, but before entering your password).
This two-step process is needed because Unity requires 3D graphics and the drivers for the 3D virtualization are not installed by default.
Comment: I have done this (the host OS is Mac OS X), and I still can't get Unity to work. 3D accelleration is working, as evidenced by window effects such as wobbly windows functioning correctly in the standard gnome desktop.
Comment: Okay, I installed VirtualBox and did some test, and apparently the OpenGL support in VirtualBox is far from complete...
Comment: is a well know bug in virtualbox 3.2.10.. see my comment above
Answer: With VirtualBox 4.0 it is now possible to test Unity under Ubuntu 11.04.
The 5-steps howto is here.
I did not tried to run Unity under 10.10 in a VM but if you still want to, you should be more lucky with the latest VirtualBox release.
Comment: -1 This question is about Unity in Ubuntu 10.10 - that link is about the new Unity in 11.04
Comment: Oops, sorry, I was so pleased with the new VirtualBox release that I read the question a bit too fast :-/
However, if someone is still interested in testing the Unity interface I will recommend using this solution : it works and the development is more advanced.
But you're right, that wasn't about Ubuntu 10.10...
Comment: Ok, answer edited.
Comment: Unity 11.04 works for me; I'll give it a go -- thanks!


PowerPC Interrupt Vector 0xfff00800

Question: This is a long shot, and may come under fire as not being EE-enough of a question for this site, but what conditions will result in a PowerPC processor  (e.g. Freescale 7448) taking a jump to address 0xfff00800? My reading of the family reference manual suggests this is a Floating-Point Unavailable Exception, but in talking to people it's been suggested this is a common place where programs go to die on a bad instruction decode. Assuming that's accurate is there any way to recover what the errant instruction was via poking and prodding with a JTAG debugger?
Answer: I don't know the architecture in question, but from general processor knowledge, could you not examine the stack to find the PC (or equivalent) from when the interrupt was triggered and look at the memory pointed to by that?  You woudn't even really need JTAG - you could do it in the interrupt routine.
Answer: Turns out Flash was not mapped correctly through an FPGA in the design and the "instruction" 0xFFFFFFFF was literally being fetched and executed out of flash, resulting in the vector in question. Took a lot of debugging to come to that conclusion.

PowerPC Interrupt Vector 0xfff00800


How to obtain the HTML source for mysite.master?

Question: As per this question, and several others, it's better practice to work with .html files rather than .master files. However, there seems to be no base .html file available for the mysite master.
How would one obtain such a file?
Answer: The Design Manager is not available in MySites I don't think. It's this feature that does the stuff with html/master mashups.
Comment: It's true that the design manager is not available in mysites, however, would it still be possible to convert a masterpage backwards, to a html base via manual labor?
Comment: Unfortunately not. The Design Manager stuff converts HTML to master but not the other way round. Even if you did get back to HTML, SharePoint can't do anything with it without Design Manager.


How to move all installed programs from my computer to another computer or laptop?

Question: If I have installed a lot of programs/games on my computer(desktop) and now buy a new laptop and I have installed a Ubuntu 11.10 on it too then,how to move all installed programs on my desktop to my laptop instead of installing them again on my laptop ???
Comment: IMO reinstalling all of your games on your laptop would be easier than trying to "move" them over from your desktop. What is your reason for wanting this? Are you trying to preserve configuration and save data, avoid having to re-download, or what?
Comment: Avoid reinstall, avoid re-download, avoid power consuming, and enhance battery life
Answer: Best way to do that is a full backup of your system and then restore it the the new disk.
You have basically 3 choices:

Full manual system installation, all programs and configurations done
one by one or using any automated process of installing the packages that you had. Configuration of those packages will probably be necessary after installation, with a bit of luck you will be able to "move" all your programs configuration by copying your home folder from the old computer to the new one;
Full system backup done with backups tools such as deja-dup which
will then be restored to the new system;
Disk cloning from the old system to the new. An image can be made
from your old system and then restored to the new one leaving your
system identical as the previous one. You can use dedicated applications such as clonezilla or a more simple approach suck as dd;

In the end its options 2 and 3 will make the all process faster and no (mostly no) downloads needed but option 1 will leave you with a cleaner system.
Answer: It is important to remember that as long as you copy your home directory onto the new computer, all your apps will be automatically configured and ready to use when you install them. You don't have to reconfigure anything.
Comment: but i have re-download them and reinstall them
Answer: 1)open nautilus with sudo nautilus command , go to  var/cache/
apt/archives
select and copy the folder with packages u have downloaded .(if it gives error , just click on skip and Dont worry )
2)paste it to a external drive . also copy and paste your home folder .
3)copy and paste both folders in your second pc.
4)install synaptic package manager in second pc , click on add downloaded packages from menu and point to the location u copied archive  folder.
it will add them and mark them automatically . if it gives error for broken packages , update cache with update manager or reload and click on 'fix broken packages' from menu .
5)click on apply . u will have to download only if there is new version available for something .
6)after installation copy the home folder to your home. restart your system.
by following this procedure u will have clean system and u will have to download least .
Comment: But i haven't found apt directory in var(do i have to install synaptic, i haven't installed synaptic on my desktop)
Comment: mmm, this directory contain a lot of .dep packages is there any way to add all installed programs and games in one executable file
Comment: here u don't need to do that, coz all the packages will be marked automatically for installation as soon as they are added.
Comment: Sorry, i need it and it is the only way to do the job (what is the meaning of `coz`)
Comment: coz is because .   and when u click on 'add downloaded packages' in synaptic menu , and when they are added after the process , you Dont need to mark them individually , they all get marked automatically and you just have to click on apply  to install everything .  if you Dont want to install everything you downloaded , then you will have to manually unmark packages you Dont want to install .
Answer: As techvish81 said you just have a copy of your hard disk. If you didn't find the .deb packages just search for it in Nautilus if you don't like the command-line approach.I'm sure you will get it.
And then place all the .debs you want in a folder and run the following command

sudo dpkg -i *.deb

See here
Answer: So if you're on Ubuntu 20 DON'T try to use rsync like I did. It did not work as expected instead I recommend just copying partitions via gparted specifically both the root file system (obviously) and the efi (fat32) file system, that should work just fine.


Can I eat a Zucchini pumpkin squash hybrid?

Question: My volunteer "Pumkini" came up in my flower bed and I let it grow. The fruit is large and egg-shaped with a green skin (so far). It is immature. Can I eat it like a zucchini anyone know?
Comment: I've never seen a pumpkin/zucchini hybrid but I have had zucchini/yellow squash crosses and they are definitely edible.  Sometimes they are yellow with zucchini-like marking and other times they are yellow and green striped but are pretty much like what you'd expect.  I'd expect what you have to be edible but you won't know if they taste good until you try them.  A picture would be interesting.
Answer: According to Okiedawn of Houzz/Gardenweb, you can eat young unripe pumpkins the same as summer squash. If it's more mature, you might be able to use it more like a winter squash (and I might add that it may ripen the rest of the way indoors, if you keep it in storage a while). I imagine your cross would be similar to that or zucchini. Crosses between C. maxima and C. pepo are supposed to be rare, though (so, if there's an alternative explanation, I would consider it, too).
I've eaten unripe winter squash before. I'd recommend cooking them (like frying them up like you would with a yellow summer squash), though. If they're bitter, I wouldn't eat them (bitterness tends to indicate higher levels of cucurbitacins, which are toxic).


Listing two people and yourself

Question: "My brothers, my cousins, and I"
"My brothers, my cousins and I"
Which one is correct?
Comment: You're asking about the [serial comma](http://en.wikipedia.org/wiki/Serial_comma).
Comment: As a matter of pedantry, when you list "my brothers" as plural and "my cousins" as plural, you are listing at least five people, not "two people and yourself". ;)
Comment: There should be a comma at the end of each item in a series except the last, including the next-to-last one. Some people, for reasons known only to them, believe that next-to-last comma should not be used. But they can only point to other authorities who proscribe it, and not to any real reason to depart from normal comma usage.
Answer: In the US the serial comma is more often in general use.  It is also known as the Harvard comma, as that is part of the 'house style' amd so mandatory in all written work.  It is used in the UK too, however, less so generally.  It is often known as the Oxford comma in the UK, again due to it being 'house style'.  Unless a publisher or company have a 'style' that you must adhere to, either are correct as long as you are consistent through a document in its usage and avoid ambiguity in whichever style you choose.  In the above statement there is no ambiguity.

Listing two people and yourself


Red Hat  cannot register with any organizations. How to register?

Question: So basically after I executed subscription-manager register --username Username --password Password I received a "Username cannot register with any organizations" error.
I'm sure that the answer is in the Red Hat forums, but as I don't have a subscription I cannot view these forums.
Answer: You just answered your own question. If you don't have a subscription, you can't register. Registering requires the use of a username / password pair that has at least one available subscription associated with it.
Comment: If it's for development purposes, the OP can get a free subscription on [Red Hat Developers](https://developers.redhat.com/).
Answer: You must attach subscriptions to a system via Customer Portal using Red Hat Subscription Manager as the following steps:

Log-in to the Customer Portal
Click on the Subscriptions at the upper left

Click on System in Subscriber Inventory under the Manage

Click Register a system
After Registration, click on the name of the system in Units Panel
Click on Attach a subscription (written in blue letters)
Select the desired Subscriptions and click Attach Selected
Answer: Even I was facing the same issue. But the problem got solved.
Until you accept the terms & conditions AND you have active subscription 1, you can't register.
I have solved this problem by adding company name as N/A and job title as retired. After 2 days of creating the account, active subscription became 1 and I was able to register my system.

https://access.redhat.com/products/red-hat-enterprise-linux/evaluation

go to this link and try to login for 30 days evaluation
Once I run the command :

subscription-manager list --available

I got the following output:
 Subscription Name:   30 Day Red Hat Enterprise Linux Server Self-Supported
                     Evaluation
Provides:            Red Hat Beta
                     Oracle Java (for RHEL Server)
                     Red Hat Enterprise Linux Server
                     Red Hat CodeReady Linux Builder for x86_64
                     Red Hat Enterprise Linux for x86_64
                     Red Hat Ansible Engine
                     Red Hat Container Images Beta
                     Red Hat Enterprise Linux Atomic Host Beta
                     Red Hat Enterprise Linux Atomic Host
                     Red Hat Container Images


Can I simultaneously Charge and use Canon PowerShot SX740 HS

Question: I am planning to buy Canon PowerShot SX740 HS, heard the battery can only last less than an hour. I would like to shoot a 4k 30fps tabletop videos for 2hours. Will it work with external power continuously ? suggestions please
Comment: Probably a similar answer as https://photo.stackexchange.com/questions/118035/can-you-continuously-charge-the-fujifilm-x-t200-while-filming though video questions aren't on topic here.
Comment: The Power Coupler needed to keep a PowerShot SX740 HS powered on continuously can be used for shooting either stills or video for an indefinite period of time.
Comment: @Tetsujin Except the SX740 HS isn't an ILC, it's a compact. The numbers are a little different there in terms of how many can charge the battery via USB.
Answer: No possible way to USB charge the battery while using the camera.. BUT...
I just bought a brand NOS ACK-DC110 AC adapter to use
with my Canon SX740HS and it worked great !
Just connected the 'dummy' plastic battery to the camera's
battery compartment, connected the small DC cable to the
supply then pluged this adapter to 120vac.
Powered up my camera and Voilà !
You can now use the camera for ever..
The only thing to be aware of is the 30 min max video recording time.
But otherwise you can use this camera with it's HDMI
output port directly. endless streaming...
BTW, I bought the adapter on eBay for $49.00US + shipping
Answer: The PowerShot SX740 HS Camera User Guide states on page 123 that the camera can record movies for about 100 minutes on a single, fully charged battery. The CIPA rating, which often varies from real world conditions, is listed on the same page as 60 minutes for shooting video.
The Camera User Guide also lists the Canon Compact Power adapter CA-DC30 as a compatible accessory. The Compact Power Adapter is used, along with the Canon IFC-600PCU Interface Cable to charge the battery using the camera's "digital" (micro-USB) port.
But here's the rub. The User Guide says it takes almost three hours to charge the battery in the camera. Yet that same battery can be depleted in a little more than half that time when recording video. This indicates that the battery can not be charged fast enough via the USB connection to provide enough power to continuously run the camera. To put it another way, the camera uses more power per minute than the amount of power the USB port can provide per minute. It's also not clear from any of Canon's documentation if the battery may be charged at all via USB when the camera is turned on. Many digital cameras that allow USB charging only allow it when the camera is powered down.
But there's often more than one way to skin a cat.
There are some other Canon compact cameras that use the same NB-13L battery used by the PowerShot SX740 HS that can be powered by a "dummy battery" that is connected to an AC power source. The dummy battery, called a "DC Coupler DR-110" by Canon, is part of the AC Adapter Kit ACK-DC110. At Canon's page for the ACK-DC110, it is listed as compatible with the PowerShot SX740 HS.
A small rubber flap is necessary to allow the wire attached to a power coupler into the camera when the battery compartment door is closed. The door must be closed for the camera to power up. Though it is not labeled as such in the PowerShot SX740 HS Camera User Guide, there does appear to be a rubber DC Coupler terminal cover (I've added a yellow circle) in the illustration on page 4 of the Powershot SX740 HS Camera User Guide.

Compare that to the similar drawing on page 4 of the PowerShot G7 X Camera User Guide:

Will it work with external power continuously ?

I'd be fairly confident that the PowerShot SX740 HS can use the DR-110 Power Coupler supplied with current by the ACK-DC110 plugged into an AC wall socket to keep the camera turned on indefinitely. This would allow one to use the camera in whatever way one wishes, whether that be shooting still images or recording video, for time periods much longer than two hours.
If you can't find an actual Canon branded AC Adapter Kit ACK-DC110 anywhere (they seem to have been discontinued but a few smaller camera stores seem to still have a few for sale), there are still a few different brands of third party knock-offs available on amazon.


Random bug with settings menu not loading on SP Online

Question: I'm getting a random bug when my Settings menu (Gear icon in the top right corner) does not appear sometimes on my SP Online site. I found that when it happens I have an error in my console (see below).
When I refresh the page it is all good, if I refresh 10 times, I'm getting this problem 2-3 times. Looks like some race condition is involved. I've traced the error and it looks like a bug in SP JavaScript code.
It all looks like:

Here are all details about the error:
The console error:

Here is the piece of code where the bug sits:

So line return e.Id === n.newWorkloadSettingLink.Id fails because e sometimes null. I traced the source of e and it looks like it an iteration from _spPageContextInfo.MenuData.SettingsData array + merged with something else (+5 more elements) where one element is null in my case (item with index 3).

If I'm fast enough (can include script which runs on a page before the error call) and run the following block of code on Init in my Application Customizer extension, error disappears:
    const links = _spPageContextInfo.MenuData.SettingsData;
    for (let i=0; i < links.length; i++) {
      if (!links[i]) {
        links.splice(i, 1); // Removing item if it has no value
      }
    }

But this is kind of hack, and obviously, I need some help to understand how to resolve this issue for good. Does anyone have any idea why do I have one element in the array set to null or why Microsoft has this bug?
PS.: I play with SP on my own non-commertial research project and don't have any MS support subscription. Anyway I don't believe they will fix this bug for me in shot time as they are a bit slow sometimes. My last hope that someone from the community already saw/solved something like this :)
Thanks everyone in advance!
Answer: You should open a support ticket via the Microsoft 365 Admin center. All plans have support via this mechanism. As you noted, there is nothing we can do to help.


How do I calculate the forces on a glider's foundation?

Question: I want to calculate the forces applied on a bar holding the wings, and there is a load connected to the middle of the bar. My question is, how are the forces act on the bar, supposed the wings are rectangular (I'm not sure if it matters). should I treat it as the lifting force is spreaded along the bar and the load pulling down in the middle of the bar?
Comment: You might do better to use standard terms. I think you are referring to the wing's spar instead of bar. The spar is the main load supporting member. However most wings use additional structure to provide strength including wing skins and perhaps multiple spars.
Answer: The lift distribution across the span of the wing is due to the different pressures under the wing and over the wing. in most roughly rectangular wings this distribution of the lift pressure decreases as measured further from the center/the fuselage of the plane. If the wing is swept back and in twisted or has a delta shape things get more complicated. Here is a graph of wing load versus span position for low Re numbers at an angle of attack of 6 degrees.

A very rough estimate of the distribution of the loads on your bar would be to apply the pressure in a trapezoid pattern depending on the shape of your glider.
And as you mention you can apply the load hanging from the center.
NASA has a java app to calculate the wing loads here, Foilsim III .Foilsim lll


Can the Metropolis-Hastings algorithm be generalized to quantum systems?

Question: The Metropolis-Hastings algorithm is an efficient way of simulating classical ensembles using the Monte Carlo method. Is there a generalization of this algorithm to quantum systems? What I DON'T have in mind is Wick rotation to a classical Euclidean system.
Comment: Why don't you want to discuss methods that rely on a Wick rotated classical system?
Comment: @wsc: I understand _exactly_ what he wants, and it is something interesting and new, and might not exist. Metropolis Monte-Carlo produces an essentially arbitrary local probability distribution on many variables efficiently starting from coin-flips.  He wants a sampling method which produces an arbitrarily entangled quantum state using only quantum information source, which is similarly efficient. The definition of quantum computation is sort of like this, but you want to specify an arbitarily entangled state, and how to get to it. This is asking for a Quantum computation monte-carlo analog.
Answer: It is called quantum monte carlo.
However, there is unresolved problem which does not allow to "compute everything": wavefunction of fermions should be antisymmetric, thus it changes its sign. Which is a big problem for quantum monte carlo. For bosonic systems it "just works".
UPD Both main QMC methods, variational and diffusion, are not just Wick rotation to a classical system. Variational MC is "just" a variational method with integrals computed using MC. No rotations, nothing. For trial functions there is a standard choice: Slater-Jastrow which is a jeneralization of Hartree-Fock functions with a free parameters.
I actually had in mind diffusion MC, which might look like turning into classical system, though it is not. Imaginary time is used, but serves a different purpose: to turn time evolution in the Schrodinger equation into convergence to the stationary solution. The obtained equations which are similar to diffusion equations in multi (3M where M is the number of particles involved) dimensional space gives the solution: evolution of this fictional "system of particles" which is calulated using slightly modified Metropolis algorithm gives an approximate solution of stationary Schrodinger equation as its infinite limit.
You might take a look at the introductory level paper in Rev. Mod. Phys., 73, 33 (2001).
Comment: This answer is exactly what the OP didn't want. It's classical Monte Carlo in imaginary time.
Comment: Then he could better formulate what he wanted. It is NOT just classical MC in imaginary time, by the way. The dimensionality of the classical and quantum problems is quite different.
Comment: @Misha: -1--- you are making no sense: yes, a classical deterministic system is defined by a point in phase space, but a classical _probabilistic_ system is defined by a probability distribution, which is of the same exponential size as quantum mechanics. The probability distributions reproduces the ground state properties.
Comment: @Misha--- you mean that the imaginary time quantum system is one dimension more, because of the fact that time becomes a spatial dimension. Yes, we know, and yes it _is_ just classical MC in imaginary time.
Comment: @Ron Maimon No, I mean that classical system is defined either (it depends on what you call classical, but OP was not precise enough there) by point in N dimensional space where N is the number of variables or distribution in 3 dimensional space. While quantum system is a distribution in 3M dimensional space where M is the number of particles. And QMC has no "time that becomes spatial dimension". "Time" there is somewhat fictional variable to let the (fictional) diffusion approach stationary solution (of the quantum problem). Only its infinite limit has a meaning.
Comment: @Misha, I think you're trying to talk about Diffusion (sometimes called "Green Function") Monte Carlo. This is an essentially variational approach and only one flavor of QMC (Ron's confusion is understandable). If you want this to be a good answer you should flesh out what DMC is exactly, and why it's different from path integral or stochastic series expansion approaches (which are also called Quantum Monte Carlo).
Comment: @wsc: I am _not_ confused, I understand all of this perfectly well. He is talking about the monte-carlo on the imaginary time continuation of the quantum mechanical paths. It is _exactly_ the same as any other Monte-Carlo, it's Wick rotated. It's quantum field theory in 0+1 dimensions, so it turns into a monte-carlo on 1d paths. It's not what the OP wanted. The OP wanted a _quantum computer_ algorithm which will allow you to reproduce a given quantum state by a sequence of quantum operations, like Metropolis allows you to reproduce a given classical probability distribution by some moves.
Answer: Were you thinking about something like this?
http://www.nature.com/nature/journal/v471/n7336/full/nature09770.html
or arXiv:0911.3635
They called the algorithm "quantum metropolis sampling". The only downside seems to be that you would actually need a working quantum computer.
Answer: Path integral Monte Carlo might be what you're looking for. The basic idea is to sample the partition function
$$
Z  =  {\rm tr} \ \exp\{-\beta H\}
$$
where $H$ is the Hamiltonian of a single quantum particle (think of an electron in a disordered environment in the simplest case). $Z$ can be factored into P parts
$$
Z = \int dx <x| e^{-\beta H} |x>
$$
$$
  = \int dx_1 dx_2...dx_P <x_1| e^{-\beta H/P} |x_2>... <x_P| e^{-\beta H/P} |x_1>
$$
the last expression is isomorphic to the partition function of a classical ring polymer with P 'beads' or particles. The ring geometry comes from the trace. It can be sampled with Metropolis Monte Carlo in the same way as a classical (ring) polymer.
There have been numerous applications of this method, for example to study an electron in a disordered liquid or inert gas.
For a many-particle quantum system it gets tricky because exchanges between identical particles have to be accounted for. The approach was originally proposed by Feynman in 1953 to study superfluidity in He$^4$. He had to wait a couple of years until computers were powerful enough: Ceperley & Pollock were the first to do a Monte Carlo study of liquid He II in the early 1980's.


How sim800 get ssl certificate?

Question: Sim800 supports SSL protocol. AT command "AT+CIPSSL" sets TCP to use SSL function.
In the "sim800_series_ssl_application_note_v1.01.pdf" is noted that: "Module will automatic begin SSL certificate after TCP connected."
My Problem: What is the exact meaning of the begin SSL certificate? what does sim800 do exactly? Does sim800 get SSL certificate from website? where does sim800 save SSL certificate?
Comment: Hello. Welcome to Stack Overflow. Please have a look around and take the [tour], and read through the [help]. You can also read about [ask] a good question.
Answer: As far as I know, SIM800 has some certificates in it and when you use a TCP+SSL or HTTP+SSL connection it will automatically use those certificates.
If those certificates are not ok for you, you will need to use an SD card, save there the certificates you want and use the command AT+SSLSETCERT to set the certificate you saved on your SD card. Here you can find how to use the File System.
Usually the certificates that come with the module are enough and you won't need this. But for example they didn't work for me when I tried to communicate with Azure via MQTT. I had to encrypt the data myself using wolfSSL library and send it using TCP without SSL.
Note: Not all SIM800 modules have SD card support.
Comment: could you elaborate on how you managed to communicate with Azure over TCP without SSL? I've tried various examples of this and the server rejects everytime :/
Answer: There are a very few information about sim800 and ssl certificate on the web, and like you i got a lot of questions about it.
About your questions on how does sim800 get certificate and where does it save it, it seems, according to sim800_series_ssl_application_note_v1.01.pdf, that you can create (defining your own path), write and import a ssl certificate on your own with the AT+FSCREATE, AT+FSWRITE and AT+SSLSETCERT commands. An example is provided at the paragraph 3.10.
I'm sorry, i can't answer your other questions.
Anyway, if you get further informations about sim800 and ssl, i would be grateful if you share it with me.
Answer: When you use AT+CIPSSL you tell the SIM-module to use the SSL connection with TCP. When you use +CIPSTART command->

SIM module requests the TCP connection with the server through SSL.
Server sends the Server SSL certificate.
The authenticity of that certificate is checked with internal certificate authority certificate (The one that resides inside SIM-module) which is cryptographically connected with server certificate.
If the authenticity of certificate can not be confirmed SIM-module will close the connection unless you use the command AT+SSLOPT=0,0 (which forces the SIM-module to ignore invalid certificate authentication) prior to AT+CIPSSL command.

//Key exchange

SIM-module then encrypts it's master key (already inside SIM-module cannot be changed or read) with the public key (Which is part of the already sent server certificate) and sends it back to server.
Server then encrypts it's master key with SIM-module's master-key and sends it back to SIM-module. Key exchange is now complete as both (server and SIM-module) recieved master keys.

SIM-module currently doesn't support Client authentication which means that server cannot authenticate the client. That means there must be some other option of authentication (For example in MQTT that can be username and password that only client knows)
If you want your module to be able to authenticate server you will need to create the self-signed certificate for server and certificate authority certificate (for SIM-module) which is cryptographically connected to self-signed certificate and upload them to server and SIM-module (through AT+SSLSETCERT command from SD card).
If you only want to encrypt the data traffic you can ignore invalid certificate (AT+SSLOPT=0,0) as you will recieve publickey nevertheless. But if you want to be sure about server authenticity you will need to upload right certificate to module.

How sim800 get ssl certificate?


Do you start writing GUI class first or reverse?

Question: I want to write my first Java program, for example Phonebook, and I wonder what to do first. My question is should I write GUI classes first or util classes first?
I am database developer and want to know best practice in building program.
Comment: @Job This kind of subjective question should theoretically be the good kind. Ideally we'd see a few well-reasoned and well-motivated answers explained in sufficient detail for the OP to choose from. It looks like your comment would make a good basis for one of those answers. :)
Comment: This is subjective. I like the mix of from top/from down approach. I call my chaotic approach 'agile'. I do start with a quick GUI mock-up just to see what it will feel like, and then move on to a mix of db / plumming. I do not like to finish any one part completely in isolation. I like to play with it, see what kind of noises it makes when it runs and how to make it better, what to add and what to take out. I start with GUI first because I believe that usability is ultimately most important to the user, not the extra 20 ms. Just look at the popularity of the iPhone.
Answer: In theory, there are at least five possible approaches.
Top-Down:
Start with UI mock-shots or a paper prototype. Turn them into real dialogs, and work your way from the button handlers and other controls down through the logic and to the database.
Bottom-Up:
Start with the data structures (probably the database schema). Then add logic (modelling real-world processes); finally, your UI is just an interface to trigger the logic and display the results.
Logic first:
Start with the program logic, implementing data access and a rudimentary UI as needed. Then formalize and harden the data structures, and finally flesh out the UI properly.
Meet in the middle:
Start with database schema and UI, and simultaneously work towards the point where they meet. With this approach, the logic comes last.
Horizontal expansion:
Start by identifying the absolute minimum amount of functionality that would do something interesting, and implement the whole stack (data structures, logic, and UI) for this part. It could be just a basic CRUD cycle with a simple edit dialog for just one entity. Then start adding more features, implementing the whole stack for each feature (hence 'horizontal').
Each of these has pros and cons.
Top-down gives you something visible early in the process, and allows you to check your functional design with stakeholders - mock-shots often tell users more about a design than flowcharts or walls of text.
Bottom-up gives you a chance to design a rock-solid database schema before you commit to anything; since a database schema is notoriously hard to modify once released, you want to get this part right - the impact of modifying a UI is much smaller and produces fewer and less severe bugs.
Logic-first means you can test the logic before spending serious time on the database and the presentation, which is especially interesting if your logic is going to be really complex.
Meet-in-the-middle combines the advantages of bottom-up and top-down, but you'll have to jump back and forth between two tasks, and you risk ending up with logic that is more complex than necessary because your two ends don't meet naturally.
Horizontal expansion goes well with an iterative workflow, and it has the added advantage that, if you prioritize well, you will have a working application at any given time, so if you don't make a deadline, you will have a version that has fewer features, but is still fully functional, as opposed to a version that has a complete database, but no UI at all.
So which one you choose depends on your personal style, and on the circumstances.
Answer: If you are a database developer I think you should start with a data model and create a good abstraction layer so that it is easy to define your user interface (be it GUI or not).
Answer: Personally, I would analyze the user concerns and go from there. Ideally, the aspect of the application that requires the most amount of work should start first.
In this scenario, I'd focus on UI mocks as a primary focus. The customer has expressed concern over supporting a diverse end user group, especially those with visual impediments, and distributing the system across cultural lines. Thus, while having a functional and stable system will be critical, the importance of having an interface that will allow users to easily accomplish work takes precedent.
This scenario would have me focusing on the domain logic. The customer has requested a system with complex business interactions. It will store large amounts of complex data structures. Thus initial work discovering and implementing the business logic with data source storage will lead to a successful project.
If the system is a personal project, then focus on what you want to learn from the project. If I am trying out a new technology, I try to focus on a small spike with it and isolate the technology itself so I can better grasp how it works. However a personal project that goes through all the stages will have the benefit of better preparing you for "real" projects. In that case, I'd outline some major goals and use those as a stepping stone. If this phone book app is a personal project of yours, I would suggest working through the UI first. As a database developer, I am assuming that you know how to connect databases to domain logic and roughly how to write domain logic, but have not explored UI technologies as much; thus working on the UI should benefit your learning more than starting from the data source or domain logic.
Comment: Domain logic is synonymous with business logic. It contains all the information on how different pieces of data interact with each other and how to maintain its integrity. Think about foreign key constraints in a database; domain logic will, in part, ensure that no data being inserted into the database breaks this constraint. Additionally, it contains any algorithms you use to solve a problem. For example, Google maps performs calculations on the fastest path between two addresses, this would be implemented in the domain logic.
Comment: Can you explain me briefly what is domain logic?
Answer: Start with the part of the project you find most interesting. If you start with the part you don't like you might quit before you make progress. Where you start is mostly a matter of preference so you might as well choose what you most want to work on.
Answer: Start with the domain or what you call 'util classes'. Test it independently of your UI implementation. That way you get a better understanding of how your application behaves (or should behave), how the logic plays out regardless of which UI framework, MVC or whatnot, tools, styles you're planning to use in the end.
Binding yourself to a specific UI implementation is usually a bad idea. I'm not saying that you shouldn't consider it up front. I'm saying that your application shouldn't be dependent on it. The UI tends to change A LOT over the course of a project and if your domain is tied to it then you'll be changing your domain a lot as well.
Comment: I suppose you are assuming a rather large (multiple man-months) system here.
Comment: Any project I'm not planning to throw away within the month, so yeah.
Answer: Almost everyone will have a different method for developing that suits their style. For example, one person may find that its easier to design their GUI if they have defined the underlying architecture and data storage.  Another person may find however that playing around with the GUI and getting an initial draft may help them better organize their storage system and code their program in a more organized manner.  The task before you will be to find out which method (or perhaps some hybrid of the two) works best for you.  For me, I prefer to do an initial mockup of what I think the GUI will look like, then begin working on the nuts and bolts of the application.  Once I've done that I typically come back and make changes to the GUI as needed.  My recommendation to you is to pay careful attention as you work on small projects and get a feel for the approach that helps you most.
Answer: This is a fairly straightforward project where I'd say it's not that important.  On many projects though it's not going to be immediately clear exactly how you want the GUI to look and operate, and once you make it someone may ask you to change it.  It's good to make quick mockups of the GUI so you or whoever is in charge can come to a concrete decision on what it should look like and then this will give help you see some of the correletive pieces of data you'll need to track that you might not have noticed had you started with the data design.
More importantly, you do NOT want your data design to drive your user interface.  Relatively speaking, I believe fixing poor GUI implementations is far easier than fixing poor data implementations.  So I definitely vote for starting with the GUI.
And I'm more of a database guy myself, just fyi.


How to completely remove ubuntu-restricted-extras

Question: I recently installed ubuntu-restricted-extras but it is causing bugs in Google Chrome, and I want want to remove it. However, when I do it using sudo apt-get autoremove or sudo apt-get purge it doesn't seem to be completely removed because when I was installing it, a lot of packages got removed and others got installed.
My question is: How do I make things just like they was before installing ubuntu-restricted-extras?
Thanks.
Comment: That package should not cause "bugs" in Google Chrome. Quite a few of us have the restricted extras installed and Google Chrome works perfectly. Perhaps you'd like to explain what exactly are the bugs? Maybe there's another cause for them?
Comment: I think that restricted extras is causing the bug because Chrome was working fine before installing it. But now, when I try to publish something on Twitter, start from the beginning even though I put it at the end.
Answer: You can use synaptic.  If you don't have it installed, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:
sudo apt-get install synaptic

Once done, open synaptic, by typing it in dash, and once it opens search for ubuntu-restricted-extras, right click, and choose Mark for Complete Removal, and then click on Apply.
Comment: Thank you. But is this going to reinstall the packages that were removed during the `ubuntu-restricted-extras` installation?
Comment: No.  Packages removed probably are not needed anymore.  Any package in particular you're concerned about?
Answer: The issue you are having is that the ubuntu-restricted-* metapackages use recommendations instead of dependencies. If you want to completely remove the packages recommended by either of these, a safe way is to do it manually (tested on Ubuntu 14.04.3):

apt-cache show ubuntu-restricted-extras
apt-cache show ubuntu-restricted-addons
Take note of all the "Recommends:" packages.
apt-get remove ubuntu-restricted-extras ubuntu-restricted-addons
apt-get remove for all the recommended packages
apt-get autoremove to get rid of the installed dependencies for the recommended packages.

Then if you want you can do a clean reinstall:

apt-get install ubuntu-restricted-extras to get everything back

Note that apt-get install --reinstall for all of the recommended packages would not be thorough enough as it would not get rid of the installed dependencies for the recommended packages.
Answer: The following answer is irrespective of the problem you faced with Google Chrome.
It's an answer to the title's question.
The ubuntu-restricted-extras package, is a dummy package that installs other packages and libraries as well.
Here is an example list
cabextract flashplugin-installer freepats gstreamer0.10-ffmpeg gstreamer0.10-fluendo-mp3 gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse
  gstreamer0.10-plugins-ugly gstreamer1.0-libav gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly liba52-0.7.4 libass4 libavcodec-extra-53 libavformat53 libavutil-extra-51
  libcdaudio1 libdc1394-22 libdca0 libdirac-encoder0 libdirectfb-1.2-9 libdvdnav4 libdvdread4 libenca0 libfaac0 libfaad2 libfftw3-3 libfftw3-double3 libflite1 libgme0 libgsm1
  libgstreamer-plugins-bad0.10-0 libgstreamer-plugins-bad1.0-0 libkate1 libmad0 libmimic0 libmjpegutils-2.0-0 libmms0 libmodplug1 libmp3lame0 libmpcdec6 libmpeg2-4
  libmpeg2encpp-2.0-0 libmpg123-0 libmplex2-2.0-0 libnspr4-0d libnss3-1d libofa0 liboil0.3 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenjpeg2 libopus0
  libpostproc52 libschroedinger-1.0-0 libsidplay1 libslv2-9 libsoundtouch0 libspandsp2 libswscale2 libts-0.0-0 libtwolame0 libva1 libvo-aacenc0 libvo-amrwbenc0
  libwildmidi-config libwildmidi1 libx264-123 libxvidcore4 libzbar0 libzvbi-common libzvbi0 tsconf ttf-mscorefonts-installer ubuntu-restricted-addons ubuntu-restricted-extras
  unrar

You can copy-paste the above code to a txt file and run
sudo apt-get remove $(cat somefile.txt)

Be Aware that the package-libraries versions may vary. Above is from Ubuntu 13.10.
Also you can locate the command you gave "apt-get install ubuntu-restricted-extras" in apt history log files and see which packages this command had installed.
Try
cat /var/log/apt/history.log

If the installation is recent it will be listed there, if is older, you can try other history logs as well. e.g. history.log.1.gz (you can list .gz files with zcat instead of cat)
Answer: @Mitch answer doesn't remove completely ubuntu-restricted-extras package (at least in Ubuntu 14.04). Certainly because ubuntu-restricted-extras has not much "depends" packages but "recommends" instead, that are installed automatically by default.
apt-cache depends ubuntu-restricted-extras
  Depends: ubuntu-restricted-addons
  Recommends: ttf-mscorefonts-installer
  Recommends: unrar
  Recommends: gstreamer0.10-plugins-bad-multiverse
  Recommends: <libavcodec-extra-53>
  Conflicts: ubuntu-restricted-extras:i386

apt-cache depends ubuntu-restricted-addons
ubuntu-restricted-addons
  Recommends: gstreamer0.10-plugins-ugly
  Recommends: gstreamer1.0-plugins-ugly
  Recommends: flashplugin-installer
    flashplugin-installer:i386
  Recommends: gstreamer0.10-plugins-bad
  Recommends: gstreamer1.0-plugins-bad
  Recommends: gstreamer1.0-libav
  Recommends: gstreamer0.10-fluendo-mp3
  Recommends: gstreamer1.0-fluendo-mp3
  Recommends: chromium-codecs-ffmpeg-extra
  Recommends: oxideqt-codecs-extra
  Conflicts: ubuntu-restricted-addons:i386

Unfortunately apt-get purge package and apt-get autoremove --purge don't remove "recommends" packages (Remove recommended packages) even after you uninstall ubuntu-restricted-extras and ubuntu-restricted-addons, so you have to uninstall manually what you don't need (I had ttf-mscorefonts-installer, unrar and flashplugin-installer already installed):
sudo apt-get purge ubuntu-restricted-extras ubuntu-restricted-addons gstreamer0.10-plugins-bad-multiverse libavcodec-extra-53 gstreamer0.10-plugins-ugly gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer0.10-plugins-bad gstreamer1.0-libav gstreamer0.10-fluendo-mp3 gstreamer1.0-fluendo-mp3 oxideqt-codecs-extra

On my computer, removing chromium-codecs-ffmpeg-extra wants to uninstall chromium, so I had to install chromium-codecs-ffmpeg and it will uninstall chromium-codecs-ffmpeg-extra:
sudo apt-get install chromium-codecs-ffmpeg


App detects it has been previously installed

Question: How does an app detect that it has been previously installed on a phone even though it was hard reset and completely wiped (even the system partition and sd card and everything)? I think it is due to IMEI number.
Are there any methods to bypass this?
In case of multiple such methods, what is the best method and what is the most popular? And how can each be bypassed?
Comment: Could you mention what app? There are many possibilities (e.g. IMEI, MAC address, phone number, "unreliable" device ID, etc), so it's better to pinpoint the cause on specific app.
Comment: @AndrewT. Actually I'm not interested in a particular app. I have edited the question in accordance with your comment. :)
Answer: If you did the hard reset, but app still know, I think it check your IMEI, MAC address, google ID, or else stored in app owner server or google.
Answer: I can think of two things involved here:

Not clean wipe: An app might keep that record of being installed somewhere on the device, that even uninstalling the app, doesn't get deleted. Thus, upon being re-installed, goes to check that whatever it stored to learn if its been on that particular device before. Therefore, if you say you wiped clean, then it wasn't an 'entirely' clean wipe, as the app stored the file somewhere out of reach of a 'normal' wipe. With that said, wipe-wipe-totally-clean-everything, in other words, hard wipe
A remote account involved: Does the app request to login before using the app? If so, then probably, the app stored a combination of unique information about your phone somewhere remotely (online), then upon re-login, it simply checks to verify.


Non-homogenous recurrence relation

Question: I need to solve the recurrence relation  $A(n)=2A(n-2)+ 2^{n-2}$. I tried writing out equations up to the $A(2)$ and multiplying by powers of two and adding all the equations together  then all the terms cancelled but after that I couldn't find the sum of the powers of two. I forgot to mention that the base is $A(2)=2$ and n is even
Comment: Do you have a guess for the general term? If so, you can try to prove that your guess is right by induction.
Comment: Unfortunately, I don't .
Answer: Let us compute some values of A(n):
$n=2, A(2)=2$
$n=4, A(4)=2A(2)+2^2=8=2^3$
$n=6, A(6)=2A(4)+2^4=32=2^5$
$n=8, A(8)=2A(6)+2^6=128=2^7$
You should see the pattern, It seems that $A(n)=2^{n-1}$. This is true and can be easily shown by induction.
Answer: You do this much the same way as you might solve a differential equation: first find the general solution to the homogeneous part of the equation, and then find a particular solution that you can add to that general solution.
The homogeneous equation here is:
$$
A(n)=2A(n-2)
$$
Because $n$ is even, the general solution to this is easily seen to be:
$$
A_C(n)=B.2^{n/2}
$$
where $B$ is an arbitrary constant.
We now seek a particular solution.  One thing we could try would be just setting:
$$
A_P(n)=2^{n-2}
$$
But then $2A_P(n-2)+2^{n-2}=2^{n-1}+2^{n-2}\neq2^{n-2}$.
That didn't work.  We somehow need to find some way to make the two terms on the left combine into one term.  If we try
$$
A_P(n)=2^{n-1}
$$
then we get:
$$
2A_P(n-2)+2^{n-2}=2^{n-2}+2^{n-2}=2^{n-1}=A_P(n)
$$
Thus, $A_P(n)=2^{n-1}$ is a particular solution to the equation.  The general solution then is:
$$
A(n)=A_C(n)+A_P(n)=B.2^{n/2}+2^{n-1}
$$
Since $A(2)=2$, we have
$$
2=B.2^1+2^1=2B+2
$$
So $B=0$, and the solution is $A(n)=2^{n-1}$.
Answer: It never hurts in such problems to start by gathering some numerical data:
$$\begin{array}{rcc}
n:&2&4&6&8&10&12\\
A(n):&2&8&32&128&512&2048\\
A(n):&2^1&2^3&2^5&2^7&2^9&2^{11}
\end{array}$$
There's a very obvious pattern here, that leads to the conjecture that $A(n)=2^{\text{what function of }n?}$ if $n$ is even. Complete the conjecture correctly, and you should have little difficulty using mathematical induction to prove that it's correct.
Alternatively, let $B(n)=A(2n)$; then $$B(n)=2B(n-1)+2^{2(n-1)}=2B(n-1)+4^{n-1}\;,$$
and 'unwrap' the recurrence:
$$\begin{align*}
B(n)&=2B(n-1)+4^{n-1}\\
&=2\Big(2B(n-2)+4^{n-2}\Big)+4^{n-1}\\
&=2^2B(n-2)+2\cdot 4^{n-2}+4^{n-1}\\
&=2^2\Big(B(n-3)+4^{n-3}\Big)+2\cdot 4^{n-2}+4^{n-1}\\
&=2^3B(n-3)+2^2\cdot4^{n-3}+2\cdot 4^{n-2}+4^{n-1}\\
&\;\vdots\\
&=2^kB(n-k)+2^{k-1}\cdot 4^{n-k}+2^{k-2}\cdot 4^{n-k+1}+\ldots+2\cdot 4^{n-2}+4^{n-1}\\
&\;\vdots\\
&=2^{n-1}B(1)+\sum_{i=1}^{n-1}2^{i-1}\cdot4^{n-i}\\
&=2^n+\sum_{i=1}^{n-1}2^{i-1}\cdot4^{n-i}\\
&=2^n+\sum_{i=1}^{n-1}2^{i-1}\cdot2^{2n-2i}\\
&=2^n+\sum_{i=1}^{n-1}2^{2n-i-1}\\
&=2^n+\sum_{i=n}^{2n-2}2^i\\
&=2^n+2^n\sum_{i=0}^{n-2}2^i\\
&=2^n\left(1+\sum_{i=0}^{n-2}2^i\right)\\
&=\;?
\end{align*}$$
Answer: Generating functions to the rescue. Define $g(z) = \sum_{n \ge 0} A(n) z^n$, write:
$$
A(n + 2) + 2 A(n) + 2^n
$$
Multiply by $z^n$, sum over $n \ge 0$ and recognize the resulting sums to get:
$$
\frac{g(z) -A(0) - A(1) z}{z^2} = 2 A(z) + \frac{1}{1 - 2 z}
$$
As partial fractions:
$$
A(z)
  = \frac{1 - 2 A(0) - 2 (A(1) - 1) z}{2 (1 - 2 z^2)} + \frac{1}{2 (1 - 2 z)}
$$
You could now split the first term into partial fractions (but with irrational coefficients) or just take:
\begin{align}
\frac{1}{1 - 2 z^2}
  &= \sum_{n \ge 0} 2^n z^{2 n} \\
\frac{z}{1 - 2 z^2}
  &= \sum_{n \ge 0} 2^n z^{2 n + 1}
\end{align}
i.e., split into even and odd cases.
The second term is just a geometric series.

Non-homogenous recurrence relation


What is different between 分かります and 分かりました。

Question: What is different between 分かります and 分かりました。
Comment: @Earthling But this is not a tense question.
Comment: I think that tense is relevant, but it interacts with aspect in a way that may be non-obvious.
Comment: Do you know how to express present and past tense in Japanese?
Comment: I think also that it is tense-relevant : think that わかります is along the lines of "I am understanding/I know" meaning a continuous action, whereas 分かりました is along "I understood", meaning something that has been learned (and is done). But well, the answer's good.
Answer: A very good question.
Despite how it might look on the surface, this is definitely not a question about tense.
We use the two phrases differently depending on the situations -- more specifically, on the content of the discourse.  In other words, it depends on what the other person has just said to you.

You use 「わかりました」 when you understand the explanation or instruction that the other person has just given to you.  It is an expression of comprehension of and obedience to what has been explained to you.  You just learned something now.

Guy: "To get to the XXX Park, you go ~~~~~."
You: 「わかりました。ありがとうございます。」 You will never say 「わかります」 here.

「わかります」 is quite different in that it is used to say "Yes, I know." or "I know what you mean."  It is an expression of knowledge and sometimes, sympathy.

Guy: 「『懐疑的』の意味はわかりますか。」"Do you know what 懐疑的 means?"
You: 「はい、わかります。」
or --
Woman: "My husband just sits in the couch and watches TV ~~~~~.  He never helps me with ~~~~."
You:「わかります。My husband is the same way.」
Comment: Excellent ! I would simply add that in english terms, usage of 分かりました is similar to that of "understood" maybe more casual whereas 分かります can be used as "I understand/I feel you" but I know it's not always a good idea to provide translations...
Answer: 分かりました = i understood
分かります = i understand


Custom Form only for admin

Question: I want to add a custom form with some fields such as text,date,dropdown etc only viewable and editable for admin.When I submit the form the data should be displayed in the desired page that I select.Is there any way to do that. I dont have any idea about how to start with this. Can anyone help me with this?
Comment: Where should this form be visible? Should it be placed in wp-admin area or in front end?
Comment: Thanks for taking a look at my question. I want to display it in the admin area and as mentioned in the question I want to add the fields I want to be added in the form. Once data is entered into those fields and submitted, That data should be shown in the page I choose.
Answer: Well, it won't be easy, but you can do this in this way:

Add a Custom Post Type (you can restrict access to this CPT for admin only).
Use Advanced Custom Fields plugin and create custom fields template for your Custom Post Type from 1.
Create a custom page template and place custom query inside it (with this query you can select custom posts).
Comment: Is there any plugin availabel to do this?
Comment: There are some plugins to add CPT. But it's pretty easy, so you can add it in code. For custom fields you can use Advanced Custom Fields plugin. I don't think there is any plugin to create custom page template (and if there is I wouldn't use it).

Custom Form only for admin


Wigner-Eckart theorem and vectors

Question: Let's consider a system in state $^3$D$_1$:
$$\vec{L}^2=L(L+1)=6 $$
$$\vec{S}^2=S(S+1)=2$$
$$\vec{J}^2=J(J+1)=2$$
According to Wigner-Eckart theorem, if this is an irreducible representation, all vectors are proportional, so for example $\vec{S}=a\vec{J}$.
$$\vec{S}\cdot\vec{J}=a\vec{J}^2$$
$$\vec{J}-\vec{S}=\vec{L}$$
$$\vec{J}^2+\vec{S}^2-2\vec{S}\cdot\vec{J}=\vec{L}^2$$
$$\vec{S}\cdot\vec{J}=-1$$
Therefore we find $a=-\frac{1}{2}$, however:
$$\vec{S}^2=2\neq\frac{1}{2}=a^2\vec{J}^2$$
Why doesn't $\vec{S}^2=a^2\vec{J}^2$ hold true, when we have $\vec{S}=a\vec{J}$?
Answer: You are misinterpreting W-E theorem. Let me review it for your
example. You are given two irreps, the one for $\vec S$, of dimension 3, and the one for $\vec L$, of dimension 5. Then you build up their direct product, which is of dimension 15 and reducible. Reduction is effected via $\vec J$ and gives three irreps, of dimensions 3, 5, 7 ($3+5+7=15$). Then you consider the first, of dimension 3.
W-E theorem says that any vector operator will have - within that
irrep - matrix elements proportional to those of $\vec J$. Up to now
it's all ok.
But then you operate - within that representation - using algebraic
relations between $\vec S$, $\vec L$, $\vec J$, and this isn't
justified on ground of W-E theorem. Actually it's wrong, because
$\vec S$ as well as $\vec L$ have matrix elements from that irrep to
the other two. (Only $\vec J$ is reduced into blocks and has zero
matrix elements among different eigenvalues of $J^2$.) Only in the
full 15D rep you'd be permitted to write your equations.
Comment: With algebraic relations are you referring to $\vec{J}=\vec{S}+\vec{L}$? isn't that the definition of total angular momentum? (at least that's what is written on the notes I'm studying on) And if the procedure I wrote is wrong, how can I actually calculate $a$ limited to the irrep in question?
Comment: I've studied your problem a little (actually I'd to aid my memory by resorting to lecture notes of mine, of about 20 years ago). Your calculation of $a$ is right (for a complicated reason difficult to explain in a comment). What's wrong is your last step: $\vec
S^2=a^2\,\vec J^2$. This is because $\vec S^2=2$ is only true if you use for $\vec S$ the whole $15\times15$ matrix. From your signature I guess you can read Italian. If it's so, the matter is dealt with [here](http://www.sagredo.eu/lezioni/gruppi/gruppi10.pdf) page 10-5
and following.
Comment: In case you're still interested, I've written a complete explanation of the whole matter (applied to your example). You'll find it as an answer, since it's very much too long to fit in a comment.
Answer: $\let\l=\lambda
\def\bJ{{\bf J}} \def\bL{{\bf L}} \def\bS{{\bf S}}
\def\cD{{\cal D}} \def\cG{{\cal G}} \def\cV{{\cal V}}
\def\ket#1{|#1\rangle}
\def\frac#1#2{{\textstyle{#1\over#2}}} \def\half{\frac12}
\def\a{^{(3)}} \def\b{^{(5)}} \def\c{^{(7)}} \def\d{^{(15)}}
\def\Da{\cD\a} \def\Db{\cD\b}\def\Dc{\cD\c} \def\Dd{\cD\d}
\def\Va{\cV\a} \def\Vb{\cV\b}\def\Vc{\cV\c} \def\Vd{\cV\d}
\def\Pa{\Pi\a} \def\Pb{\Pi\b}\def\Pc{\Pi\c} \def\Pd{\Pi\d}
\def\bVa{\bar V\a} \def\bVb{\bar V\b}$
Let's review the problem from its beginning. (I prefer to use boldface capital letters for vector operators, ordinary capital for scalar operators. Lowercase letters always mean ordinary numbers. In
particular, $j$, $l$, $s$ denote quantum numbers.)
We start with a set of states with definite $l$ and $s$: $l=2$, $s=1$. The corresponding kets span a 15-dimensional vector space $\Vd$, tensor product of a 5D space $\bVb$ having a base formed by $L_z$ eigenvectors and a 3-dimensional one $\bVa$, with base of $S_z$ eigenvectors. We could denote the corresponding base in $\Vd$ by
$$\ket{2,1;m_l,m_s}$$
with $m_l$ ranging from $-2$ to $+2$ and $m_s$ from $-1$ to $+1$, but little use will be made of this notation. It's important however to note that in that representation $L_z$, $S_z$ are diagonal and
$|\bL|^2$, $|\bS|^2$ are not only diagonal but multiple of the unity:
$$|\bL|^2 = 6\,I \qquad |\bS|^2 = 2\,I.$$
In the following I'll let $I$ understood when this causes no
ambiguity.
As to $\bJ$, it's defined by
$$\bJ = \bL + \bS \tag1$$
then $J_z=L_z+S_z$ is also diagonal but this can't be said of
$|\bJ|^2$. In fact $|\bJ|^2$ doesn't commute with $L_z$ and $S_z$.
Instead of the $L_z$, $S_z$ base another is of much use: the one where $|\bJ|^2$ and $J_z$ are diagonal. Of course eigenvalues of $|\bJ|^2$ are $j(j+1)$ with $|l-s|\le j\le l+s$ while
$-j\le m_j\le j$. Note that $|\bJ|^2$ in $\Vd$ isnt't a multiple of unity - allowed values for $j$ are $1,2,3$. The base kets are labelled
$$\ket{j;m_j}.$$
Transition from the $m_l,m_s$ representation to the $j,m_j$ is
accomplished by a unitary matrix. Finding that matrix is the
Clebsch--Gordan problem.
There's a deeper way of looking at this problem. Let me summarize it
briefly. We have two representations of the rotation group SO(3) (or better SU(2), but here we don't need to worry about the difference). By representation is meant

A vector space $\cV$.
A group $\cG$ of linear operators over $\cV$, homomorphic to SO(3).

(By homomorphic is meant that every rotation has an image in $\cG$,
respecting multiplication properties. The correspondence needs not to be one-one.)
In our case we have two such representations:

One, called $\Db$, acting on $\bVb$ and generated by operators $\bL$
Another, called $\Da$, acting on $\bVa$ and generated by operators
$\bS$.

Actually in our discussion the group $\cG$ has never appeared - only
angular momentum operators $\bL$, $\bS$, $\bJ$ are playing the game.
Maybe you know why it's so: angular momentum operators are the Lie
algebra of SO(3) and what we are dealing with are representations of that Lie algebra. Without deepening the relationship between a Lie group and its algebra, I want only to recall that in a sense the Lie algebra operators describe the infinitesimal transformations of the group and that almost all properties of that group can be deduced from those of its Lie algebra.
So we start with two representations (physically orbital and spin
angular momenta) whose base vectors are
$$\ket{2;m_l} \quad {\rm and}\quad \ket{1;m_s}$$
respectively belonging to $\bVb$ and to $\bVa$. What is $\Vd\,$? It's their tensor product:
$$\Vd = \bVb\!\otimes \bVa.$$
One base in $\Vd$ is given by the set of pairs
$$\ket{2;m_l}\,\ket{1;m_s}$$
usually contracted (as I did above) to $\ket{2,1;m_l,m_s}$. Of  course $\Vd$ too hosts a representation $\Dd$ of SO(3) and of its Lie algebra: we get it simply adding $\bL$ and $\bS$. To be precise, we had to extend $\bL$ from $\bVb$ to $\Vd$ and $\bS$ from $\bVa$ to
$\Vd$ too:
$$\bL \otimes I\b \qquad I\a\!\otimes \bS$$
but that is usually left understood.
Now the concept of invariant subspace and of minimal invariant
subspace must be introduced. Let's begin with $\Vd$. All operators
like $\bL$, $\bS$ and their linear combinations when applied to a
generic ket $\ket u\in\Vd$ give a result still belonging to $\Vd$ -
that's trivial. The question arises whether proper subspaces $\cV$
of $\Vd$ exist sharing the same property:
$$\Dd \cV \subseteq \cV.$$
Any such $\cV$ is called an invariant subspace of $\Dd$. If no other invariant subspace $\cV'\subset\cV$ exists, then $\cV$ is called a minimal invariant subspace. We don't yet know if proper invariant subspaces of $\Vd$ do exist (well, actually we know, but let's pretend we're learning all this matter anew). If $\Vd$ had no proper invariant subspaces, we'd say $\Dd$ is irreducible - otherwise $\Dd$ is reducible. In the latter case we are interested in reducing $\Dd$, i.e. in finding all minimal invariant subspaces of $\Vd$, such that their direct sum equals $\Vd$.
In physical terms, that's the problem of composition of angular
momenta, and we know the answer:
$$\Vd = \Va \oplus \Vb \oplus \Vc.\tag2$$
The meaning of eq. (2) is that every ket of $\Vd$ is the unique sum of three kets, one belonging to $\Va$, another to $\Vb$ and a latter to $\Vc$. Note that $\Va$, $\Vb$, $\Vc$ are mutually orthogonal (that's a theorem for SO(3) and generally for compact or finite groups).
So a complete reduction of $\Dd$ is equivalent to changing to the base $\ket{j;m_j}$. In that base all matrices representing SO(3) or its Lie algebra are reduced to blocks: only matrix elements internal to component subspaces are non zero. Note however that this holds for $J_x$, $J_y$, $J_z$ and their linear combinations - but not for the components of $\bL$ and $\bS$. As to $|\bL|^2$ and $|\bS|^2$, they are always $5\,I$ and $3\,I$ - as they are multiple of the unity this holds in any orthonormal base. $|\bJ|^2$ is slightly more complicated:it's a multiple of unity in each invariant subspace, but with different coefficients:
$$|\bJ|^2 = 2\,I\a + 6\,I\b + 12\,I\c. \tag3$$
Shortly we'll see another way of expressing that.
Now consider your first passages. From eq. (1) we get
$$\bL = \bJ - \bS$$
and squaring
$$|\bL|^2 = |\bJ|^2 + |\bS|^2 - 2\,\bJ\cdot\bS$$
$$2\,\bJ\cdot\bS = |\bJ|^2 + |\bS|^2 - |\bL|^2 \tag4$$
All these equations, in particular (4), hold in $\Vd$. We must be
careful when trying to apply it to subspaces like $\Va$, which is what you did. In order to operate safely I'll now introduce the technique of projection operators.
Maybe you know them, but let me write a short summary, using our space $\Vd$ and its subspaces as an example. Recall eq. (2) and its
interpretation. If $\ket u\in\Vd$ then there are three kets
$\ket{u\a}\in\Va$, $\ket{u\b}\in\Vb$, $\ket{u\c}\in\Vc$, uniquely
determined and such that
$$\ket u = \ket{u\a} + \ket{u\b} + \ket{u\c}.$$
$\ket{u\a}$, $\ket{u\b}$ and $\ket{u\c}$ are mutually orthogonal.
Now the projection operator $\Pi\a$ is so defined:
$$\Pa\,\Va = \Va \qquad \Pa\,\Vb = 0 \qquad \Pa\,\Vc = 0 \tag5$$
(please note the notation abuse: I've written "0" meaning the
"zero ket" which is an element of $\Vd$, not a number). A parallel
definition is given for $\Pb$ and $\Pc$. The following properties are implied:
$$\Pa + \Pb + \Pc = I \tag6$$
$$\Pi^{(i)}\,\Pi^{(k)} = \Pi^{(i)} \delta_{ik} \quad (i,j = 3,5,7)$$
For a generic operator $A$ acting on $\Vd$ I'll define
$$A^{(i)} = \Pi^{(i)} A\,\Pi^{(i)}.$$
For instance, what is ${(|\bJ|^2)}\a\,$? From eq. (3) you can easily
verify that
$${(|\bJ|^2)}\a = 2\,\Pa.\tag7$$
And what about $(\bJ\cdot\bS)\a\,$? From (4), (6)
$$2\,(\bJ\cdot\bS) = 2\,\Pa + 6\,\Pb + 12\,\Pc - 4\,I =
-2\,\Pa + 2\,\Pb + 8\,\Pc$$
$$(\bJ\cdot\bS)\a = -\Pa.$$
On the other hand
$$\eqalign{
(\bJ\cdot\bS)\a &= \Pa(\bJ\cdot\bS)\,\Pa \cr
&= \bJ\a\cdot\bS\a + \Pa\bJ\,\Pb\cdot\Pb\bS\,\Pa +
\Pa\bJ\,\Pc\cdot\Pc\bS\,\Pa \cr
&= \bJ\a\cdot\bS\a \cr}.$$
I've used (3) which implies $\Pa\bJ\,\Pb=\Pa\bJ\,\Pc=0$. Then
$$\bJ\a\cdot\bS\a = -\Pa \tag8$$
And at last Wigner and Eckart came! Applied to our example the theorem
says, as you wrote
$$\bS\a = a\,\bJ\a \tag9$$
for some $a$ to be determined. Multiplying by $\bJ\a$
$$\bJ\a\cdot \bS\a = a\,\bJ\a\cdot\bJ\a = 2\,a\,\Pa$$
from (7). Using (8) in LHS
$$a = -\half.$$
On the other hand, from (7) and (9)
$$\bS\a\cdot\bS\a = a^2 {(|\bJ|^2)}\a = \half\,\Pa.$$
So you see where your error was. You'd taken $|\bS|^2=2$, which is
true in $\Vd$ but not in $\Va$. This is because $\bS$ isn't reduced in
blocks, like $\bJ$. Would you try to check that $\Pa\bS\,\Pb$,
$\Pa\bS\,\Pc$, $\Pb\bS\,\Pc$ don't vanish?

Wigner-Eckart theorem and vectors


Verifying whether point lies on line or not when both given in GCS?

Question: Googled and tried to look on Esri's forum but couldn't get anything. Rather got things which were verifying if the point is within a polygon or not. But I want to know, if I have starting point and end point of a line on a map with datum as WGS84 and geographic coordinate system, and I have another point in the same system, how can I verify if the point lies on the line or not? I am pretty new in the field of GIS, so maybe it's a very trivial question.
Comment: What GIS software are you using to try and do this?
Comment: I have arcgis. Though if you can explain me geometry behind it. I can code than on my own. @PolyGeo
Comment: Point-on-line is a philosophical question, even before taking great circle route complications into account. To make this answerable you'll need to edit the question to provide context -- GIS software being used (with version), data format(s) of the line and point sources, whether you want the routes between vertices to be geodetic or Cartesian, and what distance from that route is close enough to be considered "on" the line.
Answer: Here are a few links to get you started in the right direction.  This is not simple Euclidean geometry question.
See Charles F. F. Kinney's (cffk's) response to Finding projection of point to line?
The C code Charles mentions is at this link to his intersect.ccp file
His very detailed article entitled Algorithms for geodesics deals with math behind the problems of intersection and interception in Section 8 Ellipsoidal gnomonic projection.
Here is a more general discussion presented in simpler terms at Ask Dr. Math
A geoprocessing approach would simply involve using the Intersect tool on the two layers and outputting a point feature class where the points that fell on the lines would merge the point and line attributes and the points that did not fall on the lines would not be in the output.


Requesting a favor from student for giving recommendation letters

Question: Can I ask/ insist a bright undergraduate student (who is having similar areas of interest) to work under me for his final year project period and try to come up with a scientific publication in favor for giving him recommendation letters for internships?
Comment: What you propose is plainly unethical and abusive towards the student.
Comment: Generally speaking, if you think something might not be ethical, it probably is not ethical. The things you give up by being ethical are trivial in comparison to what you give up by not being ethical.
Comment: give, and you will be given... Sometimes the bible helps ;-)
Answer: It sounds like what you want to do is to write a letter now in exchange for the promise that they will work for you later. Whether you can do this is down to your university's rules, but I would argue that it is unethical and unwise to coerce a student in this way.
My recommendation would be to accede to the request and make the offer

Sure, I can write you a strong letter. For that matter, if you are looking for research experience, I would be happy to supervise your senior project next year. Let's chat sometime if you are interested.

If you are not willing to write the letter:

My policy is to only write recommendation letters for students who do research with me. That said, I'd be happy to discuss hiring you as a research assistant next year.

Note, this second one still links the two, but it simply tells the student your requirements, rather than suggesting quid pro quo.
Comment: I would go with your first highlighted paragraph. The policy in the second paragraph is no good for the reasons that people have been concerned about the original proposed bargain. Letters of reference should never be tied to any sort of compensation. You should write such a letter if you find the person worthy of a letter of reference, period. Even restricting it the way you suggest in the second paragraph is on the wrong side of the line.
Comment: I agree that OP should write the letter. In general though, having a policy that "I will only write for students that meet X criteria" is reasonable and ethical, and it is proper to cite that policy when declining to write a letter. I don't think the policy of "I'll only write for my research employees" is a good one, but that's for OP to decide.


When do you write a private method, versus protected?

Question: If I'm writing a class, when do I make a method private, versus protected? In other words, how I can know in advance that a client programmer would never ever need to override a method? In a case where it's something that has external considerations, like a database connection?
Comment: Should this be tagged with php?  Doesn't seem like there should be a difference, but I'm not familiar with OO stuff in PHP so maybe private v. protected are crazy-different in PHP than other OO languages.
Comment: I'm not too familiar with OO outside of PHP, so I didn't want to assume anything. Maybe it *is* crazy different; I don't know! :)
Answer: public and protected methods form the 'interface' to your object, public for developers using (delegating to) your class, and protected for developers wishing to extend the functionality of your object by subclassing it.
Note that it's not necessary to provide protected methods, even if your class will be subclassed.
Both public and protected interfaces need careful thought, especially if this is an API to be used by developers outside your control, since changes to the interface can break programs that make assumptions about how the existing interface works.
private methods are purely for the the author of the object, and may be refactored, changed and deleted at will.
I would go for private by default, and if you find you need to expose more methods, have a careful think about how they will be used - especially if they are virtual–what happens if they are replaced completely with an arbitrary alternative function by another developer–will your class still work?  Then design some appropriate protected which are useful for developers subclassing your object (if necessary), rather than exposing existing functions.
Comment: +1 the point is that you have to think about your implementation in another way when you make private stuff protected. You can't just make everything protected/public.
Comment: /\-- +1 Took the words out of my mouth.
Comment: good explanation, but using `private` by default is the reason why I stop using certain classes. I simply can't extend them and I am not willing to copy-paste them.
Comment: Amazing explanation.
Answer:
In other words, how I can know in
  advance that a client programmer would
  never ever need to override a method?

You cannot. And you don't need to. It is not your job to anticipate IF a developer might want to override a method, let alone how. Just assume he wants to and enable him to do so without having to touch your code. And for this reason, do not declare methods private if you don't have to.
If a developer feels he needs to adjust some functionality of your classes, he can pick from a number of structural and behavioral patterns to do so, e.g. Decorators, Adapters or by subclassing. Using these patterns is good, because it encapsulates the changes into the developer's own class and leaves your own code untouched. By declaring methods private, you make sure the developer will monkey with your class. And that is bad.
A perfect example is Zend Framework's DB adapter. They discourage the use of persistent connections and their adapters provide no mean to this end. But what if you'd want to have this nonetheless and the adapter method was marked private (it isn't, but what if)? Since there is no way to overwrite the method, you would (yes, you would) change the adapter code right within it's class or you'd copy & paste the code into your own adapter class, effectively duplicating 99% of the class just to change a single function call. Whenever there is an update to this adapter, you either would lose your changes or you wouldn't get it (in case you c&p'd). Had it been marked protected (as it is), you could just have written a pConnectAdapter subclass.
Moreover, when subclassing, you are effectively saying subClass is a parentClass. Thus, you can expect the derived class to have the same functionality as the parentClass. If there is functionality in the parentClass that should not be available in the subClass, then disabling it conceptually belongs to the subClass.
This is why I find it much better practise to default all methods and properties to protected visibility and only mark those methods (not properties though) supposed to allow interaction with my class from another class or script as public, but only a few things private. This way, I give the developer the choice of using my class as I intended it to be used and the option to tweak it. And if he breaks something in the process, it is very likely his fault then, not mine.
Update: since I wrote this four years ago I have come to the conclusion that defaulting things to protected instead of private often leads to suboptimal subclasses. This is because people will start to use whatever you provided as protected. This in turn means you have to consider all these methods as API and may not change them at will. As such, it's better to carefully consider what extensions points you want to provide and keep the everything else private. See http://fabien.potencier.org/article/47/pragmatism-over-theory-protected-vs-private for a similar view.
Comment: This is also pretty much what I think the longer I work in large PHP projects. More often than not I'm wishing a class had declared a certain method as `protected` instead of `private`, effectively forcing me to write a patch. As a programmer I do not expect classes that I subclass to work perfectly if I override a protected method without understanding what I'm doing. Instead, I read the code, understand what's being done and how, and override the method in question accordingly. I expect the same from people who work with my code. +1
Comment: Yes, I guess so. I am quite aware that there is a lot of people that prefer to use private as default and expose only what is needed when it is needed. But with future developers in mind, you just cannot anticipate what they will need. Feel free to do it differently though. There was a similar question a few months back that you might like to read too: http://stackoverflow.com/questions/419844/best-to-use-private-methods-or-protected-methods
Comment: "And for this reason, do not declare methods private if you don't have to." Well, I never *have* to -- I'm always *choosing* to. The class by itself would work just fine whether the method is `private` or `protected`. So the *have to* would come in only when I'm anticipating the needs of a future client programmer. Unless I want to ensure that some purely internal functionality of the parent class can never be broken by a client programmer -- is that what you're saying? Unless that's the case, go with `protected`?
Answer: I typically will start at the lowest level.  If you're unsure make it private.  Then as needed you can make things protected or public.
The idea being it is not a breaking change to go from private to protected but it could be a breaking change to go the other way.
Comment: This is agood thought, but what about encapsulation? If I'm writing a child class and I need to use a private method in parent, here I am mucking around with parent's code.
Comment: Right.  Alot depends on the specifics of your app.  You will be setting the rules as to what can/cannot be overriden or called from the child.  Some parts will be so core to the functionality you will need them to be private to protect future developers from accidentially overriding/calling them.  Others will be optional or configurable and should be exposed as protected or public where appropriate.
Answer: Don't think of the private/protected/public thing as if a programmer would ever "need" a method. Think of it as if you want to allow them access to it.
If you think they should be allowed to change the DB Connection String then make it public.
Comment: So should the default be protected, and private only when I'm really sure they should never have access?
Comment: If I'm forced to then I'll say go with "private" as default as per brendan's answer, however, I don't actually think there should be a "default" as such. You really need to think about what it is the method does. Then you decide what it should be.
Answer: I always make all methods private as default. This is to keep the interface clean and easy to maintain.
It is much harder to change or hide an already visible method than to make a private method more visible. At least if you need to be compatible with existing client code.
Answer:
In other words, how I can know in
  advance that a client programmer would
  never ever need to override a method?

If you don't know assume they will need to. If that's fine by you (ie, if you think they should be able to) then use protected; otherwise use private.
Comment: I don't agree. It's better to assume they will not need to override it. Keep it private until proven otherwise!
Comment: I guess my question is, how would I know? I feel like asking myself that is akin to divining the future. How could I know the needs of some future programmer? It seems like what you are telling me is to always use protected, since I haven't yet been in a situation where I *know* that a client programmer will never need to.
Comment: You can't "KNOW", you can only make an educated assumption based on your knowledge of the app and the developers who will use/consume it.
Comment: Do you have a requirement to expose certain functions outside your system?
Answer: Private members are used to encapsulate the inner workings of your class. Use them to hold data that only you want to be able to access. For example, let's say you have a field called _name and a getter/setter named GetName()/SetName(name). Maybe you want to do some syntax checking on name before you allow the SetName to succeed, else you throw an exception. By making _name private, you ensure that this syntax checking will occur before any changes to name can occur (unless you yourself change _name in your own class, in your own code). By making it protected, you're saying to any potential future inheritor of your class, "go ahead and monkey with my field."
In general, protected is used sparingly and only in specialized cases. For example, you might have a protected constructor that exposes some additional construction functionality to child classes.
Answer: I typically just make everything private and refactor when I need to call it from a base class.
Except when I feel lazy and do everything protected that isn't definitely dangerous.


How do I find the current Mission Control space number from the command line?

Question: Is there any way to determine the number of the currently active Mission Control space/desktop in Mac OS X Lion from the command line?
Comment: Just curious. Why do you need to know the number of the current Mission Control desktop?
Comment: I have a load of desktop wallpapers, some good, some bad. With the old Spaces I had an automator workflow tied to a button that would find the name of the current wallpaper and trash the file if I pressed the button. That way I could delete pictures I no longer liked. With Mission Control, the only way I can see of doing this is by first knowing the number of the space I am viewing. If you can come up with an alternative method of finding and trashing the picture currently being viewed, then I am all ears.
Comment: I will have to think about it. That's pretty complicated, and pretty cool too!
Comment: The names of the spaces wallpapers are in com.apple.desktop, but I have no idea how to work out which one is for which space other than grepping for the names in this file and looking at the images. As I run 6 spaces and have thousands of images, it would be nice to be able to trash one I don't like if it pops up on the current space I am using.
Comment: I guess I will have to get my workflow to ask me which space I am in. That's probably the easiest solution in the absence of a key-value property that is easy to interrogate.
Answer: I found this post on the main SO site.. Seems simple enough (er not really)..
Hope this helps.


What are the inverses of $1,3,7,9$ in the group $(G,*_{10})$?

Question: Consider $G =% $ {$1,3,7,9$}
The group is $(G,*_{10})$
I am told that the inverse of 1 is itself, which is understandable, as $1/1 = 1$, but I am told that the inverse of 3 is 7, the inverse of 7 is three and the inverse of 9 is itself.
Shouldn't it be, respectively, $3^{-1} , 7^{-1} , 9^{-1}$?
Answer: There is no "division operation" in a group, it only signifies $a/b$=$ab^{-1}$. So, you are right to say that $1/3$ is the inverse of 3, but a better notation would be $3^{-1}$. Now, to see that 3 and 7 are inverses in the group of units mod 10, we see that $3\cdot 7=21 \equiv 1\pmod{10}$ and 1 is the identity. We can do the same to find the inverse of 9.
Comment: So finding that the result of multiplication between two elements in agroup is 1 implies inversity between these two elements?
Comment: 9 * 9 = 81 (mod 10) = 1. I'm still not sure whether or not the fact that the result of the numbers is the identity of the given operator means that the numbers of each other's inverse?
Comment: That is correct- $9$ is its own inverse. Also, a notational issue- We note that $9 \cdot 9 \equiv 1 \pmod{10}$, not $81 \pmod{10} = 1$. The mathematical notation is different than what you may have seen in computer programming.
Comment: @Johny Yes. In a group $G$, the inverse $g^{-1}$ of an element $g$ is defined so that $gg^{-1} = 1 =g^{-1}g$; if you multiply two things and get the identity element of the group, those two things are the inverses of each other (by definition).
Answer: Let $(G, \cdot)$ be a group whose identity is $e$. By definition, for an element $a \in G$, any other $b \in G$ is called inverse of $a$ when $a \cdot b = b \cdot a = e$.
You can actually prove that the inverse of an element is unique. Assume that for $a \in G$ there exist two elements $b, c \in G$ such that both $a \cdot b = b \cdot a = e$ and $a \cdot c = c \cdot a = e$ hold. In particular you will have that $b = b \cdot e = b \cdot a \cdot c = e \cdot c = c$. Given this unicity, we can unambiguously represent the inverse of $a$ by $a^{-1}$.
You are right on saying that the inverse elements are $3^{-1}, 7^{-1}$ and $9^{-1}$, given that they satisfy the axiom above. Actually that is what you are looking for to be satisfied when trying to find the inverse of an element, nothing else. Writing $1/3$ is just a shorthand notation for $1 \cdot 3^{-1}$ in the rational (or real or complex) group; of course you can define it in any other group (like the one you have provided) but using it can be confusing.
Note that the definition of the inverse does not prevent the inverse of an element to be itself. In your example, $9$ is its own inverse not because $9/9 = 1$ (in the rational sense we are used to look at this) but because $9 \cdot 9 = 81 \equiv 1 \mod 10$.


Will my explorer's happiness level affect his quest?

Question: I accidentally sent my Explorer on a quest when his happiness level was 10%.
Now even after 22 hours he is still at the same level.
My doubt is whether I have spoiled his otherwise successful quest.
Pls clarify!
Comment: 50 is the maximum level. Aside from that, I have no idea if happiness has any effect on success in exploration.
Comment: I have no reason to think that the happiness has any effect. I certainly haven't noticed any difference, but I haven't scienced it either.
Answer: I actually did explore this recently, and short answer is no. Dweller happiness only affects your "Weekly reports". It has no effect on production, a dwellers SPECIAL, or wasteland expeditions. (This was part of my experiments to find what increases dweller happiness).
I tested this by choosing one of my most successful explorers,  and placing him in a room full of corpses (his happiness plummeted from 100 to about 15 in a minute flat) then stuck him out in the wasteland. He was out there for his usual time (~1 day) and still came back with some good loot - it was actually the first time anyone returned with any Legendary items (got a Legendary recipe).
Needless to say I pampered that poor SOB as soon as he stepped inside the Vault.


django-tenants basics: SHARED_APPS vs TENANT_APPS

Question: I am using django-tenants for a multi-tenant app.
In the docs it talks about setting up SHARED_APPS and TENANT_APPS.

SHARED_APPS is a tuple of strings just like INSTALLED_APPS and should
contain all apps that you want to be synced to public

If I want an app (e.g. django.contrib.auth) to be accessible on both the public schema and shared schema, do I include it only in the SHARED_APPS or do I need to include it in both SHARED_APPS and TENANT_APPS?
"SHARED" would imply that everything in this list is accessible via all tenants and the public schema, but the docs seem to imply otherwise?
Answer: I am the maintainer of Django Tenants.
If you want the same user to be able to access in both shared and tenant you would put it in just SHARED_APPS. However this would mean that the same user would be able to get in to multiple tenants I expect you don't want that unless you write a permission table. This would also mean your users are not tenanted.
If you want different users you can put it both the SHARED_APPS and the TENANT_APPS. Django Tenant always queries local schema/tenant first and if that table doesn't exist it goes to the public schema. This is the way I do it with my project. Beware you need to make sure django.contrib.sessions in both SHARED & TENANT apps otherwise you will get a security problem swapping from one tenant to another.
The other think to look at is django-tenant-users
Answer: When using django-tenants, your database will contain a public schema (ie. directory), and a schema for each tenant, say tenant1, tenant2, ..
The data of models belonging to a SHARED_APPS will end up in the public folder, and will be accessible by all other tenants (schema's). Hence, it is sufficient to only include int once in the SHARED_APPS


Adjusting HVAC damper

Question: First summer in this 2 story house and looks like air flow on the second floor is significantly weaker then on the bottom floor. Looked at the HVAC to find the dampener handle and found 1 but it is screwed in place. Not sure if this is the duct going to the second floor or first.... Is it done to prevent the dampener from being manipulated for some reasons or its ok to just unscrew it and play with the level of open/close?
Comment: It's done to prevent the damper from moving due to air flow across it. Old school dampers had a spring to keep tension on them, to prevent them from moving. The newer lightweight duct you have would just squish if a spring of sufficient strength was pushing on it. Unscrew it and move it if you want, if you leave it in a different position you could just duct tape it there, in case it is the wrong duct...
Answer: Welcome to the wide, wide world of second story air conditioning.
If this was done to prevent it from being manipulated they wouldn't have installed it. This was done just to prevent the damper from closing due to air flow. Find out where this duct feeds and if it's to the first floor try closing it a bit to divert more air to the second floor. If this does feed the second floor, you might want to add a duct fan to increase the air flow. They can be controlled manually by a switch or hooked up to your air handler. Good luck.
Answer: When I set up a 2 story I usually install 2 dampers 1 for upstairs and 1 for down. I lock them in place with the flow balanced but I usually set up a summer / winter positions. In the summer I set ~60% to the upper floor and 40% downstairs. For winter I set 60% down and 40% upstairs. You don't want to make a change much larger than that or you could split your ductwork inside a wall or have it blow off a register if flex duct. I have seen both and repairing a split trunk can be a pain in the back side especially if it is inside a wall. When I set the flows I use a anemometer and measure the flow. I mark each damper with 60 & 40 positions they should not need adjusting outside of this range and it is normal to shoot a screw in the handle if there is not a lock (many times a butterfly nut or wing nut) so you should have 2 dampers for best results if not you may have limited ability to adjust the balance and will need to open or close the individual registers in each room to get the same affect.

Adjusting HVAC damper


How to type IPA quickly on Mac?

Question: I want shortcuts (pre-existing or customised) for IPA symbols.
I've installed IPA Unicode keyboard, which works fine on notes/ google docs but not on pages. I don't have ms word.
Keyman does not come with a list of shortcuts I can refer to and learn.
I don't want to have to Fn+E and look up the symbols menu to manually pick each symbol.
(For reference, I'm using MacOS Monterey 12.6.9)
Comment: IPA Unicode seems to work fine for me in Pages 13.1 in Monterey.  What exactly does not work for you?
Comment: A list of shortcuts for Keyman can be found at https://help.keyman.com/keyboard/sil_ipa/1.8.6/sil_ipa
Comment: @TomGewecke pages 13.1 refuses to switch to IPA unicode as input source. It makes the switch to every other keyboard just fine.
Comment: Try reinstalling Pages and iPA Unicode.  It works fine for me, and an input source like that should work in any apple app.
Comment: I'm voting to close this question because this site is not about computer programs.
Answer: Is pasting text from an IPA keyboard webpage acceptable? There is a popular IPA keyboard here: https://ipa.typeit.org/full/
The website allows you to type in IPA fairly quickly through keyboard shortcuts and copy it to the clipboard.
[fɹ̈ ɘgˈzɛə̯̃mpɫ̩ | ˈhi̠ɹ̈ ɘz ə nɛ̝ɹ̈o̜ʊ̯ tʃɹ̥̈ɛə̯̃nˈskɹ̈ɪ̞pʃn̩ ɐɪ̯ ˈme̞ɪ̯d̪ ˌðɛ̝ɹ̈]
Comment: "I don't want to have to Fn+E and look up the symbols menu to manually pick each symbol"

How to type IPA quickly on Mac?