Laravel optimization

Question: So I've heard, because Laravel is easy to develop, it loads a whole bunch of dependancies which may or may not be needed. I want to optimize Laravel for the sake of better performance, and I wonder if there's any plugins I could utilize so as to find out and remove unwanted Laravel classes/services to suit exactly my own needs?
Comment: possible duplicate of [Is Laravel really this slow?](http://stackoverflow.com/questions/23283574/is-laravel-really-this-slow)
Comment: Adding plugins to to make performance better.......  Does that even make sense?
Comment: Is there a specific performance issue you're trying to solve?
Comment: Not really, just thought that Laravel should do better, but guess it no longer matters to me now since I use nodejs instead for all my  new projects
Answer: The latest version of Laravel, soon to be released and it will gets rid of all of the unnecessary elements and has a vast improvement. I would suggest using this upcoming version rather than trying to streamline the current version, they have done it all for you.
Comment: So glad to hear that! Is it Laravel 5 you're talking about? Any definitive news when the release date will be?
Answer: use these commands in terminal-
composer dump-autoload -o
php artisan optimize

-o flag create the optimized autoload file.
Answer: You can use Lumen which is an amazing Microframework by Laravel.
Answer: if you are on debuging mode ::
on you laravel project directory
run
php artisan optimize --force

else
run
php artisan optimize on you project folder

(It will optimize Laravel Framework for Better Performance as much as possible)
Answer: Take a look at Lumen and compare the dependencies, it is basically a slim version of Laravel.
Besides the dependencies you will also notice it uses $app->get() instead of Route::get() which will be faster if you have a lot of routes
Answer: I use the following commands for laravel 5:

php artisan optimize --force -n
php artisan config:cache
php artisan route:cache

Also make user to use production env.
You can also disable/comment out providers and alias from config/app.php that are not being used
Answer: Autoloader Optimization:
When deploying to production, make sure that you are optimizing Composer's class autoloader map so Composer can quickly find the proper file to load for a given class:
composer install --optimize-autoloader --no-dev

Optimizing Configuration Loading:
When deploying your application to production, you should make sure that you run the  config:cache Artisan command during your deployment process:
php artisan config:cache

This command will combine all of Laravel's configuration files into a single, cached file, which greatly reduces the number of trips the framework must make to the filesystem when loading your configuration values.
Optimizing Route Loading:
If you are building a large application with many routes, you should make sure that you are running the route:cache Artisan command during your deployment process:
php artisan route:cache

This command reduces all of your route registrations into a single method call within a cached file, improving the performance of route registration when registering hundreds of routes.
Server Configuration:
Nginx
If you are deploying your application to a server that is running Nginx, you may use the following configuration file as a starting point for configuring your web server. Most likely, this file will need to be customized depending on your server's configuration. If you would like assistance in managing your server, consider using a service such as Laravel Forge:
  server {
    listen 80;
    server_name example.com;
    root /example.com/public;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

Laravel optimization


Is quantum entanglement the "architecture" for a quantum chip?

Question: I am trying to understand the role of entanglement in quantum computing.  Is it a method used to link/entangle states of qubits so each state is dependent on it's entangled partner? And If entanglement is monogamous how do you entangle multiple states?
Answer: Entanglement occurs whenever two or more quantum states are created in a single interaction. They need not be monogamous.  This doesn't answer your question of how to entangle multiple states, but it happens all the time in nature.  For example, all of the electrons in an atom in its ground state are entangled.  Not all entangled systems are easy to transform into quantum computers, however (except in the trivial case of self-simulation). For an extreme example of many-particle entanglement see this current Phys Rev Letter


Is it OK to refer to Eisa ibn Merriam as 'son of man'?

Question: When I am trying to engage Christians in dawa and interfaith dialog the question of Jesus and his status is always there and must be addressed.  The early gospels of Mark and Matthew refer to him as 'son of man'.  Should muslims have an issue with this?
Answer: In the Tanakh (Old Testament), the phrase translated as "son of man" is "ben adam" literally "son of Adam", which is a word for a human being.

Numbers 23:19
lō 'îš 'êl wî-ḵaz-zêḇ, ū-ḇen- 'ā-ḏām wə-yiṯ-ne-ḥām; ha-hū 'ā-mar
wə-lō ya-'ă-śeh, wə-ḏib-ber wə-lō yə-qî-men-nāh
God is not man, that he should lie, or a son of man, that he
  should change his mind. Has he said, and will he not do it? Or has he
  spoken, and will he not fulfill it?

.

Ezekiel 2:1
wayyoˈmer ˈelay  benˈadam ˈamod ˈalraglekha vaˈadabber ˈotakh
And He said unto me: 'Son of man, stand upon thy feet, and I will
  speak with thee.

The Quran uses a similar word  to refer to humans, for example:

Quran 17:70
وَلَقَدْ كَرَّمْنَا بَنِي آدَمَ وَحَمَلْنَاهُمْ فِي الْبَرِّ
  وَالْبَحْرِ وَرَزَقْنَاهُم مِّنَ الطَّيِّبَاتِ وَفَضَّلْنَاهُمْ عَلَىٰ
  كَثِيرٍ مِّمَّنْ خَلَقْنَا تَفْضِيلًا
Walaqad karramna banee adama wahamalnahum fee albarri waalbahri warazaqnahum mina alttayyibati wafaddalnahum AAala katheerin mimman
  khalaqna tafdeelan
And We have certainly honored the children of Adam and carried them on
  the land and sea and provided for them of the good things and
  preferred them over much of what We have created, with [definite]
  preference.

And the Prophet used it as well:

Sahih Bukhari
قَالَ اللَّهُ أَنْفِقْ يَا ابْنَ آدَمَ أُنْفِقْ عَلَيْكَ
Allah's Messenger (ﷺ) said, "Allah said, 'O son of Adam! Spend, and I
  shall spend on you."

.

Saheeh Muslim
يَهْرَمُ ابْنُ آدَمَ وَتَشِبُّ مِنْهُ اثْنَتَانِ الْحِرْصُ عَلَى
  الْمَالِ وَالْحِرْصُ عَلَى الْعُمُرِ
The son of Adam grows old, but two (desires) in him remain young:
  desire for wealth and desire for life.

Jesus was a human according to Islam, and being the son of Mary he was a descendant of Adam. So I don't see a problem with using this title, he was of the بَنِي آدَمَ.
Messengers are humans of the Bani Adam:

Quran 7:35
يَا بَنِي آدَمَ إِمَّا يَأْتِيَنَّكُمْ رُسُلٌ مِّنكُمْ يَقُصُّونَ
  عَلَيْكُمْ آيَاتِي ۙ فَمَنِ اتَّقَىٰ وَأَصْلَحَ فَلَا خَوْفٌ
  عَلَيْهِمْ وَلَا هُمْ يَحْزَنُونَ
Ya banee adama imma yatiyannakum rusulun minkum yaqussoona AAalaykum
ayatee famani ittaqa waaslaha fala khawfun AAalayhim wala hum
yahzanoona
O children of Adam, if there come to you messengers from among
  you relating to you My verses, then whoever fears Allah and reforms
  - there will be no fear concerning them, nor will they grieve.

And Jesus was no exception:

Quran 5:75
مَّا الْمَسِيحُ ابْنُ مَرْيَمَ إِلَّا رَسُولٌ قَدْ خَلَتْ مِن
  قَبْلِهِ الرُّسُلُ وَأُمُّهُ صِدِّيقَةٌ ۖ كَانَا يَأْكُلَانِ
الطَّعَامَ ۗ انظُرْ كَيْفَ نُبَيِّنُ لَهُمُ الْآيَاتِ ثُمَّ انظُرْ أَنَّىٰ يُؤْفَكُونَ
Ma almaseehu ibnu maryama illa rasoolun qad khalat min qablihi alrrusulu waommuhu siddeeqatun kana yakulani alttaAAama onthur
  kayfa nubayyinu lahumu alayati thumma onthur anna yufakoona
The Messiah, son of Mary, was not but a messenger; [other]
  messengers have passed on before him. And his mother was a supporter
  of truth. They both used to eat food. Look how We make clear to
  them the signs; then look how they are deluded.
Comment: Is the conclusion that it is Ok to say son of man or not?


Meaningless Choice

Question: What's a name for a meaningless choice? A choice that has no effect on outcome. Something similar to a phrase like "pyrrhic victory".
Comment: You may choose A or B. *No matter choice* (or no matter what choice you make), you will loose her.
Answer: inconsequential, defined by Dictionary.com as:

of little or no importance; insignificant; trivial

The OP asked for a choice that had no effect on the outcome.  The outcome could be serious, no matter the choice, as in Graffito's comment.
Example:  Whether you go to Romano's or Chez Louis for dinner is inconsequential; she's decided to take the job in Singapore.
Answer: Consider decision quicksand.
Quoting Physcology Today

... a paper in the August 2012 issue of the Journal of Consumer Research by Aner Sela and Jonah Berger.
They suggest that unimportant decisions can suck us in when they are more difficult than we expect them to be. They call these choices decision quicksand, because they pull you in and take more effort than they deserve.

See their research paper at jonahberger.com
Answer: If a decision is of no practical effect, the word "academic" could be used.

It is academic now whether Mark proposes to her or not. She has already  made up her mind to marry George.

If the decision will cause different immediate effects, but the end result is the same, the phrase "catch 22" can be used.

It is Catch 22. If she makes the first move he will think her too forward, and that will put him off. If she leaves it to him to make the first move, he will never get round to it. Either way they won't get together.

If the decision will be made by someone else the phrase "Hobson's Choice" may be used.

The menus said fish served with vegetables. I asked for carrots, but it was Hobson's choice. That day they were only serving peas.
Answer:
Insignificant
Doesn't matter in the grand scheme of things, alternatively:
Useless
Pointless
Void(!)
Dud
Futile
Ineffectual
Impotent (sheesh, that's harsh.)
Dysfunctional
Inept
On-rails(!)
Linear

Insert other synonyms of useless here.
Take it from an avid RPG player who burnt himself on BioWare, Telltale Games, and other "cinematic, choice driven" "role-playing" "games". Everything in quotes are subject to change whenever asked by players.

Meaningless Choice


Facebook Messenger unspam conversation

Question: I marked a conversation as spam by accident (wanting to press mark unread) from Facebook desktop messenger and it got removed without ANY warning from my conversation list. Any way to revert this mess? I tried checking spam messages in mobile Facebook and see filtered requests but no luck.
Answer: Go to the app-version of messenger. Click the chat head in the left upper corner with your own image. A menu appears. Choose message requests. You come to a folder separated in two categories. Choose Spam. These are the messages marked as spam either by you or Facebook. To get it back to your inbox, the only solution I've found so far is to reply to it, but I'm trying to find other options.
Comment: Super helpful, thank you.
Answer: The Spam folder has been deprecated. Unfortunately, you won't be able to recover those messages.
Source
Answer: I have just one thing to say if that can help you out. Please visit Facebook and go to the activity log, if you remember the date or month filter it in the search and there you may be able to do some action. I don't know exactly but I think you may find a way there.
Let me know further.

Facebook Messenger unspam conversation


How do I determine the appropriate size for my tablespace when importing a .dmp file?

Question: I have a 14g DMP file. How large should I size my tablespace to import it into an Oracle 11g database?
Comment: Fire up a VM, run Oracle 11.2. Import that file and see how big it is. Then, add that + 50% (varies on how active you database/file is).
Comment: maybe offtopic, but usually it is helpfull to execute the rman command "report schema" on source db, to get report about datafile sizes. Also you can use imp option `show=yes` to get ddls for tablepsaces (is its full database export).
Comment: @Verace, thanks.  I'm simply using it for reporting.  I assumed that I needed to create a tablespace before importing the dmp. file and that create tablespace command required a size.  Import it to figure how to size it seems to be cart than horse.
Comment: It's my understanding of Oracle that if you don't specify tablespace, it'll just end up in the default one. If you do that and get the size before and after the operation, then you'll know the space. You can then delete your VM and import into your real system. I don't know, maybe you have a perfect test mirror of your PROD system, but I know all too well that's frequently not the case, hence the VM suggestion.
Answer: At least 14 GB.
Maybe more if the dump file is compressed.
Maybe less if the tables are compressed.
A bit more or lot more if there are indexes.
Even Data Pump will miscalculate the required space in case of compressed tables.
Index data is not stored in the dump file, only index definitions. You can have a 14 GB dump file with 14 GB table data and 0 index definitions or hundreds of index definitions, and building those indexes may consume a lot more storage than the base tables, or just a fraction of it.
So the correct answer in my opinion is, test and measure it.
Comment: Will importing the data cause the index to re-build or will I need to do that manually?
Comment: Indexes will be built automatically for new tables, maintained automatically for existing tables.
Answer: Using a combination of MASTER_ONLY and KEEP_MASTER switches, it's possible to get Data Pump import to do the dependency tracking, calculations, and estimations of sizes that it does at the beginning, create the master table that it uses to track everything, and then stop.
You can then examine the master table to see how big the various tables are estimated to be.
Remember that when importing data, if importing to a schema/user which has a default tablespace of "XYZ", then the data will go into that tablespace no matter what tablespace it came from on the originating database.
Comment: Thanks for your insight.  As you probably surmised, I'm not a dba and don't pretend to be one.  Further I've never had access to the source database only the dmp file so I'm not sure what I'm getting myself into.
Comment: I couldn't find this yesterday, but got it now... link to some info on what you can do in this kind of situation: http://dbaharrison.blogspot.de/2014/10/what-tablespaces-do-i-need-to-import.html
Answer: Assuming you are not using bigfile tablespaces and assuming you have no standard for how large datafiles should be or how empty they should be, you should create a tablespace with one 14G datafile and allow it to autoextend to a reasonable percentage of the overall free space you have available.  If you have plenty of free space, you should set the maximum to unlimited (which is actually a finite amount dependent on your block size).  By doing this you can set an amount for the autoextention that reflects your balance between system performance due to frequent autoextending and the space benefits of allocating only as much space as the objects need.


Browser does not load certain pages

Question: I installed UBUNTU 12.04 and configured for internet access. No issues there. However, my browser (firefox, chromium) is not able to load/display certain pages (mail.yahoo.com, thehindu.com, in.yahoo.com) after loading the web page title. The browser does not have problem with other sites (google, msn, ubuntu, etc...). Any reason why only certain pages are not loading?
Answer: You may have a bad DNS (Domain Name Service). It's used to look up the numbers that your computer needs to connect to websites.
Go to your network settings. Edit the connection you use for Internet. Under "IPv4 Settings" tab, change the "Method:" scroll down to "Automatic (DHCP) addresses only". Then in the box labeled "DNS servers:" put in 188.8.131.52,18.104.22.168
This will set your computer to use Google's public DNS which is a fast and reliable DNS.

Browser does not load certain pages


Current through a junction of two metals

Question: When a current flows through a junction or a contact between two metals of different conductivities a charge is accumulated in the vicinity of contact. The charge accumulated, I've read, is directly proportional to the current. In case current flows from a metal of large conductivity to a metal of small conductivity, charge accumulation is of positive type. Why so? And if there is such an accumulation of charge, won't a potential barrier be set up, that will eventually stop current flow?
Comment: considering a gaussian surface may be helpful...
Answer: The two metals will have differing dielectric constants and hence different electric fields, so when considering a gaussian surface, the net flux will NOT be 0. Hence we can assume accumulation of charges. The current will not stop as this accumulation of charges will be overpowered by the cell voltage.


MS Access 2016 report no longer editable after "data type mismatch" error - recoverable?

Question: After receiving the "data type mismatch" error, which I do know how to fix, I can no longer open the report in Design View.  Thus, I cannot get at Report Properties to fix the problem.  Is this a know bug?  Is there any way to recover the report?  I lost about an hour's work and seems like it could easily happen again.
Comment: I'm voting to close this question as off-topic because OP resolved the issue through several different steps and it is unlikely they'll be able to reproduce the problem in order to know the specific problem and therefore the effective solution.
Answer: Although I opened and closed both Access and the database several times, the problem with the report persisted.  I ran compact and repair with no change.
I spent an hour developing an automatic backup task and, in the process, moved the database to a network location.
The next time I opened the database, I was able to open the report in Design View and see the Report Property Sheet.
I have no idea why moving the database worked but I thought I would post it for someone else to try.
Comment: Hi user3067815, thanks for your answer, while I'm not sure if Question and answer will indded be useful for other users. On some other sites there would be a close reason like "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers."


A case for exceeding docker's max depth

Question: I am building a common library inside a docker container. A number of applications depend on the library. They build inside the common container and the compiled files are copied in a "slim" application container.
The common library Dockerfile looks as such:
FROM common:latest
COPY sourcecode
RUN build steps for library

The reason to iterate over the latest image is to keep multiple versions of the same library in the latest image. Then the services which depend on the library can build inside latest common image and find the correct version of the library on which they depend.
Eventually, the max layer depth of docker builds is exceeded.
Complication:
The common image actually contains multiple packages, each of which is versioned. All the apps that depend on the libraries are also versioned and depend of specific versions of the packages. All the builds happen automatically in a CI pipeline.
Solution 1:
Don't build the common libraries in docker. Instead clone the common repository build the correct versions, build your app on top of it's dependencies and copy the artifact in an image. However, now your CI agent is building the same version of the libraries again and again.
Solution 2: Start versioning the common image. Find a way to correlate the app version with the common image tag. Pass the tag in a --build-arg to docker build. This solution is complicated. Versioning the common image is doable. For instance, the build digest can be used to tag. Now you can't correlate the app versions with the common bundle in a straight forward way.
Correlating is possible in my special case. The agreement is that functionality is only added to the common libraries, (whether this may be a terrible idea). In this case, every time the a common library is iterated, I can make a small commit in the app repositories, saving the docker common image tag and bumping some dependencies in the application source code.
Then this saved tag can serve the docker build of the applications until the next iteration of common. No matter how much any staging environment lags behind, I can use the tag that lives in the application repository branch from which the environment is deployed. This also allows patching against the tag in need of hot-fixes.
Question:
How are you solving this problem? What are the common practices?
P.S. This is not hypothetical. I exceeded the max depth today. Fortunately, someone made docker-squash.
Answer: I ended up using docker-squash.
Install: pip install docker-squash
Example usage, squash up to <LAYER>:
docker-squash -f <LAYER> -t <IMAGE>:squashed <IMAGE>:<TAG>

A case for exceeding docker's max depth


Can I use SCH 40 for buried and above ground feeder wire?

Question: I'm running 2" PVC from my house to a detached garage to run a 60 amp feeder.  Looking at the NEC, it looks like I need to put it in SCH 40 below-ground.  However, it looks like I have to use SCH 80 anywhere the PVC will be above the ground.  Is that correct, or can I get away with using SCH 40 for the whole run?
Comment: The guy who said he installed 2" EMT 24" deep is wrong. EMT is not rated for underground work. This conduit and fittings will corrrode. Sorry for the bad news. Raul Electrician
Comment: When I ran power to my shed about 10 years ago I used EMT. It was about as cheap as PVC and I don't have to worry about anyone accidentally digging and hitting a live wire. I put it down about 2 feet. No problem to date.
Answer:
National Electrical Code 2014
Article 352 - Rigid Polyvinyl Chloride Conduit: Type PVC
II. Installation
352.10 Uses Permitted. The use of PVC conduit shall be permitted in accordance with 352.10(A) through (H).
(F) Exposed. PVC conduit shall be permitted for exposed work. PVC conduit used exposed in areas of physical damage shall be identified for the use.
(G) Underground Installations. For underground installations, homogenous and nonhomogenous PVC shall be permitted for direct burial and underground encased in concrete. See 300.5 and 300.50.
Article 300 - Wiring Methods
I. General Requirements
300.5 Underground Installations.
(D) Protection from Damage. Direct-buried conductors and cables shall be protected from damage in accordance with 300.5(D)(1) through (D)(4).
(4) Enclosure or Raceway Damage. Where the enclosure or raceway is subject to physical damage, the conductors shall be installed in rigid metal conduit, intermediate metal conduit, Schedule 80 PVC conduit, or equivalent.

352.10(F) says that the PVC conduit "used exposed in areas of physical damage shall be identified for the use". I know schedule 80 is suitable for protection from physical damage, however, the Authority having jurisdiction in your area may allow schedule 40 as well. You'll want to check with your local inspector to be sure, or use schedule 80 for the exposed section.
300.5(D)(4) says that even though the conduit is buried, if it's subject to physical damage (not deep enough, under a garden, etc.) it still has to be schedule 80.

UL 651
Schedule 40, 80, Type EB and A Rigid PVC Conduit and Fittings
1.2 Schedule 40 and 80 conduit and fittings
1.2.1 Schedule 40 rigid PVC conduit and fittings are for aboveground use indoors or outdoors exposed to sunlight and weather, and for underground use by direct burial or encasement in concrete. Schedule 40 rigid PVC conduit, elbows, that are specifically marked for underground use are suitable for use underground only by direct burial or encasement in concrete.

The UL listing says both 80 and 40 can be used in both above and underground installations.

Guide Information for Electrical Equipment The White Book 2013
Rigid Nonmetallic PVC Conduit (DZYR)
Use and Installation
Schedule 40 conduit is suitable for underground use by direct burial or
  encasement in concrete. Schedule 40 conduit marked "Directional Boring""(or "Dir. Boring") is suitable for underground directional boring applications.
  Schedule 40 conduit is also suitable for aboveground use indoors or
  outdoors exposed to sunlight and weather where not subject to physical
  damage. Schedule 40 conduit marked "Underground Use Only" is only
  suitable for underground applications.
Schedule 80 conduit has a reduced cross-sectional area available for wiring
  space and is suitable for use wherever Schedule 40 conduit may be
  used. The marking "Schedule 80 PVC" identifies conduit suitable for use
  where exposed to physical damage and for installation on poles in accordance
  with the NEC.

The White Book clearly states that only schedule 80 is suitable for use where exposed to physical damage, though again, says schedule 40 is suitable for aboveground use (unless labeled otherwise). So while you may be able to use schedule 40 for the entire run, you'll have to use schedule 80 through any areas where the AHJ deems the conduit is exposed to physical damage.
Comment: @JoePhillips You can get [free access to NFPA 70](http://www.nfpa.org/codes-and-standards/all-codes-and-standards/list-of-codes-and-standards/detail?code=70), you just have to sign up for account.  It's not mobile friendly, so best to view it on a computer.
Comment: Where are you finding the code to copy and paste? Is that some subscription or something you have to pay for?
Comment: @JoePhillips who says I'm copying and pasting?
Comment: Oh dear. Even better. But seriously, where can a regular like me find the actual code? Do I have to buy a book?
Answer: I asked the local inspector, and he said SCH 40 is fine for both above and below ground. I ended up using 2-2-2-4 Aluminum (marketed as mobile home feeder) to support the 60 amp service.
Answer: I just got off the phone with my electrical inspector (in Tennessee they are state-certified). Sch. 40 PVC is okay underground (18 inches down in a residential yard), but 80 is needed for the section that comes above ground. An exception is if you use the Water-tite continuous flexible conduit because they don't make that in 80.
A UL listing for above ground use (of Sch. 40) doesn't necessarily mean that NEC approves that use. In academic terms, the UL listing is necessary, but not sufficient. NEC has to say okay, too.
Comment: Note that many expansion joints and slip risers are only effectively Schedule 40 in wall thickness, so if you need Sch80 stubups, then you'll have to chase down Sch80 expansion fittings to match (the regular ones will fit just fine, they just won't have the same damage resistance as the rest of the stubup)
Answer: If the NEC accepts schedule 40 at which ever depth under which ever weight or ground type… running schedule 80 pvc is literally throwing your customers money or the job out the window when bidding.
If you plan on digging it up yourself with a bobcat than you already know the depth. If you're worried about future owners of area digging it up, place identification tape 12" above the conduit.
Schedule 40 is pretty strong when below 2' underground. How would it break?
Answer: Not true. NEC is not the end all be all some think it is. Municipalities don't have to accept what the NEC says, in fact the NEC is not even a legally enforceable entity, I don't have to do anything they say unless my local code says so.
Comment: While true, this is a somewhat deceptive statement. Most (all?) localities in the US adopt some version of the NEC. Many adopt it wholesale and verbatim, others make minor or major adjustments (ex: Chicago requires pretty much all residential wiring to be in conduit) to it, but _all_ locals codes are based on the NEC in large part. Where I live, we're still on the 2008 version, but it's still based on NEC.
Comment: What you just said is true of all codes.  None of them come from "legally enforceable entities" (not even sure what that means, really).  NFPA, IRC, IBC, NEC etc are all just standards made by various nonprofits and then adopted as law/ordinance in various jurisdictions.  But just as much to the point the NEC is written by experts in the field who know more than anyone on this forum.  We should all want to meet NEC code even if our local jurisdiction has a lower bar.
Answer: No one can make exceptions or go below the standards of the NEC period. The NEC is the minimum standardized electrical installation code. The local or state ordinance can only make the NEC code stricter with ordinances. For instance the NEC says that 1 inch emt must be strapped within 3 foot from a junction box. The city ordinance may say it has to be strapped within 18 inches of a junction box. The city ordinance can not say it can be strapped within 4 foot of a junction box. No inspector can weaken the NEC code book for it is already minimum standards.
Comment: That is *NOT* true -- while inspectors don't have exception power as you say, an AHJ can choose to not adopt code provisions even if not adopting them would make the as-enforced code *less strict* than the NEC.   (This is a significant bugbear of the NFPA WRT non-adoption of the more recent/aggressive AFCI and GFCI reqs)
Comment: @ThreePhaseEel is exactly right.  Take a common example in the IRC - the requirement that residential homes be built with sprinklers now.  Many states adopt the latest IRC but specifically eliminate this requirement, even though it was added to the IRC quite a few years ago.
Comment: @pbarranis -- it's one of the most irksome examples i know of -- the benefit/cost tradeoff for sprinklers is *extremely* clear to the point where I see them as "the best fire insurance money can buy".  People who harp about water damage don't understand two things: 1) that wetting is far more reversible than burning and 2) that if a working fire gets into the structure (wall and floor cavities) of any house built after oh, the 1970s -- that house is pretty much a gone gosling, even before you add 250GPM hose streams to the mix.


Can I selectively send scores of my general and subject GRE to the university that I am applying to?

Question: I made an account for general GRE and subject GRE. I have a pretty bad score in subject GRE. Few universities are not asking for subject GRE score and it would be better if I don't send them subject GRE score. When I try to send my score to university ETS sends both the scores from my account. Is their any way, I can only one score from the account?
Comment: Cannot you send them an email and ask them to help you with your problem? I have heard that candidates who have sit the exam more than once may choose which score to be sent to the institute they are applying to; but I am not sure.
Answer: GRE offers a ScoreSelect function.

After test day, you can send additional score reports for a fee and select from these options for each report you'd like to send:

Most Recent option — Send your scores from your most recent test administration.
All option — Send your scores from all test administrations in the last five years.
Any option — Send your scores from one OR as many test administrations as you like from the last five years.

You can only send by test date, though, so if you took both tests on the same day, you'll have to send them together. If this is the case, then I don't believe you can get around it.

You will select by specific test dates, so your scores are all from the same testing session.

This applies to both general and subject GREs.

The ScoreSelect option is available for both the GRE® revised General Test and GRE® Subject Tests, and can be used by anyone with reportable scores from the last five years.


MR Segmentation to draw marker over the MR Dicom Images

Question: I am doing R&D over the MR Segmentation to draw marker over the Heart MR Dicom Images. My Question is that how I can draw a such marker over the dicom image that show in attach/link image. that Region of Interesr ROI read from the tag or its part of Pixel Processing.
Comment: Just to clarify. From your DICOM images,which are probably from a research paper,it is difficult to tell whether the ROI was read from a DICOM tag or found via Pixel Processing. Access to the image and its metadata would help us to better answer your question.
Comment: What is exactly your problem please? Is it 1) how to draw inside the image (cf. beginning of your question) or 2) how to detect interesting parts in the MR image (as the end of your question seems to imply)? You need to be more explicit with your need to get useful help.
Comment: 1) how to draw inside the image
2) how to detect interesting parts in the MR image
these are the question i ask @begining
Answer: Typically research papers handling DICOM standard images would probably extract the ROI using pixel processing methods. However, a lot of medical imaging companies like to implement their own DICOM tags(public/private) to keep track of such information for various purposes.
For example, General Electric keeps the following tag enabled on most MR images:
VerticesOfTheRegion found at (0028,9503), which is according to the DICOM standard, a private tag(odd location tags are private)
In short: Its implausible to tell you,how was the ROI extracted without having access to the DICOM metadata of the image in question.
Answer: Assuming that you have computed the contour in the first place
(through some manual or image processing method), and want to
save it in DICOM and restore it for display, you have several
options:

in a DICOM Structured Report (SR) as 2D image-relative
coordinates in an SCOORD content item with an IMAGE reference
in a DICOM Presentation State (GSPS) as 2D image-relative
coordinates in a Graphic Annotation, or as a bitmapped overlay
in a new image that contains a copy of the pixel data plus
a bitmapped overlay (e.g., in (60xx,3000))

The SR approach is the most robust, and is what a commercial
ultrasound echocardiography product might produce, for
ventricular measurements, and also allows you to include
the computed numeric values (like stroke volume, etc.)
The GSPS Graphic Annotation approach is more widely supported
for display.
The overlay approach is ugly, poorly supported, and best avoided.
If I were building a product that did this, I would probably
do all of the above, to maximize the probability that a
recipient could handle one of the possibilities, as well as
make a "pretty picture" in a secondary capture file with
the outlines "burned in".


Insulating Ceiling After Skylight Removal

Question: I'm removing 3 skylights from a vaulted ceiling. I'm tired of the leak anxiety and the heat that pours in when it's hot out. I'm hiring someone to do the roof but I'd like to finish off the interior on my own. I'm thinking to remove the wood trim, put in two layers of 2" XPS rigid foam as snug as I can, seal with canned foam and then sheetrock/mud/paint. I'm most concerned about doing something wrong with the insulation. Any tips/suggestions? Here are the skylights that will be removed:
Comment: Sky lights add value to your home.

Bright rooms add value to your home.

To control the light and heat, install shades.

To close the hole is more elaborate the stuffing foam in it.

To control the leak anxiety have roofing guy inspect it every 2 or 3 Years.
Comment: Also all that foam will be a firework when it lights off, and the fumes will knock you out and leave you unable to escape.   Foam is n.a.s.t.y.  https://www.youtube.com/watch?v=CdItsso3ur0
Comment: Once again, knowing where in the world this is would be a help. But assuming they're only a problem in Summer, what's wrong with cutting a slab of rigid foam (maybe 100mm) to fit into the space when it gets too hot? Darned sight quicker, easier, cheaper, and when someone changes their mind, easy to undo!
Comment: and then one day the drywall insert will fell on your head since it is not screwed in.
Comment: I agree with Ruskes & Kyle.  Skylights are generally considered an amenity, for the reasons they mentioned.  Maybe you need to look at upgrading the glass that's in the skylight.
Answer: Yes, it is fine to do what you are planning.
Make sure you add wood framing so that your open space span is no more than 24" on center and use 5/8" drywall (always on 24" span framing- 1/2" drywall will sag with 24" on center framing).
Your rigid insulation is OK but stuffing with batt insulation would also be fine. Put as much insulation as you can in there whether rigid foam or batt. I do not think you need the spray foam at all.
Skylights are nice- until there is a problem. I say if you don't want them anymore then get rid of them.
Comment: Packing as much batt insulation as you can defeats the purpose of batt insulation. The efficacy of batt insulation is severely degraded if its compressed.
Comment: @stevieb - That's only partially true.  Compressed fiberglass batts have the same R-value (actually,it's a bit better) per inch as when it's not compressed. 6" batts are typically R-19, so an R value of 3.2 per inch.  If you compress that batt to 4", you still have 3.2 per inch (or better), but your total R value is 4*3.2=12.8.  It's more important that the cavity be completely filled, even if the insulation is compressed.


What is the default sorting for customer reviews on e-commerce website?

Question: What should be default sorting for customer reviews on e-commerce website?

newest
oldest
most helpful
rating (High to Low)
rating (Low to Hign)
???

download bmml source – Wireframes created with Balsamiq Mockups
Answer: It depends.
For something that's time sensitive, displaying newest reviews first is good.
e.g. Restaurant reviews
The food at a restaurant may be very good several years ago, but they may change their menu, staff may change that makes older reviews less relevant.

For something that typically don't change over time, displaying "most helpful" reviews is good.
e.g. Book reviews
The content of a book doesn't change. A review that other customers marked as helpful will probably be relevant regardless of when the review was written.
Answer: Obviously you want the most interesting reviews first. If time matters for the subject, sorting by date makes the most sense, if not, sorting by date will still be the safest option. If you have other options, be sure how useful they are for sorting.
Sorting by rating can be misleading if there are no or just a few ratings. The first item is in this case expected to be the most valuable but is in fact the only rated item (or maybe randomly sorted on top or by date). If you do sort by rating, make sure rating items is used a lot.
Another way to sort is by the length of the review. This more of a fall back option, and it needs a bit of experimenting. But longer reviews tend to be more informative:

"Don't buy this!"

is less helpful than:

"I can't recommend this because of (a) ... and (b) ...".

Obviously you can't communicate to the user that longer reviews are placed on top, let alone make it a sort option which they can choose, but it's an idea to keep in mind if the main priority is to have the better reviews on top.


Is there a circuit breaker that trips when there is a loss of power?

Question: Is there such an animal that would trip a circuit breaker when there is a loss of input power?  Similarly with the relay system which energized to close the main contact to apply main/grid power to the service panel, but when there is a loss of grid power = loss power to the relay which disengage the main contacts which isolate the grid to the service panel.  I am wondering if there is such a compact plug and play device to do that.
Comment: Where are you on this planet, and why do you want this device?
Comment: I don't know of a device that would trip a breaker because breakers aren't meant to operate like switches.  There are relay devices that would/could open a circuit after a power loss and have to manually be reset to restore the power.... think of a motor starter with a momentary "on" button.
Comment: I still think a relay or starter is a better way to go, I find the cheap addons to molded breakers don't last or the ones I have used are definitely not up to commercial grade and the cost is more than a mag. without the overload unit the Fuji solution would be much better in my opinion.
Comment: There are remote trip and reset units but these are usually found on commercial breakers not molded case, an easier way to accomplish this is with a relay. once pulled in it can keep the circuit active but if the power drops out it opens and has to be reset to energize the line and the breaker is left alone.
Comment: @EdBeal you know Eaton has remote trip/reset breakers in its CL and BR lines ( and possibly CH and CHQ), right?
Comment: Many thanks to All for your candid answers, and as I suspect that this elusive animal which can't be tamed.  May resort to the original scheme of a relay system and I will keep on searching... again thanks.
Answer: A magnetic starter switch or magnetic contactor can do what you want.  Most are designed for fairly heavy loads (8A and up), and they are not consumer-style plug-in devices but rather bulky boxes intended for permanent wiring.  There are circuit breakers with this feature that you can mount in a panel (hopefully you have a panel type that one of these can fit).  The on/off buttons are provided on the breaker itself and/or via a separate switch connected with its own wiring and mounted near the load (usually a machine of some sort).
The Fuji SC-03 is one example of such a circuit breaker:
https://www.fujielectric.com/products/mc/mc_ms_tr_sc_neos.html
Comment: I should have read further before posting a comment, a starter is a heavy duty relay and could use an auxiliary relay to maintain  power to the coil keeping the contacts pulled in unless there was a power loss then it would open until reset.+ there are many sizes sc02 , a source for these available to the public is automation direct I use them for these exact parts.
Answer: In answer to your original question, Yes there are breakers and devices that trip out breakers when the is a loss of prime power. Usually they are found in larger industrial sites where large motors create voltages at loss of power or there are parallel and redundant systems. They are not compact and they usually cost more than a Homeowner DIY is willing to pay.
Example see @John Zwinck go ahead and price his Fuji SC-03 and an Enclosure it would go in. I was thinking more along the line of Bassler's relay protection or a Smart Breaker depending on use.
What would be the residential need for such a device?
Comment: Table saw comes to mind.
Comment: Many (not all) table saws have their own contactors so they won't restart until start button is pushed.
Answer: From your description, you seem to want a device that cuts the connection after power loss (and, perhaps, low voltage), to prevent something from restarting when power comes back on.
A simple DPST (or DPDT) relay, of the voltage and current required, could be used. Put the relay coil in series with one set of normally open (NO) contacts, and across the mains. Put a momentary contact NO switch across the relay contacts.
The other set of relay contacts control the load.
When the switch is pressed, the relay will pull in, and stay in, until the mains voltage drops below the holding point. It will then stay off until the switch is pressed.
Answer: Smart switches have various behaviors on power cycle. I am pretty sure that some will allow setting a status on "power restored", though it may take some digging to figure that out - fortunately manuals are generally available online before buying. But if you go that route, you have to be careful about what you are connecting. Limitations may include:

Total power (actually, every switch has that limit, but it is generally far below the 15A or 20A capacity of a circuit breaker)
LED/CFL/Incandescent compatibility
Motor compatibility
Neutral vs. ground vs. leakage current for getting power, which may affect compatibility with various devices


How do I build a UPS-like - battery backup - system?

Question: As we all know, the Raspberry Pi doesn't really use that much power (5v + 700mA is the spec).
I'd like to build a battery backup for power outages in a DIY-ish fashion. I don't need surge protection or any other fancy options, just security from minor power outages and brownouts.
How can I put a battery backup between the Raspberry Pi and the phone charger I'm using to run it?
Comment: How long is a minor power outage?
Comment: @MathiasKunter I tried that but had a hard time finding a USB power bank that could be charged while it is charging a device.
Comment: @AlexChamberlain, LiPo complicates things as they do not tolerate trickle charging. NiMH or lead acid make life a lot easier in this case. I think http://electronics.stackexchange.com is a better place to ask this question
Comment: It's actually possible to use a USB power bank as UPS. My Pi is continuously running for about half a year now this way. I've summarized the details at http://raspi-ups.appspot.com
Comment: ok so what do you think about this: http://www.ebay.com/itm/Sony-CP-ELS-USB-Portable-Battery-Back-Up-Charger-USB-5V-1A-Li-ion-2000mAh-/171044510273?pt=Battery_Chargers&hash=item27d30c1a41 or that: http://www.amazon.com/9000mAh-Capacity-Portable-Rechargeable-Camcorder/dp/B0057LZA4I to keep it connected to charger and raspberry continously
Comment: I think this is best implemented as a LiPo expansion board.
Comment: I would define a minor power outage as a few seconds of complete lack of power, enough to make a normal desktop computer reboot.
Comment: Could you power the board in parallel with a big capacitor?
Comment: Check www.wugrobot.com/products/pion/, it should help.
Comment: FWIW, here's a link to a very similar project that someone did: ["Single SuperCapacitor UPS for Raspberry Pi"](https://hackaday.io/project/25107-single-supercapacitor-ups-for-raspberry-pi)
*"A last gasp Uninterruptible Power Supply for any Raspberry Pi computer."*
Answer: You question is more suited for the Electrical Design Stackexchenge site - Because you can always rely on the Gurus there, like Oli, to help design easy, up to date circuits.
I think that this question will be asked by many more Raspberrians to come so this is actually a very good place to answer your question.
My answer will go more into engineering your own circuit so that you can have full control of what you want it to do.
The circuit should handle...

Initially deciding what kind of circuit you need. Powered by USB 5V? or maybe by a 12 volt source? You can also power it from a lower power source like 3.3V/1.5V but is very inefficient in converting power. This decision also fundamentally contributes to what kind of voltage regulator you are going to use... if any.
Keeping the battery charged up during normal operation (also each type of battery requires have charging characteristics, Lead Acid, Ni-Cd, Li-Ion, etc)
The circuit needs to sense when primary power (USB +5V) stops providing power or similar.
The backup circuit to charge your type of battery and an embedded circuit to possibly route power back into the main circuit when the main power is off.
Optional. Build a trigger into the circuit that connects to the Raspberry PI's I/O system to send you and email,text message, make a phone call, trigger an alarm or turn of your kitchen lights.

Searching around the internet most UPS circuits and schatics will include a transformer to reduce 110V/220V down to DC 12 Volts.

Here is a very simple circuit used with Lead-Acid batteries (They are easy to charge and they keep charge for a very long time) Do not attempt to charge any other kind of battery with circuit... they will blow it up!

Part List:

R1 - 39 ohms 1/2W
D1, D3, D4 - 1N4001 or similar diode
D2 - 13V zener rated 1W
C1 - 220uF electrolytic capacitor rated 25V
C2 - 10uF electrolytic capacitor rated 10V
IC - 7805 or similar 5V regulator
BAT - 12V lead acid battery rated 1.2Ah minimum
DC Input - 12 Volt DC

I found this circuit while rummaging through the internet. This guy pretty much rips apart a notebook and recycles a few parts to make a decent system - Just remember to regulate the output voltage to 5V

Final circuit - one of the easiest and most probably the one that many people would prefer to use is a USB charged UPS circuit using some small lithium batteries.   This was answered at Engineering SE, please refer to the answer for details.

Do not feel like building your own circuits? There is this MUPS available for purchase (gone, sorry) that does pretty much what the final circuit design outlines.

References

You can find a lot more circuits on this website
-- WebArchive https://web.archive.org/web/20161028081245/http://www.simple-electronics.com/2012/02/5v-ups-circuit.html (please donate)
Using search engines will also find a lot of other interesting facts and solutions
Visit Electrical Engineering Stack if you have any circuit design questions.
Comment: I don't see why this circuit wouldn't recharge the battery.  Also, if you replaced the regulator with a LM2940CT-5.0 (5V low drop-out regulator) you could use a 6V lead acid gel battery instead, which would result in much less heat generated by the regulator since it's only dissipating up to 1.6W of energy (2.2V * 700mA) rather than 5.9W (8.4V * 700mA).

Of course I'd recommend a 7.2-7.5V regulated supply for your input, so you can safely "float-charge" the battery (7.5Vs of the supply - 0.7Vf drop of D1 = 6.8V at the positive terminal of the battery).
Comment: Nice comment. I think it will recharge it but only a lead acid battery as commented, NOT lithium ion! be very carful it could blow the battery up. This circuit needs revising for lithium ion.
Comment: Excellent point -- the above circuit should *ONLY* be used for a lead-acid battery!  A Li-Ion battery could be very seriously damaged or catch fire in a circuit like this, and even NiCd or NiMH batteries may not be safe in this circuit.  For such batteries you'd need a more robust charging circuit.
Comment: It seems like something that could be rally beneficial out there not just for Rpi... :)
Comment: Yes, I'm actually designing a similar circuit for an emergency LED lighting system for my home (we live in SE Massachusetts, and are occasionally subject to hurricanes, blizzards, and other storms that induce extended power outages)!  The difference is my circuit is designed so the lights don't come on *unless* the power's out.  They also have an override "off" switch so you don't waste the batteries during the day or while you're not home.
Comment: thge circuitry need some extra things in there- ni-cd and li-ion batteries are very fragile to over charging and there needs to be a way to use the batteries power when the mains fails.. so some kind of sensing circuit.. i added another schematic that might nail it on the head with a few tweaks
Comment: This answer is great factually, but really needs cleaning up.
Comment: Your MUPS link is now broken.
Comment: Sorry.. its been 6 years.. wow. They don't sell it any more. also the simple electronics is down.. added webarchive link.
Comment: As an alternative to the 7805 shown there (and its supporting capacitors), you could use a much more efficient buck converter board, they can be had very cheaply on eBay now... can put out 5V at several amps (more than enough for the Pi and anything plugged into it) without breaking a sweat, as opposed to the linear regulator that will double as a space heater trying to dissipate 10-25 watts of heat from dropping 12V->5V or let the smoke out in spectacular fashion if not adequately heatsinked.
Comment: FYI Marcellus' answer below is a simple buck converter circuit if you're more inclined to build your own rather than buy a prebuilt buck converter board.
Answer: I have built a converter from 12v to 5v
That's enough for RaspberryPi's 5v requirement. IT also gives power for fan with adjustable thermostat (12v) and even active usb hub (in the future). Everything (Raspberry Pi, converter and thermostat) is enclosed in a router-box (I even have space for an additional 2.5" hdd, 3G modem and/or GPS unit ;) )
Such a converter can convert power from a battery pack (for example from 5 or more AA batteries) and SAFELY give 5V for Raspberry (watch out for voltage!). The converter is pretty small (i think 3 x 10 x 1.5cm). But if you are good at soldering and building circuit boards you can do it smaller.
This is the converter I use with a sample schematic.

It works great, you can attach from 7 to 40V from batteries. And we got max 3 amps on 5v side.
If you need to switch between phone charger and battery pack, you must build a switch (when power from charger goes down, the battery-pack power is connected and vice versa). I think that's pretty simple (transistor, capacitor... just few elements). Or do it manually ;)
Comment: Hello- Thank you for you input it is really appreciated! As a new user please quickly read the site rules found under "faq" and "about" at the top. You do not have to apologise or thank in answers. You can always edit your answer later. You can easily upload pictures while editing to. Please do not worry about your language or spelling. Somebody  will always be happy to edit and fix it up for you. Welcome to RaspberryPI SE!
Comment: That is fantastic mod! I am sure it could be used in the suggested circuit from Engineering forum are just as it...   :-) I love it!
Comment: You can get modules based on the LM2596 on ebay for $2 shipped. There are also modules based on LM2576, but they are more expensive
Answer: I found the question very interesting but my self am not really interested in soldering and fiddling with resistors and stuff and I am sure other people might stumble upon the OP question with hope of a ready product.
So I did find this which for my needs would actually be great. Buy, wait a few days, plug in and viola.

I found it on DX.COM
As pointed out in comments. It seems like there could be an issue with high power consumption.. so end of day it looks like it will have to be opened and messed about with. But it is suitable for the Model A.
Comment: Only problem is, the user was looking to do something "in a DIY-ish fashion"... this is about as far from DIY as it gets ;)
Comment: But what if I can't viola (I don't own one)?
Comment: Does it have a battery inside? Looks something like we are talking about yea.. thanks.
Comment: The current rating is a bit lower than the RPi, but perhaps it can be modified. I have been running the RPi from a USB port on my laptop with no problems so far anyway :)
Comment: Currently your answer does not explain how it answers the question. Please add an explanation or I will be forced to delete it. Thank you for your cooperation!
Comment: It would work as a low power usp as it can sit on charge and you can run the RPi off the 3500mAh battery at 500mA at 5.3V but really one with a USB output: DC 5V, 700mA would be better.
Comment: There are other devices such as this one which will output 5V at 1A.  http://www.dealextreme.com/p/2-x-18650-powered-backup-battery-case-w-1-led-usb-port-for-cell-phone-more-white-129750?item=4
Comment: The problem with regular battery packs is that the output voltage dips enough to reboot the raspberry each time the powerpack input is connected or disconnected.
Answer: Any external USB battery pack with built in overcharging protection will help your Pi survive power outage. It will simply work as a poor man UPS for your Pi.
http://www.google.com/search?ie=UTF-8&oe=utf-8&q=usb+battery+pack
Comment: We must simply find a USB external battery that will stand being continuously connected to the input supply.  Surprisingly enough, many battery systems, specially lowest quality ones, will not stop charging the battery, which heats the battery and shortens its life.
Comment: @RaúlSalinas-Monteagudo Check out emkey08's comment to the question. He provides a link to a page where he mentions a usb UPS which seems to be what you (and I) want. Just ordered it =)
Comment: The problem with regular battery packs is that the output voltage dips enough to reboot the raspberry each time the powerpack input is connected or disconnected.
Comment: exactly what I first thought...
Answer: Here is a UPS for the Raspberry PI:
http://www.eevblog.com/forum/projects/raspberry-pi-server-with-diy-ups/
Also, with sufficient changes and safety circuits, lithium rechargeable cells can be float charged. In this case it is best to use a single cell and a boost converter so that balancing circuits are not required. Here is some info on float charging lithium cells:
http://www.electronicsweekly.com/Articles/01/02/2006/37528/Float-charging-lithium-ion-cells.htm
Answer: So you want a SIMPLE reliable DIY ups like powersupply for your RPi:

get a sealed 12v Pb battery ( I use a 5Ah battery)
get a 220Vac to 12v switched mode power supply (I use 12v 4A )
get a car lighter to usb plug (8v--24v input, out = 5v 2A) switched
mode
get a diode which can handle 4A and a 0.5 ohm 5 watt resistor to
limit the current by empty battery recharging
get a usb to universal cellphone charge cable it has 10 different
plugs with short  cables, 1 goes to power the RPi,an other one for
the usb hub , an other for whatever jumps in mind.....still many
left

Wire it as follows:

from the +12v of the power supply to the anode of the diode
from the cathode of the diode to the 5Ah Pb sealed battery, this
protects against the power supply  draining the battery when no 220v
Then from the + of the battery to the "lighter plug to usb " +5v 2A

, plug in the usb cable
I was liking to put a picture of all parts needed, but i'm not allowed by this website until received 10 points... when this will happen, then i will post the picture
Results of running the RPi(running ssh,wospi,lighttpd) + Davis VPro2+ console (console added 300mA) + usb hub : after 20 hours on the battery , the battery voltage was dropped from 13.08v to 11.77v ! considering 10v as empty this means enough juice for at least 32 hours on a 5Ah battery
total costs 30 usd, everything brand new
Comment: user7165, 11.7 V o/c is usually considered full discharge for a 12 V lead-acid. Discharging to 10 V will do it no good at all.
Comment: Simple and effective. Very nice +1 but just to add, those converters are very inefficient draining more battery than it should.
Answer: Here is a supercapacitor based UPS solution for brown-outs and safe shutdowns.
The main difference to other UPS-like circuits is that there is no need to use batteries. This helps to avoid a lot of problems, like recycling the batteries after end of life, the energy is stored in the supercaps which are soldered to the PCB. Why not, when the lifetime of the supercaps is equal to the lifetime of the whole circuit board? You don't have to care about overcharcharging and all the temperature issues, like charging only at temperatures above zero. Supercaps hav no memory effect. They don't need  discharge and charge cycles to keep them healthy.
On the other side: supercaps don't have the energy density of batteries, but the circuit should only backup short-term power failures or brown-outs. You really don't need a battery with 2000mAh capacity to backup 1A for a few seconds. Let us evaluate: 700mA for 30 seconds is 5.9mAh capacity you need at 5V. Have you ever seen a battery with this little capacity? Even if it would exist, you would never be able to draw 700mA out of such a small battery. In other words: battery based UPS for short time backup times ALWAYS use batteries with extremly oversized capacity. A supercapacitor is able to source a current of a few Amps even at very small capacities. I think therefore are batteries not the optimal energy storage device in this case.
One thing is bit complicated using supercapacitors: The voltage at the supercapacitor depends on the state of charge, so the need of a step-up/step-down converter makes the use a bit complicated if you think about DYI.
Comment: Welcome to Raspberry Pi! Whilst this may theoretically answer the question, [it would be preferable](http://meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.
Answer: The LiPo Rider Pro was meant for solar applications, but the USB port can also charge the battery, so you don't really need a panel.  Coupled with a larger LiPo battery, it should keep the Raspberry Pi alive for a number of hours.
Comment: Yes I can confirm a lipo rider pro board from seeedstudio works like a charm. It has usb in + batter + solar charge if so desired. Single usb out. Basically takes main in if available, otherwise battery. All for under 20 dollars including battery. The only downside is its only 1amp out so if you have some usb devices drawing power, it may not supply enough.
Answer: I'm kinda cross-posting this to all the UPS questions on this Stack Exchange because I was looking for something similar, and could never find any answers I liked, so I ended up researching it myself. You can use a standard, off-the-shelf UPS, and the Network UPS Tools (NUT) package to allow a Pi to shut itself down when the power goes out. I have just posted an article I wrote with step-by-step instructions for setting it up:
https://melgrubb.wordpress.com/2014/09/05/raspberry-pi-home-server-part-15power-failures/
Of course, if what you were really after was a DIY hardware project, then I'm afraid this doesn't involve any soldering.
Comment: Also running a RPI with a regular UPS is kinda like attaching a 5000 gallon tank in your Miata, when all you wanted was a Jerry can of extra gas for emergencies.
Answer: You can try one of these, and use battery instead of super capacitor.
Comment: According to Maxim's [data-sheet](https://datasheets.maximintegrated.com/en/ds/MAX690-MAX695.pdf) the "690" is only capable of sourcing 50mA from Vout and it does not have a BATT_ON output that could be used to operate an external semiconductor switch (MOSFet ?).  There are other ICs in the same product range that might be better suited to this role.
Answer: As others have stated, a USB power bank is an easy and fairly cheap solution. Be sure to get one which supports charging and discharging at the same time (which, unfortunately, isn't usually indicated—you will have to figure that out).
The Pi typically draws anywhere between ~200 to north of 500 mA; for later models the maximum is 2000 mA. So a 6000 mAh power bank will give you anything from 3 hours to a day's worth of battery power; make sure you get a power bank with sufficient capacity.
Plug your Pi into the output of your power bank and the charger into its input. If the power goes out, your Pi will keep on running until power is restored or the battery runs out.
Limitations are that the Pi has no way of knowing whether it's running on AC or battery power, or how much battery power is left. Consequently, if the battery runs out before power is restored, the shutdown will be an unclean one.
A more advanced solution, also involving a power bank, is described at https://raspi-ups.appspot.com/en/index.jsp. It includes a daemon which uses the Ethernet connection to determine if it is running on AC—if the Ethernet connection drops, it assumes it is running on battery power. It measures the power consumption of the Pi and estimates the charge level of the battery based on consumption and total capacity (which needs to be configured beforehand). When power runs out, it shuts down the Pi cleanly.
As a variation of the above, if you have some USB peripheral hooked up to the Pi that runs on AC power, you could modify the daemon to use that as a power indicator.


transaction in any payment gateway on admin approval

Question: I want a feature like. If anyone wants to become feature on my website than he fills a form and pays the money. Now it will not be visible until admin approves it. So i want to do it like the money should be deducted only when the admin approves it. So is there such kind of facility in any payment gateway to do such delayed transaction. or any other way in which i can do this... Is it good to store the card holder information in md5 and later doing the transaction when admin approves it?
Answer: You can't store a credit card number using MD5. MD5 is one way hash. That means once you hash it you cannot get the original value back. You would need to use an encryption algorithm if you wanted to have the encrypted value unencrypted at any point in the future.
And if you store credit card information you will be subject to PCI compliance. PCI compliance is not easy to do.
If you're looking to store credit card information to charge a customer at a future date you can use a service like Authorize.Net's Customer Information Manager (CIM). CIM allows you to store credit card information on Authorize.Net's server so you don't have to worry about PCI compliance. Then you can charge users at a future date safely and securely.
Answer: PayPal preapproved payments (card details stored with PayPal. Buyer gives approval to you to bill them up to a certain ceiling, you use this approval 'ID' to bill the buyer) and/or reference transactions would work in this case.
I'd very strongly advise against storing card details on your end; it'll cause more headaches than it's worth. Bigger companies have tried, and failed.


Quantum mechanics + General relativity =?

Question: I have learned (the basics) of how one can incorporate the principles of special relativity to quantum mechanics to obtain quantum field theory. Can the same be done with GR and QM to obtain a new theory? If not, what happends if one tries, what exactly goes wrong? Is there a mathematical inconsistency in any theory that combines them, such that either current GR or QM must be modified, or is it just that we dont know how to yet?
Answer: General Relativity + Quantum Mechanics = String theory.
The things that go wrong in a non string approach;

the path-integral over metrics has a bad direction, so that the Euclidean continuation is suspect. You need a Euclidean continuation to define a quantum field theory in a mathematically sound way.
You can't sum over high dimensional topologies without a cutoff on the allowed curvature, and to sum each topology once and only once cannot be done, because the classification of 4d topologies solves the halting problem. This means that any sum over 4d topologies is really an infinite process which defines a hyper-computation. If you needed to do this to define quantum gravity, this would be the end of physics, if "physics" means making computer programs to model reality.
Nearly all gravity theories (all but the maximal supergravity in 4d) are perturbatively non-renormalizable. This wouldn't be so terrible, except that quantum gravity has no sound gauge invariant cutoff, you can't kill high frequency modes in any simple way, because the frequency is defined by the metric, which you are summing over.
Quantum gravity path integrals naively require more degrees of freedom than the principles of black hole evaporation allow. In a path integral in a black hole background, there are infinitely many very very short-wavelength modes very close to the horizon whose energy is low because of time-dilation. These modes give black holes a divergent surface entropy, as noted by 'tHooft. You need to kill this divergence to reproduce the Bekenstein Hawking entropy, and this requires a special sort of nonlocality.

All these problems might be surmounted, but this requires a new idea, like loops. In 2d and 3d gravity, the same problems occur, but they are resolved completely by the topological nature of gravity. Loops give an interesting idea for 4d, but it is incomplete.
The way to solve all four problem at once is to move to an S-matrix theory for gravity. This idea, originally proposed by Heisenberg, but best attributed to Geoffrey Chew and Stanley Mandelstam, means that you define the theory asymptotically in terms of scattering states, not in terms of microscopic fields. This works to produce string theory.
Comment: interesting bit about classification of 4d topologies being non-computable, however i would hope that by itself does not preclude approximation schemes that would allow to give bounds on the errors after summing a given finite number of topologies
Answer: Well, some people might say that string theory is the answer. If one takes the usual framework of quantum field theory (say, the standard model), we run into trouble if we want to add gravity. I think one can prove that it doesn't work (it's not renormalizable), and it's not just that we don't know how to do it. But finding the right theory that includes quantum mechancis and gravity is one of the big open problems in physics.
Someone more knowledgeable on the subject can surely point out exactly what the difficulties are.
Comment: http://physics.stackexchange.com/questions/387/a-list-of-inconveniences-between-quantum-mechanics-and-relativity


Riddle of J Krishnamurti

Question: What was the philosophy(if we can use that word) of J Krishnamurti. He sounds very abstract nor did he gave any examples just string of complex words with implicit meaning. Can you explain me his philosophy?
Answer: Krishnamurti was not a philosopher of the western type. He was an Indian mystic ( not in the traditional look and feel ) who uses a western taste language to make us think and contemplate about the important things of life.
Many of his writings and YouTube videos can be easily found on the Internet.
Comment: Sure sir, but how a student of philosophy understands what krishnamurti offered.

Riddle of J Krishnamurti


What if Guru's order is contrary to scriptures should it still be followed?

Question: Namaste,
Can a student obey a Guru's order if Guru orders something which is against scriptures?
Please provide scriptural proof in this regard..
Comment: Follow your guru, if you don't feel satisfied then leave. But don't get struck between guru and scripture.
Comment: A shishya must stick to his gurus words unwaveringly. But this holds true only till upasana krama. If some padhati is different in some Aagam shastra and ur guru is teaching differently follow ur Guru's words. That's Kula dharma. Apart from that, if Guru is faulty and asking to do paapkarma just move away, until the words accords to Shastras. As a personal experience had been in touch earlier with a guru who said to enjoy sensual pleasures as much as one want. This contradicts to Shastras and therefore found futher loopholes in them. So, here it requires Shishya's self analysis on his Guru.
Comment: If your Guru is really jeevanmukta and u have realized that, and has always abided to scriptures but this is the 1st call when he said to do something differently, do that. Since, sometime Gurus choose very different path to teach shishyas based on our nature. So, what here is important is **guru's conduct**, if Srì Guru is pristine and really bhagwatprapt, these things of shastras don't contradict, since any words from such Jeevanmukta is Shastra itself.
Answer: If you think your Guru is wrong then leave him.
Freedom to change Guru

But should you have a Guru who does not have the knowledge and always
create doubt, no blemish attaches to you if you go to another.

Kularnava Tantra, Guru-Shishya, Readings by M.P. Pandit
Answer: Guru's orders or teachings that are contrary to scriptures or contrary to dharma, need not be followed.
An example is from Srimad Bhagavatam 7.5, where Prahalada does not approve of the teachings of his gurus.

As is reported, the glorious Kāvya (Śukra) was selected by demons to fill the office of the royal priest. His two sons, Śaṇḍa and Amarka, stayed near the palace of the king of Daityas (Hiranyakasipu).

They taught the course of studies (in politics and such other sciences) to Prahlāda and other eligible Asura students sent to them by the king, even though Prahlāda was expert in philosophy.

Whatever was taught there by the teacher, he (carefully) listened and reproduced it. But he did not approve of the teaching that was on the false notion of distinguishing between (man and man) as friends and enemies.

Another description of this account is given here -

Prahlāda Mahārāja did not carry out the orders of his teachers, for he was always engaged in worshiping Lord Viṣṇu. As described in this chapter, Hiraṇyakaśipu tried to kill Prahlāda Mahārāja, even by having a snake bite him and by putting him under the feet of elephants, yet he was unsuccessful.

Hiraṇyakaśipu's spiritual master, Śukrācārya, had two sons named Ṣaṇḍa and Amarka, to whom Prahlāda Mahārāja was entrusted for education. Although the teachers tried to educate the boy Prahlāda in politics, economics and other material activities, he did not care for their instructions. Instead, he continued to be a pure devotee. Prahlāda Mahārāja never liked the idea of discriminating between one's friends and enemies. Because he was spiritually inclined, he was equal toward everyone.

.......Hiraṇyakaśipu affectionately took his son Prahlāda on his lap and then inquired from him what the best thing was that he had learned from his teachers. As usual, Prahlāda Mahārāja began praising the nine processes of devotional service, such as śravaṇam and kīrtanam. Thus the King of the demons, Hiraṇyakaśipu, being extremely angry, chastised the teachers, Ṣaṇḍa and Amarka, for having wrongly trained Prahlāda Mahārāja. The so-called teachers informed the King that Prahlāda Mahārāja was automatically a devotee and did not listen to their instructions.


Windows XP: Add site directory to Apache config

Question: I have a local instance of Apache on my computer for development purposes, I'm trying to add a site directory, to Apache's httpconf file, that contains some sample web applications I'm trying to debug using Eclipse.  The directory I'm trying to add is as follows:
C:\Eclipse_Workspace\dummyWeb
After adding the path, I restarted Apache and tried to enter a URL as :
http://localhost/Eclipse_Workspace/dummyWeb/enterGreeting.php

But I get the 404 error page.  I'm not sure what I have to do to to get the page to open properly.  I'm new to Apache server configuration and am using ApacheConf Lite as a GUI-based server settings editor.  The new directory I added in the httpconf file looks like this:
<Directory "C:\Eclipse_Workspace\dummyWeb">
  Options All
  Allow from All
  Order Allow,Deny
  AllowOverride None
</Directory>

I also tried making the last slash a forward slash like the default root directory:
<Directory "C:\Eclipse_Workspace/dummyWeb">
  Options All
  Allow from All
  Order Allow,Deny
  AllowOverride None
</Directory>

Compared to the default root:
<Directory "C:\Program Files\Zend\Apache2/htdocs">
  #
  # Possible values for the Options directive are "None", "All",
  # or any combination of:
  # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
  #
  # Note that "MultiViews" must be named *explicitly* --- "Options All"
  # doesn't give it to you.
  #
  # The Options directive is both complicated and important.  Please see
  # http://httpd.apache.org/docs/2.2/mod/core.html#options
  # for more information.
  Options FollowSymLinks Indexes
  #
  # AllowOverride controls what directives may be placed in .htaccess files.
  # It can be "All", "None", or any combination of the keywords:
  # Options FileInfo AuthConfig Limit
  Allow from all
  #
  # Controls who can get stuff from this server.
  Order allow,deny
  AllowOverride None
  #
  # Note that from this point forward you must specifically allow
  # particular features to be enabled - so if something's not working as
  # you might expect, make sure that you have specifically enabled it
  # below.
  #
  #
  # This should be changed to whatever you set DocumentRoot to.
</Directory>

But I still get 404, what am I missing?  Any help is appreciated.
Some other details, I'm using the Zend Server Community Edition for PHP web development and Eclipse with PDT. My goal is to be able to debug PHP web applications through Eclipse.
UPDATE:
Looks like adding an alias might be what I'm looking for.  Not sure how they work though, currently reading through Apache documentation.
UPDATE 2:
Bingo!  Looks like adding an alias did the trick.  The relevant lines of configuration are as follows:
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
DocumentRoot "C:\Program Files\Zend\Apache2/htdocs"

.

.

.

.

<IfModule alias_module>
  #
  # Redirect: Allows you to tell clients about documents that used to
  # exist in your server's namespace, but do not anymore. The client
  # will make a new request for the document at its new location.
  # Example:
  # Redirect permanent /foo http://www.example.com/bar
  #
  # Alias: Maps web paths into filesystem paths and is used to
  # access content that does not live under the DocumentRoot.
  # Example:
  Alias /webpath "C:/Eclipse_Workspace/dummyWeb/"
  <Directory "C:/Eclipse_Workspace/dummyWeb/">
  Options Indexes FollowSymLinks MultiViews ExecCGI
  AllowOverride All
  Order allow,deny
  Allow from all
  </Directory>
  #
  # If you include a trailing / on /webpath then the server will
  # require it to be present in the URL.  You will also likely
  # need to provide a <Directory> section to allow access to
  # the filesystem path.
  #
  # ScriptAlias: This controls which directories contain server scripts.
  # ScriptAliases are essentially the same as Aliases, except that
  # documents in the target directory are treated as applications and
  # run by the server when requested rather than as documents sent to the
  # client.  The same rules about trailing "/" apply to ScriptAlias
  # directives as to Alias.
  ScriptAlias /cgi-bin/ "C:\Program Files\Zend\Apache2/cgi-bin/"
</IfModule>

So if I punch in the following URL: http://localhost/webpath/, I'll get a directory listing as follows:

Brandon, thanks for the suggestion.  I want to keep the document root intact, I'm going to modify the alias to move up one directory, i.e. C:/Eclipse_Workspace/ so that I have access to debug all my web applications in the eclipse workspace.  This link also provided a good tip on a potential Gotcha when adding an alias.
Last, but not least, for anyone interested in setting up a simple PHP Development environment, this PDF document proved a very valuable resource, make sure to follow the instructions.  I used the all-in-one package tools provided on Zend's website, they pretty much come with everything out of the box.
Comment: Is anything already currently listening on port 80 that is not apache?
Answer: I looked at my own apache file I think you are missing one spot of changing the document root:
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "C:\Eclipse_Workspace\dummyWeb"

I believe this is about line 210 in the httpd.conf file, I am using your directory here.


Listbox with checkboxes — description aligment with title, or checkbox?

Question:
On a project, we show a list with checkboxes — and all options have some additional descriptions. So the question is should those descriptions be left aligned with the checkbox, or item title?
Answer: I like looking at these types of layouts as if they were bulleted lists with checkboxes for bullets.
See this example:

Benefits of exercise:

Boosts mood
Increases energy
Improves sleep
Helps control weight by elevating your metabolic rate, which allows you to burn more calories even when you're at rest.
Enhances mental clarity by stimulating the release of chemicals in the brain that can improve memory, focus, and problem-solving skills.

As you can see, lists usually use this typographical pattern called hanging indent (or negative indent).
I think it'd help make your checkbox list read as both a list and selection options group and, more importantly, make it more scannable and easier to use. It also helps visually group description with the label, which is better too.
So overall, I usually go with the first option.


Is there a difference between "be honest to" and "be honest with"?

Question: I have seen here that the expression "to be honest with someone" exists and means telling someone the truth. I also have seen sentences like "be honest to yourself." and "be honest to me." My question is, are both "to be honest to someone" and "to be honest with someone" correct? If so, is there a difference between the two?
Answer: "Be honest to me" is not idiomatic. I've certainly never heard it, and it was a surprise to me (native British English speaker) to find any credible search results at all. It appears it is occasionally used, but this ngram shows that it is extremely rare in comparison to "be honest *with".
You may be thinking of examples such as "talk to" versus "talk with", both of which are idiomatic and are sometimes freely interchangeable but with slightly different inferences. You can talk to somebody without them saying much (or anything) back. To talk with somebody infers that you both spoke - you had a conversation.
Although by saying "be honest with me" you are asking someone to speak honestly, honesty itself not a verb like "talk". The verb is "be", and what is idiomatic seems to be driven by how one would show or express the particular quality you are asking someone to be.


How often is the Trello webcal page updated?

Question: I am wondering how often the Trello webcal page is updated. I would like to have my Trello due dates appear in my Google Calendar, but I need to ensure that the dates are being propagated to Google Calendar.
Answer: Google Calendar updates "every few hours." Unfortunately, it's not a configurable setting. See How often does Google Calendar update its "Other Calendar" feeds?
The Trello iCalendar feed requests that clients refresh the feed hourly, but they have no obligation to do so (and, indeed, Google Calendar ignores that request). You can see the last time the feed was updated in each event's description under "Feed Last Updated."(Source: I'm the Trello dev who wrote the iCalendar feed)
Comment: Interesting. I would not have thought that it was Google that was causing the delayed updating. This is not a major concern to me luckily, but it is good to know so that I am not sitting there wondering why a due date may not have appeared. My idea is to use Trello to organize homework for my upcoming school year, and adding due dates and using the ical feed in Google Calendar really allows me to stay on top of things!


Is was or were Correct Verb

Question: After the phrase, "a supply of school supplies and snacks", would I use was sent or were sent for the verb in the sentence?
Comment: Note that although grammatically legal (and a good study case for learning), the repetition of "supply" is awkward and would be avoided in ordinary speaking/writing.  People would reword it, perhaps to: _"a shipment of school supplies and snacks was sent"_ or _"shipments of school supplies and snacks were sent"_
Answer: You would use "was sent" because "supply," not "supplies," is the subject. Ignore the prepositional phrase.

Is was or were Correct Verb


Car will not start after sitting for three months - if I get it started will I be ok?

Question: I have a 2008 cheve impala that I left sitting (covered) for about three months.  It got a new battery just four months ago.  If I call AAA and get it started, will it be ill advised to drive the car like normal, or must I go to a mechanic?  That is, is there much of a risk that my car will not start again? Thanks to anyone who can help!
Comment: I've let my car sit through the winter on several occasions. Jump the battery and away we go. Of course, one thing you might want to do though is have the oil changed and generally check the car over for any problems. Make sure you run the car for a while or put the battery on a charger so you don't need another jump-start. This will also push the fluids around and make sure everything gets lubricated.
Answer: So, you can get the AAA to start it, you should also check the oil level and tire pressures. You could also put the battery on charge overnight and if all else is well it should start from its own battery.
After that you can drive it, you may find the tires have "flat spots" due to being in the same position for so long, but they will normally work themselves out after a few miles or so.
Then after that it should be normal - it should not affect the reliability any further.
Comment: I once had exactly the same situation (caused by a medical emergency putting me in hospital for three months!). The only issue was a flat battery which prevented the car from starting. The (UK) AA guy who I called out checked the battery was still in good condition after the engine had been running for a few minutes, - and would have fitted a new battery there and then, if it had been required, rather than me having to go shopping for one.


Do ST:DS9 Changeling/Founders Regenerate Their Matter?

Question: On a number of occasions, e.g. S07E21 with Odo, Changelings give a sample of themselves for studies.  As they don't seem to eat or consume, are they permanently losing mass when they do so?  They seem to show little more hesitation than someone giving [replenishable] blood.
Answer: In the episode The Begotten the infant Changeling grows, indicating that Changelings do increase in mass. Where this mass is coming from is never really revealed (as your said, they don't seem to eat), but the infant's size did stagnate when it was not being encouraged to shape change, perhaps indicating that this is somehow a factor.
It is fairly clear throughout the series that Changelings can drastically change their size (shifting into birds, fog, etc.). This would mean either a change in density, or a change in mass.
However, their weight when smaller also appears to be less. For instance, in the pilot, Odo changes as a sack to hold latinum, and the sack does not appear to have the weight of a grown man. Thus it seems that they are able to change their mass (however that may be).
Comment: I don't remember the source, but I read somewhere that they store a large percentage of their mass in subspace.
Answer: When the female Founder gives her "skin" samples to Weyoun for Dominion scientists to find a cure for her disease, it doesn't appear that she expects it to be returned (the previous sample(s) had run out, so presumably the tests destroy the samples). However, when Odo gives a sample to Bashir, he tells him that he expects it to be returned.
So it's possible that, being a much older and more powerful Changeling, the female Founder can regenerate lost mass more easily or has more mass to give, or perhaps she can replenish her body mass when she returned to the Great Link.
Also, DS9 writer, Robert Wolfe, theorized that when Changelings morph to a smaller object, they shift part of their mass into subspace. So it's possible that the way they gain energy/grow is through some subspace interaction.
Comment: `when Changelings morph to a smaller object,` - Are we then assuming that his externally visible volume as a humanoid is completely occupied?  The jug he stays in is pretty small.  Shouldn't we assume he is somewhat hollow?  If he is hollow, then you don't have to account for the entire mass/volume of a standard sized humanoid.
Comment: @Zoredache: Well, according to canon, scans of a changeling when they morph into an object show them as identical to the actual object. Additionally, there's no evidence that Odo or other changelings are lighter than other humanoids (otherwise it would be incredibly easy to detect them by just installing hidden scales/pressure-sensors). When Odo fights with others, his weight also appears to be equal or greater than that of his opponents, so there's no reason to believe that he's hollow most of the time.


What's the difference between the Life Cycle Hypothesis and Permanent Income Hypothesis?

Question: Would it be correct to say that the Permanent Income Hypothesis (PIH) stipulates that current consumption decisions are made based on future income projections/expectations, while the Life Cycle Hypothesis (LCH) claims that consumption is constant over the average person's life time, and this is made possible, despite changes in income level throughout his/her lifetime, through borrowing when younger and savings during the elderly years?
Answer: The ideas are very similar and functionally virtually equivalent although there arguably is subtle difference. For example, Romer in his Advanced Macroeconomics, which is widely used intermediate macroeconomics handbook, calls both the life cycle hypothesis and permanent-income hypothesis just permanent income hypothesis. To be more specific he says

Thus the individual uses saving and borrowing to smooth the path of consumption. This is the key idea of the permanent-income hypothesis of Modigliani and Brumberg (1954) and Friedman (1957).

Where the Modigliani and Brumberg (1954) refers to the paper where the life-cycle hypothesis originates.
There is very subtle difference though. Friedman's permanent income hypothesis, focuses more narrowly on income. Friedman's argument is also very 'instrumentalist' and it goes as follows. We know from macroeconomics that consumption depends on income so we will have:
$$C_t = a +  bY_t + e_t$$
where the estimated $\hat{b}$ is given as covariance of income and consumption over variance in income $\hat{b} = \sum(C_t-\bar{C})(Y_t-\bar{Y})/\sum(Y_t-\bar{Y})^2$ and $\hat{a}= \bar{C}- \hat{\beta}\bar{Y}$. Now if we assume that $Y$ can be decomposed into permanent $Y^P$ and temporary $Y^T$ income (i.e. $Y=Y^P +  Y^T$) and that the two are uncorrelated with transitory income having mean zero we can following Friemdman show that:
$$b= k \frac{\sum (Y_t^P- \bar{Y_t}^P)^2}{\sum ( Y_t- \bar{Y_t})^2} \text{ and } \hat{a} = \bar{C} -\hat{b}(\bar{Y}^P+\bar{Y}^T)$$
Since transitory income is on average assumed to be zero, and because variation in transitory income which is component of the denominator in calculating $\hat{b}$ is arguably much smaller than the variation in permanent part of the income one can conclude that consumption is determined virtually completely by changes in permanent income.
The life cycle hypothesis of Modigliani and Brumberg is more analytical and pays also attention to person's whealth. Following presentation in Romer's Advanced Macroeconomics,  a person at any time $t$ a person would make expectation of his/hers lifetime income $\sum^T_{t=1} E_1 [Y_t]$ together with any initial assets/wealth $A_0$ and their current consumption at the time $t$ will be just an equal fraction of all income (i.e. permanent income in Friedman's lingo) and assets  for that particular time period. That is the consumption in present period 1 would be given by:
$$C_1 = \frac{1}{T}\left(A_0+ \sum^T_{t=1} E_1 [Y_t]\right) \text{ and }$$.
This implies that people will try to smooth their income over their life as it implies that people will save when the income is higher than average income and dis-save when it is lower than average since:
$$S_t=Y_t-C_t= \left( Y_t - \frac{1}{T} \sum^T_{t=1} E_1 [Y_t]\right) - \frac{1}{T}A_0$$
Thus both PIH and LCH are functionally equivalent and they are both consistent with each other. They both argue that consumption is determined by your permanent income/lifetime income including any inherited assets.  The main difference is in presentation and arguably the mechanisms are subtly different. The Friedman's PIH presentation is more 'empirically oriented' and focuses on income itself (although arguably Friedman implicitely included any assets in $Y$). The LCH is more analytical and pays more attention person's wealth and later versions also to demographic factors.  Since they are so similar as already mentioned before the ideas are usually treated simultaneously in textbooks and some authors such as Romer call both ideas permanent income hypothesis and I recall seeing the reverse as well.


Randomized Algorithm Log-Space Exp-Time

Question: I'm looking for an example of a randomized algorithm that halts with probability 1 (halts almost surely), uses only logarithmic space (worst case) and whose expected run time is not polynomial in the size of the input.
Comment: Can you [edit] your question to define "always halts" more precisely, please?  If the probability of not halting is 0, does that qualify as "always halts"?  Do you mean for all inputs, the probability that it halts is 1?  Or do you mean that for all inputs and all possible coins (choices of random values), it halts?
Comment: Please don't use "EDIT:".  Rather than appending more information at the end, please revise your question so that it reads well for someone who encounters it for the first time.  We're hoping to build up an archive of high-quality questions that will be useful to others in the future.  See https://cs.meta.stackexchange.com/q/657/755 for more details.
Comment: Can you now clarify what you mean by "run time"?  Do you mean "expected running time" (expectation taken over the random choices made by the algorithm, for the worst-case input)?  Do you mean worst-case running time (both the worst-case input, and the worst-case set of random choices)?  Something else?  It affects the answer.
Comment: In essence, halts almost surely, worst case logarithmic space, worst case exponential time
Comment: This still doesn't answer what you mean by "worst case".  Does that mean worst over all possible random choices that happen during execution of the algorithm, as well as all possible inputs?  If you'd like an answer, I recommend that you [edit] your question to specify this very explicitly and clearly in the question.  Don't force us to guess -- as then if we answer based on some guess at what you're asking, and it wasn't the assumption you were hoping for, then both you and we have wasted our time.
Answer: If I understand you correctly, I don't think such an algorithm exists. Any algorithm that uses only log space and halts could not run in exponential time, because there is at most polynomial number of unique configurations of the machine. This applies to randomized algorithms (i.e. probabilistic Turing machines) as well, because every branch of the probabilistic TM has to halt in polynomial time before running out of possible configurations for that branch.
Comment: While i believe this is correct accordingly to my previous formulation, i have edited it and am quite sure there should exist an algorithm in the new formulation.
Comment: @JoséDuartedeAzevedoeCunha, what makes you sure that one should exist?  Did you encounter this question somewhere?  Can you tell us about the context behind this question and why you believe such an algorithm should exist?

Randomized Algorithm Log-Space Exp-Time


How can a GMail file attachment of "unknown" file type be downloaded in Ubuntu Touch?

Question: How can an e-mail attachment of arbitrary file type be downloaded in Ubuntu Touch? I have a file (say .dat, or something the system doesn't recognise) that is an attachment to an e-mail opened in the default GMail application on Ubuntu Touch 15.04 OTA-11. When I select the attachment, I am presented with the message "Sorry, there aren't currently any apps installed that can handle this type of content."
Given that I want to download the file as opposed to open it and given that wget or similar is not an option because of authentication limitations, how can this attachment be downloaded?
Answer: Sign in to your gmail account from the browser app (instead of gmail webapp or Dekko), you'll see an option to simply download the file (along with opening with another app).
There is a feature request at Launchpad to include an option to download arbitrary file types from the webapps.