Ah, the memories…

August 14th, 2010 recover No comments

Recently, I have started coding a bit in Delphi. I used to code a lot in Delphi long ago. It’s actually the first proper programming language I learned. It’s really easy to learn and it’s easy to do windowed programs, but it has a weird syntax. I haven’t used it in about 5 years and I don’t plan on going back.

This time I made a custom version of the open source program SubRip. I added a bunch of stuff that I needed. Unfortunately the source code is a total mess, but I managed to add what I needed after a few tries.

Go here to find my files. Go here to read a thread I made about them.

You might find it interesting to know that my programs TrayCD and ShutdownGuard originated as Delphi programs. Their Delphi variants including source code are available too (follow the links).

P.S. I might post some of my old Delphi apps someday. I got a lot of them, but most of them are about as useful as TrayCD. :-)

Categories: Uncategorized Tags:

New site

July 6th, 2010 recover No comments

Finally! A new blog post. :-)

I got some good news: I am launching a new site! The purpose of this new site is to serve as a hub for my various projects and contain some basic information about me. Its ultimate purpose is to assist me in getting myself a job when I finish university (so please excuse any bragging ;) ).

Along with the new site there is a new server. To this date, stefansundin.com has been hosted at Dreamhost, which means the server is located in the US. This hasn’t been particularly convenient because I live in Sweden. I have now added ny.stefansundin.com, which points to my new server and contains my new site.

I currently got the new server in Sundsvall, but it will move to Luleå when school starts again. Once in Luleå I will try to get it a new home at Ludd, at which point it will eventually take over stefansundin.com.

This means that right now, I got two servers running concurrently. I have set up stefansundin.com to redirect you to ny.stefansundin.com if the new server is online. All of the old stuff (like this blog) is still hosted on the server in the US because I don’t want to take all the bandwidth at home (my brothers will get angry at me, hehe). So the two servers will work in conjunction with each other until the new server can take over completely. An added bonus of this is that I have a redundancy in case anything goes wrong with the new server.

Finally, I’ve changed the subtitle of this blog to “Me and my projects” to better represent what I talk about here.

Let me know if you have any suggestions.

Categories: Uncategorized Tags:

Dear hackers

May 26th, 2010 recover 1 comment

Dear hackers.

I am well aware that you are trying to hack my site. Since I added my speedruns hosting site, there have been about 20 attempts to upload malicious php files and what not. In recent days, the attempts have occurred more frequently.

Of course, all these attempts have failed. I am pretty sure it’s unhackable, but thanks for testing my security anyways. There is a review made by me before any file is accessible, so it simply will not work. Most of you are probably script kitties also, so I’m not surprised you aren’t having any success.

Anyway, please stop. It’s tiresome. But it does get me to laugh sometimes. Maybe I’ll make a map with the places people are trying to hack me from (since I got your IP addresses), could be fun to see.

Update: Here’s the map! Also, I can see that the script kitties are searching on Google for sites where they can upload files, for example inurl:upload.php.

Update: I just went ahead and blocked the upload script, this was getting far too annoying. Just email me if you want me to host a speedrun.

http://stefansundin.com/speedruns/upload.php
Categories: Uncategorized Tags:

Flattr

May 9th, 2010 recover 2 comments

So the new service Flattr is slowly but surely launching. It’s a new service that is meant to fix the problem of not being able to give something back to the creative creators on the internet. You will finally be able to add some money to that Thank You note. Flattr fixes this ingeniously, by implementing a monthly flat-rate, so you can flattr as many people as you want without having to worry about how much money you are giving away. Everyone will get a piece of the pie (or cake).

Right now Flattr is in beta, but you can sign up for an invite on the website. I am expecting it to launch very soon. Flattr will get very exciting when everyone gets a chance to test it out. You can’t make a living on it yet, but who knows what will happen when it gets popular?

The biggest problem with the de facto standard way of donating so far — Paypal — has been the problem of giving small sums. People who have little income will not bother since the overhead cost is simply too big. I have noticed this myself. Out of the 194507 downloads that my Windows tools have received so far (SuperF4, KillKeys, TrayCD, ShutdownGuard and AltDrag combined), only six people have donated. Those six people combined have generously given me 240$ (Thanks!).

Imagine instead that out of each download, 10% of the people want to give something back. Imagine that those 10% presses my Flattr button, and at the same time presses Flattr buttons for 9 other people that month.  Lets consider that they use the lowest possible flat-rate on Flattr, 2€. Since they have pressed 10 Flattr buttons, that amount will be split between 10 people, giving 0.2€ to each, with one of them being me. Lets do some simple math: 194507 × 0.10 × (0.2 €) = 3890 €. This means I would get 3890€, an enormous amount compared to the measly 240$ I have gotten so far using Paypal. And all of this while having quite pessimistic expectations — 10% wanting to give, each one with the lowest flat-rate and also giving to 9 other people.

There is one big hurdle that faces Flattr though. Adoption. The fantastic scenario I just wrote is only possible if Flattr gets a high adoption. This will definitely require some effort on Flattr’s part, but also depends on community help. Hopefully this blog post will get you excited enough to try it out. Here’s my advice: try out Flattr — it’s extremely cheap and best of all, everyone will get a piece of the cake (or pie)!

P.S. I have one Flattr invite in case you want to try it out. First person to email me gets it. It’s taken!

P.P.S. You see that new Flattr button below this post? Press it! :)

Categories: Uncategorized Tags:

My first circuit board

March 17th, 2010 recover No comments

I finished my first circuit board last week; an AVR programmer. I made it at an evening course arranged by an association at my university. It was pretty cool to learn how to make circuit boards DIY-style, and it wasn’t that difficult either. I had some previous soldering experience but this is the first time I soldered surface mounted components, which was probably the most difficult part in the whole process. Everything turned out great though, and the card worked on the first try. :-)

Here are some pictures:

The only mistake I made was to pick the wrong footprint for the resistors, so they are a bit crammed, but you would only notice that if you know what to look for.

A very fun project indeed. I learned a lot.

Categories: Uncategorized Tags:

MinGW and mingw-w64

February 23rd, 2010 recover No comments

MinGW is a port of the gcc compiler to Windows. I have used it for all my Windows programs, like AltDrag and SuperF4, and it has served me well for years. Recently though, I have become increasingly frustrated with MinGW’s stagnated development.  Simply put, nothing has happened for years.

It started with missing #define statements in the header files, and I eventually encountered missing library definitions for dll files. MinGW doesn’t even have all the correct definitions for Windows XP, some of which I want to use. A temporary workaround to these problems was to simply add a bunch of #define statements in my own code, and sure, this worked pretty well. The missing library definitions were a lot more troublesome to work around, but I eventually managed to do it (more about this here).

Off topic: one of the things I hate to do while programming is having to do things that doesn’t really concern the functionality of my program. Some things worth mentioning here is GUI, documentation and compilers. The basic reason why these compiler problems exist in the first place is because I only want to use free software programs in my toolchain. All the processing of my code to a working binary is entirely done by free software, which I think is pretty important. This might be a controversial statement since the programs are for Windows, a closed operating system, but I will leave that issue for another blog post.

When I started looking for a 64-bit compiler for Windows, it wasn’t long before I found out that the MinGW project had no intention of adding that anytime soon. I soon found the mingw-w64 project, a fork of MinGW. mingw-w64 is not only adding 64-bit support, but it is a lot more cutting edge; instead of gcc 3.4.5 (MinGW) there is gcc 4.4.3. They are also developing a 32-bit version called mingw-w32, which is basically MinGW but a lot more cutting edge. When I first found mingw-w64, the documentation wasn’t that great and I had a lot of troubles getting it to work. It is still a little difficult to find the stable downloads, but here are links to help you: mingw-w64 1.0, mingw-w32 1.0.

When I first tried mingw-w32, it was also missing the library definitions, but after I visited the IRC channel and asked them to add the definitions, they did so on the spot, and the next daily build worked flawlessly. I have seen many forum threads trying to get the MinGW people to add the very same library definitions, but with no success. I have been idling in the IRC channel ever since, and I am seeing constant development happen. This project is very much alive. I would like to encourage all MinGW users to check out mingw-w64 and decide if they want to switch to it.

Currently only the 64-bit parts of AltDrag 0.8 is compiled by mingw-w64 (the 32-bit files were compiled with MinGW). I am planning to compile all future releases with mingw-w32 and mingw-w64, which means I will start offering 64-bit binaries. All my programs can still be compiled by MinGW, but I don’t think I will be actively maintaining support for it.

Categories: Uncategorized Tags: ,

Name days in Google Calendar

February 13th, 2010 recover No comments

I recently finished a new project; Name days in Google Calendar.

This calendar works very similar to my Google Calendar Week Numbers, but instead adds flag icons to each day. Simply hover the mouse over the flag to see a tooltip with that day’s names. Click the flag to read more about the names (on Wikipedia).

Currently there are only Swedish name days, but if this becomes popular then I am willing to work to support more countries.

Categories: Uncategorized Tags: ,

The trouble with Shell_NotifyIcon()

December 20th, 2009 recover 3 comments

In the Windows API, there’s a function called Shell_NotifyIcon() which is used to manage the tray icon in your program. All my programs, like SuperF4 and AltDrag, have a tray icon — also the only UI they expose. As the number of users for my programs have grown, the number of bug reports regarding this function have increased. The problem with this API is that if (when) the Windows shell (explorer.exe) for some reason isn’t responding, the API call will fail. As a result, your tray icon won’t get updated, or worse yet, it won’t be added in the first place.

The first time I received a bug report about this was in December last year, almost exactly one year ago. A user was using AltDrag and complained that tray icon was not appearing when he started his computer, and that an error message mentioning Shell_NotifyIcon() appeared instead. After some googling, I found out that this most often happened on slow computers with antivirus software installed. The antivirus program slows down the computer so much so that explorer.exe hasn’t fully initialized when the autostart programs try to add their tray icons. I verified that the user had an antivirus program installed, and we managed to work out a workaround for the problem. The workaround simply tried to add the tray icon at least five times before giving up (code).

This worked great, and there were much rejoicing. It worked great until April this year, at which time I got two bug reports in rapid succession (one day between them). At this time I was using Vista and I had even encountered the error message myself, even though I have a fast computer and I don’t use an antivirus program. I eventually managed to track down why the retry code wasn’t working — it was because the code only tried several times when it was adding the tray icon — it didn’t retry when was updating the tray icon. Somehow the tray icon was added successfully, and then when the program tried to update the tray icon, explorer wasn’t responding and the update failed. For readers unfamiliar with my programs, they first initialize in a disabled state (and adds the tray icon), they then enable themselves (hook with the keyboard etc.), and finally updates the tray icon to represent the enabled state. Another fix was made to make the code always retry, no matter if it was trying to add or update the tray icon, and a delay of 100 ms was added between each retry (code).

This worked great, and there were much rejoicing. It worked great until a few months later, when bug reports about this started rolling in again. Another fix was made which increased the number of retries to 100. Combined with the 100 ms sleep, this means that the code should retry to add/update the tray icon for at least 10 seconds. This seems to have solved the problem for everyone.

I am now using Windows 7 and I have noticed that most people who reported the error also used Windows 7. It seems that Microsoft have worsened the situation with this release. I have also noticed that some of my other programs on autostart fail to add their tray icon sometimes (psst.. Xfire developers). The reason is this bug! Yes, it is a bug, but it’s not a bug in the program — it is really a bug in Windows. These programs don’t retry when they add their tray icon, they probably don’t even check if it was added successfully. I can understand why: This isn’t something a programmer should have to worry about at all, and the workaround is horrible and unreliable. The only reason almost no one knows about this bug is because almost no programs display an error message if their tray icon failed to add. Does your favorite app fail to add its tray icon on boot? That is because of this bug!

I have not updated all of my programs with latest fix yet. So far only AltDrag has the latest fix in its stable version, and SuperF4 has a hotfix released separately on its website. I will have to roll out a new version for all my programs — a version which only works around a bug that exists in the operating system.

My recommendation to developers: Add code that retries when you do any kind of operation on the tray icon, include a delay between each try, and try at least for 10 seconds before giving up. Also take a look at my code.

All of this touches on a much more deep and fundamental problem: Windows is unable to evolve. We are stuck with this problem because of application compatibility. Microsoft is afraid to trip on the wrong bit and cause mayhem with older applications, in which case they will eventually lose money. That is why Microsoft is unable to fix this bug. If a bug like this existed in an open operating system, it would simply be fixed, at the core, and the community would make sure that all applications are updated to work properly. This is impossible in Windows, and I promise you that we will still work around this bug in ten years from now. I guess that when Windows 8 is released, we will just have to increase the number of retries to 200.

Categories: Uncategorized Tags: , ,

Elasto Mania

August 16th, 2009 recover 2 comments

Today I want to release a few Elasto Mania maps that I made about 4 years ago. There are 4 levels, and I have made recordings of my best times on them. You can download them here.

Here are the levels:

rec1 – “Noobs only”: A pretty easy level where speed is important. My best time is 1:26:23. Screenshot.

rec2 – “Climbing Hour”: A tricky level in which you can save a lot of time by properly bouncing to an apple. My best time is 51:49. Screenshot.

rec3 – “Bumpy Ride”: A very short level with a lot of bumps. My best time is 14:97. Screenshot.

rec4 – “Authorized Elites Only”: A pretty long and difficult level. There are plenty of risky timesavers here. My best time is 3:35:02. Screenshot.

I will try to put the recordings up on youtube as well. They are now up! I also have a fifth level in the works, but I’m not sure if I will release it.

Let me know if you beat my times! :)

Categories: Uncategorized Tags:

Tiberium Earth

June 18th, 2009 recover 2 comments

Today I want to write about something that I made back in April 2007. This was about two weeks after Command & Conquer 3: Tiberium Wars had been released. Command & Conquer is a franchise that I really like. Well, before EA decided to kick Westwood in the butt anyway.

What I really like about C&C is the story. It has a truly awesome story. So after I had played through C&C3 I wanted to see how the planet had been ravaged by Tiberium. What is sad is that there were very little information outside of the game. The only place where you could see a globe with information about what places had become blue/yellow/red zones was in the introduction video, and it was really hard to make out the details.

In any case, I somehow got the idea to make a map of my own. I found a map with the various zones online. So I went to Google Maps and re-created the map there. When I was done I imported the map into Google Earth and recorded a short video.

cnc3zones

Video in mkv container. Watch with VLC.

After that I made a thread on the official C&C forums (which no longer exists) and a thread on the Pure Pwnage forums, linked to the video and explained what I had done, and there were much rejoicing. A few people noted that my source image was inaccurate but overall the reaction was positive. Those who posted agreed that information on how the various places in the world had turned out was really scarce.

Not much happened after that…. But after about two weeks, EA announced that they were releasing something called Tiberium Earth. Looks familiar? Well, it should! The idea is identical to mine. In plain text: they ripped me off!

tiberiumearth

And did I get any recognition at all? No!

This is as good as an example as any of EA’s inherent evilness. I would have settled for an email from Apoc telling me “Good job. Thanks for the idea.” or something like that. I wouldn’t have required anything except a little recognition! But no, they don’t care.

In any case, the effort from EA seems to have died right after they launched Tiberium Earth. I have seen no news about it after the announcement. The Tiberium Earth site have not been ported over to the new C&C site either. The KMZ file is no longer available at their site… I had to look it up on the web. You can get it here: TiberiumEarth.kmz

Final words? Apoc: It’s not too late to give me recognition for the idea.

Categories: Uncategorized Tags: