Archive for the 'Programming' 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 »

Apr 07 2009

Posted by coen under Programming,School

Lost in translation

I’ve been planning to blog again for some time now, but every time I had some spare time I had nothing interesting to write about. That has changed. In my short experience in working through projects, I noticed that sometimes there are moments ‘in between’. You know, those moments between milestones or something. Well, I’m in one right now, and it’s a biggie.

I sort of finished the backend of my model translation tool (It reads an Enterprise Architect Class Diagram [/buzzwordalert] ), and now it’s time for the client. The problem with that is that I always get bored when the interesting stuff is done. In this case, The Interesting Stuff is figuring out how the Class Diagram parts of UML fit together and how to translate that to usable interfaces so that it can be transformed into code.

Luckyly for me, another interesting part is coming up: I have to create an Eclipse plug-in that uses the backend and produce kick-ass quality Java code of it. And reverse engineering, ofcourse. Not that I’m willing to be a rival of any other tool like, say, for instance the Eclispe Modeling Framework. I just want to know how stuff like that is done and what problems are encountered while creating code for that purpose, and I secretly hope that I will be able to contribute to the EMF after my graduation internship because after reading only the beginning of the Eclipse Modeling Framework I’m very excited about it.

I also ordered a book on creating Eclipse plug-ins because I couldn’t find much of a tutorial so I’ll be reading a lot, the next couple of weeks. But until that time I am a little off my game here with translating models and all. Lost in translation.

5 Comments »

Feb 22 2009

Posted by coen under C-Sharp,Java,Programming,School

Modeling and code generation

At my graduation internship at Sogyo I am currently working on an interesting item: researching the currently available modeling and code generation tools, and see if there’s a way to provide integration between those. There probably are a lot of tools that can generate code, but I’m focusing on the Eclipse Modeling Framework, Visual Studio 2008 and Enterprise Architect. The reason I am doing this ‘research’ is because I believe that modeling should have nothing to do with the programming language the software will be written in.

As it turns out so far, Visual Studio provides a Class Designer tool, but that’s not as extensive as I’d hoped. On the other hand there are the DSL Tools which enables me to create a Domain Specific Language that provides the necessary functionality. In fact, one could create a DSL that generates Java code – or whatever language, but that’s an obvious property of any DSL.
The Eclipse Modeling Framework has way more functionality, but can – as far as I know right now – only generate Java code.
The third tool, the Enterprise Architect, is an UML modeling tool that also provides very basic code generation. Unfortunately I must say that I’m not satisfied at all with the generated code by the Enterprise Architect, and even less satisfied with the plug-ins they provide for Eclipse and Visual Studio. In the generated Java code, enums and interfaces are apparently ignored; in C# code, the namespaces are not created and class methods are generated but getters and setters are neither recognized nor generated (this also goes for Java).

So I have decided that I’m going to write at least an Eclipse plug-in that reads the model from Enterprise Architect and creates decent hand-written-quality code for the domain classes. And given time, I’ll also create a Visual Studio plug-in that does the same. After that, the next step would be to extend these plug-ins with functionality to generate persistence and GUI code. Another thing is that it should be possible to alter the code after it’s been generated and send the changes back to the model. I’ll incorporate that as well in the first version of the plug-ins.

That leaves me with a lot of work todo, so I won’t get bored the next couple of months :)

4 Comments »

Jan 17 2009

Posted by coen under PHP,Programming,School

php and ssha ldap passwords

Although the current semester is almost over, we’re still working very hard on our project (in Dutch), and today I finished a password reset function for users of the portal. The tricky thing for me is that the user passwords are stored in LDAP, so I had to figure out how to write to a LDAP database, and how to create a SSHA password hash in php.
I found that there is very little documentation about the ldap functionality in php, let alone how to create a SSHA hash. There was, however, one post on php.net where I found half of my answer: http://nl.php.net/manual/en/function.sha1.php#52365 . The only thing I had to change was:

// this
$salt = pack("CCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand());
// into this
$salt = pack("CCCCCCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand());

So, the complete code now looks like this:

mt_srand((double)microtime()*1000000);
$salt = pack("CCCCCCCC", mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand(), mt_rand());
$sshaPassword = "{SSHA}" . base64_encode( pack("H*", sha1($newpasswd . $salt)) . $salt);
// bind using the configged options
$ldap->bind();
$ldap->save($userDn , array("userPassword" => $sshaPassword));

So finally, the password reset functionality works and users won’t have to worry if they’ve lost their password.

2 Comments »

Next »