Archive for the 'c++' Category

May 24 2010

Posted by coen under Programming,c++

inspectfs

It has been some time since my last post here, but finally I have something new to share.
Just yet I started working on a hobby project that may end up in the trash, or it may end up as a large side project: inspectfs. I haven’t put much thought in the name, so if you have an idea, let me know.
The idea is to build a (Linux) tool that gathers information about any disk / partition / file system that is currently attached to your computer. It’s a bit of a rough idea as of yet, but I hope it will crystallize a bit in the next few weeks.If you have any ideas or tips regarding this, please let me know and I’ll see if it’s worth incorporating.

Inspectfs relies on libudev for querying device information but I wrote some C++ wrapper classes because I want the project to contain as much C++ and as less C code as possible.
Soon you’ll be able to find the code and more on github, and if you want to join me, post a message here!

2 Comments »

Aug 08 2009

Posted by coen under Computers,Programming,c++

FreeNOS

For some time now, I’ve spent my free time working on an experimental Operating System called FreeNOS (Free Niek’s Operating System) and it’s about time I tell you something about it.
FreeNOS was invented by a friend of mine: Niek Linnenbank and is an microkernel OS written in C++, purely for learning purposes. By far the most work on FreeNOS is done by Niek but there is also some work on my name: I’ve been working on a time server, a parser library and the new challenge ahead is writing my own filesystem (as has Niek done with his LinnFS).
If you’re curious you can check out the code from Google Code and read all about FreeNOS on it’s website. It’s all very well documented (one of the main purposes of FreeNOS) and there is a developers manual on the way. I cannot emphasize enough that it’s possible for anyone with some programming experience to contribute to FreeNOS, regardless of what you want to do. So go on and explore!

1 Comment »

Jan 03 2009

Posted by coen under General,Programming,School,c++

2009

And there it is: the year 2009.
Thing is, I don’t really have a clue as to how to write this particular post, but there are a few things that I want to mention because I’m really really really excited about them :)
First of, I’m going to graduate this year, starting February 2nd. I plan to do that at Sogyo, and I’ve got a very cool assignment: I am going to do research after the available tools of code generation and DSL, and build proof of concept code in case the already available tools don’t suffice. Also, I think I will get my first Java certificate (SCJP).

Although these things all have a high nerd factor, I’ve a plan that can top that. In the summer holidays, I’ve decided to go to Hacking At Random, which will be in The Netherlands this year. I think that my friends and classmates (who also will be there) and I will have a *lot* of fun. As a matter of fact, I promise to show you some pictures afterwards.

While I’m thinking about it, my learning-by-cheating idea didn’t go as well as I thought: I didn’t finish that little project (but alas, that’s one of many). What did come out of it is Sentry. The Sentry core is actually nothing more than a library loader, but is has some nice features. Each plug-in (or library) can provide a number of hookpoints, where other plug-in commands can hook onto. Nice thing about this is that you can create a completely event-driven application, and anyone is free to create their own plug-ins. At this moment, I’m using it to create an IRC bot that is kind of able to control what’s happening in a channel and also to give my c++ knowledge a boost :) If you’re interested: you can take a quick look at my websvn subdomain, the repository is sentry_cpp, and it’s also possible to svn co it from the svn subdomain.

That’s all for now, happy 2009 y’all!

No Comments »

Oct 12 2008

Posted by coen under Programming,c++

Valgrind and it’s neighbours

For some time now, I have been working om my messaging client Skaar. Last week I built a version that only can connect to an IRC-server. There’s still a lot of work to do, but it was time to test and debug my work done so far.

A classmate told me to use valgrind to test Skaar for memory leaks. Valgrind is a suite of tools for debugging and profiling programs, so that should work, and there I went:

valgrind --log-file=./valgrind.log --leak-check=full ./skaar

After shutting down, it turned out that Skaar had left something behind, and not that modest (43Kb) either. It’s actually not that simple to prevent memory leaks, I learned. The obvious cases seem to scream: free(3) or delete me, but the not so obvious cases keep their mouths perfectly shut..

Obvious case:
char* line = (char*)malloc(513);
memset(line, 0, 513);
strcpy(line, "PRIVMSG #mychannel :foo\r\n");
...
free(line);

Not so obvious case:
// in RFC1459.cpp
JoinMessage* joinmessage = new JoinMessage(this, line);
return (AbstractMessage*)joinmessage;


// somewhat later in Skaar.cpp
AbstractMessage* message = protocol->translateIncoming(rawmsg);
...
delete message;

I’m wondering if this is the right way to end the AbstractMessage*‘s life, by the way. Who’s responsibility is it to get rid of the message? I could go with this solution, that says: “Here is your object, have fun”. I could also create a function in the protocol that destroys the message, something like RFC1459::destroyMessage(AbstractMessage* message), that says “Here is your object, but you have to let me take care of it’s end. Actually, I have no clue which one is the best choice, if there is a best choice here..

But, back to business: all I have to do now is just test every possibility to see if there are any leaks. Or I could just watch it when I write code, which also sounds nice.
Another tool that I’ve come to value is gdb, The GNU Project Debugger. This tool allows you to see what happens ‘inside’ the program while it executes. And yes, I stole that line from gnu.org :)
To start using gdb is not very hard, just type gdb yourprogram, and that’s that. To actually start executing you program, type run once gdb has started.

No Comments »

Feb 16 2008

Posted by coen under General,PHP,c++

About how school can be enjoyed again

Finally I have some time to write another post to you, my dear readers!

After starting up the HULK for about a fortnight, we started to bring up ideas for projects (so if anyone has an idea…). Actually, while I’m writing this I realize that I haven’t told you anything yet about the HULK (hmm.. weird).
Well, HULK stands for Hogeschool Utrecht Linux Kennisgroep, and consists of a few classmates and yours truly, who try to give Linux a shot in our university, the Hogeschool of Utrecht. The website is in Dutch, so if you want to follow up on it, you have to be able to read it.

We thought about some really cool projects like building our own Ubuntu distribution, HUbuntu , setting up Linux on mobile devices, teaching Unix, and also some smaller projects like building a logbook to keep track of what we’re doing and to provide student services (SSH access, web servers, database servers, etc.). Apart from that, I’ve started learning c(++), and for practice I’m building an IRC client, called skaar.

Next week, together with Mattijs, I’m starting on the logbook which will be built in PHP, so that we can start logging quickly.

Keeping you posted!

4 Comments »