Mitt hembyggda arkadspel Marcade Mini är färdigt

Efter många timmars slit så är äntligen arkadspelet så gott som färdigt. Lite småfix med mjukvaran är det givetvis kvar och man kan ju alltid lägga till fler emulatorer, men i stort sett så är allt klart. Om du följer länken nedan så har jag lagt upp en byggbeskrivning med bilder och en film.

Marcade mini är ett litet two-player arkad/flipper-spel som körs på Tiny XP och sedan används ett flertal emulatorer för att kunna köra olika hårdvara.

Byggbeskrivning av Marcade Mini

Commodore 64 i besöksloggen

Commodore 64 lives again! I besöksloggen (awstats) för hockeysnack så har en kär gammal vän dykt upp.

22 st träffar har alltså gjorts med en gammal C64. Imponerande gjort med den gamla brödrosten från 80-talet. Tydligen så finns det såväl en webbläsare och en webbserver till C64. Det är imponerande att awstats känner igen en sådan gammal maskin som inte ens var gjord för att surfa med.

Leve commodore!!

The Facebook bot

The ”Facebook Bot” started to appear in my server logfiles in June. Below is a screenshot of the awstats section for web-bots/spiders. Does anyone know what it is doing?

Running and debugging a SQL Server 2000 DTS Package in Visual Basic 6.0

If you have a fairly complex DTS-package (Data Transformation Services) in SQL-Server 2000 and don’t have a clue of what it does and have a limited understanding of dts read this. You can ”export” the package to VB6 and by doing so you can read the code and run and debug the script from the VB6-IDE. You can even run it in VB.NET. This is quite old school but sometimes necessary to do in legacy systems if you want to edit a complex dts-script.

Step 1 – Export the dts-package to visual basic

Open your DTS-package in SQL-server 2000.

Choose ”Package -> Save as” in the menu and then change ”Location” to ”Visual Basic file” in the dialog. Press OK and then a bas-file (VB-module) is saved to disk.

Step 2 – Create a visual basic project

Open Microsoft Visual Basic IDE. Choose to create a new ”Standard EXE” project then click ”Open”. Remove the default Forms1 from the project. Then you add the dts bas-file to the project with ”Project -> Add module”. The result should should look like below.

Step 2 – Executing and debugging the dts-package

Go to ”Project -> References” and add references to ”Microsoft DTSPackage Object Library” and ”Microsoft DTS Custom Task Object Library”. Now you are ready to edit your package.

To debug the package you simply set a breakpoint and hit F5.

Now feel free to fool around with the package/module and make the changes that you need. It is not easy at first but after a while you get the hang of it.

Step 3 -Saving the dts-package to SQL-server

When your package is ready for deployment you can deploy it through VB. Instead of executing the package you can easily save it to your SQL-server.

Search for the ”Save or execute package” section in the module. Comment the Execute statement and uncomment the SaveToSQLServer row.

Hit F5 to run the module. If everything works fine your new dts-package shows up in SQL-server.

More help with DTS can be found and at sqldts.com/

MRTG and Cisco-problem for unrouted VLAN’s

We had a problem with mrtg (version 2.14.5) and Cisco-routers (Cisco IOS Software, c7600s72033). The problem was that cfgmaker did not find the 64-bit traffic counters for ”unrouted vlan’s”, instead it used the 32-bit counter. When the utilization of such a port reached above 100 Mbit the counter ”rolled over” to zero and the graph looked like it was cut.

If you need to troubleshoot cfgmaker you should use snmpwalk to manually look at the counters from the device that you are monitoring. By doing so you can watch the traffic-numbers from the source. These are some of the ones that cfgmaker uses.

Get basic system information
snmpwalk -c community -v 2c ip-address system

Listing 32-bit traffic counters
snmpwalk -c community -v 2c ip-address ifinOctets

Listing 64-bit traffic counters
snmpwalk -c community -v 2c ip-adress ifHCInOctets

Check the interfaces speed
snmpwalk -c community -v 2c ip-adress ifSpeed
snmpwalk -c community -v 2c ip-adress ifHighSpeed

Check status of the interfaces
snmpwalk -c community -v 2c ip-adress ifOperStatus
snmpwalk -c community -v 2c ip-adress ifAdminStatus

List everything about the interfaces
snmpwalk -c community -v 2c ip-adress if

When I tested my router I could clearly see that it had 64-bit counters. However, cfgmaker couldn’t find them. Why?

IF-MIB::ifHCInOctets.1 = Counter64: 0
IF-MIB::ifHCInOctets.11 = Counter64: 1436496000
IF-MIB::ifHCInOctets.21 = Counter64: 1657770660
IF-MIB::ifHCInOctets.31 = Counter64: 8220
IF-MIB::ifHCInOctets.41 = Counter64: 219538030

There is a bug that is responsible for this behavior. Maybe the bug belongs to Cisco because they mark these interfaces as having zero speed. Very strange!

The workaround is (as stated in the bug report) to modify row 907 in cfgmaker to:
if((!defined $speed) or $counter eq ”” or $counter !~ /\d/ or $SNMP_Session::errmsg or $Net_SNMP_util::ErrorMessage?){

If you want to debug cfgmaker change to the rows below in the beginning of the cfgmaker program-file:

@main::DEBUG=qw(base snpo coca);
#@main::DEBUG=qw();

Do something every X iteration in a bash loop

If you have a bash loop and want to ”do something” at every X iteration you are in trouble because bash isn’t that good with numbers. Anyway, today I created this small example that you can use. In my case I needed to read a pretty large txt-file and create a simple html output table of the rows. The problem was to insert TR-tags between the TD-tags like below:

td row 1
td row 2
td row 3
tr
td row 4
td row 5
td row 6
tr

My solution solved the problem! It is pretty helpful that we have the modulo (%) operator in bash.

#!/bin/bash

# Change this to how many rows row you want to skip before doing something
doevery=3

for (( c=1; c<=100; c++ ))
do
	remainder=`expr $c % $doevery`
	echo "Remainder: $remainder"

	if [ $remainder = "0" ];	then
		echo "Every $doevery iteration"
		# Do something
	fi

done

Mina försök att använda HTPC’n som trådlös router i Windows 7

Jag har under sommaren laborerat med min HTPC så att den ska kunna dela ut mobilt bredband i sommarstugan med Windows 7 utan att behöva koppla in någon router. Man kan ju förvandla sin Windows 7 dator till att fungera som en trådlös router genom att använda ConnectifyMe, Virtual Router eller att använda sig av kommandoraden.

Jag har nu efter 1 månads testning gett upp försöket efter att ha testat alla dessa lösningar. Det som jag fick att fungera bäst var kommandorads-versionen men även den fungerade dåligt i längden. Det första jag märkte var att det sög rätt mycket kräm ur HTPC’n som skulle fungera som WIFI-hotspot (även om inga klienter var inkopplade). Det andra var att internet-uppkopplingen till de trådlösa klienterna försvann med jämna mellanrum. Jag testade med två olika 3G-modem i HTPC’n och uppkopplingen dog ändå. Vet inte vad det berodde på och orkar inte undersöka det mer, men antagligen är det något internt i Windows som spökar. Det lustiga var att uppkopplingen i vissa fall fungerade i själva HTPC’n men inte i trådlösa nätet. Det tredje ”dåliga” var att man inte har sån stor koll på vad som händer i nätet och man har inga möjligheter att ställa in de parametrar som vanligtvis finns i en router. Och till sist så tyckte jag att throughput’en (hastigheten) på trådlösa nätet försämrades drastiskt.

Nu har jag alltså gett upp och delar ut mobilt bredband trådlöst med en vanlig hårdvaru-router inkopplad till HTPC’n istället. Hur man gör detta kan man läsa här. Detta fungerar nu mycket bättre. Om M$ hade lagt lite mer tanke bakom den här funktionaliteten så hade det varit en riktig ”killer-feature”, men nu känns det lite väl omoget.

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.