Java multithreading - How to make sequence of threads?
Interview: How to ensure that a thread runs after another?
Interpretation of the rating of a real transformer The rating of a real transformer is 15 kVA , 2300/230-V then can we say that the primary rms is 2300 V or can we say that the secondary rms is 230 V or both.  To clarify further, suppose to solve for certain characteristics of this transformer like primary current and secondary current i use the equivalent circuit equation of the transformer referred to the primary side as:  Vp = aVs + Req*Ip + jXeq*Ip  Then what should i use for Vp or Vs in the above equation looking at the rating of the transformer.  In the above equation looking at the rating data given above is Vp= 2300 or Vs = 230 ?As mentioned earlier the transformer is mentioned to be real. Assigning point IDs to respective start and end attributes of polyline? I have two shapefiles, Point and Polyline. I'm trying to populate my polyline layer with the point data ID (systemID) where the lines start to where they end; eg. create two columns (from and to). The lines already have flow direction assigned to them. I am using ArcHydro tools but Arcpy is also fine.  In ArcHydro I have tried using Attribute Tools > Generate From/To Nodes for lines but it creates values for To and From that are not from my point data. My other alternative was using Feature to Vertices and joining the result to my point data table to get the systemID. But then I would have to update the polyline layer as well. I am sure there is a easier way of doing it.  Note: not all the lines have points at the vertices, blank values are fine for them. What I get:  host:~ user$ cat example.txt some texthost:~ stas$   What I want to get:  host:~ user$ cat example.txt some text host:~ stas$   Is there a way I can make cat behave like this?  I'm using bash on Mac OS X. I've got the new Canon Pixma MG 3150 and so far, I can't seem to find a driver anywhere. I do have the CD for both Windows and Mac, but this doesn't help me, as I have Ubuntu 11.10. I'd prefer to have it running on the wifi.  I'm really new to this, so I need for you to explain this to me as basically as possible. How to simulate data that satisfy specific constraints such as having specific mean and standard deviation? This question is motivated by . But I imagine that it would also be useful in teaching contexts where you want to create a dataset that exactly mirrors an existing published dataset.  I know how to generate random data from a given distribution. So for example, if I read about the results of a study that had:   a mean of 102, a standard deviation of 5.2 , and  a sample size of 72.   I could generate similar data using rnorm in R. For example,   set.seed(1234) x &lt;- rnorm(n=72, mean=102, sd=5.2)   Of course the mean and SD would not be exactly equal to 102 and 5.2 respectively:  round(c(n=length(x), mean=mean(x), sd=sd(x)), 2) ##     n   mean     sd  ## 72.00 100.58   5.25    In general I'm interested in how to simulate data that satisfies a set of constraints. In the above case, the constaints are sample size, mean, and standard deviation. In other cases, there might be additional constraints. For example,    a minimum and a maximum in either the data or the underlying variable might be known. the variable might be known to take on only integer values or only non-negative values. the data might include multiple variables with known inter-correlations.   Questions   In general, how can I simulate data that exactly satisfies a set of constraints? Are there articles written about this? Are there any programs in R that do this? For the sake of example, how could and should I simulate a variable so that it has a specific mean and sd? I entered the USA on a Visa Waiver Program (VWP) on 1 July 2012 and stayed until 16 Sep 2012 (78 days).  On what date in 2013 will I be able to travel to USA again under VWP? Socket Tester all indicators light up I used the above GFCI/RCD (up to 250v) socket tester on the 240v black and red live wire of the US split phase ac power system. When I connect the ground, all indicator lights (3 red) got on indicating "Live/Grd Reverse, Missing GRD" although it is connected properly.  What is inside the socket tester? Does it have a live and neutral leg such that it should only be used for ac system with polarity? How about if you use it on the red and black 240v phase to phase? Why would all the indicators light become on (3 red lights)?  The following is the specs of it:  Specifications: Brand Name: HABOTEST Color: Black Material: Flame Retardant ABS Plug Type: US Voltage: 48V-250V 45-65Hz RCD Test: >30mA (EU/UK Plug) RCD Working Voltage: 220V±20V GFCI Test: >5mA (US Plug) GFCI Working Voltage: 110V±20V Voltage Measurement: 48V~250V / 45~65Hz    Accuracy: ±(2.0%+2) Working Environment: 0°C ~ 40°C, 20% ~75%RH Storage Environment: -10°C ~ 50°C, 20% ~80%RH Safety Rating: EN61010-1,-2-030, EN61326-1,CAT II 300V Item Size: 62 * 65 * 55mm / 2.4 * 2.6 * 2.2in Item Weight: UK 64g/2.3oz, EU 59g/2.1oz, US 53g / 1.9oz Package Size: 7.5 * 7.4 * 7.3cm / 3.0 * 2.9 * 2.9in Package Weight: UK 90g/3.2oz, EU 86g/3.0oz, US 79g / 2.8oz Forcing SSL and www in .htaccess I'm looking for a way to force SSL and www.  I've been able to force both separately but together I keep running into redirection issues. The following code works when handling a URL in this format: http://example.com and properly redirects to https://www.example.com but when the incoming URL is https://example.com it will not forward to https://www.example.com - Any suggestions?  EDIT: it should also send http://www.example.com to https://www.example.com.  RewriteCond %{REMOTE_ADDR} !127\.0\.0\.0 RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} !^www.example\.com$ RewriteRule ^(.*)$ https://www.example.com/$1 [R,L] $n$ balls are thrown randomly into $k$ bins - how many are empty? A large number of variants of this question were already asked here, including these - , , which are close, but none seem to answer my question. Assume that $n$ balls are thrown randomly and independently into $k$ bins.  What is the probability of finding $x$ empty bins? What is the expectation of the number of empty bins? In The Force Awakens, we see Rey pouring some flour-like polystarch rations into water so that the flour amazingly transforms into something that looks like bread. What are these rations? Is there any documentation of the fictional chemistry and biology that makes the starch rations behave as they do? How can I tell which cards or sets are currently legal in various formats? I haven't played Magic: the Gathering since the days of Onslaught and Mirrodin, and I would like to try to catch back up. Since all my cards are quite dated now, I may be more interested in formats other than the most up-to-date one.  Rather than ask what is currently legal in various formats (since that is likely too localized), I would rather pose the question of how can I tell which sets/cards are legal in each format. This is a  about DNS server administration.   I have one hundred or so domains. All of these domains need to be configured identically, but it seems like a huge waste of time to have to configure a new zone and/or zonefile for every one of these domains. There has to be a better way to automate this!  I think I'm on to something...if I create a zone called ., or use some other feature in my DNS software to always return a specific IP when an A record is requested, this seems to get me pretty close to my desired end result. My server is responding authoritatively to the requests and it's so much easier to manage!  This was working great until nameserver validation software started checking these domains. I figured out that I can make most of the errors go away by adding NS records, but my software won't let me put more than one SOA record in the same zone file.  How do I work around this multiple SOA record problem? I've deleted a system file from my Mac and need to get it back.  System files can include:   hidden files in the root of / - especially unix files in /private  /System files /Library files /Applications files that ship with the core OS   System files are not any app, user files or files that can be regenerated by a known sequence such as cache files, Spotlight index files, etc…    Canonical question and answer for . Unwanted Lines when rendering using GPU and OpenCL (RX 580) Truly destroying a PHP Session? Why uniform closure $\mathscr{B}$ of an algebra $\mathscr{A}$ of bounded complex functions is uniformly closed? Let $\mathscr{A}$ be an algebra of bounded complex functions. (Or if necessary, continuous and domain of functions is compact)  Definition:  $\mathscr{B}$ is uniformly closed iff $f\in\mathscr{B}$ whenever $f_n\in \mathscr{B} (n=1,2,\cdot)$ and $f_n\rightarrow f$ uniformly.  $\mathscr{B}$ is the uniform closure of $\mathscr{A}$ iff $\mathscr{B}$ is the set of all functions which are limits of uniformly convergent sequences of members of $\mathscr{A}$.  ============  Let $\mathscr{B}$ be a uniform closure of $\mathscr{A}$.  How do i prove that $\mathscr{B}$ is uniformly closed in ZF?  Does Stone-Weierstrass theorem require choice since it is critical to prove Stone-Weierstrass Theorem? We sometimes buy trout from a local breeder who'll get them fresh out of the water for us, and then cook them a few hours later. They taste great, but the flesh tends to fall apart in a way that doesn't happen with fish from the super market. It's often barely even possible to get them out of the pot without them completely coming apart. We tried leaving them in the fridge for a day so they wouldn't be quite as just-killed-an-hour-ago-fresh, but that didn't help.   We usually prepare them by cooking them in simmering (not boiling) water.  Is there some way to prevent this? cd in bash script without alias, function, source I've written a bash script which should cd me to a directory.   My problem is that only the directory in the subshell changes.  I've read of many similar problems to this, but I want to know if there is a solution besides using an alias, a function or sourcing the script.  If you don't understand what I mean, here's an example:  user@linux ~: cat ./myscript.sh #!/bin/bash cd /any/directory user@linux ~: ./myscript.sh user@linux ~:    Please note that my script is much longer, so I don't want to use a function! If a maximal subgroup is normal, it has prime index I'm having trouble with an exercise in "Introduce to the theory of group" book. This is problem:  Let $M$ be a maximal subgroup of $G$. Prove that if $M$ is a normal subgroup of $G$, then $[G: M]$ is finite and equal to a prime. Reclassifying only part of raster keeping rest unchanged? I'm trying to reclassify only a certain part of a raster...not the entire raster.  Here's the problem.  I have a LULC raster of the entire US.  There are some issues with the raster that I want to fix, namely some cells that should be water are classified as wetlands.  These are mainly off the coast, not inland.  However, some cells that are classified as wetlands should really be wetlands (mainly inland) and I don't want these to change.  I plan on using a ZIP Code boundary file to determine which cells are considered "off the coast" and which ones are not.  I have access to ArcGIS 10.1 and R with the appropriate raster packages I need so a solution in either software would be fine.  Can anyone help me figure this out?