Moving and organizing files in download folder

Question: This is a Python script that I use on my Android tablet.  It moves the files in the Download folder to a folder on the external SD card.  The files are sorted based on their extensions and are moved to folders (for each different type of extension).  If it encounters a new file type, it will create a new folder.  If the file name already exists, the new file will be renamed by appending the first five hash digits to the end of the file name.  The original file is deleted.
How can I improve my program?  What changes should I make?
import os
import hashlib

download_dir = "/sdcard/Download/"
save_dir = "/mnt/external_sd/Download/"

FileList = os.listdir(download_dir)
for File in FileList:
    #print File
    extension = ''.join(os.path.splitext(File)[1])
    name = ''.join(os.path.splitext(File)[0])
    ext = extension.strip('.')

    if os.path.isdir(download_dir + File):
        pass
    else:
        if os.path.exists(save_dir + ext + "/" + File):
            Data = open(download_dir + File, "r").read()
            m = hashlib.sha1()
            m.update(Data)
            h = (m.hexdigest())[0:5]
            file(save_dir + ext + "/" +name+"-"+h+"."+ext, "w").write(Data)
            print File, " ","-->"," ",name+"-"+h+"."+ext
            os.remove(download_dir + File)

        elif os.path.exists(save_dir + ext):
            Data = open(download_dir + File, "r").read()
            file(save_dir + ext + "/" + File, "w").write(Data)
            print File #, " ","-->"," ",name+"."+ext
            os.remove(download_dir + File)

        if os.path.exists(save_dir + ext) != True:
            os.makedirs(save_dir + ext)
            Data = open(download_dir + File, "r").read()
            file(save_dir + ext + "/" + File, "w").write(Data)
            print File , " ","-->"," ","/"+ext+"/"+name+"."+ext
            os.remove(download_dir + File)

Answer: File, FileList, and Data are neither class names nor constants; variable names should be lower_case in Python.  I'd call it filename instead of file to avoid clashing with Python's built-in file() constructor.
Avoid calling splitext() twice with name, extension = os.path.splitext(filename).
For portability, clarity, and to avoid accidental omission of the path component separator, it would be better to use os.path.join(dirname, filename) instead of dirname + filename, even if you only plan to run it on Android.
You open files for reading and writing but don't close them.  In particular, it's important to make sure the destination file handle is successfully closed before removing the source, or you might lose data.  Also, it's preferable to call open() instead of file().
The structure of your program can be simplified.
if a:
    ... # body a
else:
    if b:
        ... # body b
    elif c:
        ... # body c
    if c != True:
        ... # body d

can be written as
if a:
    ... # body a
elif b:
    ... # body b
elif c:
    ... # body c
else:
    ... # body d

assuming that bodies b and c do not influence the c != True test.  Also, I believe you intend for cases b, c, and d to be mutually exclusive, but I suspect it may be possible to execute both bodies b and d in your original program.
Bodies b, c, and d are very similar to each other.  You should try to reduce the redundancy in your code.  One approach would be to copy the contents to a tempfile in the destination directory (computing the hash as you copy, in case you need it), then successively try to os.rename() the temporary file to various destination filenames.


What happened to the "give skull" command in Minecraft?

Question: I just got Minecraft Bedrock Edition, and I wanted to Make a map for a Minecraft YouTuber and put his head in the dedication, but both of the the "give skull" commands (/give @p minecraft:skull 1 3 {SkullOwner:"_________"} or /give @p minecraft:skull {SkullOwner:"_________"})
isn't working. When I type in the former, it says "Missing Object Name" or something like that. But when I type in the Latter, it says something like "Item Not Recognized". Can anyone tell me what happened to it?
Answer: Bedrock Edition doesn't have any NBT access with commands, so you can't /give items with extra data. They are planning a "component" system to do some of the things NBT does, but there's not much there yet.
Bedrock Edition also doesn't have player skulls, because it doesn't have skin servers. Skins are stored on the player's computer only, so there's no real way for them to add player skulls without a restructure of how that works.
The commands you have, and most commands you find online, are for Java Edition (the original version of the game). In Java Edition 1.12 and below your first command is fine. For Java Edition 1.13 and above you should use:
/give @s player_head{SkullOwner:"Notch"}

Comment: Really? Thanks for the info. I am kind of disappointed.
Comment: Also, I have used NBT tags in Bedrock Edition before when I played at my friend's house, and they worked. I used the command:

/give @s diamond_sword 1 0 {display:{Name:"Super Sword"},lore:["A Good Blue Sword Never Breaks"]},{Unbreakable:1}

so this can't be true. Bedrock does have NBT access.
Comment: @ShadowBlstrTheNinja That has never worked on Bedrock edition. What you were playing at your friend's house will not have been Bedrock.
Comment: I have done it before. and it was on console. it was the new version on the Nintendo switch.
Comment: Oh, maybe that was just a dream. My bad! Anyways, could you inform me when they finnish the component system?


Wideband metamaterials in mobile-telecommunications bands

Question: Were there any metamaterials (materials, settings, geometry) studied that are non-resonant (not frequency selective) in the frequencies between 700 MHz and 2700 MHz, therefore useful for mobile telecommunication purposes? I've been reading a lot of literature lately, but it seems that either they are used for lasers, or the selectivity is so high that they are used as "selective" filters. I'd want a metamaterial instead that has low losses on the above mentioned band.
Comment: What application is your metamaterial for? Are you specifically looking for a negative refractive index material?
Comment: I would like to study their uses actually... Nothing special. For example what happens to a beam if you put a metamaterials radome over it and so on
Answer: Nonresonant metamaterials of course exist and are used; then denoted as "artificial dielectrics", they found their application in 1940s for construction of lightweight microwave optics. Their theory is even older:Lord Rayleigh theoretically elaborated the elmg/acoustic wave propagation through a rectangular lattice of cylindrical or spherical "obstacles" in 1892: http://www.tandfonline.com/doi/pdf/10.1080/14786449208620364
Note that the terminology is a bit obsoleted - for the Bloch wave in periodic media, the scattering particles are no "obstacles" in the classical sense.
In the nonresonant structures, you may generally engineer the permittivity tensor, with the possibility of constructing a strongly anisotropic or even hyperbolic medium. One example is the microwave wire polarizer.
Thanks to being far from resonance, the losses can be kept very low, unlike negative-index metamaterials which tend to be relatively lossy.


How do you get nested facets with Searchkick/ElasticSearch

Question: How can you do nested facets in ElastiSearch with the Searchkick gem?
I would like to achieve something like this:

Category Name

median price
count
min price
max price
Answer: Searchkick only support term facets, for median price you need stats facets http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-metrics-stats-aggregation.html
I suggest you to check elasticsearch-rails or elasticsearch-ruby project.
I used to research all elasticsearch related gem, because of elasticsearch syntax is complex, no gem can provide such flexiable DSL.
So I like write my own elasticsearch query


Move loopcut without distorting UV map

Question: I have a brick wall that I am trying to add a door to. I have already UV mapped it, so when I move the loop cut to the right height, it distorts my UV map. How can I avoid having to unwrap it again?
Answer: Press G, G or Ctrl E > Edge Slide to move the loop cut. Then in the bottom of the Tool Shelf or by pressing F6 turn on Correct UVs.

In Blender 2.9 it's now called Correct Face Attributes
Comment: Also the inverse of this operation, once you've baked everything, you can remove the extra loops again using 'x' then 'g', this should preserve the UVs.  Now your higher poly model once again becomes your low poly model.  All the baked textures will still match up so long as you keep watching the UV coordinates and use 'Undo' should you ever damage a UV island when removing a loop.
Comment: You can also use this technique to push loops up against each other and use remove doubles to merge the two loops.  This helps with cases where the previous method fails.
Comment: In Blender 2.9 and Blender 3.0, there is an option called "Correct Face Attributes", which allows you to preserve the UVs even when NOT edge sliding. However, when using Edge Slide, you still have the option to toggle "Correct UVs" on or off, however this option is NOT visible until after you first confirm the operation by left clicking. Then you can further adjust parameters, including the "Correct UVs" option. For example, if you wanted to dilate a pupil by edge sliding and have your eye texture stay locked to the iris, turn the "Correct UVs" option OFF.

Move loopcut without distorting UV map


Nuke TV Dinner and then renuke it 3 hours later?

Question: I need to feed 10 people a Hungry Man TV Dinner each (please don't ask why--it's too long a story) and I have only 1 microwave oven. I need everyone to eat pretty much at the same time, but this is not possible since it will take 8 minutes for each TV Dinner to heat up. So, my solution is to to spend 80 minutes heating all the frozen meals, and leaving it for three to four hours until mealtime comes. My question is: Would reheating an already heated TV dinner alter the taste and texture (like get dry and hard)?
Comment: How are you going to store them in between? This is a huge thermal mass, so your fridge will be working hard if you stack them in there... and leaving them out on the counter, worst if stacked, for 3 hours after heating them will leave them at the top end of the danger zone uncomfortably long...
Comment: TV dinners used to have instructions on how to reheat in the oven.  I have no idea if they still do or not.  The only reason that I can think of that they might not recommend it would be if they changed the plastic used in the trays.  (I've run into cases when 400°F softened the plastic trays from Wegman's ... who also used to have oven instructions on heating stuff from their catering department but didn't this last time around).
Comment: At the very least, you could set the oven to its lowest setting (usually around 200°F), microwave them individually, then set them in the oven.  Although holding for 3 hrs means that they'll dry out some in that time if you have an electric oven.
Comment: Oh ... and don't think that you can get away with borrowing a friend's microwave to make it go twice as fast.  My place of work's rec center did that when they decided we weren't allowed to use the ovens, stove, or indoor grills anymore after their 'renovation' (turned the @#@!% place into a conference room).  They put both microwaves on the same circuit, so as soon as we started warming things, we blew the circuit ... and they had no clue where the breakers were.  (luckily, that year Wegman's still gave oven instructions)
Answer: I would try pre thawing them all so they don't take so long to nuke when the time comes. So maybe defrost them in the fridge a few hours before so you aren't microwaving from frozen. And just stack them in the oven to stay warm while you nuke the rest.
The crazy part of me would disassemble the meals.
1: all veg in a pot.
2: all mash potato in a pot.
3: all meats on an oven tray
4: heat it all up on the stove and oven
5: re assemble all meals onto clean trays or clean plates.
But I'm kinda crazy. And it might not be easy if there is gravy involved.
Also if you haven't already purchased said meals why not just get a bag of frozen veg, a box of instant mash potato and a frugally priced meat option of your choice to just make dinner for all at once. (But maybe not an option for you)
That's all my ideas :) good luck!
Comment: Agreed: if you're going to essentially thaw them, let them cool, then reheat again, you might as well do it on purpose, in a safe way.


Maven Snapshot Repository vs Release Repository

Question: What is the difference between a Snapshot Repository and Release Repository?
This is with reference to setting up Repositories (like Artifactory, Nexus etc)
Answer: Release repositories hold releases and Snapshot repositories hold snapshots. In maven a snapshot is defined as an artifact with a version ending in -SNAPSHOT. When deployed, the snapshot is turned into a timestamp. By definition, snapshots are mutable, releases are immutable. This is why Nexus makes you store them separately because usually you don't care if you lose snapshots, but you will care if you lose releases. It makes snapshot cleanup much easier to deal with that way.
Comment: Thanks for the *"When deployed, the SNAPSHOT is turned into a timestamp"*.
Comment: I've been using maven & gradle for years and only understood this very recently.
Answer: Release Artifacts
These are specific, point-in-time releases. Released artifacts are considered to be solid, stable, and perpetual in order to guarantee that builds which depend upon them are repeatable over time. Released JAR artifacts are associated with PGP signatures and checksums verify both the authenticity and integrity of the binary software artifact. The Central Maven repository stores release artifacts.
Snapshot Artifacts
Snapshots capture a work in progress and are used during development. A Snapshot artifact has both a version number such as "1.3.0" or "1.3" and a timestamp. For example, a snapshot artifact for commons-lang 1.3.0 might have the name commons-lang-1.3.0-20090314.182342-1.jar.
Taken from refcard
Comment: This defines what release and snapshot artifacts are. But: are two distinct repositories needed?
Comment: This does not answer the question, the question is about the distinction between release and snapshot _repositories_ (not artifacts).
Comment: Found well written information at https://docs.oracle.com/middleware/1212/core/MAVEN/maven_version.htm#MAVEN8855
Comment: @mks-d Good observation but it's hard to understand a repository of something without understanding first what that "something" is. :) https://stackoverflow.com/a/5901460
Comment: Sayat, Is `1.1.0.M5 ` or `1.1.0.M4 ` one version of the snapshot?
Answer: Usually in maven we have two types of builds:
1) Snapshot builds: SNAPSHOT is the special version that indicates current deployment copy and not a regular, specific version. Maven checks the version for every build in the remote repository. The snapshot builds are nothing but development builds.
2) Release builds: Release means removing the SNAPSHOT at the version ID for the build. These are the regular build versions.
Snapshot artifacts and release artifacts are push to snapshot, release repositories respectively.
Answer: Snapshots are maven idea to give version number as -SNAPSHOTS , its under development, it can change any time.
Internal repository is the release repository with fixed version number. You can modify the SNAPSHOTS, but That artifact never changes after it is released.
Answer: SNAPSHOT here doesn't really mean ONE snapshot which is frozen and won't change, SNAPSHOT covers several snapshots whose modifications are not big enough for being represented by a new version number


ARMv6 FIQ, acknowledge interrupt

Question: I'm working with an i.mx35 armv6 core processor.  I have Interrupt 62 configured as a FIQ with my handler installed and being called.  My handler at the moment just toggles an output pin so I can test latency with a scope.  With the code below, once I trigger the FIQ it continues forever as fast as it can, apparently not being acknowledged.  I'm triggering the FIQ by means of the Interrupt Force Register so I'm assured that the source isn't triggering it this fast.  If I disable Interrupt 62 in the AVIC in my FIQ routine the interrupt only triggers once.
I have read the sections on the VIC Port in the ARM1136JF-S and ARM1136J-S Technical Reference Manual and it covers proper exit procedure.  I'm only having one FIQ handler so I have no need to branch.  The line that I don't understand is:
STR R0, [R8,#AckFinished]

I'm not sure what AckFinished is supposed to be or what this command is supposed to do.
My FIQ handler is below:
ldr r9, IOMUX_ADDR12
ldr r8, [r9]
orr r8, #0x08                        @ top LED
str r8,[r9]                          @turn on LED
bic r8, #0x08                        @ top LED
str r8,[r9]                          @turn off LED

subs pc, r14, #4
IOMUX_ADDR12:   .word 0xFC2A4000 @remapped IOMUX addr

My handler returns just fine and normal system operation resumes if I disable it after the first go, otherwise it triggers constantly and the system appears to hang.
Do you think my assumption is right that the core isn't acknowledging the AVIC or could there be another cause of this FIQ triggering?  If the core isn't acknowledging the AVIC, what do I need to do to acknowledge it?
Answer: It's just as you say, it looks like you're not clearing the pending interrupt from one or both of the peripheral generating the interrupt or the VIC itself.

ARMv6 FIQ, acknowledge interrupt


Plesk Rebranding Web Hosting

Question: I recently bought the new Plesk software and im unsure on how to re-brand the site to our company logos and themes.
Does anyone know the steps to changes these settings or a manual that would answer my questions?
Regards,
          Oliver James
Answer: Well, it really depends on how much work you want to do. You can do as little as changing the logo--which is quite simple--to as much as completely retheming the interface to match your company's brand. The path of least resistance is to copy an existing skin and modify it to suit your needs.
Either way, start in the admin interface and go to the Server config page. The two options that should interest you are there: Logo Setup and Interface Management. Changing the logo is pretty obvious, so I'll stick to the Interface Management part.
Once in the Interface Management section, click on the Skins tab. The first thing you should do here is find the skin that most closely resembles what you'd like your finished product to look like. You'll notice on the list of skins that there's an icon of a floppy disk; clicking on this icon will allow you to download a .zip or .tar.gz file containing all the files for the skin.
Now you just need to alter the skin as necessary. I recommend setting up a development server (or a virtualized server) where you can play with Plesk without causing any damage to your production server. And, of course, best practices dictate that you should probably put it all under source control to make sure nothing goes wrong.
Anyhow, once you've made your changes and you're satisfied with the results, go back to the Skins page in the Interface Management section and click the Add New Skin button. Zip up your skin (to match the way it was zipped when you downloaded the base skin) and upload the file. Once you've uploaded it, you can then choose the skin from the Skins page. To be on the safe side, I recommend creating a dummy client user and testing out the skin on your production environment before switching any existing users to the new skin, just in case there's a problem with the skin.
And once you're satisfied that your newly-modified skin works on the production site, go ahead and switch all your existing users over.

Plesk Rebranding Web Hosting


Why are DIMMs not equipped with a heat sink like a CPU?

Question: I know that a DIMM is composed of a set of chips that contain control logic managing the decode and prefetching memory operations. According to a product specification, I found that newer RAM works at a high clock rate (> 1Ghz) that is comparable to some CPUs. And that's what made me wonder why only the CPU is equipped with a heat sink, and not also the DIMM, besides a certain high clock rate (and thus the amount of heat needing to be cooled).
Comment: Some DIMMs have heatsinks. Look at overclocker oriented DIMMs.
Comment: Umm… they are. Not all of them though, same as not all CPUs require heatsinks and you can find embedded low power ones without heatsinks. I suggest rephrasing your question, because it doesn't seem well-researched the way you posed it.
Comment: Why do you correlate Ghz with need for heatsinks instead of power consumption? I am not aware of any DIMM taking 250 watt.
Comment: PC3-8500 does not (despite its common name of DDR3 1066, and despite many vendors suggesting otherwise in marketing materials) work at a clock rate > 1GHz.  It has 1066M *transfers* per second, but because it's a Double Data Rate product that means that its clock rate is 533MHz and performs two operations per clock cycle (similarly to having a dual core processor).  PC3-16000 products do operate at 1GHz, but seem to universally have heatsinks.
Comment: Yeah, but it is a little ignorant to go by frequency and totally ignore the thermal design specs. It is quite obvious that for example a TR4 socket CPU - which can use up to 250 watt in the newest iteration - will have a different cooling need than a DIMM that pulls - attention - around 1-2 watt, frequency or not. Frequency is not the only relevant element. At the end, it is about power consumption and thermal profile, and that is very differnt REGARDLESS of frequency.
Comment: @TomTom: Because power consumption tends to rise with the increase of frequency. This can be superlinear, even. To compensate for shorter time intervals, you need higher voltages to keep sufficient noise margin.
Comment: @TomTom understood.
Comment: Analogy to the question: "If my quadcopter's motor spins at 9,000 RPM, why doesn't need the same cooling as my car engine spinning at 9,000 PRM?" It's a matter of scale.
Answer: You're assuming that the power dissipation is directly related to the clock rate. That's true but there's more.
Suppose I have this chip A where only 10% of the chip area (die size) runs at the highest clock rate. Compared to a chip B of equal size where 100% of the circuits are running at the high clock rate, chip A would dissipate only about 1/10th of the power that chip B dissipates.
My point: not only the clock rate matters, also how much of the chip is actually running at that clock rate.
For a DRAM chips (PC DIMMs use DRAM) most of the area on the chip is DRAM cells (obviously) and these are run at a significantly lower speed than the external clock rate. The DRAM controller access the chips in parallel and in a sequence so that this lower speed is somewhat compensated for by parallelism.
On a CPU a much larger part of the circuits actually run on the maximum clock rate (depending on how busy the CPU is of course) so it is bound to dissipate a lot more power than a DRAM chip where only a small part of the chip is running very fast.
Comment: You can add another simple fact. the surface area of a DIMM is significant larger than the surface area of a CPU. Yes, it may not look so - but that is mostly because "the CPU" is mostly head spreading material, the acutal CPU is a lot smaller.
Comment: It really is **significantly** lower. Most modern DRAM modules for consumer PCs refresh every 64ms so rather than operating in the GHz range, it nominally operates at a paltry 15.625 Hz. Of course, a heavily-loaded module will be quite taxed, but even then a CPU's built-in cache will reduce the need to repeatedly read from RAM.
Comment: @forest, no as 1/64 ms = 15 Hz, for 15 kHz T is about 64 us. But 15 Hz is just the refresh rate, when accessed the DRAM cells will be accessed at a much higher frequency. The 15 Hz is only when **idle** (sitting there just keeping the RAM contents).
Comment: @Bimpelrekkie I said 15 Hz, not 15 kHz (15.625 where . is a decimal place). I said a loaded module will be more taxed. The majority of cells will be sampled every 64ms.
Answer: DIMMs don't dissipate the same power a CPU does, so they don't need the same cooling.  In addition, the power the memory and control chips do dissipate is much more spread out physically.
Power dissipation may be roughly proportional to clock rate, but that proportionality constant is quite different between a CPU and a memory.  The CPU has many more transistors and gates switching at the clock transitions than the memory does.
Remember that for CMOS, by the time you get to current being roughly proportional to clock speed, the dominant current is charging and discharging all the little parasitic capacitors on the outputs of every gate.  If you have fewer gates changing state, then there is lower current, which results in lower dissipation at the same clock rate.
Answer: You need a heatsink if your component produces more heat than it can dissipate through its own package. Heat is electricity converted to a change in temperature of some mass
Now, in a modern CPU, what uses electric energy is mainly the process of switching a transistor. Every single transistor switching costs energy, and the faster that switching has to happen increases the amount of energy per switching.
Now, for every clock cycle, your CPU does a lot complicated things like multiplying numbers, caclulating addresses, speculating what the next operation might compute before that actually happens, and so on. Those operations lead to a lot of transistors switching at once.
A DRAM chip (like the one on your DIMMs) is different in that there's no complex operations to do – it's just memory, which means that it basically has to switch about (word length)×(memory address bits) – so, really, less than 2000 transistors for a single chip (there's a bit of address and command decode overhead, but that's very "cute" compared to the complexity of a CPU). Sure, the things these transistors switch need more energy (because that charging and discharging relatively large capacitors, whose charge is the actual bit), but it's really very few transistors only.
Then, DRAM also needs to be periodically refreshed, but that happens every few milliseconds or so only, so only every couple million memory clock cycles – and hence doesn't contribute greatly to overall power consumption.
Comment: "Relatively large capacitors" in the nF range...
Comment: I must admit I don't know how large these are. Probably multiple dozen picofarad!
Answer: Some types of DIMMs do have (and need) heatsinks. While the ones on gamer-oriented memory sticks are mostly for design/show reasons, there are e.g. FBDIMMs for servers which, due to their different architecture, require significantly more power (the last ones I used were roughly at 10W per stick) and thus need more cooling capacity than the bare plastic chip package can provide.
Comment: "the ones on gamer-oriented memory sticks are mostly for design/show reasons" - I disagree. I needed to buy radiators for my PC memory few years ago, and it helped to prevent Windows BSoDs. Just anecdotal, I know,but still.
Comment: @Mołot That's why I wrote "mostly".. there may be corner cases where memory sticks are overclocked hard enough (or misdesigned so much, or installed in a case with poor airflow) that they don't run stable without extra cooling anymore.. but the broad majority doesn't need that. I've just looked through a few Kingston gamer memory sticks, and they are all in the 1.5-2 watt area, which could easily be dissipated without the heatsink as well.
Comment: To be honest, OC in gaming is no longer a "corner case", it's something manufacturers expect to happen. Also, I always do my best to buy the fastest memory my CPU can handle, and that makes a difference, I guess.
Answer: DRAM is built from gates and capacitors. Think of glasses of water, some empty, some full. Pour some water in and periodically refill as it evaporates.
CPU cache is made of flip-flops. Think of faucets full blasting cold or warm water. You don't need refilling, but they do use a lot of water (energy).
Because of that difference DRAM chips usually don't need heatsinks (not much energy loss) but CPU does. Mind that CPU also does the calculations (another set of fire hoses) that contribute to the heat.


How do I put music not eligible for iCloud on my iPhone without turning off iTunes Match?

Question: In short, I have an audio file that is too large for iTunes Match (This item is not eligible for iCloud), but I'd still like to listen to it on my phone. In days past I was still able to drag the track to my iPhone in the sidebar, but that feature now seems to be disabled.
Comment: What version of iTunes and is the device set to sync over USB, WiFi or not at all to that iTunes library?
Comment: Latest for what OS? It really helps the site if you put in these details. It's just a suggestion and you don't need to - but we aim to have questions usable even 2 years down the road when iTunes 14 is out (or whatever)
Comment: It it were me, I'd use Audacity or some other audio editor to break the monolithic track up into sub tracks and create a custom album.  On the song options, I'd probably select part of a gapless album.
Comment: Latest version of iTunes, device is set to sync over WiFi.
Comment: Sorry, but I thought screenshot implied this was for OS X. 10.8.4 specifically, but that doesn't seem relavant to the problem.
Answer: I made the file kind "audiobook," and then they seemed to sync fine, as audiobooks. Since they were lecture files, that's just fine with me.
Comment: I was actually trying to upload an audiobook to the iphone and marking files as `audiobook` totally helped :)
Answer: Just spoke to Sr. Apple Support staff.  There is no official way to do this without turning off iTunes Match, selecting the content you want moved to either the iPhone or the iPad (in iTunes), syncing and then turning iTunes Match back on.  While not a great solution, that is the official word.
Comment: This is frustrating, but I guess at least it's possible. Apple is being stupid here. Let us store whatever you allow in iCloud, then sync the rest of the ineligible stuff in iTunes as normal. I guess I'll give this a try. 90GB of music is getting to be ridiculous.
Comment: I've also heard of people storing these files in dropbox or another file storage program that allows playing of the file. It's not the same as being integrated within the Music app, but the file does get on your iPhone for listening.
Answer: I changed the file type to 'Audiobook', (Right click on the file in iTunes, Get Info, Options, then change 'media kind' to audiobook') and then it allowed me to drag and drop the file on to my iPhone in iTunes.
Then, in the Music app on the iPhone, tap 'More' in the bottom right corner, and 'audiobooks' will appear in the list.
Took about an hour of faffing about with iTunes Match before I discovered this tip. Then it was done in about 20 seconds.
Answer: As a possible workaround you could use a different app than the default Music.app for this particular song. Some apps (Azul, for example) permit you to use simple iTunes sharing to put media inside and they are independent of the iTunes library.
It is not ideal but it does solve the problem.
Answer: I have found to date the best fix to this dilemma is to change the "Media Kind" to iTunes U. Select the track or tracks and then select options, you will see the option to change the media type. This option will be available to only songs that have Not been added from your mac or pc to iCloud i.e. there's the cloud with a line through it next to the track. I have the latest iTunes 11.1.1 and iOS 7 on my iPhone. I used this method to add 323 teaching files  that won't sync to the cloud, not sure why because I have other teaching files that are the same length and they sync to the cloud just fine. Turning iTunes match off then moving the files to my phone, then turning iTunes Match back on didn't work, it just erased the files i just moved over when turning match back on.
Answer: I had the same issue. My solution was to go onto my iPhone 5S, turn OFF iTunes Match in settings. At the same time, I also turned on Automatic Downloads Music. One of these solved my problem. When I plugged my phone back into the computer, all of my music synced. Good luck.
Answer: I had great success with going into iTunes and selecting Get Info → Options and changing the type from Music to Audiobook and selecting the checkboxes for Do Not Shuffle and Remember Location.
Then you can selective-sync audiobooks with your iPhone and sync like in the old days.


Prove that $x_n$ has infinity limit

Question: $x_1 = a^2$ and $x_n = (x_{n-1} - a)^2$ where a>2. I proved that it's increasing sequence, but I don't know how to prove that it's not bounded above.
Comment: Have you tried to suppose that it's bounded, and taking a limit. Odds are, the delta will come negative (I suspect it will, but I didn't check)
Answer: Hint:
Assume on the contrary that the sequence $x_n$ is bounded above. You have already proved that this is a increasing sequence. This imply that sequence is convergent and has limit. Let us call the limit $l$
Then taking limits on both sides of the given expression we get
We have $l=(l-a)^2$
Can you arrive at some contradiction from here?
Answer: Write $x_k=ay_k$, where $y_k$ is defined by $y_1=a$, and $y_{n+1}=a(y_n-1)^2,\ \forall n=1,2,\cdots$. Then $$y_{n+1}-1=a(y_n-1)^2-1.$$ Suppose $y_n-1=1+\varepsilon$. Then $y_{n+1}-1>1+4\varepsilon+2\varepsilon^2>1+4\varepsilon$.
This shows that $\displaystyle\lim_{n\rightarrow\infty}y_n=\infty$, and therefore $x_n$ is  unbounded.

Hope this helps.

Prove that $x_n$ has infinity limit


Very low MSE, but negative R^2 [different case than similar questions]

Question: This question has been asked before, but I have a specific case I'm curious about. Essentially, I have a very low MSE, but the R^2 turns out to be negative. Even the scatterplot shows that a horizontal line isn't a good fit, so I'm not sure what to make of these results. I used sklearn's Linear Regression object, and calculated "Variance Score" (R^2) with the .score() function with .score(Xtrain, ytrain) for the training set (leftmost plot) and .score(Xtest, ytest) for the testing set (middle plot).
These are time series predictions btw
Thanks]1
[]2
Comment: Welcome to [stats.se]!  Please take a moment to view our [tour].  It looks like you end up with a combinations of two distributions (or a bi-modal distribution) which is especially prevalent in the second model.
Answer: The $R^2$ value indicates that a null model (horizontal line) is a better fit for the test data than the model you've created in the training data. If you plot the $x=y$ line in your test set graphs, you can see that this line lies almost entirely above the predicted y values. For the null model, roughly half of the predicted values will lie above this line and half will lie below it, even though the predictions are all the same.
There are two aspects here that perhaps need looking at:

The training data and test data appear to be different (the range of y values are certainly very different). Why is this? Should they be expected to be described by the same model? Have they come from the same data generation process?
Being able to fit the null model for the test data requires knowing the average true y value across the test data. A more appropriate null model in this case would be the average training data y value. Because of the different ranges of the training and test data, your model would likely do much better than this (but remain a bad model for the test data)

The small $MSE$ doesn't indicate much here. The null model would also have a small $MSE$.


Possible measurements of an observable described by an operator composed of two identical states

Question: Consider we have an operator $\hat{B}$ which is composed of two states i.e.
$$
\hat{B}=|\theta_1\rangle\langle\theta_1|
$$
The state $\theta_1$ is in turn composed of basis vectors
$$
|\theta_1\rangle=\alpha_1|\phi_1\rangle+\alpha_2|\phi_2\rangle
$$
where $\alpha_1,\alpha_2\in\mathbb{C}$ and $\{\phi_1,\phi_2\}$ form an orthonormal basis for the Hilbert space. If we want to find the possible measurements for this observable, we need to solve the eigenvalue equation
$$
\hat{B}|\phi_{i}\rangle=\epsilon_{i}|\phi_{i}\rangle \;\;\;\;\;\; i=1,2
$$
I tried approaching this in the manner described in jinawees answer. However, my interpretation of how it applied to this question would not work. In this case we get (for $i=1$)
\begin{align*}
\hat{B}|\phi_1\rangle&=|\theta_1\rangle\langle\theta_1|\phi_1\rangle \\
&=(\alpha_1 |\phi_1\rangle+\alpha_2 |\phi_2\rangle)(\alpha_1^*\langle\phi_1|\phi_1\rangle)\\
&=\alpha_1^{*}(\alpha_1 |\phi_1\rangle+\alpha_2 |\phi_2\rangle)
\end{align*}
which does not give us our required eigenvalue equation as both orthonormal bases are still present. Not really sure how to solve this, any help would be greatly appreciated.
Answer: The $\mid\phi_i\rangle$ in the eigenvalue equation are states to be determined, not some given basis states. The equation should look like this:
$$B\vert\psi\rangle=\varepsilon\vert\psi\rangle,$$
and you need to determine what the possible combinations of states $\vert\psi\rangle$ and eigenvalues $\varepsilon$ are which solve this equation. In this case you don't have to do all that much algebra, and instead notice that $\vert\theta_1\rangle$ itself is an obvious eigenstate of $B$ with eigenvalue $1$, and the state orthogonal to $\vert\theta_1\rangle$ is also an eigenstate with eigenvalue $0$. Since your Hilbert space is 2-dimensional, that's all the eigenstates you'll find.
Comment: Thanks! That makes sense. So basically a system does not inherently have a basis associated with it, rather the choice of observable determines what the useful basis vectors are?
Comment: Yes, that's correct.


Can I charge a 3.7V 150mAh LiPo battery from USB?

Question: Can't get a clear answer anywhere. Need to replace small batteries in small sports mp3 players. They had 150-190 mAh Li-Ion batteries. All I can find are Li-Po replacements. Can I charge those the same way as a small Li-Ion battery, from USB port or 0.5 A charger or do I really need a special charger for those?
Comment: To answer your question as it's written: yes you can charge them from USB. But you need to do so with the correct USB charger.
Comment: It sounds like you want to remove old Li-Ion batteries from mp3 players and replace them with Li-Po replacements that are the same capacity (150-190 mAh). That should work fine. The mp3 player must have a charger already built-in to charge the Li-Ion cells. The same charger will work fine with Li-Po. The charger will never know the difference and the Li-Po will be happy.
Comment: Special charger unfortunately since the termination voltage is slightly lower.
Comment: USB port is not a charger. USB port is for a power supply. The device with battery has internal charger.
Answer:
They had 150-190 mAh Li-Ion batteries. All I can find are Li-Po replacements.

What you call "Li-Po" IS a Li-ion cell. It's a pouch Li-ion cell, but a Li-ion cell nonetheless.

Can I charge those the same way as a small Li-Ion battery,

Yes, because it is a Li-ion cell.

from USB port or 0.5 A charger

From a charger, yes. Not directly from a USB port. You need a charger between the USB port and the cell.
Though, 0.5 A is too high for a 190 mAh Li-Ion cell. You should find a 0.1 A charger instead.
Answer: First, as people already noted, your "USB port" or "USB charger" are not Li-ion chargers, they are constant-voltage (5V) power supplies, maybe with some limitations. Your MP3 players, however, must have a built-in proper Li-Ion charger circuitry, so the type of power source does not matter much.
However, you need to seriously consider the VOLTAGE rating of your replacement. Li-Po stands for "Lithium Polymer", which refers to differences in mechanical construction and separation materials of the cell. But the exact chemistry might differ between your old cells and the new one. The old-fashion Li cells used to have charging voltage of 4.2 Volts, some modern one use 4.35V to reach maximum capacity. Some other Lithium families use max charging voltage as low as 3V. So if your new battery has lower max charging voltage rating, use it with higher-voltage chargers could pose a fire hazard for your devices.
If the voltage rating of the new cell is higher than for your old ones, the charging circuit in the player won't provide full charge to the new cell, so playtime might be less than expected.
On the last note, nominal cell capacity makes no difference whatsoever on charge process, the cell will be charged to max capacity automatically, because the charge termination in Li-Ion charging algorithm is based on low-current cut-off, which will occur sooner or later, proportionally to battery capacity.


How to edit a bone with a local axis?

Question: Coming from maya I'm a little bit confused with some rigging stuff in blender, got stuck on this one. Here i have a two bones finger, i have an armature axis display on, and want to move the head of the bone in the edit mode along the Y axis, so the finger stays straight, but the local grab orientation (and any over orientation) doesn't represent the armature axis orientation, what do i do wrong?
Comment: To move a bone in its local axes, rather than the armature's local axes, set orientation space to "normal".  "Local" **should** be armature local space, and if it's not, I can't explain that.
Comment: Yes you would expect to be able to move the bone's head or tail on its axis, that said you can create a custom transform orientation axis on the selected bone
Comment: @Nathan, yes it lacks logic here, but Normal works, you should answer
Answer: If you change to pose mode it uses the local axis to rotate the bone, then if you need the changes you did in pose mode in edit mode you can click on pose-> apply -> apply pose as rest pose (kinda the same thing as freeze transforms in maya). Also if you want to make the bone longer along the local axis you can change the length in edit mode transform menu.

How to edit a bone with a local axis?


Android Emulator Keyboard not displaying

Question: Just installed the android sdk on my macbook pro. I created a virtual device, allotted 50mb worth of memory in android 3.0. I ran the emulator, and Android_ displays on the left, but the keyboard interface does not display on the right. I have hw.keyboard.lid enabled. Not sure if that has anything to do with it.
Comment: What happens if you disable hw.keyboard.lid?
Answer: This is how to make emulator to show soft keyboard:
Device settings > Language and Input > Default > Hardware (Physical Keyboard) > set to Off.
Comment: Click on Default then Hardware window will appear.
Answer: You can also issue a command from the keyboard.
http://developer.android.com/guide/developing/tools/emulator.html
e.g.
Android  ==   PC Keyboard
Back Key == ESC
Menu     == Page-up
++++++++++++++++++++++++++++
the link is not there any more. there are more other descriptive answers here
Android emulator doesn't take keyboard input - SDK tools rev 20
Comment: The link is broken now.
Answer: Press CTRL+F11 or num pad 7 to enable an onscreen keyboard within the OS.  I don't think the 3.0 emulator has an equivalent keyboard interface the way the others do.
Answer: I just came across this problem and solved it - the default keyboard setting in the 3.0 image is set to the Japanese IME (which I'm assuming doesn't work landscape). Simply go into the settings and change it to the Android keyboard.
Answer: This works for me: I enable the "Hardware Keyboard Present" in the AVD definition. When the AVD boots up, the virtual keyboard doesn't come up in the device, but the computer's keyboard works. I then go to Settings -> Language and Input -> Keyboard and input methods -> Default. Here, I switch off the Hardware (Physical Keyboard) option. Now, both the virtual keyboard as well as the computer keyboard works -- best of both worlds.
But, as user850688 said, you have to do this everytime you boot up the AVD. If you don't want to do that, switch off the Hardware Keyboard Present setting in the AVD and you will always have the virtual keyboard, but you cannot use the computer keyboard at all.
Answer: yes, ctrl+f11 and num-7 bring up the soft keyboard. useful, but not as convenient for testing as the old side/emulator keyboard.
In the Android 3.0 SDK using v11 or higher a side-keyboard is apparently no longer available by default, presumably to better emulate that the devices are all touch-screens. An AVD based on the default WVGA800 tablet skin and any AVD based on a custom screen size will not have a side emulator keyboard for you to use, and I couldn't find which setting might turn it on. However...
I was able to get a side-keyboard (very very handy for dev+testing) by downloading some older skins from http://teavuihuang.com/android/ and creating AVDs based on these. Somehow this enables the emulator keyboard, through some file or setting which the AVD editor doesn't make available. The window sizes and emulator keyboard placement don't exactly line up, but it beats the heck out of nothing.
Seems like Google should have documented all of these intricacies at http://developer.android.com/guide/developing/devices/emulator.html, but they haven't.
Comment: It's ok to try to better emulate touch screen only devices, but what about the home and back button? I found out the back button functionality can be obtained by pressing the esc key, but what about the home button?
Comment: Home button is still the "Home" button on your PC's keyboard! :)
Answer: Just change AVD Device Features. You selected a specific Resolution eg. 240 X 360. Choose QVGA instead. Keyboard appears.
Answer: On the newer Android versions, you won't find it the AVD settings, you simply need to load the emulator normally and go to the Settings app, there you can choose to NOT use the hardware keyboard of your computer.
Answer: Yes,If you enter manual resolution in AVD it will not show keyboard just select any default resolution keyboard will start showing up
Comment: the default resolution wxga does not show the keyboard- which is what i wanted.
Answer: I don't know if this will be helpful, but in Android 4.0, even if you have the hardware keyboard emulation enabled, you can pull down the system menu at the top of the screen, and it should give you to option to turn the hardware keyboard off, enabling the virtual keyboard again. Curiously, I found that hardware keyboard emulation still works - best of both worlds!
Comment: This works well, but it seems to reset each time the emulator is reboot. does this happen with you.
Comment: I'm afraid I can't help with that one, @user850688 - since I posted this answer, we've found the emulator slow and unstable enough that we tend to debug with real devices.
Answer: you may try do this :
change default skin to with dynamic hardware controls  when you edit emulates
hopes to help you


Partial single photon reflection

Question: If I understood Feynman correctly, a single photon reflects with a chance determined by the added amplitude arrows of each surface it encounters. I'd still like to know how that is determined if the photon is already on its way back before it would reach the last surface, as he asked at 30:41.
Comment: A single photon is either absorbed or it's not. If not it will continue on its way. If it is absorbed it will be re-emitted in a Random directions. It takes millions of photons to average what we call a reflection.
Comment: Feynman was talking about [a single photon](https://www.youtube.com/watch?v=xNF_3KdpdrY&t=30m26s), though, with [an adjustable angle of reflection](https://www.youtube.com/watch?v=xNF_3KdpdrY&t=30m04s).
Comment: Single photon does not have an adjustable reflection angle. It can be emitted randomly in any direction.
Comment: @BillAlsept In a cavity, (the Feynman talk with the thin glass is a very low Q cavity), only certain electromagnetic modes are allowed. This changes the spontaneous emission rate(Purcell effect)  and also limits the directions that are allowed. If you want to look into it search Cavity Quantum Electrodynamics so in that sense the direction of emission doesn't have to be random.
Comment: Reflection is _not_ absorption followed by reemission.
Answer: I didn't take the time to watch that movie. However, a critical thing in qm is the measurement of a wave function. Once we measure a photon, the wave function collapses. Hence, the probability amplitude of all "points" which are not consistent with the measurement become zero.
Comment: So it can only reach the last surface when not already measured, but the last surface does affect the chance of measuring it. FTL effect?
Comment: Wave function collapse is purely interpretation and has no counterpart in the formalism of quantum theory.
Answer: I didn't go though the whole video, but looking at your comments, a couple of things that might help clear things up.
Feynamm was tilting the back surface of the glass so it wouldn't bounce directly back and fourth between the two parallel surfaces. He was just talking about that some so he could talk about only having a front surface refection going back to the photomultiplier near the light source.
In the case where the the two surfaces are parallel, you form a cavity. I don't think Feynman's vide talks about how a cavity can only support certain electromagnetic modes. The cavity formed by the two surfaces is not very good, but it is still a cavity...
The single photon when it encounters the cavity is only allowed to occupy the allowed modes. In this case the photon is weakly coupled to the cavity, but people work pretty hard to make very high finesse cavities where the surfaces are very reflective where the photon could be strongly coupled to the cavity and the effects can be very strong.
There is a branch of photonics called Cavity Quantum Electrodynamics where people study light matter interactions in cavities.
Purcell effect - changes the spontaneous emission rate of emitters in cavities
Rabi oscillations - changes in how many states in energy levels.
Cavities don't have to be mirrors, but can also be photonic crystals or Bragg reflectors, or grating etc.
But in any case, the main point is that you don't need to invoke FTL, or track the photon as it travels through the glass to reach the back surface if you think about it from a cavity QED point of view.
If the cavity is there then only certain modes are allowed, and the photon will interact with the allowed modes depending on the nature of the cavity. If the surfaces are moved apart or the reflectivity of the surfaces, then the allowed modes are changed. If the surface are very far apart compared to the wavelength of the photon then there is not enough coherence for a good cavity.
For a lot of cavity problems like making lasers you don't need the full CQED description and you can look at the Fabry-Perot cavity from an interference of waves.
More recently with the interest in quantum computing and quantum sensors there is a lot more interest in understanding the details.
Comment: A photon interfering with itself proves it's a wave, but how can it when the measurement is done before the final surface affects it? That would explain the double slit experiment.
Comment: I think part of the issue is that the photon is not just by itself, but it coupled to a larger system, and the math to describe that interaction is not easily worked out. So it is not obvious how it all fits together when you are just looking at the photon by itself in terms of the timing.  Most lectures and textbooks don't try to work out the double slit or these type of problems in ways where the coupling of the photon to the rest of the system. On the other hand for a lot of real world applications it dosen't matter that much.
Answer: Special relativity says spacetime is flat (1D) at light speed in vacuum, compressing the future (explaining how a photon reflects before it reaches the final surface) and expanding the past.

Partial single photon reflection


stdout and stderr ports in Rebol3?

Question: You can read bytes from system/ports/input, and if you convert them from BINARY! bytes to a STRING! of unicode codepoints you get something coherent:
>> to-string read system/ports/input
Hello
== "Hello^/"

But if you try writing to system/ports/output in Rebol3 you get:
>> write system/ports/output "World"
** Script error: write does not allow none! for its destination argument

The output port is a field in the object, but it's none.  Running an ordinary PRINT command that generates output doesn't make the field get set.  Where is it?
Also while on the topic, where is the stderr port?
Answer: Rebol3 Alpha has not completely implemented the standard output and standard error ports yet.

stdout and stderr ports in Rebol3?


Young Adult fantasy novel about the devil

Question: I've been looking for this series for a long time. The premise is there is this teenager who has supernatural abilities and he is persued by the Devil. Apparently the boy is some kind of gatekeeper in an ancient line and the Devil needs him to unlock the gate between earth and hell? The Devil can take over people's bodies and possesses the boy's friends to try and trick him. I don't remember a lot of the plot except small parts, like when he first learns of his ability he jumps like 100 feet into the air on a trampoline, or he goes for a run and ends up in the next town without realizing it. I think the Devil eventually enters his body when he has sex with a girl because you have to give the Devil consent to enter your body.
Comment: Do you have any idea of when this series came out?
Comment: This sounds more like a religious work than a fantasy novel. How did you come in contact with the book?
Comment: Thought it might have been Prince Ombra (great book) but the boy in that dodnt have any special powers like you describe
Answer: In The Gate Thief by Orson Scott Card, the second book of his Mither Mage series. Danny North has unusual powers. His family made up of beings that were once known as Odin and Thor and other "gods"  His ability to open the locked gates between worlds; A Great Gate Keeper. There is the scene in the book of him running and ending up in the next town and the evil entity possessing one of his female friends having sex with him to steal his power and get into him, if I remember correctly.
Answer: Might it be the Gatekeepers series (also known as The Power of Five)?
There are five books in the series: Raven's Gate, Evil Star, Nightrise, Necropolis, and Oblivion.
Series Summary:

The series focuses on five children: Matthew Freeman, Pedro, Scott
  Tyler, Jamie Tyler, and Scarlett Adams, a group of fifteen-year-old
  children (all five children turn fifteen in Necropolis) who are
  destined to defeat mystical entities known only as "the Old Ones" who
  ruled for a long period of time ten thousand years ago. Matt is the
  appointed leader. The Gatekeepers won in the past through allowing
  Sapling, the third Gatekeeper, to sacrifice himself; and upon
  Sapling's death, his future incarnation, Jamie Tyler, was sent into
  the past to reunite all the Gatekeepers and repair their strength to
  defeat the Old Ones. The Gatekeepers also won because the Old Ones do
  not understand Scarlett Adams' powers, and because they thought Inti,
  the second gatekeeper, wouldn't be able to make it to the battle as he
  was on the other side of the world (Inti goes through one of the
  twenty-five doorways for the five scattered across the world to make
  it on time). In the present day the Gatekeepers have been reincarnated
  as modern day teenagers because the Old Ones are about to escape the
  world they were sent to and rule over humanity a second time. The
  books focus on the modern day children trying to defeat the Old Ones
  again.

Bit of a longshot there. :P


How do I use the new "Ubuntu Font Family" in older releases?

Question: I want to use the new Ubuntu fonts that are default in Maverick in Lucid. Where to get it and how to install it?
Comment: Have you resolved this issue?
Answer: The Ubuntu Font Family packages are being inserted into order (still supported) releases of Ubuntu as they are released.  As of February 2011, those older releases are:

Ubuntu 10.10 Maverick
Ubuntu 10.04 LTS Lucid
Ubuntu 09.10 Karmic
Ubuntu 08.04 LTS Hardy

If you have software updates enabled then you should be able to select the package and install it from the Ubuntu Software Centre or using:

sudo apt-get install ttf-ubuntu-font-family

For more details on the process (or to help validate that new releases are suitable for backporting as Stable Release Updates), see:

bug #650889 Ubuntu Font Family would be valuable for older releases
bug #709980 SRU ubuntu-font-family 0.70.1 for all
Answer: Another source is http://font.ubuntu.com/.
Comment: For Ubuntu-based machines, please use the `ttf-ubuntu-font-family` packages in the archives.  Using the archive means that the package can automatically be updated with new features, bug-fixes, and expanded language/style coverage.
Comment: @sladen You may want to post that as a separate answer, rather than as a comment to this answer.


AC and DC signals

Question: If a AC+DC signal passes through a junction from where a capacitor is connected to ground and resistor is also connected from the same junction to the ground ,will the voltage measured across resistor and capacitor be same? IF yes then how?AC signal will pass through capacitor while dc signal through resistor...wont it make a difference?
Answer: An AC signal simply means that your signal level is changing sinusoidaly. In your situation Both AC and DC signal will flow through resistor and Only AC through capacitor. Due to AC signal in both componants current in them will vary in them such that the voltage across them remain constant. Consider input voltage as,
$$ V_i=a+bsinwt$$
$$ I_r =\frac{a+bsinwt}{R} $$
$$ V_c=C\frac{dV_i}{dt}=Cbcoswt$$
Therefore as these equation explained that current in both componants is different and hold it's value such that voltage across them remain input voltage.
Answer: From your description it sounds like you are looking at a resistor and capacitor in parallel with respect to a voltage source and that this voltage source can either be AC or DC. Correct this if my interpretation is wrong. Maybe something like this:

simulate this circuit – Schematic created using CircuitLab
It is important ot remember that anytime you hook anything up directly across a volage source, it must have the same electric potential across its pins. You can view this as you are effectively measuring the voltage across the terminals of the voltage source. Similarly, two devices that are connected in parallel both must be at the same potential (or have the same voltage) across their terminals. You can again view this as you are effectively measuring the voltage of the source.
My other interpretation of your question is that you are asking if both types of current flow are going through these two devices in parallel, will the voltage be the same? If this was your question then you need to realize that there are only two types of current flow and voltage sources cannot produce both (at least not at the same time). If a signal contains postive and negative voltages, then it is definitionally AC. If a signal contains only positive voltages, then it is definitionally DC. (These are slightly oversimplified but represent the effective definitions). Following this, either source signal (AC or DC) will have a voltage across it so any components must also have that potential.
For the future you should clarify your questions a little more.
Answer: Well it seems that you decribed a parallel RC circuit. The voltage will be the same. How? The components are in parallel. Please read about the superposition theorem:
Link for the superposition theorem
Basically, the current over the resistor will have an Ac+DC component, while the capacitor's current will have only the AC component, value is depending on the frequency of the AC signal and capacitance. Again, check for the superposition theorem and the calculation of impedance in AC circuits.
Answer: Yes. Whenever two circuit elements are connected in parallel, the potential difference across them will be the same.

how? AC signal will pass through capacitor while dc signal through resistor...wont it make a difference?

Because the capacitor can sustain a DC voltage across it without passing any current.
And a resistor can sustain an AC voltage across it while passing much less current than a capacitor (when \$C \gt\gt 1/\omega{}R\$).

AC and DC signals


Block Magento Site from specific countries

Question: How can I block specific countries accessing Magento 2 site?
Comment: please explain breifly
Answer: You can block access to specific countries either in .htaccess or free Magento extensions available

Find the reliable list of IP's for the country you want to block from IP2location
1: https://www.ip2location.com/free/visitor-blocker. Input the country name and generate the IP's list for the country you want to block. Open the .htaccess file and copy the code from downloaded file similar to the lines below
order deny,allow
deny from 220.127.116.11/23
deny from 18.104.22.168/32
deny from 184.108.40.206/32
allow from all

Save the changes and the IP's from these countries will be denied access to Magento store.

Else use this free extension to configure the countries to be blocked in the backend so the module does other work to restrict access for specific countries https://www.mageworx.com/geo-lock-magento2-extension.html
Comment: blocking countries in application or http web server is a bad idea, firewall is the proper place for this task.
Answer: Every country is assigned a range of IP addresses. You can allow or deny your website from being accessed from a specific IP or a list of IP addresses by using the .htaccess method.

Prepare the list of such ranges which you want to block by the help of https://www.countryipblocks.net/country_selection.php or https://www.ip2location.com/free/visitor-blocker or any other similar website.
Put the list in the .htaccess file of your website.
Restart the server to take the .htaccess changes effect.


How can I dynamically add a field to a class in C#

Question: Is there any way to add Field (or FieldInfo, maybe this is the same) to a class at runtime?
Comment: possible duplicate of [How do I create dynamic properties in C#?](http://stackoverflow.com/questions/947241/how-do-i-create-dynamic-properties-in-c)
Answer: You can't alter a class definition at runtime. However, you can create a new class that inherits from the original class (if it's not sealed) and declares the field. You can do this by emitting the appropriate IL code using System.Reflection.Emit.
Answer: No, C# doesn't allow monkey-patching.
You can generate new classes using either CodeDOM or Reflection.Emit, but you can't modify existing ones.
Comment: It's called monkey-patching? Where did that term originate?
Comment: Monkey patching is a term that comes from Ruby. Jeff Atwood wrote about it in a blog post a few years ago.
Comment: No idea where it comes from, but I've added a link to the Wikipedia entry.
Answer: C# does not allow it because all of it's classes are based on Metadata.  The CLR (not C#) disallows the adding of fields to metadata at runtime (1).  This is the only way that C# would be able to add a field at runitme.
This is unlike dynamic langauges such as IronPython which essentially don't have concrete metadata classes.  They have more dynamic structures which can be altereted at runtime.  I believe IronPython simply keeps it's members (fields and methods) in what amounts to a hashtable that can be easily altered at runtime.
In C# 3.0, your best resource is to use Reflection.Emit.  But this will generate an entirely new class vs. altering an existing one.
(1) There are certain APIs such as the profiling APIs or ENC that allow this but I'm not sure if their capabalities expand to adding fields.
Answer: See this question for a simple way to do it in C# 4.0, by casting an ExpandoObject as an IDictionary, which causes the values added to the dictionary to become properties of the object. I demonstrate this in another answer of mine showing that they actually become properties.
However, this is only possible with an instance of ExpandoObject or by sub-classing DynamicObject.
It may also be possible to use with other classes if they implement IDynamicMetaObjectProvider, but I think there is too much work involved to get it to work properly.
Answer: Not exactly.
However, you can implement ICustomTypeDescriptor to approximate it, and then just use a hashtable to store the fieldname/value pairs. A lot of the framework which uses reflection asks for ICustomTypeDescriptor first.
Comment: Thanks, I've tried this approach, but it doesnt work for me. I'm trying to impelment IExpando interface to allow javascript code calls unexisted fields in my C# class. For example,
var o = new ActiveXObject('mCom');
o.ArbitraryField = "Foo";
Please note that ArbitraryField doesnt exists at my class.
Comment: Have you just tried implementing IReflect? It's the way to implement IDispatch/IExpando for interop with dynamic languages (at least before C# 4.0). http://msdn.microsoft.com/en-us/library/system.reflection.ireflect.aspx

I've done this exact thing with a hashtable implementation and it works well
Answer: Not until C# 4.0 which adds dynamic lookup and is based on the CLR 4.0 which incorporates the DLR, and then it will not strictly be adding to a class, as classes won't be in the picture.
Comment: I wouldn't think this will be possible in C# 4.0. I think that you won't be able to alter existing types. However, I can imagine that you could create some dynamic object (e.g. coming from Ruby) and than alter it.
Comment: That's what I meant by "not strictly be adding to a class, as classes won't be in the picture". Rather, individual objects referenced by 'dynamic' will be able to accept assignment to a property that didn't previous exist, and deal with this by dynamically adding a property.
Answer: as others already said, this isn't possible. What is the reason for your question? If you need to store some additional data in the class dynamically, then you could probably just use dictionary:
class My {
   Dictionary<string, object> data;
   public My() { data = new Dictionary<string, object>(); }
}

.. but it really depends on what you actually want to achieve?
Comment: My aim is to implement IExpando interface. My super aim is to allow javascript code to add fields to ActiveX object dynamically and in "javascript way". For example,

var myobj = new ActiveXObject('server.object');
myobj.ArbitraryField = "something";

Please note taht ArbirtaryField doesnt exists
Answer: Perhaps you could use the Decorator pattern.
In object-oriented programming, the decorator pattern is a design pattern that allows behavior to be added to an individual object, either statically or dynamically, without affecting the behavior of other objects from the same class.
http://www.dofactory.com/Patterns/PatternDecorator.aspx


If a human is being sent to space in a rocket, does the seating angle matter?

Question: All manned spacecraft have had seats in an "on-back" angle for launch. What is the benefit of this seating position for a manned spacecraft launch?
Comment: The answers are fine, but the real benefit of tolerating high-g environment better is much better concentration which is critical for taking any manual actions in an emergency.
Answer: The human body tolerates G-forces best if they're perpendicular to the spine.
When you apply a G-force along the spine, the blood will gravitate towards the feet, leaving the head starved of blood, which induces loss of consciousness. Having the head at the lowest position helps to prevent these blackouts.
3G is tolerable even if you're facing down, by the way. The seating position in capsules is chosen to support the body during landing (the forces in reentry and landing are larger than during launch).
Comment: From wikipedia "The human body is better at surviving g-forces that are perpendicular to the spine. In general when the acceleration is forwards (subject essentially lying on their back, colloquially known as "eyeballs in"), a much higher tolerance is shown than when the acceleration is backwards (lying on their front, "eyeballs out") since blood vessels in the retina appear more sensitive in the latter direction."
Answer: Interestingly, the Soyuz capsule has seats that change orientation at landing time.
They are mounted appropriately for absorbing G-Loads the best at launch. Then seconds before landing, the seats change orientation to prepare for better shock absorption during landing.
Apollo's seats had shock absorbers for landing, and required certain depths for 'travel' which was an issue they had to consider when they designed the Skylab rescue Apollo for the worst case of a disabled Apollo at Skylab.  They would need to carry at least 4 people, (one pilot up, 3 down, more likely 2 up so they could work as a team and three down) which meant 2 rows of seats, which the travel requirement caused issues with making it all fit.
Answer: let us take the shuttle

"Space Shuttle (takeoff): 29 m/s2"

which means 29/9.8 $\approx$ 3g In such a case the force acting on the body would be tremendous, so if your seating position is in the opposite direction, the force is strong enough to crush your ribs (chest) and the broken bones from the ribs can even penetrate leading to death or it can cause breathing problem and even cardiac attack.
If the seating is "on-back" angle for launch much of the force during the acceleration would be transferred to your back side of the body to the chair so less force is felt by your heart.
Comment: Fast-jet pilots pull 9g in a more-or-less vertical seats. 3g will not crush your ribs.
Comment: @Florian, there is no jet that can provide anywhere near 9g acceleration from the engine. Acceleration from the wing is vertical.
Comment: @FlorianCastellane the 9g comes from lift from the wings in tight turns. Some jets can 'stand on their tails' - i.e. they can provide 1g of thrust, but the force due to turning is much higher.
Comment: An alternative way to put it would be to say a 70kilogram astronaut would encounter the exertion of carrying an extra 140kilograms (+;
Comment: @PeteKirkham while jet seats are vertical, jets don't usually accelerate up. the engine provides thrust _forward_, hence the seat is faced forward for the same reasons. presumably that 9g acceleration vector would not push along the pilot's spine.


What can be done in this video to solve "the air-conditioning problem"?

Question: This lecture seems to have been filmed in a classroom with ar conditioning.  I can see the professor is using a microphone that's very close to his mouth.  I would like to also record lectures like that, but I think the sound result is very poor and I'd like to do anything I can do to resolve this.  What could be done?  Would buying a much better microphone really produce a much better result?  Can you recommend all the necessary equipment so that I try it out?  I'm willing to invest a good deal of money in the equipment.
Answer: The audio on this video isn't from the mic around his neck.
It's from a mic much further away. I would guess the wrong input was selected when the video was filmed. The main noise on the audio is electrical interference because it's a cheap mic in a laptop or phone.
Any radio mic or clip mic around the neck should work better than what we hear in this clip. Sennheiser make good expensive reliable radio mics. Rode make some cheaper clever rechargeable models. Even a £10 clip mic plugged into an iPhone in airplane mode and recording into the Voice Memo app can give good results in a situation like this, if you're prepared to re-sync the audio and video afterwards.
Comment: Thank you so much for your experience on this.  I did not notice what you did.


Creating Package of Bucketed Sitecore Items

Question: Recently I faced an issue in my project. I have to migrate few Sitecore items from one environment to another by creating package of them. But the issue is that few of the Sitecore items are Bucketed. I tried to search on google but could not get a proper solution? So is it possible to create package of Bucketed items. If it is possible, please tell me how it can be achieved. Or is there any other work around of how can I migrate Bucketed items from one instance to another.
Answer: As mentioned by our Climber, you can create the package just as with normal items.
But if you don't want the entire bucket and have no idea where to look, you could use the "Items dynamically" option when inserting items in the Package Designer.
You will be asked for a root item (your bucket) and then there are several options to search for items to include in your package. This can be a regular search, or based on the creation/modification date, ...
After you have set all parameters you can verify the result by clicking on the created "source". This will open a new tab in the Package Designer (called Source) and has the option to review your search parameters, set install options, but also to preview the result (which is nice to check if your parameters are correct).

Remember that if you need to package new items, you probably also need the parent items (in this case the 'invisible' folders created in the bucket)..
Answer: You have to create package with bucket items, in the same way like normal items.

You need to create package with the parent item (the bucket)
You need to choose Add with Subitems

When you open generated zip files you will see all bucketable items serialized.


Conservation of angular momentum in a linearly accelerated particle

Question: The angular momentum of a linearly accelerated particle in an inertial systems in which the line of motion passes through the origin is $\vec{L}=m\vec{r}\times\vec{v}=0$. But if I move my system of coordinates  a distance $d$ in a direction perpendicular to the line of motion then I have $L=dv$, or $\dot{L}=da$. So angular momentum is conserved in one inertial system but not in another. Am I wrong on something?
Answer: It's an interesting observation but it should not worry you too much.
The general rule is that if there is acceleration then a force is acting so we do not in general expect angular momentum to be constant. But, as in your example, one can find an accelerated motion where the angular momentum about one particular axis is constant.
My answer consists in saying that this is ok, and it is also ok that in this example the angular momentum about some other axis is not constant. After all, for circular motion at constant speed one also has constant angular momentum about the centre of the circle, but not about some other place.
A somewhat related fact is that a motion which conserves kinetic energy in one inertial reference frame does not necessarily conserve kinetic energy in all reference frames (e.g. circular motion in one frame).
Comment: Damn, you are right, for some reason I religiously believed this not to be possible.


Why does an increase in temperature lead to an increase in dipole oscillation?

Question: As far as I know, heat radiation is caused by the electromagnetic waves produced by the permanent or induced dipoles of the heated material. The higher the heat, the higher the frequency of oscillation and as such, the higher the frequency of the electromagnetic waves. My question is, why do the molecules oscillate at a higher frequency when exposed to higher temperatures?
Comment: Are you familiar with [Equipartition theorem](https://en.wikipedia.org/wiki/Equipartition_theorem)? Temperature is essentially the measure of how much vibration the molecule is showing (in this case)
Comment: No, not familiar with this theorem, but I will check it out @Cryo, thanks
Answer: Temperature is, at least in classical mechanics (to the best of my knowledge), an emergent property of all the particles in a substance defined by the average random kinetic energy of the particles in the substance.
A temperature increase, then, can be taken as a direct indication that the random kinetic energy of the particles, which relates to the energy with which the particles oscillate, has increased. If the particles are oscillating with greater energy, it is implied that any individual particle is oscillating at a higher frequency (provided you take that particle to be a simple harmonic oscillator).
The equation that relates the oscillating "angular speed" $\omega$ of a simple harmonic oscillator (i.e. a given molecule) to its energy of oscillation is $$E = \frac{1}{2}m\omega^2 x_0^2$$ where $x_0$ is the amplitude (max. displacement) of oscillation, and $m$ is the oscillator's mass. The mass of the oscillator will not (appreciably) change when it oscillates with more energy, as nothing is really happening to the molecule. $x_0$ will not change significantly, given that the molecule is surrounded by neighbors in some larger structure, like a solid or liquid. As such, the only element of its oscillation that can change is $\omega (= 2\pi f)$ - its angular speed (proportional to its frequency) - such that it oscillates faster.


Sitecore JSS how to get media library item directly

Question: In Sitecore JSS, how can we refer a media item in the front end?(image ,pdf file etc)
Can we use Layout Service? Any other way?
Comment: The Layout service can be used on items for which presentation details (components) defined. To access Media Items directly, you can use the ItemService.
Answer: There are multiple ways to accomplish this but purely based on your requirement. If you are looking for any image which is part of your web page, I would recommend you to upload the image in media library but refer the same in your page item using an Image field for ex. sampleField. From layout service you could able to access this image field and render in JSS app,
import { Image } from '@sitecore-jss/sitecore-jss-react';
const TestImage = (props) => (
  <Image media={props.fields.sampleField} />
);
export default TestImage;

Other ways are using Item Service or GraphQL where you no need to worry about your Layout Service or Page Item. You can directly access any media folder/item using Item Service or GraphQL and render wherever you want.
Also you can consider customizing the Layout Service for your need, but it's up to you to pick a right approach for your need.


External Id - Make unsearchable

Question: I want to make the external Id field to be unsearchable from the global serach or sidebar search. Is it possible? If so how?
Answer: External Id is a property on any field that can be marked to represent an external id. So as long as that field is searchable and marked as External Id, it will still be enabled to be searched. So as far as I can say there's no way to hide that from search results.
Refer below excerpt from this knowledge article

Additionally, if you have an external ID field, the field becomes searchable in the sidebar search.

Further from the documentation for Searchable Fields by Object in Lightning Experience and Searchable Fields: Custom Object for Salesforce Classic, refer to below excerpt.

All custom auto-number fields and custom fields that are set as an external ID (no need to enter leading zeros)

External Id - Make unsearchable


Move people search to list page

Question: Is there a way or module that allows me to move the search tab of the People page to the List tab?
Answer: https://www.drupal.org/project/admin_views makes the users and content page a lot friendlier. On of the things it does is putting a search field on the users page.
One of the modules I use on every project.

Move people search to list page


Why is there no current flow when I connect two opposite terminals of two separate batteries?

Question: I don't understand this..maybe there is something wrong with my understanding of battery or electricity.
I am learning about electricity more deeply this time. So please bear with me.
So lets begin with what I know:

follow of current occurs when there is voltage drop.
voltage drop happens when there is imbalance in charge.
a battery is basically two separated chemicals. One side with
electrons to spare and other side that needs electron to balance
itself. which is imbalance in charge.
When both sides are connected + side snatches electrons
from - side. (And if there is a medium, conductor, then first electrons are taken from conductor
that in turn snatches from - side, which not being able to keep electrons
lose them and give up those electrons, we label it as excessive.)

The analogy i was taught with used marbles in pipe... When one side has excessive marbles And this pipe is connected to other side that has no marbles the marbles will instantaneously start falling out so even though marbles from container with excessive marbles haven't traveled there yet, they still start falling because filled side marbles are pushing marbles in pipe and which in turn push the last marbles in pipe out.
1st, Aren't electrons pulled by atoms that can use more electrons, and not move because one side is overfilled with electrons so they can't wait to push some out.
Questions:

if I connect a conductor to positive side of a battery, shouldn't it
make all electrons/marbles fall into empty container as empty
container will pull marbles as atoms need electrons?
if I connect two batteries' only opposite sides to each other shouldn't
they drain (balance the each other out, cancelling all - &
+ charges)?
Comment: Have a look at this http://www.zbattery.com/Connecting-Batteries-in-Series-or-Parallel
Comment: Do you mean something like http://physics.stackexchange.com/questions/76361/why-does-shorting-two-cells-in-series-heat-them-up  ? Current does flow in this case.
Comment: @user80551 no in that circuit is closed i meant if you just take 2 batteries and touch them together with 1 terminals only.
Answer: There exists a similar question here.
This description of a voltaic battery solves the conundrum which the question raises:

If one connects  the + and - of the same battery with no resistance, one shorts and discharges it anomalously. There should always be a resistance ( the lamp in the drawing) on the same battery.It is clear in the diagram that a chemical path exists, a current of ions that closes the circuit and current flows.
A chemical circuit has to be closed for  current to flow. Two different batteries have two different chemical flows . Electrons that might leave the anode to go to the cathode  of the other battery cannot close the chemical  circuit of the parent cell because the ions have no reason to move as no charge  has gone to the copper cathode of the original cell. At the same time the second cell is at the same fix , as no chemical circuit is closed there too, no charge has left the zinc anode, no motion of ions possible.
Comment: :Could you tell whether we could get current by connecting a wire through an electrolyte so that electrons from the electrolyte goes to the protons in the electrolyte as said in the [video](https://www.youtube.com/watch?v=IpaEGhjpZgc).
Comment: Yes, it is correct, it is a temporary current. I do not like the continuation, which glosses over what the diagram in my answer shows. A complete mix they are showing will discharge the battery.
Comment: :Could you tell how does an electrolyte provides an continuous current.That's where I'm stuck.
Comment: please read this discussion http://hyperphysics.phy-astr.gsu.edu/hbase/chemical/electrochem.html#c2
Comment: :I really couldn't get this sentence:"In order for the voltaic cell to continue to produce an external electric current, there must be a movement of the sulfate ions in solution from the right to the left to balance the electron flow in the external circuit. ".Could you help me.
Comment: The sulfate ions carry the negative charge in the solution, the electrons in the metal.Notice the -2over the SO2  in the drawing  in the answer. charge is conserved all around
Comment: :Okay.Does this process goes on for ever or does it stop anytime?
Comment: It stops when the solutions become saturated with zink on one side and all the copper depleted, just SO2 on the other, then the battery is discharged and has to be charged again.
Comment: :Could you tell how does copper gets depleted.I think copper ($Cu(s)$) actually gets deposited on copper rode after it ($Cu^{2+}$) accepts electrons from zinc.
Comment: @justin  I mean that it is depleted from the solution , it becomes a part of the solid,
Comment: :Oh sorry about that.Could you tell whether an electron can _flow_ from zinc to copper through a wire  **without**  an electrolyte.I would like to know whether  the **electrolyte** is responsible for turning $Zn(s)$ into $Zn^{2+}$ ions.
Comment: @justin if you read the explanation you will see that the electrolyte is necessar "placing zinc and copper metal in solutions of their salts can cause electrons to flow through an external wire which leads from the zinc to the copper. " Just copper and zinc are neutral and there is no force to make electrons move. http://hyperphysics.phy-astr.gsu.edu/hbase/chemical/electrochem.html#c2 . A chemical reaction takes place.
Comment: :Yeah that's truely right.
Comment: :Can we use _water_ as an electrolyte for the zinc and copper reaction?Also as you said [here](http://physics.stackexchange.com/questions/91768/why-is-there-no-current-flow-when-i-connect-two-opposite-terminals-of-two-separa/91795?noredirect=1#comment551598_91795) could you tell whether it's $SO_4$ or $ZnSO_4$ on the other side of _copper_?Using _only_ zinc rod,$ZnSO_4$ and $CuSO_4$ can we get the same reaction that we get when use zinc rod,$ZnSO_4$ and $CuSO_4$ and _copper_ rode?I thinks there's **no** need of using a  _copper_ rode since copper only gets _deposited_.
Comment: @justin if the  copper is not deposited the SO4 will not carry a charge(-2), read the diagram, it shows how ball is played with the charges and the copper and zink . There can be other electrolytes, but not randomly guessed. The chemistry has to work. .
Comment: :Do you mean to say that if  the _copper_ gets deposited in the $CuSO_4$ solution _rather_ than getting deposited at the _copper_ rode the chemical reaction wouldn't take place.I would like to know whether the electrons from zinc could be transferred to the $CuSO_4$ solution _instead_ of depositing them on the _copper_ rode so that the $Cu_{2+}$(aq) ions could accept these electrons and turn $Cu$(s) in the  $CuSO_4$ solution _itself_  instead of getting deposited on the _copper_ rode?
Comment: @justin I cannot teach chemistry. The way the chemical reaction works has been utilized in the set up of the battery. There is no if about the way the energetics of chemical reactions go.
Comment: :Oh sorry about that.Could you tell whether $Cu_{2+}(aq)$ has a greater affinity for $Cu(s)$ rod than for $CuSO_4$ solution?
Comment: @justin  I am sorry, no, although I can guess since copper containers were popular before stainless steel that not much copper is dissolved in water.
Comment: :No problem.Since copper _doesn't_ get too much dissolved in water is it better to deposit copper in water than depositing it on a copper rod?
Comment: @justin I do not understand you question. The whole point of an electrolyte that can deposit on coppe and dissolve from zink is the carrying of charge as seen in the diagram. This cannot happen with water. Bye Bye
Comment: :Oh sorry I meant to say about $CuSO_4(aq)$ solution rather than water.Could you now help me.
Comment: @justin  I still do not understand the question . The diagram says it all. Better find a chemistry question and answer site.  I do not know enough chemistry to answer further
Comment: :Oh that's no problem.I'll ask it [here](http://www.madsci.org/).A great site indeed for any science questions.
Comment: The Cu2+ ions stay on the right side of the cell they are not permeable through the membrane only sulfate is. Some people use 2 separate jars with a salt bridge (KNO3) instead of a semipermeable membrane. The electrolyte is typically non-conductive so the electrons cannot flow through it, they have to flow through the external circuit.
Comment: If Cu2+ ions were at the zinc anode yes they may be reduced and the energy would then not be used as electricity instead it would be released as heat.It is important to use electrolytes that do not undergo oxidation or reduction at the anode or cathode or a full redox rxn will occur at the terminal instead of a half one
Comment: :Could you tell why we use electrolyte?I'm really confused where the oxidation,reduction etc takes place.To be honest I know that the flow of electrons(from zinc metal) are produced by the attraction of electrons towards the protons(copper metal) as seen in this [video](https://www.youtube.com/watch?v=IpaEGhjpZgc).I can't get why do we need an extra potential to make the current flow and why do we use an electrolyte that has no role in flow of electrons.Could you help me.
Comment: @justin  electrolyte provides charge mobility,  in the link provided: "As a zinc atom provides the electrons, it becomes a positive ion and goes into aqueous solution, decreasing the mass of the zinc electrode. On the copper side, the two electrons received allow it to convert a copper ion from solution into an uncharged copper atom which deposits on the copper electrode, increasing its mass."
Comment: :Sorry but I couldn't get how electrolyte provides charge mobility.Do you mean to say that due to the potential difference in the electrolyte,electrons get an energy to move from zinc rod to copper rode through the wire?
Comment: look at the diagrams, the electrolytes have electrons and ions that provide the current in the electrolyte and exchange copper and zinc
Comment: :Yeah I could see that to obey the principle of [electroneutrality](http://www.chem1.com/acad/webtext/elchem/ec1.html#ENEUT) the $Zn^{2+}$ ions are attracted by the $SO_4{2-}$ ions.Could you tell why does zinc losses two of it's electrons?
Comment: @justin It is the effective potentials from the various bonds. It is not my field, but when energy exchanges happen it means that there are lower energy states for the ions and electrons to occupy which appear when the  circuit is closed.
Answer: It's common for almost all analogies to break down at some point when the phenomenon is understood at a deep enough level.  In the very old days indeed electricity was thought of as a fluid and a concept of 'pressure' and 'flow' was used.  However electrons are not marbles.  Most commonly they move because they are in an electric field, not because anything is bumping into them.  Now to answer your 2 questions it is simpler to understand a battery as a thing that exerts a potential difference (voltage) between the 2 terminals.  The gradient (derivative) of the voltage is proportional to electric field:

If you connect a conductor to a battery terminal the conductor becomes the same potential as the battery terminal, and the potential difference becomes 0, so there is no electric field.
If you connect the - terminal of a battery to the + terminal of another battery, the contacts will be at the same potential (because they are conductors).  Then the potential difference between the 2 contacts is 0 and again there is no electric field.
Comment: about 2, why is potential energy zero when side has excessive and other side lacks electrons. Why there is no potential here.
Answer: Under the scenario you presented, all you've done is made a bigger battery.  Which is just sitting there, so there is no current flow.  If you open up a standard 9 volt rectangular battery you will find six 1.5 volt cells connected in series, i.e. exactly as you described.


Visual Studio: default settings

Question: We have many developers here using MSVC 2008 and I want to standardize the Visual Studio settings and project setup.
In particular, I want:
1) All of the settings in the Tools -> Options to be the same (especially the tab settings!)
2) We have a source repository where we have a shared folder. The shared folder has header files/code that we re-use in multiple solutions (.sln) developed by different people. I want all new VC project created to automatically include (/I) the directories and link to the shared .lib/dll in that shared folder. (Note: this process has become so un-necessarily labor-intensive where each time we create a new solution, we have to re-type these include/lib names over and over)
Could someone please save us and point us to the right solution?
Answer: For #1, you can easily set up one Visual Studio environment, and then use the Import/Export Settings (under the Tools menu) to save a settings file that can be loaded into everyone's environment.
For #2, you could try creating a project template, so that whenever someone created a new project, they could use that template and it would include those items automatically.
Answer: For tab settings and whatnot, you can use the Tools -> Import and Export Settings to create a standard settings file that you could check into source control.  Any new developers could pull that and import it into their Visual Studio settings.
Answer: For 1 a novel approach would be to use Microsoft's Live Mesh Sync VS Settings with Live Mesh. It would be an easy way to keep all your developers using the same VS settings, although I could see that causing problems once individuals start customising to their own tastes.

Visual Studio: default settings


Why did Rick not want to go with Aaron?

Question: I watched The Distance (S05E11) but I just don't understand why didn't he want to go somewhere where he might get to stay instead of worrying Judith would attract the zombies?
Comment: Well, have you watched the rest of the series? If so, you'd know by now the survivors, and Rick in particular, are wary of seemingly benevolent strangers offering shelter. See: Terminus, Woodbury, etc.
Comment: @HDE226868 They're referring to S05E11 - *The Distance*.
Comment: Remember when Terminus seemed like a good idea?
Comment: Which episode did you just watch?
Answer: Ideally, Rick did want to go with Aaron - but theirs is not an ideal world. Past experiences have taught Rick and the group to not trust strangers - especially ones who belong to groups - even those promising sanctuary. Consider the major groups that they've come in contact with thus far in the show:

the nursing home group in Atlanta: not terrible, but they were ready to kill members of Rick's group.
the Greene family: this worked out ok.
The prisoners:  betrayed and tried to kill them
Woodbury & the Governor: destroyed the prison, killed Herschel, Axel, responsible for the death of Andrea, tried to kill Glenn. The governor killed many of his own people.
Tyrese, Sasha, et al: this turned out ok.
Abraham, Eugene, Rosalita: this has turned out ok aside from Eugene lying to everyone about DC
Terminus/The Hunters: Killed Bob, wanted to kill/eat the group.
The Claimers: tried to rape Carl, wanted to kill Rick
The Hospital Cops: kidnapped & killed Beth

Rick and the group would love to believe that Aaron would take them to a safe zone, but they're wary of anything strangers tell them, and will naturally distrust newcomers until they have proven themselves.

Why did Rick not want to go with Aaron?


(Python) Send structured packet over network

Question: i want to build a chat application which supports text messaging, group messaging, file transfer(like netmeeting). when i send it over TCP socket i saw that data is not structured all the data send as string over TCP. I want to send it in a structured way with few headers like name:,ip:,data:,data_type_flag:(file or text message) etc... one stackoverflow  member told me to use TELEPATHY but i can't get a simple tutorial to understand. how can i send structured data over socket? or can any one suggest me a good tutorial to implement telepathy properly. i want to communicate over network as peer-to-peer rather than dedicated server.. Thanks
Comment: what about this http://raphael.slinckx.net/files/telepathy-guadec-2007.pdf ?
Answer: Try google protcol buffers or apache thrift. There are many examples for how to use them.
As for your comment about "peer to peer", please realize that even in peer-to-peer one of the peers is always acting as a server (sometimes both are).
Answer: TCP is a transport layer protocol, as opposed to application layer. This means that TCP is not responsible for the types of data you send, only the raw bits. HTTP has headers and other metadata because it is application level.
For a project like the one you're talking about, you will want to implement your own application layer protocol, but this is not exactly a trivial task. I would look at the python source code in the httplib module for an example of how to implement such a protocol, but note that this is likely fairly different still from what you want, as you will want persistent socket connections to be a first-class citizen in a peer-to-peer chat protocol like the one you're describing.
Another option is to use one of the various RPC libraries, eg xmlrpclib, which will handle a decent amount of the required low-level network things for you (although not file transfer; there are other libraries like the ftplib that can do this).
Answer: Pickle your data before you send it, and unpickle it on the other end?
http://docs.python.org/library/pickle.html
Comment: Super dependent on the version of Python.