How to create a landing home page?

Question: I want to create a landing page which is to give some information to the customers saying this website is in working progress please visit our sister company websites, so the customer can only visit our sister companies. Thanks
Answer: This can easily be done

Create a file name maintenance.flag in your magento root directory. Contents under this file doesn't matter, you can keep it empty.
Change the maintenance file (located in magento root -> errors -> default directory) to show proper message when user visits your website.

If you with your ip still want to access the page then do this
Step 1: In order to have access, we need to modify index.php file in Magento root folder and specify list of IPs that will allowed to access your site. Download and open original index.php file.
On line 47 put the following code:
$ip = $_SERVER['REMOTE_ADDR'];
$allowed = array('220.127.116.11','220.127.116.11');

In the $allowed = array('220.127.116.11′,'22.214.171.124′);  you should specify list of IPs that will have access to your site.
Step 2: Search for the following code:
if (file_exists($maintenanceFile)) {

Replace it with
if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {

In order to edit content showing on maintenance page, open errors/default/503.phtml file, find the maintenance message and edit as you wish.
Source: Here
Comment: Pradeep maybe flag it as the right answer then. Thank you
Answer: Simply put maintenance.flag in root folder and edit the content to show your child sites. Simple as it is.

How to create a landing home page?


How to develop patience?

Question: I want to know how can I develop patience?
What Buddha said on this?
And also what is the reason of being impatient?
Comment: You can develop patience by putting your whole attention on impatience(sensations in body, restlesness in mind) and choosing not to act on it.
Answer: In my understanding, it comes back to a central Buddhist concept of "attachment".
We feel frustrated or angry, we get emotional about things, when we have a strong attachment or prejudice about how things are supposed to be.
These prejudices or preconceptions come from some strong experiences we have in childhood, or from some books we trust, people we highly respect etc. They also come from pain, when we did something and got in trouble. In most of these cases we have some basic formula in our head "this is bad" or "this is good" (why - because blah blah blah). And we are so convinced that this is correct, that we feel like we will never change our opinion in the entire life.
So when we see something or someone doing something that goes against this preconception or attachment, then we feel like they go against Truth (or the way we see it anyway). This makes us frustrated or angry or upset etc.
There are multiple ways to develop patience in Buddhism. On the basic level, we just try to calm down. We tell ourselves how bad it would be if we lose control and start yelling etc. But in my experience this does not work as soon as situation gets serious. We just forget everything and jump right back into emotion.
The next method is to be mindful of one's emotions on the body level. This way we can notice ourselves getting nervous far before it gets out of control. So if we develop feeling of presence of body, and always feel all tensions etc., we get this convenient weather indicator that can show a storm coming 5 days in advance (really maybe 5 minutes, but still good). It is much easier to fix e.g. a conversation that goes towards a scandal 5 minutes before it gets out of control, when things are still calm, but you feel it coming.
And then the most powerful method is to see the attachments or preconceptions that give rise to emotion - and learn to let them go. This is the most difficult, because it means you have to learn to see situation from another perspective, and to not assume that you are 100% right. This can be very difficult in the beginning. But at the end this ability makes you practically immune to all disturbances, 100% patient at all times. It is a very helpful feature to have in life.
My teacher said, enlightened person is like a lawyer. He or she sees every situation from all sides at the same time. This helps him to never lose patience and to make better decisions than anyone. The point is, Buddhist patience is not self-restraint and self-torture, it is freedom from single point of view, freedom from attachments.
P.S.
Same exact logic applies to impatience towards desirable objects. Attachment, preconception etc. - except in this case it's a preconception that the object is "good", usually based on some overgeneralization or idealisation. So the method Buddha prescribed for that is to analyze the object and see that it has negative sides and not only positive. This helps to let go of attachment and come back to patience and balance. All the same advice about being mindful of your body to sense the attachment getting out of control, applies here as well. In Buddhism desire and aversion are considered things of the same nature, one is positive and the other is negative but the principle is the same.
Answer: Patience is a very important character trait that one need to develop if you wish to walk this path. To develop this quality of 'Kanthi'(Patience), it needs to be developed together with the other qualities of adhittana (unwavering determination), ariya metta (loving kindness to all irrespective of all odds), nekkhamma (renunciation), and upekkha (equanimity).
Our inherent nature as humans is one of haste. Haste is a common characteristic inherent in most people when dealing with day to day affairs. People tend to accomplish most affairs with undue haste whether these particular affairs need or do not need urgent attention for completion.  It is evident most of the time that people are not in a composed, relaxed mental frame to accomplish most of these tasks with patience. Even their day to day physical activities such as talking, eating, walking is also done with undue haste. This undue haste is an inborn characteristic of human beings.
A story from the Buddha's time on haste would shed light on our present day busy, hectic lifestyles. According to this story, Bikkhuni Uttara, aged 120 years, was on her alms rounds one day when she noticed the Buddha, who was also on the alms rounds with the other monks, coming towards her direction. Bikkhuni Uttara, out of respect for the Buddha, stepped aside hurriedly to make way for the Buddha. While stepping aside hurriedly, she stepped on her robe by accident and fell on the ground. The Buddha who saw this incident came to her and treated her with the assistance of others and expounded a discourse, emphasising the importance of acting without undue haste in life. At the end of this discourse, Bhikkuni Uttara attained the fruit of stream entry (sotapanna).
Answer: Good householder, coming after the original questioner (hopefully not inpatient that leaded to abounding account),

Patient endurance:
the foremost austerity.
— Dhp 184

patient (kanti) is sayed to be the sibling of metta. So best treated like metta in action.
Ingratitude and wrong view are the main reasons of inpatient:

"And how is one made impure in three ways by mental action? There is the case where a certain person is covetous. He covets the belongings of others, thinking, 'O, that what belongs to others would be mine!' He bears ill will, corrupt in the resolves of his heart: 'May these beings be killed or cut apart or crushed or destroyed, or may they not exist at all!' He has wrong view, is warped in the way he sees things: 'There is nothing given, nothing offered, nothing sacrificed. There is no fruit or result of good or bad actions. There is no this world, no next world, no mother, no father, no spontaneously reborn beings; no brahmans or contemplatives who, faring rightly & practicing rightly, proclaim this world & the next after having directly known & realized it for themselves.' This is how one is made impure in three ways by mental action. Cunda Kammaraputta Sutta.

So straighten right view is most importand to overcome signs of aversion and ill-will, and it has to start by oneself, within: with ones reaction, feeling, bad states of mind.
Best way is always to ask oneself on a call by ones thought-committee: "Sure? Let's wait first and see if real and lasting."
An extended collection on training how to overcome ill-will can be found here: 2. Ill-will
And this are the things from outward which should be learned to endure:

"[4] And what are the fermentations to be abandoned by tolerating? There is the case where a monk, reflecting appropriately, endures. He tolerates cold, heat, hunger, & thirst; the touch of flies, mosquitoes, wind, sun, & reptiles; ill-spoken, unwelcome words & bodily feelings that, when they arise, are painful, racking, sharp, piercing, disagreeable, displeasing, & menacing to life. The fermentations, vexation, or fever that would arise if he were not to tolerate these things do not arise for him when he tolerates them. These are called the fermentations to be abandoned by tolerating. MN 2

Since patient is also a importand criteria for being prepared to receive teaching right, my person will end here for now.
A collection of Suttas on the parami (perfection) of Kanti here: Endurance, in the study guide on the Ten Perfections.
[Note that this isn't given for stacks, exchange, other world-binding trades but for escape from this round bound]
Answer: Since you are not a monk, I am giving you a solution from householders point of view.Commit to yourself that whatever you will do you will do it slowly. You will not rush to be successful. You will not rush to eat. You will not rush to prove your point.
That is one way..
Another way is to sit and meditate. Meditate as long as possible. Meditate on short breath.Meditate on long breath. Just sit and do nothing. Patience automatically develops when you realize there is nothing worth being impatient for...
Buddha says this is suffering. Whatever you crave for is the origin of suffering. If you are serious follow the 8 fold path for the cessation of suffering. 8 fold path will automatically develop patience in you.
Finally , why does impatience arise ? The answer is simple. It is due to greed or aversion to something. Get rid of greed and aversion ... impatience will fade away.
Answer: What Buddha said on this?
From the Diamond Sutra:

I also remember Subhuti that during my five hundred previous lives I
had used life after life to practice patience and to look upon my life
humbly, as though I were a saint called upon to suffer humility.

How to develop patience?


Communicating between classes

Question: I have a form that is divided into two classes.  Each class represents the widgets on part of the form.  What is the best way to allow these classes to share data between each other and update each other.
Example:
Button in class A is clicked.  Update text field in class C
Answer: This is very short what you can do:
public class ButtonFrame extends JFrame implements ActionListener
{
     private TextFieldFrame frame;

     public ButtonFrame(TextFieldFrame frame)
     {
         this.frame = frame;
         // init your components and add this as actionlistener to the button
         ....
     }

     public void actionPerformed(ActionEvent evt)
     {
         frame.notifyButtonPressed();
     }
}

The other class:
public class TextFieldFrame extends JFrame
{
     private JTextField field = ...; // init in your constructor

     public void notifyButtonPressed()
     {
         field.setText("Yes man!! The button is pressed by the user!");
     }
}

Again, this is very short what you have to do.
You can also work with a Singleton pattern, but this is a better way.
Answer: You could create a class that holds all your form-objects. The form classes all know the parent class and communicate over it.
If a button is clicked in class A, class A calls a method in the parent class and the parent class notifies class C to update its text field.
Answer: Don't think widget. Design your application on models. Have widgets as windows onto those models. (And don't extend classes unnecessarily.)
Answer: Have a look at Mediator pattern, it could give you some ideas.
Also, JFace Databinding framework goal is synchronization of values between objects, although i find it poorly documented and not much fun to use. JFace_Data_Binding

Communicating between classes


The importance of Decibels

Question: I have a question , why decibels are useful for electrical engineers ?? I still can't figure out why it is useful to use decibels in expressing power ratios , gain and other things ?
Comment: It nit because they don't know about Napers which is the units of log exponents, discovered centuries ago, it's because a lot of natural physics including attenuation spans so many decades that it appears linear on a log-log scale.
Comment: It isn't more "useful" than percentages, or ratios, or fractions. It's just more practical in a lot of cases, mainly because the scale is logarithmic, unlike the other alternatives I gave.
Comment: The sun provides about +250 dBm of power. Yet Boltzmann, using measurements of the thermal energy of molecules, found the thermal noise floor, at one vibration per second, to be about -174dBm. In between those two power levels, life is exciting.
Answer: Because gain in linear systems, as a function of frequency, tends to vary asymptotically on a log-log scale, and that helps greatly with visualisation.
Answer: Just as an example,take the case of human hearing.  The range of levels that the ear can perceive range when expressed in dB range from 0 (threshold of hearing sensitivity) to about 150 (close to a jet engine at full throttle).  To express either of these numbers in decimal format would require many zeroes and be difficult to interpret. Another example is trying to determine an overall gain (or attenuation) for many individual stages. With dB, it is only necessary to add the dB value of each stage. Without dBs, you have to multiply many numbers with varying amounts of zeroes.  It is much more difficult and prone to errors. Many other examples exist but I hope you get the idea.

The importance of Decibels


Case Assignment Rules running Multiple Times - Negative Impact

Question: I have a bit of an odd question. Is there a negative impact running assignment rules on a Case object on every insert/update? We have a use case where we need to run when the user uses inline edit, but only with certain criteria, but I'm wondering if that's necessary to use a trigger to only run the rules when it meets criteria or just run the rules every time. It would be difficult to maintain over time in a trigger.
Answer: There's some "wall clock" time involved, but running assignment rules does not materially affect any of the governor limits (e.g. SOQL queries, CPU time, etc), and likely won't cause any significant impact. This suggestion doesn't immediately raise any red flags, except I'd possibly be concerned that the case might be "accidentally" transferred when it shouldn't have been (but this is more dependent on sharing rules, etc).
Comment: Thanks. Looking at the Salesforce docs, they specifically say anything about performance as well and they do have an option to set the assignment checkbox to checked by default at the layout level.


Integrating factors, a missing solution

Question: I want to solve the differential equation $(3xy+y^2)+(x^2+xy)y'=0$. If I use the integrating factor $\mu (x)=x$ so that the original differential equation becomes exact, then the general solution that I get does include the the particular solution $y=-2x$. But if I use the integrating factor $\mu (x)=\frac{1}{xy(2x+y)}$ (so that the original differential equation becomes exact), then the general solution that I get does not include the particular solution $y=-2x$. Why? What should I do so that an integrating factor that I choose will give me the general solution that includes all particular solutions of a differential equation that I want to solve?
Answer: What I get with your second integrating factor is a general (implicit) solution expressed as
$$ \ln(x) + \dfrac{1}{2} \ln(2x+y) + \dfrac{1}{2} \ln(y) = c $$
The particular solution $y = -2x$ is not really "missing": it is a limiting case as $c \to -\infty$.  If you multiply by $2$ and take exponential of both sides, it becomes
$$ x^2 y (2x+y) = e^{2c} $$
which with $e^{2c}$ renamed is the same general solution as I get with the first integrating factor.
I don't think there's any way to avoid all cases where particular solutions occur only as limiting cases of the general solution.
Comment: Can we declare that both of the integrating factors lead to the same set of solutions?

Integrating factors, a missing solution


Is such an orbit possible that allows a satellite on Earth and another on Mars to always be in direct line-of-sight?

Question: If not always, how much "most of the time" could it get?
Or would a multi-satellites setup be more suited?
Comment: No; the Sun will inevitably get in the way :)
Answer: Yes, but the satellite(s) would be orbiting the sun instead of the earth. You place a satellite at either L4 or L5 Langrangian points on the Earth-Sun two-body system--these are points 60 degrees to either side of earth on her orbital plane around the sun where you can place a satellite. Throughout earth's entire orbit the satellite will maintain that 60 degree separation, even under the influence of earth's gravity. It does this by moving slightly faster than earth (tangential velocity) at a slightly larger orbit than earth, allowing the angular velocity to be equal to earth.
With the satellite in L4 or L5, mars will always be in line of sight to either earth or that satellite. You can add more satellites such as geostationary ones on both planets to allow to specific points on those planets to have line of sight 100% of the time.
Answer: The best way to minimise loss of sight would be to have the satellites orbiting at a very high altitude, e.g. beyond the distance of the moon. It would then be very rare for the satellites to be eclipsed by the planets, or moon. Such eclipses could also be easily avoided with a small orbit correction or by synchronizing the orbit in such a way that potential eclipses never happen
The only case where you would be caught out would be when Mars passed behind the Sun as seen from Earth but such events are very rare. If the orbits were higher than the radius of the Sun (700 Mm) it would be possible to avoid even the Sun occultations with careful planning and some orbit adjustment.
If the satellites have to be nearer their planets you could keep them orbiting around the axis joining the planets so they are always in sight, but more fuel would be required to keep them in those orbits as the planets move.


How to tilt the edges to a particular angle

Question:
Hi, can anybody help me to fulfill my requirement.
I want to move the arms a bit down if you see the man sculpture then it seems that angle of arms with body's side portion is somewhat 90deg but I want to the arms a bit down so that they make angle around 60deg. I tried the Rotation but it is rotating the complete arms.
Answer: I did it by using rotation so I rotated the arms along Y-axis then it looked weird as the arms were rotated as so far from the body, then I used the provided axes to set the position of arms back to the position relative to body.
Now it looks correct as I wanted:


Why two type result for my python script?

Question: i have script like this
 import mechanize
 url = "http://www.globalhide.com/browse.php?u=u=http://www.whoisxmlapi.com/whoisserver/WhoisService?domainName=google.com"
 br = mechanize.Browser()
 br.set_handle_robots(False)
 br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:220.127.116.11) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]
 response = br.open(url)
 content = response.read()
 f = open('q.html', 'w')
 f.write(content)
 f.close()

i need the result like this
 when i run this from python shell ,the result correct. but when i save this in a something.py file and run like this python something.py the content of q.html
What wrong with my code?
Comment: You are trying to do something that globalhide doesn't want you to do. Can I suggest that you stop doing it? ;-)
Answer: I don't think there's anything wrong with your code as such. Changing the requested url results in good data returned.
The block is being implemented by globalhide.com themselves. The link you added in your question gives the same page as you've attached (more or less). I can't tell you exactly how this hotlink blocking is implemented, but it could be through the referrer heading. Looking into referrer spoofing may help you here.
Edit
Jumped the gun a little bit there wrt referrer spoofing. I'd go with Aaron's cookie suggestion.
Answer: For that URL, I sometimes get the XML, and sometimes get the "no hotlinking" page in Chrome Linux. The first hit returns the no-hotlinking page for the same url. If I clear my cookies and visit that page again, I get the no-hotlinking image.
It appears that a Cookie is required for this site. The following should work with your code.
policy = mechanize.DefaultCookiePolicy(rfc2965=True)
cj = mechanize.LWPCookieJar(policy=policy)
br.set_cookiejar(cj)

For more information on the different methods to implement cookies, check out Mechanize Docs - Cookies.
Edit 1 You should save the cookie jar, see Cookielib - Save.
Edit 2 here's the cookie information that site set for me:
Name:   __utma
Content:    53296278.1653562620.1363413018.1311413018.1337443014.1
Domain: .globalhide.com
Path:   /
Send for:   Any kind of connection
Accessible to script:   Yes
Created:    Wednesday, May 1, 2013 6:56:58 AM
Expires:    Friday, May 1, 2015 6:56:58 AM
Name:   s
Content:    x2tjlhb1qfidn5t1ds8kvd24p5
Domain: www.globalhide.com
Path:   /
Send for:   Any kind of connection
Accessible to script:   Yes
Created:    Wednesday, May 1, 2013 6:56:57 AM
Expires:    When the browsing session ends

Comment: Are you saving the cookie? I do not have experience with Mechanize personally, but this save-cookie method worked for me: [How To Save Mechanize Browser Cookies To File](http://stackoverflow.com/questions/7510806/how-to-save-mechanize-browser-cookies-to-file)


Can I resize the backlog item description panel in TFS web view?

Question: In the product backlog item view in TFS, the "description" panel is tiny relative to the size of my screen, and annoyingly there's lots of unused space at the bottom of the page. Since the description is the important part, I'd like to see more than a few lines of it at a time. Is there a way to resize this panel, or better yet to show the description on its own, full screen and without all the other clutter?
Comment: How many lines can you see? What browser do you use?
Comment: I can see 13 lines of text, but the main point is that the description box occupies roughly 15% of the page. Annoyingly, there's as much unused space at the bottom of the page as there is in the description box!
Answer: I'm using TFS 2013 and unfortunately it looks like there's no way to resize the description panel, its size seems to be fixed and part of the overlay backlog item window.
Each panel (Description, Business Context, Originated By, etc.) has its own link, e.g. $/<team_project>/_backlogs#witc_tab_417, $/<team_project>/_backlogs#witc_tab_422, $/<team_project>/_backlogs#witc_tab_428, but trying to open one of those links in a new tab causes the whole backlog item view to be displayed again.
As a workaround, the only thing that I'd suggest to do if you have a long description is to temporarily copy it entirely (CTRL+A, CTRL+C) and paste it (CTRL+V) into an external editor (e.g. Notepad++) and then read it from there.


jquery version Issue

Question: I was working with jquery v1.3.2 and following piece of code was all working nice
$(".textid").live('click',function(){
  textbox_input=true;
 });
But as soon as I updated to jquery v1.4.2 above piece of code just not working as expected!!.
Just to test script identified the click event correctly I added following
<code>$(".textid").click(function(){
    alert('you clicked me');
});
</code>
and message pop up saying "Load Jquery First"  {this come sometime}
I checked my include list and jquery is the first include.....
Can someone guide me to resolve this issue.
Regards,
Priti
Comment: Does "not working as expected" mean not working at all? What does your javascript debugger (e.g. Firebug) say is happening?
Answer: either some other code fails
or
your link to 1.4.2 is broken.

jquery version Issue


Import Inkscape text to Scribus

Question: When I import an Inkscape file into Scribus the text is always vectorized. Is there a way to import editable text into Scribus from Inkscape?
Comment: What is your current workflow and what format are you using for the import?
Comment: I'm primarily designing in Inkscape and using Scribus for CMYK color editing. I've tried several formats for import - SVG, PDF, EPS.
Comment: did the answer I gave work for you?
Answer: Given the choice I'd never lay out body text in an Inkscape file destined for output via Scribus as Scribus handles this sort of text so much better.
That said, if you've inherited the files or there's some other compelling reason behind your question then using pdf as the intermediate file might work.
In Inkscape's Save As pdf dialogue there's a "Convert text to paths" check box which should be left unselected and Scribus should happily open the resultant pdf with editable text.
Along the way you may have issues with fonts but it'll work by and large.
If you've got the choice though I'd recommend letting Scribus handle the text and leaving Inkscape to provide your vector components in svg format.
Comment: Hi Matt, experiencing the same issue, I just came across your answer. Though I'll take your advice to heart to use Scribus for text, I can't seem to import editable text from Inkscape into Scribus. I tried various formats, all from ps, eps, pdf, and plain svg, and where applicable not selecting the "convert text to paths" checkbox. But Scribus still keeps converting the text to paths.
Comment: @vic Same computer running both apps? Did you draw the Inkscape text boxes as rectangles or simply click and type? If you're transforming the text it might never work as expected. If you're using a "fancy" font try a version with a standard (arial etc.) font. Hth
Comment: Actually, I didn't create the text in Inkscape at all. I imported an ai-file from Illustrator, improved it a bit and then wanted to open it in Scribus in order to prepare for print. And yes, the fonts are "fancy" but they are installed on the system. I'll try as you suggested.
Comment: Would you please change ""might"" to "*might*". I'm pretty sure you're not quoting anyone or anything.

Import Inkscape text to Scribus


Group points and compute area

Question: In a point vector layer, how to compute area for 4 defined ranges of values of one attribute?
On the example below, I want the total area for each of the 4 colours.
Comment: Point does not have area
Comment: I suppose so, how about converting to polygons and then computing the area?
Answer: If the points are regular points having the same distance between each point, you can convert the points to raster instead of polygons. But you need to select the proper cell size, simply by measuring the distance among the points. Then you can Go Raster -> Conversion -> Rasterize. Set a vector layer to process, a field with values and desired raster size.
After converting the points to raster layer go Reclassify grid values located under SAGA and do the following:
1) Choose the raster layer created earlier as input file.
2) In the method, choose simple table.

3) Then go down and click on lookup table and click on browse (...)
4) You will see a new window as shown below

(1) Add a row to get 4 rows
(2) Change the old min and old max values with the new values
5) Save the reclassified grid as a new output.

Use the Vectorize raster layer under GDAL/OGR in processing toolbar to covert the reclassified raster layer to polygon vector layer, as shown below:

Finally edit the vector layer to add new field (Area Field) and compute the area using $area.
The process might be long process, but since the original input data is points, this is one method on how you can convert them to polygons.
Answer: I would enclose the area in the above picture. In other words make a single polygon surrounding the points. Determine the area of the polygon.
Then get a total point count within the area (all colors combined)
I would then get a point count for each of the separate colors within that area.
Find the percentages of each of the colors from the total point count, and that would be the percentage of the total area.
It is quick, and dirty, and may not be accurate enough for what you desire, but it would be good for gross error checking.
So in simple terms
The polygon is 100,000 sq ft in area.
There are 10000 points total in the enclosed area.
4500 of those points are dark green = 45 percent of the total area = 45,000 sq ft
3000 of those points are light green = 35 percent of the total area = 30,000 sq ft
1500 of those points are yellow = 15 percent of the total area = 15,000 sq ft
1000 of those points are red = 10 percent of the total area = 10,000 sq ft.
Comment: You are welcome!
As I said above, it may not produce the most accurate of results, but it will give you a very good rough idea.

Group points and compute area


Vertical float switch for tethered float sump pump?

Question: I have a sump pump in my basement that has a tethered float switch.  The sump is not deep enough for the switch to turn on so I have to go down there and turn it on manually every time it rains hard.  If I put a vertical float switch with a piggyback plug/switch will it turn on the sump pump?
Answer: Try this fix, shorten the tether so the float will turn on/off quicker, or replace the pump with a one that has a vertical mounted float switch. I got rid of my tethered float switch pumps for ones with the vertical switch. They work great with just a short rise in water level.
Answer: Sure, if you secure the original float in the 'on' position and it doesn't experience corrosion due to its newly stationary duty. I'd be concerned about having a second possible point of failure in a system protecting so much value.


When a country is merged into another country, what happens to the people who were holding public office?

Question: If country A were to be absorbed into country B, do elected officials in country A generally receive some position in country B? For instance, if Moldova and Romania unite, will Maia Sandu and her cabinet be offered jobs in the Romanian national/regional government(s)?
Comment: I'm not sure there exists a general answer. It depends on the political systems of the merged countries (are public officials elected? Are there regional governments?), the circumstances of the merger (was one country conquered?) and probably a lot more factors. Perhaps it would be better to ask after a specific unification (Germany, Serbia and Montenegro, Yemen, ...) or after existing proposals for Moldovan/Romanian unification.
Comment: I agree with @xyldke.  Country mergers are so comparatively rare and each is so situation-specific that it's going to be impossible to generalize.
Comment: The question does not have any prospective answer to new mergers that is not pure speculation. The two answers given answer how this has been done in specific cases in the past and the question could be edited to pose a valid question along those lines.
Comment: Case specific I guess, sometimes the whole office gets removed from power and external set of people is placed, sometimes the office retains their positions.
Comment: FWTW, Russia seems to have retained the nominal leadership of two of the [self-declared] Republics it recently annexed. But changed some of their immediate underlings. The situation with Romania would probably more complicated to solve like that because it doesn't have administrative regions as large as Moldova, from a quick search.
Answer: As the comments said, there is no general answer.
The case I am most familiar with is German reunification. There, the unification treaty specified in article 42 that the East German parliament would elect 144 representatives into the existing West German parliament. That was not relevant for very long; unification happened in early October and about two months later, in early December, a regular election was held anyway.
As for the executive branch, five former East German officeholders became "ministers for special affairs" in reunified Germany. That doesn't seem to have been the result of any kind of agreement; in Germany, the Federal Chancellor is free to appoint any eligible citizen as a minister for anything at all.
Answer: To look at historical examples, one of the more famous examples of this occurred in 1706 Treaty of Union, which United the countries of England and Scotland under a singular parliament leading to the formation of the new Nation of Great Britain, which was the successor state to both of the involved nations.   In this case, the cause for this was do to the monarchy system of the two countries and the 1603 death of Queen Elizabeth I of England, which ended the Tudor dynasty of died childless and the last of her line.  Succession fell to her cousin, King James VI of Scotland (now known as James VI and I).  As King of two nations, James and his successors advocated for a single parliament for the two nations, which had to over come several hurdles and was defeated multiple times prior to the Treaty of Union.
The text of this document handles the full merging of the two nations.
Another common solution to the issue is the formation of a Federation government when two or more sovereign nations wish to unite.  In a Federation, the "state" governments will vote to join the larger federal union by surrendering certain powers to the federal government while retaining a degree of sovereignty to make their own laws (what governing powers are surrendered generally depend on what the Federal Nation states they have the right to do.  Typically, Federal Nations will always control the foreign negotiation for all states collectively, but beyond that it's based on laws of a specific nation.).  The United States is one of the most famous Federal Nations and it's laws on what the Federal Government and State government can do are derived from the Constitution, with Articles I and IV as well as amendments IX X and XIV being the most relevant.   Other Federal Nations include Mexico, Canada, Australia, Germany, Switzerland (Formally a Confederacy, which is an artifact title from when Confederacy described a federation.  The Modern Definition describes something else), Brazil, Russia, India, Pakistan are among some of the most prominent of the 27 nations classified as a Federation.   Some interesting Federations design is that of Bosnia and Herzegovina, which is the world's only double Federation (Formed by the union of the Federation of Bosnia and Herzegovina which contained 10 Cantons and the Republika Srpska which is a unitary state.   If it helps, Republika Srpska is not part of the "Federation of Bosnia and Herzegovina" but is part of the nation of "Bosnia and Herzegovina" as is the "Federation of Bosnia and Herzegovina".) and The Federation of Malaysia is the world's only Federal Monarchy (While Canada and Australia are Constitutional Monarchies, each Province and State respectively have the same Monarch, the King of the United Kingdom.  Malasia's member states each have their own separate royal family).   Other common features of Federations are that their national capital cities are frequently planned cities for the sole purpose of being a Capital City and are often part of a Special Administrative District, so the Capital City has no disproportionate ties to any one member-state, though this is not universal.   Washington D.C. (U.S.), Canberra (Australia), and Brasília, (Brazil) are examples of this trend.
As briefly discussed, Confederacies are looser for of a Federation, in this case, the member states have to ratify the centralized governments laws before the national law can take effect in that member state... in addition to making their own laws.  If this seems insanely frustrating, most of the world agrees and true confederacies have a nasty habit of falling apart quickly as dissenting member state governments.  Again, the rules are not universal, but the general difference between confederacies and federations is that confederacies typically will have a way for the member-state to leave the union (to the degree that it's codified law) while federations do not (generally it's uncodified if it exists at all.  In the case of the United States, there was a civil war over the matter.).  This has the nasty habit of seeing Confederacies be wildly ineffective at running a nation (See the United States under the Articles of Confederation.  The Constitution was written primarily to fix everything that was broken with the Articles.  In the case of the Confederate States of America, several member states were considering seceding from the CSA as it was becoming increasingly clear that the CSA would not win the U.S. Civil war.).  Most confederacies that are stable tend to take the form of regional diplomatic organizations (The European Union) though they mostly get called Confederacies by their critics or as an ad hoc union of member-states that are looking to form closer ties that will devolve into a federation (Again, post-independence U.S. prior to the Constitution.).


In Azure Devops and TFS, is it possible to create a build artifact and release definition in a different collection than the original code repository?

Question: I have code repo held in Collection 1 and, using this code repo, I am trying to create a Build artifact and Release definition in a different Collection 2.
Is this even possible?
Answer: Since on-premise TFS and the newly renamed Azure DevOps Server 2019 still have the concept of collections, which is the highest level of separation of data you can have (separate physical databases), you'd need to treat a code repo in Collection 1 as an external repository rather than try to discover it as a known internal repository.
You can do this in the Build pipeline of a build in Collection 2 by selecting External Git (if your repo is Git, TFVC is not supported), then clicking Add Connection and entering the Git repository URL and login credentials like in the screenshot below.  Once connected, your pipeline, if it produces artifacts, will store them in Collection 2, which can be used for a Release pipeline.
Answer: In Azure DevOps there is no Collection - there is a project and there are organizations which hold zero or more projects. There is also a distinction between the code repositories and the builds and between the builds and the release mechanism.
Within a build pipeline it is entirely possible to reference a different projects repository to pull into the build and that repository could be in GitHub, Gitlab, or another VSTS organization, and within a release it is entirely possible to include build artifacts from multiple build pipelines.
TFS on-premises depends highly on how up-to-date it has been kept. The most recent versions are feature equal or close to it with Azure DevOps and the above should be true. Milage may vary in older versions.
It isn't clear here in your question though what you are trying to achieve or what you've tried so far.


How do you identify a RAW or JPEG image within Lightroom 3?

Question: I usually shoot RAW photos.
Once in a while I will switch back to JPEG.
Is there a way to identify which photos are RAW in Lightroom library and such?
Answer: There are many ways to do this:

Hover over the image in the Library module and you'll see some information about the image, including the filename.
In the right-hand sidebar of the Library module look in the Metadata section and find the File Name field.
Use the Expanded grid view style in the Library module (View > Grid View Style > Expanded Cells). Control what is displayed in the cell (including file name or extension) by choosing View > Grid View Style> View Options. Similarly, in the Develop module you can use the Loupe Info Overlay and View options (in the View menu) to display this information.
Or, filter photos: use the Filter bar to get just the photos you want, or create a Smart Collection to find them.
Answer: Lightroom will show you the extension of the file, which should point you in the right direction, but if that's not quite good enough, try creating a Smart Collection -- you can filter by file type there, including RAW vs. JPG.
Answer: (In windows) if you just hover over an item in Library view in Lightroom it will show you the filename and the extension of that file.
Answer: I use four different ways. More probably exist, but this is what I find handy.

Note: this example has the sort option shown as well as the image filename of the selected image.
Answer: You can also use a Custom Text Filter on "Filename", "Ends With" and "jpg"
Answer: Short Answer:
Open the photo in Loupe mode, press "i" and you will see the photo meta data information like the shutter speed, aperture, focal length, and the file's extension which will be either (in your case) jpeg or your camera raw extension.


Azure table store snapshot/backup capability

Question: I don't seem to be able to find any documentation on taking snapshots of an Azure table store, and neither can I find anything on taking backups either.
I've found a few posts from a few years ago with people saying they export their table stores to another storage account via AzCopy running on a VM called by Windows scheduler, but this seems awfully archaic and would mean storing complete copies of data.
The only thing that the Azure documentation seems to mention is snapshots of blob storage and I don't think that table storage, even though it's likely to be blobs underneath, counts.
Surely there's a better way of taking regular backups of Azure table stores?
Comment: Nope, I'm afraid not. Although the newly released Cosmos DB appears to take full automatic backups every 4 hours, the last 2 of which are kept, so it's something... It's a shame that the number of kept backups and the backup frequency isn't configurable but maybe that'll come later.
Comment: Did you find any better way of taking Azure Table stores snapshots ?
Answer: There is no table snapshot feature available (unlike blobs, which do have snapshots).
You'd need to devise your own way of making a backup of a table. Whether that is a partition-by-partition read + write, full table read plus write, or maybe some other technique (such as writing to two tables simultaneously).
Note: You still get the read-only secondary for tables (if you enable that type of storage), if you're concerned with DR.
Oh - regarding azCopy (or any other tool): Yes, those result in storing your data in another place. But snapshots could end up doing that too. While it's true that, with regular (non-premium) storage blobs, a snapshot doesn't initially take up much space (minimal, really), as the original blob changes, the snapshot grows in size to reflect the differences. And the same goes for each additional snapshot. Also, with premium storage (or managed disks, both regular and premium), snapshots take up the same amount of space as the original disk.
Answer: After doing a lot of research on the best way to automatically backup data, I found that the easiest way to do this is to schedule a job in the Windows Task Scheduler on an Azure virtual machine that uses AZCopy. AZCopy does the work of moving the table data to the VM and then back out to a secondary blob store in Azure to hold the backup. The batch file also causes AZCopy to copy the blobs from the source storage account into the target account directly.
You can see a detailed description of how I made this work complete with links to the batch files that I use to automate the backup at this link: http://www.eastfive.com/2016/03/01/automated-backup-of-azure-storage-tables-and-blobs/
Answer: By using snapshot or backup, you could make different versions of your data.
To create a backup of Azure Storage, you could use the Copy Activity of Azure Data Factory to move data from Azure Table Storage. You also could use this service to restore data back to Azure Table Storage.
Move data to and from Azure Table using Azure Data Factory
If you want to create a in place snapshot, you could implement it by adding a prefix versioning tip to Row Key. If the table data is updated, you could add a new row with a new version prefix. I get this idea from following article.
In place versioning on top of the table store


How can I simulate a mouse click at a certain position on the screen?

Question: What I want to do is to manipulate the mouse. It will be a simple macro for my own purposes. So it will move my mouse to certain position on the screen and click like I am clicking with certain interval.
Comment: Would [this](http://stackoverflow.com/questions/8242409/simulate-mouse-clicks-at-a-certain-position-on-inactive-window-in-c-sharp/8242484#8242484) be what you need ? Also, as someone suggested in the comments, you may wanna use UIAutomation.
Answer: Here's a code that is using unmanaged functions to simulate mouse clicks :
//This is a replacement for Cursor.Position in WinForms
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern bool SetCursorPos(int x, int y);

[System.Runtime.InteropServices.DllImport("user32.dll")]
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);

public const int MOUSEEVENTF_LEFTDOWN = 0x02;
public const int MOUSEEVENTF_LEFTUP = 0x04;

//This simulates a left mouse click
public static void LeftMouseClick(int xpos, int ypos)
{
    SetCursorPos(xpos, ypos);
    mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
    mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);
}

To keep the mouse pressed for a specific duration you can Sleep() the thread that is executing this function, for example  :
mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
System.Threading.Thread.Sleep(1000);
mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);

The above code will keep the mouse pressed for 1 second unless the user presses the releases the mouse button. Also, make sure to not execute this code on the main UI thread as it will cause it to hang.
Comment: This code works fine to bring the pointer to the desired coordinates on the screen but for some reason the click does not work for me. Any idea why?
Comment: This is FAR simplier than other solutions I have seen here. Thanks
Comment: Here you can have the codes for other mouse buttons : https://msdn.microsoft.com/en-us/library/windows/desktop/ms646260(v=vs.85).aspx
Answer: You can move by XY position. Example below:
windows.Forms.Cursor.Position = New System.Drawing.Point(Button1.Location.X + Me.Location.X + 50, Button1.Location.Y + Me.Location.Y + 30)

To click, you can use the below code:
using System.Runtime.InteropServices;

private const UInt32 MOUSEEVENTF_LEFTDOWN = 0x0002;
private const UInt32 MOUSEEVENTF_LEFTUP = 0x0004;
[DllImport("user32.dll")]
    private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData,             uint dwExtraInf);
private void btnSet_Click(object sender, EventArgs e)
    {
        int x = Convert.ToInt16(txtX.Text);//set x position
        int y = Convert.ToInt16(txtY.Text);//set y position
        Cursor.Position = new Point(x, y);
        mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);//make left button down
        mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);//make left button up
    }

Credit to JOHNYKUTTY
Comment: The question is on WPF, not Forms.
Comment: does not work : windows.Forms.Cursor.Position = New System.Drawing.Point(Button1.Location.X + Me.Location.X + 50, Button1.Location.Y + Me.Location.Y + 30)  . also i tried this at forms not mention to will not work at wpf


What is a Laurent Series and how do I find it?

Question:
I'm rather new to this branch of mathematics but have been trying to learn some basics of it on my own. I know it's likely not the easiest place to start, but I've been working on calculating contour integrals. I know that the contour integral is defined as :
$$
\oint f(z)\ dz = 2\pi i\sum \text{Res}\left(f,a_k\right)
$$
Which would be immensely useful to me if I knew how to calculate a residue. After some research, I realized that it is the coefficient of the $-1^{\text{st}}$ term of the Laurent Series of the function of the pole for which you are trying to find the residue. I now know all of the necessary information for basic contour integration EXCEPT how to find the Laurent series of a function.
Is it like a Taylor series? Is there a simple formula for it like for a Taylor series? How does the disc/annulus of the area of $z$ affect the series? How do you know whether or not to use a disc or an annulus?  Thanks in advance, I know this may be a handful to teach in just one post, sorry for my ignorance. :/ An example would be really helpful.
Comment: It's a slightly lengthy and complex (!) subject to be thoroughly treated in this site, I think. Grab a book in complex analysis, **any** decent book will do, or wai until you reach that level in your class. In short, yes: it's kindda Taylor series but with negative exponents.
Comment: +1 for @DonAntonio's comment. "Read a book" might seem like cheap advice, but it's really the best possible in this context. Take the time to properly learn the fundamentals of a subject. If you try to jump ahead to the advanced machinery without a solid foundation, you'll never really understand what you're doing. You're already dwelling under a minor misconception: the formula for a contour integral that you wrote is not how they are defined. Rather, it's a very important important theorem that includes assumptions on the function $f$ (https://en.wikipedia.org/wiki/Residue_theorem).
Comment: If $f(z)= \sum_{n=-\infty}^\infty a_n z^n$ converges absolutely for $0 < |z| < 2$ then $\oint_{|z|= 1} f(z)dz= \ ?$
Answer: Laurent series are for meromorphic functions, that is, functions which are analytic except they may have poles. Just as a Taylor series, you compute a Laurent series around a center. You can compute the $k$th coefficient of the Laurent series with the identity
$a_k = \oint f(z)(z-a)^{-k-1} dz$
If the function has no poles then the Laurent series coincides with the Taylor series, which implies that
$\oint \dfrac{f(z)}{(z-a)^2} dz = f'(a)$
So you can compute derivatives by integrating.
Any function analytic in a disk will have a Taylor series which converges to it in that disk. On the other hand if the function is known to be analytic in an annulus, it will have a Laurent series which converges to it in that annulus, but it need not have a convergent Taylor series, because it may have poles inside the annulus.
Usually it's easier to compute Laurent series by manipulating known Taylor series instead of using the above formula. For example the Laurent series for $\tan z$ about $z=\pi/2$ can be computed by
$\tan z= \frac{\sin z}{\cos z}= -\frac{\cos(z-\pi/2)}{\sin(z-\pi/2)} = -\frac{1+(z-\pi/2)^2/2+...}{(z-\pi/2) + (z-\pi/2)^3/3!+\dotsb}=-\frac{1}{z-\pi/2}(1-1/3(z-\pi/2)+\dotsb)=-\frac{1}{z-\pi/2}+1/3+\dotsb$
So tangent function has a single pole of order 1 at $\pi/2$.
Comment: Thanks so much for this answer! It helped me with so many of my questions(even those that weren't in the original post). You have been very helpful, and I plan to do as @Glare has said and find a good book to read. Thanks again!


Magnet in the generator?

Question: I'd like to know if there is some magnet in the rotor or in the stator of the generator? Or neither of those (rotor & stator) need a magnet for the current to flow?
Comment: All motors and generators use magnetism, some use permanent magnets and others use electromagnets.
Answer: Depends on the type of electrical machine.
All electrical machines can operate as Generators & Motors.
An electrical machine is an electrical <-> kinetic energy converter which utilises magnetic fields. The real question is by what means does the stator & rotor generate its magnetic field.
Types of electrical machines
Brushed DC

Stator: Wound or permanent magnet
Rotor: wound

Induction Machine

Stator: Wound
Rotor: Wound

Synchronous machine

Stator: Wound
Rotor: Wound or permanent magnet

Brushless DC or AC (these are sync machines)

Stator: Wound
Rotor: Permanent magnet

Switched Reluctance

Stator: Wound
Rotor: neither

This is ignoring inside out machines.
For higher power generators however, national grid type machines, the topologies of these machines are wound rotor synchronous machines
Answer: All electro-magnetic generators need magnetic field to induce electric current. This is called excitation.
Some generators use permanent magnets to create magnetic field.

usually small and low power
simple to build
simple to use
no voltage/power control (only by changing applied speed/torque)

Some generators use field coils to create magnetic field.

they have disadvantage  - you cannot create magnetic field without flowing current. Not excited generator will not take mechanical energy (except loss on friction etc). You have to deliver a little bit power to generator for startup (It's like lighting a candle, it will burn after you remove source of fire).
Later it creates electricity to power field coils. Note that this is not perpetuum mobile - when magnetic field appear - mechanical energy will be taken (rotor will resist). Very large generators in power plants are connected to grid, and almost never stop. Small generators without magnets usually rely on remanent magnetization. More: link
high power - field coil can produce stronger field than a magnet, so generator with field coils can be smaller than generator with magnets. This is one of reasons why there are no generators based on permanent magnets in power plants (they probably would be much bigger)
good control: voltage (and power) doesn't have to be proportional to speed because excitation current can be adjusted to archieve same output voltage or power at diffrent speeds.

Read also JonSB answer above/below to see types of generators. I didn't listed them because he did it and I'm afraid my english is not good enough for that kind of answer.

Magnet in the generator?


How can I replace my rigid front fork on my 1993 Palisades Trail? I'd like to keep it as low cost as possible

Question: I'm trying to replace the front rigid fork on my Marin 1993 Palisades Trail with a suspension fork so that when I ride mountain trails I don't destroy my wrists. Does anyone have any suggestions on what suspension forks I can use to replace my rigid one with? It's a 26" tire with what I believe is a 24" frame.
Update: the steerer width is 1 1/8" inch and its threaded.
Answer: I am making the assumption that a bike as old as yours has a 1 inch threaded steerer. The steerer is the top tube of the fork that goes through the frame. Older 1 inch forks had the most rudimentary types of suspension. later models used a 1 1/8" steerer which are available and some were of good quality but unfortunately won't fit your frame. Even if you could find the best fork available at the time it would likely be showing its' age. The rubber parts in particular tend to harden with age and replacements if available bring high prices. You also need to be concerned with how a new fork will affect the bikes handling. A suspension fork will raise the front of the bike several inches. This likely to affect the bikes stability. You can try some less expensive thing first. Try lowering the front tire pressure ( high enough to avoid pinch flats but low enough to allow the tires to absorb some vibration), some thicker grips to absorb vibration, padded gloves. It will likely be more cost effective to buy a quality used bike that was designed for use with a suspension fork.
Comment: Agreed - fit the biggest front-tyre that will leave 5mm of clearance in between the forks.  Really brave would be running that tyre as tubeless.


Can I fly a checkride with inop vacuum indicator and attitude indicator in a TAA plane?

Question: I have a checkride coming up and I will be taking it in a TAA plane. The vacuum indicator and attitude indicator are both inop and marked as so, but was wondering if it is still okay to fly for a commercial checkride. Those instruments are not a part of ATOMATOFLAMES, plus I do have the attitude indicator and all of my vacuum instruments on the glass panel for something to refer to. Inop process was followed but still not sure if I can still fly with just glass panel to rely on? Would it be okay to fly for a checkride?
Comment: My suggestion: review FAR 61.45, appropriate sections of FAR 91 regarding required aircraft equipment, and appendix 7 of the Commercial Airman Certification Standards (ACS). Then talk to the Examiner **before**  you show up for the flight check. Since your airplane has some inop equipment you may want to have its airworthiness and acceptability for your checkride sorted out and agreed to by the Examiner before your check.
Comment: Take a look at the MEL.  There may be relief for an inoperative vacuum system.  These standby instruments are there in the case of a complete electrical failure.  If it is not on the MEL (or no MEL exists), take a look at the equipment list (EL), you may find that it is/is not a required piece of equipment.  If it is not required, follow the guidance in 91.213 and deactivate it.
Answer: If the airplane is airworthy and the inoperative equipment is not required for the checkride tasks, you can use it for a checkride.
ATOMATOFLAMES are all required, but keep in mind that your airplane's POH, STCs, applicable ADs, etc., can all require equipment beyond just those basics.
For instance, if you are flying a Cessna 172S, the vacuum gauge is required for day VFR flight, unless the airplane has an STC or other document changing this requirement.
Answer: Check to see if your plane has a Minimum Equipment List. If not go through the following:

Check the Type Data Certificate Sheet (can be found on the FAA's DRS online) and check any Supplemental Type Certificates
Check the POH for a Kinds of Equipment List
You've already checked 14 CFR 91.205 which is good
Check for any Airworthiness Directives

If the equipment is not required by any of the above do the following:

Discard/deactivate it
Placard it as "Inoperative"
Sign off on it in the maintenance logs
Determine if as PIC you feel comfortable flying without the inoperative equipment

You should also talk to your DPE and mention you've gone through the above steps. Make them aware the equipment is inoperative and as your examiner they might make a decision.


Max memory for 64bit Java

Question: What's the maximum amount of heap space that one can allocate for java on a 64-bit platform? Is it unlimited?
Comment: Why do you think it's unlimited?
Answer: Theoretically 264, but there might be limitations (obviously)
According to this FAQ it's only limited by memory and swap space on the local system:On 64-bit VMs, you have 64 bits of addressability to work with resulting  in a maximum Java heap size limited only by the amount of physical memory and swap space your system provides.
See also Why can't I get a larger heap with the 32-bit JVM?
Also keep in mind you need to set the max heap via command line. Without an -Xmx command. without it Java uses 64mb + 30% = 83.2mb as a default max heap on 64 bit machines according the same FAQ.
java -Xmx1000g myClass

works fine on my machine.  But it dosn't seem to yet support the 't' modifier so you can't specify max memory in terabytes yet :)
Comment: 1000g worked for you? I thought `java` would validate if there's enough memory before taking in that option.
Answer: If you could make every atom in the universe into a byte of RAM, you could allocate it in a 64 bit address space.
Actually, that's a slight exaggeration.
There are 10^80 atoms in the universe (according to WolframAlpha), and 2^64 bytes of address space in a 64 bit system, so you'd only be able to address 1 out of every 5x10^60 atoms.  But if you have 18 qintillion bytes of RAM, you'd probably need a couple of quantum black holes to power it with.
Comment: Wouldn't want to wait for a full collect on that!
Comment: Just when i thought Java started to get boring, i run into old posts like these. Faith in OOPs, restored.
Comment: @Stephen, I edited the answer before you posted your comment.  WolframAlpha rules!
Answer: This probably depends on the system your VM is running in. If you are running a AMD x64 architecture the address space of currently shipped processors uses 48 Bits, not 64. This results in a theoretical maximum of roughly 256 TB. (See http://en.wikipedia.org/wiki/X86-64)
I am not a specialist in VMs, but any modern OS typically will give as much memory as there is physical RAM plus available virtual memory. Probably thats what the VM will pass to your application depending on its configuration.
Comment: The relevant AMD manual states that the virtual address space is in fact 64 bits (Chapter 2.2.1, AMD64 Architecture Programmer's Manual, v3.14, September 2007)
Answer: With recent VMs from Sun, the practical heap limit size is usually 512 times the available physical and/or virtual memory. Even if the theoretical limit is much higher, the VM will allocate 1 byte for maangement purposes for each 512 bytes of heap memory on startup, so 1TB of heap will immediately require 2GB for the memory management.
Comment: You won't find a reference for that anyhwere. It's simply the way the VM is implemented, or at least was implemented in current versions two years ago.
Comment: Can you please cite a reference?
Answer: In theory its between 2^63 and 2^64 bytes.
In practice it is limited by the amount of physical memory and swap space available on your machine.  And the physical memory is in turn limited by your chipset (i.e. the number of address pins on the physical memory address bus) and motherboard (i.e. the number and size of the DIMM sockets).
Comment: For AMD64, the current specs foresee 40-52 address pins. Also, they support NUMA architectures where each processor has a chunk of memory which other processors can only access indirectly.

Max memory for 64bit Java


What is duck typing?

Question: What does duck typing mean in software development?
Comment: I'm sure I've read somewhere that SO was intended to be "a repository of canonical questions", and I'm pretty sure you cannot get more canonical than this one.
Comment: [If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.](http://wikipedia.org/wiki/Duck_test)
Comment: @sushil bharwani: no, not angry. But people expect that as the first port of call (i.e. the first thing you do) is to try searching before posting here.
Comment: @Mitch i tried and got something as its some form of inheritance. But could not follow much. Sorry if i asked the wrong question.
Comment: imo every question under the sun should be documented in a part of the `StackExchange` community
Comment: sorry for not mentioning it. I searched, read didnt followed much so tried the best available option.
Comment: like in the answer "duck typing is a style of dynamic typing in which an object's current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface." i dont follow when somebody says "rather than its inheritance from a particular class"
Comment: Duck typing is the reason why foreach works for any object thas has a `GetEnumerator()` method. You don't have to implement `IEnumerable`.
Answer: It is a term used in dynamic languages that do not have strong typing.
The idea is that you don't need to specify a type in order to invoke an existing method on an object - if a method is defined on it, you can invoke it.
The name comes from the phrase "If it looks like a duck and quacks like a duck, it's a duck".
Wikipedia has much more information.
Comment: Be wary of using Strong Typing. It is not that well defined. Neither is Duck Typing. Google Go or Ocaml are statically typed languages with a structural subtyping-construction. Are these duck typed languages?
Comment: Both Python and Ruby are strong-typed languages and both have Duck Typing. String Typing does not imply in not having Duck Typing.
Comment: a better phrase for duck typing is: "If is says it is a duck.. well that's good enough for me." see http://pyvideo.org/video/1669/keynote-3 28:30 or http://www.youtube.com/watch?v=NfngrdLv9ZQ#t=1716
Comment: I'm downvoting this. Duck ducking has nothing to do with the strength of type, just the ability to be able to use any object having a method, wether it implement an interface or not.
Comment: Duck typing isn't necessarily just used in dynamic languages. Objective-C isn't a dynamic language and it uses duck typing.
Comment: @tovmeod I think that's different. Duck typing is more like feature detection based on verification that the necessary methods/properties exist while what you're suggesting is like checking the vendor string and then trying to call a method without checking whether or not it exists.
Comment: Strongly typed means the language never allows an operation
to be invoked with operands of the wrong type. It has nothing to do with dynamic or not. Dynamiclly typed means just run the code
before *every* primitive operation but check that the operation is being passed values of the right type.
Comment: According to this [answer](http://stackoverflow.com/a/1948272/689991), you first statement is wrong. C++ and D templates are a perfect example of duck typing that is not dynamic. C++ is weakly typed language, and D is a strongly typed language.
Comment: i believe i have never worked in a dynamic language so its a bit difficult understanding the term. But yes i thank you Oded for you answer. The only dynamic language i am bit aware of is javascript. Can you suggest me any example in that context..
Comment: @sushil bharwani - See the answers to this question: http://stackoverflow.com/questions/3379529/duck-typing-in-javascript
Comment: @Oded How is this related to monkey patching, if related at all?
Comment: @Djack - it isn't. Totally different things. Monkey patching is about changing the program instance as it is being run.
Answer: Duck typing
means that an operation does not formally specify the requirements that its operands have to meet, but just tries it out with what is given.
Unlike what others have said, this does not necessarily relate to dynamic languages or inheritance issues.
Example task: Call some method Quack on an object.
Without using duck-typing, a function f doing this task has to specify in advance that its argument has to support some method Quack. A common way is the use of interfaces
interface IQuack {
    void Quack();
}

void f(IQuack x) {
    x.Quack();
}

Calling f(42) fails, but f(donald) works as long as donald is an instance of a IQuack-subtype.
Another approach is structural typing - but again, the method Quack() is formally specified anything that cannot prove it quacks in advance will cause a compiler failure.
def f(x : { def Quack() : Unit }) = x.Quack()

We could even write
f :: Quackable a => a -> IO ()
f = quack

in Haskell, where the Quackable typeclass ensures the existence of our method.

So how does **duck typing** change this?
Well, as I said, a duck typing system does not specify requirements but just tries if anything works.
Thus, a dynamic type system as Python's always uses duck typing:
def f(x):
    x.Quack()

If f gets an x supporting a Quack(), everything is fine, if not, it will crash at runtime.
But duck typing doesn't imply dynamic typing at all - in fact, there is a very popular but completely static duck typing approach that doesn't give any requirements too:
template <typename T>
void f(T x) { x.Quack(); }

The function doesn't tell in any way that it wants some x that can Quack, so instead it just tries at compile time and if everything works, it's fine.
Comment: didn't you mean : void f(IQuak x) { x.Quak(); }

(instead of K.Quack) because function f's parameter is IQuack x not Iquack k, very small mistake but I felt like it needed to be corrected :)
Comment: So if I understand what you said, the difference between a language that supports duck typing and one that does not is just that with duck typing, you do not have to specify the type of objects that a function accepts? `def f(x)` instead of `def f(IQuack x)`.
Comment: According to Wikipedia, your last example is "structural typing", not "duck typing".
Comment: Well, it seems there's a separate question for that discussion: http://stackoverflow.com/questions/1948069/duck-typing-must-it-be-dynamic
Answer: Simple Explanation
What is duck typing?
"If it walks like a duck and quacks like a.... etc" - YES, but what does that mean??!
We're interested in what "objects" can do, rather than what they are.
Let's unpack it with an example:

See below for further detail:
Examples of Duck Typing functionality:
Imagine I have a magic wand. It has special powers. If I wave the wand and say "Drive!" to a car, well then, it drives!
Does it work on other things? Not sure: so I try it on a truck. Wow - it drives too! I then try it on planes, trains and 1 Woods (they are a type of golf club which people use to 'drive' a golf ball). They all drive!
But would it work on say, a teacup? Error: KAAAA-BOOOOOOM! that didn't work out so good. ====> Teacups can't drive!! duh!?
This is basically the concept of duck typing. It's a try-before-you-buy  system. If it works, all is well. But if it fails, like a grenade still in your hand, it's gonna blow up in your face.
In other words, we are interested in what the object can do, rather than with what the object is.
What about languages like C# or Java etc?
If we were concerned with what the object actually was, then our magic trick will work only on pre-set, authorised types - in this case cars, but will fail on other objects which can drive: trucks, mopeds, tuk-tuks etc. It won't work on trucks because our magic wand is expecting it to only work on cars.
In other words, in this scenario, the magic wand looks very closely at what the object is (is it a car?) rather than what the object can do (e.g. whether cars, trucks etc. can drive).
The only way you can get a truck to drive is if you can somehow get the magic wand to expect both trucks and cars (perhaps by "implementing a common interface"). This can be done via a technique called: "polymorphism" or by using "interfaces" - they're kinda the same thing. If you like cartoons and want an explanation, check out my cartoon on interfaces.
Summary: Key take-out
What's important in duck typing is what the object can actually do, rather than what the object is.
Code Sample
But how can a golf club "drive" like a car? Aren't they different? If you're using a language like Ruby, we don't care about what the object is:
class Car
   def drive
      "I"m driving a Car!"
   end
end

class GolfClub
   def drive
      "I"m driving a golf club!"
   end
end

def test_drive(item)
   item.drive # don't care what it is, all i care is that it can "drive"
end

car = Car.new
test_drive(car) #=> "I'm driving a Car"

club = GolfClub.new
test_drive(club) #=> "I"m driving a GolfClub"

# welcome to duck typing!

PS. I wanted to cut out the academic rigmarole: this answer is not scientific, but hopefully it gives you a vague understanding of what is going on via analogy.
PPS. if you wanna laugh and got some time to spare, check out: Matt Damon's explanation of duck typing in Good Will Hunting ;)
Comment: Best explanation for sure. I'm so tired of this "duck" explanation, and so are you too it sounds like (my emphasis in bold): "("If it walks like a duck and quacks like a duck then it is a duck.") - **YES! but what does that mean??!"** Now I get it: just try the method on whatever object comes in rather than checking the object's type first.
Comment: I find interesting the premise about you care more about the behavior, that's it's definition. No doubt BDD is so successful in languages like ruby.
Comment: I felt too passionate about this, and had to [add my own answer too](https://stackoverflow.com/a/66502857/4561887) :).
Comment: Also, I think you should put your "Summary" right at the beginning. That's the key takeaway. Maybe leave it at the end but also put a copy of it right at the beginning too.
Comment: But isn't the drive of a car different from the drive of a golf driver?
Answer: Consider you are designing a simple function which gets an object of type Bird and calls its walk() method. There are two approaches you can think of:

This is my function, and I must be sure that it only accepts the Bird type or the code will not compile. If anyone wants to use my function, they must be aware that I only accept Birds.
My function gets any objects and I just call the object's walk() method. So, if the object can walk() then it is correct. If it can't, my function will fail. So, here it is not important the object is a Bird or anything else, it is important that it can walk()  (This is duck typing).

It must be considered that duck typing may be useful in some cases. For example, Python uses duck typing a lot.

Useful reading

There are good examples of duck typing for Java, Python, JavaScript
etc. at  https://en.wikipedia.org/wiki/Duck_typing.
Here is also a good answer which describes the advantages of dynamic
typing and also its disadvantages: What is the supposed productivity gain of dynamic typing?
Comment: This answer is simple, clear, and probably the best for beginners.  Read this answer along with the answer above it (or if it moves, the answer that talks about cars and teacups)
Comment: Nice explanation, What are any advantages?
Answer: I see a lot of answers that repeat the old idiom:

If it looks like a duck and quacks like a duck, it's a duck

and then dive into an explanation of what you can do with duck typing, or an example which seems to obfuscate the concept further.
I don't find that much help.
This is the best attempt at a plain english answer about duck typing that I have found:
Duck Typing means that an object is defined by what it can do, not by
what it is.
This means that we are less concerned with the class/type of an object and more concerned with what methods can be called on it and what operations can be performed on it. We don't care about it's type, we care about what it can do.
Comment: Great! Some might also state it means a technique when an object's type is determined not by its inheritance but properties (i.e. fields, methods etc.). Related: https://stackoverflow.com/a/4205164/5113030 (*Answer by Chris Baxter...*)
Answer:
Don't be a quack; I've got your back:
"Duck typing" := "try the methods, don't check the type"
Note: := can be read as "is defined as".
"Duck typing" means: just try the method (function call) on whatever object comes in rather than checking the object's type first to see if that method is even a valid call on such a type.
Let's call this "try the methods, don't check the type" typing, "method-call type-checking", or just "method-call typing" for short.
In the longer explanation below, I'll explain this more in detail and help you make sense of the ridiculous, esoteric, and obfuscated term "duck typing."

Longer explanation:
DIE  DIE!
Python does this concept above. Consider this example function:
def func(a):
    a.method1()
    a.method2()

When the object (input parameter a) comes into the function func(), the function shall try (at run time) to call any methods specified on this object (namely: method1() and method2() in the example above), rather than first checking to see if a is some "valid type" which has these methods.
So, it's an action-based attempt at run-time, NOT a type-based check at compile-time or run-time.
Now look at this silly example:
def func(duck_or_duck_like_object):
    duck_or_duck_like_object.quack()
    duck_or_duck_like_object.walk()
    duck_or_duck_like_object.fly()
    duck_or_duck_like_object.swim()

Hence is born the ridiculous phrase:

If it walks like a duck and quacks like a duck then it is a duck.

The program that uses "duck typing" shall simply try whatever methods are called on the object (in this example above: quack(), walk(), fly(), and swim()) withOUT even knowing the type of the object! It just tries the methods! If they work, great, for all the "duck typing" language knows or cares, IT (the object passed in to the function) IS A DUCK!--because all the (duck-like) methods worked on it.
(Summarizing my own words):
A "duck typed" language shall not check its type (neither at compile time nor run-time)--it doesn't care to. It will just try the methods at run-time. If they work, great. If they don't, then it shall throw a run-time error.
That is duck-typing.
I'm so tired of this ridiculous "duck" explanation (because without this full explanation it doesn't make any sense at all!), and so are others too it sounds like. Example: from BKSpurgeon's answer here (my emphasis in bold):

("If it walks like a duck and quacks like a duck then it is a duck.") - YES! but what does that mean??!"

Now I get it: just try the method on whatever object comes in rather than checking the object's type first.
I shall call this "run-time checking where the program just tries the methods called without even knowing if the object has these methods, rather than checking the type of the object first as the means of knowing the object has these methods", because that just makes more sense. But...that's too long to say, so people would rather confuse each other for years instead by saying ridiculous but catchy things like "duck typing."
Let's instead call this: "try the methods, don't check the type" typing. Or, perhaps: "method-call type-checking" ("method-call typing" for short), or "indirect type-checking by method calls", since it uses the calling of a given method as "proof enough" that the object is of the right type, rather than checking the object's type directly.
Note that this "method-call type-checking" (otherwise confusingly called "duck typing") is a type of dynamic typing. But, NOT all dynamic typing is necessarily "method call type-checking", because dynamic typing, or type checking at run-time, can also be done by actually checking an object's type rather than by simply attempting to call the methods called on the object in the function without knowing its type.
Read also:

https://en.wikipedia.org/wiki/Duck_typing --> search the page for "run", "run time", and "runtime".
Comment: thanks sir! i mean "bravo!!" this is amazing, should be upvoted way more!
Comment: @manish, I don't know JavaScript, so I can't say. If it is a scripted language with weak, unspecified types that aren't automatically checked for errors (either at compile time or run-time) in function calls when you pass in parameters, then the answer is "yes". Python fits this description. It doesn't throw an error when you pass in a parameter with the wrong type to a function, rather, it throws a run-time error _when you try to call some invalid method on that object type and it fails._
Comment: Thanks, this made more sense. So is JavaScript duck typed?
Answer: Wikipedia has a fairly detailed explanation:
http://en.wikipedia.org/wiki/Duck_typing

duck typing is a style of dynamic
  typing in which an object's current
  set of methods and properties
  determines the valid semantics, rather
  than its inheritance from a particular
  class or implementation of a specific
  interface.

The important note is likely that with duck typing a developer is concerned more with the parts of the object that are consumed rather than what the actual underlying type is.
Answer: I know I am not giving generalized answer. In Ruby, we don't declare the types of variables or methods— everything is just some kind of object.
So Rule is "Classes Aren't Types"
In Ruby, the class is never (OK, almost never) the type. Instead, the type of an object is defined more by what that object can do. In Ruby, we call this duck typing. If an object walks like a duck and talks like a duck, then the interpreter is happy to treat it as if it were a duck.
For example, you may be writing a routine to add song information to a string. If you come from a C# or Java background, you may be tempted to write this:
def append_song(result, song)
    # test we're given the right parameters
    unless result.kind_of?(String)
        fail TypeError.new("String expected") end
    unless song.kind_of?(Song)
        fail TypeError.new("Song expected")
end

result << song.title << " (" << song.artist << ")" end
result = ""

append_song(result, song) # => "I Got Rhythm (Gene Kelly)"

Embrace Ruby's duck typing, and you'd write something far simpler:
def append_song(result, song)
    result << song.title << " (" << song.artist << ")"
end

result = ""
append_song(result, song) # => "I Got Rhythm (Gene Kelly)"

You don't need to check the type of the arguments. If they support << (in the case of result) or title and artist (in the case of song), everything will just work. If they don't, your method will throw an exception anyway (just as it would have done if you'd checked the types). But without the check, your method is suddenly a lot more flexible. You could pass it an array, a string, a file, or any other object that appends using <<, and it would just work.
Answer: Looking at the language itself may help; it often helps me (I'm not a native English speaker).
In duck typing:
1) the word typing does not mean typing on a keyboard (as was the persistent image in my mind), it means determining "what type of a thing is that thing?"
2) the word duck expresses how is that determining done; it's kind of a 'loose' determining, as in: "if it walks like a duck ... then it's a duck". It's 'loose' because the thing may be a duck or may not, but whether it actually is a duck doesn't matter; what matters is that I can do with it what I can do with ducks and expect behaviors exhibited by ducks. I can feed it bread crumbs and the thing may go towards me or charge at me or back off ... but it will not devour me like a grizzly would.
Answer: Matt Damon explains Duck Typing in Good Will Hunting
Transcript is as below. Video link here..
CHUCKIE: All right, are we gonna have a problem?
CLARK: There's no problem. I was just hoping you could give me some insight into what duck typing is actually is? My contention is that duck tying is not well defined, and neither is strong
WILL: [interrupting] …and neither is strong typing. Of course that's your contention. You're a first year grad student: you just got finished reading some article on duck typing, probably on StackOverflow, and you're gonna be convinced of that until next month when you get to the Gang of Four, and then you're gonna be talking about how Google Go and Ocaml are statistically typed languages with structural sub-tying construction. That's going to last until next year, till you're probably gonna be in here regurgitating Matz, talkin' about, you know, the Pre-Ruby 3.0 utopia and the memory allocating effects of sub-typing on the GC.
CLARK: [taken aback] Well as a matter of fact I won't, because Matz drastically underestimates the impact of —
WILL: "Matz dramatically underestimates the impact of Ruby 3.0's GC on performance. You got that from Donald Knuth, The Art of Computer Programming, page 98, right? Yeah I read that too. Were you gonna plagiarize the whole thing for us—you have any thoughts of—of your own on this matter? Or do—is that your thing, you come into stack overflow, you read some obscure passage on r/ruby and then you pretend, you pawn it off as your own—your own idea just to impress some girls, embarrass my friend?
[Clark is stunned]
WILL: See the sad thing about a guy like you is in about 50 years you're gonna start doing some thinking on your own and you're gonna come up with the fact that there are three certainties in life. One, don't do that. And two, if it walks like a duck then it is a duck. And three, you dropped a hundred and fifty grand on an education you coulda got for zero cents via a stack overflow answer by Ben Koshy.
CLARK: Yeah, but I will have a degree, and you'll be serving my kids some cheap html via react at a drive-thru on our way to a skiing trip.
WILL: [smiles] Yeah, maybe. But at least I won't be unoriginal.
(a beat)
WILL: you got problem 3 ? I guess we can step outside and sort things out.
Clark: there's no problem
Some time later:
WILL: Do you like apples?
Clark is like, huh?
WILL: How do you like them apples? (Boom: Will slams a letter up against a window.) I gotta offer from Google! (Shows the letter of acceptance to Clark showing his interview answer: a picture of a duck walking, and talking, and acting like a... goose.)
Roll Credits.
THE END.
(This is a footnote to the old answer here:)
3 Advent of Code problems.
Answer: Duck typing:

If it talks and walks like a duck, then it is a duck

This is typically called abduction (abductive reasoning or also called retroduction, a clearer definition I think):

from C (conclusion, what we see) and R (rule, what we know), we accept/decide/assume P (Premise, property) in other words a given fact
... the very basis of medical diagnosis
with ducks: C = walks, talks, R = like a duck, P = it's a duck

Back to programming:

object o has method/property mp1 and interface/type T
requires/defines mp1
object o has method/property mp2  and interface/type T requires/defines mp2
...

So, more than simply accepting mp1... on any object as long has it meets some definition of mp1..., compiler/runtime should also be okay with the assertion o is of type T
And well, is it the case with examples above? Is Duck typing is essentially no typing at all? Or should we call it implicit typing?
Answer: Duck Typing is not Type Hinting!
Basically in order to use "duck typing" you will not target a specific type but rather a wider range of subtypes (not talking about inheritance, when I mean subtypes I mean "things" that fit within the same profiles) by using a common interface.
You can imagine a system that stores information. In order to write/read information you need some sort of storage and information.
Types of storage may be: file, database, session etc.
The interface will let you know the available options (methods) regardless of the storage type, meaning that at this point nothing is implemented! In another words the Interface doesn't know nothing about how to store information.
Every storage system must know the existence of the interface by implementing it's very same methods.
interface StorageInterface
{
   public function write(string $key, array $value): bool;
   public function read(string $key): array;
}

class File implements StorageInterface
{
    public function read(string $key): array {
        //reading from a file
    }

    public function write(string $key, array $value): bool {
         //writing in a file implementation
    }
}

class Session implements StorageInterface
{
    public function read(string $key): array {
        //reading from a session
    }

    public function write(string $key, array $value): bool {
         //writing in a session implementation
    }
}

class Storage implements StorageInterface
{
    private $_storage = null;

    function __construct(StorageInterface $storage) {
        $this->_storage = $storage;
    }

    public function read(string $key): array {
        return $this->_storage->read($key);
    }

    public function write(string $key, array $value): bool {
        return ($this->_storage->write($key, $value)) ? true : false;
    }
}

So now, every time you need to write/read information:
$file = new Storage(new File());
$file->write('filename', ['information'] );
echo $file->read('filename');

$session = new Storage(new Session());
$session->write('filename', ['information'] );
echo $session->read('filename');

In this example you end up using Duck Typing in Storage constructor:
function __construct(StorageInterface $storage) ...

Hope it helped ;)
Answer: Tree Traversal with duck typing technique
def traverse(t):
    try:
        t.label()
    except AttributeError:
        print(t, end=" ")
    else:
        # Now we know that t.node is defined
        print('(', t.label(), end=" ")
        for child in t:
            traverse(child)
        print(')', end=" ")

Answer: I think it's confused to mix up dynamic typing, static typing and duck typing. Duck typing is an independent concept and even static typed language like Go, could have a type checking system which implements duck typing. If a type system will check the methods of a (declared) object but not the type, it could be called a duck typing language.
Answer: The term Duck Typing is a lie.
You see the idiom "If it walks like a duck and quacks like a duck then it is a duck." that is being repeated here time after time.
But that is not what duck typing (or what we commonly refer to as duck typing) is about. All that the Duck Typing we are discussing is about, is trying to force a command on something. Seeing whether something quacks or not, regardless of what it says it is. But there is no deduction about whether the object then is a Duck or not.
For true duck typing, see type classes.
Now that follows the idiom "If it walks like a duck and quacks like a duck then it is a duck.". With type classes, if a type implements all the methods that are defined by a type class, it can be considered a member of that type class (without having to inherit the type class). So, if there is a type class Duck which defines certain methods (quack and walk-like-duck), anything that implements those same methods can be considered a Duck (without needing to inherit Duck).
Answer: In duck typing, an object's suitability (to be used in a function, for example) is determined based on whether certain methods and/or properties are implemented rather than based on the type of that object.
For example, in Python, the len function can be used with any object implementing the __len__ method. It doesn't care if that object is of a certain type say string, list, dictionary or MyAwesomeClass, as far as these objects implement a __len__ method, len will work with them.
class MyAwesomeClass:
    def __init__(self, str):
        self.str = str

    def __len__(self):
        return len(self.str)

class MyNotSoAwesomeClass:
    def __init__(self, str):
        self.str = str

a = MyAwesomeClass("hey")
print(len(a))  # Prints 3

b = MyNotSoAwesomeClass("hey")
print(len(b))  # Raises a type error, object of type "MyNotSoAwesomeClass" has no len()

In other words, MyAwesomeClass looks like a duck and quacks like a duck and therefore is a duck, while MyNotSoAwesomeClass doesn't look like a duck and doesn't quack, therefore is not a duck!
Answer: Duck Typing:
let anAnimal

if (some condition)
  anAnimal = getHorse()
else
  anAnimal = getDog()

anAnimal.walk()

The above function call will not work in Structural typing
The following will work for Structural typing:
IAnimal anAnimal

if (some condition)
      anAnimal = getHorse()
    else
      anAnimal = getDog()

anAnimal.walk()

That's all, many of us already know duck typing is intuitively.
Answer: In programming, types can be divided into nominal and structural types. Nominal types consider the entire structure of a type. So from whom inherited etc. They are clearly more complex than structural types. One uses nominal types for example in C# and Java.
Structural types do not consider these points at all. For structural types only the structure of the single type is important. So how it looks like. In the example of a class. Does it have the same parameters and the expected types. This is called Duck Typing. Duck Typing finds its origin in the Duck Test.
A Dugtest means: If something looks like a duck. If it swims like a duck. If it quacks like a duck. Then it is a duck. Conversely: If a test case does not apply, then it is not a duck. (https://en.wikipedia.org/wiki/Duck_test)
Answer: I try to understand the famous sentence in my way:
"Python dose not care an object is a real duck or not.
All it cares is whether the object, first 'quack', second 'like a duck'."
There is a good website. http://www.voidspace.org.uk/python/articles/duck_typing.shtml#id14
The author pointed that duck typing let you create your own classes that have
their own internal data structure - but are accessed using normal Python syntax.
Comment: this answer is quite duck typing answer

What is duck typing?


Can you have "missing" predictors in Cox regression or are these just considered [right] censored data?

Question: If data is extracted from electronic health records and used for survival analysis, can outcome vars be considered missing or are they just considered right censored data points?
Answer: Quoting from Stef van Buuren's Flexible Imputation of Missing Data, Section 3.7.3:

Survival analysis is the method of choice if censoring is restricted to the single outcomes. The approach is, however, less suited for censored predictors or for multiple interdependent censored outcomes.

With only one type of event and no missing predictor values, the usual practice is to treat such a case as having a right-censored event time based on the last known follow-up time.
With missing predictor values or multiple types of outcomes, however, multiple imputation of the missing data could be a preferred approach. Van Buuren provides an example Algorithm 3.6 that uses predictive mean matching, Kaplan-Meier estimates, and bootstrapping for imputation. He also provides further references to literature on the topic.


Are there any unlockables in Assassin's Creed Revelations from playing the prior games?

Question: Are there any unlockables in Assassin's Creed Revelations that are awarded from playing prior Assassin's Creed games or getting specific achievements in those games?
Comment: I haven't got it yet, so I can't answer, but I doubt it. AC2 and AC:B didn't have anything like that IIRC.
Comment: UPS delivered my copy to the leasing office at my complex and I didn't get home before they closed for the day >.< I should be able to confirm 100% tomorrow, but I agree with @MrSmooth that the answer is probably "No".
Answer: Yes. If you've played AC:B multiplayer that unlocks the Courtesan for use in Revelations multiplayer.
That's it though.
Answer: Now that I've finally had a chance to sit down and play this - no.  I have full completion on all the other games, and started this one essentially naked.


Do all Banks and Credit Unions in the U.S. accept Bitcoin?

Question: Do all Banks and Credit Unions in the U.S. accept Bitcoin for deposits or withdraws?
Comment: Are there any at all that do?
Comment: Possible duplicate of https://bitcoin.stackexchange.com/q/17239/5406
Answer: Certainly all banks and credit unions do not accept bitcoin, and I'm not aware of any that do.
Banks and credit unions can be thought of as nodes in their own network that is not actually so dissimilar to Bitcoin.  The function of this network is to create, store, and transfer money.  Most fiat currency is not created by the central bank, but is lent into existence by the process of fractional reserve banking.  In other words, a bank is inherently part of the currency it operates with.  It plays a role in the money creation process.
With this view, your question is similar to asking "can the Litecoin network transfer bitcoin?", or "can an Ethereum miner create a Bitcoin block?".  These are separate networks, operating with different sets of rules.  The same is true of Bitcoin and the traditional financial network.
That said, many traditional financial institutions operate small-scale foreign currency exchanges for the convenience of their customers.  You can often go up to a bank teller in the US and exchange a small amount of euros (leftover from a trip abroad) for dollars, usually only if you are a customer or memeber.  I do not know of any traditional bank or credit union that has added bitcoin to the list of currencies it exchanges, but I doubt there are many...if any at all.


My pictures will not transfer from my Nikon D3200 to my Macbook. It has done it in the past but does not do it now. Do I need a software up date?

Question: I can not get pictures to transfer from my Nikon D3200 to my Mac Book. It has been done in the past but will not work now. Do I need a software up-date?
Comment: Tell us more about your current method of transferring pictures. usb cable? sd slot in the macbook?
Answer: Why don't you try to transfer photos using the card with a card reader, there is no need for any software while transferring with a card.
Just buy a card reader, attach it to USB port, plug in your card and transfer.
Comment: True, but most Mac Books have a SD card reader built in. She can use that.
Comment: did not solve my issue, my MBP does not have an SD-Card Reader built in


Create magento different language store

Question: I have created two different stores for different languages on Magento 1.9. But, I am unable to see language drop-down at the frontend. Please guide me
Answer: The store switcher does not appear unless you have 2 stores minimum in the current website.

Check if you have well this file : /app/design/frontend/{package}/{theme}/template/page/switch/languages.phtml else in your base/default
Check well if you have the code bellow in your xml app/design/frontend/{package}/{theme}/layout/local.xml
<reference name="top.links">
    <block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
</reference>

Create magento different language store


What command do I put into a command block that can set the spawn of the nearest player to a different specific location?

Question: I want to use the command block to set the nearest player's spawn to a specific location, how to I do it? And will the player spawn there if he dies?
Answer: You can do /setspawn @p 50 64 50.  @p targets the nearest player, and 50 64 50 is the x,y and z coordinates. If the set player dies they will respawn at the set coordinates.
Comment: The question specifically asks for the /setspawn variation for the closest user, since /tp teleports the player, it doesn't set spawn. If that option exists, that is.
Comment: @Arperum that option exists. The appropriate command would be `/spawnpoint @p x y z`
Answer: /setspawn @p in the command block to set the spawn. But you need to be in opped creative to make it work.
Answer: What you would do is set a team spawn, this can be done by using this:
[c1]=*****=[c2]
(c1 = /scoreboard teams join (Team) @p )
(c2 = /setspawn @a[team=(Team)] x y z)
(=) = Repetor
(*) = Redstone
Answer: Use /tp @p [x] [y] [z] This will teleport the nearest player to a specific location.