Search

Chaps

Sweet sweet memories

Blather

Uptime verified by Wormly.com

14 August 2008

locale: Cannot set LC_CTYPE to default locale

I get this problem a lot.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "en_AU.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

I think possibly this solves it.

$ sudo apt-get install --reinstall language-pack-en

It says comforting things like...

Generating locales...
  en_AU.UTF-8... done
  en_BW.UTF-8... done

Update: Except it didn't work. But maybe this will.

$ sudo localedef -i en_AU -f UTF8 en_AU.utf8

18 July 2008

Dell 2408WFP Widescreen Monitor with Ubuntu Hardy

It took me a while to figure this one out, because I'm totally unelite.

Section "Monitor"
  Identifier    "Dell 2408WFP"
  Option        "DPMS"
  HorizSync 30-83
  VertRefresh 56-75
EndSection

Section "Screen"
  Identifier    "Default Screen"
  Device        "ATI Technologies Inc RV380 [Radeon X600 (PCIE)]"
  Monitor       "Dell 2408WFP"
  Defaultdepth  24
  SubSection "Display"
    Modes       "1920x1200" "1280x1024" "1152x864"  "1024x768"  "832x624"   "800x600"   "640x480"
  EndSubSection
EndSection

xorg.conf

16 June 2008

Apache again

I've finally ditched lighttpd + fastcgi and replaced it with Apache on smurf. Lighttpd was good, but fastcgi was a total dog. It broke all the time and it got to the point that I didn't want to host my friends sites anymore. Every time I went on holidays fastcgi seemed to fall over and all the sites would be down for a day or three.

So I've gone back to the stable world of Apache, although not on the important server. In all the years I used Apache and mod_php it gave me no problems at all. A total rock. I was seduced by lighty's memory footprint, but I was a fool.

I'll move the other server over to Apache as well at some point, the one with Thoughtful Foods and KSAsub.. I thought rewriting all the configuration files was going to be a pain, but it was actually really quick. RewriteCondition with -f is bloody marvellous.

10 November 2007

Significant Digits in R CRAN

I get a bit sick of scientific notation in R. And when I try to turn it off, I get sick of all the decimal places. These options seem to mostly stop scientific notation and give a happy number of decimal places.

options(scipen = 6) # bias against scientific notation
options(digits = 1) # show fewer decimal places

12 October 2007

iTunes Rating Distribution

I have spent a bit of thought trying to work out the best way of rating my iTunes music. Most of it I haven't rated, or have rated only by album. It's mostly an academic question, because there isn't much you can actually do with the ratings once you've stuck them in.

At first I found myself rating everything as three stars or more. I thought, if it's rated less than three then why not just delete it. Those were times of precious disk space for me, but it does make sense in general. Scrolling through a whole lot of junk music is a pain, even if you've got endless disk space. Not mention that obsessives like me obtain a great deal of satisfaction from having a neat music collection, with all the ID3 tags in good working order.

So I thought I need to reinterpret the ratings. Normally one star means something is shite. In my case I wanted one star to mean "just good enough not to get deleted". So I started doing that. And it worked pretty well. Most of my playlists drop stuff with one star, but the music is still there if I want to listen to it - which occasionally I do.

I also thought about the top rating - five stars. Should I keep it reserved for only the best, life-changing music? Should I assume that music goodness is uniform and give five stars to 20% of the collection? Or is it some sort of normal distribution (or something non-symmetric but similar)? Tough questions I know. Should I worry about trying to make my ratings comparable to other people's ratings. What about rating inflation? Will I one day need a 6th star? And when I'm in a good mood I'm likely to give everything good ratings. I find that every time I really enjoy a song I end up giving it four stars because giving it five makes me feel like a rating floozy, and giving it three just feels mean. I suspect there's a decided spike at four, and this troubles me.

Another problem is that I never take the effort to rate anything that I don't like. So everything has four stars or no rating at all. Which is totally useless. I've started bulk rating whole albums, hoping that over time I'd use some Bayesian logic to gradually make each song rating more appropriate. I did this just to get some data in there but it isn't very satisfying.

I'm inclined to think that I should maintain some sort of histogram and try to ensure that the ratings distribution sticks to something reasonable. Perhaps just a uniformish distribution. Hopefully, I'll subconsciously adjust my ratings based on short-term distortions in distribution over the long-term it stays reasonable.

Clearly, plenty more thought needs to be done on this. Although I can't help but wonder if my life would be better if I completely removed the whole rating column from iTunes altogether.

29 August 2007

Is the CIA using Plone?

CIA using Plone?

How cool would that be? What Plone may lack in goodness, it more than makes up for with open-sourceness.

19 August 2007

Google Apps

Google Apps is a beautiful piece of online software. I'm hopeless at maintaining servers and all that jazz. I always screw up the packaging for accidentily delete everyone's mail so I have room for more videos of fish. Google Apps makes email so easy. It makes a few other things really easy too, but most of other things it makes easy aren't that useful. But the mail. Very good.

17 August 2007

Convert .docx to .odt

You can convert Microsoft Word Open XML (.docx) files to OpenDocument (.odt) formats using the open source ODF Converter software on Sourceforge.

The ODF Translator Command Line is the version that worked most easily for me. Apparently it will import and export to Microsoft Word, but that didn't happen for me. And the command line version doesn't require you to have Word at all. Once you've unzipped the command line tool, you just have to run this from the Windows command line.

OdfConverter.exe /I file.docx /O file.odt

Then you're done. If you don't have OpenOffice or Word to convert it back into a normal old-fashioned .doc file, you can import the .odt file into Google Docs and export it from there.

16 August 2007

XCache with PHP5 and Lighttpd on Ubuntu Dapper

PHP is been pretty slow for me since I left Apache 2 and the PHP code caching behind. I tried turck mmcache with PHP4 and it worked pretty badly. It sped things up, but lighttpd started freezing up every few hours. It was probably FastCGI screwing up and it might have been fixed with FastCGI since then. But I'm all PHP5 now, so I needed to use something else. The Lighttpd guys suggested (and maybe created) XCache so I tried it. It only took a few minutes to install and it's working sweet. Wordpress page loads are down from 300ms to 50ms. I just hope it doesn't screw other things up.

I used the XCache installation instructions but had to do things a bit differently.

  1. Downloaded the XCache source from http://xcache.lighttpd.net/

    ~/src $ wget http://... (the release url)
    ~/src $ tar -zxf xcache-*.tar.gz
    ~/src $ cd xcache
    
  2. You have to install php5-dev and make if you haven't got them

    ~/src $ sudo apt-get install php5-dev make
    
  3. Run the PHP/XCache installation stuff

    ~/src/xcache $ phpize
    ~/src/xcache $ ./configure --enable-xcache
    ~/src/xcache $ make
    ~/src/xcache $ sudo make install
    
  4. Edit the php.ini file to tell it where the xcache.so file is located. Mine was at /usr/lib/php5/20051025/xcache.so. You need to edit the xcache.size setting (I used 32M, but others use 64M) and the extension (or zend_extension) setting.

    ~/src/xcache $ find /usr -name xcache.so
    ~/src/xcache $ sudo vi /etc/php5/php.ini
    
  5. Check that it's working

    ~/src/xcache $ php-cgi -v
    
  6. Restart lighttpd

    ~/src/xcache $ sudo /etc/init.d/lighttpd restart
    

3 August 2007

Forecastfox Profile

My profile for Forecastfox, which is totally sweet.

forecastfox.xml

16 July 2007

Windows Save As Bug

I found a bug in the Windows Save As dialog. It's only a little one - it's really a display bug - but it's surprising after 10 years or so of the same dialog.

  1. File > Save As
  2. Click on an existing file (it becomes the name of the file you're going to save)
  3. Rename it to something else (the file is renamed but the File name field is unchanged)
  4. Click Save

Windows asks you if you want to replace the existing file, even though the name you have is different to the existing one.

25 June 2007

Foxit PDF Reader

I found an alternative to Adobe Reader. I've been using it for a week (which is a lot of documents in a study week). It's called Foxit Reader and it is good.

22 June 2007

Calculating a Bond Yield

> f = function(y) (5/(1+y) + 5/((1+y)^2) + 105/((1+y)^3) - 88)^2
> optimize(f, c(0,1))
$minimum
[1] 0.09807912

$objective
[1] 8.321122e-06

Two lines. R is so sweet.

20 June 2007

Nominations for Worst Software Used on a Daily Basis

  1. Adobe Reader
  2. Java browser plugin
  3. Openoffice

There is a special category of software, which people continue to use despite being crap. Adobe Reader has to top my list. And many days OpenOffice would have to rank up there as well. As awkward as Microsoft Office is, returning to it actually fills me with joy. Joy that it won't crash and that it's been sufficiently bug-tested that strange things won't happen. Of course, one can't really complain about free software... well you can. But it's not very diplomatic.

16 June 2007

Rome: Total War

I accidentily sort of bought Rome: Total War and Empire Earth II the other day while I was at the shops. I've spent the last two days mostly playing Total War. I'm still only just figuring out how it works, but what a fantastic game it is. So satisfying to get it right, and I reckon that's what real gaming is all about. It's the satisfaction of having your city running well. The satisfaction of finishing a Sonic level in 23 seconds. The satisfaction of watching your 9 light cavalry charge into the flank of 30 heavy infantry and seeing them rout. There are so many possibilities. You can fire flaming rocks at fleeing peasants. I've never found violence so entertaining. I want to play with other people, because the computer falls for the feint every time. But goodness me there is so much fun and mayhem to be had. And for only $25 too.

I haven't even opened Empire Earth. That might have to wait until after my exams.

5 May 2007

Google Office

Google Docs is pretty sweet, and a lot of their stuff is pretty sweet, but in no serious way does it challenge Microsoft Office. If there is any challenge to Microsoft's Office, then it's OpenOffice, which is hardly a challenger at all. I've used OpenOffice for years know, but I still feel happy when I go back to Word or Excel. Google Docs & Spreadsheets are hugely buggy and dis-satisfying to use. They are slow as well, even though they do much less. I think it will take a new generation of browsers and hardware for web-based office stuff to be a serious threat.

It's just annoying that journalists keep talking about how scared Microsoft is of Google Docs. Google Docs is essentially Writely, which sucked about the same amount several years ago, and you had to be really idealistic or misinformed to ever suggest Writely was a threat to Microsoft. Windows XP with MS Office and Firefox is one of the best basic setups you could hope for. Google will have to work pretty damn hard to bust it up.

30 April 2007

Smail

I wanted a little Mail Transport Agent thing for the virtual server. Mostly just because the blogs need to send emails sometimes. I had postfix installed, but it used so much memory. I probably could have reduced that if I was clever, but I am not. I tried exim, but I didn't understand it. Exim4 seemed the same. I tried xmail because it sounded lightweight, but the installation didn't work. I wasn't even sure if I was installing the right things. I don't know which part of postfix actually does the sending. I think part of the problem is that I don't have a smarthost because it's hosted at a budget sort of place. So the server has to do all the work of sending mail itself. Postfix can do that because I've seen it do it, but I'm not sure that everything can.

Anyway, eventually I tried smail and it worked straight away. It doesn't even have a daemon. In theory it would probably try to do something if mail was ever sent to this server (with inetd), but they probably won't and smail would probably vomit if it happened anyway. But happily, I can send mail. It all works and I got a bunch of memory back (I only have a tiny bit). I'll have to keep a record of how many times smail offers friendly hackers root and see if it's worth it.

24 April 2007

Yahoo Pipes

Yahoo Pipes is a thing of beauty. So tastily intuitive and flexible and practical.

R

R is really quite a lovely piece of software. Compared to Stata and Eviews, which both do try very hard, R makes you feel quite happy inside.

18 April 2007

WebCT Vista

I think Vista is possibly even worse than WebCT. I don't remember WebCT requiring Java to run. And the sessions in Vista are so fragile. It's the only think I ever use that makes me restart the browser.

And it's damn ugly. Everything about it is ugly. It's messy and ugly. The URLs are ugly. The colours are ugly. The layout is ugly and impractical. It uses Javascript to break stuff in random places. There isn't a single component or idea that isn't substantially worse than average or what you'd expect.

And it doesn't actually do anything. I feel like I've written applications in a week that do more than Vista. Maybe there is a whole lot of fancy stuff going on behind the scenes which means the stuff we actually use has to suck, but I doubt it.

Vista lives up to every stereotype of the kind of bloated software favoured by large institutions. It pains me to use it. And I'm not being melodramatic.

14 March 2007

locale.Error: unsupported locale setting

Python and bzr are great, but gee they suck sometimes. I hate locales generally. It's because I'm not hardcore, but Perl is always screwing up with locales. There are apparently easy ways to fix it and hard ways. I don't even understand the easy ways.

I solved this problem for Python by doing this in /usr/lib/python2.4/locale.py at line 417

- setlocale(locale.LC_CTYPE, "")
+ setlocale(locale.LC_CTYPE, None)

Apparently an empty string is an invalid locale but a Python null is OK.

13 March 2007

Delicious Bookmarks

The del.icio.us Bookmark extension for Firefox is a real winner. It fits in happily with the way I've started organising bookmarks and is speedier than getting Firefox to do it with RSS. It seems to be pretty thoughtfully programmed too.

11 March 2007

PS3 Home

PS3 does Second Life but with good graphics and some sense of purpose. Frighteningly appealing.

15 January 2007

Stata and ‘ml init’

I've been using Stata's ml command for a while now. It's all quite nifty, but I couldn't figure out how to use the ml init part and I had a feeling that it would be a useful sort of command. When your likelihood function isn't globally concave there are no guarantees you're going to find the maximum you're looking for. The manual was pretty terse, and the book that explains it is $180 so I had just ignored it. But after running out of other options I started scouring the web for some example of it. And it's actually dead simple.

ml init beta:index=1 beta:_cons=0 /a=-4.566654 /b=-1.332323 /c=-0.54343

There is one equation and three parameters. All this command is saying that assume the coefficient on only regressor (mrw_index) is going to be in vicinity of 1 and the intercept in the vicinity of 0.

In this example the model failed to converge after 3 iterations with the hints and failed after 13 iterations without the hints. And that seems like a great improvement.

Flock

Flock is good.

11 January 2007

Firebug

Firebug rocks. It solves every remaining HTML/CSS development annoyance at once.

12 November 2006

OpenVZ and ISPConfig with Low Memory

I've finally managed to install ISPConfig for Debian 3.1 on OpenVZ when 128MB of RAM and 8MB of swap. It took many attempts, and the ISPConfig installer doesn't exactly make life easy.

The trick was to stop all the services on the machine before starting the installer. That includes all the services that ISPConfig needs you to have - bind, postfix, courier, apache, mysql. The installer will start Mysql without asking part way through the installation and you'll need to stop it reasonably quickly when that happens, because not long after there's some fairly memory intensive compilations. Make sure you don't make any mistakes with stuff like passphrases for the SSL certificate, because you'll have to start the whole thing again.

Eventually it will ask you for the name of your Mysql host. I started Mysql again and gave it the details it needed. From there it should install by itself happily.

I wasn't very optimistic after seeing the installer but the ISPConfig application itself is actually pretty sweet and well-made.

9 November 2006

Miranda

Miranda is sweet. I thought Gaim was a huge improvement over MSN and ICQ, but Miranda is way less annoying than Gaim. It can do Gmail notification, MSN, IRC and RSS all at once. Pretty nifty.

7 November 2006

Jungle Disk + Netdrive

Combining Amazon S3, Jungle Disk and Netdrive gives you a pretty sweet transparent online hard-drive. I had a couple of early stability problems with Netdrive, but since I restarted it has been dandy.

It costs about 20c/GB to store and upload data with Amazon S3. Pretty damn cheap. I can keep a backup of every document I've ever created for about 20c a month.

25 October 2006

Firefox 2.0

Firefox 2.0 is delicious. So spelling checkery, and pretty sortable tabbery.

I got the new version of Firefox when I upgraded to Ubuntu Edgy, which I am also enjoying a lot. It's all just better, and slicker and faster. Maybe almost time to swap back to Ubuntu. Thank goodness I haven't bought any iTunes music.

11 October 2006

Code Igniter

Code Igniter is a really sweet MVC-ish framework. I've been spending my last week of sickness reading about all the PHP frameworks, and fiddling about with some of them. Seagull, Cake and Code Igniter seem to be the best.

Seagull is a bit of a mess, but seems to be built by more practical than average sorts of PHP coders. It has Flexy templates, and over the years I've come to like Flexy a lot. It's not the quickest template language to get productive with, but then none of them really are.

Cake is pretty closely modelled on Rails, and is good.

But my favourite was Code Igniter, even though it doesn't have models in a proper sense. But it's really sensibly designed so it's easy to extend. I find with most frameworks, if you don't do what you're told by the tutorials and manuals, you won't get very far. It's also really light and fast, unlike PEAR-based frameworks, and probably Rails.

But I'm more convinced than ever that Ruby (probably with Rails in tag) are going to take over the world. The only real argument I've heard for using a PHP framework is that not all hosting providers do Rails. Which doesn't bode well for PHP. Who knows how long it's embeddedness advantage will last.

0.375 seconds