Notes: General Software Tips by follower

Notes & tips related to software applications that don't get their own page

Android (3.x)

(Note: These currently relate to apps running on an HTC Jetstream tablet running Android 3.1.)

Failure to see all files via MTP

  • Android 3.x supports (& encourages) use of MTP for file transfer rather than mounting as a USB Mass Storage device. Mac OS X does not support MTP natively so use of the Android File Transfer app is required to transfer files to & from the Android device.

    During use I noticed that the list of files displayed by the AFT application did not get updated (or refreshed or reloaded) to match the current list of files on the device. This persisted even if the device was disconnected and reconnected to the computer running AFT.

    (Using an Android File Explorer/Management application it was possible to verify that the files did in fact exist on the storage of the Android device.)

    Eventually I found an article ("Why do some files NOT show up over MTP?") which indicates the problem is caused on the Android side of the equation and is thus cross platform. (So you may see it on Windows or Linux as well.)

    Apparently the issue is caused because the information used for the MTP transfer is only as current as the last "media scan" (the same issue that means sometimes new camera images etc don't appear in the Gallery app). The solution is to force a rescan of the "media" (i.e. what used to be an actual SD card but may now just be internal storage). This is a standard Android function that is called at boot time and possibly other times. To force a rescan requires an application to trigger the relevant Android functionality.

    Rather than using the app suggested in the thread mentioned above I found Rescan Media in the market and it appears to work effectively to force a media rescan thus making the file changes visible via MTP. (The only slightly weird thing is that once you set it to auto-quit it doesn't seem possible to reverse it. Not a big deal.)

    Yak shaved!

Tidying Quill for Android output in Inkscape

  • Quill for Android is a cool FLOSS app (also available on the Market for $1.00) for note-taking and other pen input tasks. At present it can export to PNG (in raster form) or PDF (in vector form).

    Inkscape will open the PDF files happily but the vectors are made up of individual line segments which is less than ideal.

    Until Inkscape supports variable width paths (see: 1, 2, 3, 4) we need to consider other approaches:

    • With heavy playing around it might be possible to have some success based on this post suggesting:

      Even "simpler" is to copy a path to your clipboard with ctrl+c (must be a path, not a group or object), then in the pen or pencil tool select the shape dropdown and select "clipboard".

      This is just a shortcut to applying the pattern along path LPE.

      It may be possible to programmatically generate the shape of the path-effect to be stretched/placed along a path to match the original outline while preserving the underlying line. (You can poke around with the XML used to see how they interact.)

    • However, in the interim, this is the approach I used:

      1. Select all the path segments that make up a letter or object.

      2. If you just want to have a single line and width you can choose Path > Combine and you'll be done. (You may want to specify a line width if the smallest line width is used for the whole line & the width is too fine.)

      3. The second option if you want to preserve the variable width line but lose the ability to edit/treat it as an actual line is to:

        1. Choose Path > Stroke to Path.

        2. Choose Path > Combine.

        3. The result will be a single closed, filled shape that matches the widths of the original stroke segments but without it's "pathy-ness". :)

        4. Optionally you may wish to Path > Simplify also.

    Which approach you want to use will depend on what you want to do with the end product and whether the difference in appearance is significant.

    (I wondered if there might be some way of combining the two with the "pattern on path effect"... It doesn't work as is--but if you could convert the shape to a variable width "line" shape in a single plane it might work as a pattern. (But apparently not from some quick hacking around.) (Whoops, made Inkscape crash too.))

So, yeah, anyway. That's that. :)

  • Note: It seems like the multiple segments per path only applies to the pen tool with variable widths--if you draw an object with a pencil it stays as one object in the PDF. Also, in Inkscape you can search e.g. by colour to combine objects together to get semi "layers".

Markdown (formatting/mark-up language)

  • Ending a line with three spaces and continuing on a newline will create a line break without a blank line between the two lines.

    For example, you put three spaces here:
    and then carry on here.

        It also works in a situation   
        like this.
    

    (via)

  • Bookmarklet to create markdown formatted link to current page with either a text selection or page title (if no selection) as the link text:

        javascript:(function(){try{s=document.selection.createRange().text;}catch(_){s=document.getSelection();}   
        prompt('Markdown Link','['+(s.toString()||document.title)+']('+location+')');})()
    

    Created with Bookmarklet Builder based on "Markdown Link" from "Bookmarklets for text manipulation" (via URL Decoder/Encoder which actual breaks the original bookmark because the + characters aren't kept).

    (You'll need to copy the code above & paste it into a bookmark because bookmarklets aren't directly support in Markdown.)

  • Quick way to indent a file/clipboard entry with the required (at least) 8 spaces to make it an indented code block (the pb* commands are OS X-specific):

        pbpaste | sed 's/^/        /' | pbcopy
    
        sed 's/^/        /' <filename>
    

Linux

Mounting disk images made with dd

I had a disk image I'd made using dd (I assume) of an eee netbook SSD and was trying to work out how I could mount it somewhere. Running file on it from OS X produced:

    eee900_rootfs.img: x86 boot sector, GRand Unified Bootloader (0.94); partition 1: ID=0x83, starthead 1, startsector 63, 4819437 sectors; partition 2: ID=0x83, starthead 0, startsector 4819500, 3020220 sectors; partition 3: ID=0xc, starthead 0, startsector 7839720, 16065 sectors; partition 4: ID=0xef, starthead 0, startsector 7855785, 16065 sectors, code offset 0x48

Which is not exactly the most helpful formatting. So, modifying that shows:

    eee900_rootfs.img: x86 boot sector, GRand Unified Bootloader (0.94);
    partition 1: ID=0x83, starthead 1, startsector 63, 4819437 sectors;
    partition 2: ID=0x83, starthead 0, startsector 4819500, 3020220 sectors;
    partition 3: ID=0xc, starthead 0, startsector 7839720, 16065 sectors;
    partition 4: ID=0xef, starthead 0, startsector 7855785, 16065 sectors, code offset 0x48

Which more clearly shows that there are multiple partitions.

On Mac OS X I tried opening the .img file and it mounted a volume named BIOS but nothing else.

VirtualBox didn't recognise the .img file as anything it could use.

Then I found the extremely informative article "Mounting a raw partition file made with dd or dd_rescue in Linux" which first helped made sense of the file output (leading to my reformatting of the output above) and then mentioned the solution is to "mount the [image] file with an offset specified".

The article also mentions using fdisk -l to list the partitions, which under Linux (Ubuntu 8.04 cough) gave the output:

    $ fdisk -l [snip]/eee900_rootfs.img 
    You must set cylinders.
    You can do this from the extra functions menu.

    Disk [snip]/eee900_rootfs.img: 0 MB, 0 bytes
    255 heads, 63 sectors/track, 0 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x8eb98eb9

                                Device Boot      Start         End      Blocks   Id  System
    [snip]/eee900_rootfs.img1               1         300     2409718+  83  Linux
    [snip]/eee900_rootfs.img2             301         488     1510110   83  Linux
    [snip]/eee900_rootfs.img3             489         489        8032+   c  W95 FAT32 (LBA)
    [snip]/eee900_rootfs.img4             490         490        8032+  ef  EFI (FAT-12/16/32)

It turns out that on OS X you can get similar results with:

    $ fdisk [snip]/eee900_rootfs.img
    Disk: [snip]/eee900_rootfs.img  geometry: 977/128/63 [7880544 sectors]
    Signature: 0xAA55
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     1: 83    0   1   1 -  299 254  63 [        63 -    4819437] Linux files*
     2: 83  300   0   1 -  487 254  63 [   4819500 -    3020220] Linux files*
     3: 0C  488   0   1 -  488 254  63 [   7839720 -      16065] Win95 FAT32L
     4: EF  489   0   1 -  489 254  63 [   7855785 -      16065] <Unknown ID>

(Note that while it's not obvious that the OS X fdisk operates on disk image files in addition to actual devices but it does.)

Oh, so, after a bunch of mucking around I discovered that VirtualBox (4.1 at least) will in fact recognise the raw disk image file if you change the extension to .hdd. Which is, you know, handy--but kinda stupid at the same time.

So from there on I could just mount the partitions as normal in Linux in the VM.

(In some other scenario I would instead go ahead and use the "mount with offset" approach mentioned above and in "Trouble mounting dd image file.")

VirtualBox

There seems to be some issue with clipboard sharing: here, here. If you kill the VBoxClient --clipboard process that uses heaps of CPU after a copy it will at least drop the CPU usage. Using strace it seems to get stuck in a futex wait loop or something. Too many yaks.

Links

See also: