Näytetään tekstit, joissa on tunniste english. Näytä kaikki tekstit
Näytetään tekstit, joissa on tunniste english. Näytä kaikki tekstit

sunnuntai, 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.

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.

perjantaina, kesäkuuta 13, 2008

My first Erlang program

I wrote a program to test how fast is the message passing and process scheduling in Erlang.

-module(pingpong).
-export([start/1, pinger/0]).

% This would be something that got its params from command line
% like: ['123']
start([PingH|_]) ->
start_pings(list_to_integer(atom_to_list(PingH)));

start(Pings) ->
start_pings(Pings).

start_pings(Pings) ->
Pid = spawn(?MODULE, pinger, []),
io:format("Processes ~w and ~w will exchange ~w pings~n", [self(), Pid, Pings]),
Pid ! { self(), Pings - 1 },
pinger().

pinger() ->
receive
{ Pid, 0 } ->
Pid ! quit,
done;
{ Pid, Pingsleft } ->
Pid ! { self(), Pingsleft - 1 },
pinger();
quit ->
done
end.

Save it into a file, like pingpong.erl, then compile with erlc pingpong.erl. Run with: time erl -noshell -s pingpong start 100000000 -s init stop

Sending 100 million messages takes roughly 60 seconds on my 1.4 GHz PowerPC Mac mini.

sunnuntai, lokakuuta 21, 2007

DVD, a standard or not? And why would it be?

I have learned that Mac mini (G4 1.42 GHz, OS X 10.3.9) cannot play DVD discs recorded with Sony RDR-HXD870B, a digital set-top-box with a built-in DVD-recorder.

This seems to be the case no matter if the DVD is recorded as DVD-VR or DVD-video. The disc was finalized.

The discs can be played on the Sony itself and on a Philips DVDR-3400 player.

I will try to get more data points before pointing an accusing finger to somebody. Right now I'm just pissed that it won't work. DVD is such an old standard that it should have matured by now. But I guess I should not be surprised. After all, I did own an old PlayStation 2 that would not recognize some of our Disney DVDs as playable discs.

But surely it was just a glitch that Sony PlayStation 2 would not play some Disney content. After all, what would Sony, itself a major movie studio, benefit from such a situation?

I can't help but recall the olden days when all the VCRs played all the videos, provided you were trying to insert a VHS tape into a VHS device and not into a Betamax device. This mistake would have been difficult to do, given the different physical characteristics of VHS and Betamax systems. You would immediately know you were trying to shove a Betamax tape into a VHS device, even in dark and your eyes closed.

After you managed to insert the cassette into the device, it would play back the video. If the recording device and playing device were not very well compatible, you would get a slightly fuzzy or noisy picture, but if the story of the video was any good, you could overlook little things like the picture quality.

Your chance of getting satisfaction were pretty high.

Fast-forward to present day of digital entertainment systems and high-definition TV screens. There are several incompatible systems on the market from several consortiums of companies who have realized it is not in their best interests to have a level playing field where every device just plays any medium.

If you were an alien who was just dropped on this planet, you might think there was a level playing field with a standard medium. The medium was a shiny, plastic disc, about 12 cm in diameter. The alien would probably be surprised to find, even though the discs all look alike (although they might have different coloring or images imprinted on them), the data on the disc can be encoded in a number of different ways, all ever so slightly different and incompatible.

The alien would need to study the economy and culture of this planet to realize the entities called companies, who the capitalistic system relies on to bring new wonderful things for people (who are called consumers), are really afraid of the the very system they are part of. In the capitalistic system, companies compete on the marketplace and the one to make the superior product will win the hearts (and pocketbooks) of the consumers.

But in this system nothing is permanent. Any time another company could arise and make an even better product and steal the customers from the previous winner. This means the winner cannot rest on its laurels, as they say, but must keep on innovating. This is hard work. It is much easier for the company if it can create a product that locks people into the system, makes it hard for them to switch the product of one company to a product of another.

The first step of creating such lock-in is to make products that are incompatible. Once the consumer has invested into one product, it would cost him a lot of money to switch to a better system because he would have to buy everything new instead of using his older products.

Hmm... this is developing into a nice conspiracy theory. Perhaps I should just take a deep breath and get a grip of myself. Obviously I'm just getting overexcited over such a little thing as Apple failing to make proper DVD player software. I'll try the disc in some other Macs first...

sunnuntai, lokakuuta 14, 2007

Warning: your OpenID login might be compromised

For a few months now I have used one web service that supports OpenID logins. I decided it was time for me to get me an OpenID and start using it.

The good thing about OpenID is it is a completely open system where multiple providers can compete. It is not a proprietary system that would be tied to the success or failure of one company and it is not encumbered by patents or other intellectual property issues.

I looked at some of the OpenID providers and could not really see much difference there. I knew OpenID makes it possible to use any URL as your identity, so I wanted to use my blog URL. When I was looking, the only provider that openly told how to do that was claimID.com. So I chose to register with them.

I have also started using Tor, The Onion Router to hide my location on the web (and also turned off cookies by default, installed NoScript and Adblock Firefox extensions.)

Yesterday I was told Tor was used to steal passwords.

I immediately thought this can only happen if people mistook Tor for something else than it is: Tor does not encrypt or scramble your traffic and magically make it secure, it only hides where and who you are. Tor cannot hide who you are if you reveal that in the content of the messages in the form of user names and passwords.

So, if you are dumb enough to send passwords in the clear, you deserve to get your password stolen. And of course I'm not that stupid. All the important web sites I use login over SSL-protected pages... except claimID.com.

When I use my OpenID URL to log into OpenID-enabled web services, I'm redirected to claimID.com's login page where I log in. I had been lazy and not verified that login page is secured with SSL. It is not. Sometimes the login page is not SSL protected, but the login form is posted back to the server over SSL. But this is not the case with claimID.com either.

This means it is possible someone running a Tor exit node has seen my claimID.com login name and password in the clear.

I started to fix this issue. First, I wanted to know if there is a way to login to clamID.com securely and I just haven't used it for some reason. If there was no secure login available, I would find another OpenID provider.

After some digging around, I found claimID.com has recently made it possible to login securely on an SSL protected page. (Link to announcement in the title of this post.)

I have now updated my login settings to use the SSL protected login page and changed my password at claimID.com. Also I sent an email to claimID.com's support and asked them to: 1) Add a secure login link to the old cleartext login page and 2) email their users telling them to start using the secure login and change their passwords.

I think it would be decent of them to do these things but if I were claimID.com, I would probably be too embarrassed to tell my users I have made them send cleartext passwords.

maanantaina, lokakuuta 08, 2007

We want to hear from you. Yeah, right...

Remember the good old times when the only way to get your voice heard by other people was to write a letter to the editor of the local newspaper? Of course, the editor might not publish it, but perhaps he read it.

Then the Internet came. Everyone and everything was on it. Everyone had an email address. Newspapers had them. Some newspapers had separate addresses for every section of the paper printed at the top of every page.

Then there were newsgroups, bulletin boards and finally, social networks.

Communication is the big thing. Call us, email us, send us the phonecam pic you snapped of the upside-down car on your way to work. Tell us what you think! Help us make this site better!

Usually you have nothing to say. Sometimes you have something to say but you're busy or just can't be bothered.

And then there are the times when you really feel you have something you want to share.

You click that link.

"You need to register before you can post comments." Grrr... do I look like I need another login/password to keep track of? Well, ok, just this once.

You fill in the form, click the next-button... and they slap you with a captcha.

Ok, these guys are paranoid. You type in what the barely readable picture says.

And it tells you you got it wrong. Ok, perhaps my fingers slipped. Let's try again.

Wrong again! There's no way my motor functions are this bad. I need to complain to them and tell them they are making it too difficult to contribute and their captcha is not working. Now how do I contact them? Searching the page .... finds link called Contact Us. This looks good. Clicking... New page loading.... with ANOTHER CAPTCHA!

That does it. It is past midnight and I finally get the message: whatever it was I wanted to say was not that important and by now I have already forgotten what it was.

Good night.

torstaina, heinäkuuta 26, 2007

AppleScripted downloads

I find I'm missing a download manager application. As I am a cheap bastard who is not certain he will be running Mac OS X in a few months, I don't want to spend money on the commercial or shareware download managers and I did not find any free ones.

I have a fairly standardized set of files I need to download every now and then and the files are large. It would be nice if the download had a progress indicator. Also, because the files are large and my network connection is kind of flakey, it would be a bonus if the broken downloads could be continued.

One more thing: I noticed that Safari does not allow one to download files to a specified folder, it downloads everything into the download folder and sometimes it fails to name the file with the basename of the URL and uses the host part of the URL instead. (Yes, FireFox does not have these problems. It has other problems, but let's not go into that.)

As I have played around with AppleScript during the last few weeks, I thought I would see if I can get finer-grade control over Safari downloads using AppleScript. It turns out Safari has a fairly small AppleScript dictionary and it does not allow script control over downloads.

Then I discovered there is a standard scripting component called "URL Scripting Access" that can download and upload using HTTP and FTP. The documentation even says it can display an optional progress bar.

This approach was a failure too.

There is no progress bar even when it is requested and the large downloads fail because the script times out. It would seem the download script is talking to another process called "URL Scripting Access", which does the actual downloading. Apparently there is some fixed timeout, a couple of minutes, after which the download script says a timeout has happened and exits with an error. The URL Scripting Access process is still running and still downloading (the file on the disk keeps growing and the System Monitor shows there is activity in the network.)

But I don't want to use this approach because there is no progress bar and no control over the download and it would seem there is no way to continue a broken download.

At the moment I'm considering other alternatives but they all would require more programming, especially UI programming, which I'm not familiar with. The time available for this project is getting short, next Moday my vacation is over.

I think I will use lftp for my downloads. It is available in MacPorts.

maanantaina, heinäkuuta 16, 2007

Good article on font rendering

Lately there's been some buzz in the blogosphere about the differences in font rendering in applications from Microsoft and Apple. The title links to a blog post that goes into a lot of detail. A short summary would be: Microsoft does a really bad job of font rendering and Apple doesn't do it that well either, but at least they've got taste.