The Rainbow Smoke project

Rainbow smoke - new imageThe all RGB colors project has been amazingly successful, let me thank everyone for their interest again. There have been many developments, so let me introduce them. First of all, I made the algorithm a lot faster and added many more features, so you will see lots of new awesome images (here’s one on the right, just a random pick out of hundreds, it’s rescaled, so don’t count the colors in it). I created a gallery website for to this project, rainbowsmoke.hu, and I’m working on providing fine art prints to the public. And I started porting the algorithm to other platforms, it’s already available for Android. So that’s the overview, I promised a follow-up article previously, let’s continue where I left off. Continue reading

All RGB colors in one image

RGB 256 1I recently started visiting the programming puzzles SE site. To a geek like me, it’s a little paradise: many interesting challenges, many interesting solutions, many like-minded people. Two days ago, there was one particular challenge: make a program to create an image that contains all RGB colors exactly once (and of course the best looking one wins). A very long time ago I made a small screen saver in assembly which grew a colorful coral (I may post that one day, too). I thought something similar would work here and maybe I’ll even get some votes. You can see the very first image right here. The results completely blew my mind, they were absolutely stunning, and of course it was a big success. Then I thought, let’s make a huge image, maybe even a YouTube video from this. But it wasn’t easy because it’s a brutally exponential problem. Two days of non-stop coding and minimum sleeping later, here it is! Continue reading

Why wouldn’t Oracle use a perfectly valid index?

I’ve been working on a project where Oracle suddenly stopped using a perfectly valid index. It is a unique index, so if you run a query for 20 different key values, there will be (at most) 20 rows. But instead of using this index, Oracle started doing a full table scan on the table, but it has a few hundred million rows, so it was game over for the application and it was totally incomprehensible. I am 95% developer and 5% DBA, I know my way around Oracle, SQL and simple optimizations, but I couldn’t find any explanation for this issue, so I had to start digging deeper and deeper. I learned a lot about Oracle’s internals until I finally found the solution. Instead of just writing about the end result, I decided to tell my whole story from the very beginning. Not only was it a very interesting investigation for me, but it can be useful to anyone in a similar situation. Continue reading

Storing .NET objects in cookies part 2 – compact bytes to string conversion

As I mentioned in part 1, Forms authentication cookies can get quite big when they have some data in the UserData field. The main problem is that every 8-bit character in the user data occupies four characters in the cookie, because it is UTF-16 encoded (1 character – 2 bytes, an extra zero is added) and converted to a hexadecimal string (1 character – 4 characters). For example, the “X” character (U+0058) ends up as the four character string “5800″. Plus a little overhead of the ticket itself, plus the 33% overhead of Base64 encoding. Here’s how you can do a lot better. Continue reading

The blog is alive

It was shocking to discover that I haven’t posted for over a year. Life happened, changing priorities, that’s all. As you can see, finally I had the time to write a new post, and there are at least 2 more in the queue right now, and an ever growing list of new ideas. Dear readers, don’t you worry, I will try to keep new stuff coming :) .

Storing .NET objects in cookies part 1 – compact serialization with binary XML

I was recently faced with the following challenge in an ASP.NET application. I have a data contract object that describes a user, which I have to store in a cookie for authentication and other purposes. Forms authentication is perfect for this: the cookie is cryptographically protected, the authentication is very easy to configure and it can store arbitrary user data as well. Problem is, as you might guess, this cookie would be quite big. You might ask, why don’t I store this object in the session? Because I wanted a session-less application. Or why don’t I store only a user ID in the cookie? Because gathering the user information is quite an expensive task. So the challenge was to serialize this object in the most compact way. Continue reading

I developed SVN tasks in MSBuild Extension Pack

I wanted to release binaries of my projects and embed the SVN revision and branch version number in them automatically. When it comes to build automation in .NET, MSBuild and MSBuild Extension Pack are the way to go. SVN isn’t supported out of the box, so I would have had to write targets that invoke the SVN command line tools. Tedious and ugly work. And then I had the idea that since MSBEP is open source, maybe I can develop support for SVN in it, so that my life will be easier, and also the whole world can benefit from that as well. My idea was very welcome by the project leader, Mike Fourie, so I joined the project and did it. See the official announcement here. Continue reading

Joco-ADPhoto: active directory photo editor, also introducing my tools project

It’s been so long since I last wrote… My previous post was about the directory object dialog that I implemented in my framework. My plan was to use it for something, and that something is finally here. It’s a tool that you can use to save photos for accounts in active directory and retrieve them. I also set up a new project on Google named Joco Tools. That is because I’m planning on releasing a lot more useful stuff here. Continue reading

Directory object dialog in .NET, and advanced COM marshaling

Last week I wanted to start a new .NET project, and I needed a directory object picker for it. I searched the web and found some solutions, but they just didn’t look right and decided that I can do a lot better than those. So in the spirit of creating good and reusable code, I started implementing my own IDsObjectPicker wrapper in my framework. I thought it would be easy, and it turned out to be anything but, but the result was awesome: clean, easy to use, and it works. And just like last time, I learned a lot about COM interop, you can read all about it here, or just scroll through and grab it already. Continue reading