Archive by Author

My list of useful firefox plugins

As a web-developer your most valuable tool is Firefox. Here is a list of the plugins I couldn’t live without:

Firebug – Web developer tool
IE Tab 2 – For browsing crappy webpages (and Logica internal web)
Xmarks BYOS edition – Syncing bookmarks between computers using my own server
Svensk ordlista – Swedish spelling dictionary
YSlow – Firebug web performance tool
PDF Download – Regain control of pdf files opening in your browser window
Download statusbar – Manage downloads from the statusbar
Foxyproxy standard – Good tool when working at different companies with different proxies

My Windows 7 experiences and setup

One year has passed since my first tryout of Windows 7. The transition from Windows XP was easy and I won’t go back. Well thats not entirely correct, because my arcade machine (coming up blogpost) run a very fast and good version of XP called Tiny XP.

I have had the same ”install” the entire year and tried a lot of things with it. The usual problem with having the same install too long has now began to show itself. More problem than I can handle! The only solution is as usual to reinstall everything. This time I am going with a dual-boot setup with Win7 and Ubuntu.

The most annoying thing with ”Windows 7″ has so far been the new ”Windows explorer” (explorer.exe) which I think is bloated. There is no way that I can be productive as earlier with that crap. And I can’t even make it work in ”classical mode”. I have stopped using it! The most perfect file browser in my mind is the classical windows explorer which Microsoft stopped using with Windows XP. I have tried a lot of file browsers and xplorer² is a good replacement. That program is actually the first program I install on a new computer.

Some of my setup tweaks

Lets share some of the tweaks I use to make my Win7 feel good. It is also good for me to have a checklist when I install Win7 the next time.

1) Live Messenger

Minimize Windows Live Messenger to systray

Make Live Messenger cleaner by patching it

2) Taskbar and systray

Bring back good old ”Quick launch”

Unpin all programs from taskbar

Taskbar properties: Check ”Use small icons” and ”combine when taskbar is full”

3) Personalize

In the beginning I switched of all aero stuff and used ”Windows Classic” theme. But by now I am actually used to all fancy aero stuff and it doesn’t feel that my machines performance is that much affected by this.

4) Services and startup

I try to disable as many services that is possible or set them to start manual. Services eat memory and CPU-time.

I continually check msconfig.exe (or registry) to sanitize startup programs. More startup-programs makes your computer boot slower.

5) Programs

I try to keep my program list clean. If I do not use a program I remove it. You never know what services and resources a program uses.

If I want to check stuff out I do that in a virtual machine instead of my ”production machine”. It is very handy to have some lab virtual machines if you are a software developer.

6) Useful free programs

Image Resizer Powertoy Clone for Windows
xplorer² (file manager)
Putty (ssh)
WinSCP (moving files with ftp/sftp)
CDBurnerXP
K-lite codec pack (media playing codecs)
Avast antivirus
Filezilla (ftp)
uTorrent
CutePDF Writer
DAEMON Tools Lite
OpenOffice
Firefox
7-zip (file archiver for zip, rar…)
Notepad++ (text editor)

Felaktigt certifikat för mail på yahoo.se vid pop/smtp hämtning

Om du har ett mailkonto på username@yahoo.se och vill kolla din mail med pop/stmp så kan du stöta på problem. Jag har den senaste timmen försökt felsöka varför mailklienten ”Windows Live Mail” spottar ut sig ett felmeddelande om att certifikatet är felaktigt. I bilden nedan så ser du felmeddelandet man får då man synkroniserar mailen (windows 7 x86). Felet beror på att servernamnet som man angett inte stämmer överens med det servernamn som finns i SSL-certifikatet på mailservern.

Yahoo help så kan man läsa att man ska använda pop.mail.yahoo.se samt smtp.mail.yahoo.se. Dessa är däremot bara redirects till engelska mailservrar.

C:\Users\Övriga>ping pop.mail.yahoo.se

Pinging pop1.mail.vip.ukl.yahoo.com [217.146.176.233] with 32 bytes of data:
Reply from 217.146.176.233: bytes=32 time=199ms TTL=52
Reply from 217.146.176.233: bytes=32 time=230ms TTL=52
Reply from 217.146.176.233: bytes=32 time=230ms TTL=52
Reply from 217.146.176.233: bytes=32 time=130ms TTL=52

Ping statistics for 217.146.176.233:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 130ms, Maximum = 230ms, Average = 197ms

C:\Users\Övriga>ping smtp.mail.yahoo.se

Pinging smtp2.mail.vip.ukl.yahoo.com [77.238.184.81] with 32 bytes of data:
Reply from 77.238.184.81: bytes=32 time=166ms TTL=52
Reply from 77.238.184.81: bytes=32 time=180ms TTL=52
Reply from 77.238.184.81: bytes=32 time=202ms TTL=52

Ping statistics for 77.238.184.81:
    Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 166ms, Maximum = 202ms, Average = 182ms

Om man kollar certifikatet för dessa servrar så ser det ut enligt följande:

Certifikatet är alltså utfärdat till pop.mail.yahoo.co.uk medans vi använder pop.mail.yahoo.se och då blir det mismatch mellan dessa. Det är alltså de engelska servernamnen som svenska @yahoo.se kunder ska använda för att slippa få felmeddelande angående certifikat. Efter att jag bytt mailservrar till dessa så har det fungerat felfritt. I övrigt så är det samma inställningar med ssl etc. som anges på yahoos hemsida.

Pop och stmp servrar för svenska @yahoo.se mailkunder
Pop: pop.mail.yahoo.co.uk
Smtp: smtp.mail.yahoo.co.uk

Hoppas att detta hjälper fler med samma problem och att yahoo.se uppdaterar sina hjälpsidor.

How to monitor hard drive temperature with MRTG and FreeBSD

I really love to monitor my servers, so why shouldn’t I also monitor the temperatures of my hard drives? In my mind a cooler hard drive lives longer than a hot one. However, the google paper on failure trends of hard drives says that the hard drive temperatures doesn’t have an impact on a hard drives life length. But I want things to run cool in my server so here is how I monitor the hard drives with mrtg and FreeBSD.

To be able to get the hard drives temperatures we have to install SmartMonTools.

The smartmontools package contains two utility programs (smartctl and smartd) to control and monitor storage systems using the Self-Monitoring, Analysis and Reporting Technology System (SMART) built into most modern ATA and SCSI harddisks. In many cases, these utilities will provide advanced warning of disk degradation and failure.

Install SmartMonTools
# cd /usr/ports/sysutils/smartmontools
# make install clean

Check the temperature of the drives that you want to monitor
# smartctl -a /dev/ad4 | grep Temperature_Celsius
194 Temperature_Celsius 0×0022 113 103 000 Old_age Always – 34
# smartctl -a /dev/ad6 | grep Temperature_Celsius
194 Temperature_Celsius 0×0022 148 091 000 Old_age Always – 30

Create a script called disktemp.sh that outputs the temperatures in a Mrtg friendly way.

#!/bin/sh
/usr/local/sbin/smartctl -a /dev/ad6 | grep Temperature | awk '{print $10}' | tail -n 1
/usr/local/sbin/smartctl -a /dev/ad4 | grep Temperature | awk '{print $10}' | tail -n 1
echo "A long time"
echo ""

Then create a mrtg cfg file called disktemp.cfg:

### Global Config Options
WorkDir: /home/www/mrtg
Options[_]: growright, bits
EnableIPv6: no
Language: swedish

# Sysload
Target[disktemp]: `/usr/local/etc/mrtg/disktemp.sh`
MaxBytes[disktemp]: 100
Options[disktemp]: integer,gauge,nopercent
YLegend[disktemp]: Temp (C)
ShortLegend[disktemp]: (C)
Legend1[disktemp]: /dev/ad4
Legend2[disktemp]: /dev/ad6
LegendI[disktemp]: /dev/ad4
LegendO[disktemp]: /dev/ad6
Title[disktemp]: Hard drive Temperature
PageTop[disktemp]: 

Hard drive temperature

Run mrtg (a couple of times)
/usr/local/bin/mrtg /usr/local/etc/mrtg/disktemp.cfg

Check If everything seems to be working. If OK then add this to crontab…

The result should be looking like this (in your language):

Nagios plugin for checking ping in bash

Everyone that uses Nagios knows about the basic check_ping plugin. However, today I needed a light version in bash with the same functionality that its easy to modify…

The result is seen below. My Nagios ping-plugin checks the rtt avg time against the treshold values for critical and warning. I never bothered to check for packet losses because that wasn’t the purpose for this script. It only checks ping avg time but could easily be customized to check other things as well.

nagios-check-ping.sh

#!/bin/bash

# This script pings a host and compares critical and warning tresholds against avg rtt (ms)
# Syntax: nagios-check-ping.sh HOST CRITICAL WARNING
# Example: nagios-check-ping.sh www.sunet.se 10 20

if [ ! -n "$1" ]
then
	echo "UNKNOWN: Missing argument HOSTNAME..."
	exit 3
fi   

if [ ! -n "$2" ]
then
	echo "UNKNOWN: Missing argument WARNING..."
	exit 3
fi   

if [ ! -n "$3" ]
then
	echo "UNKNOWN: Missing argument CRITICAL..."
	exit 3
fi   

AVG=`ping -n -c 5 $1 | awk -F/ '/^rtt/ { print $5 }' | awk -F '.' '{ print $1; }'`

if [ ! -n "$AVG" ]
then
	echo "CRITICAL: Error pinging"
	exit 2
elif [ $AVG -le "$2" ]
then
	SC="OK"
	EX=0
elif [ $AVG -le "$3" ]
then
	SC="WARNING"
	EX=1
else
	SC="CRITICAL"
	EX=2
fi

echo "$SC: Average response time is $AVG ms"
exit $EX

Run it like this:
> nagios-check-ping.sh www.sunet.se 10 20

Example output:
WARNING Average response time is 20 ms

How to monitor cpu temperature with MRTG on FreeBSD

Have you ever wanted to monitor the cpu temperature on your server with MRTG and FreeBSD? Of course you wanted that if you have a server running in a closet or some other special place. By following my steps you can have a nice graph like below. It is really relaxing to have all vital stats from your server available online.

This small tutorial works if you have the same processor as I have (Athlon 64). The only thing besides MRTG that you need is the k8temp program which is described as ”k8temp is a utility to read the temperature sensors provided by AMD K8 and K10 processors, including most Athlon 64′s and Opterons.” If you don’t have a Athlon 64 cpu there are other programs that should be ok to get the temperature as well.

You should have MRTG installed and be somewhat familiar the concept to get this working…

Check your cpu (if you dont have a clue)
> dmesg | grep Processor
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 5000+ (2599.72-MHz K8-class CPU)

Install k8temp
> cd /usr/ports/sysutils/k8temp/
> make install clean

Then setup mrtg to use k8temp. This is my mrtg-config file: cputemp.cfg

### Global Config Options
WorkDir: /home/www/mrtg
Options[_]: growright, bits
EnableIPv6: no
Language: swedish

# Sysload
Target[cputemp]: `/usr/local/etc/mrtg/cputemp.sh`
MaxBytes[cputemp]: 100
Options[cputemp]: integer,gauge,nopercent
YLegend[cputemp]: Temp (C)
ShortLegend[cputemp]: (C)
Legend1[cputemp]: CPU 0:1
Legend2[cputemp]: CPU 0:2
LegendI[cputemp]: CPU 0:1
LegendO[cputemp]: CPU 0:2
Title[cputemp]: CPU Temperature
PageTop[cputemp]: 

CPU temperature

By running the ”k8temp” program you get a list of available sensors. Find the temperatures that you are interested in and edit the script below. This is the script ”cputemp.sh” that the mrtg-config-file uses to get the cpu-temperature:

#!/bin/sh
/usr/local/sbin/k8temp -n 0:0:1
/usr/local/sbin/k8temp -n 0:1:1
echo ""
echo ""

Run mrtg (a couple of times)
/usr/local/bin/mrtg /usr/local/etc/mrtg/cputemp.cfg

Check If everything seems to be working. If OK then add this to crontab…

Telenor har bäst mobilt bredband på södra Alnö

Telenor har alltså bäst (snabbast) mobilt bredband i sommarstugetäta södra Alnö utanför Sundsvall. Eftersom det finns väldigt många sommarstugor i området så hoppas jag att fler har nytta av denna post. Givetvis kan förhållandena variera från område till område men jag tror ändå att Telenor har bäst täckning totalt sett.

Efter förra årets debacle när familjen valde Telias bredband till sommarstugan i Havstoviken så fick inte samma misstag ske igen. Hastigheten under förra sommaren var under all kritik (dålig GPRS) men har man bundit upp sig med årsabbonemang så har man. Till denna säsong så finns nu mobilt bredband kontant vilket kan vara ett bra alternativ om man bara behöver bredbandet i sommarstugan under 3 månader. Man laddar då bara kortet per månad. Ett sådant kort för Telenor har jag nu testkört under en veckas tid.

Operatörerna har på sina täckningskartor över södra Alnö full täckning med 3G, men det vet jag ju sedan förra året att det inte stämmer i Telias fall. Utrustad med både ett Telia och ett Telenor sim-kort så kopplade jag upp mig med samma modem (Huawei e220) och på samma plats (Havstoviken) för att se skillnaden mellan de två.

Följande resultat fick jag i undersökningen med TP-test samt bredbandskollen

Telia (samma nät som Tele2)

TCP nedströms : 148.86 kbit/s

TCP uppströms : 79.31 kbit/s

UDP nedströms : 196.49 kbit/s

UDP uppströms : 102.16 kbit/s

Telenor (samma nät som Tre)

TCP nedströms : 3.08 Mbit/s

TCP uppströms : 338.28 kbit/s

UDP nedströms : 3.47 Mbit/s

UDP uppströms : 381.80 kbit/s

Summering
Med Telenor så fick jag bra täckning och fart i sommarstugan. Telenor kör cirklar runt Telia för både upp och nedladdning. Med Telia fick jag samma dåliga resultat som ifjol, vilket var riktigt uselt. Undvik Telia på Södra Alnö och allra helst om du har sommarstuga/boende i närheten av Havstoviken.

Tillägg
4 juli 2010 – Får samma resultat vid Säludden (mellan Havstoviken – Spikarna)

du – file space usage

Då har det äntligen hänt i och med att jag bytt uppdrag på jobbet. Jag har börjat köra Ubuntu 10.04 till vardags. Nåväl det blir ett annat blogginlägg om hur det har gått framöver…

Detta inlägg blir mest bara som en minnesanteckning för ett kommando som jag alltid glömmer bort men som är nyttigt.

Kommandot är: du -hs /var/*

Vad gör då det? Ja man får ut storleken/totalsumman av alla filer i ”mapparna” och listar det ”human-readable”.

Google streetview bilen i Sundsvall

Jag gillar verkligen Google. Häromdagen så såg jag att Streetview bilen var här i Sundsvall för att fota våra gator och torg. Den var parkerad utanför mitt hus så man kan ju undra vad den gjorde där.

Troubleshoooting device driver installation with setupapilog.txt

Today I tried to install the ”HP Universal Driver PCL6″ (32-bit) on a Windows XP machine with WMI and VB.NET. All I got was the errorcode 2 and a failed installation. What does that mean? Windows errorcodes is not my (anyones?) speciality…

After some googling I found this very good post that describes the problem and a possible solution.

The key to solving this puzzle and possibly other device installation problems is the file setupapi.log in the windows folder. After running my code again I got this in my setupapi.log file (in swedish):

[SetupAPI Log]
OS-version = 5.1.2600 Service Pack 3
Plattforms-ID = 2 (NT)
Service Pack = 3.0
Svit = 0x0100
Produkttyp = 1
Arkitektur = 2006157608
[2010/01/22 14:20:41 5392.4 Driver Install]
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe
#I060 Ange vald drivrutin.
#I060 Ange vald drivrutin.
[2010/01/22 14:20:41 5392.5]
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe
#-167 SPFILENOTIFY_NEEDMEDIA: Tagg = p6i2svww.cab, Beskrivning= PDL_LANG, Källsökväg = C:\CentralPrintArea\FKPrint\HP\Universal\32bit\HP Universal, Källfil = UNIDRV.HLP, Flaggor = 0x00000000.
#E169 SPFILENOTIFY_NEEDMEDIA: returnerade FILEOP_ABORT. Fel 2: Det går inte att hitta filen.
#W187 Installationen misslyckades. Försök att återställa originalfiler utförs.

It says that I got an errorcode 2 (missing file) and which file that is missing. In this case it is missing the file ”UNIDRV.HLP” that is not available in swedish. All I had to do is to extract this file from the cab-file ”p6i2svww.cab” to the root of the driverfolder. After doing this and running the program once more everything is working and the driver installs. After this I get the following output in setupapi.log.

[SetupAPI Log]
OS-version = 5.1.2600 Service Pack 3
Plattforms-ID = 2 (NT)
Service Pack = 3.0
Svit = 0x0100
Produkttyp = 1
Arkitektur = 2006157608
[2010/01/22 14:28:43 4784.4 Driver Install]
#-198 Bearbetad kommandorad: C:\WINNT\system32\wbem\wmiprvse.exe
#I060 Ange vald drivrutin.
#I060 Ange vald drivrutin.

That looks good I suppose! At least better then before. And the driver is installed ok!

You can read and download information about setupapilog.txt at the Microsoft website. If you read the whitepaper you could possibly solve many kinds of STRANGE device driver installation problems.

This is Microsofts description of setupapilog.txt

Windows XP and later versions log system operations more extensively than previous versions of Windows do. One of the most useful log files for debugging is the SetupAPI log file (setupapi.log). This plain-text file maintains the information that SetupAPI records about device installation, service-pack installation, and hotfix installation. Specifically, the file maintains a record of device and driver changes, as well as major system changes,

If you wnat more verbose logging to the setupapi.txt file you can edit the windows registry key ”HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\LogLevel”. If you raise this value to 255 you get a lot of logging which can be useful at times.

I hope this helps someone and that HP fixes the broken driver. It must be some sort of localization problem within this driver. Or maybe that I have the wrong driver…

The path to this file in Windows XP is %WINDIR%\Setupapi.log. On Windows Server 2008R2 the log files are found in %WINDIR%\Inf\ and are called setupapi.app and setupapi.dev.

There is always something new to learn in the Windows world! Happy troubleshooting!