Forever Learning

Forever learning and helping machines do the same.

Archive for the ‘Linux’ Category

Back To Back

leave a comment »

Gruber asserts.

Being able to label the back button is a big reason why the iPhone’s on-screen buttons are better than Android’s hardware Back button. A dedicated hardware Back button can never answer the question “Where?”

Oh really

The Back button on my browser is not labeled in any way, nor are the (to Gruber perhaps confusingly labeled) emergency “exit” signs in most buildings. Some things are just so blindingly obvious they do not warrant a label at all.

I guess I never really considered the “Where?” question to be important. I always figured the Back button on my phone would do pretty much what it says on the tin: take you back. Back to where you came from; wherever that may have been.

Conversely.

When I click my Android hardware Back button after moving from one application to the next (for instance when opening a map, webpage or dialing a number from within an app) Android does exactly what I would expect; it goes back to the previous screen. As long as I keep tapping that button, Android will take me back; even if I have been moving acros a multitude of applications. Right up until I return to the Home screen.*

This makes total sense to me.

When the user presses the BACK key, the current activity is popped from the top of the stack (the activity is destroyed) and the previous activity resumes (the previous state of its UI is restored). Activities in the stack are never rearranged, only pushed and popped from the stack—pushed onto the stack when started by the current activity and popped off when the user leaves it using the BACK key.

For me, this consistent Back functionality across applications is a big reason why Android’s Back button is better than the iPhone’s on-screen buttons. Even if they do have fancier labels.

[* As a side note, I’ve always felt the Android applications integrate more often and more nicely producing a more natural flow between apps. Perhaps this point is not a salient to those used to the more clunky iOS flow where manual application switching is more common, at least for me. ]

Advertisements

Written by Lukas Vermeer

November 16, 2011 at 19:36

Posted in Android

Copying Bits in the Fastlane

with 5 comments

I’ve finally gotten ’round to rooting my ‘old’ G1 phone and installing the Cyanogen firmware. I will not bore you with the technical details of flashing firmware, but I would like to share an observation. To illustrate my point, I will need to cite some of the steps involved.

The technicalities of the following citations do not matter all that much, so if you want, you can skip right to the short translation. There will be no pop-quiz at the end, I promise.

Rooting the G1 is not as complicated as you might expect from the enormous amount of steps involved. The biggest obstacle for me proved to be the fact that I do not have a copy of Windows installed on any of my computers, so the following steps in the “the unlockr” guide (referred to by none other than Cyanogen himself) were practically impossible for me (underlining is mine; and as promised, there is a short translation below).

9. Now, goto http://download.cnet.com/HxD-Hex-Editor/3000-2352-10891068.html?part=dl-HxDHexEdi&subj=uo&tag=button to download the HxD Hex Editor. Save it and install it to your computer.

10. Take your SD card out of your phone and put it into the SD adapter it came with. Then put that into your computer so it shows up on your computer as Removable Disk.

11. Open the Hex Editor (Run as Administrator if one Vista or Windows 7) and click on the Extra tab, then click on Open Disk. Under Physical Disk select Removable Disk (your SD card you just put into the computer). Make sure to UNcheck “Open as ReadOnly”. Click OK.

12. Goto the Extra tab again and click Open Disk Image. Open up the goldcard.img that you saved from your email. You should now have two tabs, one is the SD card (Removable Disk) and the other is the goldcard.img. Press OK when prompted for Sector Size 512 (Hard Disks/Floppy Disks).

13. Click on the Goldcard.img tab and click on the Edit tab and click Select All. Then click on the Edit tab again and click Copy.

14. Click on the Removable Disk tab (Your SD Card) and select offset 00000000 to 00000170 then click on the Edit tab and click Paste Write.

15. Click on File then click Save.

Translation: download software of dubious origin, run software as Administrator, open disk, click a few things, copy/paste a few bits, save. Apparently all we want to do here is copy some bits from a file to (the beginning of) a disk. Copying a few bits can’t be this hard, right?

I mean, this is a computer; it copies bits all the time!

Luckily I was not the only Android enthusiast stumped by these Windows-only (and frankly, rather convoluted, manual  and error-prone) steps. Someone else had already solved the problem for me (thanks, Sven). The steps in his guide (for Mac or Linux) seems a lot simpler to me (again, underlining mine and translation below).

1 .Open your Mac’s Terminal under Applications -> Utilities ->Terminal (Or your Linux-Terminal)

2. Enter diskutil list and confirm

3. You should be able to see your SD-Card now. You can recognize it from its size (mine is 2GB) and that its type is DOS_FAT_32. As IDENTIFIER it says disk2s1.Remember this identifier.

4. Now unmount the card the folowing way: If your identifier was disk2s1 enter diskutil unmountDisk /dev/disk2 and confirm. If not, you have to replace the 2 with your value (the value that is written right after the word disk).

5. Now create your goldcard with sudo dd bs=512 if=~/goldcard.img of=/dev/disk2. If you need to, replace the 2 again. Confirm, wait, enter your users password (or under linux your roots password) and confirm again.

Translation: figure out which disk you need, copy bits to disk. The dd command used here is available in every flavor of *nix I’ve ever encountered. Let me break that crucial fifth step down for you.

sudo I am the Administrator, do the following as I say! (normal users are not allowed copy bits this way, that would be a Very Bad Idea)

dd Copy bits

bs=512 in chunks of 512 bits (“bs” stands for “block size”, in this case, not cow manure)

if=~/goldcard.img from this file (“if” for “in file” and “~/” just means the file is in my home folder)

of=/dev/disk2 to this disk (“of” for “out file” and “/dev” is the Device File folder, where *nix pretends devices attached are just files e.g. disk2 for my SD-Card).

It could be me, but that looks a lot simpler (and faster and less error-prone) to me than the Windows instructions.

The problem seems to be that, although Windows is perceived to be easy to use (and it probably is, up to some point), the lack of real and raw power under-the-hood can make anything as trivial as copying a few bits impossible without resorting to downloading dubious applications. It’s like having a car that is pretty and easy to drive, as long as you stay out of the fastlane.

And that, my friends, is one of the reasons why people like me do not like Windows very much. We nerds, we like living life in the fastlane.

Written by Lukas Vermeer

July 3, 2010 at 17:44

Posted in Android, Bash, Linux

%d bloggers like this: