With the recent success of the Swedish Pirate Party, these kinds of parties are popping up all over the world. At the moment I am helping revive the Pirate Party of Canada which can hopefully run in an election sometime soon!
So if you are interested in protecting yourself from another C-61, join up and give us a hand!
Jul 1, 2009
Jun 29, 2009
/(Temporary)? Retirement/
It seems that the company I have been working for, keenkong and I have taken our separate paths. It wasn't really anything spectacular, from my perspective it was basically just a little incompatibility. I wasn't overly enjoying it, and that likely affected how I worked.
So now I look to the horizon with a fair bit more uncertainty about the future. I'm feeling fairly neutral about the job ending. I'm not ecstatic but at the same time, I'm happy to have some free time and a chance to take on some more creative pursuits.
As for looking for a new job, I'm not feeling overly motivated to find a new development position. It seems there are enough open-source projects that I'd be interested in contributing to to satisfy any code craving I may have.
Right now my current goal looks to be go back to school full-time and finish that, and see where it takes me. Back to coding? Maybe but unlikely.
So yeah, I will announce here my (likely permanent) retirement from the software development profession, and hope that all of those reading still in it will enjoy it more than I did :)
PS: I will still be writing code in my spare time - I do like coding after all. This blog will continue to get posts about that kind of stuff, just probably not as many Rails/JRuby posts.
So now I look to the horizon with a fair bit more uncertainty about the future. I'm feeling fairly neutral about the job ending. I'm not ecstatic but at the same time, I'm happy to have some free time and a chance to take on some more creative pursuits.
As for looking for a new job, I'm not feeling overly motivated to find a new development position. It seems there are enough open-source projects that I'd be interested in contributing to to satisfy any code craving I may have.
Right now my current goal looks to be go back to school full-time and finish that, and see where it takes me. Back to coding? Maybe but unlikely.
So yeah, I will announce here my (likely permanent) retirement from the software development profession, and hope that all of those reading still in it will enjoy it more than I did :)
PS: I will still be writing code in my spare time - I do like coding after all. This blog will continue to get posts about that kind of stuff, just probably not as many Rails/JRuby posts.
Jun 27, 2009
Using FreeImage in Ubuntu
In my last post I mentioned I wanted to output a visualization of the time it takes to render various parts of my fractal generator. To do this I used FreeImage, so here is a little tutorial on how to use the library in Ubuntu.
To install, just install the libfreeimage-dev package, either through Synaptic or using:
Here's some simple code to output a blue background to a bitmap:
To install, just install the libfreeimage-dev package, either through Synaptic or using:
sudo apt-get install libfreeimage-devOnce you've got that installed, you can link to it from your C/C++ programs.
Here's some simple code to output a blue background to a bitmap:
#include <FreeImage.h>Then to compile:
#include <stdlib.h>
int main(){
FreeImage_Initialise();
atexit(FreeImage_DeInitialise);
// create the bitmap object
FIBITMAP * bitmap = FreeImage_Allocate(200, 200, 32); // allocate a 200x200 pixel image, with 32-bit colour
// create the blue colour
RGBQUAD blue;
blue.rgbBlue = 255;
for (int i = 0; i < 200; i++){
for (int j = 0; j < 200; j++){
// draw a blue pixel at (i, j)
FreeImage_SetPixelColor(bitmap, i, j, &blue);
}
}
// save it as output.bmp
FreeImage_Save(FIF_BMP, bitmap, "output.bmp");
// deallocate memory
FreeImage_Unload(bitmap);
}
g++ image.cpp -o image -lfreeimage
Jun 20, 2009
Julia Sets - Moving the seed
I've been at the fractals again. This time I made it morph:
This is a Julia set again, but instead I am tracing a path through the complex space with the seed value. The path taken in this video is a near-circle centred at 0.12 + 0.74i with an real radius of 0.11 and an imaginary radius of 0.10.
There were a number of other really cool ones, but the problem is that the path they take tends to go into areas which have lots of points that do not fly off into infinity, which means they take a long time to process. That means that I can't have a nice framerate like the video has.
One thing that was kinda neat was that if you flip the sign on the centre of the ellipse for the imaginary component, it flips the patterns displayed on the x-axis (or maybe it's the y-axis). So centred at 0.12 - 0.74i, those swirls are in the top-right and bottom-left instead of the top-left and bottom-right.
A thing I would like to try to make better animations would be to see where the framerates get low. I can probably do this by iterating between -1 and 1 in the real and imaginary components and spit out a time for each computation. My plan will be to spit that out into a greyscale image so that it is easy to see where the slow points are.
This is a Julia set again, but instead I am tracing a path through the complex space with the seed value. The path taken in this video is a near-circle centred at 0.12 + 0.74i with an real radius of 0.11 and an imaginary radius of 0.10.
There were a number of other really cool ones, but the problem is that the path they take tends to go into areas which have lots of points that do not fly off into infinity, which means they take a long time to process. That means that I can't have a nice framerate like the video has.
One thing that was kinda neat was that if you flip the sign on the centre of the ellipse for the imaginary component, it flips the patterns displayed on the x-axis (or maybe it's the y-axis). So centred at 0.12 - 0.74i, those swirls are in the top-right and bottom-left instead of the top-left and bottom-right.
A thing I would like to try to make better animations would be to see where the framerates get low. I can probably do this by iterating between -1 and 1 in the real and imaginary components and spit out a time for each computation. My plan will be to spit that out into a greyscale image so that it is easy to see where the slow points are.
Jun 11, 2009
Actors and Distributed Computing
During my last post I spaced a fair bit and forgot to include a very important part about actors. I will now dedicate a whole post to that important part.
There are two requirements in an actor model: there is a way for an actor to reference another actor, and there is a way for the actor to send a message to that other actor. In a typical sequential OO program, this is done using instruction pointers and memory addresses and all that jazz. While it can also be done this way in an actor model, it is not restricted to this. For example, the way of referencing an actor can be done through the magical thing known as an IP address, and the way of calling an actor could be to send an HTTP request to that IP address. So in effect, many of us have already used the actor model without even knowing it!
The most important part of what I'm trying to say is that with an actor model when given two actors, these two actors may or may not be executing on the same machine.
An interesting thing is that this starts breaking down the definition of "program". A program can consist of several actors running across multiple machines within the same code-base, or can consist of several programs running across multiple machines and communicating with one another. Where does one draw the line? I can assume the Internet will not be referred to as a program, although technically it seems to follow the actor pattern.
There are two requirements in an actor model: there is a way for an actor to reference another actor, and there is a way for the actor to send a message to that other actor. In a typical sequential OO program, this is done using instruction pointers and memory addresses and all that jazz. While it can also be done this way in an actor model, it is not restricted to this. For example, the way of referencing an actor can be done through the magical thing known as an IP address, and the way of calling an actor could be to send an HTTP request to that IP address. So in effect, many of us have already used the actor model without even knowing it!
The most important part of what I'm trying to say is that with an actor model when given two actors, these two actors may or may not be executing on the same machine.
An interesting thing is that this starts breaking down the definition of "program". A program can consist of several actors running across multiple machines within the same code-base, or can consist of several programs running across multiple machines and communicating with one another. Where does one draw the line? I can assume the Internet will not be referred to as a program, although technically it seems to follow the actor pattern.
Jun 10, 2009
Actors
Concurrency is an interesting topic these days. Actually, it has been an interesting topic for a long time. Yet it is strange that many of us still only know of one way to write a concurrent program: using threads. This is not a bad approach - in fact it is the approach that seems to give the most control over how a program executes because it is close to the machine.
There are other models of concurrency that you can use. Being the ignorant boor that I am, I really only know about the actor model, however if you have the interest you can read about others here. I am not going to talk about those today, I will be telling you about actors.
While some may disagree, the main idea behind object-oriented programming is that there are objects which send messages to one another - in most OO languages, this involves calling the other objects' methods. Things like inheritance and encapsulation and all that are secondary - although no less important.
The actor model is the same thing. There are actors (instead of objects) which send messages to one another. The difference between actors and objects is that every actor is always running, and when it sends a message it does not wait for the message recipient to finish processing before it continues to execute. Let's illustrate this with an example:
With actors however, foo will have finished long before bar does. Why? Because after foo makes the call to bar, it just continues on executing in parallel with bar. Pretty neat eh?
That's pretty much all there is to actors. You can try playing around with them yourself by trying out Scala which has built-in support for actors and is not too far away from Java, or you can take a deeper plunge and try out Erlang. Unfortunately I do not have much experience with either language, in fact my experience with actors comes from a research project in university I did using a C++ library for actors. You can probably find libraries that implement the actor model for most modern languages, if you're not interested in learning a new language.
There are other models of concurrency that you can use. Being the ignorant boor that I am, I really only know about the actor model, however if you have the interest you can read about others here. I am not going to talk about those today, I will be telling you about actors.
While some may disagree, the main idea behind object-oriented programming is that there are objects which send messages to one another - in most OO languages, this involves calling the other objects' methods. Things like inheritance and encapsulation and all that are secondary - although no less important.
The actor model is the same thing. There are actors (instead of objects) which send messages to one another. The difference between actors and objects is that every actor is always running, and when it sends a message it does not wait for the message recipient to finish processing before it continues to execute. Let's illustrate this with an example:
method fooIn a traditional OO language like C++, Java, or basically any other OO language that I've worked with, nothing will happen in foo until bar has finished. So foo ends up taking a long time to execute, even though nothing really in foo takes a long time.
call bar
.. do stuff which does not take a long time
end
method bar
.. do stuff that make take a long time
end
With actors however, foo will have finished long before bar does. Why? Because after foo makes the call to bar, it just continues on executing in parallel with bar. Pretty neat eh?
That's pretty much all there is to actors. You can try playing around with them yourself by trying out Scala which has built-in support for actors and is not too far away from Java, or you can take a deeper plunge and try out Erlang. Unfortunately I do not have much experience with either language, in fact my experience with actors comes from a research project in university I did using a C++ library for actors. You can probably find libraries that implement the actor model for most modern languages, if you're not interested in learning a new language.
Jun 8, 2009
Blocking Reddit from Blogger
Over the year and a half or so that I've been writing this blog, a number of my posts have been put onto reddit by their search bot, gst - at least I think it is a search bot, I don't think anybody could have posted as many articles as they have unless they are sitting there reading blogs 24/7 - or maybe it is actually multiple people, who knows. Anyway, some posts were well liked, some were not, but in the end it doesn't really matter to me.
There is a good and a bad side to reddit. The people who like my stuff either just leave (possibly putting a vote up on reddit) or they subscribe and continue reading and occasionally share an intelligent comment. This is welcome. What does bug me is the people who just come in, leave a nasty comment or two like "yer gay" or something and fuck off. These people contribute absolutely nothing and when I'm having a bad day it is not the kind of email I want to come home to.
So anyway, I wrote up a little script to block out reddit traffic. To install this on your Blogger blog, just click the "Layout" tab, go to "Edit HTML" and drop this somewhere outside of a CSS tag:
There is a good and a bad side to reddit. The people who like my stuff either just leave (possibly putting a vote up on reddit) or they subscribe and continue reading and occasionally share an intelligent comment. This is welcome. What does bug me is the people who just come in, leave a nasty comment or two like "yer gay" or something and fuck off. These people contribute absolutely nothing and when I'm having a bad day it is not the kind of email I want to come home to.
So anyway, I wrote up a little script to block out reddit traffic. To install this on your Blogger blog, just click the "Layout" tab, go to "Edit HTML" and drop this somewhere outside of a CSS tag:
<script>This basically just boots them back to reddit. It won't affect them if they copy+paste the URL into their browser, but I figure if they're willing to go through that much effort to read your stuff they actually want to read your stuff and probably aren't going to troll.
if (document.referrer.match(/reddit\./)){
window.location = document.referrer;
}
</script>
Subscribe to:
Posts (Atom)
