A case of superior customer service!

The most amazing thing just happened, last year I bought the very nice Etymotic HF3 headphones, excellent sound and good features, only one downside, they broke… That is usually a major hazzle, so I have been procastinating about it for a while, but yesterday I finally decided to take the bull by the horns and I called Apple. After three minutes (literally), it was settled. Some minutes later I got a mail with the return number for the old headphones. Today my replacement headphones arrived!! Amazing, the replacements are here the day after I reported it!! If this is representative for their customer care, I understand why Apple is rocketing past M$!!

An interesting and commendable note is that the important thing for them was not to get the broken ones back and then send me a new pair, the most important was to get me the the replacements and then worry about getting the broken ones back! Thats the way to get returning customers!

Tags:

Advanced Perl debugging with Aspect

So I had this huge bunch of Spreadsheet::WriteExcel code where I was generating Excel sheets from some statistics I was gathering and I noticed that everytime I opened the Excel file I got a message with something along the lines “File error: data may have been lost”, but on a casual look the spreadsheet looked fine… but of course the devil is in the details. It turns out that if you happen to Spreadsheet::WriteExcel::write in the same cell twice (or more I guess 🙂 ) that error message is what my Excel produces…. So how to find where the problem is… in this huge bunch of writes…

Enter Adam Kennedy’s excellent Aspect library for Perl, a truly brilliant module!! Thanks Adam!

How did I use it in this case? Here goes…

.... lots of other code....

use Aspect;

my $pointcut = call qr/Spreadsheet::WriteExcel::Worksheet::write$/;
# Observe the $ at the end, otherwise write_string will also match, and we don't want that

...... code passes ...

sub in_my_big_excel_write_block {

my %spcoords = ();
my $before_write = before {
my @args = @{$_->params};
if ( $spcoords{$args[1]}{$args[2]} ) {
croak "Will do double write at coord: ["
. $args[1] . "," . $args[2] . "] = >" . $args[3] . "<\n" . "Previous write at coord: [" . $args[1] . "," . $args[2] . "] = >" .
$spcoords{$args[1]}{$args[2]} . "<\n"; } $spcoords{$args[1]}{$args[2]} = $args[3]; } $pointcut; .... lots of $worksheet->write(...) code....

}

Now my poor perl script will die with a message telling me where and what I tried to write double and what I wrote there previously, now it’s easy to find!

🙂

A more general debugging tip would be this simple “before” advice:


before {
if( ($cnt % 1000) == 0 ) {
my @args = @{$_->params};
print "Calling " . $_->sub_name . " with args : " . Dumper(@args) . "\n";
sleep 1;
}
$cnt++;
} $pointcut;

Neat huh!? And trust me, this is only some small simple example of the power of the Aspect library.

Tags: , , ,

Efficient navigation of source code in (X)emacs

Going back to (X)emacs to code perl and c++ after a couple of years of Java coding in Eclipse I was a bit frustrated of navigating around the code with just pg-up, pg-down and search. For instance when you are looking at some function call and want to have a quick look at the definition of that function and then go back to the function call. The best way that I have discovered to do this so far is using imenu and the built in “mark” system. I set a function key to “imenu”

(global-set-key (kbd "<f3>") 'imenu)

Then with the cursor placed on the function call i press f3 RET, which then (in most cases) takes me to the function definition. When I want to go back I use the fact that imenu “sets the mark” where it left so I can use Ctrl-u Ctrl-SPC, which takes me back to the last “mark position”. First I used Ctrl-x Ctrl-x which also kind of works, but that marks the whole region from the function definition back to the function call, which is usually not what I want.

Also, repeated use of Ctrl-u Ctrl-SPC will continue going back to previous marks set in your buffer. Emacs keeps a “current buffer mark ring” in which it stores the marks that are set in the buffer. It is also good to know that “interactive search” (Ctrl-s) sets the mark where the search started when it leaves so when you have finished searching you can use Ctrl-u Ctrl-SPC to go back to where the search started. You can also manually “set the mark” by pressing Ctrl-SPC if you know this is a position you will soon want to return to.

I also like (global-set-key (kbd “C-<return>”) ‘dabbrev-expand) which kinda does code completion the simple emacs way. Since <tab> is tied up with indentation and Ctrl-space is for setting the mark I like Ctrl-Return.

Further, there are the functions ‘beginning-of-defun’/’end-of-defun’ in CPerl mode these are bound to M-C-a/M-C-e, I global-set these to C-M-right and C-M-left which are in my installation bound to beginning and end of sentence which I have no much use for.

Related:
Search At Point
Emacs Nifty Tricks

Tags:

iPhone 3GS Personal Hotspot to iPad 2

Just wanted to confirm that Personal Hotspot does work on the iPhone 3GS and it is indeed possible to pair it with my iPad 2 WiFi only!! Yay!!

It requires iOS4.3.

One “funny” thing is that I had updated my iPhone 3GS to 4.3 but there where no “Personal Hotspot” available in the Settings. It turns out that I had to reset my network settings, AND to use the “correct” reset button.

For me it did NOT help by using the “Reset” under Settings->General->Network>Cellular Data Network->Reset Settings”.

But when I used the General->Reset->Reset Network Settings, the iPhone 3GS rebooted and at restart the Personal Hotspot was indeed available under Settings->General->Network !

On the iPhone 3GS the Personal Hotspot uses Bluetooth and does not use WiFi sharing as in the iPhone 4. So you will have to activate Bluetooth on both devices and pair them to get it to work.

Tags:

Spela PS2 SingStar spel pÄ PS3

TĂ€nkte bara bekrĂ€fta att det gĂ„r att spela SingStar spel som Ă€r gjorda till PS2’an pĂ„ PS3’an. Jag tycker inte att det varit sĂ€rskilt klart att det faktiskt gĂ„r, men ikvĂ€ll har jag lyckats testa det och det funkar!! Jag provade ikvĂ€ll (Ă€ntligen!!) SingStar Sjung Med Disney (som bara finns till PS2) pĂ„ vĂ„r PS3.

SÄ hur gÄr man dÄ till vÀga?

Man mĂ„ste ha en PS3 SingStar skiva till att börja med, man startar med den skivan i PS3’an och startar igĂ„ng spelet, sen navigerar man till “VĂ€lja LĂ„t Menyn” dĂ€r trycker man pĂ„ “Select” knappen pĂ„ handkontrollen, dĂ„ fĂ„r man möjlighet att byta skiva och dĂ„ kan man sĂ€tta in en Singstar PS2 skiva.

Observera att det gĂ„r inte bara att starta igĂ„ng spelet och trycka ut skivan för dĂ„ stannar spelet, man mĂ„ste gĂ„ till “VĂ€lja LĂ„t Menyn” och trycka “Select” pĂ„ handkontrollen.

Tags:

ClickToFlash!

Beeing really sick and tired of Adobe Flash and how it hogs up the entire CPU and slows Safari down to a grinding halt I finally had enough and tried to find some remedy and found the EXCELLENT ClickToFlash. ClickToFlash is a Flash blocking plug-in for Safari on Mac OS X and there is just one thing to say about it, “Get it”!! (ok, two things…).

Excellent unobtrusive tool that simply just does the right thing!

Haven’t found any problems with it yet (as you can see WordPress works fine with it installed, including image uploads), but if I do, I’ll report it here.

[UPDATE] Having now run ClickToFlash for a couple of days I must say it works like a charm, love it!!! It’s like having a new computer, no more Mr Sirup computer!! Thanks to all the people who are developing ClickToFlash!!!

Tags:

Backing up Windows to Readynas with Cwrsync, an rsync package for Windows

I finally figured out a nice backup solution for our Windows laptop.

Some background, the machine is not constantly on so I wanted to have the backup initiated from the laptop side when it was up and running, and since it is a quite old laptop with a slow wireless connection I further wanted to use rsync to transfer minimal amount of data. In addition to this I preferred having the backup in a plain file structure rather some obscure windows backup format AND I wanted the backup side to hold more data than was possible on the laptop so we can delete some data on the laptop when the disk keeps filling up but I didn’t want this removed on the backup side.

So to facilitate all this we bought a Netgear Readynas NV+ with 2×1 TB mirrored disks. On this excellent machine I enabled rsync and activated rsync on the “backup” share.

Then, to the windows machine, I downloaded cwrsync an excellent stand alone packaging of rsync for windows (you don’t need to download Cygwin to use it). You can find cwrsync here.
Cwrsync supports utf8 over rsync (in contrast to DeltaCopy), something that is essential if you live in Sweden and use Ä À ö in filenames.

I then created this:


cd "C:\Documents and Settings\USERNAME\Mina dokument"
rsync -avz "." "10.0.1.16::backup/WindowsBackup/Mina dokument"

small BAT script (based on the example included in the Cwrsync package, which sets up path’s to cwrsync etc. ) on the windows machine which recursively backs up all new or changed files in “Mina dokument” to the Readynas machine.

This small script was put on the Desktop (Skrivbordet in swedish), now all my better half has to do is to double click the BAT file and the backup is magically done in the most efficient way.

I’ll probably add a backup job on the Readynas to backup THAT backup to another NAS too… Did I mention that we DO NOT want to loose our pictures and videos of our daughter.

Tags: ,

Apple Time Capsule update to 7.5.2 firmware

Just a small note on this update, the 7.4.2 update was really bad for me (one Macbook Pro and one Windows XP machine), but the 7.5.2 seems to be quite stable for both the Macbook and the Windows XP machine.

Update 2011-01-23: The 7.5.2 is actually very stable and I can really recommend it. The wireless connections both to the Macbook and the Windows machine is much more stable!

Update 2011-03-06: Well… nope, they have fucked up agan! 😛 😛 The wireless connection IS more stable than before but it seems that under heavy load (just a theory at the moment) it hangs and then IT IS IMPOSSIBLE TO restart with the LAN cable plugged in.

Update 2011-03-13: Ok, after some experimenting and a suggestion from my brother in law, it seems that setting the wireless channel to a fixed value (1 in my case) seems to have stabilized things.

Tags:

Mac OS X Terminal och ÄÀö

Har inte upplevt nĂ„gra problem förut, men nu har det börjat strula…

ÅÄÖ i Mac OS X Terminalen har blivit ett elĂ€nde. 🙁

Det Àr 3 olika problem.

1. FĂ„ ut ÄÀö frĂ„n applikationer, t.ex ‘cat textfil.txt’ (dĂ€r filen innehĂ„ller ÄÀö) eller frĂ„n t.ex Perl program
2. Skriva ÄÀö pĂ„ kommandoraden, för mig har den nu börjat ge ingenting (ok, ett “beep”) eller “(arg: 6)”
3. FĂ„ ‘ls’ att korrekt lista filer med ÄÀö i filnamen.

Problem 1:
Löses genom att Àndra terminal settings till Western (ISO Latin 1) Se bild.

Terminal Settings

Mac OS X Terminal Settings

Problem 2:
Löses med en kombination av lösningen till problem 1 och detta tips pÄ 99.se
Dvs, skapa en fil i hemkatalogen som heter “.inputrc” och innehĂ„ller följande:

set convert-meta off
set input-meta on
set output-meta on

Om man bara skapar .inputrc sÄ blir det knas nÀr man t.ex skriver ÄÀö, följt av 3 backspace som dÄ backar tillbaka in pÄ prompten för mig. Och att bara skapa .inputrc löser inte Problem 1 (för mig iallafall).

Problem 3:
Har jag ingen lösning pĂ„. 🙁
NĂ€r jag gör ‘ls’ i en mapp med filer men ÄÀö i filnamnen sĂ„ visas “a?” istĂ€llet för Ă„, “a??” isf Ă€ och “o??” isf ö och jag kan inte tab-completa filnamnet, dock sĂ„ kan man skriva in filnamnet som det stĂ„r eller copy-pasta det. Om jag gör export LC_ALL=”sv_SE” i terminalen och har “Terminal Settings” satt till UTF-8 dĂ„ ger ‘ls’ svenska tecken i llistningen men dĂ„ Ă€r jag tillbaka med Problem 1. 🙁 Har jag Terminal Settings satt till Western (ISO Latin 1) sĂ„ blir ÄÀö nĂ„gra andra konstiga tecken (typ Ì).

Tags: ,

Downgrade 1T Apple Time Capsule from 7.4.2 to 7.3.2 firmware

Well, after upgrading to 7.4.2 firmware of my 1T Time Capsule and realized it sucks (our Windows XP machine gets dropped connections all the time, the MacBook stays up a bit better but very frequent drops there too), I was looking for the old 7.3.2 firmware, but Apple in their infinite wisdom has removed the possibility to download this firmware form their 7.3.2 download page, I finally found this link:

http://apsu.apple.com/data/106/061-4874.20080627.8U65r/7.3.2.basebinary

on this:

http://discussions.apple.com/thread.jspa?messageID=8396597

page, and concluded that it works for the Time Capsule also even though it is mainly the AirPort Extreme 802.11n Base Station that is discussed on the page.

If they end up removing that one to, feel free to contact me (by leaving a comment here) to get hold of the 7.3.2.basebinary.

Tags: ,