How get the mint price from contract and max supply not total supply

Question: I wanted to get the Mint price from nft i tried getting it from abi but it's not effective since different contracts has different names for it so how can i find the set mint price from contract in pure.js or is there any api for it. and lastly how to find the max supply like not the total supply which is minted amount 222/3000 in here i want to get the 3000 which is max supply, thanks
Answer: There aren't any standards (at least any that would be in use) for setting the mint price. So everyone implements it in their own way. Therefore there is no universal way to retrieve it - and many contract don't have a mint price at all.
The same goes for max supply: there is no way to programmatically know what is the max supply (unless there is an explicit variable for it and you can trust it). You would have to manually analyze the contract to see if it has some max supply.
Comment: i'm creating a platform where anyone can come and mint by pasting the contract but it's a must to show what's the mint price unless they will put a desired price they want and might fail?
Comment: Well you can simulate the transactions to see if it would fail with the given mint price. Check your used library's documentation for more information.
Answer: Unfortunately, like Lauri said in prev post, there is no one standard or even any commonly used pattern.
The only solution I can think about here is to pre-approve contracts in your application with checked and set proper function calls for every contract and show only those pre-approved contracts for your users in the application.


Recovering GRUB after installing Windows 7?

Question:
Possible Duplicate:
How can I repair GRUB? (How to get Ubuntu back after installing Windows?)

I installed Windows 7 after it crashed, and now I am unable to boot Ubuntu. Ubuntu partitions are still there. I tried using Boot-Repair, but it didn't work!
Comment: You can simply use Ubuntu CD itself. Read through http://askubuntu.com/a/6321/22272 as it is already answered there.
Answer: You can re-install grub in the Master Boot Record using the LiveCD for you distribution version,
It goes like this:

Boot from LiveCD ⋯ please try to use a LiveCD that has the same version of Grub2 as the installed version
Mount the root of the installed Ubuntu at /mnt
Change root
Update grub
Install grub
Reboot

The above steps are from near the bottom of the Ubuntu Community Documentation of Grub2
After booting from the liveCD ( select "Try Ubuntu" on the opening screen)
Then start up a terminal (dash, type-in terminal, … )…

It may be easier to open this web page while running LiveCD.  Firefox should allow you  to do this.

Type in the terminal sudo fdisk -l - and enter your password if asked.  That's a lower case L. Find the installed Ubuntu partitions, (from mine with other disks snipped ― here):
me@mycomputer:~$sudo fdisk -l
...
Disk /dev/sde: 300.1 GB, 300089646592 bytes
255 heads, 63 sectors/track, 36483 cylinders, total 586112591 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xc3f5ebeb

Device    Boot      Start         End      Blocks   Id  System
/dev/sde2       138464296   586110975   223823340    5  Extended
/dev/sde3   *        2048   138463231    69230592   83  Linux
/dev/sde5       138464298   313460279    87497991    7  HPFS/NTFS/exFAT
/dev/sde6       313460736   317650943     2095104   82  Linux swap / Solaris
/dev/sde7       317652992   581922815   132134912   83  Linux
/dev/sde8       581924864   586110975     2093056   82  Linux swap / Solaris

Partition table entries are not in disk order

Find your Linux installation (Id=83, System=Linux0 then type in
sudo mount /dev/sde3 /mnt

but use your partition instead of /dev/sde3(my root partition is sde3, sde7 is my home partition).
This is assuming that you do not have a separate /boot partition.  If you do, you will need to also mount it by typing
sudo mount /dev/sd·· /mnt/boot

where sd·· is the partition where you installed the separate boot directory.
ls /mnt - just checking to see if I got it right:
me@mycomputer:~$ sudo mount /dev/sde3 /mnt
me@mycomputer:~$ ls /mnt
bin   cdrom  etc   initrd.img      lib         media  opt   root  sbin     srv  tmp  var      vmlinuz.old
boot  dev    home  initrd.img.old  lost+found  mnt    proc  run   selinux  sys  usr  vmlinuz

You should test to see if the boot directory is properly installed.  Type in ls /mnt/boot and if it is empty, the boot directory is not installed.  It should look something like this:
me@mycomputer:~$ ls /boot
abi-2.6.35-30-generic     initrd.img-2.6.35-30-generic  System.map-2.6.35-31-generic
abi-2.6.35-31-generic     initrd.img-2.6.35-31-generic  vmcoreinfo-2.6.35-30-generic
config-2.6.35-30-generic  memtest86+.bin                vmcoreinfo-2.6.35-31-generic
config-2.6.35-31-generic  memtest86+_multiboot.bin      vmlinuz-2.6.35-30-generic
grub                      System.map-2.6.35-30-generic  vmlinuz-2.6.35-31-generic

Then:
for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
sudo chroot /mnt #change the root
sudo update-grub # now update grub

Example:
me@mycomputer:~$ sudo for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
me@mycomputer:~$ sudo chroot /mnt
me@mycomputer:~$ sudo update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.0.0-13-generic
Found initrd image: /boot/initrd.img-3.0.0-13-generic
Found linux image: /boot/vmlinuz-3.0.0-12-generic
Found initrd image: /boot/initrd.img-3.0.0-12-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Microsoft Windows XP Professional on /dev/sdc1
done

Now to re-install grub in the MBR.  You will need to know which disk your system boots from, and find it in the fdisk -l listing you have already done.  Then type in sudo grub-install /dev/sd replacing sd· with the disk you will boot from.
me@mycomputer:~$ sudo grub-install /dev/sd·

Then type in Crtl-D to exit chroot.
Then type in sudo for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done - as one line
me@mycomputer:~$ sudo for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done

If you mounted a separate /boot partition, type in sudo umount /mnt/boot
me@mycomputer:~$ sudo umount /mnt/boot

Then type in sudo umount /mnt
me@mycomputer:~$ sudo umount /mnt

Then type in sudo reboot to restart he system (remember to remove the LiveCD).
me@mycomputer:~$ sudo reboot

Hopefully, grub will be installed.
Comment: I just installed Win7 for a friend and had to this.  Thanks to askubuntu, I didn't have to try to remember.  Yea! askubuntu.
Comment: Worked great, thanks! Just a note, I didn't bother with all the `umount`ing at the end -- ubuntu automatically unmounts filesystems on shutdown. So I just did a `sudo reboot` and everything worked fine.
Comment: You also need to mount the EFI partition for modern installations. `sudo mount /dev/ /mnt/boot/efi`
Comment: Ah, so those for loops of commands are necessary so that we can run chroot /mnt and work safely inside a chroot jail. Nice.  All worked for me.
Comment: CyberEd's comment is correct, otherwise will get the error `grub-install: error: cannot find EFI directory.`
Answer: Try this...
To recover grub:

Open the live version.
Open the terminal and run sudo fdisk -l to see where Linux is installed.
Run sudo mount /dev/sdaX /mnt where x is the number you have found Linux word in
Run sudo grub-install --root-directory=/mnt /dev/sda to install grub.
Run sudo update-grub to update grub and if this command didn't work run it after rebooting.
Reboot.
Comment: You saved my life... The --root-directory was just ehat I needed
Comment: +1 very short and quick solution. It worked great.
Comment: @user145959 as i said if you have errors you can run this command after restarting.
Comment: Still works, for Ubuntu 16.04 and Windows 7
Comment: I have problem in step 5. May you explain more? I get this `usr/sbin/grub-probe: error: faild to get canonical path of 'aufs `
Comment: That works, in my case was Ubuntu 18.04 and Windows 7 Ultimate. The `sudo update-grub` didn't work for me even after rebooting. Grub worked fine though, thanks a lot for this solution.
Comment: Worked for me after Manjaro Architect installer installed everything *except* grub. I skipped step 5.
Comment: @BlackBlock.. the perfect procedure in simplest way... should be marked as accepted answer. Cheers bro
Answer: Boot-Repair is a simple tool to repair frequent boot issues you may encounter in Ubuntu like when you can't boot Ubuntu after installing Windows or another Linux distribution, or when you can't boot Windows after installing Ubuntu, or when GRUB is not displayed anymore, some upgrade breaks GRUB, etc.

Remark: this can also be performed from a live-CD or live-USB.
Either add 'ppa:yannubuntu/boot-repair' to your Software Sources via the Software Centre or, for speeds-sake, add it using a new Terminal session:
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update
sudo apt-get install -y boot-repair && boot-repair

Boot-Repair can be installed & used from any Ubuntu session (normal session, or live-CD, or live-USB). PPA packages are available for Ubuntu 10.04, 10.10, 11.04, 11.10, 12.04 and 12.10.
source
Comment: did not work on 64-bit ubuntu CD - used grub install method instead
Answer: After installing Windows 7, Windows bootloader has overridden the MBR.
To fix this you can install a program 'EasyBCD' in Windows
Follow these steps to restore GRUB when after installing EasyBCD:

Launch the program and select ADD NEW ENTRY from the EasyBCD Toolbox
Select the 'Linux/BSD' from the operating systems column
Choose GRUB (Legacy) under type and Click on the ADD ENTRY icon
Choose YES to the restart prompt
GRUB will be displayed after the restart which will detect the Ubuntu partition for you to be able to boot into Ubuntu

GOOD LUCK
Download link: http://neosmart.net/download.php?id=1
Comment: I tried EasyBCD and it did what I wanted. After I reinstalled win7, I lost access to grub. With EasyBCD, I was able to boot Linux to restore my original grub via update-grub2 and then grub-install /dev/sda.
Answer: Boot-Repair works:

I had Windows XP and Ubuntu on my PC.
I installed Windows 7 which resulted in new boot loader without Ubuntu.
I installed Boot-Repair with the startup disc and GRUB was updated along with Windows 7 and Windows XP.
Answer: One nuance to be careful about - the instructions say to check if you have a separate boot partition, and if so then do sudo mount /dev/sd·· /mnt/boot. I got confused here - I did have a boot partition that was not my Linux, it was my base partition (/sda0). So I did that command, and ended up getting a grub menu that only showed my Windows boot. I re-ran the procedure without the doing the sudo mount /dev/sd·· /mnt/boot and it worked beautifully - my old GRUB menu was back, with all the Linux options as well as Windows. The instructions are only referring to a separate Linux boot partition, not for the case where your boot partition is not Linux.


How to expose a client's real IP address?

Question: As a forum administrator, how can I find a client's real IP address? Are there any third party tools or weakness that expose the real IP address?
Answer: If you run the forum software, then you implicitly know the IP of anyone who connects. Whether the forum software stores that information for you to see depends on the software, but it's always possible.
This isn't a weakness or vulnerability of the software, rather it's a necessary component of how the Internet works.
Note that questions on how to configure your specific forum to show you this information are not on-topic for this site.
Answer: I've seen your question posed as an attack on Tor users in the past but I can't find the resource. Here goes:

Let the user connect through a proxy
Have an Ajax script or a Flash applet call home
You have the real IP address.

This only works when the user hasn't taken countermeasures (disable Flash, JS), but you know when they do because you don't see a "call home" connection. And just to tie it with the Tor angle, if you use the modified browser that comes with Vidalia, these plugins are disabled by default.
Comment: In this case, what about someone using something like Whonix (https://whonix.org/wiki/Main_Page). If they have a separate Tor gateway then even at that point they could run Flash/JS with a possible leak in real ip, no?
Comment: An Ajax script wouldn't be able to break out of a normal proxy AFAIK (it'd be proxied just like the regular request). Likewise if all the traffic is tunneled via the proxy, then even Flash wouldn't be able to defeat the proxy (although you might defeat the proxy via tracking- i.e. super cookies).
Answer: Given the pervasiveness of NAT, users have many different IP addresses between their computers and your website. But of course, what you mean by "real IP address" are their public Internet gateway addresses.
There are many ways for users to conceal their public Internet gateway addresses. There are HTTP(S) proxies, SOCKS proxies, SSH tunnels, VPN services, Tor, and various combinations thereof. HTTP(S) proxies tend to leak. SOCKS proxies are more secure. Properly configured, SSH tunnels, VPN services and Tor don't leak, and aren't vulnerable to direct external attack.
However, they're all vulnerable to attacks that either break the computer's networking setup, or leave behind malware that "phones home" when users let their guard down. But it's generally considered in poor taste (and typically illegal) to compromise other peoples computers. Unless you're the NSA, of course ;)
There are two steps that users can take to defeat such attacks. First, they can isolate networking and apps in separate compartments. Whonix and Qubes are notable examples, using VMs. Hardware isolation is even better.
Second, users can compartmentalize their activity using multiple machines and VMs. For high-risk activity, they can use LiveCDs on diskless machines.
Bottom line, you can catch the naive ones, but not many of the ones you worry most about ;)


Can the ender dragon see you in minecraft when you have a potion of invisibility

Question: I am planning on fighting soon and just wondering if a potion of invisibilty would be a good thing to bring along.
Answer: The Ender Dragon is not influenced by invisibility potions. Source: I just tested it in a creative world.
This is true for 1.8.3. I haven't tested any other versions.
Comment: I just tried this in 1.12.2. It was as if the ender dragon could see me from the get go, magic bombs, head butts, the whole nine yards. So, invisibility potions do not seem to help, unless maybe you take off all your armour and go against it with nothing but fists....
Comment: OK, so I tried again wearing no armour, and the dragon can't see you! Useful if you want to build something like a pillar or stairs. BUT once I started hitting the crystals the dragon found me quick and without armour I didn't last long.
Answer: The dragon doesn't dive bomb you when invisibility is in affect. However I've noticed it will throw magic bombs and dive bomb the last location arrows are shot from.
Way to win. Invisibility. Feather fall. Make a pillar. Shot crystals from pillar. Make way to enclosed crystals and destroy. Then kill dragon with arrows slowly.
Answer: The Ender Dragon can't see you until you shoot arrows at her or hit her. My advice would be to shoot her as quickly as possible and then get out of that spot fast because she's about to throw you up in the sky or throw fireballs at you right there.
Answer: In a way all the previous answers are right. The dragon cannot see you if you have the invisibility buff, provided you are wearing no armour and do nothing aggressive. As soon as you do anything that harms the dragon, including hitting the crystals, it will track you, and you will not last long without armour.
I found that at least some of the time if you destroy the crystals using redstone circuitry and TNT while invisible the dragon seems to fail to notice you. Maybe the few seconds to ignite the TNT is long enough to get away from the scene.
So, the way forward is to go into the end wearing no armour and with the invisibility buff. Do whatever you need to do to gain access to the crystals, mining obsidian, making a pillar or whatever. Just avoid hitting anything! When you are ready put on your armour and then the fun starts.


How effective could a dragon be in wwII style warfare?

Question: For my question, the dragons are no taller than the average human, and they would have about the same intelligence as a human as well, their colouring is grey-ish blue, and they have access to all similar kinds of weaponry found in WWII and they have no helmets or clothing, but they still have protective padding, like water canteens and simple medical provisions with them (that they don't have to carry in their hands). They can fluently communicate between themselves and regular people. The dragons are in an army along with humans they are up against an opposing army entirely composed of humans. And both sides have relatively equal quantities of tanks, AV's, warships and planes.
Comment: There's enough variation in dragons that you need to describe them more to get any useful feedback. Are they bipedal? Serpentine? Quadrupedal? A lizard shape creature that was the same height as a human would be pretty massive. Can they fly? Gliding dragons would be pretty good paratroopers.
Comment: How many dragons are in the army? A few, thousands, millions?
Comment: well, they have four limbs for terrestrial traverse and two for areal. They still have that classical mammalian body shape (it's not that easy to describe, but it is the most common body shape out there for western dragons) They cannot actually breath fire, and yes, they can fly, and due to that, they can also glide.
Answer: Really, really effective as code speakers
Yeah, we're not going to do something silly like waste them on dangerous jobs or anything like that when there's so much better of a use we can use them for. See, in WWII, because of it's potential, intelligence was more valuable of a commodity than any one soldier's life - so much so that the fact that the Allies had cracked Enigma cypher was occasionally concealed by letting German run successful mission because of how concerned the Allies were about keeping it hidden. Being able to talk without any concern of the other side cracking the code is a huge advantage for one side to have.
Take, for instance, the Navajo soldiers. They spoke Navajo, which to be fair, is said to be a language that is apparently impossible to learn if you aren't a native speaker. The Allies used them on the Eastern Theater, are basically guaranteed that the Japanese wouldn't be able to understand intercepted transmissions. So what you have now is great. Use the dragon soldiers as code speakers, speaking draconic. Logically, due to the fact that dragon have entirely different anatomy when it comes to speaking and hearing, the draconic language should be as incomprehensible to non-Draconic speakers as Navajo is.
Comment: Messages sent using Navajo codetalkers were also encrypted.  This was important because there were American civilians who spoke Navajo who were captured early in the war.
Comment: Plus, if they ever do get in trouble there's the whole breathing flame and sharp teeth thing.
Answer: About as effective as a human soldier
Which is to say, largely useless without training and technology, and fairly effective with.  You've basically described a human who can (presumably) breathe fire.  Human armies in WWII used flamethrowers as weapons, so that's not a radical change.  Flame(thrower)s are very effective close-range weapons but useless at any great distance, so your dragons will still need to be competent users of long-range weaponry as well, just like human soldiers.
Comment: what's the difference with humans then ?
Comment: @GlorfSf Instead of playing "Dungeons and Dragons" with plastic or metal miniatures they play "Humans in Dungeons" with real flesh and blood humans? Just a guess.
Comment: Sorry, I forgot to mention the absence of breathing fire, guess you're right...
Answer: Assuming it's the fire-breathing and flying type of dragon it kind of depends on what part of the war you talk about (early or late) as the war gear available changed drastically during this time period.
Throughout the war they will have two skills that will be extremely valuable. If they can fly they will be exceptional at gathering intelligence compared to regular aircraft as they have a tiny radar profile, a tiny profile to shoot at and I wanted to add they would be far more silent but due to the wingspan and how loud small birds actually already are when flying I have to scrap that one.
The second skill they'll have is urban combat. Their fire breath (if they have it) would work a lot like a molotov cocktail, allowing any dragon that gets close to the air intake of an enemy vehicle to cause it to heat up from the inside and catch fire. There's also a nice advantage is being able to enter a room just after a large plume of fire causes your opponents to step back and perhaps flee. After all it could be someone wielding a flamethrower who's about to cook the entire room and you better get out of there fast.
Fighting non-dragons is also a huge advantage. Most living things have a natural resistance to killing their own kind or even causing permanent damage to others of their kind. This caused people throughout firearms history to fire over their enemies rather than at them as even in those life-or-death situations they are unwilling to actively kill the opponents. Modern armies drill specifically to replace this reflex with one where the soldier actually fires to kill, with all the psychological consequences afterwards. But your dragons likely don't have this compulsion when faced with humans and fire more accurately. The unfortunate side-effect is that it'll likely be fired upon more accurately as well.
Answer: For my answer I will assume the dragon species in question has about the same level of intelligence as a very smart dog or dolphin, can breathe fire, and has wings which generate enough lift to carry its own body weight plus cargo (weight limited by the need to maintain flight). I will have to assume that these creatures are carnivorous, warm-blooded, and have a migratory lifestyle. Finally I will work with the assumption that the Allied and Axis powers field dragons at a rate similar to that of other war animals of the period, i.e. only for some very specialist uses.
I tried to go as stock as possible.
The firebreath could come in handy for razing urban areas, especially cities and towns with a lot of wooden architecture; after all the USAAF firebombed wooden-built Japanese cities to terrifying effect. However they will have to close in with their target, in contrast with most bombers which let loose their destructive payloads at a great height. In this sense dragons can be thought of as flesh-and-blood dive-bombers.
If they have a magnetic node which guides their migration (akin to many bird species), this could mean they will not face the same troubles of navigating inclement weather far from friendly bases as do the human-piloted aircraft of the era.
Answer: The most interesting concept to me would be if the dragons could use fire arms. By which I mean they rear up like a bear using their back legs and wings to balance themselves then using their forelimb to handle the weapon or weapons. Another thought that occurs to me is that even if we assume that the dragon's body by itself is only as large as a human then there is going to be a lot of weight even with just the muscle for flight plus the wings. So dragons could probably handle larger firearms with their wings to help balance them and the added bulk, so that's a possibility. My final thought is that dragons tend to have for intense and purposes "scales of iron" which sounds to me like the scales of a pangolin if you don't know what that is look it you and then come back. For those of you who do here's a little tidbit about pangolin scales, They are bulletproof. There have been reports of people getting injured but bullets ricocheting off of these creatures.
Now given what I have read so far and the concepts I've put down I'm imagining a large bulletproof creature that can fly, rely secret messages, gather airborne intel, navigate better that most pilots, and hold back an entire platoon back by itself with nothing but it's own napalm and heavy machine gun fire, all while despite not really wearing any armor takes a shotgun blast to the face while looking at you angrily. And to top it all off unlike your fellow man. It is showing no mercy to you or your soldiers. The thought sends both a excited and fearful shiver down my spine.


How to abbreviate the long Selenium CSS code for table elements?

Question: I am having trouble abbreviating the following selenium CSS code which has the element inside multiple tables. The code below gives me two checkboxes.
table[id$=gridReports]>tbody>tr:nth-of-type(2)>td:nth-of-type(2)>table[id$=panelReportInformation]>tbody>tr:nth-of-type(2)>td>table[id$=panelReportContent]>tbody>tr:nth-of-type(2)>span[id$=reportCheckBox] input

I cannot use this code since there is also another table with the same span and checkbox. The only difference is that the it is in different row. So if i put the code for another checkbox, it would look like this.
table[id$=gridReports]>tbody>tr:nth-of-type(3)>td:nth-of-type(2)>table[id$=panelReportInformation]>tbody>tr:nth-of-type(2)>td>table[id$=panelReportContent]>tbody>tr:nth-of-type(2)>span[id$=reportCheckBox] input

So the only difference is nth-of-type(i) for every table. So how can i shorten the css code?
Is there any option that i can shorten like table[id$=gridReports]>tbody>tr:nth-of-type(i) followed by span[id$=reportCheckBox] input.
Any help would be appreciated.
Thanks
Answer: You could shorten it by narrowing your universe
el = driver.find_element_by_css_selector("table[id$=gridReports]>tbody>tr:nth-of-type(3)")
el.find_element_by_css_selector("span[id$=reportCheckBox] input")

OR
els = driver.find_elements_by_css_selector("span[id$=reportCheckBox] input")
for el in els:
    el.click()

That's in python but same idea in all bindings as you can chain a webelement request to a previous webdriver element


Authentication center in GSM

Question: We know that the AuC (Authentication Center) is used to identify GSM subscribers in the case of roaming or when the subscriber is requesting access to mobile network for the first time. But, I'm wondering what if the mobile is switched off then on, is the authentication needed or not? what also about if the mobile is out coverage and restored it? I don't really know what are conditions where the subscriber should pass by AuC?
Comment: Did any answer help you? if so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
Answer: When the mobile is turned on, if the LAI in the BCCH broadcast is the same as the one stored on the SIM card at IMSI detach (i.e. the location area has changed), then it sends an IMSI attach rather than a location update. If it is not the same, then it sends a location update type IMSI attach, and this performs a combined procedure.
On receiving a location update request or a CM service request (which sets up a session with the MSC such that the mobile can then initiate a call setup) or a CM service request that additionally contain a paging response from the mobile to an incoming call, etc., the MSC uses the VLR to determine whether to perform authentication according to the data configuration. I am not sure what this configuration might be actually. I would assume that authentication happens every single time a call or a location update occurs, or perhaps just a location update. The location update will perform the authentication procedure if it is required. It's either going to be required on just location updates, or both location updates and calls. I haven't read anything on this actually -- what the range of options are and what the typical configuration is, and I can't think of the logical justifications right now. This says that authentication is only performed if the TMSI that the mobile sends in the location update request or CM service request is not in the VLR, in this case authentication occurs and a new TMSI is assigned. I do not know when the TMSI expires, but certainly this will happen the first time you visit this MSC, and a new one is always reassigned upon a location update. The mobile uses the TMSI it has been most recently assigned, which identifies an active association between a SIM IMSI and a MSC that it is currently visiting.
If authentication is required, the VLR checks whether authentication triplets are available. If authentication triplets are available, the MSC sends an Authentication request message carrying the first authentication triplet.
If no authentication triplets are available, the VLR obtains authentication triplets from the HLR over MAP/D and stores them: The VLR identifies the HLR serving the subscriber based on the IMSI of the mobile carried in the received location update request, and then sends a MAP_SEND_AUTHENTICATION_INFO_REQ message to the HLR. The message carries the IMSI of the subscriber and the number of required authentication triplets (5 by default and can be configured as required). The HLR requests the AUC (usually integrated with the HLR) for an authentication triplet. The AUC generates a RAND (random challenge number), an SRES = A3(Ki, RAND) and a Kc = A8(Ki, RAND) and returns them to the HLR. The HLR then sends a MAP_SEND_AUTHENTICATION_INFO_RSP message carrying the authentication triplet to the VLR. If a TMSI+LAI is sent in the location update request then the VLR uses the LAI to identify the PVLR (old VLR) and sends the TMSI to it in a MAP_SEND_IDENTIFICATION_REQUEST and it applies with the stored authentication triplet in the response. The VLR returns the RAND to the MSC and now the MSC can send an Authentication request message carrying the RAND from the first authentication set (SRES, RAND, Kc) to the MS and the remaining authentication triplets are kept by and stored in the VLR.
On receiving the authentication request, the MS sends the RAND to the SIM. The SIM uses the A3 authentication algorithm to generate an SRES by using the RAND and the Ki stored in the SIM (the same as the one at the AUC) and uses the A8 authentication algorithm to generate a Kc, i.e. SRES = A3(Ki, RAND) and a Kc = A8(Ki, RAND). Then, the SIM sends the SRES and Kc to the MS. The MS sends an MM Authentication Response message carrying the SRES to the MSC which it then forwards to the VLR. The VLR compares the SRES reported by the MS and the SRES provided earlier by the AUC. If the SRESs are the same, authentication is complete and the VLR proceeds with location updating if this is a location update (update location to HLR, HLR cancels location in old VLR indicated in HLR, inserts subscriber info into new requesting VLR), generates a new TMSI and returns the Kc to the MSC in a set ciphering mode command (which will be the same Kc the mobile now has) and the MSC sends a BSSMAP CIPHER MODE COMMAND message to start the encryption flow. If the SRESs are not the same, the VLR denies the authentication and the MSC sends an Authentication reject message to the MS. On receiving the message, the MS stops accessing the network and adds the network to the list of unauthorized networks.
The BSS sends the RR CIPHERING MODE COMMAND to the mobile in the clear. The MS responds with RR CIPHERING MODE COMPLETE. This message is transmitted with ciphering, using Kc and A5 -- encryption comes after the GSM 5.03 encoding stage, and the payload is inserted into the logical channel provided by GSM 5.02. All messages from now on are ciphered. The BSS receives it and sends a BSSMAP CIPHER MODE COMPLETE to the MSC.
The MSC sends Location updating accept to the MS with the new TMSI and the MS responds with TMSI reallocation complete. The MSC sends TMSI reallocation ACK to the VLR.
Comment: @zarar I would probably go with it reauthenticating when a new TMSI needs to be assigned
Comment: @zarzar the VLR generates a TMSI every time there's a location update, meaning authentication occurs and when the SRES matches it generates a TMSI, and the msc sends a TMSI realloc cmd to the MS after ciphering has been enabled. The TMSI definitely expires relatively regularly, I'm not sure if this is more regularly than the MS period location updating.
Comment: I agree with you in terms of logical thinking, but I think there are more cases where the authentication will be needed. I need to be sure in this matter of authentication to precise it in my report !!!!

Authentication center in GSM


Is there a Unicode-aware LC_COLLATE sort order which respects punctuation?

Question: As far as I can tell, setting the environment variable LC_COLLATE=en_US.utf8 changes four things compared to LC_COLLATE=c, regarding how programs like ls will sort files:

Unicode characters are preserved (rather than being replaced with ?? garbage)
Accents and diacritical marks don't affect sort order
Case differences don't affect sort order
Punctuation characters (such as dots) don't affect sort order

Feature 1 is must-have in this day and age.
Features 2 and 3 are great too, since they make it more convenient to deal with real-life Unicode filenames.
Feature 4, on the other hand, is something that I find really anti-productive in my day-to-day work, since it often produces counter-intuitive sort orders for Linux filenames - where dots tend to be used to separate suffixes or to indicate dotfiles. I really can't imagine why anyone thought it would be a good idea to ignore dots when sorting filenames.
For example:
$ touch foo.txt foo2.txt foó3.txt foo4.txt

$ LC_COLLATE=en_US.utf8 ls
foo2.txt  foó3.txt  foo4.txt  foo.txt

$ LC_COLLATE=c ls
foo.txt  foo2.txt  foo4.txt  fo??3.txt

Neither is satisfactory. This is how I'd want those files to be sorted:
foo.txt  foo2.txt  foó3.txt  foo4.txt

In other words, just like with LC_COLLATE=en_US.utf8, except that punctuations are treated as significant characters (which are sorted before letters).
Does any LC_COLLATE setting exist which does this?
If there is no punctuation-respecting one that supports all features 1-3, is there at least one that supports feature 1 (i.e. sort like LC_COLLATE=c but don't garble Unicode chars)?
Answer: Problem number 1 is that LC_COLLATE=c is an invalid locale. You need a capital C (LC_COLLATE=C):
$ LC_COLLATE=c ls -1a
./
../
.sharp
.zharp
Sharp
sharp
szharp
zharp
??harp

$ LC_COLLATE=C ls -1a
./
../
.sharp
.zharp
Sharp
sharp
szharp
zharp
ßharp

I don't know how to do unicode-aware sorting without sorting filenames starting with a dot on top though (searching for an answer to this is how I ended up here) :-/


Installing downtube shifters with no clamp

Question: I am trying to convert my Schwinn Mountain bike into a road bike. I bought a set of Shimano SL-SY20A 3 (2) x 7 Speed Down-Tube Shifters. they have a clamp attached but my downtube is very wide and the clamp won't fit. how can I mount them to the downtube. I'm thinking of drilling holes on each side and screwing them in, mounting them that way. Does anyone know how I go about doing this? thanksfor your time!
Comment: You do risk weakening the downtube if you drill through it.  How serious this risk is depends on the material used in the downtube, plus your skill at drilling a clean hole, and how much stress the actual mounts generate.  It would not be a serious risk for steel frame that is not lightweight, but would be more of a risk for aluminum, and very iffy for carbon.
Comment: If its a steel bike you might get away with brazing some mounts onto the frame.   But if you're going to put drop bars on it, consider brifters (integrated brake/shifters)
Answer: Without any additional knowledge on the bike, my advice would be don't drill into the down tube. You run the risk of making it structurally unsound. That being said, some bikes with downtube shifters have a hole drilled in the downtube with a rod going between the mounts and maybe some epoxy using something like this:

Some other options are:

Find a different clamp (the Problem Solvers downtube shifter mount is bigger than most, has a 31.8 mm diameter)
Try making your own clamp (e.g. with a hose clamp; this may be necessary if you have oval/other shaped rather than round tubes)
Braze on some downtube shifter mounts (Shouldn't be too hard for steel frames)
Switch to using bar end shifters/brifters (Shimano makes a Tourney 7 speed brifter)/Retroshift levers (which mount a downtube shifter on the brake lever)

An aside:
As noted in various other questions on this site (do a simple search), its often not advisable to convert a mountain bike to a road bike or vice versa due to cost and geometry reasons.
Answer: I have drilled my Helliot's steel downtube to install  downtube shifters and it's OK. I made 3 videos for Youtube with the whole process.
Now I'm thinking to switch to an alloy frame and I'm going to avoid to drill it. Vintage alloy frames had downtube bosses but probably the tube was reenforced on that zone or the bosses were weldded (no drills), but I'm not sure. As an engineer, I think it's not sound to drill alloy, specially if the hole is 8 mm wide.
Comment: But "steel" bikes are almost always steel alloy, aren't they?  (Except at the lowest end.)  Are you sure there's a meaningful distinction?


Where shall I use odds logarithm and when shall I use sigmoid in logistic regression?

Question: I have been interested in DS and ML recently and logistic regression was on of the first algorithms I learned. In my first course it was said that ln(p/(1-p) was used for the logistic regression. But then I took another course and there was told about sigmoid function for logistic regression.
Which of them is better for binary classification? Where to use odds logarithm and where to use sigmoid?
Answer: A sigmoid function is a function with specific properties, most notably it maps values to the interval $[0,1]$. Often "sigmoid" is used to describe "some" s-shaped function which maps values to the interval $[0,1]$.
If you take the logistic function
$$ f(x) = \frac{L}{ 1 + e^{-k(x-x_0)} },$$
with $k=1, x_0=0, L=1$ ($x_0$ midpoint, $L$ curve max. value, $k$ logistic growth rate), you arrive at:
$$ f(x) = \frac{e^x}{1+e^x}.$$
With (binomial) logistic regression you aim at predicting a probability for some outcome $y$ based on some real valued inputs $x$, so you can employ the logistic function. You can write (omitting indexes $i$):
$$p(y=1) = \frac{exp(x' \beta)}{1+exp(x'\beta)},$$
where $x'\beta = \beta_0 + \beta_1x_1 + ... + \beta_nx_n$.
Now when you look at the odds $\frac{p(y=1)}{1-p(y=1)}$, you can plug in the equation above.
$$ \frac{p}{1-p}=\frac{\frac{exp(\beta_0+x_{1}\beta_1+...+x_{n}\beta_n)}{1+exp(\beta_0+x_{1}\beta_1+...+x_{n}\beta_n)}}{1-\frac{exp(\beta_0+x_{1}\beta_1+...+x_{n}\beta_n)}{1+exp(\beta_0+x_{1}\beta_1+...+x_{n}\beta_n)}}=exp(\beta_0+x_{1}\beta_1+...+x_{n}\beta_n).$$
Now in order to have a linear function (or model) on the right hand side you can take $log$s.
$$\ln\left(\frac{p_i}{1-p_i}\right)=\beta_0+x_{1}\beta_1+...+x_{n}\beta_n.$$
The log-odds (left hand side) are also called logit. The logit serves as a link function between the linear model and the probability.
The R code below looks at a logistic function, odds, and log-odds.
<code># Logistic function
x = seq(-10,10,1)
res1 = exp(x) / (exp(x)+1) # Maps some values x to interval [0,1]
plot(x,res1)

p = seq(0,1,0.01) # Probablility that event occurs

# Odds
odds = p/(1-p)
plot(odds,p)

# Logit
logodds = log((p/(1-p))) # Logit maps probabilities to real numbers
plot(logodds,p)
</code>
Comment: Thank you, but in which situations is it better to use each of them?
Comment: logit is the inverse of the logistic function: so logit and logistic function (as "sigmoid"-like function) are  two sides of one coin. The logistic regression model is defined as above and finally represented by "logit".


After restoring from a (valid) full disk backup can malware still persit?

Question: In the comments to this question it is mentioned that even after a backup recovery malware still can persist. Do I understand that correctly? How is this possible? If Acronis True Image is used to make a backup of a disk would restoring a clean backup guarantee the removal of any malware? For example when recovering is the master boot record rewritten?
Answer: In general, restoring from a clean backup will wipe out any malware you have.
However, there are rare exceptions.  Malware can install itself in your computer's BIOS, in which case it will persist through anything but a BIOS flash (and if it can sabotage the flash process, it can survive even that).  BIOS-infecting viruses are extremely rare, though, because they need to be tuned to the exact make and model of the computer's mainboard.
The most common reasons why malware can survive a restore from backup are:

it was present on the backup, and the user didn't realize it, or
the user failed to wipe the hard drive before or during the restore, or
the user has sufficiently bad security habits that they were re-infected almost as soon as they finished the restore.
Comment: @why should the drive be wiped?
Comment: To get rid of any malware on it.  In particular, boot-sector viruses can survive a typical restore from backup.


Determining proper word for a situation

Question: I work at a call center.  I said something somebody I work didn't like.  I was working.  They came behind me while working and just kept calling my name and would not leave me alone.  I reported this to HR as harassment.  HR told me this was not harassment.  So, what is the proper word to describe a situation like this?
Comment: Cascabel is right.  It may be that 'harassment' is covered by the company's code of conduct, in which case you need to study it and decide if HR is taking a fair view of the situation.  At all events the issue you raise sounds more to me like a legal or quasi-legal one than a matter of English language usage.
Answer: I believe that harassment is the correct word.
Here are two of the senses of the Merriam-Webster definition of harass:

1 b (1) : to annoy persistently
  // was harassing his younger brother
1 b (2) : to create an unpleasant or hostile situation for
  especially by uninvited and unwelcome verbal or physical conduct
  // was being harassed by her classmates
  // claims that the police were unfairly harassing him

From the description of a colleague standing behind you and constantly repeating your name, despite you saying you didn't like—and, presumably, being annoying in a persistent fashion, I would say it was a clear case of harassment based on the English definition of the word.

Having said that, however, the HR department at your company might have a different definition of the word they use as part of their own policies.
If so, a more accurate response could have been:

"We acknowledge that it was harassment in the commonly used sense of the word, but it's unfortunately not something we can act on. Per our policies, actionable harassment is defined as  . . ."
Comment: +1  agree with you
Comment: Thank you, I appreciate all responses.  This give me very good insight into the matter.
Answer: I would call the behavior of your colleagues DISTURBANCE.
According to Merriam-Webster's Dictionary
https://www.merriam-webster.com/dictionary/disturbance:
disturbance
: the act of disturbing
: the state of being disturbed
// apologized for creating a disturbance

Determining proper word for a situation


Problem with Solving ODE containing PolyGamma function

Question: Please see the attached screenshot of the code which was written in Mathematica 8 on Windows  for solving differential equation contaning PolyGamma function and then plotting it. Now the same code is not working in Mathematica 10. Can someone help me in rectifying it?
Answer: Since Mathematica is happy to treat PolyGamma as a function in it's own right you really want to be using Solve. While you're right that PolyGamma is a differential function of Gamma, there are similar relationships between $\cos$ and $\sin$, and we wouldn't whip out a differential equation solver (necessarily) to solve $ \sin(f[x])=\cos(g[x])+\cdots $.  We would solve using inverse functions of $\sin{}$ and $\cos{}$.
This is indeed what DSolve was doing even in Mathematica 8, wrapping Solve.  The short answer is to just use Solve with the InverseFunctions->True argument:
Tc = 89.9; m = 2.71;
eqn= Log[Tc/x]  == PolyGamma[(x + Tc + y[x])/(2 x)] - PolyGamma[1/2] ;
sol=Solve[eqn, y[x], InverseFunctions -> True] // Flatten

Interestingly, with exact Tc=899/100 your equation has a cute simplification:
FullSimplify[eqn]

yields
HarmonicNumber[(899 - 10 x + 10 y[x])/(20 x)] == Log[899/(40 x)]

Whose solution with inverse functions yields:
{y[x] -> (-899 + 10*x + 20*x*InverseFunction[HarmonicNumber][Log[899/(40*x)]])/10}


Are there any game engines out there that support cryptography?

Question: Are there any game engines out there that support cryptography? Obviously when one creates a game engine in one of the more established languages, like C++ or Java, one can just get some cryptography libraries and use those. I'm mainly asking about engines that allow one to create games using mainly a scripting language like lua or javascript.
Comment: Support cryptography for what?  What do you want to have encrypted?
Comment: @NathanReed At the moment my list of requirements is sha256, secp256k1, ripemd160, as well as some private-public key encryption/decryption and commutative encryption/decryption. Mostly the encryption will done on a short strings of data to represent various parts of a card game.
Answer: I'm assuming that the presence of crypto isn't the only thing that's part of your evaluation of game engines.  My suggestion would be to start making a list of features you require (including crypto), and start whittling down the list of engines.
Additionally, what you want to do with it is a factor as well.  If you just want to encrypt a local file, that's going to be pretty easy perhaps.  If you want to encrypt data transmission between your client and a server, that's getting more complex.  But at the same time client/server encryption is pretty common, including just using HTTPS.
Also note that a quick Google shows libraries do exist, including ones for JavaScript and Lua.


Inductance and the current through the inductor

Question: I am a high school student studying inductance, there is some point I can not wrap my head around, my teacher said that if we closed an LR circuit , at t= 0 the current in the circuit is zero and this is just because the back emf that the inductor generated due to the change in magnetic flux and this emf is equal to the electromotive force supplied by the battery, but I really doubt that,I  mean if the inductor was capable of creating a back-emf equal to the electromotive force once the LR circuit was closed ,it will always create the same opposing emf to the electromotive force at any point of time based on the logic that the inductor was just fighting the change in magnetic flux through it, the second argument I have is that there was just no change in magnetic flux in the inductor once the circuit was closed, I mean if  the current was zero amps how on earth can the magnetic flux through the coil change ?
However, I am thinking about this as being a dummy ,meaningless, assumption to make the evaluation of the solution to the RL circuit differential equation easy!
So, why is the current equal to zero!
Answer: The back emf is related to the rate of change of current.
$$V = -LI'$$
or
$$V = -L\frac{dI}{dt}$$
When a voltage is "applied" to an inductor, then (ignoring things like the resistance of the wire and stray capacitance) the back emf will be equal to the applied voltage.
When the applied voltage is 0, then (ideally at least) the current doesn't change with time.
If the applied voltage changes to say 10V, and the inductance is 1mH, then the current will change at a rate of 10/(0.001) = 10A / mSec. [Of course, as the current increases, it is likely that the voltage drop across the inductor will decrease. This will happen, for example if there is a resistor in series with the inductor.]
Now, when your teacher said that at t=0 the current is 0, it is probably because before that time, the current was 0. Typically, in examples like this, there is a switch that is open before t=0, and closes at t=0. It is the fact that the current was initially 0, that it is still 0 at t=0. Just as, if a car is initially at rest, and starts accelerating at t=0, then its velocity at t=0 will be 0.
Comment: This was how I was looking at it.Thanks!
Answer: It might help to visualize this as follows:
It is impossible to instantaneously assign a current through an inductor, for the same reason it is impossible to instantaneously assign a velocity to a mass. In either case, an infinite effort variable (voltage or force) would be necessary.
You can instead instantaneously apply a voltage across an inductor, for the same reason you can instantaneously apply a force to a mass. In either case, the resulting flow variable (current or velocity) starts from zero and builds up to its steady-state value.
Comment: So, **based on your own argument** if we applied a voltage through a resistance, the current can not go instantaneously to a steady-state value which is determined by **Ohm's law**, which I think is not true, the current does reach a steady-state value instantaneously.
Comment: @saidsalah2020, no, that is not true; a pure resistance can have any arbitrary voltage or current (but not both simultaneously) imposed instantaneously on it, to which it instantaneously responds with a current (in the case of an imposed voltage) or a voltage (in the case of an imposed current). This is not true for an inductor, whose *impedance* is set by the rate of change of the current:  an infinite (discontinuous) change in current produces an infinite resistance to current flow.


Is it possible to reset launchpad layout?

Question: My launchpad has become very cluttered overtime. I'm wondering if there is a function to reset launchpad like the iOS reset home screen layout feature. Let me know in the comments if you don't understand what I'm asking.
Comment: a related question for users on high sierra can be found here: https://apple.stackexchange.com/q/300109/122152
Answer: To reset Launchpad to the default, delete the following file:
<code>/Users/$USER/Library/Application Support/Dock/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.db
</code>

Where "xxxx..." in the file name is an alphanumeric string.

And then run the following command in a Terminal:
<code> killall Dock
</code>
The Launchpad is now reset to the default and a new database (.db file) will be created with the default settings.
Note:  If you want to examine the contents of the database you can use an app like Liya.
Comment: Does this remove all the app icons? I want to be perfectly clear before doing this :)
Comment: @www139, I've tested this on my own system and saw no adverse effects.  One should not just delete a file without having a backup so as to be able to revert to the previous state if needed/wanted. As to  "_Does this remove all the app icons?_", in what context are you referring to? I had my Launchpad set alphabetical using LaunchpadCleaner and when I manually removed the target file and `killall Dock` the Launchpad was reset to having the OS X default apps first as arranged upon first boot and everything I installed since came after the default apps. All icons still showed as I expected.
Comment: Great, that is what I was looking for :)


Electrifying a Battery Operated Clock

Question: I have a motion clock that runs off of two C cell batteries.  One battery runs the movement at 1.5 volts.  That other battery then continues in series to run the motion part delivering 3 volts to it.  I would like to use a 3 volt dc plug in power supply to run the entire clock, but do not know how to separate 1.5 volts from it.  I would not be opposed to using a 4.5 volt power supply if that is what I would need to do - 3V + 1.5V.  The movement is quartz, so I'm sure the amperage draw is small.  The motion part is an electromagnet that pulses and pushes a permanent magnet away from it to move the pendulum.  If possible I would like to put this on a board that would press fit into where one of the batteries go, so it could be returned to battery operation in the future if desired.  I'm also planning to use a jack plug that accepts the power supply/dc transformer, so it could be easily replaced in the future if it burns out.  Thanx in advance for any help.
Comment: I'd buy a 3v 'plug top' power supply. Make a mechanical arrangement that fitted in place of the batteries, with a socket to accept the 3v supply, and either an LDO linear regulator to get the 1.5v, or a couple of silicon diodes and a resistor as a simple regulator. If the current demand is low enough (which it should be) this is one of those very few places where a resistive voltage divider *would* be suitable as a low voltage power supply.
Comment: There are OTS solutions available you can tailor to suit or get ideas.  The powersupplies do seem rather over priced but the various adapters are a good starting place for your non-invasive requirement.  You may find that with just the clock running on one C-cell you may have many years of run time and only need to mains power the movement.  -  http://www.batteryeliminatorstore.com/index.php?id_product=54&controller=product
Comment: I do believe you're right about the C cell lasting for years.  I have another clock that uses 1 C cell without motion.  We've been in this house for almost 5 years and I can only remember changing it once even though it chimes every 15 minutes.
Comment: If I knew the values or part numbers of the diodes & resistor and how to wire them up that would be helpful.  I've tried 2 1N4004's in series using 2 C cells, but they do not drop the voltage enough; it was over 2 volts.  I have the 1N4004's that I use to reduce arcing across the 12 volt winding contacts on vintage car clocks that I repair and have those, but no others.
Answer: I have run battery powered  quartz  electric clocks on  mains derived low voltage DC for about 2 decades .They work fine .I made my own low idle current linear regs from garden variety BJTs like BC337 ,BC327 .The battery clock does not need a highly accurate DC voltage because it is designed to keep time as the 1.5 volt cell ages .Now days you could use a LDO P channel reg .I did not use LM317 because the idle current wastes  much more power than the clock .I used a combination of supercaps and electrolytic caps to allow operation during short power outages which are common in my area .Some years later I hooked up a smoke alarm to the system .
Answer: There are very cheap and easy to use voltage regulator modules available on Ebay for like $ 1 each, I suggest you get two of those.
This is the (LM317 based) module I'm talking about:

Then connect them like this:

simulate this circuit – Schematic created using CircuitLab
You should use a DC adapter of at least 5 V so you could use a USB phone charger. I would not go higher than a 12 V input voltage.
Before you connect the clock, use the small screw on the blue variable resistor to set the output voltage to 1.5 V and 3 V.
Indeed as Neil suggests in his comment, you could also use a resistive divider or (what I'd do) a couple of diodes in forward mode (and a resistor to 3 V) to make 1.5 V from 3 V. You'd still need a 3 V adapter though and these might be hard to find.
Also the cost of the individual components to make that will not be less than just buying two modules. We EEs often have these components in our part drawer so for us they're "free" but since my guess is that you would have to buy everything, it might be easier to just get two cheap LM317 based regulator modules.
Comment: This seems like a very economical solution (LMC317) that would end up as a clean installation.  I appreciate the help with this!  :)
Answer: 2 Silicon diodes in series step down 1.5 Volts (.7V * 2). Use diodes rated at twice the current or more than you believe the clock movement needs.
Comment: Exactly 1.5V? the voltage will be dependent on the current. Diodes make up for poor regulators, check out art of electronics figure 9.2 and chapter 9
Comment: The current matters little. Anything over ~50 mA will forward bias most Silicon diodes .7 Volt. In such low power applications as a clock motor, I've already used Silicon diodes for this purpose. They work JUST FINE! I also use a diode to reduce voltage from 5 USB to 3.5.
Comment: This is more of a comment, keep in mind the post is over 2 years old
Comment: No, it is not a comment. 2 diodes in series lowers the voltage exactly 1.5 volts which is the exact voltage drop he needs.

Electrifying a Battery Operated Clock


How do you synchronise projects to GitHub with Android Studio?

Question: I am trying to synchronise a project that I have on in my Android Studio folder to GitHub, but I am not fully sure what to do other than adding my credentials in the options menu. Could someone give me a quick guide, please?
Answer: Open the project you want to push in Android Studio.
Click VCS -> Enable version Control Integration -> Git
There doesn't seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project and do git remote add <remote_name> <remote_url>
Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI.

If you are getting the error: fatal: remote <remote_name> already exists that means        you already added it. To see your remotes do git remote -v and git remote rm <remote_name> to remove.

See these pages for details:
http://www.jetbrains.com/idea/webhelp/using-git-integration.html
http://gitref.org/remotes/
Comment: When i do VCS -> Commit changes  i get **No changes detected**
Comment: If the file names in the project window are red that means they aren't being tracked. Right click the file then Git -> Add. Now changes in that file should be detected.
Comment: Great explanations.  This video could also be helpful: https://www.youtube.com/watch?v=Ldmc757EXaE
Comment: Can I push the same project to 2 github repo? I was not able to.
Comment: I know of one way to add the remote through the GUI. If you do a push and you haven't set up credentials and the address for remote, then it will prompt you. You will see master -> Define remote and the "Define remote" part will appear as a link. Click on it and the rest will be self explanatory if you have used Git before.
Comment: @jsc0 I think it can only add the `app` module at the maximum. To add all of them, open terminal and `git add .` at the project dir. Which one is the best practice? To add a project or to add a module into the version control?
Comment: Though not entirely related on this one, but in case you need your project to be on BitBucket altassian here's how you integrate bitbucket remote repo with Android Studio: http://www.goprogramming.space/connecting-android-studio-project-with-bitbucket/
Comment: `VCS -> Enable version Control Integration` doesn't exist for me. All I have in the VCS menu is VCS Operations, Apply Patch and Apply Patch from Clipboard.
Answer: Following method is a generic way of pushing an Android Studio project to a GIT based repository solely using GUI.This has been tested with a GIT repository hosted in Visual Studio Online and should virtually work with GitHub or any other GIT based version control provider.
Note: If you are using GitHub 'Share on GitHub' is the easiest option as stated in other answers.

Enable the GIT Integration plugin
File (main menu) >> Settings >> Search for GitHub Integration

Enable Version Control Integration for The Project
VCS (main menu) >> Enable Version Control Integration >> Select GIT

Add project file to Local repository
Right Click on project >> GIT  >> Add

Commit Added Files
Open the Version Control windows (Next to terminal window) >> Click commit
button

In the prompt window select "commit and push"

Defining Remote
After analyzing code android studio will prompt to review or commit code
when committed will be prompt to define the remote repository.There you can
add the url to GIT repository.

Then enter the credentials for the repository and click 'Ok'.(Visual Studio
online Users need to enable "alternate authentication credentials" as
mentioned here to login to repository)
Comment: how can we do this for bitbucket . Is there a way like Github.??
Comment: @Nepster you should be able to connect with a bitbucket repo. if you add the your bitbucket repo url at the step 5 in the answer. Also if you need a dedicate plugin please try https://bitbucket.org/atlassian/jetbrains-bitbucket-connector, but unfortunately it seems the plugin is not supported or updated according to JetBrains.
Answer: On Android Studio 1.0.2 you only need to go
VCS-> Import into Version control -> Share Project on GitHub.
Pop up will appear asking for the repo name.
Comment: If you get the error above download latest git from https://git-scm.com/download/win and set the path to where you downloaded git.exe in Android Studio: File->Settings->Version Control->git "Path to Git executable" ; I had this issue hopefully will help others as well.
Comment: When I try to do that, I get an error message saying, "Cannot run program "git.exe":CreateProcess error=2,The system cannot find the file specified."
Comment: showing empty gist error and github repository opened
Comment: What about bitbucket . HOw to share project on Bitbucket ??
Answer: In the version of Android Studio I have (0.3.2), it was as easy as using the menu.

VCS Menu > Git > Share on GitHub.

It will then ask you for your credentials, and then a name for your new repo, and that's it!
Comment: In Android Studio 0.8.2 I found it via Alt+BackQuote or under VCS -> VCS Operations Popup.  In this version of Android Studio I don't see Git under the VCS menu.  If there's a plug-in or something I should have please let me know.
Answer: This isn't specific to Android Studio, but a generic behaviour with Intellij's IDEA.
Go to: Preferences > Version Control > GitHub
Also note that you don't need the github integration: the standard git functions should be enough (VCS > Git, Tool Windows > Changes)
Answer: Android Studio 3.0
I love how easy this is in Android Studio.
1. Enter your GitHub login info
In Android Studio go to File > Settings > Version Control > GitHub. Then enter your GitHub username and password. (You only have to do this step once. For future projects you can skip it.)

2. Share your project
With your Android Studio project open, go to VCS > Import into Version Control > Share Project on GitHub.
Then click Share and OK.

That's all!
Answer: For Android Studio 0.8.9: VCS --> Import into version contraol --> Share project on Github. It doesn't give you option to share in a specific repository or at least I couldn't find (my limitation!).
You can add your github info here: File --> Settings --> Version COntraol --> Github.
Answer: Now you can do it like so (you do not need to go to github or open new directory from git):
Answer: First time I have added a video link for solving your problem but I learned it was a bad idea. This time I'll explain it briefly.
Android studio is compatible with github but you need adjust something:

Setup Android Studio
Setup the Github plugins in the Android Studio settings

Android Studio settings >> Plugins page

Download the git version control system from this link and setup
https://git-scm.com/
After the installation, open Android Studio settings page and select the git.exe

settings >> version control >> git
Usually the path to git.exe is program files >> git >> bin >> git.exe

Go to Settings >> Version control >> Github you will see login and password for your Github account. Apply the settings.
For updating the project, go in Android Studio top line click
VCS >> enable version control integration >> git
One more time
VCS >> import into version control >> share project on Github
and enter your master password.

Now you can use VCS update buttons for updating your project to Github
Answer: For existing project end existing repository with files:
git init
git remote add origin <.git>
git checkout -b master
git branch --set-upstream-to=origin/master master
git pull --allow-unrelated-histories

Answer: In Android Studio 0.8.2 , you have the same option (ie Share on GitHub). If you want to find it, you can use ctrl+shift+a and enter github in the input text.
Answer:
Github with android studio

/*For New - Run these command in terminal*/
echo "# Your Repository" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/username/repository.git
git push -u origin master

/*For Exist - Run these command in terminal*/
git remote add origin https://github.com/username/repository.git
git push -u origin master
//git push -f origin master
//git push origin master --force

/*For Update - Run these command in terminal*/
git add .
git commit -m "your message"
git push

Answer: This is how I got mine working using Android Studio UI:
Delete .git folder from your project folder.
Delete .git folder from all your project subfolders.
Open project in Android Studio.
Settings, Version Control, remove all the roots
Go to VCS, Import into VC, Create git repository
Select the directory
Make sure your folder is the only root in Settings, Version Control
Go to VCS, Import into VC, Share project on Github
Mark as private if wanted.
Select all the files for initial commit, including app folder
Add files, select all in your project folder and app folder.
VCS > Commit -> to commit the files.
VCS > Git > Push -> to push the files.


Is there a way to plug a NEMA 6-20P plug into a NEMA 10-30R receptacle?

Question: Is there a way to plug a 6-20p 208/220/250v plug into a 10-30r receptacle? I can't seem to find an adapter for this. I bought a 220v fahrenheat heater and want to be able to plug it into a range or dryer receptacle.
Comment: This application considers both ends of the issue at hand. Ultimately, the circuit breaker is intended to protect the house wiring, FIRST and foremost. If the device needed it's own in-line fuse or protection, step-down could be integrated. Here, the appliance would draw less than the breaker's maximum current. All will be cool, no pun intended.
Answer: You will not find a legal or listed "adapter" for this.
A 6-20 is a straight 240V grounding 20A device.
A 10-30 is a 120/240V non-grounding 30A device, where the grounding function is provided via the neutral. This is only allowed in older range and dryer circuits, so any adapter would not be legal to use on any other circuit.
Comment: @Ecnerwal -- the ampacity is not the problem.  A 6-20R to 14-30P adapter is legal; the equivalent with a 10-30P isn't because of the missing equipment grounding conductor.  Besides -- how is a 20A heater on a circuit protected by a 30A breaker any different from a 1A clock radio on a circuit protected by a 15A breaker, or a 10A fridge with a 5-15P plugged into a 5-20T receptacle?
Comment: ...and you'd have a 30A breaker on a 20A device...
Answer: NEMA 10-30 is still in use. I just bought a 16A 240V EV charger and had an outlet installed by a licensed electrician. When you try to interchange with a live ground you may or may not get into trouble. If the power is coming from the main panel (not a sub-panel), ground and neutral buses are shorted together. But if someone tried to do this where the power came from a sub-panel, then there would be no path to earth grounding for the 6-20 load. So actually what you want to do is invalid since neutral cannot be grounded; see this page for more details.
Answer: Yes, there are actually adapters available for this. A quick web search for "6-20r to 10-30p adapter" should give you a few good results. Good luck! :)
Comment: These adapters *cannot* be legally used anywhere UL-listed wiring devices are required, as they *cannot* have a legit listing due to them abusing neutral as a ground, or leaving ground floating.
Comment: Using ground as neutral is unsafe, largely because the ground is not intended to be a current carrying conductor and might not even be insulated. However, using neutral as ground is not inherently unsafe. How do you think electric dryers plugging into a 10-30 outlet managed for all these years? Yes, they used the neutral for ground. Sure, the 10-30 doesn't meet current codes for new construction - but if you already have one, using an adapter to plug in an appliance with a 6-20 plug is perfectly safe. I'm an electrical engineer so I probably know a little bit about this stuff.
Comment: The answer to the question re: NEMA 10 is "not very safely", that's how.  The fact they're still in service today is an epic short-sightedness on the part of appliance manufacturers...


How can we explain "head feature" of a phrase?

Question: For example, how can we explain the head feature of an adjective phrase?
Answer: The assumption is related to the fact that lexical categories such as nouns, adjectives, verbs, etc. are not atomic. In fact they can be deconstructed into features.
John is an NP category with these features [+human, +male], you can go futher.
Maya is a NP category with these features [+human, +female], again go further.
Features distinguish lexical items from each other. This is why we need to look at lexical categories as bundles of features. This view carries over to functional categories. Consider this pair:
(1) She likes him.
(2) He likes her.
If we wish to deconstruct the s (agreement and tense morpheme) and see what its features are, we will discover that although isomorphic, i.e., has the same phonological shape, it is an s in (1) and an s in (2), but still there is a difference.
(1) s: [+Singular, 3rd person, +Female]
(2) s: [+Singular, 3rd person, +Male]
This rationale can be extended to your question regarding adjectives.
(2) She is tall
(3) She is short
If we assume that humans are divided by either being tall or short, then tall as an adjective is [+tall], and short in (3) is [-tall].
There are other features, it depends on each grammatical context. I can also add that tall is [+V, -N, -Tense] because it falls under the rubric of verbal predicates. It assigns an external theta role to **she*. But it's not a noun nor a tense category.
Comment: Well, in the PP theory - abandoned a while ago - Chomsky postulated [±N] and [±V]. Secondly, why do you view nouns, verbs etc. as purely lexical categories? And how do you deconstruct into features such nouns as *feature*, *syntax*, or *linguist*?
Comment: I don't see where Chomsky has abandoned the notion Principles & Parameters. He has abandoned a number of GB assumptions developed within PP yes, but not PP (as a cartesian theory of syntax). The following references are all rethinking attempts of GB (1995, 2000, 2001, 2008, 2013/15). In recent works, the labels you're using in your comment which I also used for expository reasons are also abandoned. There's nothing as +/- values but only interpretable/uninterpretable, valued/unvalued. I didn't want to go deep in my answer provided that it was put according to the question.
Comment: Moreover, look at his question. He's asking what a 'head feature' is. Shall we bother him with exceptions, complications, developments within the theory ? If you think so, please answer his question with every possible exception there is.
Comment: I'm afraid I can't write an answer because I don't quite understand the question in its current format. btw I'm quite familiar with PP, GB, MP etc.


Linq to sql, filtering results in a datagridview

Question: I have a very simple database for which I'm using linq to sql.
I have a datagridview to show the contents of the table. I want the user to be able to filter the rows appearing in the datagridview, if possible without making another query to the database (I'm really low on resources, so the solution has to be as fast as possible).
I thought about using the Filter property of BindingSource class, so I created one, set the DataSource property to the linq to sql expression. When the user added a filter, I set the Filter property. After like half an hour I found out, that BindingSource does not support filtering. Hell, great; but then what does? After spending another half an hour using Google and finding basically nothing usable, I deceided to use a System.Collections.Generic.List to store the rows, because I'm able to filter that. That was all right, but I also needed to store the original List (in case the user removes a filter) and I also need to support multiple filters.
So I had two Lists: one with all the rows the query resulted and one with the rows that met the filter's conditions. I didn't test it with multiple filters, though.
That worked, although it wasn't a really nice solution (at least I didn't find it appealing), but that was all I'd got. I deceided to write a wrapper class, because I may need to re-use this solution anytime later. I thought about creating a FilteredList class (after I made some searches with Google and didn't find any existing implementations), based on the following theory:

I store a List with all the rows in the table,
I store the filters (which are Predictate expressions) in a BindingList (so I can know if the list changed and re-filter the rows),
I store the filtered rows in a List, serving as a cache when there are no modifications made on the source list or the filters,
I keep a boolean value (_NeedsRefiltering) meaning whether or not the existing filters have to applied on the source rows to regenerate the cache,
The class has to implement the IList interface, so it can serve as a DataSource for the DataGridView.

Here comes the source code of my FilteredList class:
public class FilteredList<T> : IList<T>
{
    private bool _NeedsReFiltering = false;
    private BindingList<Predicate<T>> _Filters;

    public BindingList<Predicate<T>> Filters
    {
        get
        {
            if (this._Filters == null)
            {
                this._Filters = new BindingList<Predicate<T>>();
                this._Filters.RaiseListChangedEvents = true;
                this._Filters.ListChanged += delegate(object sender, ListChangedEventArgs e)
                {
                    this._NeedsReFiltering = true;
                };
            }
            return this._Filters;
        }
        set
        {
            this._Filters = value;
            this._NeedsReFiltering = true;
        }
    }

    private List<T> _Source;
    public List<T> Source
    {
        get
        {
            return this._Source;
        }
        set
        {
            this._Source = value;
            this._NeedsReFiltering = true;
        }
    }

    private List<T> __FilteredSource = new List<T>();
    private List<T> _FilteredSource
    {
        get
        {
            if (this._NeedsReFiltering)
            {
                this._NeedsReFiltering = false;
                this.Refilter();
            }
            return this.__FilteredSource;
        }
        set
        {
            this.__FilteredSource = value;
        }
    }

    public List<T> FilteredSource // Only for setting it as the DataGridView's DataSource - see my comments after the code
    {
        get
        {
            return this._FilteredSource;
        }
    }

    public FilteredList()
    {
        this._Source = new List<T>();
    }

    public FilteredList(int capacity)
    {
        this._Source = new List<T>(capacity);
    }

    public FilteredList(IEnumerable<T> source)
    {
        this._Source = new List<T>(source);
        this._NeedsReFiltering = true;
    }

    public void Refilter()
    {
        this.__FilteredSource = this._Source;

        if (this._Filters == null)
        {
            return;
        }

        foreach (var filter in this._Filters)
        {
            this.__FilteredSource.RemoveAll(item => !filter(item));
        }
    }

    public int IndexOf(T item)
    {
        return this._FilteredSource.IndexOf(item);
    }

    public void Insert(int index, T item)
    {
        this._FilteredSource.Insert(index, item);
        this._Source.Add(item);
    }

    public void RemoveAt(int index)
    {
        //this._Source.RemoveAt(index);
        this._Source.Remove(this.__FilteredSource[index]);
        this._NeedsReFiltering = true;
    }

    public T this[int index]
    {
        get
        {
            return this._FilteredSource[index];
        }
        set
        {
            this._Source[this._Source.FindIndex(item => item.Equals(this._FilteredSource[index]))] = value;
            this._NeedsReFiltering = true;
        }
    }

    public void Add(T item)
    {
        this._Source.Add(item);
        this._NeedsReFiltering = true;
    }

    public void Clear()
    {
        this._Source.Clear();
        this._FilteredSource.Clear();
        this._NeedsReFiltering = false;
    }

    public bool Contains(T item)
    {
        return this._FilteredSource.Contains(item);
    }

    public void CopyTo(T[] array, int arrayIndex)
    {
        this._FilteredSource.CopyTo(array, arrayIndex);
    }

    public int Count
    {
        get { return this._FilteredSource.Count; }
    }

    public bool IsReadOnly
    {
        get { return false; }
    }

    public bool Remove(T item)
    {
        var r = this._Source.Remove(item);
        this._FilteredSource.Remove(item);
        return r;
    }

    public IEnumerator<T> GetEnumerator()
    {
        return this._FilteredSource.GetEnumerator();
    }

    System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
    {
        return this._FilteredSource.GetEnumerator();
    }
}

I had some problems because of the two lists (the source list and the filtered list), but I think I've handled them correctly. Or maybe I haven't, because DataGridView doesn't seem to accept it as DataSource: no exception thrown, simply, nothing appears (not an empty datagridview appears, but nothing at all - not the columns, nor an empty row to add more items). Well, well, that's weird. I tried setting the _FilteredSource directly as a DataSource, and it was fine - until I added a filter and tried to scroll down when I get the error: System.IndexOutOfRangeException: Index 180 does not have a value.
Screenshot:
alt text http://shadow.crysis.hu/dgv_error.png
To be honest, I have no idea what's wrong. I have tried to call the DataGridView's Invalidate, Update and Refresh methods - same results.
So...

How could I efficiently filter the results appearing in the DataGridView using linq to sql?
Why can't I use my FilteredList as a DataSource for the DataGridView?
What's the problem with the code above?

Thank you very much for your time (if you read all this) and help (in advance)!

So, I tried to follow what Marc Gravell advised, and implemented the System.Collections.IList interface instead of the generic one. It worked, so I could bind it to the DataSource property of the DataGridView, and it displayed all rows, but as I added a filter and began to scroll down (for some reason, the list isn't refreshed until I start to scroll - Invalidate(), Refresh() and Update() doesn't help it) it started to give those weird IndexOutOfRangeException-s as DataError-s.
Any ideas how to do this stuff? I can't believe that linq to sql with datagridview sucks so hard (sorry, but this is getting ridicolous)...
Answer: To work with DataGridView, you need to implement the non-generic IList, not the generic IList<T> (or simpler and better: inherit from BindingList<T>, which provides things like change notifications via INotifyPropertyChanged). For working with LINQ-to-SQL I have some info on usenet that might be useful (assuming it still holds water - it has been a while).
re "rest of the problem"... can you be more specific?
Re filtering LINQ-to-SQL efficiently, you don't want to use Predicate<T>; you want to use Expression<Func<T,bool>>; this allows you to pass this down to the database via Queryable.Where, i.e. (where you have an IQueryable<T> source) something like:
IQueryable<T> data = tableSource;
// then for each filter "expr"
{
  data = data.Where(expr);
}

Writing a true filtered list is very tricky. I've done it for in-memory objects (I can't post the code, though) - but it takes a lot of object tracking etc. Unless you absolutely need this, it may be easier to keep things simple and just display simple snapsnots, tracking just additions/removals. For simple snapshots, just ToBindingList() may suffice...
Comment: Thanks, I'll rewrite my FilteredList class using that. Any ideas about the rest of the problem? So, how would you filter? And what is that IndexOutOfRangeException?
Comment: I see... so I should forget filtering the fetched data and should re-query the database when a filter is set. Using Expression> is a good idea, thank you! I'll wait a bit and see whether someone else has got another option... if not, then I'll accept your answer. Anyway, thank you for your time and help!
Comment: Implementing the IList non-generic interface allowed me to bind the FilteredList object as a DataSource, but didn't solve the IndexOutOfRange problem...


Conformational analysis

Question: In organic chemistry, much emphasis is given to the study of the conformers of alkanes and the broader topic of conformational analysis. Can you elucidate why the spatial arrangements and rotations around single bonds in alkanes are so crucial that they merit such focused attention? How does understanding these basic structural variations provide a foundation for grasping more complex concepts in advanced organic chemistry? Moreover, why do introductory organic chemistry courses prioritize this subject, and how does it set the stage for deeper exploration in subsequent coursework and research?
Comment: Conformers of alkanes aren't important at all. Conformers of *proteins* are, but good luck starting education with them - you need simple examples and that's what you get.
Answer: Barton writes in his 1969 Nobel lecture:

Every chemical reaction has a transition state. Many transition states have a
well-defined preferred geometrical requirement.

So the conformation (or the distribution of conformations) is one driver of chemical reactivity. Conformation also determines the shape of a molecule, which in turn is important for understanding whether and how molecules attach to the binding sites in receptors and enzymes.

[OP] Can you elucidate why the spatial arrangements and rotations around single bonds in alkanes are so crucial that they merit such focused attention?

The reactions of alkanes are not as diverse as those of other families of compounds, but the principles of conformational analysis (rotation around single bonds, steric hinderance, conformations of rings) are the same.

Conformational analysis


Why isn't Voltage considered in mAh ratings?

Question: The capacity of a battery is measured in mAh, for example a 1000mAh battery can provide 1A for 1 hour. Why is voltage not considered in this equation? 1A at 5V draws twice as much power (P = V*I) as 1A at 2.5V, which would surely drain the battery twice as quickly? The only reason I could think is the mAh is calculated on the output voltage of the battery in which case how can we compare batteries using mAh ratings?
Comment: Because as you have found, the capacity in mAh does not tell the complete story. It **does not** tell you the amount of **energy** in the battery. For that we use Wh (Watt Hour, 1 Wh means 1 Watt during 1 hour). Consider a hypothetical 1 mV battery with a 1000 Ah capacity. 1000 Ah sounds like a lot but at 1 mV you're only getting 1 Wh.
Comment: Because it's a measure of charge ( 1 mAh = 3.6Coulombs)
Comment: Of course, the capacity is measured in A·h simply because it's defined like that. I read the question as "Why are batteries characterized by capacity rather than energy?"
Comment: Knowing both the voltage **AND** the capacity of a battery allows you to do all the necessary calculations when supplying a load. If the voltage was mixed into the value (VmAh) you would still need to know the voltage separately.
Comment: And it doesn't make any sense to measure a voltage per time. Current and power per time do make sense since they are both a flow in electrons and energy per second.
Comment: Sometimes you are interested in mAh value, not Wh value. Wh value is interesting only in case you are using DC-DC convertor. In all other cases you are looking to mAh value.
Answer: There are two reasons why batteries are rated for capacity (A·h) instead of energy (W·h):

Cells using the same chemistry will have equal (or very close) voltage ratings, so voltage can be factored out when comparing their capacity.
In many chemistries, the voltage changes significantly during charge-discharge cycle, but also with temperature and load. Factoring that variable voltage in the battery energy will make many calculations complex:

a cell discharged to 50% of its energy would require e.g. 80% of its nominal energy to recharge back to 100%, while a cell discharged at 0% may require 200%. With capacity, charge and discharge figures are much closer, and the losses are nearly the same regardless of the charge level.
the same cell at 50% energy would gain some energy by simply being heated up. Its remaining capacity, on the other hand, would not change significantly.
the same battery would deliver 95% of its energy to load X, but only 70% to load Y. This is also true for the capacity in some chemistries, but to a lesser extent.

As you can see, if you say "I have a batter of 1 W·h", you'll need to specify in which conditions this energy has to be consumed, while "a battery of 1 A·h" characterizes the battery itself, not the environment where it will be used.
Comment: He means that if load Y discharges the battery at a current, say, ten times faster than load X then the battery Ah is de-rated. The Ah rating is specified for a particular discharge current. Decrease the current and battery capacity goes up. Increase it and it goes down. (More heat losses in the battery.)
Comment: I think the statement "the same battery would deliver 95% of its energy to load X, but only 70% to load Y" needs a bit more information to explain why that might happen. Do you mean that one load requires a higher voltage to operate, or something else?
Answer: The marketed mAh value is obtained as follows: The manufacturer puts the battery in a constant-current sink circuit (e.g. 100mA), and checks the voltage of the battery, which then decreases slowly. Once the voltage reaches a minimum threshold (let's say 1.2V for an alkaline battery), The manufacturer multiplies the current by the time it took to reach this value and says it's the capacity of the battery.
So the mAh value actually depends on at least those two parameters: current drawn and voltage threshold (it also depends on temperature, etc...). But if the current drawn is smaller, they show better capacity, for example.
Now for the voltage: The manufacturers usually provide graphs that show how the voltage evolve during this test. Here is one:

So, the mAh is given for the voltage of the battery all througout this test. Now, if you want to have the total energy that the battery can give (expressed in Wh : Watt-hour), which is the value you seemed to be interested in, you integrate this graph (not easy), but it's not really necessary anyway, since the voltage stays within reasonable bounds. Just multiply the mAh by the average battery voltage.
To sum up and go back to you question
If you want to compare batteries: if they are specified with the same voltage, you can directly compare the given mAh values. If they have different nominal voltages, multiply the mAh values by the voltage of the batteries, you'll have mWh values that you can compare to each other.
Now, whether the battery energy is drawn "quicker" at 5V than at 2.5V is not really relevant. It depends solely on the load type.
Finally, why the manufacturers indicate the mAh rather than the mWh ? I don't really know. It's like that. Maybe because the mAh value is easier to get from the above graph.
Comment: @niico I don't know what you mean by "USB battery". But I guess it is those battery-powered portable devices that are able to charge a phone through USB, right? In this case, it is **not** just a battery. It is a battery followed by a boost converter that is able to output 5V from whatever voltage the battery provides. The battery itself within this device isn't providing 5V at all times.
Comment: Interesting - though when, say, using a USB battery - isn't it supposed to be able to provide 5V at all times?! Many divides require at least that (or have some other minimum requirement).
Comment: USB battery packs - they are very common now, Anker for example make them. People use them to charge their phones. Your point on batteries v boost converters is interesting. However, these devices also state their power in mAh - eventhough they do have a boost converter.
Answer: As I understand it, most lithium ion batteries are rated at 3.6 volts. Since the voltage is standard, you can compare the mah of two lithium ion batteries and determine how much relative power they will each provide. As others have pointed out, the actual usable power is less than the full capacity and how they are used also effects the power they will provide. For instance, the slower you use the power, the more total power the battery will provide. The quicker you draw it down, the less power it will provide. So that mah rating is only nominal, the actual power provided will be different.
Comment: Your answer is, in general, correct. A few details: 'mAh', not 'mah'.  "*... the actual usable power ...*" You mean the actual usable *energy*. (Energy = power x time.) Similarly, "*... also effects the power they will provide.*" should read "... also **a**ffects the **energy** they will provide. Welcome to EE.SE.
Answer: Since the Voltage of a battery is fixed, a 2.5 V with 1000 mAh battery will drain at the same speed as a 5 V with 1000 mAh, when both provide a current of 1A. But the power of both batteries are surely different.
How much a Power a battery can provide depends on each single battery.
Hope this could help.


Dimension SST Printer Broken parts

Question: My company has an old Dimension SST printer that is out of commission due to a few broken pieces.
I have contacted the Stratsys folk and they won't do anything until we purchase a multi-thousand dollar service policy.
I also have a Makerbot that I can use to create spare parts however, can't find pictures of the original configuration.
The broken pieces are the Toggle Bar and Z Foam Sensor and whatever parts used to hold them in place on the head. Toggle Bar circled in red  View of my printer where the toggle bar used to be
Two Questions:
Does anyone know of a location to purchase spare parts?
Does anyone have detailed pictures (360 view) of the print head they are willing to share so I can recreate the parts/attachments.
Thank you so much for any help!
Comment: Does [this PDF](http://www.rnd-tech.com/media/fdm-pdfs/dimension-1200-es.pdf), page 61 help?
Comment: Unfortunately i need the backside view of that image. Thank you for doing some digging!
Answer: Seeing as how no one has been able to find a solution yet and I'm not familiar with your machine, I would recommend reverse engineering the part to the best of your abilities. If you don't have the right tools, try finding a local machine shop and ask if you can use their measuring equipment. Sometimes you might get lucky and they will have something more intuitive than callipers, such as a CNC CMM or CMM Arm. As far as acquiring the part, try asking the machine shop if they can produce it, or get it 3D printed via 3D Hubs, MakeXYZ, or some other peer printing service.
I'm sorry I don't have a more direct solution, but hopefully it at least a general sense of what options you may have.

Dimension SST Printer Broken parts


How to extract DEM (Digital Elevation Model) from 3D model

Question: How can I extract a Digital Elevation Model from a 3D model of a building, made with SketchUp, using Blender,qgis or any other software?
Comment: Can sketchup write any of these with z as attribute or coordinate? http://www.gdal.org/ogr_formats.html. If so then this should help: http://www.gdal.org/gdal_rasterize.html
Answer: Export your terrain object from SketchUp as a .dae file (or .kmz if you're using the free version - rename the .kmz extension to .zip and extract it find the .dae file inside)
Open the .dae mesh in Meshlab (free) and export mesh to .xyz points format, ignoring normals. Now, you can add the .xyz as a layer in QGIS using 'add delimited text layer'. Specify your x and y column, 'space' as custom delimiter, and that you have no header row. Looking at the data table, column 3 will contain your Z values.
Remember that unless your model was already georefenced, you will probably need to translate, rotate and scale the resulting layer, as required.
You can now use the raster > interpolation module to create a raster based DEM.
Answer: A second solution, which seems more efficient to me, after hours trying to achieve something with the same initial purpose (extraction of a DEM from a mesh constructed with Sketchup [in order to use visibility analysis tools].

If possible, export the Sketchup object as a *.obj file, as it seems that it is the only format that keeps the scale and orientation of the model
Open it with CloudCompare (opensource and free) and select it. If needed, georeference it [Ctrl + T / Edit > Apply transformation > "From > to axes", give the true coordinates of your origin point in Sketchup]
Add sample points on the surface of your mesh [Edit>Mesh>Sample points]. As for the number of points, 1.000.000 per a 300 m² building with walls 3 m high give good results.
Select your sampled cloud. Rasterize it [Tools > Projection > Rasterize]. Important parameters:

Projection direction: Z
Empty cells. Fill with kriging

Update grid to see the result, click on Raster in order to save the file.


Why does glass break at the line where you score it?

Question: Why does it take such a small incision for the glass to break at that spot? Why is the structural strength of the material influenced by such a small imperfection?
Comment: Well, because glass is uniform in thickness and the force needed to break it is proportional to the thickness - or some increasing function, whatever it is. An incision means that the thickness at that point could be 1% or 10% smaller so the fource needed to break it at that point is 1% or 10% smaller than elsewhere. If one continuously increases the force - and any realistic contact has a nonzero time when the force is continuously increasing - it's therefore guaranteed that the glass will break at that point.
Comment: i'm not sure if the force needed is proportional with the thickness. Could the glass start to crack at one end and sort of unzip itself to the other end. For a normal unscored glass this unzipping couldn't take place because it doesn't have a clear path. If this unzipping is really happening then the force should be just enough to start the crack, which I believe is much small then the force needed to break the whole length of glass at the same time as it would happen with a normal pane of glass
Comment: What is wrong with the description at [Fracture Mechanics](http://en.wikipedia.org/wiki/Fracture_mechanics)?
Comment: Right, of course, I meant the force needed to start the crack. Once the shape begins to change and bonds are broken, the situation and required forces for further steps change - and have to be recalculated again. Yes, it's then very likely that the breaking will continue along a path.
Comment: @RedGrittyBrick thanks for the reference, I was not aware of 'fracture mechanics' terminology/field
Answer: Suppose you bend a perfect, i.e. unscratched, piece of glass, the forces on it look like:

The top of the glass is in tension and the bottom in compression, but the stress is spread over a large area of glass so the local stress at any point isn't enough to break the glass.
Now put a scratch in the top surface and bend it again:

This time the stress is concentrated at the leading edge of the scratch so you get a high local stress and the glass breaks at the tip of the scratch. This means the crack grows until it breaks through the glass. That's why putting a scratch on the glass causes it to break when bent. The scratch focusses the stress at the scratch.