Since I so seldom setup ssh I always forget the details, here is a good guide:
Setup SSH keys
An addition to this is that you may have to do ssh-add on the client to get it working.
Since I so seldom setup ssh I always forget the details, here is a good guide:
Setup SSH keys
An addition to this is that you may have to do ssh-add on the client to get it working.
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.
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: emacs
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: linkedin
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: linkedin
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.
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: computing
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.
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 Ă).
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.
So, being a very happy Apple customer it saddens me to no end, the problems I have with iTunes and having its database on my Apple Time Capsule (NAS).
Having a Macbook Pro I’m sorta limited on disk space so I don’t wanna have all my music and podcasts and iTunes University stuff (there’s some GREAT stuff on iTunes University, check it out, and it’s free!) on my Macbook disk so I thought “Well, why not just put it all on my Time Capsule, lots of space there, all Apple stuff too so it should work fine!”…. and there it began, my “no end of pain”.
I did the transfer of the data completely according to the book and I have everything the way Apple wants it (synch db, copy imports, manage names, etc) but the bastard just keeps mucking up the whole frikking time!!! đ
It looses the network connection for a moment and then suddenly iTunes decides that my whole library is GONE, “Wooops, better silently change the iTunes directory to the default Music folder”…. Unaware that iTunes made this clever move, I innocently want to sync my iPhone, because that is what we responsible users do, iTunes then goes… “Wow, he seems to have empty his whole library, and since we are sync’ed I’d better wipe his whole iPhone without asking first”…. NO, NO, NO YOU BASTARD!!!
So painstakingly I put it all back, which takes hours, but then all my data that I have put in my Apps are…wait for it… wait for it…. GONE!!!! AAAARRRGGGHHH!!! THIS IS NOT HOW IT IS SUPPOSED TO BE!!!
Not only is there the above problem, additionally it starts adding any stuff to this “new” iTunes folder which it silently changed to which I have to fiddle over to the correct place later on when I realize what has happened. And every time I change back it has to “Check my iTunes library” which takes forever, THEN it asks me to “Update all the frikking songnames and whatever frikkin else” so it loops over all my stuff and “changes” it to the correct names, which I have already told it to do 70 times, so they bloody well should be correct by now… SIGH!
The best way I have found of preventing this STUPID silent moving of the iTunes folder is to create a write protected link in the Music folder to the correct place on my Time Capsule, then at least I find out about it and can prevent it from happening, then it usually reports something along the lines that my iTunes folder is write protected and gives up… HA!!! GOT YA!!! đ
My latest hoe is that it hangs when i sync my iPhone, it does all its stuff and then when you figure it is finished, it just hangs on “Syncing iPhone”… buhuuuu!
Apple! Fix! Now! This is not funny anymore, it wasn’t even funny from the start and it is beneath you!!
You are currently browsing the archives for the Computing category.
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Aug | ||||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | |||||
Arclite theme by digitalnature | powered by WordPress