Transactions in SQLite with Flask

Question: I'm writing a Python web app using Flask with SQLite as the database
I have a table with an auto-incrementing PK and filenames.  I want to generate the filenames as I'm inserting into this table, so that the first file is named file1, second file2, etc.  What is the best way to do this?  My first thought was to just do a transaction where I figure out the next auto-inc, generate the filename, then insert into the database and commit.  Problem is I can't seem to find anything about transactions in Flask, it sounds like it's done automatically, but I'm not sure if I can rely on the id lookup and insert being atomic.  The other alternative I guess would be somehow using the auto-inc value in the insert statement, is that new value available at that point somehow?  Any insight into these approaches or an alternative would be appreciated!
Comment: No, I mean, why not simply do something like this: `now = datetime.now(); conn.execute("INSERT INTO MyFileTable (Created) VALUES (?)", (now, ));`  Then later you can get the id out of the database `id = conn.execute("SELECT ID FROM MyFileTable WHERE Created = ?", (now, )); print "filename{}".format(id)`?  `Created` could be any other way you have of uniquely identifying these files.
Comment: Why not just use the primary key?  You'll have to generate the filename in your code, rather than in the database, but if the base name is always the same it will save you some headache.
Comment: That's what I'm trying to do.  That's this solution:

My first thought was to just do a transaction where I figure out the next auto-inc, generate the filename, then insert into the database and commit. Problem is I can't seem to find anything about transactions in Flask, it sounds like it's done automatically, but I'm not sure if I can rely on the id lookup and insert being atomic.
Comment: Hm, definitely an interesting solution, hadn't thought of using the timestamp like that.  For some reason I was getting an error with g.db.execute('begin'), but I'm not anymore so I'll just go with using transactions.  Thanks for your suggestions!
Answer: If I understand your question correctly, you have a table something like this:
CREATE TABLE files (
  file_id INTEGER PRIMARY KEY AUTOINCREMENT,
  filename TEXT
)

You would like to atomically:

Create a new row in the table with an auto-incremented primary key value.
Get that primary key.
Set the filename for the row with a name derived from the key value.

With sqlite3 in Python, using a transaction (as you requested):
import sqlite3
con = sqlite3.connect('files.db')
with con:   # Context manager on the connection manages the transaction
    cur = con.cursor()
    cur.execute('INSERT INTO files DEFAULT VALUES')
    file_id = cur.lastrowid   # Get the primary key of the new row
    cur.execute(
        'UPDATE files SET filename="file"||file_id WHERE file_id=?',
        (file_id,)
    )

See here for more details on the context manager:
http://docs.python.org/2/library/sqlite3.html
After running:
sqlite> SELECT * FROM files;
1|file1

There is no real difference due to the fact that you are using Flask. However, you would probably put your call to connect in before_request and assign the result to a global as shown here:
http://flask.pocoo.org/docs/patterns/sqlite3/
Finally, other approaches you may consider are a VIEW on the table (if the filename will never change, and is always simply derived from the primary key), or an AFTER INSERT trigger for the table.

Transactions in SQLite with Flask


Why is CMOS fall time faster than rise time?

Question: I've just started a computer architecture class, and the slides from a lecture says that the reason why fall time is faster than rise time is that the NMOS electrons have more mobility than PMOS which has holes. Does anyone know how to explain this in simple terms?
Answer: The answer lies in Carrier Mobility of Silicon. A CMOS stage has a P channel device from Vdd and an N channel device to Vss. Note the much higher mobility of electrons vs. holes.
The rise time at the output depends primarily on how fast the P channel device can turn on, and the fall time is determined primarily by how fast the N channel device can turn on.
The majority carrier in P channel devices is holes, and the majority carrier in N channel devices is electrons.
As electrons are in the conduction band and holes are in the valence band (same link), N channel devices are inherently faster in switching than P channel devices given equal physical parameters.
In many newer logic families, the length - width ratios of the transistors are adjusted to give symmetric switching times.
Comment: I think it is no correct to say "The rise time at the output depends primarily on how fast the P channel device can turn on, and the fall time is determined primarily by how fast the N channel device can turn on." What matters actually is the time it takes to change the voltage of the output. Even if both transistors can turn on in the same time, "on" for the N-MOS transistor may mean 5 Ohm and "on" for the P-MOS transistor may mean 8 Ohm between Source and Drain resulting in different fall and rise times.
Comment: Also your last sentence supports my objection. Carrier mobility (or turn-on time) is not affected by length or width of the transisor. Length and width, however, affect the on-resistance.
Answer: For some reason it is easier to get \$R_{on}\$ small for N-MOS than for P-MOS transistors.
The N-MOS transistor is in charge of setting the ouput low, i.e. discharging the line capacitance and gate capacitances of the connected inputs which is faster when \$R_{on}\$ is smaller.


Accessing AddInContent PDF Document

Question: I'm converting a COM Extension to an Add-In.  The old extension installed a PDF alongside the .dll and an Command in the extension start the PDF Viewer process (using Process.Start(pdflocation).
I'm running into trouble duplicating this with the Add-In structure.
In Visual Studio I have my PDF file included in a 'Resources' folder I made.  I've got the PDF's Build Action set to AddInContent. Where can I find this file after the Add-In is deployed?
I used Assembly.GetExecutingAssembly().Location; to see that the .dll file is located in C:\Users\myuseraccount\AppData\Local\ESRI\Desktop10.2\AssemblyCache\{<AddIn GUID>}\ but I do not see my Resources directory here (or even the Images directory containing the images that my Add-In buttons and tools use)
So like the title states... How do I access files in an Add-In that have a Build Type of AddInContent?
Answer: Aha!  I figured it out.
What I had to do was set the PDF's 'Build Action' to 'Content' and then set 'Copy to Output Directory' to 'Always'.
More information here: Advanced add-in concepts / File Structure
Just have to RTFM I guess ;)

Accessing AddInContent PDF Document


Distractions in software testing

Question: What are the distractions you face daily while doing testing in your office? Are there any steps to cope up with those, like how do you manage to get the job done with utmost quality in between those distractions? Could you give any examples?
Comment: I'm voting to close this question as off-topic because it would be better answered at workspace.stackexchange.com
Comment: This question seems more like general views question and is not related to particular problem. As the distractions depend on your Seating, Office space, Experience level, Mental and Emotional status etc. You need to make your question more problem specific which is being faced by you.
Comment: Yes sure, you can take cues from here and apply these to other fields as well.
Comment: old question, but still worth re-opening. It's one of the few questions which are really about the profession of testing and not about general tools, code or development processes
Answer: One question:

What is your office space like?

Distractions often are ubiquitous. You can only try to circumvent. Headphones is one option, changing work hours is another. Changing your expectations is a third.
So what you need to do is:

Find out average/acceptable performance. You may not have a problem at all.
Detect production breaking habits, circumstances and possibly colleagues.
Omit, avoid, condition:

Change your own behaviour. Come in early when everyone else comes in late for example.
Acquire headphones, turn your desk to the wall, whatever works best.
Colleagues often are hardest to cope with when breaking your concentration with frequent easy to solve questions or just plain chitchat. Set aside fixed working hours for uninterrupted work, COMMUNICATE these with the reason, put up a sign on your desk while these last.

References:
http://www.joelonsoftware.com/
Comment: Some how I agree to this as I have felt that during weekends if I go to office I can accomplish the same task in much less time that on a normal working day when everybody is around.. Thanks so much for these points.
Answer: I try the following things when I am getting distracted while working:

I work at lunch time, usually when everyone leaves for lunch.
Meetings are one more distractions. So if there is no planned meeting, I would skip them off.
Listening to music or I just keep headset to make myself focus.
If some tasks got delayed due to unplanned meetings/discussions - I would try to complete when everyone leaves office or come early and finish the task first.
I try to keep myself away from group of testers sits together, without unnecessary discussions.

Distractions in software testing


Screen scraping gotchas

Question: When screen-scraping, what are the "gotcha"s to look out for?
The inspiration for this is: my spouse's co-worker asked me to scrape all the pages from a Blogger-hosted blog that her friend with cancer kept in her final months and this lady wanted to keep all of the posts in case the blog were ever deleted. I eventually found a free tool that was barely good enough.
One issue with scraping many Blogger pages is that there's often a navigation menu where you can click on the triangles to expand the post lists by year or month. These little buggers created insane amounts of duplicate content because you'd have the same page over and over again with different combinations of the menus being expanded/collapsed. In Blogger's case I'm not sure this is avoidable since the links are all formatted as real http links and not obvious JavaScript calls. Still, it got me thinking:
If you were to scrape a website, what kinds of potentially non-obvious things would you compensate for?
Answer: Do not use regex to scrape
While regular expressions can be good for a large variety of tasks, I find it usually falls short when parsing HTML DOM. The problem with HTML is that the structure of your document is so variable that it is hard to accurately (and by accurately I mean 100% success rate with no false positive) extract a tag.
What I recommend you do is use a DOM parser such as BeautifulSoup or equivalent (SimpleHTMLDom in PHP).
Some may think this is overkill, but in the end, it will be easier to maintain and also allows for more extensibility.
A regular expression could be devised to achieve the same goal but would be limited. For example, developing a regex to get the src and alt tag would force the alt attribute to be after the src or the opposite, and to overcome this limitation would add more complexity to the regular expression.
Also, consider the following. To properly match an  tag using regular expressions and to get only the src attribute (captured in group 2), you need the following regular expression:
<\s*?img\s+?[^>]*?\s*?src\s*?=\s*?(["'])((\\?+.)*?)\1[^>]*?>

And then again, the above can fail if:

The attribute or tag name is in capital and the i modifier is not used.
Quotes are not used around the src attribute.
Another attribute then src uses the > character somewhere in their value.
Some other reason I have not foreseen.

So again, simply don't use regular expressions to parse a dom document.
Answer: I screen scrape a lot. Some advice:

Emulate a User-Agent string for some browser you want to use. Different websites frequently return very different results depending on what your user agent is. If they don't recognize the User-Agent they will often revert to lowest common denominator, so it's usually best to start with some recent browser. (For example the World of Warcraft Armory returns beautiful, easy to parse XML if it thinks you're a recent Firefox. If it doesn't know what you are it sends terrible HTML).
Be polite to the site you're scraping; don't hit it too hard. Your scraper will go faster if you multi-thread it, making many requests at once, but that will annoy the site owner.
Be smart about error handling. Do not write code like while (1) { makeRequest(); }. If your code or the server throws an error a loop like this will immediately fetch another request, generating another error. It can get ugly quickly. Handle errors well and consider putting in sleeps or exits if you see a lot of errors.
When developing your parsing code, test against a cached version rather than hitting the server every time. Will make your development go faster and is the basis of a simple test suite.
Answer: First, I'd check for an RSS feed. On blogger, you just have to add /rss to the root url, if I remember correctly.
Then I'd check if there isn't already some tool to scrape blogger.
Then if there's no RSS feed, and no existing tool, I'd give up and do it by hand with copy/paste. Unless we're talking 5000 pages, it's much faster and easier that way. Take it from someone who's tried.
If you have access to the actual account, blogger has an export function.
edit: Or of course, you could try mechanical turk.
Answer: As far as gotchas are concerned..It's usually a good idea to limit the amount of requests made over a certain period of time. Smashing a site with alot of requests in a short space of time is a good way to have your requests rejected.
Answer: Aside from the technical considerations, make sure your not putting yourself at legal risk.  Most large sites have specific legal language in their terms of use that disallows programmatic access to their services via an automated computer program, and also, the obvious copyright concerns.
From a technical standpoint, definitely use a DOM parser library and you'll save loads of time.  Many provide the ability to read HTML into an XML structure that can be queried using XPath to find exactly what you need.
Answer: If you know someone who has access to the account, they can use Blogger's export "Export blog" feature.

Screen scraping gotchas


Low-cost airline

Question: Is there a low-cost airline between South-Asia (or the Middle East) and Europe? I don't mind changing flights and staying overnight. I want to know if there are some. I know about Scoot, Norwegian to South-Asia; Pegasus to the Middle East.
Comment: Note that "low-cost" refers to a business model, not necessarily fares. I am often able to find lower fares on, say, American or United than on jetBlue or Southwest, albeit with a great many more restrictions.
Answer: I think you need to narrow this down a bit. In general "low cost" airlines are NOT always cheaper than "full service" airlines. You need to look at specific dates and destinations to optimize the price. For example, Frankfurt <-> Bangkok in February on Etihad or Turkish is around US $600 round trip. Given the distance, I doubt you can get it a lot cheaper than that.
Answer: I've noticed relatively(in comparison to Emirates, Qatar, Oman) inexpensive flights offered by Gulf air with regional (national) carriers of European countries. However they tend to have extremely long layovers.

Low-cost airline


Mann-Whitney test help

Question: I've done the Mann-Whitney test and I'm not sure how to interpret the two-tailed p-value which was equal to 0.0336 and 0.0673. The test was used to find out how opinions, between men and women, differ in regards to genetically modified crops.

Comment: How did you come to get two different p-values for one test?
Comment: That's what the Mann-Whitney test on VassarStats gives you (http://vassarstats.net/).
Answer: It's pretty clear that the first p value you cite is for a one tailed test and the second one for a two tailed test.  Which one you should use depends on what your original hypothesis was, but, in the absence of a strong reason to think women would be higher on this, a two tailed test is appropriate.
Your last sentence, after the graph, makes no sense. You have the number of observations that you have.
Whether you should be using Mann Whitney at all is unanswerable here. I'd usually prefer to do some sort of regression with some control variables to get a better sense of what is going on.

Mann-Whitney test help


Display more version history for documents

Question: A client of ours is looking for versions of documents that are no longer displayed in the Version History of that document. Is there a way to show more of the existing version history? I did change the number of major versions to a greater number (100) but only ~38 are being displayed.
Comment: When did you change the number of versions to be displayed?  Did they work up more than 38 versions after you changed the setting? Just increasing the setting won't bring back versions that have been discarded in the past.
Comment: I changed it just today. No the number of versions stayed. The last document displaying has a date of July 21 but they want versions from June 15 to July 16.
Answer: You need to change the setting for how many versions to keep BEFORE the versions are created. That's the whole point of that setting. If it is set to keep only the last ten versions, say, and a document is saved a hundred times, only the last ten versions will be kept and all other versions will be removed from the system.
When you then change the setting to keep the last 100 versions, SharePoint can't magically recreate the other 90 versions, because they were never kept and are no longer in the system.


PHP code to display Registered Date & Last Visited Date?

Question: How can I make a PHP script that displays a users Registered Date and Last Visited Date as it appears in the core Joomla profile page?
Answer: Before asking a question like this, please do some research. Seeing as you have been doing a lot of work with the user Object already, I'm surprised you haven't seen the following page yet:
http://docs.joomla.org/Accessing_the_current_user_object
You can simply use:
$user = JFactory::getUser();
echo '
Register date: ' . $user->registerDate . '
';
echo '
Last visited: ' . $user->lastvisitDate . '
';

Comment: i am quite lazy! :)
Comment: @Lodder I am suddenly horrified to find that I have 61 declined flags.  The one above is just one of the many that are rightfully removed from this site.  I suspect that most of them are my flagging of useless comments like "thanks", "your welcome", "I love you", "you are a genius", "i am quite lazy", etc.  What possible reason can there be for declining these flags?
Comment: @mickmackusa - The majority of your comment flags have been on "thank you" comments which I personally deem ok, as they show a sign of appreciation. Some of them however, I have deleted as they were replies to a comment which had been deleted for whatever reason and thus made no sense.
Comment: You are of course welcome to ask about this on Meta and get the opinion of the other moderators, as they may think differently.
Comment: You are one of two active moderators, right?
Comment: @mickmackusa 1/3 - https://joomla.stackexchange.com/users?tab=moderators


how to keep track of newly launched ec2 instance from an ami image?

Question: I have launched an ec2 instance from an ami using lambda function.
I haven't enabled detailed monitoring. Now I want to keep track of the instances each time lambda set triggered to launch an instance. I want to get an email with instance id  and status of that, when an instance is launched, stops/terminates and instances which running more than 2 hours. I tried cloudwatch, but is instance specific can't get configured for a newly launched instance. I can uses SNS, but how to keep track of these?
Answer: Use AWS Cloudtrail: http://aws.amazon.com/cloudtrail/
It gives more info than you are asking for. In cloudtrail, enable SNS Notifications of API activity and set a filter to notify you only when an instance creation/start/stop/terminate etc., For instances that are running for more than 2 hours, you can explore if cloudtrail provides it or it is very easy to write a script using Boto to fetch that information.
There are some AWS partners providing a similar service. Hope this helps.
Answer: I think you will be better off using an auto scale group and then use the auto scale life cycle hook to get notifications whenever any instance is added or removed.
http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/adding-lifecycle-hooks.html
When you use the life cycle hooks, you can have an SNS notification to not only get intimidated about the new instance but also take custom actions.
You can still use the aws lambda function to continue adding and removing new instances, only that you will increase and decrease the size of the auto scaling group.
Comment: Thanks @rohit, But i don't require autoscaling. I work on a single instance at a item. Once the task is completed I will terminate that instance.
Comment: Autoscaling was not specified


Is it possible for a star similar to the sun to only have terrestrial planets orbiting it and no gas giants?

Question: What are some possible ways this could happen?
Comment: One planet?  Four?  Five?  Is Mars terrestrial?  Mercury?  Pluto?  They don't fit the standard description of gas giants.  Are those the only two options?  What are you trying to do?  It's likely that you could explain almost anything by having another star come by and poach some of your planets or your star poaching planets from elsewhere.
Comment: See [Kepler-444](https://en.wikipedia.org/wiki/Kepler-444). [Kepler-37](https://en.wikipedia.org/wiki/Kepler-37) is also a possibility
Comment: Note, Kepler-444 is thought to have two dwarf companions but otherwise seems to fit the criteria if we ignore age.
Comment: @Mazura Good point.
Answer: There are a number of presentations on planet formation in the SETI Weekly Colloquium Series covering the latest understanding and speculation on the subject.
I suggest you start with one of the formation models presented, well-peppered with real nomenclature and details, and also cite the specific mechanisms and situations for getting rid of the other planets and leaving the configuration you want.  That is, mix and match among the real mechanisms to craft the scenario you want.
Comment: What a wonderful bit of information!  Thank you!
Comment: It's an amazing resource for WorldBuilding interests, I must say.
Answer: Possible? yes, though highly unlikely. Much more plausible would be a system that only has gas giants that have ejected the other planets.
Way back when: Jupiter and Saturn had harmonically resonant orbits and this is surmised to have helped eject all the other garbage out of our system (anything without a stable orbit got pushed and pulled and tossed out). Without gas giants to protect your system, you're not going to be able to charge good rent money.
Something similar might have happened in your system, but instead the gas giants ejected themselves. Note, this still leaves yours in 'the cheap seats' but gets around the unlikely event of a system having had to form without gas giants.
I've nothing to back this up, but I'd assume that's why most stars are binary: you either don't have enough 'stuff' to start a star at all, so much that you get two stars, or like ours: gas giants as well.
Comment: I feel like you might be confusing the [Jumping Jupiter scenario](https://en.wikipedia.org/wiki/Jumping-Jupiter_scenario) a bit, although I haven't yet watched the whole video. What was ejected in the Jumping Jupiter model is that a third ice giant was ejected, not a bunch of planetesimals. The Kuiper Belt might be excited, resulting in a quick increase in the semimajor axes of KBOs (see [this video](https://www.youtube.com/watch?v=VXeOh3xmrQM)), but it's not like a lot of small stuff is ejected. More importantly, only *one* giant planet is ejected, not all five.
Comment: Regarding the final paragraph (sorry if I'm jumping in this a bit much) - the masses of stars can vary drastically. Except in the case of cloud fragment masses on the order of that of low-mass red dwarfs, you can generally form two stars from the amount of matter present.
Comment: [The Universe S06E03](https://www.youtube.com/watch?v=Fn_-Xl4ikvM) *How the Solar System Was Made*
Comment: The video I linked is only relevant. I can never seem to find the one that talks about how they 'cleared' our solar system during the LHB with an [orbital resonance](https://en.wikipedia.org/wiki/Orbital_resonance). Your Wiki link sure sounds like it though, only much more in-depth, and it at least helps my theory somewhat.
Answer: It depends on the size and composition of the proplanetary disc . If it is fairly small , with a low amount of hydrogen and helium , then I'd say yes , it would be possible , even with a large proplanetary disk , if the percent composed of hydrogen is low enough , than yes , you could get a solar system with no gas giants , but a side affect may be a vastly larger amount of terrestrial planets and asteroids
Comment: Without hydrogen,  how did you form a working star?
Comment: Slightly correction (by the way, @JDługosz is spot-on, unless you were to have *all* the hydrogen form the star, which seems unlikely): It might be better to refer to the disk as a [protoplanetary disk](https://en.wikipedia.org/wiki/Protoplanetary_disk). While accretion does happen close to the star (as Wikipedia notes), the vast majority will not be accreted, unlike in a traditional [accretion disk](https://en.wikipedia.org/wiki/Accretion_disk).
Answer: A star is made of gas.  Some of it ends up in the planets, it would be awfully hard to make a solar system without gas giants.  However, something could have happened to them.  While I can't see a mutual ejection scenario working (where does the energy come from??) you could have an ejection/destruction scenario (one planet leaves, the other ends up too close to the central star) or ejection by an encounter with an outside body passing through.


Is it fair to assume that 站 and 占 are the same word?

Question: It seems that the meanings "to stand" and "to occupy" are semantically related, and considering the pronunciation is exactly the same, is it fair to assume that the difference in orthography is simply a scribal convenience? Or is there reason to think of these as two truly separate items?
Answer: They're not the same word. Upon creation, they were pronounced differently. But 占 is the phonetic component of 站; their pronunciations were close. This is certain. What is less certain, though still probable, is their semantic relation.

站 is a very late-coined character, first found in documents from Tang Dynasty. Before that, to stand is called 立, which is still used now in Wu Chinese. The word used in Cantonese is most probably 企 (originally stand on tiptoes). In my dialect, we use len1, which I don't know if there exist a corresponding character.
It's probably that 站 (to stand) comes from 占, which was then written as 佔 (to occupy).
In 《增修互注礼部韵略》(Song Dynasty), 占 is explained as

擅据也,著位也,固也。 to occupy, to occupy a position, fixed

In 《集韵》(Song Dynasty), 站 is explained as

坐立不动貌。 sitting without moving

The semantic development seems to be to occupy, possess (占) → to occupy a position (占) → to sit without moving (站) → to stand (站).
Phonetically, 站 has initial 知 and rhyme 咸, while 占 has initial 章 and rhyme 盐. They were pronounced differently in Tang and Song Dynasties. However, they do come from the same initial category 端 and rhyme category 谈, so they are indeed phonetically close. Likely, due to semantic differences, the two words were differentiated phonetically. This is common in Chinese. In modern Putonghua, however, the two words are pronounced exactly the same. In some dialects, the differentiation is still kept.
The component 占 in 站 is phonetic. The meaning mainly come from its semantic component 立. The fact that the two morphemes, now pronounced zhàn and lì, have the same meaning of to stand is a coincidence.

How 占 acquires the meaning of to occupy is also very interesting.
占 is an ideogrammic compound, meaning to read divination.
The semantic development seems to be to read divination (zhān) → to predict → to estimate the number and report (zhàn) → to occupy farmland according to the estimated number (zhàn) → to occupy (zhàn).

Another important meaning of 站 is a station. This was borrowed directly from Mongolian (jamci). However, where the Mongolian word ultimately originated is still debated. Some people think it's from ancient Chinese 驿, others think it's of Turkic origin.

UPDATE
Dialects that distinguish the rhyme groups 咸 and 盐 pronounce 站 and 占 differently. For example, in Cantonese, 站 zaam6, 占 zim3. Wu and Southern Min also pronounce them differently but generally (though some areas do) they don't use 站 for the meaning of to stand up.
Dialects that distinguish the initial groups 章 and 知 also pronounce 站 and 占 differently. Two notable examples are Jiaoliao Mandarin and Central Plains Mandarin. In Xi'an (Central Plains Mandarin), 站 [tsæ̃55], 占 [tʂæ̃55].
Comment: Fantastic! Quick question:

"Phonetically, 站 has initial 知 and rhyme 咸, while 占 has initial 章 and rhyme 盐....Likely, due to semantic differences, the two words are differentiated phonetically. This is common in Chinese."

Does this mean that despite the pinyin being the same, there are actually slight differences in how the words are pronounced? I'm trying to think if I would make a slight differentiation in the vowel quality, but I'm not sure...Are the different initial and rhyming categories that you mention referring to their old pronunciation?
Comment: @BuddyL I refer to Middle Chinese in this passage. Their pronunciations in 普通话 are exactly the same. In some dialects, the differentiation has been kept.
Comment: Can you cite specific examples of dialects in which they are pronounced differently?
Comment: @BuddyL I added it to the end of the answer.
Answer: While the sound mapping and semantics of both are similar, their origins and meaning are not the same. Typically, 占 is used in relation to divination, astrology, etc. whereas 站 is usually related to movement (to stop, a station, etc. ).
The original depiction of 占 was a turtle shell with cracks in it during the divination process. The top portion of 占 is actually the crack in the shell (卜) with the bottom depicting a mouth "transcribing" the divination (口).
Answer: It is well known that Chinese has many words that have the same pronunciation and share the same radical, but the meanings differ. The case of "站, 占, 佔" is a classic example of it, and interestingly it falls on the joke that says whenever seeing an unknown Chinese word, a good guess can be made by "又邊唸邊,無邊唸中間" :)
站 - Stand (zhàn)
占 - Divine (读作zhān); Occupy (读作zhàn)
佔 - 同"占"(Occupy); 同"站"(Stand) Ref
Among the three words, 占 can be traced to "商代甲骨文", and it was the simplified form (简体, 3 & 4 below) of the original word (繁体, 1 & 2 below) that was abolished after Qin Dynasty.

The other two words seem to be derived from 占 with unknown justifications.


CakePHP / Croogo Plugin Issue

Question: I am running into a strange issue with Croogo and CakePHP 1.3. I have a plugin called "Ride".
Within that I have models: Ride, Quote, Service, and Location. All
have their own controllers, which extend RideAppController which
extends AppController, as do models extend RideAppModel/
AppModel...etc. For some reason, Ride and Quote both show great in
both front-end and admin (admin_index and index). I am adding all acos in
activation as well.
However Service and Location do not work at all and only show me a
generic "The requested address was not found on this server."
error...I don't understand why Ride and Quote work but the other two
do not?! Really nothing in the models or controllers going on. Any
thoughts? Thanks in advance!
Answer: I was able to solve the issue by renaming the models and controllers to other names and updating rides_activation.php. Not sure if these names are reserved or not.

CakePHP / Croogo Plugin Issue


How to copy SMS messages from a Nokia phone (or Nokia PC Suite backup) to iPhone?

Question: What if I have a Nokia PC Suite backuped file which contains all the SMS and want to copy them to the new iPhone?
Answer: Please check iNoki at: http://www.nokisoft.com/inoki. It's an iPhone app which can extract and import data in .NBU file created by Nokia PC Suite. All phonebook, sms, calendar, photo, audio, videos can be imported.
AppStore link: http://itunes.apple.com/us/app/inoki/id438619967?ls=1&mt=8
SMS is viewable in iNoki instead of native SMS app - for apple has no official API to insert into native SMS db.
Answer: I can provide half an answer. I'm not sure how to get the SMS out of the Nokia backup, but you won't be able to copy them to the new iPhone directly. You'll need to write a script to translate them to the iPhone format. I provide instructions below how to reverse engineer the iPhone SMS DB.
The iPhone SMS DB is sqlite3. If your iPhone is jailbroken, you can get and view the DB on the phone itself (install terminal) or on your desktop:
<code># get it local
scp iphone:/var/mobile/Library/SMS/sms.db ./
# dump to ASCII
sqlite3 sms.db .dump > sms.db.sql
# edit it
emacs sms.db.sql
# Re-db
cat sms.db.sql | sqlite3 sms2.db;
# Put it back on the iPhone
scp sms2.db  iphone:/var/mobile/Library/SMS/sms.db
</code>
If your phone is not jailbroken, you can operate on the backup up SMS DB, replace the backup locally and then restore the iPhone. The backup is located in:
<code>~/Library/Application Support/MobileSync/Backup/<long_hex_string>/
</code>
And, in my case, and according to various web sources, is named:
<code>3d0d7e5fb2ce288813306e4d4636395e047a3d28
</code>
Although comments below indicate that may not always be the name of the file. Run the sqlite3 command above to dump this to ASCII to understand the format, then replicate this format with whatever tools you want from your Nokia DB.

Here are some instructions on how to migrate your SMS in the reverse direction for Android: http://android.riteshsahu.com/tips/import-sms-iphone-android
An iPhone database extractor: http://insend.de/
Comment: I'm not sure if the file name "3d0d7e5fb2ce288813306e4d4636395e047a3d28" is iPhone version dependent. On my Mac, I just can't find this file.
Comment: Are you on Windows or OS X? My system is OS X 10.4.6 and iPhone 3GS running 4.0.1.
Comment: OS X 10.6.4, iPhone 3GS 4.0; I also tried to spotlight this file but not found.
Comment: Well you can find it a couple of ways... Go to that folder and then find all the SQLite DB's and search each one (**file * | grep SQLite**). There are quite a few, so you could try syncing, send an SMS, and re-sync. Look at timestamps, only a few files should have changed.
Answer: The program inoki has marketing material that shows it might work for your problem:

You can copy the .NBU files to iNoki's folder using iTunes file sharing. You can also invoke iNoki to open the .NBU file from Email or in your Dropbox.

you could find details at http://www.nokisoft.com/inoki/

Declaration : I do not guarantee success for this process as I am not the owner and I do not have relations to this website.
I'm only answering thi question because I have had a hard time looking for the solution to this myself. The free version probably won't work other than to see if it can get a few records as there is alsoo a paid version that costs USD19.99 through the APPSTORE ishttp://itunes.apple.com/us/app/inoki-lite/id461608906?mt=8
Answer: Though its difficult method, I just want you to know it exists in the worst case. You can also do it manually by exporting the messages from C:\Users[USERNAME]\AppData\Local\Nokia\Nokia Suite (the name of the db might be like sms_db.sqlite). There are many tools to read SQLite db like MesaSQLite for Mac and a firefox plugin for Firefox browser.
Then using the same tool import it into the iPhone SMS DB.
I have already written how to deal with iPhone SMS DB here
Comment: There are command line tools to read sqlite db - why not explain how to use the tools you recommend here? Also, summarizing your link allows your answer here to stand on it's own in case the link dies in the future.


Shower pan drain leak

Question: After a nice shower today I went downstairs to see water running out of my can light below the shower. I rand water down the actual shower drain and the other upstairs showers for about 15 minutes so I concluded the leak was from the pan drain(down the sides of the pipe). When I went to go fix it though there is no nut like I have seen before. Just the abs pipe coming up with a rubber ring around it. Can I just replace that ring or using silicone around it? I am redoing the bathroom but not for a few months so need a temp fix
Answer: Usually the rubber hub seals on the pipe. Since it appears it is not sealing I would clean it and give it a try with silicone.

Shower pan drain leak


Can a carbocation ever be more stable than a neutral molecule?

Question:
The question is about finding the most stable molecule or species. Now my thought process was that cyclopropenylidene(1) was a carbene so would be unstable even though it is aromatic. Cyclopenta-1,3-diene(4) is anti-aromatic so is very unstable. Between cyclopropenium(2) and cyclohexa-1,3-diene(3) though, I am confused, especially since my answer key has the former. I think (3) should be the most stable out of them all. Cyclopropenium is an especially stable carbocation, but it's still electron deficient. How could it possibly be more stable than (3) which is a neutral conjugated diene?
On another note, is it even possible to measure the stability of a cation with respect to a neutral molecule?
Comment: What this question is *actually* asking is simply "Which one of these is aromatic?", but it got redressed very badly.
Comment: This is a meaningless question. Most stable with respect to what?
Comment: Even for a crappy jee/neet question this is quite bad. I suggest just skipping it. I know a lot of times they just ask which is more stable and leave it at that, but sometimes (co-ordination complexes for example) you can somewhat quantitatively go about things in terms of the stability constant. Here I really don't understand what they're going for as @IanBush said.
Comment: Reactivity I guess? Maybe the enthalpy of the species? This is a pretty common type of question in organic courses...
Comment: Unless it states what the criterion for stability is it's not even a bad question - as I say it's meaningless.
Comment: Yeah it was probably about that, sometimes thinking about a question is a bad idea I guess. Thanks.
Answer: Yes this question is poorly stated, probably through no fault of the OP. (It looks like something from a textbook, in which case the authors of the book are to blame.) You can really compare only things that match up in mass, atomic composition and charge. They probably want the student to choose the cyclopropenyl cation, choice 2, because it is aromatic and the full symmetry of the ion (as opposed to choice 1 which is not fully symmetric) maximizes the effect of this aromaticity.
The cyclopropenyl cation offers a case where a salt containing the ion is more stable than a compositionally equivalent set of neutral molecules (which actually is a proper comparison); to wit, $\ce{[C3H3]+[SbCl6]^-}$ is more stable than the combination of neutral molecukes $\ce{C3H3Cl + SbCl5}$ ($\ce{C3H3Cl}$ = 3-chlorocyclopropene). When the latter two are combined at -20°C in carbon tetrachloride solvent, the salt spontaneously forms and precipitates[1]. This is considered evidence of the strong stabilization of the cyclopropenyl cation that would theoretically be predicted by the usual aromaticity rules.
Reference

Breslow, R.; Groves, J. T. (1970). "Cyclopropenyl Cation. Synthesis and Characterization". J. Am. Chem. Soc. 92 (4): 984–987. doi:10.1021/ja00707a040.
Comment: Thanks for the answer, and now I get the spirit of the question. Just a little thing I found weird though, isn't the stability of the cyclopropenyl cation a little overstated? Tropylium has stable bromides that dissolve in water with no reaction(though there is an adduct formed). It just seems weird to call that salt 'stable' when it's only stable in a non-polar solvent at -20°C. While hexa-1,3-diene is a liquid at room temperature...


Any permanent solution in killing wild grape vines?

Question: I have 80 acre with over 3/4 bush/trees situated about 1 mile from an old CN railway line (no longer in use) where people throw out their fruits among them, grapes.  The grapes seeds have made wild grape vines all over the property, in sizes ranging from less than a child's small finger to over 4 inches in diameter.  These vines are growing along our driveway among our stone fence created by the farmer over the years.  They are growing around, through, and up our beautiful old oak trees.
How to I permanently destroy the vines without hurting the trees.
Comment: Please see https://gardening.stackexchange.com/questions/3846/how-do-i-get-rid-of-wild-grape-vines which may already have an answer to your question.
Comment: There is no magic solution here. You need to cut them back and poison them. By the sounds of it you have a lot of work ahead of you, get er done.
Answer: This makes me think of a few permaculture tools that love woody food sources:

Goats - they love to eat things head level and above
Sheep - they love to eat woody things head level and below

After a few years of using these animals along with chickens to keep the grass down they will kill off anything living in the area if you provide enough animals to reverse the damage already caused.


How do I get rid of the persistent dock in Pop!_OS?

Question: I used to use dash-to-dock as my daily driver now, I tried switching to plank but whenever I open the activities menu I see another dock at the left of my screen(even after I disable the dash-to-dock gnome extension). I tried installing the vanilla-gnome-desktop but that too has that dock at the side. Is there any way of getting rid of that dock?
Answer: Well after some research on reddit I figured the dock at the side is actually called a dash. You can install an extension called just perfection from gnome extensions website which allows you to disable the dash altogether. Here disabling means to just hide the dash and nothing more.


How reasonable is it to ask about my application status to the Chair of the search committee?

Question: It has been more than 4 months I applied for a tenured-track faculty position in a research university. However, I have not heard back from anyone (e.g. representative of the Chair of the search committee or someone else) regarding my application status. Unfortunately, there is no online status-checker system available. I am even not sure whether my application has been rejected. In such a circumstance, can I place an inquiry to the search chair and ask him to let me know the status of my application?
Comment: It may matter only slightly, but what country? I suspect that most US departments are long done hiring for this year, though they may have left job postings open for the next academic year. Other countries haven't even finished their spring semester yet (I just learned that Japan's spring semester starts April 1, for example).
Comment: Sorry, forgot to mention, I have applied to an US university.
Comment: It is often useful to contact the Department Administrator, Secretary, or Assistant to the Department Chair.  This is the person who coordinates all (or most) of the administrative work in the department, or supervises people who do if it is a large department.  These people typically respond promptly and are knowledgeable about the status of various processes in the department, including filling open positions.  Most important, they have great insights into the quirks/ dysfunctions in the department, including people.  They know who to approach and how to approach them to get things done.
Comment: Did you check the academic job wiki? You should be able to figure out whether other candidates have reported progress. Be sure to edit/update it if you can.
Answer: It is completely reasonable to ask about the status of a job application at any time, let alone after so much time has passed.  Definitely feel free.
Since you have applied for a tenure-track job in the United States, I wanted to mention that my first thought was that it is overwhelmingly likely that the job search has concluded by the end of the academic year.  However, you say that you applied for the job "more than four months ago", which I guess means you applied in February or March.  That is an unusually late job application: most commonly applications are due sometime in the fall semester -- say, between September and December -- and the hiring process takes place either at the end of the fall semester or the beginning of the spring semester.  So if the application deadline was indeed in February or later, this is a somewhat unusual time (although such things certainly do happen occasionally) and it is not as overwhelmingly likely that the process has been completed.  Still the chances are not good: most American departments do not do tenure-track hiring over the summer, and once the new year starts there will be a flood of new candidates so they might as well start the process all over again.
For your future use, you might also want to look back carefully at the wording of the job application.  Some job applications have a "rolling deadline", and if you apply on certain automated academic job serves the application will be "accepted" in the formal sense for many months (usually; this depends upon the way the account is set up).  In most cases there is some text like "Candidates who apply before XX/YY/ZZZZ will receive full consideration."  You definitely want to get your application in by that date.
Finally, I hope you know that with the current amount of job applications, many if not most departments make no effort whatsoever to contact candidates negatively.  It is also not in their best interest to do so: maybe another job opens up at a weird time or maybe the person who they thought would take the job cannot or does not for some reason.  If that happens they can go back and look at the applications that are still there and see if people are still interested and available.  Unfortunately the current academic climate is such that this not especially considerate policy has some strategic merit.
Comment: In the university homepage, it is clearly written :Application material must be received by March 1, 2015 to receive guaranteed consideration, though the search will remain open until the position is filled. Importantly, I submitted my application prior to this date.


PLA use outdoors?

Question: I have been using PLA filament for two years now and have had good prints. ABS on the other hand has not been so good, so my choice of filament is PLA.
I am getting ready to do a sign for the American Legion and the colors are black, blue, and red and are 0.8 mm thin. The black letters are 4" x 2.5", blue are 3" x 2" and the red are 7.75" x 5.5". I plan to treat them with UV protection spray and attach them with clear epoxy to white back lit Plexiglass.
As the letters are quite thin, my question is how well will this hold up in the weather? The sign hangs on a pole that points east & west so the letters will be facing north and south. The original was painted with spray paint and the red paint south side faded to the point you could hardly see it at all. The sign had been there for some time and was done at a professional sign company.
Comment: Why does everyone keep mentioning a car?  It's an outdoor sign, it does not matter how hot it gets in your car.  Your car is almost always going to be hotter than the ambient so I fail to see how it's relevant to keep mentioning it.
Comment: Possible duplicate of [3d printing for outdoor use: what types of filament are most weather resistant?](http://3dprinting.stackexchange.com/questions/10/3d-printing-for-outdoor-use-what-types-of-filament-are-most-weather-resistant).
Comment: Professional != Quality work lol
Comment: Desert SW (USA) summer days inside a car can be 150F or more.  PLA is not so good.  I use ABS for outdoor here.
Comment: I'll stuff this here as I don't have a full answer yet but the glass transition of PLA is 60C, if your letters are supported (glued) well then I see don't see them failing even at the glass transition temperature.  I imagine color retention would depend on the supplier and pigment used but I would also have to guess that the same/similar pigments are used in ABS/PLA so they would have similar color retention.
Comment: @tjb1 I guess I could have added on the sidewalk or side of a building, or just in direct baking sun for generalized purposes.  I have seen a lot of people print items for a car hence the most common reference.  I have seen an egg fry on a sidewalk and  just yesterday I was at an auction where they left a couple large screen TVs in the sun, by days end the back on the one was warped and curled.
Comment: For context:   If you consider paint, ink, etc. red tends to fade worse than other colors outdoors, especially blue, unless the red is specially made for UV resistance.   The reason is the blue reflects most damaging UV but red at the opposite end of the spectrum tends to absorb it.   Also, when I was looking for info on UV resistance of HDPE/UHMW, one site said that the best UV resistance additive was plain old carbon black which is what is typically used to make things black; apparently it soaks up the UV without damage.  However, black parts may get hot and PLA doesn't like heat.
Answer: I printed a handle for a rather big rolling door in natural PLA (From Fabberparts) - no UV protection. It's on the weather side of the house and is exposed to direct sun half the day.
And after three years cycling to all the German seasons it's still absolutely fine. Also, Wikipedia told me that PLA has good UV resistance - so you should be fine IMHO.
Here is a good blog post about your question: Using PLA for Long-Term Outdoor Applications.
Update: After ~ 8 Years the door handle ist still fine.
Comment: Unfortunately, the original link no longer worked and the blog had been moved, with an updated URL and the URL would not work (for me at least). I tracked down the article and have amended your answer with the correct URL. However, as links tend to invariably die over time, you may wish to consider including and quoting the relevant and salient points from the article, directly in your answer. It would be a shame to lose information from the blog, should their website die some day.
Comment: PLA is quite safe even in australia: https://www.youtube.com/watch?v=qqNfa_zExRU
Comment: In case the blog post gets ever removed again, I saved it at https://web.archive.org/web/20190708121636/https://www.iepas.ucar.edu/using-pla-for-long-term-outdoor-applications/
Answer: Keep in mind that PLA has a much lower temperature point, where is starts getting flexible. I once had PLA-printed parts in my car in the summer for three hours and when I came back, they where bent.
I don't know about the weather conditions in your local environment, but if you experience hot temperatures and your sign is hanging in direct sunlight, I would suggest to make sure you secure the letters against bending (e.g. cover them with a coat of epoxy or something like this).

PLA use outdoors?


How to reverse the effect of an alarm?

Question: I am wondering if it is possible to make an alarm that normally operates/sounds when electricity is flowing through a wire to do the complete opposite. The alarm sounds when there is a constant flow of electricity. When the flow of electricity is interrupted, the device does not sound. I would like the alarm to sound only when there is an interruption or holt of electricity as well as be silent when there is a constant flow of electricity.
Comment: Please reread and edit your question, as it is confusing. I.e.: clearly define sentence subjects, such as "the alarm" and "the device", to remove ambiguity. (To which "alarm" or "device" are you referencing in each sentence? The one you want, the one "that normally operates...", or another?)
Comment: I answered your question because I *think* I understand what you need. But I had to read it three times, so -1. Like tyblu says, reread and edit.
Answer: at first.
a good alarm sounds when there is a open circuit. and it is quiet when it is short
but it can be active high or active low, which means:
active low: (actually inactive low; active open): the alarm is quiet when sense wire is shorted to ground. (you measure 0V) and sound when open (you measure VCC (e.g. 5V or 12V);
active high: (actually inactive high; active open): the alarm is quiet when sense line ( wire) is shorted to VCC. you measure between wires 0V, between sense and ground: VCC and sounds when open: (you measure 0V between sense and GND, ans -VCC between sense and Vcc)
the reason is: if somebody cuts the alarm cable, he directly activates the alarm, in stead of disabling it.
second:
your voltage monitor: is it on High voltage AC (120V~ or 230V~);
or on low voltage DC (12V= or 5V= or 24V=,...)
low voltage is simple to build your own;

for the values of the resistors and transistors i need to know what voltage and which current your alarm consumes, the diode can be a regular 1N4007
the L is the sense line ( the voltage to monitor), and the big black blob is the output.
if you want to build something to monitor High Voltage, you first needs a lot of experience with electronics, because it is very dangerous to play with it without exactly knowing what you are doing.
if you would build a circuit to convert a alarm you already have bought: please post the manufacturer and the type of the device
Answer:
This is an alarm that will not sound in rest, i.e. when contacts SW1 and SW2 are closed. When both contacts are closed they will connect the transistor's base to ground, and there will flow no current into the base. So no collector current and the relay will not activate. The relay's contact will remain open, and the horn silent.
When either or both of the switches are opened the transistor will get base current from +12V through R1, the relay will switch on, and the alarm will sound.
So the alarm will sound if there's an interruption in the current through SW1 and SW2, and be silent if there's current through them.
Some will use a MOSFET instead of the BC547C BJT, because it allows them to use a much higher value for R1, so that you have a much lower idle current than the 1mA you have now. That may not be a good idea. Most electromechanical contacts require some current through them when switching to keep the contacts clean. And 1mA at 12V is only 12mW, that's 0.1kWh per year, or less than 2 cents.
You can increase switching current through SW1 and SW2 by placing a 100nF capacitor across each contact.
Comment: stevenvh has discovered CircuitLab
Comment: @Federico - For complaints you have to go to clabacchio, it's all his fault! :-)
Comment: @Federico - First thing I don't like (and I think Olin will agree) is how connections are shown. In [this answer](http://electronics.stackexchange.com/a/33612/2064) I had to paint the dots with India ink for clarity. :-(
Comment: @stevenvh - I agree, it should at least have option for using    junction dots. I haven't used it but I'm assumed it used the "two lines crossing are never connected" rule and disallows connections like this (Altium does this) but looking at your link it seems e.g. the R2, R3, D1, RLY1 junction is allowed, which I'm not keen on.
Comment: @Oli - Yes, it's that kind of junctions that worry me (and makes Olin utter grumpy comments). I try to avoid them, and always have them at a "T", but here I knew I had to place the dots anyway.
Comment: @Oli - I got an e-mail this morning from someone at CircuitLab who had seen that patched circuit, to announce that from today CircuitLab also uses the dots. I had discovered it just minutes before.
Comment: @Steven - That's pretty cool, well done! Well done to them too for actively seeking feedback on their software. Might use it myself for some diagrams now, as graphically it looks a bit better than LTSpice...
Answer: Choose the momentary button and mechanical relay with coil, normally open and normally closed contacts. Total 6 pins.
Connect relay coil to its own normally open contacts. Connect a button in parallel to normally open contacts. Power the relay. Push the button. The alarm is ready.
If intruder will break the wire, the relay will return to unpowered state and close normally closed contacts. Even if intruder will restore power quickly, the relay will wait for secret button to push.
This normally closed contacts will be the alarm signal.

How to reverse the effect of an alarm?


What are good resources to study Gravitational Waves?

Question: I am undergraduate student having basic knowledge of Physics. I'm looking for resources (books, video lectures, research papers, etc) to study Gravitational Waves from scratch, I think initially I should practice mathematical physics up to some extent and then proceed for GW.
Comment: You have found this site, why not click the `gravitational-waves` tag that you've added to your question above and have a look at other questions and answers here, then go to Physics SE and click [their gravitational-waves tag](https://astronomy.stackexchange.com/questions/tagged/gravitational-waves) and read there as well. You may find that Stack Exchange itself is a helpful resource when studying from scratch (I certainly have) and you may come across something specific you'd like to ask a question about.
Comment: Because standard quantum mechanics, does not include gravity as particle with any state like a wave, everything there is more theoretical or measured indirectly,
but not checked as "gravition", most measurements are a consequence of relativity
Answer: My first approach would be to visit my local university library, ask for the physics section and look which books are available, e.g. with the title gravitational waves in the physics or science department. No need to read them completely, the first introductory sections are usually a good start.
If you are not feeling like going to library, why not checking the educational resources of the three big facilities which are studying gravitational waves?

LIGO Caltech, US
GEO600 Hannover, Germany
LISA, to be in space in 2034
Answer: Gravitational waves are a prediction of Einstein's general theory of relativity, so one should be well acquainted with special relativity first, and then become familiar with basics of general relativity, and then one will be well equipped to study gravitational waves. Luckily, this should not take a long time, since there are so many great resources for relativity theory these days.
I highly recommend Ray D'Inverno's textbook on introducing Einstein's theories of relativity (special relativity is motion in the absence of gravity, general relativity is with gravity). It has introduction to the math, for example the k-Calculus that makes special relativity simpler, and for example tensor calculus in general relativity. Other approaches, like variational principle, are touched on. This is a great book meant for undergraduates. I'm not sure if you can find a free copy, you can probably find one at your library to check out, but this textbook is definitely worth the price. The chapter on gravitational waves is not only appropriate for beginners, but it also goes into depth about the basic calculations for deriving, for example, the strain of a plane gravitational-wave in a flat background spacetime (Minkowski), showing how the two polarization states of the strain and the wave equation literally fall out of the Einstein equations. This illustrates that gravitational radiation is, in principle, a metric perturbation of spacetime. This textbook is also a great intro into the mathematics of general relativity, in general, for an undergrad.
For an in-depth view of special relativity (with a chapter on curved spacetimes), see Taylor and Wheeler's classic textbook Spacetime Physics, which reads more like a comic book, honestly :). The chapters are online for free (bless Taylor and Wheeler!). I personally found this book to be very approachable and incredibly comprehensive, with lots of examples.
For technical introductions into gravitational waves and gravitational wave research, I recommend this and this (the former being more technically comprehensive but also challenging).
For nice reviews of the history of gravitational wave science, see here and here.


Who bid for Mjolnir?

Question: In the latest episode of supernatural Season 8, Episode 2 - What's Up, Tiger Mommy?, who do we see bidding for Mjolnir? I strongly suspect that it was Loki, one of the few I can think of that would 'remember' the weapon. Am I right? We haven't seen Loki already in Supernatural, have we?
Comment: Didn't the Trickster/Gabriel pose as Loki while he was in hiding? I think the best I can say is we *may* have seen Loki already, depending on whether Gabriel and Loki were always the same person or Gabriel simply borrowed the identity.
Comment: @AnthonyGrist Yes, see 5x19, [Hammer of the Gods](http://supernatural.wikia.com/wiki/Hammer_of_the_Gods).. Actually, quite an interesting name for the episode considering it took place in the [Elysian](http://en.wikipedia.org/wiki/Elysium) Fields Hotel, and this question...
Answer: According to the supernatural wiki, the being in question is Vili.

'In Norse mythology, Vili and Vé are the brothers of Óðinn (often Anglicized Odin), sons of Bestla, daughter of Bölþorn, and Borr, son of Búri.'

All I can find on him is that he gave, according to norse legend, the first man and woman their intelligence.
Comment: I thought he seemed a bit old for Loki, but wasn't familiar enough with Norse myth to make a decent guess as to who it was.
Answer: The "old man" we see bidding for Mjolnir in that episode was indeed intended to be Vili as shown in the end credits.  He is one of Odin's brothers which explains the previous connection to the hammer.  As mentioned, there is also lore of Vili, Ve, and Odin slaying a Frost Giant together.  This explains why he has the finger.
Answer: Loki was actually included as the trickster/archangel Gabriel. I assumed the bidder for the Hammer was Thor or possibly the Dwarf that made it. But for certain it wasn't Loki. I am not certain that they provided any decent clues to determine who the character was supposed to be.
Answer: Remember how Gabriel was undercover or hiding from all the gods, who thought he was loki but he wasn't? He had a finger of a ice giant which relates to Loki.
Because of this I'm sure the bidder is loki; he always wanted the hammer (in norse mythology at least) he has access to ice giants even in the comic (Marvel?) he helps thor  to battle the ice giant (I forget the name he called him in the show).
I'm sure of it. Everything falls in place to easy and with that season being all about gods well, it seems to fit nicely.
Comment: and loki is a shape shifter so thats y he could be old.
Answer: His name in the credits is Mr. Vili so duh, not Loki. Vili. It says it in the episode. He and Odin and Va killed the original frost giant, that's why he had the finger.

Who bid for Mjolnir?


Replace fan speed controller with Dimmer switch

Question: I replaced a fan with a light fixture and the fan used a fan speed controller.  It has two red wires going to two black wires. How would I replace the speed controller with a single pole dimmer?
Comment: Lucky for you it should be as easy as just connect the two wires from the SP dimmer to the two wires coming out of the wall...
Comment: Can you post photos of the inside of the switch box please?
Comment: Photo added.  There is the supply cable, cable going to new light and cable for the three way switch that is in the same box. The closest red wire from fan controller is wired with a pigtail hot from the switch.   Not sure what the other red wire is connected to
Comment: What make and model is the dimmer?
Comment: Was looking at the Lutron Skylark model ctcl-150h-wh.  It has two black and one ground.   Sounds like I can just swap out the two red for black and connect the ground (green) to the existing ground nut?  Does it matter which black goes where?
Comment: If I wanted to keep the fan control knob and just use that to turn the light on can I do that?
Answer: The color (as long as it isn't white, green, or bare) doesn't matter; they're just pig-tails on switch legs. You're good to go here with a direct swap out and arbitrarily connecting the wires to the new device (assuming it doesn't have a neutral contact. If it does it probably matters which contact has incoming power. Read the directions ;).
Make sure those nuts are still snug after you're done.
Comment: I'd eliminate the pig tail on the right; that black wire looks long enough. Looks like it could be *two* pig tails on the right. That doesn't pass muster for me. Make it one (each) or none.
Answer: You did not state what type of light fixture you replaced the fan with. So, you should be aware that the spec on the Lutron Skylark model ctcl-150h-wh states:
"Minimum load-
Incandescent/Halogen: 10 Watts
LED: 1 SSL7A compliant lamp unless stated otherwise in the Lutron compatible bulb list at www.lutron.com/dimcflled"
Most likely this won't be an issue for you, but just in case...
Comment: The light fixture has 5 lights. We have 40w/4.5w bulbs. Is the minimum load for all bulbs combined? I checked and the bulbs are on the compatibility list for the dimmee
Comment: That is fine. The min load would be all 5 bulbs--so you are more than double the minimum.


Why aren't fasteners open standards?

Question: I just wanted to find information for an M2 flat head hex socket machine screw which, I believe, is defined by ISO 10642, but unfortunately that is locked behind a paywall of a couple hundred dollars. Unless an individual has money to throw around, that information is out of their grasp, and that doesn't seem entirely fair to me. So I was just wondering the reasoning behind why its chosen to make that sort of general information a closed standard.
Comment: Paid for as people don't work for free...
Comment: Actually ASTM committee members are paid by employers , not ASTM. But as an organizer/manager/publisher , etc, ASTM does charge for standards to cover costs. API and ASME are the same.
Comment: So, from the organizations' perspective, all specifications and standards are produce by volunteers.
Comment: Some irony; the people who write the standards must also buy them from the organization. Except API does give speciations to the committee members.
Comment: A couple hundred dollars is peanuts for any serious user of this information. It is definitely unfortunate that DIYers can't pay a DIY-appropriate price for standards. It's a failure of our economic system that applies in lots of cases (e.g. students pirating software)
Answer: A google search brings this page with useful charts, and data.

ISO 10642

Why aren't fasteners open standards?


Prove that a linear operator $T:E \rightarrow E'$ such that $\langle Tx,y \rangle=\langle Ty,x\rangle$ is bounded

Question: Let E be a Banach space and $T:E\to E'$ a linear operator such that $\langle Tx,y\rangle=\langle x,Ty \rangle$ for all $x,y\in E$. Here $E'$ is the dual space of $E$. I have to prove that $T$ is a bounded operator. I tried to use the closed graph theorem, but I can't prove that the graph of T is closed. I would appreciate it if anyone could help me. Thank you.
Answer: Let $x_n\to x$ in $E$ and $Tx_n\to z$ in $E'$. Note that for all $y\in E$ we have
$$
\langle z,y\rangle
=\lim\limits_{n\to\infty}\langle Tx_n, y\rangle
=\lim\limits_{n\to\infty}\langle Ty, x_n\rangle
=\langle Ty, \lim\limits_{n\to\infty}x_n\rangle
=\langle Ty, x\rangle
=\langle Tx, y\rangle
$$
Since $y\in E$ is arbitrary $z=Tx$. By closed graph theorem $T$ is bounded.
Answer: It is also possible to apply Banach-Steinhaus to obtain the continuity.
Comment: could you if you don't mind give me a sketch of the proof ?
Comment: Let $B \subset X$ be the unit ball and consider the family of functionals $\{ Tx \mid x \in B \} \subset X'$. To check that it is pointwise bounded, take a point $y \in X$ and $(Tx)(y) = \langle Tx , y \rangle = \langle Ty, x \rangle \le \|Ty\|$.


Can a symmetric positive semi-definite matrix be transformed to any symmetric positive semi-definite matrix with the same rank?

Question: Given a symmetric positive semi-definite matrix $A\in\mathbb{R}^{n\times n}$ and denote by $rank(A)$ the rank of $A$. Let $\bar A=Q^TAQ$, where $Q\in\mathbb{R}^{n\times n}$ is an arbitrary invertible matrix. Then it is clear that $\bar A$ is also symmetric positive semi-definite and $rank(\bar A)=rank(A)$. My question is: By choosing arbitrary invertible matrix $Q$, can $\bar A$ take all the symmetric positive semi-definite matrices with $rank(A)$? I think it is true when $A$ is symmetric positive definite. But I cannot prove for the semi-definite case, either right or wrong. Any help will be appreciated!
Answer: The answer is yes.  With
$\text{rank}\big(A) = d$
What Sylvester's Law of Intertia tells you
is that your matrix is congruent to the $\text{n x n}$ matrix
$\begin{bmatrix} I_d & \mathbf 0\\ \mathbf 0 & \mathbf 0_{n-d}\mathbf 0_{n-d}^T\\ \end{bmatrix}$
More generally, any $\text{n x n}$ real symmetric matrix with rank of $d$ and $m$ positive eigenvalues is congruent to the $\text{n x n}$ matrix
$B =\begin{bmatrix} I_{m} & \mathbf 0&\mathbf 0\\ \mathbf 0 & -I_{d-m}&\mathbf 0\\ \mathbf 0 &  \mathbf 0 &  \mathbf 0\\ \end{bmatrix}$
where $(m,d-m)$ (or sometimes $(m,d-m, n-d)$) is the signature of a real symmetric matrix. Equivalently any $\text{n x n}$ real symmetric matrix with signature $(m,d-m)$  is an orbit of $B$.
Comment: Typo in matrix $B$: $d\to m$.
Comment: @sas fixed this
Answer: Yes, it's true.  If $\ A\ $ and $\ B\ $ are any non-negative semi-definite real $\ n\times n\ $ matrices with the same rank, $\ r\ $, then there exist orthogonal matrices $\ \Omega_A\ $, $\ \Omega_B\ $ such  that
\begin{align}
\Omega_A^TA\,\Omega_A &= \text{Diag}\left(a_1,a_2,\dots,a_r,0,\dots,0\right)\ \text{ and}\\
\Omega_B^TB\,\Omega_B &= \text{Diag}\left(b_1,b_2,\dots,b_r,0,\dots,0\right)\ ,
\end{align}
where $\ a_i, b_i>0\ $ are the non-zero eigenvalues of $\ A, B\ $, respectively.  Now if
\begin{align}
D&=\text{Diag}\left(\sqrt{\frac{b_1}{a_1}}, \sqrt{\frac{b_2}{a_2}}, \dots, \sqrt{\frac{b_r}{a_r}},1,\dots,1 \right)\ ,\text{ and}\\
Q&=\Omega_A D\,\Omega_B^T\ ,\text{ then}\\
B&=Q^TA\,Q\ .
\end{align}
Comment: There is a problem in the answer. Notice that $Q$ is required to be invertible. However, the $Q$ constructed above is not invertible if $A$ is not invertible. If $Q$ is restricted to be invertible, then is it still true? Thanks a lot!!
Comment: Sorry, I missed that condition.  Yes, it's still true.  Just replace the zeroes in the diagonal of $\ D\ $ with ones  (or any other non-zero entry).   The key identity you need is
$$
\text{Diag}\left(b_1,b_2,\dots,b_r,0,\dots,0\right)=D^T \text{Diag}\left(a_1,a_2,\dots,a_r,0,\dots,0\right)D\ ,
$$
and this will be true no matter what you put in the last $\ n-r\ $ entries of the diagonal of $\ D\ $.
Comment: I see. Thanks!!


Why do computers have only a few thousand instructions when they could have millions?

Question: Most computers contain only a couple thousand instructions, but the bit width(usually 64-bit) technically allows computers to have access to millions or even billions of instructions. Some could be extremely useful, like DIVIDE, EXPONENT or conditional operations. Plus, clock speeds are grinding to a halt, and quantum computing is a long way away. Why haven't they added extra instructions to microprocessors yet?
Comment: Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackexchange.com/rooms/108571/discussion-on-question-by-trevor-mershon-why-do-computers-have-only-a-few-thousa).
Answer: Because every instruction needs some circuitry to implement it.  The more instructions you add, the bigger the processor gets.  Since most of these operations will never be used, it's just wasted complexity.
All the complexity can even slow the processor down.  RISC processors, such as the ARM, were based on the idea of throwing away a large number of operations, and making the resulting smaller processor core as fast as possible.
Even modern X86 processors, with a huge instruction set, have ended up having a faster processor hiding inside, emulating a huge complicated one.
Comment: Moreover, the more you want to make your CPU clever (and thus, as you say, bigger in circuitry), then the easier is to create flaws and maybe security breaches. See Spectre and Meltdown, to name two.
Comment: Many Intel processors will downclock a few hundred MHz when using AVX2 or AVX512 instructions.
Answer: To complement Simon B's answer, GPUs, on the other hand, do a lot of complex calculations. But they can be boiled down to multiply-add instructions, A = B*C + D. So they at least try to have complex multiply-add instructions because they are common instructions.
To recap. If you add more instructions the CPU will become:

more complex, i.e. bigger CPU and harder to use efficiently
slower. The speed you can run it depends on the slowest unit
more expensive. Is this what your customer wants?

Also, read about "risc vs cisc architectures"
Answer:
Most computers contain only a couple thousand instructions, but the bit width(usually 64-bit) technically allows computers to have access to millions or even billions of instructions.

First, let's be clear that being 64 bit doesn't mean anything for instructions. Most 64 bit systems use 32 bit long instructions, with the exception of x86 where instructions can be anywhere from less than 32 bits to several hundred bits.
As for why the number of instructions is limited, for a system using 32 bit instructions (which is a very efficient number to use), the number of possible instructions that can be encoded is somewhat limited since you ideally want to have at least 3 registers for at least some opcodes. However even x86 where instructions can have arbitrary length has on the order of a few thousand unique instructions (not all of which are necessarily still used) because there aren't that many useful things an instruction can do. Encoding lots of useless instructions (as x86 does) doesn't necessarily hurt you, but it doesn't help either.

Why haven't they added extra instructions to microprocessors yet?

Intel and ARM regularly add new instructions. Focusing on intel, there has been Haswell New Instructions, Broadwell New Instructions, Skylake New Instructions, Palm Cove (Cannonlake) New Instructions and last year's Sunny Cove (Icelake) New instructions.
Most of the useful instructions were added long ago so these typically have a marginal effect on average, but there are specific applications where these can make a large difference.
Answer:
Most computers contain only a couple thousand instructions,

That depends on how you count them. Should all instructions with a similar function be grouped together, or different variations counted separately? Or should they be grouped according to what operations the CPU has to perform to implement them (and how different must those operations be to make the instructions 'different')?
How Many x86-64 Instructions Are There Anyway?
The answer? Anywhere from 981 to 3683 depending on which criteria you use.
But why so few (or so many) when there could could be even more? Fundamentally the limit is not technical, but economic. Nobody wants those extra instructions badly enough to justify adding them.

Some could be extremely useful, like DIVIDE, EXPONENT or conditional
  operations.

That accounts for a dozen of so, most of which current CPUs already have. Millions or billions of instructions? Nobody wants them.
Just because you think an instruction could be 'useful' doesn't mean it's worthwhile implementing. Since almost all modern coding is done in high level languages, so long as there are sufficient instructions to satisfy compiler writers everybody is happy. Any other 'useful' operations that are desired can be implemented in higher level code.
There are exceptions to this of course, which is why modern CPUs tend to have more instructions in them. But there have also been cases where instructions were removed because they weren't used enough to justify keeping them. This may be done to save silicon, reduce complexity, increase speed, or simply to avoid having to support features that nobody wants.
Answer: I am having trouble finding the document that explicitly shows the opcode format for ARM, but many opcodes have a large part of their bitfield reserved for immediate data or branch offsets.  so not all of the 64 bits or 32 bits are there to encode different instructions, but are there to encode data that is built into the instruction.
Comment: These are the architecture reference manuals, the ARM ARMs, and they are readily available from ARM's infocenter.
Comment: @ElliotAlderson [i found this](https://static.docs.arm.com/100076/0100/arm_instruction_set_reference_guide_100076_0100_00_en.pdf), but still do not see where the opcodes are laid out.
Comment: That's because the document you linked is not an Architecture Reference Manual.
Comment: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.subset.architecture.reference/index.html  (registration is required from the official link, but you can find copies of the manuals on google if you do not want to register an account).
Answer: I would say that, arguably, they do support millions of instructions.  But it really depends on how you define an "instruction".
In general, instructions are divided up into several fields - one part indicates what the operation is (add, subtract, divide, branch, jump, read, write, etc.) and then other parts can provide arguments - immediate values or register indicies.  So, if you group all of the possible immediate values and all possible register indicies together, then you only have a relatively small number of operations.  As each operation must be evaluated on dedicated hardware (well, more or less...things like add and subtract can be done on the same hardware with some configuration/preprocessing) the number of distinct operations must be limited by the area and complexity of the chip.
However, different arguments result in different machine code.  For example, take the RISC-V add instruction, ADD rd, rs1, rs2 which takes two register values, rs1 and rs2, adds them together, and places the result in a third register, rd.  RISC-V has 32 registers, so that means there are 32*32*32 = 32,768 different "instructions" that all map on to ADD, but with different arguments.  Similarly, ADDI rd, rs1, imm takes a 12 bit immediate value, adds it to rs1, and writes the result to rd.  So, this results in 32*32*4096 = 4,194,304 distinct encodings just for ADDI.
Dividing up the "instruction space" is a very important part of the design of an ISA.  Which bits you use for register arguments, which bits you use for immediate values, which bits you use to determine the operation, which bits you use to determine the instruction format, which bits you use to determine the instruction size, etc. all have some bearing on the flexibility and expressiveness of the instruction set and complexity of the decode hardware required in the CPU.  Increasing the number of available operations generally comes at the expense of flexibility - immediate size, number of arguments, number of addressable registers, etc.


Can electricity be generated using a rotating electromagnet and fixed metal plates enclosing it (as opposed to rotating permanent magnet)?

Question: I was wondering , if this be possible , can we make an adjustable electricty generator? If not, why so? Appreciate any responses .
Answer: Yes, it can.  Indeed most dynamos use coils for both the stator (nonrotating part and the rotor (rotating part): a generator which uses permanent magnets for the stator is called a magneto (and anyone with a suitably old car will hate magnetos as much as I do!).
The trick these things employ is that there is some residual magnetism left in the iron cores of the stator even when the system is not running, and you can make use of this to essentially bootstrap the system: as it starts spinning it will generate some power as the rotor moves in the residual field, and this can be used to energise the field coils in the stator, and the thing thus bootstraps itself.  This is called 'self-exciting' and that you could do this was historically an important discovery.
I'm actually not sure if there are generators which use rotating permanent magnets in any kind of wide use: other than not needing brushes I don't think such a thing would be very useful.


manipulating ShellItemArray

Question: How can I remove items from a given ShellItemArray? or alternatively, create a new ShellItemArray from specific shell items of the current array?
Non of the SHCreateShellItemArray*** functions help me in that (there is one function named SHCreateShellItemArrayFromShellItem, but it creates an array from single shell item, not a few)
Answer: I don't think you can modify an existing array without directly messing with the object in memory so your best bet is probably to create a new array with SHCreateShellItemArrayFromIDLists. You can probably use SHGetIDListFromObject while building the pidl array.

manipulating ShellItemArray


How to use OpenLDAP for Oracle database user authentication

Question: In our enterprise, we have a large number of Oracle databases and (obviously) large number of users with access to different databases. We would like to ease the procedure to create/drop/modify users on an enterprise level. A LDAP solution comes to mind but the solutions from Oracle Corp are too expensive. Needless to say, my mgmt asked me to research and come up with an alternative. I read about OpenLDAP. My questions:

How do I setup OpenLDAP for oracle user security authentication ?
Can I use OpenLDAP as a standalone or does it have to be integrated with any Oracle product like OID, OVD, ODSEE etc?
Are there are any certified install procedures for setting up OpenLDAP w/ Oracle database?

I didn't find anything on the internet for setting up OpenLDAP. Any help/pointer would be appreciated. The goal is to avoid any products from Oracle Corp purely for cost reasons.
Thanks
Answer: Permitted Features, Options, and Management Packs by Oracle Database Offering

Enterprise User Security is a feature for directory-based management
  of database users. It requires a corresponding Oracle Identity
  Management Directory Services Plus to be licensed.

Enterprise User Security: The Big Picture

Enterprise User Security requires Oracle Internet Directory 10g
  (9.0.4) or higher. Other LDAP-compliant directory services are
  supported by using Oracle Internet Directory Integration Platform to
  synchronize them with Oracle Internet Directory. Another directory
  services product, Oracle Virtual Directory, provides a single, dynamic
  access point to multiple data sources through LDAP or XML protocols.
  Oracle Virtual Directory can provide multiple application-specific
  views of identity data stored in, for example, Oracle Internet
  Directory, Microsoft Active Directory and Sun Java Systems Directory
  instances, and can also be used to secure data access to the
  application-specific sources and enhance high-availability to existing
  data-sources.

Through Oracle Virtual Directory or Oracle Unified Directory.
See above. Technically it should be possible to use as standalone, but not supported at all.
None for direct connection. See above.


Kiwi (New Zealand) Pronunciation of "Moscow"

Question: So I was watching some Flight of the Conchords just a moment ago (classic), and they're from New Zealand. In one of their songs, they said "Moscow". I'd assumed that Kiwis would say it "Mos-co" (like "to and fro") as us Brits do, but they said it "Mos-cow" like the Americans do. Is this standard for those from NZ, or is this maybe because they're doing an American show (on HBO) and their primary audience is the US?
Answer: I, being a Kiwi, think I use both. With a preference towards Mos-cow.
Comment: Interesting. Would you suggest that, in general, when there are small differences between the British and American English, you go with the American (since that's more the "global language")?
Comment: Yes. Probably based on TV's influence. Often I would switch between both, interchangeably. I checked with my wife, and she says she is the same.
Comment: When it is pronunciation only. And when they sound similar. Jam is still jam, not jelly. Scones are not biscuits.
Comment: Yeah, I thought it might also be due to TV influence. Interesting. Thanks very much for your answer! :)


Adding liquid to Le Creuset Casserole during cooking

Question: My Mum had just purchased a Le Creuset Casserole with enamel coating and is wondering how you add liquid to it when it is already hot without cracking the enamel? This not only includes water, but wine and beer as well.
Comment: Depending on the recipe,you could heat the liquid in a different pan before adding it to the main casserole.
Answer: Adding cold liquids to a hot enameled pan is not going to crack the enamel, you can add a cold beer to a dish without worrying about your cookware. The main thing to keep in mind when adding cold liquids is that it will bring the temperature down below your desired cooking temperature, you will need to either crank up the heat to bring it back up to the desired temperature quickly or lengthen the overall cooking time.
Answer: Don't worry about it.  I have poured white wine or other liquids straight from the refrigerator into a hot Le Creuset casserole, in order to deglaze drippings and make a pan sauce, more times than I can count.  I can't speak for cheaper enameled pans, but Le Creuset cookware is made to take this kind of treatment.
You won't damage the enamel in any kind of normal cooking scenario--you would have to deliberately try very hard to scratch it with a stiff, sharp metal utensil like a chef's knife, or heat the casserole for an extended period of time with nothing in it, which could possibly cause crazing of the enamel.  (If you want to preheat the pan before adding food, add some oil or other liquid while it heats up first.)
Comment: Or over-heat the pan (which can cause crazing ... this is typically from pre-heating or an otherwise empty pot.
Comment: @Joe Good point.  Added.  Heating an empty pot is never a good idea, of course.
Comment: Yeah, but it's the instructions for many 'no-knead' bread recipes -- they call for [heating a cast iron dutch oven](http://cooking.nytimes.com/recipes/11376-no-knead-bread) ... but if you do it with enameled cast iron, [you risk crazing](http://jenmenke.com/my-sad-le-creuset-pots/)
Comment: Interesting.  News to me, I must be the last foodie on earth to have not tried the famous Bittman no-knead bread.  But I would definitely only use a cast-iron Dutch oven for that.


How should I fix an electric shower pull cord that doesn't work anymore?

Question: The red light on my pull cord electric shower no longer comes on, hence it doesn't work. However, there was a brief period yesterday where it worked suggesting it's an electric fault and can be fixed? There's a great article explaining how electric showers work and if someone could at least point me in the right direction that would be great.
Answer: I've never seen an electric shower (looks to be a European thing?) but based on the diagram in that article you've got electrical contacts near moisture. Corrosion is quite likely and would cause intermittent problems like you describe. Turn off all power to the device then open it and check for "crud" on any of the electrical terminals. a fine brass-bristle brush can help remove it, or even a Scotch-Brite scrubbing pad.
Comment: Cheers, I'll try that out and report back. Indeed, it is English. Also there is this answer here: http://www.mumsnet.com/Talk/property/a1418675-Shower-pull-light-broken which I'll explore too.
Comment: I gave it a good brush, getting rid of any crud and corrosion, but unfortunately it didn't change anything. cheers
Answer: As discussed in the comments above, I removed all crud & corrosion, so by process of elimination I am hopefully getting closer to an answer which is contained in this very elaborate detailed response; check it out


Allow user to have no password?

Question: Do you think it's a valid point, that if a web service holds no personal/security data it should be up to user what password length to haver or even to have no password?
Answer: What is a password for? It is to help provide authentication. If you need to provide authentication then you need means to do that. A password is merely a tool that assists that.
Answer: This depends on what the user account is used for. There are 3 forms used here:

Authentication
Authorization
Identification

If you're concerned either with Authentication or Authorization then you must have a password. Not having a password makes this pointless. If your only goal is identification and there is no real security loss/gain in allowing a user to misidentify him/herself, then a password becomes superfluous. Again, if this is the case, the identification itself becomes superfluous and you should consider allowing open access.
Answer: What's the point of having accounts if you're going to allow a user to not have a password? The purpose of accounts it accountability. Not having a password removes that.
Answer: If you need authentication via passwords, then you need your passwords to be as secure as your site operations are to the users.
Answer: First off, as the other answers stated clearly, you should always require a password as not doing so defeats the purpose of authentication.
Having said that, why not instead use openID or Facebook Connect? There are way too many sites now that require signing up for even the most trivial matters. Using Facebook Connect or OpenID will give you huge usability points in the mind of users.

Allow user to have no password?


Elementary transformations and determinant maps.

Question: Let $S$ be a smooth projective surface and $C$ a smooth, irreducible curve contained in $S$. Let $E_1$ and $E_2$ be two vector bundles on $S$ having the same rank and assume they lie in a short exact sequence
$$
0\to E_1\stackrel{f}{\to} E_2\to A\to 0, $$
with $A\in\mathrm{Pic}(C)$. In this situation $E_1$ is called an elementary transformation of $E_2$. Now, the map $f$ induces an injection $\mathrm{det}(f):\mathrm{det}E_1\to \mathrm{det}E_2$, whose cokernel is again supported on $C$ and coincides with $\mathrm{det}E_2\otimes\mathcal{O}_C$. Is there any relation between $A$ and $\mathrm{det}E_2\otimes\mathcal{O}_C$ (e.g, a map from one to the other one)?
Comment: In this context, you might be interested in the theory of Fitting ideals. See for instance the appendix of Mazur, B.; Wiles, A. Class fields of abelian extensions of Q. Invent. Math. 76.
Answer: There is no relation. In fact, if $E_2$ is fixed then $\det E_2\otimes O_C$ is fixed, while $A$ can be taken to be any invertible quotient of $E_{2|C}$.


Why is the redirect_uri defined to be an absolute uri in OAuth2?

Question: I've been reading the OAuth2 spec and section 3.1.2 states that the redirect uri parameter (the callback used after successful authentication to redirect back to the service) must be an absolute uri. I've struggled unsuccessfully to work out exactly why this is in the spec - is it critical for security? If so, is it protecting against untrusted usages (Facebook auth) or more audited flows where the same org runs both client and IdP?
Comment: its probably just to make validating it easier while allowing fuller logs and avoiding ambiguity when you have a lot of redirects and server pass-offs.
Answer: This answer might help you:
What is the purpose of OAuth 2.0 redirect_uri checking?
Another reason might be that providers can enforce the usage of https for the redirect uri...
Answer: The OAuth2 redirect uri is used as an actual HTTP redirect. In HTTP 1.0 and 1.1, HTTP redirect URL's were initially required to be absolute URL's, although almost all browsers supported relative redirects and it eventually became allowed by the updated standard for 1.1.
Despite this, there is still a good reason for OAuth2 redirects to be absolute.
The OAuth2 protocol starts with the browser being redirected to the authorization server, which should be separate to the content server, and is often in a different organization. For example, if you want to sign in to https://www.example.com/login using Microsoft credentials, the site www.example.com will redirect you to login.microsoftonline.com.
You provide your credentials directly to Microsoft, and they then redirect your browser to the redirect uri, e.g. https://www.example.com/redirect. If you could provide a relative redirect uri (/redirect) then your browser would instead load https://login.microsoftonline.com/redirect.