VHD Attach 2.10 (Beta 1)

Illustration

VHD Attach in version 2.10 is mostly about fixing some hard to catch bugs. However, one feature sneaked in and justified this beta.

Finally there is an option of read-only attaching a virtual disk file. Really good feature for taking a quick look into virtual disk without risk of changing anything.

Version is available at https://www.medo64.com/vhdattach/beta/.

P.S. Final 2.10 version has no timeline since I do have to pay my bills and that kind of work takes priority. You can always donate some money to speed me up. :)

Mercurial on FreeNAS

Illustration

In search for smallest possible Mercurial installation I remembered my old friend FreeNAS. This is small NAS server (at least in 0.7 version) based on FreeBSD 7.3. System requirements are low: 256 MB of RAM and 512 MB system disk is all that is needed. And, of course, you need to have full installation of FreeNAS. Embedded will not suffice.

I will not explain how to setup FreeNAS here since it works out of box with pure defaults. Only thing to configure is where you want your data to be and this should be easy enough to do by yourself (hint: check “Disks” menu). My final goal is to have equivalent for Mercurial under Ubuntu.

First step is to install needed packets. This can be done from web interface (System->Packages) and following packets are needed (given in order of installation):

Now we need to copy some basic files: [bash highlight=“1,2”] $ cp /usr/local/share/doc/mercurial/www/hgweb.cgi /mnt/data/hg/hgweb.cgi $ cp /var/etc/lighttpd.conf /var/etc/lighttpd2.conf [/bash]

We also need a new config file that should be situated at “/mnt/data/hg/hgweb.config” and it should have following lines:

[collections]
/mnt/data/hg/ = /mnt/data/hg/

[web]
baseurl=/hg/
allow_push=*
push_ssl=false

We need to edit “/mnt/data/hg/hgweb.cgi” in order to fix config parameter. Just change example config line with:

config = "/mnt/data/hgweb.config"

At the BOTTOM of existing “/var/etc/lighttpd2.conf” (notice that we created this file via cp few steps ago) we need to add:

server.modules += ( "mod_rewrite" )
url.rewrite-once = (
    "^/hg([/?].*)?$" => "/hgweb.cgi/$1"
)
$HTTP["url"] =~ "^/hgweb.cgi([/?].*)?$" {
    server.document-root = "/mnt/data/hg/"
    cgi.assign = ( ".cgi" => "/usr/local/bin/python" )
}
$HTTP["querystring"] =~ "cmd=unbundle" {
    auth.require = (
        "" => (
            "method"  => "basic",
            "realm"   => "Mercurial",
            "require" => "valid-user"
        )
    )
    auth.backend = "htpasswd"
    auth.backend.htpasswd.userfile = "/mnt/data/hg/.htpasswd"
}

This config will ensure that everybody can pull repositories while only users in .htpasswd file can push. If you want authorization for pull also, just delete two highlighted files. Notice that users are defined in .htpasswd file that needs to be created with htpasswd command-line tool. Since that tool is not available in FreeNAS easiest way to get user lines is to use online tool.

In order to test how everything works, just go to shell and restart lighttpd with new config:

kill -9 `ps auxw | grep lighttpd | grep -v grep | awk '{print $2}'`
/usr/local/sbin/lighttpd -f /var/etc/lighttpd2.conf start

If everything goes fine, you should be able to access repositories at “http://192.168.1.250/hg/” (or whatever you machine ip/host name is).

As last step we need to add those two commands above (kill and lighttpd) to System->Advanced->Command scripts. Both lines get into their own PostInit command. This ensures that, after every reboot, we start lighttpd with our “enhanced” config file.

P.S. Do not even try to edit “/var/etc/lighttpd.conf”. It gets overwritten after every restart.

P.P.S. This post is just about enabling Mercurial under FreeNAS and because of this it is simplified. It is mere starting point. For further reading check official Publishing Repositories with hgwebdir.cgi guide and my guide on setting-up Mercurial under Ubuntu.

Was It Worth It?

Illustration

Here I am speaking of Gingerbread upgrade for HTC Desire. And in short - it was worth it.

First thing that I noticed after upgrade was different vibration feedback on key press. I cannot say whether it is better, worse or just a product of my imagination but it is noticeable. :) Screen looks the same as in Android 2.2 but there as subtle differences (e.g. icons in status bar).

There is improvement in speed. It might be just effect of finally clearing phone of all nonsense that got installed over these months but I think that there are some optimizations behind it also.

Although HTC did cut some applications, only one that I found missing from original ROM was Flashlight. Since this application’s install file is included in same zip file that brings update, I didn’t miss it for long.

Calendar application got small change - addition of time zones. This feature is worth the whole upgrade mess to me. As with all killer features most users will neither need nor notice it. However, if you travel a lot this is life saver.

Additional nice touch comes in form of “Pocket mode”. It basically makes ring tone extra loud if it detects that you have phone in pocket or case. I still have to see how this will work in practice but it at least shows some actual thinking.

And that was all that I consider worth mentioning. This is not a major upgrade as far as user interface goes nor it is as different as HTC would make you think. It is just a simple evolutionary step.

Gingerbread Desire

Illustration

HTC Desire got it’s Gingerbread update!

In order to keep shitty attitude they have made it as difficult and frightening to install as they could possibly do. First of all, there is no version for Germany (Telekom Deutschland), North America, South Korea and Japan. Most of my readers will probably notice this “North America” part.

Another thing to notice is zip file with another zip file and then an installation inside. It reminds me of Babushka doll. All that is rounded with layer of warnings that would make Charles Manson seek his mommy. And for a good reason - all your data will be gone once upgrade starts.

In order to even think about phone upgrade, you need to get HTC Sync from HTC support. This is probably most bloated piece of shit software from HTC but unavoidable. Just to be sure this won’t mess with my development setup on this machine I made fresh install on my wife’s laptop.

Whole update takes approximately 5 minutes and it goes without any problem (if you discount wiping data as a problem). It leaves you with software version 3.14.405.1 (Android 2.3.3) and no hope of getting next update. :)

P.S. If you are wondering, my internal storage has 124 MB free.

Getting String Value for All Object's Properties

In last post I wen’t through task of restoring properties from their textual representation. But how did we end up with text?

It is as simple as loop through all public properties and then using TypeConverter in order to properly convert a value to it’s string representation. Do notice that ConvertToInvariantString is preferred over ConvertToString in order for code to properly work on non-USA Windows.

public static IDictionary<string, string> GetPairs(object objectInstance) {
    var result = new Dictionary<string, string>();
    foreach (var propertyInfo in objectInstance.GetType().GetProperties()) {  //loops through all public properties
        var propertyConverter = TypeDescriptor.GetConverter(propertyInfo.PropertyType);  //gets converter for property
        var stringValue = propertyConverter.ConvertToInvariantString(propertyInfo.GetValue(objectInstance, null));  //converts value to string
        result.Add(propertyInfo.Name, stringValue);
    }
    return result;
}

P.S. Saving key/value pairs to file is not shown here… guess how it is done… :)