Thursday, June 6, 2013

Commands: noun, then verb

One of the little things that irk me: commands that start with a verb followed by a noun.

I fully understand why English-speaking people tend to put the verb first. In English, an imperative order is given verb first. "Insert this module! Delete this directory! Add this apt repository!" So English speaking programmers tend to use the same convention for program names.

Unfortunately, verb-first order breaks command searching via command completion. Suppose I want a module related command, but I can't remember the name. The part I'm most likely to remember is "mod". If it were "modins", "moddep", "modrm", etc., I could start typing "mod" and press <tab> and the various module-related commands would be listed. But if it's "insmod", "depmod", "rmmod", etc., I had better remember the particular verb used as well as the noun.

A related problem is that verbs tend to not be consistent. Why do we "ins" and "rm" modules but "add" and "del" users? The noun part is much more likely to be consistent. Once more, command completion comes to our rescue.

When I did Solaris admin, I was impressed that all their module commands started with "mod". I'm happy to note that people in the Linux world now mostly seem to get this as well. The early Linux module commands were "verb-noun" ordering, but the newer module commands are "noun-verb" -- "modprobe", "modinfo". Similarly, the early "user" commands were "adduser" and "deluser", but the modern equivalents are "useradd" and "userdel". Yay for progress!

[And now I have a reference for when I need to argue with someone on why they should rename their program! Yay me.]

Monday, May 6, 2013

Android configuration

I document all my normal Android settings, for when I have to configure a new device. Let's share.
  1. settings
    1. security
      1. unknown sources: allow
      2. screen lock: pin
      3. automatically lock: 5 minutes after sleep
      4. power button instantly locks: off
      5. owner info: enter name and email
      6. verify apps: enable
    2. backup and restore
      1. automatic backup: enable
      2. automatic restore: enable
  2. accounts:
    1. google
    2. dropbox
    3. facebook
    4. Mantano (now expired)
    5. netflix
    6. outlook web email
    7. skype
    8. tivo
    9. twitter
  3. ADW (ADVANCED)
    1. actionbar: don't show
    2. dock: rotate with device orientation
    3. desktop position: ICS slider
    4. app drawer: ICS paginated
    5. transitions: normal scroll
    6. ADW Settings
      1. screen
        1. desktop columns: 5
        2. desktop rows: 7
      2. system
        1. advanced settings
          1. home orientation: portrait
    7. desktop setup
      1. icon row:
        1. phone
        2. beyond podcast
        3. chrome
        4. reader
      2. row: 1 (from bottom)
        1. power toggles icon (see below for details)
        2. widget beyond podcast 1x1 icon
      3. row: 2 (from bottom)
        1. widget connectbot frakir.org
        2. maps
        3. winamp
        4. folder
          1. facebook
          2. twitter
          3. flipboard
          4. google+
        5. play store
      4. row: 3 (from bottom)
        1. folder
          1. mantano reader lite
          2. AEPreader
          3. aldiko premium
          4. eReader Prestigio
          5. ZXReader
          6. HaTaNa"Ch
        2. OurGroceries
        3. folder
          1. Angry Birds
          2. Angry Birds seasons
          3. Bard's Tale
          4. Defender II
          5. Minecraft PE demo
          6. Sudoku
        4. folder
          1. MX player
          2. Music
          3. Mythfrontend
          4. netflix
          5. pandora
          6. tivo
        5. folder
          1. Gmail
          2. Messaging
          3. Outlook Web Mobile
          4. People
          5. Skype
          6. Talk
          7. YAIIC
      5. row: 4 (from bottom)
        1. folder
          1. Clock
          2. StopWatch and Timer
        2. Navigation
        3. folder
          1. Camera
          2. Camera MX
          3. DOF Calculator
          4. OneShot Cam
          5. Smart Voice Recorder
        4. folder
          1. settings
          2. ADW Config
          3. Authenticator
          4. battery indicator
          5. BlueAnt
          6. Downloads
          7. Dropbox
          8. ES File Explorer
          9. Gallery
          10. Power Toggles
          11. ROM Manager
          12. SGS3 Easy UMS
          13. StickMount
          14. SuperSU
          15. Task Manager
          16. Torch
          17. Traceroute
          18. UltraTools Mobile
          19. Wi-fi Web Login
        5. folder
          1. Tricorder
          2. AK47
          3. Android Lightsaber
          4. Android Lightsaber (#2)
          5. BlueScreen
          6. Earth
          7. Google Sky Map
          8. Periodic Table
          9. screen Crack
          10. Sonic Screwdriver
          11. Sonic Screwdriver (#2)
      6. row: 5 (from bottom)
        1. blank
        2. blank
        3. folder
          1. Barcode scanner
          2. BMI Calculator
          3. Chicon7
          4. DC Metro Map
          5. DC Metro Transit
          6. Goggles
          7. How to Tie a Tie
          8. Karl's Mortgage
          9. Local
          10. MyBMI
          11. NASA
          12. News and Weather
          13. RunKeeper
          14. Running
          15. Speed Dial
          16. The Weather Channel
          17. Translate
        4. RealCalc
        5. folder
          1. Titanium Backup
          2. APN Backup & Restore
          3. Call Log Backup & Restore
          4. SMS Backup & Restore
      7. row: 6 (from bottom)
        1. blank x5
      8. row: 7 (from bottom)
        1. blank
        2. Calendar
        3. Hebrew Calendar Widget (see below)
  4. aldiko premium
    1. settings | display | page turn animation = off
  5. automateit
    1. settings
      1. show popup messages: off
      2. show service notifications: off
    2. add rules
      1. application trigger
        1. application: map
        2. actions: composite
          1. GPS: on (phone only)
          2. mobile data: on (phone only)
      2. power connected
        1. actions: composite
          1. GPS: on (phone only)
          2. bluetooth: on
          3. wifi: on
      3. power disconnected trigger
        1. actions: composite
          1. GPS: off (phone only)
          2. bluetooth: off
          3. wifi: off
      4. application activated trigger
        1. application: MX Player Pro
        2. action: set screen brightness 100%
      5. application deactivated trigger
        1. application: MX Player Pro
        2. action: set screen brightness automatic
  6. AVG
    1. activate
  7. battery indicator
    1. just start it
  8. call logs backup and restore
    1. preferences
      1. backup folder: external card
      2. schedule backups
        1. enable
        2. 4am
        3. repeat 1 day
  9. connectbot
    1. set up hacker's keyboard first
    2. connect ssh to morty@frakir.org
    3. connect ssh to work
    4. connect local
    5. create shortcut widgets for morty@frakir.org
  10. dropbox
    1. configure account
    2. upload phones
      1. upload existing photos: no
      2. skip
  11. email
    1. settings
      1. application
        1. auto-advance: message list
  12. ES File Viewer
    1. settings
      1. file settings
        1. show hidden files: yes
      2. view settings
        1. view: details
  13. facebook
    1. log in
    2. sync (contacts): Sync all (note: won't be present on tablet)
    3. settings
      1. sync photos: off
      2. messenger location: off
      3. sync contacts: sync all (note: won't be present on tablet)
  14. hacker's keyboard
    1. configure input methods (also under settings | keyboard)
      1. hacker's keyboard
        1. enable
        2. settings
          1. keyboard mode, portrait: full 5-row layout
    2. set current input method (also under settings | keyboard)
      1. hacker's keyboard
  15. Hebrew Calendar 3x1 widget
    1. hebrew date changes at: midnight
    2. location for candle lighting: enter location manually: 21044
    3. Language: Hebrew
    4. minutes before sunset to light candles: 18
  16. mantano
    1. settings
      1. bookshelf
        1. import folders
          1. add: /mnt/inbooks
          2. del: /mnt or other defaults
  17. ourgroceries
    1. send auth request to main acount
  18. MX player
    1. settings
      1. decoder
        1. S/W decoder (local): yes
  19. netflix
    1. log in
  20. power toggles
    1. create a widget
      1. toggles:
        1. hotspot (wifi)
        2. wifi
        3. bluetooth
        4. gps
        5. mobile data
        6. screen lock
        7. volume toggle
        8. brightness quad
      2. transparency: about 50%
    2. under the app:
      1. notification widget
        1. enable
        2. conigure
          1. two rows
          2. row1: as per widget above
          3. row2:
            1. flash light
            2. screen light
            3. data sync
            4. sync now
            5. airplane mode
            6. play/pause music
            7. rotation lock
  21. realcalc
    1. settings
      1. RPN mode: yes
      2. Enable Radix modes: yes
      3. swap percent and 1/x: yes
  22. tricorder
    1. obtain from your dropbox account
    2. settings
      1. sound level: quiet sound
  23. SuperSU
    1. settings
      1. show notifications: no
      2. clear logs after: never
  24. wifi web login
    1. log in at work
    2. log in at gym
  25. root phone (ADVANCED)
    1. download heimdall, recovery.img, and CWM file CWM-SuperSU-v0.87.zip to linux system
    2. build heimdall
    3. copy CWM file to phone external card
    4. reboot (#1) phone, while holding down buttons: volume-down, power, and home
    5. at prompt, press volume-up
    6. you should now be in "ODIN mode" (small print) and "Downloading..."
    7. on your PC, sudo ./heimdall flash --recovery recovery.img
    8. watch phone closely! If you miss your window, you will need to reflash until it works
    9. When it reboots (#2), hold down buttons: volume-up, power, and home
    10. If you boot into the normal phone OS, you missed recovery mode. Go back to the reboot #1 and reflash.
    11. You should boot into CWM based Recovery. If you boot into Android recover, go back to reboot #1.
    12. If you got into recovery mode, congrats!
    13. In the recovery menu, use volume-up, volume-down, and power to select
    14. select "install zip from sdcard"
    15. select "choose zip from sdcard"
    16. select "firmware"
    17. select CWM file
    18. select "yes"
    19. select "go back"
    20. select "reboot"
  26. Upgrading to a different firmware (ADVANCED)
    1. backup phone apps using Titanium backup
    2. backup call logs to external SDcard
    3. backup SMSs to external SDcard
    4. backup APNs; copy from local SDcard to external SDcard
    5. backup ADW launcher settings; copy from local SDcard to external SDcard
    6. download and transfer to phone sdcard:
      1. desired image
      2. google apps ("gapps") for desired image
    7. do usual root steps, up to second boot
    8. using clockwork recovery:
      1. make a backup of the system firmware
      2. wipe previous data
      3. install image
      4. install google apps ("gapps")
      5. reboot
    9. once booted
      1. configure wireless
      2. configure google account
      3. go to google play
        1. stop downloads (if they are happening)
        2. install titanium backup
      4. go to titanium backup
        1. menu | batch actions
          1. restore missing apps with data
          2. DO NOT: restore missing apps and all system data
          3. DO NOT: restore all apps with data
      5. reboot

Tuesday, October 30, 2012

Android Apps

[Last Updated: 2013-05-06]

Every now and again, geek chats turn to favorite Android apps. I've been meaning to make a list of mine. Here is that list, starting with the really useful, non-obvious choices first. If you have a great one that I left out, please let me know!

[Note: a few are labelled as requiring root. For these few, if you are not very technical, you may not want to try to use them.]

    Apps that everyone can use

  1. MX Player -- video player that is much more flexible than the built-in player. Versions: free (full, ad-supported); pro.
  2. RealCalc -- scientific calculator. Has support for Radix modes, RPN, and other nifty features. Versions: free (almost all features); pro.
  3. OurGroceries -- shared list manager. Has clients for Android, iOS, and generic web. Free, ad-supported.
  4. PowerToggles -- replacement (up to 8 toggles) for the default power control widget. Free. Note: some functionality requires root, but on Samsung, is worth installing even without root.
  5. ADW Launcher -- replacement for the main interface that comes with your Android device. Will let you increase the number of columns and rows. Very useful if you have a device that limits you in this department. Free.
  6. BeyondPodcast -- nice podcast manager. Much nicer than Google's "Listen" app. Versions: trial (limited); pro.
  7. ES File Explorer File Manager -- browse files directly. Free.
  8. Call log Backup, APN backup, SMS Backup -- free backup apps.
  9. Mantano Reader -- ereader app, my current preference.
  10. WiFi Web Login -- automate login to wifi hotspots. Very useful if your work and/or gym wifi requires a login.

    More specialized apps

  11. Connectbot -- ssh client. Free.
  12. Hacker's keyboard -- replacement Android virtual keyboard. Includes, control, alt, escape, and other useful keys. Free.
  13. Stickmount -- replacement for USB mass storage support for devices that don't come with. Free. Note: REQUIRES ROOT.
  14. Speed Dial -- replacement speed dial call list for phones that have a crappy phone app. Free.
  15. Battery Indicator (Darshan) -- nice battery widget.
  16. AutomateIt -- automatically change settings and do other actions based on triggers. Versions: free (limited); pro.
  17. BusyBox -- linux tools. Free. Note: REQUIRES ROOT.
  18. DOF Calculator (Aimen) -- for photographers to calculate depth-of-field. Has advanced mode that will let you fill in numbers -- handy for, say, shuttle photography. Free.
  19. Titanium backup -- lets you backup all your apps and setting, e.g. before an upgrade. NOTE: REQUIRES ROOT. Versions: free (limited); pro.
  20. Google Authenticator -- lets you build two-factor auth systems.
  21. Google Goggles -- work with barcodes.
  22. Hebrew Bible -- for looking things up on the fly.
  23. Hebrew Calendar Widget
  24. Karl's Mortgage Calculator -- calculate mortgage under various conditions. Free.
  25. How to Tie a Tie -- diagrams that include the more obscure tie types
  26. NASA App -- keep track of NASA
  27. mythfrontend -- watch TV from your MythTV player
  28. Periodic Table -- yay for chemistry!
  29. Presto Sound Library -- a "beta" but it costs money. Will let you play your podcasts in BeyondPodcast at faster than 1x.
  30. Skymap (google) -- nifty astronomy resource
  31. Stop Watch & Timer
  32. SuperSU -- manages root access. Note: requires root.
  33. Task Manager (Rhythm Software)
  34. Tivo -- control your tivo. Cannot yet stream content from a tivo. Free.
  35. The Weather Channel -- widgets to track weather
  36. traceroute (srcguardian)
  37. UltraTools Mobile -- traceroute and other tools to troubleshoot networks
  38. Yaaic -- IRC chat program. Free.
  39. Go Clock Widget
  40. Antivirus AVG. Free. Not sure if it's worth it. ;)
  41. Call Your Folks -- reminder to call parents.
  42. Nike+ Running
  43. Runkeeper
  44. MyBMI
  45. BMI Calculator

    Some app equivalents of popular websites and desktop apps. Also apps that tend to come with your devices

  46. Google Reader -- keep up with your RSS feeds. Unfortunately, limited to 30-day retention. Still one of my most heavily-used apps.
  47. Gmail -- keep up with your google mail
  48. Google Calendar
  49. Google Earth
  50. Google Play
  51. Google Play Books
  52. Google Play Movies and TV
  53. Google Play Music
  54. Google Search
  55. Google Translate
  56. Dropbox
  57. facebook
  58. firefox
  59. Flipboard
  60. IMDB -- search IMDB. Sometimes less useful than the website.
  61. Maps
  62. netflix
  63. Skype
  64. Street View on Google Maps
  65. twitter
  66. Voice Search (google)
  67. WinAmp -- yes, it's available for Android.
  68. Youtube

    Toys and games (all free except as indicated)

  69. AK-47 -- toy gun.
  70. Android Lightsaber
  71. Angry Birds
  72. Angry Birds Seasons
  73. Bard's Tale
  74. Binary Time Widget
  75. BSOD
  76. Defender II -- free to play. After a certain point, upgrades cost money. :(
  77. Radiant Defense -- free to play castle defence. After a certain point, upgrades cost money.
  78. ScreenCrack
  79. Sonic Screwdriver Gadgets
  80. Star Wars Light Saber
  81. Sudoku (Frank and Chase)
  82. Tricorder (not available from the app store)
  83. X-sonic Screwdrivers

    Some apps I no longer use/need

  84. Power Control Plus -- can have a whole lot of toggles, but can't set GPS even with root and running as a system app.
  85. Adobe Reader -- I no longer run Adobe software by choice
  86. Advanced Task Killer (rechild) -- don't like current permissions
  87. Aldiko -- eReader app. Has problems rendering the covers of some of my books. I've switched to Moon+ Reader.
  88. Android Tethering -- prefer wifi tethering
  89. BarcodeBank -- use google goggles instead
  90. Battery Widget (GeekyYouUp) -- prefer Darshan
  91. Brightest Flashlight -- prefer the flashlight that is part of Power Toggles
  92. Color Flashlight HD -- prefer the flashlight that is part of Power Toggles
  93. Power Control Widget -- a power control widget that can have an arbitrarily large number of controls/toggles. Unfortunately, it doesn't work on my rooted ICS Samsung S3.
  94. Moon+ Reader -- ereader app. Doesn't paginate correctly.
  95. Nook -- implements DRM. No thanks.
  96. Out of Milk -- shopping app. No easy sharing.
  97. eReader Prestigio -- ereader app. Put an ad in my notification area.
  98. Racing Live -- free to play.
  99. Shop Savvy Barcode scanner

Tips and tricks

  • You can use widgets to make shortcuts. This is really useful for navigation -- I have shortcuts for home, work, gym, parents, and some others. Also for google reader -- I have a shortcut for slashdot.
  • With AutomateIt, you can have the GPS and 4G automatically turn on when you turn on navigation. This may be updated in the future. :)
  • Sunday, January 30, 2011

    Why hasn't IPv6 been deployed yet?

    A lot of articles talk about why IPv6 is needed, and some talk about why IPv6 is great even if it's not needed. Many people are concerned that IPv6 has not yet been deployed. But one question I've discussed several times recently but have never read in print: why hasn't IPv6 been deployed? There are a lot of reasons.

    Compatibility


    When IPv6 was designed, it wasn't perfectly compatible with IPv4. That is, when one switches to a "pure" IPv6 model, the existing Internet becomes inaccessible.

    Most other software upgrades try hard to retain compatibility. For example, when one language of the web, HTTP, was upgraded from 1.0 to 1.1, a lot of care was taken to ensure backwards compatibility. Any web browser or web server that talked the newer version could also talk the older version. This made the upgrade seemless. Only after upgraded clients became uniquitous did server administrators start taking advantage of the features of the new version. An upgraded device is certainly no worse off than without the upgrade. Even today, ancient web servers written in the old way can continue to provide web content without modification.

    IPv6 doesn't automatically maintain compatibility. If one "simply" upgrades from IPv4 to IPv6 without additional effort, one loses access to the current IPv4 Internet. The IPv6 answers to this problem are "dual-stack" or "IPv4 gateways". In the first case, the prospective IPv6 user must maintain an IPv4 infrastructure in parallel to the new IPv6. In the second case, the prospective IPv6 network administrator must maintain a translation device between the IPv6 and the IPv4 world. While this works, it requires additional effort.

    Effort


    IPv6 requires a lot of additional effort. The home computer user or corporate user won't have much to do, but the various network infrastructure people have to learn new protocols, replace or upgrade equipment that doesn't support IPv6, and replace or upgrade applications that don't support IPv6. This is not an effort that is worthwhile without a mandate or other strong incentive.

    No central authority mandating IPv6


    Other major software upgrades have happened because an authority forced the issue. For example, one of my older coworkers told me that the upgrade to Ipv4 was mandated to occur on a certain day. After that day, the old version would no longer be supported. The US government controlled the Internet at the time, and it was primarily used for research, so such pronouncements were possible. No one has the authority to do that today.

    Incentive


    When new Internet addresses run out, existing devices on the Internet will not immediately be inconvenienced. On that looming date, it will gradually become more difficult to add more devices, although partial workarounds (such as HTTP/1.1 and NAT) are now well-established. But the Internet will not immediately "break". It will be business as usual for most existing devices.

    Meanwhile, there are no significant resources that are IPv6-only today. Until there is a significant resource that is IPv6-only, or IPv4 is in danger of "breaking", IPv4 is good enough for most people.

    But until most people have IPv6 a site would be crazy to make itself IPv6 only.

    This is a classic chicken-and-egg problem. No one wants to upgrade because no one has upgraded.

    The classic way the software world fixes this kind of problem is by sneaking in the upgrade using an easy, backwards compatible upgrade. Except, as above, the IPv6 upgrade is neither easy nor backwards compatible.

    Another way to fix this is for one or more large entities to sacrifice and take the first step. The US government is trying to do this. But it's too little, too late.

    Hardware support


    Even in 2011, there are plenty of new devices being sold that do not support IPv6. These include network routers, switches, firewalls, and more esoteric devices such as sensors, digital matrix switches, fileserver appliances, and others. Each IPv4-only device sold is making the problem a little worse. How can we upgrade if we have to throw away all these investments?

    Application support


    For an IPv6 upgrade to be compelling, one doesn't just need support at end user stations and the routers, switches, and other network gear. One also needs support in applications.

    That means that if I run some kind of application, either as an end user or as a server administrator, I need all my applications to work correctly after the IPv6 upgrade.

    Unfortunately, many applications are not IPv6-ready, themselves. So even if I am prepared to go to the effort to upgrade, how can I do so if all the software I use won't work? The software authors don't feel the incentive to upgrade any more than anyone else does.

    Conclusion


    We are in trouble. Some of these problems might have been solvable 10 years ago, had they been recognized. At this point, it's too late. The Internet will almost certainly go through a protracted period of having IPv4 addresses depleted but IPv6 not yet widely deployed.

    Sunday, January 3, 2010

    Issues with TCL and Expect

    Issues with TCL:

    * scope is insane. There is no automatic inheritance of variables
    from the global scope. If you want a variable from the parent
    scope, you need to declare this by using the "global" keyword.
    There are various other kinds of scope you can do, including going
    into the caller's scope.

    * the language is barely tokenized at all. If there is a basic syntax
    bug, the interpreter is likely to not pick up on it until that
    particular code path is run.

    * There are no forward declarations of functions. If you want to use
    a function, you have to define it before you use it.

    Issues with expect:

    * the documentation encourages people to do "send "$whatever\r";
    expect $prompt". In a lot of cases, though, sending $whatever will
    result in a prompt regardless of whether it also resulted in an
    error or not. This encourages sloppy code. Better guidance might
    be "send "$whatever\r"; expect "$whatever\r\n$prompt", because that
    checks that the host returned a prompt immediately after echoing
    $whatever.

    * Bad things can happen under three special error conditions: eof,
    timeout, and full_buffer. It would be nice if there were a default
    handler for these that threw an exception, to force programmers to
    be aware of them. The handler could be an expect_after_after, so if
    the programmer tests for them in expect_before, expect, or
    expect_after, that test overrides. It might be triggered by a
    special syntax (i.e. expect_sanity or something) so as to avoid
    problems with backwards compatibility.