Speed Of light spot

Question: Let us suppose I have an laser.I'm swinging my hand so that the spot of light moves in screen. Screen is at arbitrary distance so when I swing  my hands the spot go up and down on screen, Now It is clear that speed of spot will be greater than that of my hands. Now I'm swinging my hands with speed of light (almost) then spot must go with speed greater than speed of light. which is a contradiction?  Please Correct me.
Comment: Does this answer your question? [Is it really possible to break the speed of light by flicking your wrist with a laser pointer?](https://physics.stackexchange.com/q/48328/)
Comment: This is *not* a contradiction of Special Relativity. See ["Superluminal travel of non-information"](https://en.wikipedia.org/wiki/Faster-than-light#Superluminal_travel_of_non-information) in Wikipedia.
Comment: This has been asked thousands of times.  Please apply some research effort.
Answer: This is called Nemiroff experiment
Einstein's theory of special relativity says it
is impossible for an object (like a single
photon of light) to look as though it is
traveling faster than the speed of light.
Nemiroff experiment doesn't break this
physical law because the laser pointer
produces a stream of photons, not a single
photon. No single photon in the stream
ever moves faster than the speed of light,
but collectively, they can create the illusion
of faster-than-light travel.
Another way to understand this illusion is
to imagine an electronic ticker tape, which
creates the illusion of a word moving
horizontally across the screen. In reality,
the word is created by a series of flashes
from many individual, stationary lights. In
theory, it would be possible to have a
word move across the screen faster than
the speed of light- because nothing has
actually moved. Each flash of light is an
isolated event, and they only create the
illusion of movement collectively.
You can also watch the "veritasium" video, in which he has explained this phenomenon.
https://en.m.wikipedia.org/wiki/Faster-than-light
Answer: Take a slice in time of your beam spot. It hits the screen. The next in time slice hits the screen, but it is not the same light energy. At the level of photons , it is not the same photons. The relativistic limit of the speed of light in vacuum is about the same light slice ( or photon, at the quantum level) . The energy cannot reach the screen faster than the speed of light.
Answer: Nothing in special relativity forbids a spot of light from moving faster than c. The restriction is that objects with mass cannot move at c in an inertial frame. The spot of light isn't an object with mass (it isn't even an object).
There is also a restriction that SR together with causality forbid information from traveling faster than c. A spot of light carries neither information nor energy along its path (information and energy are carried from your hand to the screen, but not from one side of the screen to the other).
Comment: @HartmutBraun a spot of light certainly does carry information, but it carries the information from the hand to the screen, not across the screen. That is the key. A person on one side of the screen cannot change the spot in a way to send information with the spot across the screen.
Comment: I'm not convinced about the second part of the answer. It's hard to see how the spot does *not* carry information. I think, too, that "a spot of light does not carry information" but only because I think that SR is true, *thus* it impossible that it carries information. But in the first place it's is only a claim and I don't see how to prove that it is correct.

Speed Of light spot


Deploying VI JAVA in Virgo throwing java.lang.NoClassDefFoundError

Question: For vSphere Web Client plugin, I created a java Service , I try to create a datastore in the ESX host using VI JAVA. I included
import com.vmware.vim25.*;
import com.vmware.vim25.mo.*;

files in service implementation and included external JARS to STS environment and created a function to list all hosts:
public List<String> listVcHosts() throws Exception{
   ManagedEntity[] hosts = new InventoryNavigator(rootFolder).searchManagedEntities("HostSystem");
   List<String> listHosts = new ArrayList<String>();
   for( ManagedEntity me : hosts ) {
       HostSystem host = (HostSystem) me;
       //Adding the list of hosts in List
       listHosts.add(host.getName().toString());
   }
  return listHosts;
}

When I am executing as JAVA Application from STS its working fine without any warnings.
I copied JARS to server/pickup folder and tried to deploy the services in VIRGO.
It's throwing the following exception:
An Import-Package could not be resolved. Caused by missing constraint in bundle <com.xx.xxx.xxxx_1.0.0>
             constraint: <Import-Package: com.vmware.vim25.mo; version="0.0.0">

Answer: It seems you forget to include the package com.vmware.vim25.mo in your MANIFEST.MF file.
Check this file, the MANIFEST.MF should have a line importing this package.


Large export with many fields

Question: I need a simplified UX solution for selecting many checkbox items (around 50) for export from within a modal window. The idea is that the customer would like to be able to chose multiple fields from a large database table to export in to a report. I don't want to just list 50 field names in a scrolling modal because it is difficult to remember what has been previously selected. The user would have to constantly scroll up and down to confirm their choices. I also don't want to shove all 40 field names in 3 columns in to a small modal window as it doesn't look very aesthetically pleasing.
Comment: Apart from any UI suggestions (e.g. collapsible groups) on _how_ to chose the fields, one thing that may be worth considering (if you haven't already) is allowing users to save a set of selections so they can be used again in the future.
Answer: If there are logical categories you could consider grouping them to make them a little easier to find.
If there are no logical groups them perhaps consider organising them alphabetically like a Rolodex (I used the items in your screenshot to set the letter categories):

You can use styling to help the user identify which letter categories contain selected fields.
Answer: This is one of the original reason that the dual pick list was created.  When you have your source list on the left side a set of controls in the middle and the list of chosen items presented on the right. You keep everything in context for what is available and what has been chosen.  Now if you add to this some of the more modern approaches for the source list like grouping by topic or alpha quick jumps you make thing even easier on the user.  Adding an image for memory jog.

Large export with many fields


Determining Independence of two random variables from joint density function

Question:
I know that to determine whether $X$ and $Y$ are independent I have to find the marginal distributions of $X$ and $Y$.  I've already found the marginal probability density function $f_Y$, but I'm stuck on integrating the joint pdf with respect to $y$ to get the marginal probability density function $f_X$. I've already entered it into integral calculators and none of them were able to find the integral.  Any help would be appreciated!
Answer: There is an easier way:
$$f_Y(y)=Cye^{-y}\int_0^\infty e^{-x/y}dx=Cy^2e^{-y}$$
And, $$f_{X|Y=y}(x)=\frac{f_{X,Y}(x,y)}{f_Y(y)}=\frac{Cye^{-y-x/y}}{Cy^2e^{-y}}=\frac{1}{y}e^{-x/y}$$
The term $y$ hasn't vanished in the conditional density of $X$; so $f_{X|Y=y}(x)\neq f_X(x)$ in general, which means they're not independent.
Answer: There is an even easier way here.  If $X$ and $Y$ are independent then the joint density kernel will be seperable, meaning that you can split it as:
$$f(x,y) \propto g(x) h(y).$$
In the present case you have a term $e^{-x/y}$ in the density, and there is no way to seperate this term into a product of functions of $x$ and $y$.  Therefore your random variables are not independent.


I want to compare the effect of alcohol ban. I have some variables like income before and after ban. How can i compare them statistically

Question: I am doing a project on effect of alcohol ban on women and children. My objectives are effect on violence,income etc.. I have collected the data like domestic violence before and after ban, income before and after ban etc... . How can I compare these before and after data statistically?
Answer: The best way to estimate causal impact is to conduct a controlled experiment before the intervention (the alcohol ban in your case) and perform some statistical test (such as t test) on it.
But you want to estimate the causal impact of a intervention that is already happened, standard controlled experiments no longer work. You need to apply some counter factual analysis techniques to deal with such a situation.
The idea of counter factual analysis is using statistical models to "mimic" the behavior of the control group as if the intervention didn't happen. There are two models most popular in this field. You can pick one based on your own situation:

Model1: Difference-in-difference(DID). It's a simple yet effective model; you can find its descriptions everywhere.
Model2: Structural time series. It's more flexible than DID. Here's a paper describing how to use Bayesian structural time series for causal impact analysis: Brodersen, Kay H., et al. "Inferring causal impact using Bayesian structural time-series models." The Annals of Applied Statistics 9.1 (2015): 247-274 They even have a R package for it.
Comment: (+1) Helpful! Corrected "casual" to "causal". Must be in the top ten statistics typos.
Comment: @NickCox Thanks! Yes I made that same mistake so many times and it just won't stop comming ;-)
Answer: Paired sample t-test will be useful, when the data has the pairs of before and after an event and if you want the analyse the significance of the difference of the values between before and after the event.


Accessing and Modifying AppDelegate OUTSIDE Itself

Question: In my viewController, there's an object of a custom PolyShape class. The main variable of it is the number of sides and this modifies everything else in the app.
I'm trying to use the AppDelegate and NSUserDefaults to store the number of sides on the NSUserDefault, but my problem is communicating between the AppDelegate and my viewController.
I saw that you can make a call to the AppDelegate with this line of code
    YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
which doesn't seem to work for me.
But supposing this DID work and I was able to call the value out of the AppDelegate, how would I write it back in the the app is about to close? Here's my code so far:
<code>@synthesize window = _window;
@synthesize polySides;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self setPolySides: [[NSUserDefaults standardUserDefaults] integerForKey:@"polysides"]];

    [self.window makeKeyAndVisible];
    return YES;
}

- (void)applicationWillResignActive:(UIApplication *)application {
    /*
    Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    */
    [[NSUserDefaults standardUserDefaults] setInteger: self.polySides forKey:@"polysides"];
}

- (void)applicationDidEnterBackground:(UIApplication *)application {
    /*
    Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
 If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    */
    [[NSUserDefaults standardUserDefaults] setInteger: self.polySides forKey:@"polysides"];
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    /*
    Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    */
    [self setPolySides: [[NSUserDefaults standardUserDefaults] integerForKey:@"polysides"]];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    /*
    Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    */
}

- (void)applicationWillTerminate:(UIApplication *)application {
    /*
    Called when the application is about to terminate.
    Save data if appropriate.
    See also applicationDidEnterBackground:.
    */
    [[NSUserDefaults standardUserDefaults] setInteger:polygon.numberOfSides forKey:@"polysides"];
}

- (void)dealloc {
    [_window release];
    [super dealloc];
}
</code>
EDIT: I guess I wasn't clear. What I want to be able to do is the following:
<code>[[NSUserDefaults standardUserDefaults] setInteger: polygon.numberOfSides forKey: @"polysides"];
</code>
where polygon is an object in my controller. Similarly I'd like to be able to do
<code>[polygon.setNumberOfSides: [[NSUserDefaults standardDefaults] integerForKey: @"polysides"];
</code>
Answer: You need to synchronize your defaults after you do a set:
<code>NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setInteger: self.polySides forKey:@"polysides"];
[defaults synchronize];
</code>
Comment: Okay, useful, but doesn't answer my question. What I want (and I guess I should've been more clear) is to be able to do

[[NSUserDefaults standardUserDefaults] setInteger: polygon.numberOfSides forKey: @"polysides"];

where polygon is an object in my controller.

Similarly I'd like to be able to do

[polygon.setNumberOfSides: [[NSUserDefaults standardDefaults] integerForKey: @"polysides"];


Asynchronous vs synchronous execution. What is the difference?

Question: What is the difference between asynchronous and synchronous execution?
Comment: I used to confuse both terms, and the way I did to remember the difference is throw the first "A" in "**A**JAX" which stands for asynchronous, in JavaScript when you do requests with AJAX in a loop they don't wait for each others or block the process, because the browser doesn't want to impact the user experience with a frozen website, all requests are sent almost at the same time without waiting the response of the previous request. That is **asynchronous**
Comment: Well, I don't think the answers explain the original motivation for the terminology. But here's my take from what I came to know so far:
synchronous - act based on a point of time, like the end of a timeout.
asynchronous - act based on an event happening, irrespective of time
These terms make a lot of sense when put this way. However, the meaning of 'synchronous' is being twisted in this particular context.
Comment: this question is [discussed at meta](https://meta.stackoverflow.com/q/420519/839601)
Comment: ... or "sequential vs parallel" execution ... although true parallelism requires multiple cores, otherwise it's logically interleaved.
Answer: When you execute something synchronously, you wait for it to finish before moving on to another task. When you execute something asynchronously, you can move on to another task before it finishes.
In the context of operating systems, this corresponds to executing a process or task on a "thread." A thread is a series of commands (a block of code) that exist as a unit of work. The operating system runs a given thread on a processor core. However, a processor core can only execute a single thread at once. It has no concept of running multiple threads simultaneously. The operating system can provide the illusion of running multiple threads at once by running each thread for a small slice of time (such as 1ms), and continuously switching between threads.
Now, if you introduce multiple processor cores into the mix, then threads CAN execute at the same time. The operating system can allocate time to one thread on the first processor core, then allocate the same block of time to another thread on a different processor core.  All of this is about allowing the operating system to manage the completion of your task while you can go on in your code and do other things.
Asynchronous programming is a complicated topic because of the semantics of how things tie together when you can do them at the same time. There are numerous articles and books on the subject; have a look!
Comment: Oddly enough "Synchronously" means "using the same clock" so when two instructions are synchronous they use the same clock and must happen one after the other.
"Asynchronous" means "not using the same clock" so the instructions are not concerned with being in step with each other.
That's why it looks backwards, the term is not referring to the instructions relationship to each other. It's referring to each instructions relationship to the clock.
Hope that helps.
Comment: What absolutely confuses me is that synchronous means "at the same time", yet when used in the sense above, it means *sequential*, and asynchronous means "not at the same time"...?? Can somebody explain this conflict?
Comment: @Zenph: In this context, an entire block of code is what we're concerned with. Synchronous means that the block is executed at the same time (though, yes, the components are executed sequentially). Asynchronous means that the block is not all executed at the same time.
Comment: The terms come from engineering.  https://en.wikipedia.org/wiki/Asynchronous_system
Comment: Asynchronous execution also happens when a program sends a message to a queue (as in messaging systems, such as ActiveMQ, WebSphere MQ, HornetQ, MSMQ, etc.).  In this case, the asynchronous call doesn't involve multithread programming or handling concurrency at the OS level.
Comment: Actually, "Synchronized" means "connected", or "dependent"  in some way. in other words the two tasks must be aware of one another, and one must execute in some way that is dependent on the other. In mist cases that means that one cannot start until the other has completed. Asynchronous means they are totally independent and neither one must consider the other in any way in initiation or in execution.
Comment: Asynchronity doesn't automatically translate into executing code on another thread. For example the WPF message pump allows to perform asynchronous operations on one single thread.
Comment: @AdamRobinson, synchronous/asynchronous doesn't have to do with multi-threading. JavaScript is well asynchronous and yet single-threaded. In any case, multi-threading is a way to implement asynchronous processing, but not the only one.
Comment: (a)synchronicity is not at all inherently related to threads. I think this is very misleading. also, see: https://blog.stephencleary.com/2013/11/there-is-no-thread.html
Comment: @DamienRoche  synchronous means "at the same time **line**"
Comment: @DamienRoche You can blame the trappings of English traps, my friend. It's all too common to mix up **a**word with **anti**word. It doesn't help that many native English speakers mix these up too. Going by the synchronous definition you provided, the crux here is that **a**synchronous has no concept or respect for time, ergo it isn't synchronous by its very nature.
Comment: Perhaps also worth mentioning that the threads may be in the kernel, with user-space taking advantage of them with a single thread using non-blocking mechanisms like select(2) or asynchronous mechanisms like I/O completion ports.
Comment: @committedandroider: A `Task` generally takes place on a thread (though some things like file and network operations would also make use of IO completion threads, which are different) but is almost never a thread itself. By default, the threads used to execute tasks come from the thread pool; they are not spun up individually for each task and shut down upon its completion.
Comment: Thanks for the multiple attempts to explain the confusing apparent opposite meaning of the terms. Yet it will take some more pondering for me to get convinced that they're as explained above, not the opposite.
Comment: Is task generally a thread?
Comment: Excellent, perfect answer. Indeed, it is very tricky to get two threads to work together properly on a mid-level of the stack. For example, I am using Delphi's `TThread` predominantly for multi-threading. It does a great job of implementing threads, where they get split by the OS on different cores automagically. But, any developer must still really pay close attention to how each thread interacts with each other. It's not always a trivial task. I've come to rely on event-driven threads.
Comment: @TomPadilla thank you for your clarity.  I knew I had two concepts in my head that needed reconciliation.  It was more ironic because not being dependent on a clock in asynchronous communication in engineering (using handshakes, etc) looks remarkably like synchronous communication in computer science..  I still feel as if computer science should have used a different term.
Answer: Synchronous/Asynchronous HAS NOTHING TO DO WITH MULTI-THREADING.
Synchronous or Synchronized means "connected", or "dependent" in some way. In other words, two synchronous tasks must be aware of one another, and one task must execute in some way that is dependent on the other, such as wait to start until the other task has completed.
Asynchronous means they are totally independent and neither one must consider the other in any way, either in the initiation or in execution.
Synchronous (one thread):
1 thread ->   |<---A---->||<----B---------->||<------C----->|

Synchronous (multi-threaded):
thread A -> |<---A---->|
                        \
thread B ------------>   ->|<----B---------->|
                                              \
thread C ---------------------------------->   ->|<------C----->|

Asynchronous (one thread):
         A-Start ------------------------------------------ A-End
           | B-Start -----------------------------------------|--- B-End
           |    |      C-Start ------------------- C-End      |      |
           |    |       |                           |         |      |
           V    V       V                           V         V      V
1 thread->|<-A-|<--B---|<-C-|-A-|-C-|--A--|-B-|--C-->|---A---->|--B-->|

Asynchronous (multi-Threaded):
 thread A ->     |<---A---->|
 thread B ----->     |<----B---------->|
 thread C --------->     |<------C--------->|

Start and end points of tasks A, B, C represented by <, > characters.
CPU time slices represented by vertical bars |

Technically, the concept of synchronous/asynchronous really does not have anything to do with threads. Although, in general, it is unusual to find asynchronous tasks running on the same thread, it is possible, (see below for examples) and it is common to find two or more tasks executing synchronously on separate threads... No, the concept of synchronous/asynchronous has to do solely with whether or not a second or subsequent task can be initiated before the other (first) task has completed, or whether it must wait.  That is all.  What thread (or threads), or processes, or CPUs, or indeed, what hardware, the task[s] are executed on is not relevant. Indeed, to make this point I have edited the graphics to show this.

ASYNCHRONOUS EXAMPLE:
In solving many engineering problems, the software is designed to split up the overall problem into multiple individual tasks and then execute them asynchronously. Inverting a matrix, or a finite element analysis problem, are good examples. In computing, sorting a list is an example. The quicksort routine, for example, splits the list into two lists and performs a quicksort on each of them, calling itself (quicksort) recursively.  In both of the above examples, the two tasks can (and often were) executed asynchronously. They do not need to be on separate threads. Even a machine with one CPU and only one thread of execution can be coded to initiate processing of a second task before the first one has completed. The only criterion is that the results of one task are not necessary as inputs to the other task. As long as the start and end times of the tasks overlap, (possible only if the output of neither is needed as inputs to the other), they are being executed asynchronously, no matter how many threads are in use.
SYNCHRONOUS EXAMPLE:
Any process consisting of multiple tasks where the tasks must be executed in sequence, but one must be executed on another machine (Fetch and/or update data, get a stock quote from financial service, etc.).   If it's on a separate machine it is on a separate thread, whether synchronous or asynchronous.
Comment: why in the world do words mean different things in computer...always leave me coming back to this...from dictionary.. synchronous: **occurring at the same time.** asynchronous: **not occurring at the same time.**
Comment: but as you can see in computers it means the opposite
Comment: @MuhammadUmer: in computer world, occurring at the same time is called concurrency.
Comment: Maybe the nomenclature is based on whether initiation of tasks is "synchronized" with completion of other tasks?
Comment: IMHO, these pictures do not all describe the synchronous vs asycnhronous execution of tasks  For example, the second picture implies that asynchronous tasks require several threads. Actually, it does not. And that tasks have to run in parallel, which is not a requirement as well.  Or, the picture for "synchronous" very well shows how tasks have been asynchronously dispatched form some call-site and now execute in a serial task scheduler ;)  IMO, the pictures are misleading.
Comment: Actually, CouchDeveloper, the picture implies nothing about threads at all.  It simply implies, or represents, that when multiple tasks are executed asynchronously, the second and subsequent tasks can begin before the preceding  ones have finished, whereas when they are executed synchronously, they have to wait until all preceding tasks have completed.  Whether they are on different threads (or different processes), on the same machine, on different machines, or on the same thread on a single CPU machine, where the thread is constantly switching between one task and the others, is irrelevant.
Comment: @Mandroid, Sure, look at early Unix Operating system running on 8086 or 8088 processors. They had only one CPU, so, by definition, they had only one physical thread, and yet it was a multi-Processing OS. (although within the OS code, it created multiple "logical" threads to organize the multiple tasks they were executing.) But even on only one logical thread, I could code a procedural program that interspersed instructions to perform one task with other instructions that performed a second task - even one completely unrelated to the first one.
Comment: @Mandroid, A common example is in recursive engineering problems, like inverting a matrix, or a Finite Element Analysis problem. In these software algorithms, the overall routine divides the problem into multiple smaller pieces, each of which can be solved independently of the others. The overall routine sets up, initiates and executes the multiple pieces in an overlapping fashion, like my diagram above labeled *Asynchronous (one thread)*. Sometimes the results must be combined to generate the overall result of the process, and sometimes not.
Comment: @Mandroid:  A typical example might be "threads" in python (`threading` package).  They allow you to do work _concurrently_---in a given _interval_, progress can be made on multiple tasks.  But at a given _instant_ in time, only one task is actually being operated on (so you can't take advantage of multiple CPUs).  The key idea here is "interruptibility"---work can be halted on one thread while it's performed on another.  Useful in Python for I/O-bound tasks but not CPU-bound tasks.
Comment: Most of us here (including myself) probably better understand things visually, so +1 for the ASCII art charts :D
Comment: No. It is silly to apply the terms synchronous/asynchronous, or single/multi-threaded to a programming language. You can write a software algorithm in any language that will execute in any one of these four modes, (depending on the OS and hardware it is executing on.
Comment: @CharlesBretana   I suppose concurrency cannot be achieved with synchronous execution and this(concurrency) can be done only submitting work items asynchronously. If you feel it might be relevant for other readers, please edit your response and shed some light regarding this topic as I feel they are all closely related.
Comment: @bibscy,  I'm not sure what you mean by "concurrency cannot be achieved with synchronous execution".  If you understand my post, then this statement is tautological.  Obviously, if one task is dependent on the results of another, (the definition of synchronous), then they cannot be run concurrently.  And if two tasks must be synchronized, then of course, you cannot "submit them asynchronously" Where is the dependent one getting the data it needs from completion of the other one?
Comment: @Dean,  in this context Synchronous does not mean "at the same time", it means "synchronized with" as in it must be executed or performed "in coordination" with or "in conjunction" with, the other task. "Concurrent": means "at the same time". Concurrent and Synchronous are totally different concepts. "Synchronizing" one task to run "at the same time" as another is not the *only* way a task can be "synchronized" with another. A Task can be "synchronized" to run 12 hours after another. That too would be synchronized.
Comment: @CharlesBretana, thanks for this answer. You say...'Even a machine with one CPU, and only one thread of execution can be coded to initiate processing of a second task before a first one has completed.', Can you please name some programming constructs which help in achieving this?
Comment: @Muhammad, here some good answers on SO:
http://stackoverflow.com/questions/7131991/asynchronous-and-synchronous-terms
http://stackoverflow.com/questions/1596589/why-are-asynchronous-processes-not-called-synchronous
Comment: Reversed edit,  Asynchronous means there is only ONE logical thread of execution, so there can be NO overlap.  Not even for one cpu clock cycle.  The start point of task two MUST be after the end of task one.
Comment: Synchronous because operation A is still running while the remote procedure (disk write, network fetch...) completes; asynchronous because it stops.
Comment: @MuhammadUmer - I came here with the same question. Synchronous means 'at the same time', of course, not any other redefinition just for computers, and the two things that are as nearly at the same time as possible are the beginning and end of a task. Per the boss picture above, the worker can't do anything else till they are done with the task, so they effectively are putting nothing in between beginning the work and completing it - so, completing it *synchronously*. Hope that helps!
Comment: @CharlesBretana, again confusing synchronous/asynchronous processing with multi-threading.
Comment: So glad I found this answer. I have been confused about this for a very long time, and had almost given up all hopes of ever understanding it. Now, it has all started making sense, thanks to your emphasis on "synchronous/asynchronous really does not have anything to do with threads".
Comment: "Asynchronous means they are totally independent & neither one must consider the other in any way, either in initiation or in execution."
Above quote is too strict, narrow, & conflicts with the definition of Asynchronous System & Asynchronous Circuit on Wikipedia.
OP didn't use the term "multi-threading."
Event-loop languages have 'sync' & 'async' functions. Former must COMPLETE work before next function begins. Latter requires a call-back-function parameter, & immediate execution of a subsequent function begins, but it's work is not complete yet, & when it is, the call-back will be fired.
Comment: Jaycephus,  Your objections are dependent on how you define "next function". In a routine that inverts a matrix, (or, for another example,  the quicksort algorithm), where the main algorithm recursively divides the problem into multiple smaller problems, is that synchronous or asynchronous? Which problem or problems is/are the "next" one?  Which is/are the "callback"?
Comment: amazing explanation, thank you.
Asynchronous (one thread) and Synchronous (one thread) example is here https://github.com/pavoltravnik/async
Comment: So JavaScript is an asynchronus, single threaded language then?
Answer: In simpler terms:
SYNCHRONOUS
You are in a queue to get a movie ticket. You cannot get one until everybody in front of you gets one, and the same applies to the people queued behind you.
ASYNCHRONOUS
You are in a restaurant with many other people. You order your food. Other people can also order their food, they don't have to wait for your food to be cooked and served to you before they can order.
In the kitchen restaurant workers are continuously cooking, serving, and taking orders.
People will get their food served as soon as it is cooked.
Comment: If someone wants apples compared with apples; if you wanted the restaurant scenario to be synchronous, then when you order food, everyone else in the restaurant would have to wait for your food to arrive before they can order their food etc. Now this seems like a really dumb scenario to be in, but in the computing world this scenario could be useful. Say each customer cant decide what they want, and instead want to look at what the previous customer orders to decide if they want that or not, then it makes sense that they have to wait for the food to arrive before ordering.
Comment: To push your example even further, they could consider several gates for selling tickets. Therefore, each line can work asynchronously from the other line but synchronously within itself!
Comment: Just to add on... it could be so that the operations execute like in a queue in Asynchronous operations...
But that is not mandatory at all.
Answer: Simple Explanation via analogy

(story & pics given to help you remember).
Synchronous Execution
My boss is a busy man. He tells me to write code. I tell him: Fine. I get started and he's watching me like a vulture, standing behind me, off my shoulder. I'm like "Dude, WTF: why don't you go and do something while I finish this?"
he's like: "No, I'm waiting right here until you finish." This is synchronous.
Asynchronous Execution
The boss tells me to do it, and rather than waiting right there for my work, the boss goes off and does other tasks. When I finish my job I simply report to my boss and say: "I'm DONE!" This is Asynchronous Execution.
(Take my advice: NEVER work with the boss behind you.)
Comment: @GrayProgrammerz ...to be explicit: `synchronous`: you can have 2 hands, but the second hand must  work only after the first hand is done.
Comment: `Synchronous` work with `1` hand at a time. `Asynchronous` work with `2` hands at a time.
Answer: Synchronous execution means the execution happens in a single series.  A->B->C->D.  If you are calling those routines, A will run, then finish, then B will start, then finish, then C will start, etc.
With Asynchronous execution, you begin a routine, and let it run in the background while you start your next, then at some point, say "wait for this to finish".  It's more like:
Start A->B->C->D->Wait for A to finish
The advantage is that you can execute B, C, and or D while A is still running (in the background, on a separate thread), so you can take better advantage of your resources and have fewer "hangs" or "waits".
Comment: @Devrath The operations can finish in any order.
Comment: @ Reed Copsey ...... Thanks for such a good explanation ..... Just wanted some more info on Async-Exec ...... Based on your answer in Async Exec .... Start A->B->C->D->Wait for A to finish ... So all A,B, C, D starts at a time ...... and they wait for A to finish ..... So does B will only finish after A finishes , and C after B and so on ...... ? Or can B first finish and then A can finish ?
Answer: In a nutshell, synchronization refers to two or more processes' start and end points, NOT their executions.  In this example, Process A's endpoint is synchronized with Process B's start point:

SYNCHRONOUS
   |--------A--------|
                     |--------B--------|

Asynchronous processes, on the other hand, do not have their start and endpoints synchronized:

ASYNCHRONOUS
   |--------A--------|
         |--------B--------|

Where Process A overlaps Process B, they're running concurrently or synchronously (dictionary definition), hence the confusion.
UPDATE: Charles Bretana improved his answer, so this answer is now just a simple (potentially oversimplified) mnemonic.
Comment: copy of Charles Bretana answer
Comment: @DineshSaini  - My diagram is slightly different .  For clarity, I placed A on top of B in both cases, emphasizing whether their start & endpoints are synchronized.  Charles Bretana's diagram places the synchronous processes in sequence without "syncing" anything.  (I was going to comment below his answer to "improve" it, but realized it would be easier just to show the new diagram.)
Comment: Great diagrams. I think the way to call the top one SYNC, is that the start and end of A in the top diagram are effectively at the same time, in the sense that no other events have intervened, or could have interfered with A's completion. Sync can refer to a single task in isolation, like adding to CPU registers, whose start and end are so close, as to effectively be actually dictionary-synchronous.
Answer: Synchronous means that the caller waits for the response or completion, asynchronous that the caller continues and a response comes later (if applicable).
As an example:
static void Main(string[] args)
{
    Console.WriteLine("Before call");
    doSomething();
    Console.WriteLine("After call");
}

private static void doSomething()
{
    Console.WriteLine("In call");
}

This will always ouput:
Before call
In call
After call

But if we were to make doSomething() asynchronous (multiple ways to do it), then the output could become:
Before call
After call
In call

Because the method making the asynchronous call would immediately continue with the next line of code.  I say "could", because order of execution can't be guaranteed with asynch operations.  It could also execute as the original, depending on thread timings, etc.
Answer: Sync vs Async
Sync and async operations are about execution order a next task in relation to the current task.
Let's take a look at example where Task  2 is current task and Task 3 is a next task. Task is an atomic operation - method call in a stack (method frame).
Synchronous
Implies that tasks will be executed one by one. A next task is started only after current task is finished. Task 3 is not started until Task 2 is finished.
Single Thread + Sync - Sequential
Usual execution.
Pseudocode:
main() {
    task1()
    task2()
    task3()
}

Multi Thread + Sync - Parallel
Blocked.
Blocked means that a thread is just waiting(although it could do something useful. e.g. Java ExecutorService[About] and Future[About]) Pseudocode:
main() {
    task1()
    Future future = ExecutorService.submit(task2())
    future.get() //<- blocked operation
    task3()
}

Asynchronous
Implies that task returns control immediately with a promise to execute a code and notify about result later(e.g. callback, feature). Task 3 is executed even if Task 2 is not finished. async callback, completion handler[About]
Single Thread + Async - Concurrent
Callback Queue (Message Queue) and Event Loop (Run Loop, Looper) are used. Event Loop checks if Thread Stack is empty and if it is true it pushes first item from the Callback Queue into Thread Stack and repeats these steps again. Simple examples are button click, post event...
Pseudocode:
main() {
    task1()
    ThreadMain.handler.post(task2());
    task3()
}

Multi Thread + Async - Concurrent and Parallel
Non-blocking.
For example when you need to make some calculations on another thread without blocking. Pseudocode:
main() {
    task1()

    new Thread(task2()).start();
    //or
    Future future = ExecutorService.submit(task2())

    task3()
}

You are able use result of Task 2 using a blocking method get() or using async callback through a loop.

For example in Mobile world where we have UI/main thread and we need to download something we have several options:

sync block - block UI thread and wait when downloading is done. UI is not responsive.
async callback - create a new tread with a async callback to update UI(is not possible to access UI from non UI thread). Callback hell.
async coroutine[About] - async task with sync syntax. It allows mix downloading task (suspend function) with UI task.

[iOS sync/async], [Android sync/async]
[Paralel vs Concurrent]
Comment: The diagram in the synchronous multi-threaded example appears to depict concurrently executing threads?
Comment: @sαmosΛris you can consider Thread like X axis that indicates timeline
Comment: The x-axis is conventionally used as a spacial dimension; the t-axis for time - an important distinction found in the analysis of algorithm complexity.
Answer: I think this is bit round-about explanation but still it clarifies using real life example.
Small Example:
Let's say playing an audio involves three steps:

Getting the compressed song from harddisk
Decompress the audio.
Play the uncompressed audio.

If your audio player does step 1,2,3 sequentially for every song then it is synchronous. You will have to wait for some time to hear the song till the song actually gets fetched and decompressed.
If your audio player does step 1,2,3 independent of each other, then it is asynchronous. ie.
While playing audio 1 ( step 3), if it fetches audio 3 from harddisk in parallel (step 1) and it decompresses the audio 2 in parallel. (step 2 )
You will end up in hearing the song without waiting much for fetch and decompress.
Answer: I created a gif for explain this, hope to be helpful:
look, line 3 is asynchronous and others are synchronous.
all lines before line 3 should wait until before line finish its work, but because of line 3 is asynchronous, next line (line 4), don't wait for line 3, but line 5 should wait for line 4 to finish its work, and line 6 should wait for line 5 and 7 for 6, because line 4,5,6,7 are not asynchronous.
Answer: Simply said asynchronous execution is doing stuff in the background.
For example if you want to download a file from the internet you might use a synchronous function to do that but it will block your thread until the file finished downloading. This can make your application unresponsive to any user input.
Instead you could download the file in the background using asynchronous method. In this case the download function returns immediately and program execution continues normally. All the download operations are done in the background and your program will be notified when it's finished.
Comment: It doesn't have to faster. It's about not blocking the main thread, so that it can process other kind of user input. For example user might want to cancel the download or start downloading another file simultaneously.
Comment: how is your example gonna be faster.  In the end you can't play the file until it is done downloading period.  Can you explain?  I guess I don't understand async then and it's probably me but what would that other step or process be doing while the other process is running (getting the download)?  I mean what can you do until you receive that async process back (download) in your app...I don't get it.  So what, you'd still have to show the user some kind of wait mechanism no mater what in either situation?
Answer: As a really simple example,
SYNCHRONOUS
Imagine 3 school students instructed to run a relay race on a road.
1st student runs her given distance, stops and passes the baton to the 2nd. No one else has started to run.
1------>
        2.
                3.

When the 2nd student retrieves the baton, she starts to run her given distance.
      1.
        2------>
                3.

The 2nd student got her shoelace untied. Now she has stopped and tying up again. Because of this, 2nd's end time has got extended and the 3rd's starting time has got delayed.
      1.
        --2.--->
                3.

This pattern continues on till the 3rd retrieves the baton from 2nd and finishes the race.
ASYNCHRONOUS
Just Imagine 10 random people walking on the same road.
They're not on a queue of course, just randomly walking on different places on the road in different paces.
2nd person's shoelace got untied. She stopped to get it tied up again.
But nobody is waiting for her to get it tied up. Everyone else is still walking the same way they did before, in that same pace of theirs.
10-->    9-->
   8--> 7-->   6-->
 5-->     4-->
1-->   2.    3-->

Answer: Synchronous basically means that you can only execute one thing at a time. Asynchronous means that you can execute multiple things at a time and you don't have to finish executing the current thing in order to move on to next one.
Comment: Multithreading is a type of asynchronous executions, yes.
Comment: Isn't multiple things executing at the same time called Multithreading rather than asynchronous.
Answer: When executing a sequence like: a>b>c>d>, if we get a failure in the middle of execution like:
a
b
c
fail

Then we re-start from the beginning:
a
b
c
d

this is synchronous
If, however, we have the same sequence to execute: a>b>c>d>, and we have a failure in the middle:
a
b
c
fail

...but instead of restarting from the beginning, we re-start from the point of failure:
c
d

...this is know as asynchronous.
Comment: This answer is simply not correct.
Comment: could you please be more precise in what you mean by providing more context to your examples
Answer: An example of instructions for making a breakfast:

Pour a cup of coffee.
Heat a pan, then fry two eggs.
Fry three slices of bacon.
Toast two pieces of bread.
Add butter and jam to the toast.
Pour a glass of orange juice.
If you have experience with cooking, you'd execute those instructions asynchronously. You'd start warming the pan for eggs, then start the bacon. You'd put the bread in the toaster, then start the eggs. At each step of the process, you'd start a task, then turn your attention to tasks that are ready for your attention.

Cooking breakfast is a good example of asynchronous work that isn't parallel. One person (or thread) can handle all these tasks. Continuing the breakfast analogy, one person can make breakfast asynchronously by starting the next task before the first task completes. The cooking progresses whether or not someone is watching it. As soon as you start warming the pan for the eggs, you can begin frying the bacon. Once the bacon starts, you can put the bread into the toaster.
For a parallel algorithm, you'd need multiple cooks (or threads). One would make the eggs, one the bacon, and so on. Each one would be focused on just that one task. Each cook (or thread) would be blocked synchronously waiting for the bacon to be ready to flip, or the toast to pop.

(emphasis mine)
From Asynchronous programming concepts
Answer: A synchronous operation does its work before returning to the caller.
An asynchronous operation does (most or all of) its work after returning to the caller.
Answer: You are confusing Synchronous with Parallel vs Series. Synchronous mean all at the same time. Syncronized means related to each othere which can mean in series or at a fixed interval.  While the program is doing all, it it running in series. Get a dictionary...this is why we have unsweet tea.  You have tea or sweetened tea.
Comment: Actually, "synchronized" refers to the relationship between the instructions and the clock. NOT the relationship between the instructions themselves.
That's why it looks backwards "synchronous" actually means one after another: but the instructions are SYNCHRONIZED to the clock. "Asynchronous" means "at any time, I don't care when it happens": the instructions need not be synchronized to the clock. Yes, there is a dictionary definition, but you must make sure you are defining the correct situation.
Comment: Synchronous does *not* mean 'all at the same time' in computing. You are confusing synchronization with synchronous, and 'parallel versus series' with tea and sweet tea. Answer makes no sense whatsoever.
Answer: A different english definition of Synchronize is Here

Coordinate; combine.

I think that is a better definition than of "Happening at the same time". That one is also a definition, but I don't think it is the one that fits the way it is used in Computer Science.
So an asynchronous task is not co-coordinated with other tasks, whereas a synchronous task IS co-coordinated with other tasks, so one finishes before another starts.
How that is achieved is a different question.
Answer: I think a good way to think of it is a classic running Relay Race
Synchronous: Processes like members of the same team, they won't execute until they receive baton (end of the execution of previous process/runner) and yet they are all acting in sync with each other.
Asynchronous: Where processes like members of different teams on the same relay race track, they will run and stop, async with each other, but within same race (overall program execution).
Does it make sense?
Answer: Synchronous means queue way execution one by one task will be executed. Suppose there is only vehicle that need to be share among friend to reach their destination one by one vehicle will be share.
In asynchronous case each friend can get rented vehicle and reach its destination.
Answer: In regards to the "at the same time" definition of synchronous execution (which is sometimes confusing), here's a good way to understand it:
Synchronous Execution: All tasks within a block of code are all executed at the same time.
Asynchronous Execution: All tasks within a block of code are not all executed at the same time.
Comment: I would agree with this more if you said 'effectively at the same time', or 'for practical purposes'.. I think the downvote was for the inaccurate statement that things *actually* are getting done at the same tiem.
Answer: Yes synchronous means at the same time, literally, it means doing work all together. multiple human/objects in the world can do multiple things at the same time but if we look at computer, it says synchronous means where the processes work together that means the processes are dependent on the return of one another and that's why they get executed one after another in proper sequence. Whereas asynchronous means where processes don't work together, they may work at the same time(if are on multithread), but work independently.


How much is an undergraduate student paid during fulltime internship in a research lab in India?

Question: An 3rd year undergraduate computer science student is doing several months full time internship at a research lab in the university. What is an usual budget for such a student per month?
Answer: I am an Indian student as well. The only time I have seen undergrad research students being paid is through fellowships/scholarships.
For example, the Indian Academy of Sciences Summer Research Fellowship Program pays research interns of about INR 8000 - 12,500 for 2 months (the last time I checked).
Some institutions hold their own summer research programs every year, which also provide a stipend such as IIT Kanpur's SURGE, which provides a stipend of INR 12,500 for 8 weeks.
Some of the foreign summer internships like Caltech SURF, MITACS Globalink Research Internship, DAAD-WISE pay much better.
But if you are conducting research with a professor directly, i.e. not through a scholarship or a fellowship, it's not common to get paid. This is especially true if you are working as an undergraduate researcher at your own university.
Even in the rare situation that you had the opportunity to get a stipend, it should have been discussed upfront before the internship began.
As shk92 says in his answer, it is considered that the biggest gain for a student is valuable research experience.
So, should you ask your advisor if you can get paid for your internship now?
Here's my suggestion:

How would your professor take it if you made the request? Is it possible he might get angry and think you are being entitled? Will it possibly affect your internship in the future? If you think he is understanding and would consider it, then go through with the next steps. If not, do not bring it up.
Make sure you have made sizable contributions to the project so far.
Ask your professor if you can get a stipend, highlighting the work you have done so far and future contributions you plan to make. Make sure you do not come off as arrogant.
Be prepared for a 'No'.
Comment: @student: This is a well thought, good written answer. Can you please have a look by yourself? The link has been provided, I repeat it here for your convenience https://www2.daad.de/deutschland/stipendium/datenbank/en/21148-scholarship-database/?detail=50015295
Comment: Thank you! When you say that Caltech SURF, MITACS Globalink Research Internship, DAAD-WISE pay much better, how much it can be? Two-three times more ?
Comment: @student yeah the stipend can go to lakhs for 2-3 months. But unfortunately, the application period for them is over for this year and I believe they take in only 3rd year undergrads.
Comment: Thank you very much.
Answer: Based on my experience in the US, undergraduates working in a university research lab are not paid anything. There are exceptions of course, but they are quite rare.
I'm not sure if "PI" is a common term in India. Just clarifying here that "PI" means Principal Investigator i.e. the person in charge of the lab and its research output and is also the one responsible for obtaining funds for it.
When it comes to undergraduate research, there is a quid pro quo. The PI helps the student gain valuable research experience and the student in turn helps the PI complete a few small projects or helps another graduate student with theirs. And in most cases, the student is the one that benefits the most as they are nowhere close to the level of competence required to complete a project on their own with minimal supervision from the PI.
So to answer your question "What is the budget for such a student?"
Most likely zero. You are paid with research experience. You might think it sucks and is unfair but that is a discussion for another day.
If you want to get paid, you need to go in with a strategy. You can't just go to the PI and say "I am expecting to get paid for my work." You need to have a few key points where you clarify the value you are bringing to their group and that it would benefit them from having you around. If they can let you go instead of paying you and have zero effect on their output, they're going to let you go as soon as you insist on getting paid.
Comment: I would note that practices for paying undergrads for research vary [_widely_](https://academia.meta.stackexchange.com/questions/4471/academia-varies-more-than-you-think-it-does-the-movie), even among US institutions. I have no idea what is customary in India, but I would hesitate to make assumptions based only on my experiences in the US.
Comment: Thank you for the answer!


cx_Oracle And User Defined Types

Question: Does anyone know an easier way to work with user defined types in Oracle using cx_Oracle?
For example, if I have these two types:
CREATE type my_type as object(
component   varchar2(30)
,key    varchar2(100)
,value   varchar2(4000))
/
CREATE type my_type_tab as table of my_type
/

And then a procedure in package my_package as follows:
PROCEDURE my_procedure (param  in  my_type_tab);

To execute the procedure in PL/SQL I can do something like this:
declare
  l_parms   my_type_tab;
  l_cnt     pls_integer;
begin
  l_parms := my_type_tab();
  l_parms.extend;
  l_cnt := l_parms.count;
  l_parms(l_cnt) := my_type('foo','bar','hello');
  l_parms.extend;
  l_cnt := l_parms.count;
  l_parms(l_cnt) := my_type('faz','baz','world');
  my_package.my_procedure(l_parms);
end;

However, I was wondering how I can do it in Python, similar to this code:
import cx_Oracle
orcl = cx_Oracle.connect('foo:firstname.lastname@example.com:5555/blah' + instance)
curs = orcl.cursor()
params = ???
curs.execute('begin my_package.my_procedure(:params)', params=params)

If the parameter was a string I can do this as above, but since it's an user-defined type, I have no idea how to call it without resorting to pure PL/SQL code.
Edit: Sorry, I should have said that I was looking for ways to do more in Python code instead of PL/SQL.
Answer: While cx_Oracle can select user defined types, it does not to my knowledge support passing in user defined types as bind variables.  So for example the following will work:
cursor.execute("select my_type('foo', 'bar', 'hello') from dual")
val, = cursor.fetchone()
print val.COMPONENT, val.KEY, val.VALUE

However what you can't do is construct a Python object, pass it in as an input argument and then have cx_Oracle "translate" the Python object into your Oracle type.  So I would say you're going to have to construct your input argument within a PL/SQL block.
You can pass in Python lists, so the following should work:
components=["foo", "faz"]
values=["bar", "baz"]
keys=["hello", "world"]
cursor.execute("""
declare
  type udt_StringList is table of varchar2(4000) index by binary_integer;
  l_components udt_StringList := :p_components;
  l_keys udt_StringList := :p_keys;
  l_values udt_StringList := :p_values;
  l_parms my_type_tab;
begin
  l_parms.extend(l_components.count);
  for i in 1..l_components.count loop
    l_parms(i) := my_type(l_components(i), l_keys(i), l_values(i));
  end loop;

  my_package.my_procedure(l_parms);
end;""", p_components=components, p_values=values, p_keys=keys)

Answer: Are you trying to populate the table of objects more efficiently?
If you can do a SELECT, have a look at the BULK COLLECT INTO clause
Answer: I'm not quite sure what you mean by hard-coded, but you can build a dynamic array like this:
SQL> desc my_procedure
Parameter Type        Mode Default?
--------- ----------- ---- --------
P_IN      MY_TYPE_TAB IN

SQL> declare
  2     l_tab my_type_tab;
  3  begin
  4     select my_type(owner, table_name, column_name)
  5       bulk collect into l_tab
  6       from all_tab_columns
  7      where rownum <= 10;
  8     my_procedure (l_tab);
  9  end;
 10  /

PL/SQL procedure successfully completed

This has been tested with Oracle 22.214.171.124.

cx_Oracle And User Defined Types


My bouquet of roses has green leafs. Can I plant them?

Question:
So I got these for my birthday and they have lasted about a month. I've noticed the green leafs and would like to replant them. How can I do that?
Answer: The new growth does suggest there is some life left in those cuttings. Many roses grow readily from semi-ripe and hardwood cuttings. Why not give it a go? It is a long shot to use stems that have just flowered, but you might get some free plants out of it.
They'll need tidying up first. If the stems have gone soft in the area submerged, remove the soft bit. Next, remove any flowers and flower buds. You are aiming to produce a cutting that has a couple of nodes (leaves removed if present) below the level of the compost to produce roots and a couple above the level of the compost to produce new shoots. Remove all bar one leaf per cutting (starting with the old leaves) - too many leaves will cause the cutting to lose water too quickly. Then insert into a free draining compost mix - John Innes no. 1 or similar. Don't let them get too hot, indirect light will be best. Don't forget to water them but don't sit them in a deep tray of water or they will rot. Protect from frost - be aware that a lot of roses sold as cut flower markets are produced in warmer climes (than the UK where I am) and are bred for those conditions.
Comment: Awesome. I still have them in a vase. They are dry but smell good and the green is growing. I'll do that and keep them indoors in a smaller plant. If they catch, I'll move them to the back yard.


C# GTK Drag and Drop

Question: I'm trying to make application in GTK and I need to make make my application able to drag item from one listview to another. Is it possible? If yes, please place me here example or tutorial website.
Note: I'm using C# in MonoDevelop 2.4
Answer: Is it Possible?
Yes! It is possible and not that difficult to implement. (Especially if you are using a high level language like C#.)
Example or Tutorial Website?
If you want Drag And Drop in Gtk, then I think what you are looking for is the Gtk.Drag Class. You can see it's usage in the Mono-Project Docs. There is also a tutorial available at Gnome.org . Although the tutorial is for GTK+ , it shouldn't be too hard to port it for use with GTK#. I am not sure if I can find valid tutorials for Drag and Drop in Gtk.ListView, but you can get the general idea by seeing this PyGTK tutorial on Drag and Drop with Gtk.Treeview : Tutorial Link. and this Gtkmm one : Tutorial Link .
There is another GTK+ DND tutorial over here: Tutorial Link . You may also look at the Pyjama Project sources.

C# GTK Drag and Drop


How do I determine the critical number that would the eradicate pests and that it is less than a quarter of the environment carrying capacity

Question: The sterile insect release method for pest control releases a number of sterile insects into a population. If a population n of sterile insects is maintained in a population, a possible simple model for the population of fertile insects N(t) is $\frac{dN}{dt}=[\frac{aN}{N+n}-b]N-kN(N+n)$, s.t. $a>b>0$ and k>0 are constant parameters. How do I determine the critical number of sterile insects $n_{c}$ which would eradicate the pests and show that this is less than a quarter of the environment carrying capacity? I'm having trouble understanding what this is asking of me?
Answer: A stable solution has $dN/dt=0$.  Rearrange the equation $dN/dt=0$ into a cubic polynomial.
When $n=0$, the cubic has three solutions $0,\pm p$, where $p$ is the stable population.
As $n$ increases, the cubic moves.  The solutions that start at $n=0,n=p$ move towards each other until they meet, and disappear.  That is because the cubic's local min moves above the $x$-axis.
It means there is no longer a stable positive solution to the differential equation, so the insects will get wiped out.
So: Find a value of $n$ where the cubic has a positive double-zero.  Or at least, show that there are no positive solutions when $n=p/4$


Does a user need an account to post comments?

Question: I'm working on a blog website and I doubt about forcing users to create accounts to post comments under my blog posts. What is your opinion about this? Is it good from User Experience Aspect?
Comment: A similar question I recently answered exists here: http://ux.stackexchange.com/questions/84808/member-exclusivity-e-commerce-vs-no-sign-up-e-commerce
Comment: However, since your questions is different than purchase, I'm also including an answer below.
Comment: So commenting without loggin is doable? But they need to be logged in as guest?
Answer: The single bad thing about Comments is Spam.
Once your blog starts to get active users, many bots will try to spam the comment section with useless posts redirecting to malicious websites. This is a serious issue since it will also lead to deterioration of  your personal brand with such comments and some might post negative comments which aren't constructive.
I think Account creation for comments should be mandatory and can be easily handled with Disqus and other comment signups which only require you to add a plug-in. And people who read blogs frequently generally have these accounts enabled.
I'm not entirely sure if you want them to create an account on your website or something like Disqus, but I feel comment section is one of the sections of the website that is generally ridiculed with fake links and unnecessary comments so precaution is always appreciated.
This is one reason why Youtube switched from usernames to actual Google+ names and better comment sorting to reduce spam and negative comments.
Comment: wow. very nice answer. one more question. What about social media login. like: login with facebook or gmail account? Is it better or a local account creation?
Comment: Have all three options available. Mostly people click on Login with Facebook, but not everyone is comfortable with connecting their social media accounts to a blog, so you also need a local account option.

Honestly, you need to make the reading experience on a blog as free as possible, accounts should only reflect in comments. So if and only if they want to comment use an account. Disqus is the best in these cases.
Answer: There are another aspect not mentioned in the accepted answer.
In some countries, the owner or administrator of a site may be legally responsible for comments left by anonymous users if the judge considers that insufficient measures have been taken to prevent or eliminate defamatory comments inciting racial hatred, violence, etc.
In Spain there was a case of a singer that was the subject of several defamatory and insulting comments in a web site. The justice found that the site owner didn't supply correct contact data and allowed the users to post comments without any kind of control (those comments included insults, personal data of the artist, beheadad photos, etc) El Supremo confirma la condena a una web por sus comentarios sobre Ramoncín SPANISH

The Supreme Court (TS) has confirmed the condemnation to the administrator of the page XXXXXXX.org to pay 6,000 euros to the singer XXXXXXX for meddling in his right to honor by holding this web responsible for the vexatious opinions expressed by various Internet users against artist.
The condemned appealed this resolution when he estimated that the person responsible for the expressions appearing on the web should be the user who made them and denied that he knew of the unlawfulness of the opinions and comments sent by users until he received the demand of the singer.
The ruling explains that the Services Law of the Information Society and Electronic Commerce establishes that the providers of accommodation services or storage of data will not be responsible for the information stored provided they do not have effective knowledge that it is illegal or, if have it, act diligently to remove the data or make access impossible. In this case, explains the ruling, the service provider "has not fulfilled the duty of diligence in order to detect and prevent certain types of illegal activities."
The ruling also explains that the owner of the website provided an address "inaccurate or at least not current" to the corresponding Registry, which prevented Ramoncín communicate with him in an easy and direct way to interrupt the dissemination of expressions and photographs that were harmful to him.
He added that access was allowed to third parties to that page until XXXXXXX went to court in defense of his interests, "thus not observing his duty of diligence in the rapid withdrawal of illegal data or in preventing access to them ".


Use SD or USB boot if OTP set

Question: If I set up to boot a pi3 from usb can I revert to sd slot boot later? This is in reference to the new OTP bit procedure
Comment: What new OTP procedure?
Comment: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=159691
Comment: The link is about the One Time Programmable Memory in the boot code of the Pi3 that allows USB drive to boot at power on. The link seems to imply that the boot will look for the slot, then check OTP bit  and boot from USB device. Google raspi otp
Answer: From Raspberry Pi Documentation:
"The flow of boot begins with reading the OTP to decide on the valid boot modes enabled. By default, this is SD card boot followed by USB device boot. Subsequently, the boot ROM checks to see if the GPIO boot mode OTP bits have been programmed — one to enable GPIO boot mode and one to select the bank of GPIOs it uses to disable boot modes (low = GPIOs 22-26, high = GPIOs 39-43). This makes it possible to use a hardware switch to choose between different boot modes if there is more than one available."
As per above, it doesn't seem that you need to program the OTP (One Time Programmable) bits to boot from USB.
Answer: Actually you do not need to "revert" from anything. The SD / TF slot will be still functioning as usual.
The OTP procedure will allow other boot options ( read: USB ) but it is AND, not OR.
SoC checks bootcode.bin on the SD card first. If not find proceed to USB.
So basically just taking out the USB and putting a TF in the slot will make the pi boot as usual.

Use SD or USB boot if OTP set


XTR Double chain set to single?

Question: is it possible to convert a m9100 double chainset crank to a single crank? Thanks Matt
Comment: Not sure if it helps but Shimano has a great compatibility chart for components, maybe you can even work it out from [there](https://productinfo.shimano.com/#/com?cid=C-432&acid=C-558). I can't see why it shouldn't work, as long as you have a long-cage (SGS) rear-derailleur, it should fit for both 1x and 2x (RD-Mx120-SGS listed for both applications).
Answer: Yes, you can: the chainrings are direct mount, you can keep the crank and change the chainring. The exploded view shows that except the chainrings, all the other parts are the same: https://dassets.shimano.com/content/dam/global/cg1SHICCycling/final/ev/ev/EV-FC-M9100-4378B.pdf
But as highlighted in the comment by DoNut, you may need to change the rear derailleur if you want a 10-51 cassette. The RD-Mx120 rear derailleur only works with 10-45 cassettes, the RD-Mx100-GS works with 10-45 cassettes and the RD-Mx100-SGS works with 10-51 ones.

XTR Double chain set to single?


What is the relationship between fuzzing and buffer overflow? Does fuzzing leads to buffer overflow?

Question: What is the relationship between fuzzing and buffer overflow and does fuzzing leads to buffer overflow? Is buffer overflow a subset of fuzzing?
Comment: Did you look this up? I googled "What is the relationship between fuzzing and buffer overflow" and got *many* tutorials explaining it. The answer below simply references Wikipedia. Please do at least ***some*** research before posting here. Your question is posed as if you do not know what the terms mean.
Comment: "Fuzz testing is a well-known technique for uncovering programming errors in software. Many of these detectable errors, like buffer overflow, can have serious security implications. " -- [oss-fuzz from a paper you presented to OWASP in November](https://github.com/nathanawmk/oss-fuzz). Can you explain the basis and motivation for your question? You have me very confused because it seems as though you already have this knowledge and authoritative sources for answers.
Comment: If you are trying to create, what we call canonical questions, this is not the way to do it. Usually, you post in Meta to get community feedback on the necessity for such canonical questions, and then an agreed-upon approach. Throwing dozens of ill-formed questions in the queue just generates noise.
Answer: To understanding the relationship one has to first understand what fuzzing and buffer overflow are in the first place. In short:

Fuzzing is (automatically) trying to trigger various program path usually using variations of input - in the hope to stumble into something which was not properly implemented like missing or incomplete input checks.
Buffer overflow is a very specific vulnerability which can be triggered by unexpected input. But buffer overflow is not the only kind of vulnerability for unexpected input.

Based on this fuzzing can be used to detect buffer overflows - but also other vulnerabilities. And not all buffer overflows might be detected by fuzzing. And neither is fuzzing the only way to detect buffer overflows.
Comment: See my comment above. I'm not sure how to proceed.
Comment: @schroeder: Your comment about the OP not doing the basic research reflects my thinking too. I don't feel the question as a duplicate though of a question asking what fuzzing is because the OP would need to know both what fuzzing is and what buffer overflows are to understand the relation :)
Comment: It's not just the lack of research, but having the answers in-hand already.
Comment: He's a member of OWASP and has presented several security papers. Including one that explained fuzzing ... https://owasp.org/www-chapter-singapore/assets/presos/Supply_Chain_Security_Securing_your_NPM,_PyPI,_Maven_and_Crates_(Rust),_Shift_Left_with_Gitops_and_Software_Fuzzing.pdf


What happened to the Mighty Orbots cartoon series?

Question: I loved The Mighty Orbots show when it was broadcast decades ago. It lasted only one season and ended with a finale episode, which is unusual for cartoons. Was it always planned as a one-season show? It doesn't appear to have ever been released on DVD - why did it just disappear?
Comment: So who owns the rights now??? I have an idea: We need to create a game based on Mighty Orbots. It could be a video game or a board game, but the primary goal would be to get as much publicity for it as possible. Once it becomes popular, the original owners of the MO rights will A) see the value of the property and/or B) contact us with a cease & desist order. Either way, we will know who to contact at that point. Any one interested?
Answer: According to Wikipedia, the 13-episode series was never released on DVD. It ended early

due to a lawsuit between the show's creators and toymaker Tonka, who
  accused them of basing the cartoon on their GoBots franchise (which
  was adapted from Bandai's Machine Robo line). The robot depicted in
  the show was virtually identical to the robot in the anime for
  Bandai's Godmars toy, although the colors were changed.

This may have affected its release.
According to a rather informative review here, poor ratings were its downfall, though its release in other markets on VHS developed a small cult following. T M S Entertainment, Inc./M G M/U A Entertainment Company is the copyright holder according to US Copyright office. If you have access to a VCR, there are a couple of libraries in the US that apparently have it in their collections (set of 13 tapes). You might be able to get your local library to do an inter-library loan for you.
Comment: Wikipedia has been known to be wrong.  Is there any visual evidence to back the image of the Godmars toy to Mighty Orbot?  Having typed this, do know that my next step is to go search for one online.
Comment: From what I've seen so far in my short investigation, Tonka sued because the word "Orbots" from "Mighty Orbots" was too phonetically close to "GoBots", which used the phrase "Mighty robots, mighty vehicles" as their slogan.  The Mighty Orbots primary robot did form like Bandai's God Mars toy (or Godmars, depending on who you ask), but that was possibly intended as a way to bring God Mars to the US, and the comment regarding the similarity is appears to be independent of and irrelevant to the lawsuit.  Of note, Hasbro now owns GoBots, so there shouldn't be anything left preventing release.
Comment: OK, from http://well-of-souls.com/orbots/about.htm : `There was also a lawsuit filed by Tonka alleging that the Orbots somehow infringed on their Go-Bots property that probably didn't help. {...} Tonka was a licensee of Bandai's Machine Robo line, and apparently had rights to GodMarz. The combined Mighty Orbots robot was a near-duplicate of the combined GodMarz robot, so even though GodMarz was not itself featured in the Go-Bots line, this may have been a pre-emptive lawsuit, and perhaps not entirely without merit.`
Comment: Apparently Hasbro now owns the GoBots fiction, but the license for the toy likenesses are back with Bandai.  This means... ??? for a DVD release of the cartoon?
Comment: Thanks, I'll look into that.  Of note, this doesn't answer the overall investigative questions of (1) who holds the cartoon now and (2) why haven't they released it, considering the lawsuit shouldn't be stopping them at this time.  I'm sure it's demand, but it'd be nice to know.
Answer: I asked Bandai Customer Service...

Hi, I loved the Might Orbots as a kid and would like a DVD release please.
1-It looks like Bandai holds the license for the Mighty Orbots
2-Will you please release the 13 episodes to DVD?
Please let me know.

...and got this response a week later...

Thank you for your inquiry.
As of March 31, 2013, Bandai Entertainment Inc. ceased its business operations and had not being selling items for around a year.  We are unable to further respond to any email or phone inquiries regarding DVD's.
Apologies,


BitCount Method

Question: Can anyone Explain this bitcount method.
public static int bitCount(int i) {
        // Hacker's Delight, Figure 5-2
        i -= (i >> 1) & 0x55555555;
        i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
        i = ((i >> 4) + i) & 0x0F0F0F0F;
        i += i >> 8;
        i += i >> 16;
        return i & 0x0000003F;
    }

Answer: It's based on three observations,

The bitcount of a single bit is that bit itself.
The bitcount of the concatenation of two bitstrings is the sum of their bitcounts.
The bitcount of any string takes no more bits than that string itself.

The first two points together give you a simple recursive algorithm, split the string in two halves, recurse on both, return the sum. The base case is a single bit which you return. Simple so far.
The third observation is very important, it means that if you replace each substring with its bitcount, it will always fit in the space available to it. It means that if you give every count twice as much space (by separating the odd and the even groups), you can sum them and there will be no carry from one group into the next. Then you can rewrite it to this form:
i = (i & 0x55555555) + ((i >> 1) & 0x55555555); // sum groups of 1
i = (i & 0x33333333) + ((i >> 2) & 0x33333333); // sum groups of 2
i = (i & 0x0f0f0f0f) + ((i >> 4) & 0x0f0f0f0f); // sum groups of 4
...

And so on. What happens here is that on the left side of the + we take the even groups (0th, 2nd, 4th etc) and on right side we take the odd groups and align them with their corresponding even groups. For example, summing groups of 2:
[10 01 00 01 00 01 10 10]  // note that 11 cannot occur
split
even:  [0001 0001 0001 0010]
odd:   [1000 0000 0000 1000]
align: [0010 0000 0000 0010]
sum:   [0011 0001 0001 0100]

Then Hacker's Delight uses various tricks to optimize some operations out, for example groups of 4 can be summed using only the masking at the end, because the counts go up to 4 at most so summing them directly gives 8 at most, which still fits in the 4 bits available to it.
Answer: Why don't you add some logging code to display i in binary at each step and see if you can work out what's happening?
Or reduce it to a smaller numebr of bits (8, say) and work through it on paper.
It'll give you a much better feel for the code than someone simply explaining it to you.
This page may help.
Comment: I would also suggest to just use a paper and write down whats happening... only with that information you can understand whats happening
Answer: This algorithm dates back at least to HAKMEM item 169
    LDB B,[014300,,A]      ;or MOVE B,A then LSH B,-1
    AND B,[333333,,333333]
    SUB A,B
    LSH B,-1
    AND B,[333333,,333333]
    SUBB A,B               ;each octal digit is replaced by number of 1's in it
    LSH B,-3
    ADD A,B
    AND A,[070707,,070707]
    IDIVI A,77             ;casting out 63.'s

These ten instructions, with constants extended, would work on word lengths up to 62.; eleven suffice up to 254..

BitCount Method


How to list all untagged files in Mavericks Finder?

Question: I'm trying to start using Mavericks tagging system, even though it has its bugs…
I'm also evaluating Yep to better organize my docs, but maybe I can do without, if I can find how to display all the untagged files in a Finder window via smart folders/saved searches. There's the filter for "Tag" (in "other…"), but it wants me to write a tag name (or the start/end of it). Is there any way to use a wildcard, or an hidden way to set "has tags" as filter?
(Also, a more intuitive way to view files with two or more tags would be good…)
Answer: Ok, I should have taken a look at SuperUser, here's a way to do what AllInOne says without fiddling with XML files (and it's faster).
Simply create a new smart folder or hit cmd+F, choose "Raw Query" from the filters and type kMDItemUserTags != '*' in the field.
Comment: This is awesome sauce!
Answer: A simple way to do this in Finder...
At the top of the finder window you see the column headers such as "Name", "Size", "Kind" etc like in the picture below.

Just right click on any column header and you can add a column called "tags"as seen here.

Then you can sort that column.
Answer: Create a new Smart Folder where Tags is not foo.  Save your new Smart Folder to your Desktop.
Open your "Smart Folder" in a text editor.  Yes, they are just XML files!
Go to line 8.  You will see something that looks like:
<string>((kMDItemUserTags != "foo"cd))</string>

Replace "foo" with the wildcard character, like so:
<string>((kMDItemUserTags != "*"cd))</string>

Source
Save the text file.
There is some kind of caching in saved searches.  We need to overcome this so the Smart Folder will use the new search criteria instead of the old (cached) criteria.  What worked for me was duplicating the Smart Folder.
Open the duplicated folder and you should see all of the non-tagged files and none of the tagged files.


Set a default image for thumbnail column

Question: Within SharePoint online, I would like to set a custom default image for my "thumbnail" column (or "Hyperlink or Picture"). I named it "Cover Photo".  If I go into my settings for this specific column (displayed below), it invites me to put in JSON code.  Is there where I can pull in a default image from a remote HTTP location? If so, how do I write that here in this JSON box area?
Answer: Normally, we could use following json to set default value for image column:
<code>{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json" ,

  "elmType": "img",
  "style": {
  "width": "100px"
           },
  "attributes": {
  "src": "/sites/Team1/SiteAssets/__siteIcon__.jpg"
      }
}
</code>
Result:

Per my test, I use the image stored in current site, you can try to use images from remote HTTP locations.
More information about src attribute:
https://www.w3schools.com/tags/att_img_src.asp
Comment: Thank you so much!  I'll give it a try today.
Comment: That works when the SharePoint view is set to list. But does not work when the view is set to Gallery...regardless, I still like it.


Particle question about で and に

Question: Can someone say:
"ここに暑いですね?"
To ask: "Its hot in here, isn't it?"
Or is the correct way to say it:
"ここで暑いですね?"
Answer: The usual thing to say would just be
暑いですね。
But if you to want to use ここ, I would say
ここは暑いですね。
ここが is also grammatically correct, though the emphasis is different.  Neither に or で are appropriate here.  に is typically used for a directional noun (though it is also used with things you might not think of direction, such as 住む), and で is usually used for where an action happens (well, it has other uses as well).  Here there's no action happening, or a direction for it to happen in.
If you want to say "in here" (as in, in this room) rather than just here (which is all ここ means) you might say
このなかは暑いですね。  or
このへやは暑いですね。
Answer: Neither で nor に is correct. Both sound highly ungrammatical here.
The only grammatical solution is to use は.

ここは暑いですね。
Or maybe better: この中は暑くないですか?

As you might have learned, Japanese is said to be a "topic-based" language.
What this means is, in many cases, you have to first indicate the topic of the sentence using は. In this case the topic is about "here", ここ.
By the way of course there are cases "here" should be translated as ここに or ここで. Like:

[本棚]{ほんだな}はここに[設置]{せっち}します。 The bookshelf will be installed here.
あなたたちはここで待っていてください。 You please wait here.

In these cases ここは never occurs, because the topics are "the bookshelf" and "you", not "here".
In contrast, your example has no topic other than "here".
(Even in English, the subject "it", which is often called a "formal subject", virtually means nothing.)
So, you have to attach は to the topic ここ in this case.

Particle question about で and に


Niagara falls from the USA

Question: My family and I are planning a visit to Niagara falls from the USA side. Is it possible to walk over to Canada and back? We are travelling with South African passports, ie, do we need visas for Canada?
Answer: http://www.cic.gc.ca/english/visit/visas-tool.asp?
According to this website (which anyone can use to determine if they need a visa), you will need a visa to cross over to Canada.  You can walk to cross the border, but the entry requirements are no different than if you drive across or take the train.  (People who fly into Canada from most visa-exempt countries also need an eTA, an electronic travel authorization, but these are not required for land crossings.)
The view of the falls is really spectacular on the Canadian side, so I'd recommend getting one.  You can see the falls from the US side, but the angle isn't as good.
There are secondary falls (Bridal Veil and the American falls) which are also easier to see from Canada, but you can get a different but very spectacular view by walking on the bridge to Goat Island on the US side.
Comment: My wife - Filipino passport holder, with UK (Commonwealth Country to Canda) was denied - very politely at the border.

Niagara falls from the USA


Transition from NM-B to THHN/THWN-2 for an attached garage subpanel

Question: This question is similar to others, however similar questions suggested are over 5 years old.  The work has not yet begun, but here is what I am thinking.  I am running a 50A 240V circuit from my main panel to a subpanel in my attached garage, for a new garage heater.  I do understand that I really don't need a subpanel for a single dedicated circuit, but I want to be able to shut down power to the heater at point-of-use.  The garage floor level is below the level of the first-floor floor joists.  From the main panel in the basement, I am running 6/2 NM-B by drilling through each first floor joist.  The run is less than 25 feet.  The last joist I drill through let's me go straight into the garage at the shared wall.  I plan to surface mount the subpanel in the garage on the wall that separates the garage from the house, approximately 5 feet up from the garage floor.  Once I am on the garage side, I plan to run the wires in an appropriate sized conduit.  My question is, do I need to put in an additional junction box on the last joist in the basement to simply change over from NM-B to THHN/THWN-2, so that I am running the THHN/THWN-2 in conduit instead of NM-B when I get into the garage, or can I run the NM-B all the way from the main panel to the garage subpanel (with or without conduit)?  I am totally open to other solutions or ideas.
Comment: You can also run 6-6-6-6  or 2-2-2-4 SER cable. Which is 50A and 90A wire respectively, and about 1/3 the price of #6NM copper. There is nothing wrong with aluminum wire at these large sizes.  Since you're going to a garage, bring extra amps for EV charging; not for you, for home buyers. It really helps resale value.
Comment: Is the garage/house separation a frame wall, or...?
Comment: @ThreePhaseEel Frame wall
Answer: With an attached garage you can use NMB all the way to the panel. You need a 4 wire feed and the neutral must be isolated from ground. No additional ground rods are required since the garage is attached.
Comment: @user149104 I'm sure Ed will confirm, but there's nothing at all wrong with, nor code that prevents, running NM-B in conduit so long as you don't exceed conduit fill limits. Cable requires _larger_ conduit than the 3 individual wires inside it would, and pulling cable through conduit is more difficult, so it's usually _recommended_ not to. However, for your short, 5', straight run, it shouldn't be too difficult. Whether you _choose_ to pull it to the heater is entirely up to you - if you've already got suitably sized _wire_, that would make the pull easier and require smaller conduit.
Comment: The wire in the garage, if run on the outside of the wall (exposed to potential damage), must be run in conduit to protect it from damage. NM-B can be run through conduit, it's just more difficult to pull. Run oversized conduit to ease the pull - one 5' section of conduit, even if huge, won't be all that expensive.
Comment: @FreeMan - Can I run NM-B in conduit from the subpanel to the heater?  The heater will be hardwired.  I thought NM-B shouldn't be run in conduit, or can it be in this situation?  It will be 15-20 feet from subpanel to heater.
Comment: There is nothing wrong with nm in conduit the conduit has to be appropriately sized and you have to be careful pulling NMB in conduit because cutting / scraping the sheath can fail an inspection. The sheath must be intact, can not be removed to pull into the conduit as the individual wires are not labeled. But a straight run is not hard. Inside the building envelop can't go outside with NMB even in conduit for most locations.
Comment: @ freeman, @EdBeal - I've been thinking about this, and kind of still have my original question.  So I have conduit on the garage side of the shared wall to protect the cable.  On the house side there isn't any conduit.  So how do I go from my 2-2-2-4 (or NM-B) cable that isn't in conduit to a point where it IS in conduit?  What goes on the end of the conduit at the start point?  Is there a junction box on the end on the house side, or do I simply have an open end/stub of conduit that goes through the last floor joist and the cable is just fed into it?
Comment: Conduit requires a bushing on the open end to protect the insulation.


What is the difference between 'relationship' and 'relation'?

Question: Can we say a sentence like 'her relation to her mother in law'?
Comment: A whole sentence would be better, but as-is I would use "her *relationship with* her mother in law".
Comment: Nice answer from @ricky. A similar question [here](http://english.stackexchange.com/questions/15208/relation-versus-relationship) and [here.](http://english.stackexchange.com/questions/189981/whtas-the-difference-between-relation-and-relationship)
Answer: A relationship is a larger concept that includes relations.

"There's plenty wrong with Martha and her mother-in-law's relationship."
"We are in a relationship, I'll have you know."

A relationship can be neither bad nor good when it begins: it can only take on color as it progresses. Relations, on the other hand, can begin as sour (or excellent):
From Man and Superman by G.B. Shaw:

TANNER. You lie, Tavy: you are. So let's have her down from the drawing-room and ask her what she intends us to do. Off with you, Tavy, and fetch her. [Tavy turns to go]. And don't be long for the strained relations between myself and Ramsden will make the interval rather painful [Ramsden compresses his lips, but says nothing—].

Note that you can't say "foreign relationships."

Also: relations (always plural in this case) can mean sexual intercourse.
More: a relation (singular) can mean a relative ("Those morons and twits are all my husband's relations; I have nothing to do with them.")
The word "relation" is slowly falling out of use, for no immediately apparent reason. The word "relationship" keeps marching triumphantly upward thanks mostly to psychobabble being all the rage.
I hope this helps. If someone has a better answer, I'll read it myself with much enthusiasm.


Change Trailer Tire Size?

Question: I have a utility trailer (a typical homeowner/DIY single axle, approx 8ft X 5ft) that has aging tires and which I'd like to replace soon.  It currently has size 4.80-12" tires and I am considering changing (upgrading?) to a 5.30-12" rim & tire size. Is there any reason I should not do this?  Especially safety? Note: there is about 3 inches of clearance, certainly at least 2.5 inches, from outer diameter/surface of current tire and any part of the trailer itself, e.g. the wheel well, so I am not too worried about a bit of increase in tire radius making contact with the trailer frame or wheel well...unless should be?  That's kinda the whole point of my question, I guess.
Answer: It really shouldn't matter much at all. The section width will be a little bit wider for the new tire. It will have just a little bit larger diameter, somewhere around .75", depending on the make/model you choose. That gives you about 3/8" overall on each side of the tire. That's not a lot. The only thing you need to be wary of when you say there is 2.5" of clearance is how much travel does the suspension have and will this come down and hit the tire. If this trailer is like most small trailers, it will rely on the tire itself for the suspension and the axle will be hard mounted to the body of the trailer itself. If this is how it is, then there's absolutely no issue there. The width is going to be something you'll need to check, but I doubt the amount of space you'll need will be an issue, either. Other than the width increase, there really isn't an issue as far as I can see. Just look again at how far the side of the tire is to the side of the trailer. I'll bet you have plenty of room there, as well.
If you really want to upgrade your tires (or at least get the larger ones), go ahead and get them. Then test fit them on the trailer. If they don't fit, then most places will take them back for either exchange or refund. As long as you've not used them, there shouldn't be an issue ... but ask them first before purchase.
Comment: Probably a more important (or just as) is that the replacements need to have at least the same load capacity as the old ones. Trailers are designed to carry particular weights, and if the tyres are rated at under the gross weight, there could be problems - actual and legal.
Comment: "it will rely on the tire itself for the suspension, and the axle will be hard mounted to the body of the trailer itself."  That's my situation, so what you responded with pretty much confirms my thoughts on the subject.  Thanks...
Comment: @AA040371 - Yah, if it's hard mounted and there's plenty of room, there should be no issues. Just ensure you double check the width fitment.
Comment: @Tim: yep...covered!  Current and new tires both have a C load rating...~1000lbs per tire, which is about what the trailer is rated for and well within my 4Runner tow capacity.  Hooray!

Change Trailer Tire Size?


Can't change default settings in foundation theme

Question: I am thinking about changing my Drupal site theme to a Foundation based one. I use Windows 7, with the Foundation module installed and activated, along with Ruby, Compass and Sass.
To experiment I have changed this in the scss files:
_variables.scss:
 $row-width: em-calc(1280);
 $column-gutter: em-calc(30);
 $total-columns: 12;

_init.scss:
$topbar-height: rem-calc(90);

I get no error messages when I navigate to my sub theme's folder and run compass compile from the command line. Instead I get this:
 write css/custom.css
directory css/foundation
 write css/foundation/foundation.css
 write css/foundation/normalize.css

... which looks promising enough. After this I added this to my sub theme's info file:
stylesheets[all][] = css/foundation/foundation.css
stylesheets[all][] = css/foundation/normalize.css

I also commented out the app.css line in the info file:
; For CSS users, load the app.css file:
; stylesheets[all][] = css/app.css
; Comment the app.css file (above) if you're using sass to preprocess css:
 stylesheets[all][] = css/custom.css

I have looked in the page source and can confirm that those files are actually loaded.
The width is still is the default 1000px value and the top bar still have the same height (45). And yes, I have cleared all cache.
What have I forgotten?
Answer: Sorry about the noise... after a couple of hours of struggling I removed these lines in the info file:
stylesheets[all][] = css/foundation/foundation.css
stylesheets[all][] = css/foundation/normalize.css

... and everything began to work. So never mind this question.