What are best practices for developing consistent libraries?

Question: I am working on developing a pair of libraries to work with a REST API.  Because I need to be able to use the API in very different settings I'm currently planning to have a version in PHP (for web applications) and a second version in Python (for desktop applications, and long running processes).  Are there any best practices to follow in the development of the libraries to help maintain my own sanity?
Answer: So, the problem with developing parallel libraries in different languages is that often times different languages will have different idioms for the same task. I know this from personal experience, having ported a library from Python to PHP. Idioms aren't just naming: for example, Python has a good deal of magic you can use with getters and setters to make object properties act magical; Python has monkeypatching; Python has named parameters.
With a port, you want to pick a "base" language, and then attempt to mimic all the idioms in the other language (not easy to do); for parallel development, not doing anything too tricky and catering to the least common denominator is preferable. Then bolt on the syntax sugar.
Answer: 'Be your own client' : I've found that the technique of writing tests first is an excellent way of ensuring an API is easy to use. Writing tests first means you will be thinking like a 'consumer' of your API rather than just an implementor.
Answer: Try to write a common unit test suite for both. Maybe by wrapping a class in one language for calling it from the other. If you can't do it, at least make sure the two versions of the tests are equivalent.
Answer: Well, the obvious one would be to keep your naming consistent.  Functions and classes should be named similarly (if not identically) in both implementations.  This usually happens naturally whenever you implement an API separately in two different languages.  The big ticket item though (at least in my book) is to follow language-specific idioms.  For example, let's assume that I were implementing a REST API in two languages I'm more familiar with: Ruby and Scala.  The Ruby version might have a class MyCompany::Foo which contains method bar_baz().  Conversely, the Scala version of the same API would have a class com.mycompany.rest.Foo with a method barBaz().  It's just naming conventions, but I find it goes a long way to helping your API to feel "at home" in a particular language, even when the design was created elsewhere.
Beyond that I have only one piece of advise: document, document, document.  That's easily the best way to keep your sanity when dealing with a multi-implementation API spec.
Answer: AFAIKT there are a lot of bridges from to scripting languages. Let's take e.g Jruby, it's Ruby  + Java, then there are things to embed Ruby in Python (or the other way). Then there are examples like Etoile where the base is  Objective-C but also bridges to  Python and Smalltalk, another approach on wide use: Wrapping C libraries, examples are libxml2, libcurl etc etc. Maybe this could be the base. Let's say your write all for Python but do implement a bridge to PHP. So you do not have that much parrallel development.
Or maybe it's not the worst idea to base that  stuff let's say on .NET, then you suddenly have a whole bunch of languages to  your disposal which in principal should  be usable from every other language  on the .NET platform.
Answer: why not use python for web applications too? there are several frameworks available: django, web2py - similar to django but many say it's simpler to use, there is also TurboGears, web.py, Pylons
along the lines of bridging - you could use interprocess communication to have PHP and python application (in daemon mode) talk to each other.
Comment: In our case it's because we have an existing suite of tools in PHP that would have to be ported.
Comment: You have the reason. I get it.


Geocoding - looking to identify county from list of zipcodes

Question: Using QGIS, how do I find county of an associated zipcode? I have zipcode for each point, however, I do not have a street address. I am hoping to aggregate my data to the county level using the zipcodes.
Comment: Zip codes are not typically exclusive to counties (at least not any place that I'm familiar with). I don't think this is going to work for you. If you think I'm wrong, get a layer of counties and a layer of zip codes for your area and see.
Comment: Related question: http://gis.stackexchange.com/questions/146762/ As jbchurchill points out, not all zips are contained within a single county. You'll want to be aware of this and make choices accordingly (ie that you're either going to put an entire zip into a county or you'll want to divide up the zip's values in some way, giving a portion to each county it falls within, and you'll need zip polygons for that).
Answer: I would do a spatial join between your point data and US Counties.
If you do not have US Counties, you can download the 2014 Counties here.
Then, add both layers into your map.
<code>Click Vector -> Data Management Tools -> Join attributes by location

Set the target vector layer to your points.

Set the join vector layer to your counties.

Choose to take attributes of first located feature.

Rename your output shapefile.

Select to keep all records (so you don't lose any records).

Click Ok.
</code>
Once complete, your point output will have the county information added to it.
Keep in mind:

The projections of your data
All fields from the counties will come over, but you can delete them once the process is completed
As reference, here is a tutorial doing a very similar process, except it chooses to aggregate a field rather than just joining the data
Comment: Since zip and county boundaries aren't coincident, I think it would improve this answer if you address that. How will the spatial join handle a zip with two counties? Mention of the potential need for apportionment prior to aggregation might be important, since without it you skew results (and even with you're only estimating).
Comment: The OP should clarify how the point data was created. If the point data is simply a centroid of the zip code area, then yes, adding information on how to handle more than one potential county should (and will) be added.
Comment: How would you get x and y's onto your postcodes layer?
Comment: @Vesanto - really that is a different question than what the OP asked, but you can reference [this](http://gis.stackexchange.com/questions/7199/how-do-i-calculate-the-latitude-and-longitude-of-points-using-qgis) post.
Comment: Good point. If they are randomly located within the zip code or just at the centroid (or either if they're just in tabular form) then there's some question over how to figure out which county they're in if even possible. Even without an address, if the points were in a specific location they could be geocoded to get one. Which wouldn't be necessary anyway, because at that point it's a simple point-in-polygon operation as your answer outlines and is discussed at a number of other questions here.
Answer: Very simple solution to this.
sign up here:
https://www.mashape.com/vanitysoft/boundaries-io
then in your code:
https://vanitysoft-boundaries-io-v1.p.mashape.com/reaperfire/rest/v1/public/boundary?and=true&county=Howard&includepostal=false&limit=30&state=MD
The results are GeoJson to easily integrate into repositories, or anything that takes GeoJson like googleMap...   used http://geojsonlint.com/ to cut and paste my GeoJson Results from the API call above to display the below image...Hope this helps!
image
returns below:


Clarification on the three omega method for measuring thermal conductivity

Question: I've recently come across the $3\omega$-method for measuring thermal conductivity in materials. Now I'm told that we use a lock-in amplifier to measure the 3rd harmonic in the voltage across the metal film which gives us the conductivity. What I don't understand is why the 3rd harmonic? The voltage also has a component at frequency $\omega$, why do we use the $3 \omega$ component instead of that?
Answer: The voltage has components at all multiples of $\omega$, i.e. $0\omega$, $1\omega$, $2\omega$, $3\omega$, and so on (though the magnitude gets lower and lower).
However if you go through the math, you'll see that at a first approximation, the thermal conductivity $\kappa$ is proportional to $V_{3\omega}$, and not to $V_{1\omega}$. That's why using a lock-in amplifier tuned to measure the 3rd harmonic instead of the 1st harmonic is useful to obtain $\kappa$.


Could I replace a hub on a wheel?

Question: I have a freewheel and I keep bending the axle, however the rim, spokes and tire are all fine, does anyone think it would be possible to unscrew the spokes, buy a new hub that has a freehub, install that with maybe new spokes and my previous rim? (And also buy a cassette) because I don't see the point in buying a whole new wheel just for the hub.
Comment: Okay so im getting the idea that there are 4 issues around this; that I lack the skills needed to do this, that i might not do it properly, its time consuming, and costs more than just buying a wheel. Too be honest i don't want to buy a new wheel because either the good ones are unnecessarily expensive for the type of riding that I do, or too cheap to the point where I question it's durability, i've been told that i could make my axle solid instead of hollow to make it slightly stronger but apparently  this is a short term solution. Any ideas?
Comment: You've stated your dilemma. You have two choices: rebuild your wheel using existing parts and a new hub, which you don't want to do, or buy a new wheel, which you also don't want to do. You'll need to choose.
Answer: Simple answer: yes, but it's not worth doing.
Cost of hub, spokes, nipples and having wheel rebuilt will exceed the cost of a new wheel. Even if you re-use the spokes a new wheel will still be cheaper.
Wheel building requires special equipment, expertise and time to do correctly.
Comment: Yeah, the time, from a skilled wheel builder, is the biggest cost.  (Of course, you could build it yourself if you want to learn wheel building.)
Comment: And if you manage to sell the current wheel, the price tag for getting the new wheel goes even lower.
Comment: That's not true if you have decent rims, for example carbon rims which will cost way more than the price of the hubs.
Answer: Yes - I have personally done this, by installing an 8 speed cassette freehub into a wheel that had a 6 speed freewheel.  The donor was a 26" MTB wheel, and the recipient was a 20" wheel for my folding bike
It was only worth doing because I had a donor wheel and I was able to reuse the 20" spokes well enough.  I even reused the 8 speed cassette and chain.
My purpose was to get access to smaller and larger gears, because the freewheel was a 14-28 and I now have an 11-32.
The downsides were

Assembling used parts can be a bit fiddly, might need some finangling to get things lined up.
Used parts are dirty and less fun to assemble
Used parts will be worn and slightly closer to breakage than new parts.

It took several hours to assemble, and I messed up the location of the valve hole.
Upside, I have a perfectly working, true, QR-based, 8 speed 20" rear wheel and that bike has 2000 km on it now.
You'll need parts and some normal bike repair tools:

Spoke nipple tool and probably some spare nipples
Cassette removal tools - chain whip and lockring tool
Freewheel removal tools - a bench vise and a freewheel tool, OR a grinder with a cutting wheel (mine was a non-removable chinese thing hence power tools)
Chain tool
Lubes
Either a truing stand, or some way to use your bike frame/fork to true the wheel.

Feel free to ask further clarification questions.
Comment: Note another upside: reuse instead of producing waste. Doesn't matter a thing wrt global waste production of course, but the mentality might count in the long end..
Comment: I also needed a replacement 8 speed shifter and long cage derailleur, which was salvaged off a third bike.
Comment: How much experience did you have building or truing wheels before this project?
Answer: As the others have already stated: Yes, it is possible, but ...
However, I feel that the really important message has not been transported yet: Building a wheel is not easy for the uninitiated.
Yes, it can be done. Yes, you will likely get something that looks like a true wheel. But you may easily end up with many broken spokes the weeks after.
The critical part about building a wheel is, that you need to apply even tension to the spokes. Fail to do so, and they may break very quickly. And with even tension, I really mean very even. It won't suffice that they feel evenly tensioned to the touch, the tolerances are surprisingly small. If you have a musical ear, that helps a lot, as you can just tune your spokes (that's what I do, at least). However, doing so takes time. Time that may be better spent on other pursuits. After all, when you adjust the tension of one spoke, 35 other spokes have their tensions changed slightly as well...
That said, building a rear-wheel with a cassette is an additional challenge, as you need to build it asymmetrically. Consequently, the spokes on one side need a much higher tension than on the other side. With the tuning approach, that's two different tones, the exact pitch of which depends on the geometry that you aim for.
So, if your goal is to get to know how your bike is built, go for it. You can learn it. But expect to pay for these skills with a significant amount of time, and likely broken spokes. If your goal is just to save a penny, think twice: buying a new wheel may save more in terms of time than you can save in money by building yourself, and the bought wheel has less risk of failing quickly.
Of course, this economic consideration heavily depends on the price tags of the parts that you are trying to save. If your rim costs 500$, you better keep it, no matter how much time you need to invest into building the wheel. However, for a standard, off-the-shelf 20$ rim, buying a whole wheel is very likely the more economic option.
Comment: It really depends on the price of every component. When you have high quality wheels, even if you use a professionnal to do so, it will be way cheaper for change the hub than change the whole wheel
Comment: @thibautnoah Ok, rewording is done. Hope you like it.
Comment: There's no cost to be saved building the wheel yourself, the tools necessary to do so, especially a wheel building stand, will cost more that an entire wheel.
Comment: Experiences seems to vary, of all problems I head when learning to build wheels, spokes breaking was never one of them. Regarding even tension within small tolerances: the end goal is to get a true wheel, so imo it's better not too pay too much attention to the even tension because at one point or another you're going to have to choose between true or even tension. Achieving both is theoretically possible, but it would need the exact same material properties in each spoke and nipple and across the whole rim. Not something which happens often in practice.
Comment: @stijn Yes, experiences do seem to vary: For me, I would break about a spoke in 100km when I did not manage to even them out enough. For me, that was way too much as that's about the minimum I do per week. Also, I tend to apply significantly higher forces to my bike than other people do. However, once I fixed the uneven tension problem, the problem of breaking spokes disappeared entirely. So, maybe other people don't suffer as much from uneven tension as I did (less kilometers, less torque on the wheel), but the amount of stress a wheel can handle depends heavily on even tension.
Comment: Maybe I got lucky because most wheels I built are 36 spokes, less for you perhaps? On the other hand I also ride bmx so force-wise that's hard to match. When building I do start with turning each nipple the exact same amounts though before doing actual trueing which I assume does assure a certain amount of evenness already.
Comment: @stijn Mine are 36 spokes as well. But the strongest force I apply is torque, which was beautifully visible in the pattern of spokes that broke: It were always the spokes that transfer the acceleration torque to the rim which broke. I don't know what forces your apply to a BMX bike, but I guess it's more of the shock-related kind when you jump. Anyway, I totally agree that tightening all nipples with the same amount of turns helps a lot to get a relatively even base tension, yet it's insufficient for the end result in my experience. It's just the starting point for the tuning.
Comment: Fair point about the torque. Most 'atypical' force on the bmx wheels will indeed be from jumps etc and sideways as well when spinning for instance, though since it's single speed and I ride in a variety of places the torque when pedalling uphill or accelerating fast isn't exactly low. It feels the same, if not more, than e.g. mtb or road bike up a 10% hill but I only do that a couple of km per week. Then again, I don't have a tensiometer so maybe my spokes are actually tensioned even enough to get around spoke breakage without me knowing..
Comment: @cmaster that's actually not true. Some carbon rims (for downhill or enduro) are really good and come with lifetime warranty, they also use 36spokes. The cost of the rim itself exceed 480$ most of the time and most people have custom wheels with this, meaning they will switch the hub and keep everything else.
Comment: @thibautnoah Ok. I guess there is no limit to how expensive even something as simple as a rim on a mountain bike can get. Wouldn't have though that people would pay 500$ where 50$ would do the trick just fine (but I never understood how much people are willing to pay for some things anyway). I'll rephrase my answer to make it clear that the economic consideration depends on the price tags for the parts involved :-)
Comment: I do ;) imo it is better for users to have all the information avaiable.
Well to be fair my set of wheels cost around 1900$ so... :D expensive rims and very expensive hubs.
Obviously it is not worth it to a lot of people but when you have the money and want the best.. ;)
Answer: Of course it is possible, you're simply building a new wheel with some used and some new parts. Unless we are talking about carbon rims where the spokes are glued and the wheel is trued in the factory already.
When doing that take the following into consideration:

is the new hub as high as the old one (you have high flange hubs) - if not, new spokes will be needed
new hub (the one accepting a cassette) will be asymmetrical - spokes on the non-drive side will reach to the very outside of the whole assembly while the spokes on the drive side will reach to like 2/3 of the complete assembly width as there needs to be some room for the cassette. Most likely the spokes you have will be too long and will protrude through the nipples. Either you need to buy a new set of spokes or trim the existing ones
is your rim in good condition - when using rim brakes the rim should be replaced once it is worn out
if all the spokes and nipples can be reused - I hope you won't break any of those while disassembling
if you are using the nipple washers, you most likely need a new set
once the wheel is laced, it needs to be trued and dished - either you outsource it to someone with proper tools and expertise or you do it yourself (a truing stand is almost a must)

Good luck!
Comment: Better buy a new factory-built wheel. It isn't much more expensive than buying just the hub unless the hub you envision is something exotic. But this is like pulling a caravan with a Ferrari.
Comment: @Carel and all others who claim that entire wheel is cheaper: have you actually checked what a hub costs?
Comment: @ojs : If you do the work, ir's cheaper but if you pay to have it done...
Answer: Yes, one can do this. But you ask "Can I...?" (my emphasis) and the answer is "probably not, at least not right now." Please don't take this the wrong way, but building a wheel requires a lot of skill and equipment and the fact that you're asking the question suggests that you don't have those.
Unless you're dealing with a particularly high-end wheel, rebuilding it will be more expensive than just buying a complete wheel, especially once you factor in the value of your time. However, if you want to learn how to build wheels as a hobby project, then go for it.

Could I replace a hub on a wheel?


Javascript onclick confirm form submit and flask app

Question: I want to add a confirmation to a form action:
        <form action="/delete" method="post">
            <button id="deleteForm" class="btn btn-danger" onclick="deleteConfirm(this.form)">Delete</button>
        </form>

And in my script.js I wrote the function:
function deleteConfirm() {

    let text = "Are you sure?\nOk=Delete all data.";
    if (confirm(text) == true) {
        document.getElementById("deleteForm").submit();
    } else {
        alert("Cancelled.");
    }
}

But with these codes when I click either ok or cancell, the form will submit. when I click cancel the alert show up but then the action /delete will execute.
Is this an attribute of flask?
Are there another ways to do this?
Comment: you need to add attribute type="button" to your button
Answer: You need to add attribute type="button" to your button, and id "deleteForm" add to form

<form id="deleteForm" action="/delete" method="post">
  <button type="button" class="btn btn-danger" onclick="deleteConfirm(this.form)">Delete</button>
</form>
Answer: No need to use the onclick event of the button. Instead, attach type="submit" with your buttion. And add the onsubmit attribute with your form. This is the standard way of doing what you mentioned.

function deleteConfirm(myForm) {
    let text = "Are you sure?\nOk=Delete all data.";
    if (confirm(text) == true) {
        return true;
    } else {
        alert("Cancelled.");
        return false;
    }
}
<form action="/delete" method="post" onsubmit="return deleteConfirm(this);">
    <button id="deleteForm" type="submit" class="btn btn-danger">Delete</button>
</form>
Answer: There are like many ways to approach this question, but what i would do is that instead of having an entire javascript function just to display a on click  alert i would just wrap it around a input.
<input type="submit" value="Delete"
                   onclick="return confirm('Are you sure you want to delete this data?')">

I have used this for like flask data delete and when the user clicks cancel it does not submit the form.
Here is an example of what i just used:
https://jsfiddle.net/12f6bvkq/


Will the YougNuo YN-565EX set as slave work as TTL?

Question: I'm trying to figure out something for a project that's upcoming. I'd like two flashes on stage (maybe three) triggered by an ST-E2 on-camera from the back of the room and various places in-between. Will they work in this situation to meter the flash output? If not are there any alternative flashes in that price range ($150 each) that would work.
Or if anyone has a better idea I'm quite open to listening and learning. I'm new to this.
Answer: Yongnuo claims that it will; whether or not it will work reliably in your situation will be a matter of experimentation. Off-brand is off-brand, and compatibility/reliability are always a little bit hit-and-miss. When it hits, you're golden, but there's always a question of forward-compatibility, so what works wonderfully today may not work tomorrow. Still, if you can save something on the order of $500/unit, expediency today may make a lot more sense than 100% compatibility with your next camera.
Comment: I was choosing those particular items because I thought they WERE radio triggers???
Comment: Last time I used a Speedlite 430EX II mounted to the hotshoe to trigger a Morris AC Slave (optical). the results varied and this time I want to improve the number of good photos.
Comment: @Bud : Sorry -- missed the ST-E2 detail. Yes, Yongnuo claims it will work with it. Editing main post now.
Comment: Just out of curiosity, are you familiar with the canon 40D. I have two of the Morris units and my one problem with using them is I have to flash my * button to get the reading correct for the actual shot. That means I have to fire my flash twice as many times and eat the batteries. Is there a way to have the camera hold that information without actually holding the button down halfway forever. I have a situation where I take about 200 shots that could all be with that same setting.
Comment: @Bud — sorry, no. I've never had a lot of fun mixing TTL with fixed-power flashes and moving subjects, though, unless the fixed flashes (like the AC Slave, which I have used) were just being used for hairlights or kickers (where minor variations in illumination, even to the point of occasional blowout, are fairly tolerable).


Accidental deletion of /lib directory in Fedora 15

Question: I accidentally deleted the /lib directory on my Fedora 15 machine and I'm not sure how to go about fixing this. Any help in figuring out how to restore the directory along with symbolic links would be greatly appreciated.
Comment: This is probably non-trivial. It would be easier to back up your data files and reinstall. The only other option is to reinstall the packages which have files in /lib, which is likely to be painful and difficult. Does `yum` still work, for example?
Answer: If you have another system with a similar Fedora 15 setup, you can boot your system from a livecd, and sync the contents from the other system to repopulate your /lib directory (rsync -avH  will do it). Some of your commands may not work then you need to install those packages again.
Comment: @THE DOCTOR: I was going to suggest a similar approach. Actually, if you know the list of packages on your system, you can just do a Fedora installation with the same list of packages. This won't work well unless you have a pretty good idea of the list of packages available though. Plus you could use one of the other system directories to make sure that your list of packages matches closely with the original, by doing a binary recursive diff. Perhaps `/usr/lib`?
Answer: /lib is a system directory, will contain the necessary library files installed during installation and later from any additional package installations using rpm or tarballs.
Do you have any backups for the host, Is it on a RAID or LVM partition? For that, the procedure will be different. However /lib is a system directory and its availability in sane mode is essential for the functional running of the host.
I would be keen to suggest to look for a live-cd and boot the system using cd and get into rescue mode. Also, find if there is any machine on the same network with fedora 15 same image installation earlier. If not, setup a machine with fedora 15 same machine seperately. Lets call it a remote machine for sake of the explanation. This remote machine you can use to copy /lib entire structure with symlinks and all exactly using rsync later. Make sure you install the rsync package. Also, make sure you have ssh installed and running on the remote machine with root login allowed.
Note: If you do not have another machine then only alternative is to reinstall the OS with the option of without overwriting any of the Linux installed data. That way, you will ensure that all the local data on the machine post its previous installation is safe and untouched. And do not recreate any partitions. If you do have another machine then proceed next, because this could get your system recovered and make it up and running more earlier.
Once you are done booting off the cd and rescue mode on the local machine, setup the networking and get to know the ipaddresses of the to-rescue machine and from where /lib can be copied.
Identify the /lib partition on the local hard disk. Is it a seperate partition or was mounted from /. Usually it is a directory structure under /, not a seperate partition. If it is directly under / of the root partition of the local disk, make sure you mount root the partition under say /mnt/localroot. Under /mnt/localroot/lib you will find your corrupted /lib tree structure. However, you make sure that you are not using /mnt/localroot but only /mnt/localroot/lib/ only. Be careful with trailing slashes and path.
mkdir /mnt/localroot
mount /dev/sda1 /mnt/localroot
ls -ld /mnt/localroot/lib

From the shell prompt, locate the rsync binary and start pulling the /lib contents from the remote machine to the local mounted lib directory at /mnt/localroot/lib/.
/usr/bin/rsync --delete -avz -e /usr/bin/ssh <remote-machine-ip-address>:/lib/ /mnt/localroot/lib/
Once the sync is complete, run the same rsync command again. After that, restart the system, take out the boot cd and then try booting from grub in normal mode and identify the logs that every service got started properly with out any errors.
Answer: I would suggest that recovery of the /lib is the easy angle to take in that case.
so first of all you must stop using the fedora in question, and run on it a live CD with some recovery program like here (it is a good guide), and recover to a separate HD (since you don't want to destroy the potential of the recovery), then after you have the results from one program and is satisfy you copy it back to the fedora in question, if not try another program.
Probably you wouldn't be able to recover every lib file in the directory, but you can install it afterwards.
In case you can't recover, backup any system files that you have changed to your like, and install the Fedora box again with the "Upgrade" option at the installation stage, that would install only the removed files that associate with your base system.
Answer: Other answers have explained how to recover your system by rebooting into a live CD/USB. You won't be able to shut down your system cleanly, so press Alt+SysRq+S then Alt+SysRq+U Alt+SysRq+B to unmount filesystems cleanly then directly reboot. There's a small chance that you don't need even that, but that depends on what you have available.
First, you need to be able to execute some process as root. That means having a root shell running, or having a root account with a statically linked shell and a way to log on the console or over ssh. What you can do then will depend on the statically linked tools you have at your disposal. If you have a statically linked mount (e.g. in sash or from Busybox), you can mount a USB stick or NFS filesystem that contains a copy of lib from another version of Fedora. If you still happen to have the rpm packages available, reinstall the ones that provide libraries, starting with libc; as far as I know Fedora's rpm binary is statically linked.
See also Moved bin and other folders! How to get them back?, a different situation but with enough in common that the answers might provide helpful complements.
Comment: Magic SysRq key is off in most systems these days.
Comment: @Kwpolska Not in my experience, no. Ubuntu enables it by default (some functions are disabled, but not S/U/B), which alone accounts for a lot of systems. Which distribution turns it off?
Comment: Arch Linux does, AFAIK.


Where can I find resources about writing "Choose your own adventure"-style books?

Question: I have read/played a couple of "Choose your own adventure"-style book and am interested in the process of creating one.
Where can I find (preferrably free) online resources, such as How-To-Write or styleguide articles and blogs, about writing a "Choose your own adventure"-style books?
The main reason for asking specifically about a this type of book is that I am having problems with the idea of creating a branched storyline and would like to see what common ways are for creating such a story. I have asked about this on a similar question about online resources for a visual novel, but there are a few things that are quite different when thinking about "Choose your own adventure" books.
For example I have never seen such a book that was not written in the First Person. I think that may be due to the fact that you want your reader feel like a player that has to decide for themselves and thereby you are making the story feel more alive for them - it's their adventure after all. But I would love to see whether there are any sort of studies or counterexamples for this and what the recommendations are.
There is also the question about how to format the transition whenever the reader has to decide what he wants to do. Do you put it in a little box on the side where? Do you make each block as a visible block? Are there recommendations such as "You should preferrably use complete pages/half a page for each block"?
Furthermore I have sometimes seen that the different paths don't seem to be in any particular order. It looked like the authors first wrote the book with a handful of different endings and then decided to obfuscate everything by letting blocks switch place - which makes it more interesting because you never know when you are getting close to The End. Again, I am looking for resources that talk about preferred techniques and possibly tools that may assist with this.
Discussions about the length may be interesting, too, as most of these books I have seen are relatively short for a book. But then again, it's quite the work to not only write the story as it plays out in your head, but to give the reader some agency, formatting the book the correct way, coming up with multiple endings, ... The resources would preferrably talk about the average length of such books compared to novels.
I have seen this question: I want to write a Choose Your Own Adventure styled e-book, what's a good approach?, but it focuses on writing a technical guide that is displayed as a digital document that allows readers to use for example hyperlinks to get from point A to point C to point B, whereas I am looking for different genres such as mystery, fantasy, ... in a printed form where the reader turns pages as instructed (or not, depending on your reader) and specifically about online resources, such as discussion forums, guides and tools, that would help with the process of creating such a book.
Comment: "I have never seen such a book that was not written in the First Person" - are you sure? Most of the ones I've seen have been in second person: "You open the door. You go outside" et cetera.
Answer: The blogger These Heterogenous Tasks has been writing his analysis on specific CYOA books, and general observations about their history, trends, and common structure.
https://heterogenoustasks.wordpress.com/category/cyoa/
One article in particular is often cited by other writers:
Standard Patterns in Choice Based Games.
I'll try to summarize.
He starts with a basic branching narrative based on the CYOA book "Cave of Time".  With one exception, all endings occur on the 5th page, and only 3 are "bad" (marked in red). Read-throughs are very short and each choice branches to a different outcome with no rejoining, so the intent is to re-read the book many times.

The next generalized structure is called a Gauntlet, and has only one "true" path through the story. All other choices lead to sudden death except 2 which send the reader back to try again. The single narrative is longer, but every wrong choice leads to death so there is much backtracking. The reader will likely have seen every option before reaching the good ending, and there is no reason to reread.

Then he shows Branch and Bottleneck structure which is likely to use state-tracking to carry choices "across" the bottleneck sections of the story. He explains this structure is designed for character growth, and the "passage of time" where narrative milestones are inevitable. The ending may be decided on choices made much earlier in the story when the consequences were unforeseeable.

The next structure represents a Quest where the reader travels to geographic locations and performs adventure tasks before moving to another part of the quest narrative in another location.

Expanding on the geolocation idea, the next structure is called an Open Map as the reader is free to move to any node by traveling. This is the non-linear structure of the old text adventure computer games, but has parallels in RPG.

Elsewhere on the blog in various articles he uses the same graphics to analyze more complex works, including RPG "gamebooks" that used a character sheet for state tracking: https://heterogenoustasks.wordpress.com/2011/08/17/cyoa-structures-cyo-rpg/
Answer: The original books always used the second person 'you'. (I still have one on my book shelf.) Other variations may use the first person.
There are many variations on the theme. For example, some require you to keep track of health, supplies, etc. whereas with others all you do is turn the pages. Some require dice. Others don't. I even played one where you had to keep notes to solve the mystery at the end.
There are several variations on this theme that are phone or computer apps. The guidelines for writing them (which are provided in some cases) can be very illuminating. For example, this blog talks about choices and how the average story in a 110 page book is just seven pages long.
There isn't one way to write a choice story and there isn't one format. If you are going to publish on paper, you will write something that is quite different to something that is published on a web page.
Answer: It's worth noting that "Choose Your Own Adventure" is a specific brand of children's novelty "gamebooks," and that nearly all books written in this format are released under that brand.  It's not --at least to my knowledge --a viable sub-genre outside the brand.  So if you want to write a book just like this, your best bet is probably to contact them directly.
I've personally only ever seen one book in this format outside the brand, which was Neil Patrick Harris' autobiography (which, in my opinion, was not a successful experiment).
The upshot is that if you are wanting to do a different kind of book in this general format --for instance, a serious novel for adults --it's likely you'll be charting your own territory.  It's worth noting, however, that there is one medium that thrives on branched storylines --writing for video-games.  So if this is something you are wanting to pursue, looking into video game writing might be a good resource.
Comment: I disagree on the point about it not being a viable sub-genre. See ["Shakespeare Punches a Friggin' Shark" by Ryan North](https://www.kickstarter.com/projects/168734274/shakespeare-punches-a-friggin-shark-and-or-other-s), whose Kickstarter artfully dodges the brand's name, while still evoking the concept in describing the books he has written in this style. However, I do think it's good to note that one probably can't refer to the brand directly!
Comment: Also there was a whole series of "Which Way Books". Same idea, competing publisher. Like Transformers and GoBots. I also feel like there was a line (perhaps part of one of the two publishers) geared towards younger children that had simpler plots and a totally different brand name. Oh yeah, there was "Pick A Path" stories also.
Comment: There are American Girl My Journey books that are Choose Your Own Adventure with the historical line. (https://americangirl.fandom.com/wiki/My_Journey_Books)
Comment: There's also the similar [Fighting Fantasy](https://en.wikipedia.org/wiki/Fighting_Fantasy) brand, originally by Steve Jackson & Ian Livingstone, and currently published by Scholastic. This brand mixes CYOA-style branching narratives with D&D-style dice-based fight sequences.
Answer: FYI, there is a gaming company called Choice of Games. They have quite a number of these CYOA games available on the web and for tablets, etc. The really useful part is that they have a tool that is free for authors to use to create their own stories. This may or may not be useful for your purposes, but I'm betting they have information on how to structure the story, etc. And if you decide to create a story using their tool, they host the game and you may get a few bucks. I don't have any more info than that, just trying to remember what I read on their site a while back.
Comment: Thanks for the answer. You are right with the name of the company. Here is a link to their site: https://www.choiceofgames.com/. They also have a blog with some information here: https://www.choiceofgames.com/blog/ and a lot of information about their language ChoiceScript here: https://www.choiceofgames.com/make-your-own-games/choicescript-intro/
Comment: @Secespitus - thanks! I couldn't go looking for a gaming site at work.


How can I find out the actual rpms my dc motor at any given moment?

Question: In my next project it will be very helpful to monitor the speed of my dc motor. How can I accomplish this?
Answer: In addition to the cornucopia of methods that burst forth from Russell's answer you could consider to add yet another to that rich bounty- if you have sufficient off time in your maximum PWM duty cycle you may be able to harness the back EMF of the motor itself as a tachometer signal. This has the advantage of being sensorless. It can be a suitable method for motors that are permanent magnet or that have a separate field winding. There must be sufficient time for the energy stored in the rotor inductance to die down, after which you can simply sample the voltage with an ADC.
A detailed description of this method can be found here. The back EMF is proportional to the RPM of the motor, and of the same polarity as the applied voltage (assuming a PM type or fixed field voltage) when measured at the terminals.
Comment: This looks to be a little above my head but I love that it's an "out of the box" approach. I'll definitely give this a shot.
Answer: There are so many possible ways that the best way depends on the details.
Some suggestions
Pulse per revolution from mechanical or magnetic or optical switch or ... .
Triggers could be "cam or bump", magnet, slot or mark or light or ... .
Or several pulses per revolution using either multiple sensors or multiple triggers.
Extending to ...
Tachometer track - series of marks or slots or magnetically variable permeability disk or ...
Small alternator/generator attached to shaft (often known as a tachometer).

Once you have one or multiple pulses per revolution you can

count the number over a given period, or
measure the time between them, or
trigger a fixed length pulse per input pulse (known as a retriggerable monostable) so that the mean DC level out is a measure of speed.
or ....

Where the output is a period you need to take the reciprocal to get speed. A basic microcontroller such as an Arduino can do this easily. THese can be obtained for as little as $US2.85 each if you buy 10 or $US4.50 each if you buy one.
Get a few friends to buy one too and get 10! [No, I have no relationship with them except as a happy customer]


predicative use of "adverse"

Question: Can we use the word "adverse" in predicative?

The conditions on the moon are adverse for people to live

In the sentence, is the use of "adverse" correct?
Answer: I searched in the COCA corpus and found 23 results for are adverse. Only some of these are examples of predicative use, but they do exist:

Hydrological mechanisms that lead to lower pore-water pressures in the soil are beneficial, whereas those that increase pore pressure are adverse. Of the mechanical mechanisms, those that increase shear resistance in the slope are beneficial, whereas those that increase shear stress are adverse (Greenway 1987).

As for the "for-complement", I found no examples for "are adverse for" and only one for "is adverse for":

"Most CEOs are honest and hardworking. Creating the idea that all CEOs are bad is adverse for society, " says Crandall, who, while widely respected, was not universally loved by his troops.

However, there are 19 examples for "is adverse to" and 10 examples for "are adverse to".

In the British National Corpus, I found the following:

But Texas hospitality does not perish even when conditions are adverse.
When polls are adverse there's a tendency to say there's something wrong at the top.

No examples for "adverse for" and "are adverse to", but 10 examples for "is adverse to":

Where the decision is adverse to the claimant, information about the right of appeal to the Commissioners must be given.

predicative use of "adverse"


How to differ linked clone from a full clone in VirtualBox?

Question: I've got a list of virtual machines. I know that most of them are only clones of a few base ones. How to determine if a VM is a full clone or a linked clone? Do linked clones have their own disks or are these only differencing images of their base?
Answer: Basically these are the definitions:

Full-clone: A full clone is an independent copy of a virtual machine that shares nothing with the parent virtual machine after the cloning operation. Ongoing operation of a full clone is entirely separate from the parent virtual machine
Linked-clone: A linked clone is a copy of a virtual machine that shares virtual disks with the parent virtual machine in an ongoing manner. This conserves disk space, and allows multiple virtual machines to use the same software installation

Linked clones have their own virtual disk but this is just a differential disk that contains new files or whatever that the parent virtual machine didn't have when the snapshot of that linked clone was created.
The main difference is that full-clone are independent virtual machines and linked-clones are dependent virtual machines because linked clones need the parent virtual disk as their base-virtual-disk.
Comment: Sorry to ask about such an old topic. Is there any performance implications when using linked VM's? If I want 3 VM's, should I create a base VM and then 3 additional linked linked, or just the base one and 2 linked clones?
Comment: @Wes Feel fre to start a new question. However, you should ask on [Super User](https://superuser.com/) since this topic is not directly related to programming.
Answer: Linked Clone is better the full cone why because we are running multiple copy of linked clone still we don't get any issue
fatastic
Thiyagu
Comment: Use correct spelling, punctuation, and grammar to the best of your ability.
Comment: Glad to hear that you are facing no issues with multiple linked clones.. I was wondering the same, if I create a linked clone, will the changes to the linked VM reflect on the host VM?


AD7768-1 library " Arduino "

Question: I am working on a project and I need an AD7768-1 library to make this analog-digital-converter talk to my Arduino using SPI.
" The AD7768-1" doesn't exist in Arduino's library.
Thanks in advance.
Comment: There doesn't seem to be a ready to use Arduino library for this part. Though I found one for [AD7705/6](https://github.com/kerrydwong/AD770X). If the parts are similar enough you might be able to make this library work with AD7768 with only few changes. Also AnalogDevices provides a no-OS code (general code for devices without an OS like microcontrollers), though you would need to find out how to use it and how to provide it with its needed SPI hardware routines. And depending on your project it might be easier to just write your own SPI code for it without a thirdparty library
Comment: please add a clear, answerable question to your post
Answer: At present, there is no Arduino library available for this device. As suggested by @chrisl, the easiest way to proceed would be to develop your own driver. However, if you wish to leverage all the advanced features of the device, you could use the drivers provided by Analog Devices. The AD7768-1 differs significantly from the AD7705/6!!!. Having personally interfaced with this device (and AD7768/AD7768-4) using STM32 microcontrollers and Xilinx FPGAs, I would recommend using the no-OS drivers provided by Analog Devices. This approach has worked well for me using an STM32:

Please read this article first: Understanding and Using the No-OS and Platform Drivers.
And this one:No-OS Overview.
Gather all the necessary files you would need from the Analog Devices Github repository no-OS:
Get AD7768-1 drivers from the "/drivers" folder.
Get Platform Drivers from "drivers/platform/". Since we are using STM32, then pick one of these three (STM32, MBED or Generic):/STM32: suitable for STM32CubeIDE or similar. I will use this one. MBED: for MBED platforms. Check this out AD7768-1 IIO Application. Generic: With this one, you need to fill-in platform peripheral calls manually (in the case of Arduino platforms, this would be something like SPI.beginTransaction, etc.).
All the associated source and header files are available in the same repository.
To simplify, I would assume you are using STM32CubeIDE and you just want to configure and read data from the device. Then,
Configure the STM32 Microcontroller as an SPI Master-Full-Duplex MODE 3 [MOSI, MISO, CLK].
Slave select PIN software-controlled [SS].
[Optional] One Pin for data-ready interrupts [DRDY].
Place the required source and header files in their respective
folders. At a minimum, you need (ad77681.c/h, no_os_spi.c,
stm32_spi.c, no_os_gpio.c, stm32_gpio.c) and all their linked header
files.
Initialize No-OS drivers and platform drivers. It would be
something like this:

struct stm32_spi_init_param stm32_init = {
      .chip_select_port = 1,
      .get_input_clock = &HAL_RCC_GetPCLK1Freq
  };

struct no_os_spi_init_param spi_init_param = {
      .device_id = 1,
      .max_speed_hz = 64000000,
      .chip_select = 6,
      .mode = NO_OS_SPI_MODE_3,
      .bit_order = NO_OS_SPI_BIT_ORDER_MSB_FIRST,
      .platform_ops = &stm32_spi_ops,
      .extra = &stm32_init ,
      .parent = NULL
  };

 struct ad77681_init_param ad77681_init = {
      .spi_eng_dev_init = spi_init_param,
      .power_mode = AD77681_MEDIAN,
      .mclk_div = AD77681_MCLK_DIV_8,
      .conv_mode = AD77681_CONV_CONTINUOUS,
      .diag_mux_sel = AD77681_AIN_SHORT,
      .conv_diag_sel = false,
      .conv_len = AD77681_CONV_24BIT,
      .crc_sel = AD77681_NO_CRC,
      .status_bit = 0,
      .VCM_out = AD77681_VCM_2_05V,
      .AINn = AD77681_AINn_ENABLED,
      .AINp = AD77681_AINp_ENABLED,
      .REFn = AD77681_BUFn_ENABLED,
      .REFp = AD77681_BUFp_ENABLED,
      .filter = AD77681_SINC5,
      .decimate = AD77681_SINC5_FIR_DECx32,
      .sinc3_osr = 0,
      .vref = AD77681_VOLTAGE_REF,
      .mclk = AD77681_MCLK,
      .sample_rate = AD77681_DEFAULT_SAMPLING_FREQ,
      .data_frame_byte = AD77681_DECIMATION_RATE,
  };

Finally setup the Device like this:

struct ad77681_dev *device = NULL;
struct ad77681_status_registers *status = NULL;
int32_t init_status = ad77681_setup(&device, ad77681_init, &status);

If the init_status is 0 then you've successfully initialized the device!! You would read data like this:

ad77681_spi_read_adc_data(device, data_buffer, AD77681_REGISTER_DATA_READ);

I hope this is helpful.

AD7768-1 library " Arduino "


What is this insect (or spider)?

Question: Location: Vienna, Austria
Date: July 18th
Daytime: around 5pm
Begaviours: none, unfortunately. Just walking
I take these to be six legs and some kind of appendices. But I am not entirely sure.
Answer: This is a true bug larvae - thus, an insect - you correctly counted six legs :)
Characteristics of true bug larvae are the combination of the rostrum, the wing pockets and the dorsal scent glands (although the latter both are hard to see on the photos).
I suspect the specimen to be a member of the family Coreidae as it exhibits typical (larval) characteristics of this family: a rhomb shaped body and long legs and antenna. Also spines are a common feature of this family.
Although a bit hard to tell from the photos, I find it to be most similar to Coreus marginatus, a common species in Central Europe.
Comparing two of the specimen's photos with those showing C. marginatus from a similar perspective, shows that - besides the general habitus and coloration - the number and position of the dorsal spines (2 x 2 central and 2 x 3 lateral) match well.
Also, the antenna are relatively large in comparison to the body (compare also this photo).
In comparison, a Leptoglossus occidentalis larvae (as this species was suggested in another answer) would have a generally more elongated habitus with thinner antennae. And, most strikingly, L. occidentalis larvae have a more-than-body-long rostrum.
For comparison, here are more photos of...

European Coreidae here or here
C. marginatus larvae
L. occidentalis larvae

Image source (in reading direction):
B. Schoenmakers CC-BY-3.0 |
B. Schoenmakers CC-BY-3.0 |
B. Schoenmakers CC-BY-3.0 |
Slimguy CC-BY-4.0
Answer: I think it could be this animal. It is the nymph of Leptoglossus occidentalis, the Western Conifer Seed Bug.
It fits in terms of size and the greenish-brown colour of the abdomen. Also the position of the spikes and the long antennae are a match, eventhough the antenna look a bit more flat and broad in your picture and less hairy.
This invasive species is originally from the US. It was first recorded in Vienna in 2006.

What is this insect (or spider)?


which browsers are in scope for Tridion 2011 and Tridion 2013?

Question: I'm beginning some work on some new Tridion GUI extensions and I'll like to use CSS3 and some HTML5 features.  I'm guessing 2011 was scoped for IE7, but is that true of 2013? Does Tridion use any polyfills, or feature detection?
Answer: The following web browsers are listed as supported in the documentation for SDL Tridion 2013, under Content Manager Explorer prerequisites

Internet Explorer 10.0
Internet Explorer 9.0
Safari 6.0 for the Mac
Google Chrome, latest version
Mozilla Firefox, latest version

I'm not aware of any polyfills or feature detection in use. This doesn't mean that you can't use them in extensions yourself of course :)
Comment: Dammit David, I just posted *exactly* the same thing, only to find I was some minutes behind you.
Comment: Apologies; Have a comment upvote on the house. If it's any consolation, Nuno has done that to me many, many times :)
Comment: There's a difference between _supported_ and _tested_. The warning is there just to let you know that something _may_ not work, because we couldn't test it before the product was released.
Comment: Thanks David. Regarding the latest versions of chrome and FF, I saw in the config for 2011 that the browser version is hard coded in. Since Chrome updates pretty fast, it gets tiring when I see a "browser out of date". Will that change in 2013?
Comment: I understand your point of view, but no this will not change with 2013. You will still see a warning if you use a browser version that is not considered to be supported.


Non-conservative electric fields

Question: Is the electric field produced by uniformly moving charges non-conservative? And if it is, then why?
Comment: See the answer [here](https://physics.stackexchange.com/a/251788/9887)
Answer: For a field to be conservative, you need $\nabla \times \mathbf{E} = 0$. See in my answer here how this relates to converservation of energy and path indepenedence.
The third Maxwell equation (Faraday's law + Lenz's law) states:
$$ \nabla \times \mathbf{E} = -\frac{\partial\mathbf{B}}{\partial t} \neq 0. $$
This is your first inkling that, when you have moving charges and hence electrodyanmics (as opposed to electrostatics, where $\partial/\partial t = 0$) entails a non-conservative electric field.
If you don't want to use Maxwell's equation, you can also start from the general expression for the electric field $$ \mathbf{E} = -\nabla\phi -  \frac{\partial\mathbf{A}}{\partial t},$$
and left multiply by $\nabla \times$, obtaining the same result.

Now, to be a bit more pedantic.  In order to have $\nabla\times\mathbf{E} = 0$ from the equation above, you require:

either $\partial/\partial t = 0$, i.e. electrostatics
or $\mathbf{B}  = 0$
or  both.

This is why, I am assuming, knzhou asked you about accelerating charges in the comment.  Because, what if you have a moving charge which is not generating a magnetic field? Then $\partial/\partial t \neq 0$ but $\mathbf{B} = 0$, which guarantees an overall $\nabla\times\mathbf{E} = 0.$
However, you already know that a charge moving at constant velocity is basically a current (if you consider a very small length element $\mathrm{d}\mathbf{r}$), which you know creates a magnetic field $\mathbf{B} \neq 0$.
Indeed, the full expression for the electric and magnetic fields is given here, and an example of the expression is given in the answer linked by Alfred Centauri.

Let me add a final remark.
What if you travelling in a frame of reference that moves at the same speed as a constant-velocity moving charge? Then you would see the charge as stationary, with both $\mathbf{B} = 0$ (ignoring spin) and $\partial/\partial t = 0$.  This is because magnetic field naturally come out of electrostatics + special relativity, i.e. they are electric fields seen in a different reference frame. (magnetic fields from magnets are still relativistic because they come from spin, which is a "relativistic" effect in the sense that it comes from the Dirac equation).

Non-conservative electric fields


Security Modules - Hardware vs. Software

Question: In terms of PCI requirements and compliance, is a software-based key management module like Gazzang zTrustee an acceptable solution to the PCI requirements that a (hardware) HSM solution like AWS CloudHSM solves?
Answer: Something like a Gazzang zTrustee could be used to meet the PCI key management requirements. The trick would be to make sure that they help you follow all the requirements for PCI compliance. A good way to do this is to see if they are FIPS 140-2 certified, or at least follow the FIPS 140-2 standard published by NIST. A short review of the their site I don't think they are certified by they do mention that they follow FIPS requirements. It would take some more digging and asking questions to see what they actually mean by that.
As a more general answer to your question, PCI doesn't dictate that you have to use a hardware device for key management. You can use a either or a combination, anything that helps you meet the outlined requirements in section 3 of the PCI DSS.
Answer: The previous respondent has done a good job of answering your question. However, here is some additional insight.
a) Gazzang is no longer going to be selling or supporting their zTrustee solution starting next year 2015 (the support ends in June or July). So all Gazzang customers are looking for other solutions.
b) You should also take a look at PCI DSS 3.0 requirements since it appears that you are just starting to look into this issue.
c) As the other guy has mentioned, you don't need to use a FIPS compliant solution in order to comply with the PCI DSS mandates.
d) You might want to look at this solution. Interesting people behind this company (the guy who actually wrote the file system framework that is used by eCryptfs).


I have mechanic licence from Turkey.Is there any way to easly get or change mechanic technician licenses in Alberta or Ontario

Question: I am auto mechanic.  I came to Canada 5 years ago I wanna do my job here but almost all places saying you need 4 years and every year 1500 hours and 8 weeks school than you can get license.  Is there any way to avoid that time or make it Less with my turkish mechanic license and experience?  Thank you .
Comment: https://www.immigration.ca/automotive-mechanics-automotive-technicians/ — talk to someone about it
Comment: There should be institutions in Canada that deal with the foreign qualifications of immigrants. Canada is pretty open immigration wise. They should have mechanisms that credit foreign qualifications.
Comment: This might be a better question for [Expatriates.SE].
Answer: In Ontario, you can apply for a Trade Equivalency Assessment.

Skilled Trades Ontario's Trade Equivalency Assessment is the first step towards obtaining a Certificate of Qualification for experienced workers who have not completed an Ontario apprenticeship but who have equivalent skills and experience. The Trade Equivalency Assessment determines whether you can challenge the certifying exam for a trade. If successful in the exam, you would pay a fee to be issued a Certificate of Qualification in that trade.

In other words, this is a certification that you've gained practical skills and have enough work experience (which I would expect to be about four years, since that's what's required for people starting from scratch via the Ontario  apprenticeship system.)  You then also have to take a certifying exam.
In Alberta, you can apply for the Trades Qualifier - Work Experience program.  For an Automotive Service Technician, this requires:

A minimum of 72 months AND 9,360 hours of work experience.
A successful theory exam.
A Trades Competency Verification (TCV) [a practical exam — ed.]


Cost-push inflation and labour shortage

Question: Is it possible for there to be a shortage of labour in an economy when there is cost-push inflation?
Answer: The definition of cost-push inflation is an increase in aggregate prices driven by an increase in the cost of labour and/or production inputs.
A shortage of labour could put upward pressure on wages, yielding this type of inflation. So, yes, it is possible. However, it is not necessarily true that cost-push inflation is caused by a labour shortage and it is also not true that a labour shortage will always cause cost-push inflation.
Answer: Generally speaking, a cost-push inflation is defined as an increase in the general price level caused by an increase in the production costs of a firm (or, in case we analize the general macroeconomic context, in the production costs of all the firms) that is charged to the consumer.As it is explained above, the labor shortage enters the game in the sense that this fact puts an upward pressure to wages and then to prices, since the firms - in order to keep their profit margin at least constant - have to raise prices to cover the increase in wages

Cost-push inflation and labour shortage


Cronbach alpha and item selection

Question: I am a relative novice when it comes to statistical analysis, so forgive me if my question is unclear, or simply stupid. I am also not a matemathician, as I work in social science research, but I have some working knowledge of statistics. I am currently helping a friend conduct a study where she is using a 45-item questionnaire to assess HIV-related knowledge in adolescents. The questionnaire is the translation of a properly validated English questionnaire. After administering the questionnaire to about 100 students, I conducted a reliability analysis on the questionnaire, to see whether it remains consistent after translation, in a new cultural background, and Cronbach's alpha was .323, which is extremely low. After removing items stepwise, we managed to retain 39 question items. Running reliability analysis in SPSS on the remaining 39 items results in an alpha of .745, which is acceptable. However, my question is the following: Is it acceptable and valid practice to simply delete all responses related to the deleted items, and run the intended hypothesis tests (for instance an ANOVA to check for differences in HIV-related knowledge between socioeconomic groups of adolescents ) on the remaining data, or should the questionnaire be re-administered with the reduced number of items before proceeding? My hunch is that this would amount to cherry-picking data, but I am not entirely sure.
Thank you for any responses!
Answer: The question is more complex.  When you got a low Cronbach alpha, the next step would be to look at the interitem correlations. One thing that sometimes happens is some items are reversed. After that, I suggest doing an exploratory factor analysis to try to figure out more of what is going on.  You could also look at the performance of each question.
However, to your question: Yes, your suspicion is correct. You should use a new batch of respondents and re-do the analysis.  At least, that is the proper thing to do.
Comment: Thank you for your answer! Yes, I have already planned a factor analysis as the next thing to do, although, since the questionnaire is the translation of a foreign questionnaire with a proven monofactorial structure, what I should be doing is a confirmatory factor analysis, as far as I understand. However, since I currently only have the first batch of repsonses, that will have to wait.

Cronbach alpha and item selection


What is a density function?

Question: I know about histograms and also know that if we connect the mid-points on the top of bars in a histogram we will get a frequency polygon. This polygon could then be 'smoothed' in a way that it generates a frequency curve like in normal distribution, Poisson distribution, etc. What is smoothing? How is it done? I have heard about the 'filtering techniques' and 'removing noise' but I don't understand the terms. Googling yields things like Kalman filter, moving average filter, low-pass filter, kriging, convolution, etc but they are very abstract concepts for me. Is there any good resource to start learning about these things from scratch?
Comment: http://en.wikipedia.org/wiki/Kernel_density_estimation introduces a common technique in this area with many links.
Comment: Thanks @NickCox. I have tried several online tutorials including the wikipedia page you suggested but I don't understand why every explanation is so technical. Everyone starts with describing histograms but then suddenly jump to mathematical descriptions of kernel density estimation. I haven't found a simple example describing how smoothing changes the original data and helps in identifying the general trend. Isn't there a simple, humanly understandable explanation somewhere?
Comment: There is no omelette without breaking eggs: the idea of a density function does depend on a little calculus. I wrote a review on kernel estimation, which is at http://onlinelibrary.wiley.com/doi/10.1002/esp.1518/abstract but you might not have access to it.
Answer: To start with the title question, the density function is (for a continuous random variable) a function that describes the relative probability of the values taken by the variable (it is not probability! the word relative is important, since the probabilities are all zero); loosely it's proportional to the probability of being within a very small interval containing the point.
So where the density is high, values are relatively more probable, and where it's low, values are relatively less probable.
Areas under the density, between values on the x-axis, do give probabilities of lying in those intervals.
Here's an example of a density function:

The height can be taken as relative probability in that the height at 2 (about 0.27) is saying that a value very close to 2 approximately twice as probable as a value very close to 4 (where the density is about 0.14). [At the risk of sounding repetitive, the density at 2 is not the probability of getting 2, because density is not itself probability. Indeed density can happily exceed one for example.]
You could work out the probability of getting a value between 2.5 and 3.5 by finding the area of the curve between those values (that area turns out to be 0.223 for that density).
See this description relating to an analogy which might give a clearer sense of why it's called 'density'.
When dealing with discrete random variables, such as counts (and this is where the Poisson you mentioned comes in), you're not dealing with density, but an actual probability function (sometimes 'probability mass function'). The height of the probability function is actually the probability of the given value.
You seem to be envisioning specific, named probability distributions as things obtained by manipulating something derived from data (smoothing a histogram).
Generally speaking a probability distribution such as the normal is a model, a hypothetical construct that is an approximation for the behaviour of some variable or variables.
Such simple models are not typically obtained by 'smoothing' a histogram or a polygon, but suitability (or more accurately, unsuitability) might be approximately assessed by considering such displays. Beware, however; using things like histograms - and by extension, frequency polygons - to assess distributions. Using them for this purpose must be approached with caution, as they can be misleading if taken too readily at face value.
QQ plots and quantile plots or empirical cumulative distribution functions  would often be a better way to spot the suitability of such models, though interpreting QQ plots in particular require a little more effort to learn.
See also this answer.
Smoothing of empirical distributions to produce approximate densities does happen (though kernel density estimation would be a more common way to do it than looking at frequency polygons, along with a few other techniques for producing smooth density estimates), but not, typically to identify a simple functional form. Usually such smoothing is done instead of identifying a specific functional form - one can deal with the smooth density estimate on its own terms, without naming it.
See here for a non-mathematical description of what a kernel density estimate is.
Here's a kernel density estimate, for data that doesn't come from a normal distribution, or a gamma distribution, or a lognormal, Weibull, beta, Burr, etc, etc:

As with a hypothetical density, these empirical density estimates give some assessment of the relative probability (assuming the density is smooth and doesn't vary too quickly)
Your later questions at the end there conflate a whole set of topics which are mostly unrelated to the initial question. You might do better with some books to start, rather than googling, which will lead you through a topic rather than exposing you to large numbers of not-closely related terms.
A possibly relevant post to a number of those topics with a number of links is here
Comment: Thanks @Glen_b. Am I confusing the 'smoothing' in time series data to remove noise with the 'smoothing' of frequency polygon to obtain a density function? Are they related or two completely different concepts with same names? My real goal is to understand kernel density estimation and eventually convolution which I am using to remove noise from traffic flow data.
Comment: Those things are definitely related, but smoothing an actual frequency polygon is *almost never done in practice* when the desire is to produce a density estimate. (There's been  some additions to my answer after your comment was posted - though not directly in response to it)

What is a density function?


Does antenna orientation matter?

Question: Does the orientation of transmit antenna affect the path-loss of a signal transmitted by an omni-directional antenna? If so, how are antennas optimally oriented? I am specifically interested in knowing how eNode antennas in LTE are oriented in the downlink transmissions to ensure propagation loss is minimized?
Comment: You have to be more specific. Yes, each antenna (even a omni directional one) has a so called radiation pattern and thus the direction of radiation matters.
Comment: Are you talking about the orientation of the receiver antenna?
Comment: No. Transmit antenna.
Answer: Yes, it does, in general.
Considering a simple half-wave dipole, which is what you're probably thinking of as an omnidirectional antenna, its radiation (or reception) pattern is strongest perpendicular to the elements, and has nulls off both ends.  Additionally, the polarisation of the signal is along the elements.  Since a dipole is typically mounted vertically (so it is omnidirectional with respect to the horizon), it will transmit (or receive most efficiently) vertically polarised signals.
A loop antenna can be mounted horizontally to give a horizon-omnidirectional pattern with horizontal polarisation.  This will have nulls perpendicular to its plane.
A pair of cross-mounted loop antennas with a phase-shift network can be used to give circular polarisation in two specific (opposite) directions, and linear polarisation in other directions.  Some people use these for contacting satellites without the need for pointing equipment.
Antenna theory is a very broad field.  You should definitely choose an antenna type and mounting position to properly suit your application.

Does antenna orientation matter?


oo question - mixing controller logic and business logic

Question: I'm not sure if I'm using "standard" terms, but this is a basic OO question I'm trying to resolve.
I'm coding a windows form.  I don't want logic in the form event handler, so I just make a call to a custom object from there.
At the custom object, there are two sets of logic.

The "controller" logic, which decides what needs to get done and when.
The actual business logic that does what needs to be done (for example a control that performs a math operation and returns results, etc.).

My question is, does OO architecture allow for having both of these in a single object?  Or is it recommended to split them out into a "controller" object and a "business logic" object?  Is there a design pattern I should refer to for this?
For the time being, I've started down the route of combining them into one object.  This object has a "start" method which contains the controller logic.  This method then calls other methods of the object as needed, and ultimately returns results to the caller of the object.
Answer: What you're doing is a form of "fat controller" architecture.  These days software development is trending toward thin controllers.
OO design is all about decoupling.  If you internalize only one thing about OO programming, let it be that.
Check out "Domain-Driven Design Quickly."  This free e-book is a condensed introduction to the concepts covered in Eric Evans' important book "Domain-Driven Design."
Getting educated in these concepts should help you to understand how to separate business logic from the controller, or service layer.
Answer: In general, you should probably have these in two different objects, but there's a qualifier on that.  It may make sense, if your project is small enough and your object model is not complex enough, to have the functionality composed into one object; however, if your functionality is complex enough, it's almost certainly going to be better for you to segregate the controller and the business objects.  At the very least, design the system with an eye towards separating the controller and the business objects at a later point, if you don't completely separate them now.
Answer: No, I don't put business logic in controllers.  I add an intermediate service layer that's injected into controllers.  Let the service do the work.  Controllers are for routing requests and marshaling responses.
Putting the logic in a clean service layer is "service oriented", even if you aren't using web services or WSDL.  It has the added benefit of still working if you decide to change controller/view technologies.
Answer: The answer to you design question can is as the following scenario: how would you design your application if you also had to provide a web-client for it.
Both your Windows Forms UI and you Web UI would be calling the same classes and methods. The only difference, then, would be how each populates the UI and communicates with the other layers.


In a way aren't Non-Disclosure and Non-disparagement Agreements functionally very similar?

Question: At a high level NDAs basically say "do not disclose confidential information to the public". At a high level Non-disparagement agreements basically say "do not disclose information to the public that could harm us". Both are trying to protect the company from damage caused by information getting into the wrong hands. For example if a bank was hacked into and lost a bunch of money, wouldn't both NDA's and non-disparagement agreements prevent employees from telling the public about it? I guess NDAs are more about facts where as Non-disparagement include negative opinions.In a sense are all non-disparagement a type of NDA because they are prohibiting what could be said?
Answer: Not all disclosures are disparagements, an NDA will typically cover the release of any private information, whether positive or negative. Publishing the company's future product plans might violate an NDA but would not be disparagement.
Not all disparagements are disclosures, a negative opinion does not require the release of any private information. Making a blog post stating your opinion that the company's CEO is incompetent or that their products are overpriced is likely not disclosing any private information that would be covered by an NDA, but is disparagement.
Comment: Would such non-disparagement agreements be enforceable, saying that the CEO is incompetent or the products are over priced, especially if the opinion is based on objective and publicly available information?
Comment: @CoriolisForceFighter Non-disparagement is very different from defamation or libel, in both of which cases the truth is an absolute defense. That's not so for non-disparagement, you generally can't make negative statements whether they are objectively true or publicly known already, or if they are subjective opinion. You can't defame someone by saying something true about them, but you can disparage them by saying something true, false, objective, or subjective.
Comment: I'm guessing a non-disparagement agreement doesn't prohibit reporting to the authorities. Like starting a lawsuit, talking to the police or reporting to the labour board for non-payment. I asked this here https://law.stackexchange.com/questions/92170/could-a-contract-prevent-someone-from-talking-to-the-authorities
Answer: In the employment context:
A non-disparagement agreement: the signatory agrees not to say anything negative about the employer or its staff, goods or services.
A non-disclosure agreement: the signatory agrees to not reveal to anyone information the  employer wants to keep secret. For example, financial information, customer data, trade secrets, marketing and pricing strategies, techniques and costs, operating information and costs like payroll, suppliers etc.
Things a company might prefer to be secret are not necessarily negative about the company. They could be neutral. They could be positive - for example, the progress of a cure for some cancers.
Comment: or they could be mandatory and excluded from non disparagement agreements by law, e.g. reporting money laundry as a bank employee.
Answer: Both positive and negative information about a company might hurt them if it becomes public and is therefore meant to be covered by an NDA. But damage isn't needed. If I say something that nobody cares about, or that actually helps the company, that would still be covered by sn NDA except I wouldn't be likely to be sued.
Positive information will often not be disparaging and will not be covered by a non-disparagement agreement. (But making lots of money by legally exploiting a customers naivety might be positive and disparaging at the same time). Negative information may be already known to the public but repeating it would still be disparaging.
And I should really ask a question whether false statements are covered by an NDA. I'm sure negative statements could be disparaging whether true and false and covered either way.


Upgrading to ufw on Ubuntu 9.04

Question: I've recently upgrade my Ubuntu server install to 9.04.  I'd like to install and use ufw.  Is there a way to import my existing iptables into ufw?  I'm worried about switching it on, and having all my ports closed.  I'd like to open up a single additional tcp port, but don't want to go through the complicated process of changing my iptable rules.
Answer: Manually put your old rules in "/etc/ufw/before.rules" or "after.rules".  These are in standard iptables format. There is also var/lib/user.rules, but these are overwritten by adding rules via ufw. Put your existing rules in place, add your new rules via ufw allow, and enable ufw afterwards.
Comment: I haven't configured iptables in over a year, so I don't want to relearn the process just to open a tcp port.  This is exactly what I need to get going with ufw.
Answer: ufw is an intuitive frontend to iptables for newbies.
If you already grok iptables, I see no reason why you should switch.
Answer: i guess you can keep your iptables rules and do something like this:

open a screen window
sudo ufw enable && sleep 120 && sudo ufw disable (be sure it wont ask you passwd :D)
do you testing and in a worst case scenario wait 120 secs

With this method you can test certain rules, without having an issue when you have to go to the co-loc.

Upgrading to ufw on Ubuntu 9.04


Why are Loki's eyes blue in The Avengers?

Question: I don't understand really any of this! In Thor, Loki's eyes were green. Clearly green. But in The Avengers, they were blue. You can clearly tell. But then in Thor: The Dark World, his eyes are green again. So I have no idea.
Comment: The photos you provided are not helpful. I zoomed in 200% and what I see are dark eyes on the left, and dark eyes with reflection highlights on the right.
Comment: Too much _spice_ consumption.
Comment: In the actual legends he turns himself into a female horse to foal Odin's eight legged steed.   Pretty sure eye color is small potatoes.
Comment: He's the god of lie, mischief and deception. I'm sure he can have the colour he wants in his eyes.
Comment: There's no way green and blue could ever look like each other in different light!
Comment: Perhaps it's the staff, perhaps it's a costume inconsistency between film crews
Comment: Most people go to the eye doctor once a year. Loki got a new prescription for his contacts and changed from a brown to a blue tint.
Answer: I believe this may be an artifact of Thanos'/the Staff's control.
Here is a photo of Hawkeye towards the end of the movie (after he has been released from the staff's control):
His eyes appear to be brown.

His eyes are colored similarly in the art for Age of Ultron

And here is Hawkeye while under the control of the staff. His eyes are suddenly blue!

Erik Selvig seems to go through a similar transformation.
Normal Erik:

Controlled Erik:

Marvel's official site confirms that Loki was under the effect of the scepter. It could be a weaker control, possibly explaining the lesser visual effect than the one we see on Hawkeye and Erik.

Arriving at the Sanctuary through a wormhole caused by the Bifrost, Loki met the Other, ruler of the ancient race of extraterrestrials the Chitauri, and Thanos. Offering the God of Mischief dominion over his brother's favorite realm Earth, Thanos requested the Tesseract in return. Gifted with a Scepter that acted as a mind control device, Loki would be able to influence others. Unbeknownst to him, the Scepter was also influencing him, fueling his hatred over his brother Thor and the inhabitants of Earth.
Comment: Nice find and good captions.
Comment: For those trying to remove the screenshot, Marvel's site seems to be in flux lately and is removing/updating a lot of pages. I've included the screenshot as reference.
Answer: Loki's eyes are actually blue. In the comics, Loki's eyes are green, but it is unclear in the films what eye colour Loki has because they seem to change from blue to green. However, the actor, Tom Hiddleston has addressed this question and confirmed that they are indeed blue:

"In making [Loki] with this raven black hair and blanching my face of all color, it changes my features. Suddenly my blue eyes look a lot bluer, which lends a severity to my face."

It is common for people to have eye colours that seem to change colour (found particularly in hazel eyes). Elizabeth Taylor is a good example: her eyes looked purple when they were just a deep blue. Some people who have brown hazel eyes appear to have green eyes while others may have green eyes that appear blue or vice versa. This can be caused by the clothing colours, sun exposure (aka lighting) and makeup.
As for the Tesseract theory, when you compare Hawkeye's and Dr. Erik Selvig's eyes to Loki's, you'll notice that both Hawkeye and Selvig have hardly any pupils under the power of the mind stone, while Loki does (which further proves he wasn't under its influence). So, while this theory is interesting, it most likely isn't the case.
Answer: Hmm, it's hard to say what really caused the eye color change BUT my father had hazel eyes that usually looked blue, but, when he was angry or upset, would shift to a bluish brown.  (I need to point out here that no one has eyes that are only one color; the predominant color is what you see.)  While my father had hazel slated towards blue, mine are blue with gold and green highlights.  MOST of the time they look completely blue, but when I'm emotional or in hazy lighting they look hazel.
Personally, I think that Loki had green eyes with blue highlights that kinda swamped the green when he was not in his right mind or under another's influence--both of which happened in the first Avengers film.  Poor Loki had a universe sized case of PTSD complicated by Stockholm Syndrome.  No wonder his eye color shifted!
Answer: In Avengers, Loki's eyes were blue, because he, also, was under the Tesseract/Thanos' control. I'm very sure that Tom Hiddleston's eyes are blue-green, whereas Loki's (original Loki, from comics) eyes are green. So sometimes Loki's (Loki in the Movie) eyes appear green and sometimes they appear blue, but I know that in Avengers, his eyes were made blue, because of the Tesseract's control. Some people say that Marvel doesn't use contacts, but that's not true. They had to change Hawkeye/Clint Barton's eyes to blue in Avengers and also Erik Selvig's eyes. So Tom's eyes are blue-green and in Avengers his eyes were blue to show the Tesseract/Thanos' control. But, you need to remember, original Loki's eyes are actually green. Not blue-green or any in-between, just green
Answer: I believe that Loki was under Thanos' control, but instead of being mind-whammied like Barton and Selvig was, his thoughts have been influenced and warped to suit Thanos' needs. Note that in Thor 1 he said that he didn't want the throne, he only ever wanted to be Thor's equal.
At the start of the movie where he steals the tesseract, he looks very ill. I think it's because he has been tortured through heat, as he's a Frost Giant and prefers the cold. Warmer temperatures are most likely very uncomfortable for him.
In The Avengers, Banner says that you can practically smell crazy on Loki. Loki is many things, but he is not crazy. He acts with passion and intelligence. If he really wanted to invade Earth, he wouldn't have done it the way he did. He would've gotten people to trust him and worked from the inside, and when people were least expecting he'd attack.
In Thor: Ragnarok, he had the throne. But he did nothing, he only invested in theatrics and ate grapes while amusing himself through plays. He didn't do anything with malicious intent, and Asgard seemed fine under his rule. He's a sneaky bastard and no one really suspected, though I don't doubt some were suspicious of 'Odin's' behaviour.
Addition, in Infinity War, Thanos stated 'no resurrections this time'. I am going to assume that Loki died due to his fall, and Thanos found him adrift and thought hey, he's perfect to be my general, so he brought Loki back to life just to torture him further.
Answer: The info I can find points out these two key details:
After falling from the Bifrost and into the void, Loki spent a good year in the realm of Thanos, the Other, and the Chitauri.  (It may have been longer, the way that Sakaar time is much longer than regular time.)  Loki's actor describes it as "the seventh circle of hell," and various fic writers have taken this to mean that Loki was tortured by Thanos in much the same way as Thanos tortured Gamora and Nebula, molding them into his servants.
(I do like the idea that Thanos resurrected Loki -- that gives that line a good context.  You could take the thought that Loki died in the void, Thanos revived him, and then, over a full year of torture, repeatedly brought him back to life, never letting him escape the torments.  Small wonder his mind might be a little unhinged when he returns to Earth!)
The scepter definitely had an effect on Loki (that's confirmed, not speculation), though not outright control like with Hawkeye -- it was more like amplification of his negative feelings.  So the motivations of Thor (desire to be valued, admired, to fit in, to prove that he's capable and not weak or stupid or unworthy; self-hatred, casting aside the "inferior" parts of himself; his self-esteem damaged through centuries of neglect and lies) would've been even greater factors than they were to begin with.  Hence his lack of moderation and compassion throughout this one film, compared to any other film in the franchise.
Comment: This seems like a reasonable explanation but would be greatly improved if you [edit]ed in some evidence.
Answer: I think he just has hazel eyes like me my eyes can look blue or green depending on the lighting,makeup,or what I'm wearing
Answer: Tom Hiddleston has the same problem. His eyes are green in some lights, grey in some and blue in some. From birth they were identified as blue.
Loki's eyes are the same as Tom's, and it is Tom's fault they seem to change because in different lights his eyes look different. Loki was under the power of the Mind Stone, but the sceptre never controlled him the way Clint and Dr Selvig were.
It's just the actor's real eyes that are confusing you all!


Homes needed in June

Question: My "abandoned kitty" of poss under 12 months ,moved in and now has 3 adorable kittens. So what do I do. Mum trusts me and now I adore her. Help. Need to home the 3 in Orihuela Costa Spain. They will be used to being handled and house trained as mum is so loving !
Comment: It looks like you need an advertising board but unfortunately this site isn't that. Maybe Quora or reddit allow these kind of requests. On Pets.se they are off-topic, not allowed. Please visit the [help] if you want to read more background on the site policies.
Comment: Possible duplicate of [Found 4 kittens in a bush in my side yard, don't know what to do](https://pets.stackexchange.com/questions/6386/found-4-kittens-in-a-bush-in-my-side-yard-dont-know-what-to-do)
Answer: Contact your local animal or cat rescues. They can help you find homes for your cats. Some rescues will travel, so even if you don't have any that are very close to you, contact whichever ones are closest. If they can't help they might know another rescue who can. If the first rescue you contact can't help you, try another one.
Alternatively, keep them. Four cats is a lot, but doable, although the vet bills can be hard to manage when you need to get them all fixed.
No matter what, make sure you take mum to the vet and get her spayed so there will be no more kittens to rehome.
Comment: Beta see conversation in chat https://chat.stackexchange.com/transcript/message/43899317#43899317

Homes needed in June


How do you manually allocate space on a server with multiple drives?

Question: I'm setting up a home server that is running Windows Home Server, and I'm really new to this. It has two hard drives, but when setting up shared folders I cannot figure out how to specify which drive the folder should reside on. (Is this even possible?). I want one of the folders to have critical stuff that needs to be backed up, and the second to have non-critical stuff that is not backed up. This seems like it would be easier to restore my critical data from a remote backup if one drive fails. Or maybe this is silly and unnecessary? Thanks in advance.
Answer: Not at all silly,
I work in data recovery and answer questions on sites like superuser while I watch progress bars when the hardware repairs are done and we switch to software to finish the job.
Your non essential data, browser history and temp files really don't need to be backed up.  The essential files obviously should be. Non system folders can be created on either drive then shared.  For system folders like the Documents or My Documents folders, they will already be in a default locations on the system drive.  You can right click on the My Documents(or other system folder) in most cases, select properties and in a click or two move the folder to a different(presumably larger) drive.  Given the fact you're running home server which is reasonably robust it should shuffle all share information and direction to the new location.  Backing up may require a few settings changes or an update of your backup software at this point, but once done should be easy to restore assuming your backup is on a different drive, device or location.


How to refer to a server, router, switch in general?

Question: In a room there is a server, switch, router and SAN switch. What can we call them in general? Can we call them "machines" or "equipment"?
Answer: It's usually just called Hardware.
Answer: "computer systems" may be the formal phrasing, but "servers" is more common. Consider the name of the room itself: often referred to as a datacenter (when dealing with large scales) or the "server room" (when dealing with a smaller scale). While "servers" is a bit of a misnomer, since there may telecommunication equipment in the room, the label is understood as a synecdoche of all equipment. (As I understand it, "server room" has been in use since the late 70s, before that "computer room" was used.)


What if the bitlength of the value evaluated in Barrett reduction is greater than 2k the modulus?

Question: For $c\equiv a \pmod n$, in Barrett Reduction, $\mu = \lfloor{\frac{2^{2k}}{n} \rfloor}$ is precomputed, where $k = \lceil{\log_2{n}} \rceil$ and the bitlength of $a$ is assumed to be less than $2k$. What if the bitlength of $a$ is much greater than $2k$? Is the result of Barrett Reduction still correct?
Comment: That will depend on what you do with $\mu$. What about describing it?
Comment: Computing $c\gets u\cdot v\bmod n$ when $a=u\cdot v$ is larger than $n^2-1$: at least one of $u$ or $v$ is larger than $n-1$. The usual technique computes $\tilde u\gets u\bmod n$ and $\tilde v\gets v\bmod n$, then $c\gets\tilde u\cdot\tilde v\bmod n$, where the intermediary product is now small enough for regular Barrett reduction. For large arguments, this is faster, because the multiplication involves smaller arguments and is less costly. If $u$ (or $v$) is already larger than $n^2-1$, we can use repeated steps of Barrett reduction to compute $\tilde u$ (or $\tilde v$).
Comment: I try to calculate the product $a$ of two integers which might be larger than $n$, and then do the modular operation. I want to use a larger $\mu$ to fit the product.
Answer: This depends upon how close $\mu/2^{2k}$ is to $1/n$.
In Barrett reduction we approximate the integer $q=[a/n]$ with $q'=[a\mu/2^{2k}]$ in the operation
$$a\mapsto a-qn.$$
If we write $\delta=1/n - \mu/2^{2k}$ then the difference between $a/n$ and $a\mu/2^{2k}$ is $a\delta$ and if this is less than 1 then $q$ and $q'$ differ by at most 1 (which is why Barrett has a possible extra $-n$ step). In general, we know that $\delta<1/2^{2k}$ and so $a\delta<1$ for $a<2^{2k}$. For larger values of $a$, note $q-q'$ can be as large as $[a\delta]+1$ and so the number of surplus multiples of $n$ could be that large. In the worst cases, if $a$ is $m$ bits where $m>2k$, then we could be off by $2^{m-2k}$ multiples of $n$. We can of course apply Barrett iteratively or do more conditional subtracts, but this soon stops being efficient in comparison to direct computation of $q$.
Of course, there are also good very good cases where $\delta$ is small (a lower bound is $\delta\ge 1/2^{2k}n$) and we get good behaviour for a large range of $a$ (up to $a<n2^{2k}$ in the best case).
If you want a more accurate generalisation, you can for example use $\mu=[2^{m}/n]$ and shift $a\mu$ right by $m$ and conditional subtract. This is guaranteed fine for $a<2^{m}$, but be careful how $a\mu$ fits into various word sizes. The size $2k$ is chosen simply because it useful when multiplying two numbers less than $n$ together and reducing modulo $n$.


Nomenclature of Acetone

Question: Why is the preferred IUPAC name of acetone "propan-2-one" and why not simply propanone? It doesn't make sense to specify the position of the carbonyl group as it can occupy only one position in acetone, i.e. on the 2nd carbon.
Answer: The IUPAC Blue Book defines rules where locants can be ommitted in IUPAC preferred names.
Unlike terminal locants in names for aldehydes that are omitted, there is no rule for homogeneous chains with three or more identical atoms that would allow for the ommission of the locant $2$ in propan-2-one.
This leads to the result that propanal is a IUPAC preferred name while propanone isn't.
Comment: You might also be concerned why ACETone sounds like it has two carbons and not three (2-PROPanone). It is because acetone was prepared early on from 1-1/2 acetic acids by dry distillation of the calcium salts via a Claisen condensation. The missing carbon is CO2.

Nomenclature of Acetone


Can't build new residential building

Question: After I destroy an old building, I can't build a new residential building, Parisian building, or London building. Any information for this issue?
Answer: If you destroy a residental area, you cannot get a new slot for them, like how factories and stores work. The only thing that will happen is that your population will decrease. If you want to destroy a building because you want to place it in a new place, then you should move the building.
Answer: If you have used up your available building icon, and you want to create a new building (zone actually), you will need to upgrade one of the zones (empty lots) with a building. Then only you will get an additional building/zone available for you to create/place.

Can't build new residential building


no-CMS front end WYSIWYG website editor

Question: Is there a front end WYSIWYG website editor that can edit a webpage without having to install a CMS?
Answer: FTP-based content management systems such as the following offer hosted solutions to managing simple content via a WYSIWYG-style interface:

Veolay
CushyCMS
SimpleCMS

You provide them with the FTP details for your existing site, and they allow you to set editable regions by adding class names to your HTML, which lets clients edit sites directly via a WYSIWYG without having to install software, without having to learn HTML, and without having to make major changes to their existing site.
They can be a little more restrictive in terms of feature set and security than self-hosted content management systems, but they're useful for simple sites and low budgets.
There are also self-hosted equivalents to the above, such as Unify, in case they're of interest.
Comment: Thanks Nick.  I've just installed Veolay, and it works very well.  Very easy to install and use.  Cheers.

no-CMS front end WYSIWYG website editor