suspend to ram

Over the years I’ve encountered, and resolved many annoying software issues with Microsoft. This one surely counts as one of the more annoying ones.

The problem is that my previous PC had a beautiful suspend to ram feature, which basically means that whenever you put the machine in stand by mode the system turns of almost completely except for a bit of power to keep the memory going. The technical term for this is ACPI S3 mode. My new PC however, suspends using ACPI S1 mode which means it goes stand by with the harddisk still spinning and the fans still blowing, not my idea of stand by. Naturally this was something I wanted fixed really badly. So I enabled the feature in the bios, set all the power options in windows as they should be and …. no success.

My mistake was to assume that this is a hardware/bios problem. So I kept checking the asrock site for bios updates and browsed through their FAQ, double checked bios settings drivers, etc.. Since this isn’t a problem with their hardware, bios or drivers after all, no solution was found this way. Next stop was google, but I still had the asrock keyword as part of the query so nothing useful came out of that. Then I just gave up and for the past few months I’ve been shutting down the pc completely.

This morning I googled for “force s3 standby” and ended up on this site. I learned a things here:

  • My system supporst S3 just fine, I checked using this sleeper tool.
  • Users with completely different hardware are experiencing the exact same issue (and are equally frustrated).
  • There’s a registry hack you can do but it doesn’t do much good on its own.
  • There’s lots of useless advice on enabling/disabling wake up from standby options on usb devices (my mouse and keyboard are ps/2!).
  • There’s a tool called dumppo which supposedly does something useful.

Ok, the next google query concerned dumppo, which got me here. It appears that this is a Microsoft provided (but totally undocumented) utility that you can use to check and change the ACPI settings. Sure enough my “Min sleep state” was set to S1. The reason? I installed windows XP before I enabled suspend to ram in the bios. Doh! Apparently the ACPI settings are determined forever during setup and no functionality to fix this is included with the OS. After the installation you’re screwed no matter what you toggle in any control panel, bios or other screen. Windows XP just keeps insisting that S1 is the way to do standby.

Dumppo (download from microsoft) apparently is the only way out (short of reinstalling XP). A simple “dumppo.exe admin minsleep=s3” on the command line fixes the problem. Of course this wisdom is not officially documented anywhere on the Microsoft site. There must be millions of users out there that are unable to suspend to ram because of this. Basically all computers sold in the past few years are technically capable of suspend to ram. Many of them have the option disabled in the bios by default.

Anyway, problem solved :-). Just one of these issues ordinary users will never ever figure out. I must have solved hundreds of these issues over the years.

fun with rendezvous

One of the innovative features in Mac OS X is support for DNS-SD, a.k.a. rendezvous. I was reading about the Java API for this by apple on onJava. Then I wondered if there was a pure Java implementation, because I dislike using native stuff in Java (complicates deployment).

That’s why I like google: “+rendezvous apple pure java” -> this link, right at the top. So two minutes after getting this idea, I’m doing a “jmdns-1.0>java -jar lib\jmdns.jar -browse” as the readme of JmDNS suggests, to launch the swing based dns-sd browser. JmDNS is a 100% pure java implementation of dns-sd that claims to be compatible with the real thing from Apple.

Now the reason I’m posting. I was expecting zero or at most a handful of dns-ds services on my network. I was absolutely shocked by the number of people publicizing these services on the same cable network as I am. There’s dozens of different services, each with multiple devices offering them. It seems the default settings of Apple cause their devices to happily announce all sorts of details about themselves on the lan. The nature of cable networks of course is that the entire neighbourhood is one big lan. So effectively, I’m getting access to all Rendezvous capable devices in my neighbourhood.

Right now, I’m listening to a some AC-DC tracks of one of these users who has kindly shared his music in iTunes, which means my iTunes magically finds this music (courtesy of dns-sd) :-).

Speaking of iTunes. I’m thinking of abandoning it. I like the UI but it crashes way too often. Just now it crashed twice. Yamipod aledgedly is very nice and capable of syncing with my ipod.

wlan gone paranoid

My new PC has a smc wlan pci card. It seems to work very nicely with none of the problems my previous siemens usb stick had. However, I appear to be not connected, currently. Which is strange since I seem to have no problem browsing the web, downloading stuff, etc. But the windows wireless icon insists on displaying a red cross (usually that means trouble). Weird. If Idouble click it, it will confirm that it isn’t connected, along with a text “you are connected to this network” below the text “not connected”. It also displays four out of five green bars which tell me the (dis)connection is excellent. Ah well, it’s only service pack 2.

New PC & moving itunes library

Update 30/07/2009I just bought an imac and moved the same, but now consolidated, library over to it. Check out the instructions here.

Whoohoo! My new hardware has arrived, last week. I’ve been busy playing with it so that explains the small delay in posting.

Right now I am still going through the tedious procedure of getting everything the way I want it. I have a local network so I can access my old PC. However, dragging my external HD between the two machines is much faster.
Tediousness includes copying my itunes library. Tricking itunes into accepting the old library is somewhat of a challenge. But that’s what’s google is for. Since I found google’s answers a bit disappointing (lots of drag this folder there type of stuff from Apple users), I’ll post some detailed instructions for real users who do not “consolidate” to the itunes folder but choose to keep their music organized manually. To add some difficulty, my new machine has no second harddrive so the paths are different after copying.

If all goes well everything is moved (music, playlists, play statistics, ratings) AND I can sync my ipod with the new pc without that requiring it to be wiped and refilled with the moved library. I’m moving the library, not recreating it.

The Itunes library consists of only two files, its own itunes music folder and whatever external directories you imported (two in my case). One of the two files is a binary file, the other one is an xml file with data on all your songs, including path names, statistics, ratings, etc. Essentially, the xml file contains everything we want to migrate except for the mp3s. Unfortunately, moving the itunes library is not as simple as copying the files to the new machine. Sadly, Apple deliberately made it hard to do what you are about to do. So here’s a step by step guide (windows specific though Apple probably is about the same):

  1. At all times, keep at least one intact backup of all files mentioned in this post. Never work on the originals. Preferably, leave the original library untouched, you can always go back to that.
  2. Start by copying your mp3 folders to your new machine. That may take a
    while. Make sure they are where you want them to be. It took 20 minutes for my folders using an external HD, not
    counting the time it took to create the backup from scratch on
    the external hd (basically I used my incremental backup). Also copy both Itunes files (xml and itl) and the itunes mp3 folder (if not empty)
    onto the external hd.
  3. Now dowload, install, run & close itunes. It will create an itunes
    directory for you the first time it starts, that’s where it will look for its files. Replace the stuff inside this directory (My Documents\My Music\iTunes) with the
    backups on your external hd (including the itunes music folder). Now here comes the tricky part. Thanks for
    this post for putting me on the right track! DO NOT start itunes again until after the steps below.
  4. First fix the pathnames in the xml file. They still point to the old location. Open the file in a capable editor, the thing to look for is search and replace functionality. Search and replace the parts of the path names that are now different: your itunes music folder and any other folders you imported in your old library. Save the file.
  5. Now this is important: iTunes will ignore whatever path info is in the xml file! Unless the itl file becomes corrupted. We can fix that! Open the itl file in an editor, delete the gibberish inside, save. Your itl file is now corrupted, normally this is a bad thing. You still have the xml file though (and a backup of the itl).
  6. Start itunes, it will ‘import’ your music and afterwards complain that the itl file is corrupted, let it fix it.
  7. Check if everything is there. In my case I messed up with the search and replace and some files were missing. Just go back a few steps, copy your backups and retry.
  8. Done. Everything now is on the new PC. What about the ipod? Just plug it in!. You already installed iTunes on the new machine so you have the drivers for your ipod. The key or whatever itunes uses to recognize you ipod is in the xml file. And now also in the recreated itl. Apparently the xml file is sort of a backup of the itl. I suspect the itl is a bit more efficient to manipulate programmatically. I have no idea if this preserves any itunes store stuff you purchased. Presumably, this involves deauthorizing your old machine and authorizing the new one. I never used the itunes store so it’s not an issue for me.

The only thing I lost in the transition is some iTunes preferences that are easy to restore. For example I had some of my playlists set to shuffle. The imported playlists no longer had the shuffle enabled. Big deal. The preferences probably aren’t part of the library. I noticed that the shuffle settings do not sync to the ipod either. This is annoying actually because the shuffle settings is deep down in some menu on the ipod and I only want to shuffle playlists. I like my album songs served up in the order that they were put on the album.

I’ve used winamp for most of the past decade (I think from 1996?). Only when I got my ipod a few months ago, I started using iTunes, by choice. There is an excellent winamp plugin which will allow you to sync winamp with your ipod. Presumably, moving a winamp library is a lot more easy since winamp uses a file based library rather than a database. However, the main developer has left AOL, so winamp development seems a lot less interesting these days. AOL seems to just pile on commercial crap with every release. So I’ve given up on it for now.

Howto start jEdit

At work I am (in)famous for being responsible for getting jEdit onto everybodies desktop. Despite this everyone uses textpad :-/. These primitive souls are perfectly happy (or ignorant?) not using syntax highlighting, not having their xml validated, not being able to search and replace using regexs, not being able to indent their xml files, not having autocompletion, etc.

Anyway, one of the nastier aspects of jEdit is integrating properly with windows and configuring it. Older versions included a convenient but broken .exe frontend. Newer versions require some manual setup to get going.

First of all, the jvm matters. jEdit runs faster and prettier with jre 1.5. Second of all, select native look and feel unless you really like the shitty java look and feel.

A crucial thing is to provide enough memory AND specify a small enough minimum heapsize. Contrary to the popular belief, java programs are quite efficient. jEdit for example can run with just 10MB of memory heap. Unless of course you open up big files or multiple files in which case you may need more than that. The trick with Java is that you can specify upper and lower limits on the memory heap. The garbage collector will never shrink the heap below the minimum or grow it above the maximum. With jEdit, most of the time you don’t need that much, so specify 10Mb as the minimum. You may need more sometimes though, especially when you are running lots of plugins so specify 256 as the upper limit (probably way more than jEdit will ever use).

Another crucial setting is -reuseview which will allow you to reuse already running jedit windows for opening new files.

Use the following settings for a shortcut:


javaw.exe -Xms10M -Xmx256M
-jar "C:/Program Files/jEdit 4.2/jedit.jar" -reuseview

I also have a nice cygwin shell script to be able to open a file straight into jEdit.


#!/bin/bash
currentpath=`pwd`
javaw -Xms10M -Xmx256M
-jar "c:/Program Files/jEdit 4.2/jedit.jar" -reuseview `cygpath -w $currentpath/$1` &

An ‘open in jedit’ context menu option can be obtained by importing this registry setting (create text file jedit.reg and paste stuff below, save, double click on the file)


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT*shellOpen with jEdit]

[HKEY_CLASSES_ROOT*shellOpen with jEditcommand]
@="javaw -Xms40M -Xmx256M -jar \"C:\\Program Files\\jEdit 4.2\\jedit.jar\" -reuseview \"%l\""

Edited as suggested in the comments, wordpress conveniently removes slashes when you save the text :-(.

Update 02-04-2011:

It’s been a while since I wrote this and when I hit my own post accidentally with a Google query, I knew it was time to do a little update. All of the above is still valid as far as I know, except I now use a mac. For a mac, or in fact any linux/unix type installation, there’s a convenient way to start jEdit from a bash function. Just include the line below in your .profile or .bashrc (adjust paths as needed of course):

function jedit() { java -Xms15M -jar /Applications/jEdit.app/Contents/Resources/Java/jedit.jar -reuseview "$@" &}

Update 11-07-2011:

The above line of .profile voodoo is now also available on Gist, the code snippet sharing site on Github.

In search of the One True Layout

A few weeks back when I re-launched my blog in wordpress, I made a few comments about not being interested in working around the many specification and implementation bugs of CSS and make a really nice, spiffy layout for my blog. That’s why you are looking at the (pretty) default template of wordpress.

This article captures my point perfectly:
Introduction – In search of the One True Layout

It describes a solution to a very common layout problem: how to position blocks on the page next to each other. The solution outlined works around several IE bugs. Then when it works they point out to make it do what you really want (like put the whole thing in a containing block), you will need to work around even more bugs, including a few mozilla bugs that surface when you use these workarounds. Oh and the whole thing does not work in Mozilla anyway due to a recently introduced bug that (on trunk) has just been fixed (today!).

That’s why I don’t want to do CSS/HTML based web design anymore. Any reasonably complicated design requires you to either compromise on what you want to achieve or to use a whole series of bug workarounds, stretching the css implementation well beyond its specified/intended behaviour and hoping that next months browser updates won’t break things.

Unacceptable.

CSS is a hopelessly complicated and IMHO deeply flawed standard. Sadly, no alternatives are available.

The coming paradigm shift in TV broadcasting

The coming paradigm shift in TV broadcasting
The coming paradigm shift in TV broadcasting

This article comments on Apple’s latest move to offer video content through their iTunes and how this is a logical and inevitable move with some far ranging effects.

In this blog post I abstract from this and apply it to the whole telecommunications, media and IT industry. Some things are about to change in this economically important sector.

It’s understandable they put up a fight. The telecommunications sector is built on the notion that exchanging information (in any form) costs money. The media industry is built on the notion that media needs to be distributed (physically) and that they can charge dollars for that. And finally the IT industry is used to steady income from license fees from software. All these industries may lose a lot of revenue if the rules are changed.

And that’s what’s going on. Apple just changed the rules for the Media industry. This will have a snowball effect. Right now if you want to watch something (movie, the news, tv series, documentary) you need to turn to one of the industry controlled and closely guarded media: cinema, a tv channel, a dvd, etc. Each of these things is a source of revenue to the industry and you pay directly or indirectly for it in all sorts of ways. There’s nothing against that in principle they offer access to scarce resources and people pay a market price for access.

Their problem is that Apple just made these resources a lot less scarce. Distribution through the internet of content is cheap and will become even cheaper. Technology will gradually erode the cost to close to 0$. There’s plenty of bandwidth available and an increasing amount of people has what I call a critical amount of bandwith: enough bandwidth to make streaming high definition audio and video feasible & desirable.

Apple is tapping into this by letting their users access content over the internet through their iTunes store and by providing the necessary hardware and software to them. That’s a small change and not at all revolutionary. But it will teach people an important lesson: hey I can watch desperate housewives (one of the offerings used to commercialize the new itunes ability) whenever I want, wherever I want and I don’t need to buy the dvd, I don’t need to turn on the tv on a specific time and I don’t need to watch the commercial blocks. The next steps are obvious and imminent: why store the desperate housewives episode on an ipod when you can just stream it? Mobile networks will soon mature enough to reach the same critical bandwidth as home users are currently enjoying on their home networks.

That means that anytime, anywhere you can start streaming anything to your mobile phone, your pda, your ipod, your tv that anyone bothers to put online. Inevitably this will replace all existing forms of content distributions. Why tune to a channel to view some program when you can just start streaming the program whenever you want, skip to any part you want and pause it whenever you want, etc?

Apple just gave the industry a little reality check, just like they did when they kick started online music sales a few years ago: if the industry doesn’t move, somebody else will. Over the next few months, one after the other media company will either join apple or similar iniatives from e.g. microsoft. Once this happens the pressure will be on and the market will do its work. Better content leads to more online revenue, at the cost of traditional revenue. The huge gap between cost of content production and content distribution and the market price (which is obscene) will start to come under pressure as well. At some point in the near future the market model will change from paid downloads to paid streams (subscription, per view, etc).

This will put an end to tv networks as we know them. They are content distributers and we don’t need them anymore.

The same is going on in the telecommunications sector where revenue used to come from telephony and related services. IP telephony has eliminated the need for paid telephone services since it works just fine over a modest internet connection. If you have umts phone, it is technically possible to use the internet for IP telephony so why exactly are we paying 30 cents per minute for a local phone call? Some mobile networks already offer fixed price bandwidth (expensive though). The operators on these networks get their revenue from a number of services, all of which with the exception of the network connection are technically possible with already available software packages that use the connection. People think it’s normal to pay 25 cent for the delivery of a 160 character message to a cell phone (SMS). If those two cellphones are umts phones and run msn, icq, aim, jabber or any of the other IM network clients you can send unlimited messages to anyone freely. Surprisingly few people have figured this out but they will. These changes are already happening and will kill much of the telecom industry as we know it. A mobile phone is nothing else than a general purpose computer with a umts modem or similar wireless connection and some general purpose software. The form factor is irrelevant.

Which brings us to the software industry because nothing of the above requires software with a pricetag greater than 0$. All of the services mentioned above can be implemented using existing, open source software. In fact oss developers have already done most of the work and created OSS media centers, video & audio codecs, communication software, real time operating systems and any other kind of software component you could possibly need to implement any of the services mentioned in this document. It’s just a matter of putting together the components.

So what remains is bandwidth, hardware and intellectual property. Any revenue not coming directly from these, will vaporize in the next few decades. The remaining revenue will still be sizable but probably less than the industry is used today. 50$ for a dvd now is considered normal today. I’d be surprised and disappointed if I was unable to watch star wars III on my mobile phone anywhere, anytime for over 5$ in about ten years. And no way am I going to watch that shit ten times.

My impression is that the whole proces will be slow thanks to the industry resisting any form of progress. It will take some outsiders, like Apple, to change the rules gradually. These outsiders exist and are already changing the rules.