sunnuntaina, tammikuuta 25, 2009

Why do I use Safari

During this weekend I have had a discussion on Twitter about Safari vs. Firefox. Well, in reality it hasn't been much of a discussion because it is hard to present a good argument in 140 characters. So I will elaborate here.

Why do I use Safari? Some people might have difficulty even understanding the question. 70% of Internet users surf with Internet Explorer. Many, if not most of them have never even heard of Firefox or Safari. But it so happens that I live in an environment filled with technically savvy nerds and literally everyone of my peers runs Firefox.

Except me.

Why?

I want to be different. For some reason I think there is something wrong with anything that is wildly popular. I hate crowded places. If everyone uses Firefox, I want to be different. I'm just wired that way. I also want to code in exotic, preferably dead languages: Forth, Lisp, Smalltalk, Erlang.

If I wanted to be like everyone else, I would run Firefox on Windows or Linux and code in C++ or Java.

I also have some practical reasons for preferring Safari:

Practical reason 1: Safari is smaller and starts up faster. This is important to me because my home computer is a 1st generation Mac mini, PowerPC CPU and 1 GB RAM. It normally has at least 3 users logged in, so memory is tight. I have developed a habit to quit the web browser when I'm done with the web pages or when I leave the Mac. If I were to run Firefox and keep it running, it would take ages to swap it in or out when switching users. If I always quit Firefox after viewing a web page, I will spend a lot of time waiting for Firefox to start.

This is much less of an issue on my work machine but I like to keep my work and home environment similar to minimize confusion.

Practical reason 2: Mac keyboard shortcuts conflict with Firefox Back- and Forward keys. Many are the web page forms where I have written a lot of text and hit cmd+left arrow to go to beginning of line. BOOM! Bad idea. Firefox immediately leaves the page and goes back in browser history. Never mind I had lots of unsaved text written on the page. Sometimes you can cmd+right arrow to go back and the text is still there. On some web services you get a blank page or an error. Safari is smart enough to interpret cmd+left arrow as beginning-of-line if the keyboard focus is in a text field.

Practical reason 3: I don't like tabbed browsing. Yes, I'm weird that way. Everyone of my peers has dozens of tabs in their Firefox. I don't understand how they manage. Tabs are essentially a two-way list. If you use the keyboard, you can only switch to the tab on the right or tab on the left. Those who remember the university Data structures and algorithms course will see this is the O(n) behavior. If you have a lot of tabs, you will spend a lot of time hitting ctrl+tab. The only random access available is to click on a tab with a mouse. But there's only about 8-9 tabs that fit in a Firefox window of reasonable width. The other tabs are hidden.

If you open new browser windows instead of tabs, you can use Expose (F10) to navigate them. Any browser window is within your reach with a couple of key presses or a flick of a mouse, especially if you set an active corner to invoke Expose.

Don't get me wrong, I do use tabs. I often open closely related web pages in tabs in the same browser window. So normally I have 4-5 browser windows and a couple of them have 3 or 4 tabs.

Now it is late. In the words of the immortal Forrest Gump: That is all I have to say about that.

perjantaina, tammikuuta 02, 2009

The best programming language

I have been doing most (well, pretty much all) of my professional programming in the C language. I'm beginning to really hate it. It is so difficult and error-prone to do string manipulation in C. It is easy to leak memory. There are no standard high-level data structures.

I have been looking for alternatives for a long time. The alternative should:
  • have good libraries
  • have good interface to libraries written in C
  • have support for threads
  • be small
  • have good performance
  • not have many dependencies to operating system libraries
  • it should be possible to make closed-source programs with it
I have looked at Smalltalk, Erlang and Python.

Smalltalk has good libraries and the Smalltalk virtual machines tend to have very few outside dependencies. The Smalltalk I'm best familiar with, Squeak, has no support for threads and seems to interface somewhat badly to the outside world. I was especially disappointed by its support for running subprocesses and controlling them. Also, it is pretty much impossible to make closed-source software with Squeak. All the source is included in the image or can be reverse-engineered easily.

Erlang is an even more niche language than Smalltalk. There aren't many other people using it. Erlang is difficult to extend with libraries in C. Apparently not many C libraries can easily live with the extreme parallelism and thousands of light-weight processes a typical Erlang environment looks like. OTOH Erlang has good support for running subprocesses and communicating with them. Erlang sucks particularly bad in performance, unless your problem parallelizes to the extreme and you have the hardware to support it. For the more conventional cases Erlang is probably not a performance booster.

Python is sexy but slow. Python is also mostly single-threaded. It has threads but only one of them can execute in the interpreter at once.

Java is very un-sexy and also very slow. It has good thread support but it is a huge bloated monster.

All the languages above are very big. I call it very big if the customer has to install 30+ MB of language support/runtime/virtual machine to deploy a piece of software.

At the moment it looks to me like C++ or Objective-C would be the solution. Also there is this thing called Haskell, but I haven't looked into it sufficiently to have any idea how it stacks up with the contenders above.

tiistaina, joulukuuta 30, 2008

Should I stay or should I go?

Joel Spolsky and Jeff Atwood are a bit harsh. Essentially they say if you even think about leaving the software profession, you really should go, that even entertaining a thought like that is a sign of a bad programmer.

During the last couple of years I have been considering ways to become a professional horse trainer/stable-boy or something like that. Sorry, but I did not realize by doing that I was committing an act of treason against our beloved profession.

I never considered myself to be an excellent programmer but I never knew the bar was so high. Ok, maybe I'm not that great, but I haven't figured out a way to get someone to pay for playing with horses all day and well, I do like coding. So maybe I'll stick around a while longer.

But I do think people can be good at what they do but still get tired about it for a reason or another. And it is a very big world out there with a lot of things to do. It would be foolish to assume one can be happy only by programming computers. Yes, it pays well, like Joel says, but money is not equal to happiness. Happiness comes in many forms and can be found in many ways.

I am happy now. I hope you are too.

maanantaina, joulukuuta 29, 2008

Automating TVkaista with Automator

I have been a very satisfied user of TVkaista.fi, a tv-show recording service. I have been using it to download shows I missed for some reason and I have also used it to download tv shows to my iPod via its iTunes feed.

Only recently I realized I should perhaps automate downloading the shows I follow regularly and it was only then I discovered TVkaista has an RSS feed for each tv channel. Then it came to me that I could try to use Automator to automate the downloads. And it seems it has been a success.

There were a couple of issues.

First, I only wanted to download each show once, even if I accidentally invoked the download more than once. I solved this by subscribing the tv channel RSS feeds into Mail.app. Mail can keep track of the read/unread status of each feed article. Alternatively, each article can be flagged or unflagged. I chose to flag an article when it has been downloaded and only download unflagged shows.

Second issue was a bit strange. The Automator workflow I had made worked OK when I ran it from Automator. However, it did not download anything when I saved the workflow as an iCal plugin and had iCal invoke the download at certain times. There seems to be very little one can do to debug Automator. Eventually I realized the iCal plugin is actually an application bundle and when it wants to authenticate to TVkaista, Keychain does not allow it. After using Keychain to allow access to all programs for TVkaista authentication, my scheduled downloads work just fine.

You can check the Automator workflow I use to download Hill Street Blues. It looks like this:



If you are a TVkaista subscriber, you can try it too after subscribing to the YLE FST channel RSS feed in Mail. If you want to schedule the download, open the workflow in Automator, then from the File menu, Save as plugin, choose iCal plugin and give it a descriptive name. Then switch to iCal where you will find an event that is set to invoke an application. Change the event to run and repeat the way you like. The iCal plugins are actually app bundles saved into Library/Workflows/Application/iCal under your home directory.

sunnuntaina, marraskuuta 02, 2008

Sony is evil or how to watch DVD-VR on the Mac

My dad has a Sony hard-disk and DVD recorder with a digital tv tuner. He also has Canal+. Sometimes he records a movie into the hard disk and sometimes he makes a copy for me by copying the movie from hard disk to an empty DVD disc.

MPAA can rest easy. So far I haven't been able to watch any of the discs he has given me. This is because the discs he makes with his Sony are in DVD-VR format, not DVD-Video. DVD-VR is a disc format used mainly by the Sony video cameras that record directly to DVD, i.e. not a very popular format, like the DVD-Video.

The UI of the Sony DVD recorder makes it pretty easy to copy recorded TV shows from hard disk to DVD. You simply have to step thru a wizard-like sequence of screens where you just click on the button labeled "Next" and it is the highlighted button on every screen. If you do this (and my dad does), you will get a nice DVD-VR disc. If you would like to make a DVD-Video disc instead, you would have to switch the video format in a different place in the menus. It is not possible to change the format in the "HD->DVD copy" wizard.

Of course my dad never remembers to change the video format. He just steps through the wizard and clicks on next, next, next, burn. Mission accomplished.

Why on earth did Sony choose the default format to be DVD-VR instead of the ubiquitous DVD-Video! Probably to promote the DVD-VR format and increase consumer lock-in. Sony has a history of not using industry-standard solutions and standards to prevent consumers from buying cheap off-the-shelf parts.

Sony is evil! Boycott Sony!

Today I found a small piece of software that can read a DVD-VR disc and produce a VOB file. The VOB file can be played back with e.g. VLC. It's movie time!

Uusia sarjakuvia

Myyrmäen Suomalaisessa Kirjakaupassa oli takaseinän hämärässä nurkassa hylly, johon katseeni sattumalta osui. Siellä oli sarjakuvia uloskantohintaan. Mukaan tarttui kaksi Petri Hiltusen teosta: Koston merkki ja Laulu yön lapsista. Hinta 2 x 2,95.

Sain juuri ensimmäisen näistä luettua ja olen tyytyväinen. Tarinat ovat lyhyitä, mutta nerokkaita, samaan tapaan kuin aikaisemmin hankkimani Asvalttitasanko.

Lukemista on nyt vähän kasaantunut, pitkästä aikaa. Listalla olisi vielä ainakin Ilkka Remeksen uusin ja myös uusin Naruto.

keskiviikkona, lokakuuta 22, 2008

How to copy iTunes library to a new machine

It became necessary for me to copy (well, move, really) my iTunes library to a new Mac. I googled a bit and found some advice essentially boiling down to this: copy the files and import them to iTunes in the new Mac. This means you lose playlists, play counts, stars, podcast subscriptions and other stuff. That doesn't sound nice.

The starting situation for me was that my music files were on an external disk and the library was in my $HOME/Music/iTunes folder.

After trying it a couple times, this is how I did it:

  1. Shut down iTunes on the old Mac.
  2. Copied $HOME/Music/iTunes folder my old Mac to the same folder in the new Mac.
  3. Made a new empty folder called "iTunes Music" inside the above folder in the new Mac.
  4. Copied all the music from the external disk of the old Mac to the above folder.

That's it. I suspect if my music files had been under my iTunes folder in my home directory instead of an external disk, I could probably have copied it all in one go.

maanantaina, lokakuuta 20, 2008

Missä on posti tässä kuussa?

Tuli asiaa postiin. Posti ei enää olekaan samassa paikassa missä se oli vielä viime kuussa. Posti on siirtynyt lähimpään kauppakeskukseen, kätevästi muidenkin kauppajuttujen kanssa samalla hoidettavaksi. Postissa on 15 ihmistä jonossa. Jono etenee hitaasti. Oman pakettini ovat hukanneet.

sunnuntaina, lokakuuta 19, 2008

Twitter and IM

Communicating with Twitter used to be possible via multiple channels: web, mobile web, SMS and IM. There are other communities like Twitter, but they are mostly web-based. Twitter was never strong on features or stability, but it ruled on accessibility and convenience.

IM support was disabled during the summer and Twitter always said they were working on fixing it.

Then Twitter shut down SMS updates and its usefulness went down dramatically.

Today I noticed the message about Twitter working on IM updates had disappeared and in Twitter's settings page it no longer sports any IM settings. Apparently the IM feature has been discontinued "indefinitely".

This means Twitter these days has no features a lot of other web communities would not have. In fact it has a lot less. The only thing Twitter still has are the users. It will take some time for the users to migrate elsewhere and a lot of users probably will stay. Especially the U.S. users never got used to using Twitter over SMS. But in the U.S. text messages are expensive and phone data plans are cheap.

lauantaina, lokakuuta 11, 2008

Tosielämän rekursioita

Tuli tässä tutun kanssa puheeksi henkilökortin hankkiminen. Tuttu oli näet hukannut omansa ja mietti miten poliisi mahtaa tunnistaa hänet kun hän menee hankkimaan uutta korttia.

Poliisin weppisivuilta löytyy seuraava tieto:
Henkilökorttia haettaessa on oltava mukana
  • 1 passikuva
  • luotettava selvitys henkilöllisyydestä (passi tai henkilökortti)
  • mikäli hakija on alle 18-vuotias, huoltajien suostumus (paitsi ns. alaikäisen henkilökortti)


Eli kun hakee uutta henkilökorttia, on hakiessa todistettava henkilöllisyys henkilökortilla (tai passilla, mutta jos omistaa passin, ei kai silloin edes tarvitse henkilökorttia?)

Tämähän on tietysti mahdoton tilanne. Koska henkilökortteja kuitenkin myönnetään, on poliisi ilmeisesti valmis tinkimään yo. vaatimuksista jos henkilökorttia hakeva ei henkilökorttia omista. Mielenkiintoista olisikin tietää, miten poliisi näissä tapauksissa henkilöllisyyden varmistaa.

Tiedämme kokemuksesta, että alle 18-vuotiaan henkilöllisyys todistetaan ottamalla nimet paperiin molemmilta huoltajilta.

lauantaina, lokakuuta 04, 2008

torstaina, lokakuuta 02, 2008

Uusia sanoja

Korkeateknologinen materiaali. Mitähän se sellainen on? Onko se kivi-, kasvi- vai eläinkuntaa?

sunnuntaina, syyskuuta 14, 2008

Huomaamaton kiusa


Tämän täytyy olla maailman suurin tragedia: Jokin kiusaa sinua etkä edes huomaa, että sinua kiusataan.