Ubuntu sound

This evening I downloaded the asterisk @ home vmware file. You just run it in your free vmware player (not opensource (yet)), point your nice firefox to the admin module and install the extra features, setup your extensions, conference rooms and off you go! Its much easier than setting it up on a xen debian, no editing in config files. You’ld prolly still want to know how his works but this asterisk @ home project has really made setting up a voip server easy!!

So I wanted to connect my ekiga to the voip but because I was already running skype I got problems with my sound. The friendly folks over at #ekiga on gimpnet point me to this wiki entry. Now I did create the .asoundrc file but when I moved it to another file everything still kept working. I rather suspect that you only have to modify the ekiga in and output, so setting them to default should have done the trick. I found out that I actually have to move the file otherwise the multisound doesn’t work!

I wanted to try the sounds together, so I wanted to fire up xmms, but hmm that’s so old school, right?! Well I’m pro-mono and I know Aaron is doing one hell of a job at the banshee project. As I understand it, it will be the first opensource (gnome)application that can ship with the mp3 codec build in. They didn’t use the one of the gpl version and therefor they could ship it. What really caught my eye was the speed at witch in loads the mp3z from my harddisk. When I clicked the same folder in rythmbox the app didn’t react, banshee show a nice progressbar and I could still move the window. I don’t know why, but it seems that the sound quality between xmms and banshee is also totally different. Banshee sounds much purer, don’t know if that souds normal, I’ve asked it on the channel but haven’t got any answers yet. The guys over at novell are realling going fast, they have produced some really amazing appz in a very short period of time (banshee,beagle,f-spot,… and diva is coming, WOOT!!) I’m a happy (mono) camper!!
The guys over at #mono doubted that this was actually possible, but hey I konw what I’m hearing.

Kernel development

As I already mentioned a couple of times, I’m reading up on the kernel development book of R. Love. In the past I didn’t spend that much time at looking into the kernel itself. Okay I knew there were great enhancements and stuff like that. But Now I’ve finished the part about, memory allocation for user space, IO, Process scheduler and a couple of others. I have to say (again) that It has opened my eyes. I feel like taking the blue pill 😀

When I was reading up on the IO, more precise the elevator design. For those of you who may not now this design, its quite simple. Because IO is one of the slowest parts from an application the kernel has an good design for handling seeks. If a process requests data from one sector the hard disks arm will go to that position and read it. Now another process could get a timeslice and request another read somewhere totally different. Instead of moving the arm again, it waits for a couple of seconds (as I understand, the kernel doesn’t really issue the request, but maybe I’m wrong here). If there comes another request for more data, it I’ll first handle that request and then handle the next requests. I do have to admit then there are parts where my common C knowledge isn’t sufficient, but I also ordered a book for C programming. After I’ve finished it, I’ll start my other book of kernel development and then prolly reread roberts book.

So I’ve you really want be blazed of your feet read it. This book is also perfect for the programmers/admins in your department who think they know everything. Give them this book and then do a pop quiz on them, we’ll see who laughs last 😀

First sip conversation on my asterisk box

Yesterday evening pvanhoof was so friendly to join me in a friendly voip session. We used my asterisk setup in a xen environment. First we had some problems with connecting and after some small audio issues everything worked. We were both using Ekiga, I also tried xten lite but the audio wasn’t that clear maybe after some tweaking it would have worked. But my preference goes out to Ekiga because its opensource and the maintainer is belgium. The little patriot in me 😀

Pvanhoof also found out why I got those strange errors when I used lsmod and everything that had something todo with kernel modules. My thougts were that it was a xen problem, after pvanhoof searched a bit he found on kerneltrap that the problem was the package module-init-tools it wasn’t installed. So now that’s fixed 2. Still have to install the ztdummy module but it seems you have to compile this from source, so now I’m looking for the 2.6.12.6-xenU kernel headers. So this weekend will become a googling eastern for me 😀

If you would like to give my asterisk box a go, just ping me and I’ll be happy to setup an extension for you! And if I get the meetme up and running I’ll start a conference call with all the extensions 😀

Asterisk

I’ve been very busy lately, but fortunately the soccer season has come to an end and I’ve got some more time.

Well I’ve managed to get an asterisk server up and running in our xen machine. Almost that is, person 2 person and mailbox are working but I’ve got a problem with the conference setup. I always get that darn Zaptel error, that in combination with running a xen vm and therefor a custom kernel isn’t what I’ld call a ideal setup, but I’ll manage. 😀

If there are people out there who have already done such a setup, give me call out what you did to fix it. If there are people reading this who have done this and connected the asterisk pbx with a real phone line (for Belgium) provided by a third party (packetnet or something) please leave a note, I’m looking into the available providers for this kind of service. I haven’t found that many I must say and all extra information would be great. On the other hand, I could also connect an ordinay pstn (at my home) to a local asterisk setup and all problems would be gone :), hmmm, neah, try to fix the xen setup.

I’ll keep you posted how its going.

windows vista delayed = Mr Smith

You prolly saw it in the news but windows vista is delayed. My first reaction was, So what, that has happened before, right!? Well guess I was wrong, yesterday evening I was watching CNN and there was a big report on this event. They were questioning Microsofts competence, questions like

  • have they lost their position?
  • can’t they do something easy like an operating system?
  • Are they going under because the company is just to big

The stock of microsoft were already starting to lose ground, it was even taking down big companies like dell with them. So Mr. Dell if you read this, start your linux assembly line please (stop saying it, just do it!!) 😀
They also pointed out that because Microsoft wouldn’t get it out before christmas they would lose all the revenue that came with the christmas sales and that would be a great setback.
I also heared on my podcast (where else) that IBM wouldn’t be switching to vista, but would turn their whole company to redhat (or fedora don’t know exactly). Just imagine that all those fortune 500 companies would do that, first off that would give microsoft a real backset. Secondly they would probably use openoffice, so If they would send a document into the world it would be a pdf or openoffice document type. So every customer of them would have to download openoffice to open and edit/read it. Just imagine the snowball effect this (w)could have. These are exciting times I kinda feel like the first matrix flick when neo is becoming The One, I for one am quite sure that linux is The One (kinda lost all my selfrespect of not being a total geek by this last sentence, but one cannot deny his true self, right?!)

Well maybe the shot we have with the new gnome and kde desktops is bigger than everybody is hoping for. I sure hope gnome will get further than has been planned, I’m really pleased with the outcome of the 2.14 version. It’s really blazing fast, I don’t have Xgl turned on all the time because my hardware isn’t fully supported yet, but even with Xgl on its fast (sometimes even looks faster with xgl turned on than off :D)

Gnome 2.14 + Podcast review

Yesterday evening I did an apt-get dist-upgrade (Mabye upgrade alone was enough, not quite sure. For the moment I mostly do dist-upgrade, if there is no dist to upgrade it seems to fall back to the normal upgrade).

48 MB to upgrade, that seemed a lot,off course upgrade. Today I logged in and checked the about gnome dialog. It seems 2.14 has arrived on my ubuntu dapper drake. Haven’t noticed that much changes to the 2.13.9.? I was running before. So I’ll reread the release notes 🙂

Yesterday evening I was talking to a client and the popup came that new updates were available. He’s a microsoft guy, so I explained him a bit about what the updates and all were all about. I explained to him, imagine that microsoft would popup something saying, we have a better and newer version of the kernel, drawing dll’s,… He said, well they do that, that are the service packs. Hmm I wonder, Windows xp is out around 2001 – 2002, right? There are 2 service packs available. Just imagine that on linux. My guess is, we would be still running 2.4 or 2.2 kernel. Okay I know there are still companies out there that prolly run a 2.4 or a 2.2. But they have the choice to upgrade and off course, linux fixes it own problems you don’t have to buy other software to protect you from bugs they can’t or won’t fix.

Makes you wonder if microsoft would go as fast as linux is going at the moment. Or would the bad rap still stick and nobody would join? That is off course if there were people who had the knowledge,brains and will to understand the source code of microsoft.

On another note, I was listening to my daily podcast during my commute from Bree or Leuven to Diegem (Brussels). On the linux link tech show there was the head of open source of sun. At first they off course made some jokes about sun and opensource, but in the end it got really good. I especially liked a part that goes something like this.
Sun donated openoffice to the community. First they bought the company that was working on the source and afterwords they just gave it away, now why could a company do that?
Well, imagine this: Sun has more than 100.000 employees wolrd wide, they were all using microsoft office. The costs of linces compared to the costs of buying the company that was working on openoffice were more favorable to buying the company. So we bought the company and released the code.

Now that’s something I really dig, why aren’t all big companies like that? We would have a lot more good opensource software.

He afterwards did admit that sun had a bumpy ride. He pointed out that sun first started as a real opensource company, but due to a lot of factors they weren’t as openminded as in the beginning, but now they were again focussing on opensource and we would see more news of sun in the oss community. He even said that the sun jvm would become opensource, unfortunately he didn’t say when.

So go over to the linux link techshow site and download their podcasts, they’re really good and very informative!!

Never put an image (or static file) into a db

Here’s a nice article on what exactly happens if you put static content in a database. Okay, it may look nice and stuff, but just check here what actually has to happen to just serve that static file.
Just a confirmation of what I’m always saying to people who do want to do it! So read it, if you want to store or in a former project stored images in the db!

reading kernel development by robert love

Last week I spent a week home, call it vacation if you wish. Other years I was always very busy doing all kind of geeky stuff, you know what I mean, right? Well, this year I wanted to really do nothing and just reload my batteries and get some extra sleep (in my normal life, i sleep about 4 hours a day).

Because I didn’t want to spend most of the time behind a computer, I picked up a book a had bought half a year ago. The book is kernel development by Robert love. I’m only at page 40 or something, but I have to say I already learned a lot. Because i’m always programming in higher languages you tend to forget sometimes how the underlaying system works. Because you are used to programming to a virtual machine, you don’t have to think about freeing you objects and how your datastructures are aligned,…

Reading the book I came to think about how different those 2 kinds of programming really are. I wonder if there are people around who like both, philip probably does, but for the rest I don’t actually know people who love the beauty of low level programming as wel as high level programming. To bad I haven’t got that much experience in the low level field. Besides a small patch in liferea and a patch I’m working on at the moment, my ansi C knowledge isn’t that great :s. Besides if you want to do kernel programming, you don’t have glib available and if I remember correctly you don’t even have libc available?!
Who knows, maybe after I’ve finished the book I’ll give a custom kernel module in a xen environment a swing, I’ll call it the helloworld-module or foobar-module 😛 and I’ll finally test out the remote debugging philip is always bragging about 😀

Mono/glade app did the job

A while ago a wrote about a mono app I was busy developing. Well this weekend the event took place where my app was used. And expect one little bug in the app (my fault) it worked very very good! Everyone was pleased with the result.Let me explain a bit about the event. It’s called 6 uren loop van zolder (dutch) in english this would translate to something like 6 hour run of zolder , as you prolly guessed its about a group of people running 6 hours 🙂

So these people run laps around the race track of zolder. One round was 3930 meters, I had designed an application that would let them insert new runners but more importantly it was made to keep track of how many laps a runner did. So we set us up in a little box at the start/finish line. Everytime someone came along they yelled the number of the runner and we had to insert it. Not so difficult you would image, right. Okay but imagin this, those runners sometimes stay in groups of 20 people. And all those 20 people come by you have to insert them, believe me the first couple of rounds it was really speed typing and mistakes were not so easy to fix then because the lack of time. At the end reports had to be generated for every category with the best results frist, bad results last. (if you can say that 50 km is bad 🙂 )

How did I do this, well first off this application had to run for 6 hours and had to be pretty stable so linux was off course my prefered choice of OS 🙂

Now I had to choose what language to do it in. Okay for work I do java, but I like to use other languages as well. I have done some project in dotnet in the past, but not yet on linux using mono. This was the best use case I could imagine. I had already played around with monodevelop in the past, so my choice for IDE was easy too. (I also wanted to try out the new version with the plugin system).

Because I really hate writting DAO layers with their CRUD statements.
(CreateReadUpdateDelete)
I used Nhibernate for doing all the Data Access. I’ve used Hibernate frequently in my java projects and wanted to know how far the dotnet/mono version got. I must say they did a pretty good job, only thin that didn’t work for me was the mapping in custom sql statements. ie. You have an object Runner with a property StartNumber that maps to a column Runner_Id, if you want to use it in a custom sql query, you would have to do something like “from Runner order by Runner_id” and not “from Runner order by StartNumber” as is in the java version and what you expect it to be. But hey maybe I didn’t check it good enough, and I didn’t get the CVS version.

Okay a Little example of a hibernate setup:
the mapping file

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" assembly="6urenloop">
	<class name="Categorie" table="categorie">
		<id name="CategorieId" column="categorie_id" type="int">
			<generator class="assigned"/>
		</id>
		<property name="CategorieName" column="categorie_name" type="String"/>
	</class>
</hibernate-mapping>

The Mapped object

// created on 1/25/2006 at 11:53 PM
using System;

public class Categorie
{
	private int _categorieId;
	private String _categorieName;
	
	public int CategorieId
	{
		get{return this._categorieId;}
		set{this._categorieId=value;}
	}
	
	public String CategorieName
	{
		get{return this._categorieName;}
		set{this._categorieName=value;}
	}
}

The Dao

using NHibernate;
using NHibernate.Cfg;
using System;
using System.Collections;
using System.Reflection;

public class CategorieDao{
	private ISessionFactory factory;
	private static CategorieDao _instance;

	private CategorieDao(){
		this._Init();
	}
	
	public static CategorieDao Instance{
		get
		{
			if(_instance==null)
			{
				_instance = new CategorieDao();
			}
			return _instance;
		}
	}
	
	
	private void _Init() {
		factory = HibernateUtil.Instance.Factory;
	}
	
	public Categorie FindById(int id)
	{
		ISession session = factory.OpenSession();
		ITransaction transaction = session.BeginTransaction();
		IQuery query = session.CreateQuery("from Categorie where Categorie_Id = :id");
		query.SetParameter("id",id);
		IList list = query.List();
		Categorie cat = (Categorie)list[0];
		transaction.Commit();
		session.Close();
		return cat;
	}
	
	
	public IList LoadAll()
	{
		ISession session = factory.OpenSession();
		ITransaction transaction = session.BeginTransaction();
		IQuery query = session.CreateQuery("from Categorie order by categorie_name");
		IList list = query.List();
		Console.WriteLine("list size : "+list.Count);
		transaction.Commit();
		session.Close();
		return list;
	}
}

Pretty straight forward right? As backend database I used mysql. I know there are other people running windows who want the results, this way if they setup a mysql on their windows they can import my tables.

I used 4 tables:

  1. Runners
  2. Categories
  3. Laps
  4. Results

The first 2 are obvious, but the laps table is a table with 3 columns

  1. runner_id
  2. max_lap
  3. timestamp

Every time a runner passes our box we would insert his startnumber, in the end we can track every runner his laps. This way if there are any wrong entries you can quickly fix them withou

Another thing that was pretty strange in my eyes was getting the selected value from a TreeView the code goes like this:

TreeModel model;
TreeIter iter;
if(this.CategorieLst.Selection.GetSelected(out model,out iter))
{
	newLoper.Categorie = (int)model.GetValue(iter,0);
}

With my java background it’s not that obvious, even in my dotnet projects I haven’t seen a construct like this. However in the C language it looks normal 🙂 Guess this is result from binding a C object to C# object. But it works, that’s what matters!

I used glade-2 to create the GUI (as is the standard for creating Gtk applications). I used the glade bindings to connect my gui to my code with the simple lines of code:

Glade.XML gxml = new Glade.XML (null, "6urenloop.glade", "window1", null);
gxml.Autoconnect (this);

And giving my widgets the same name as in the glade file,adding the xml attribute [Glade.WidgetAttribute] is all that is needed. Easy isn’t it?

Here you can find some screenhosts
The screen for inserting new runners:

The screen for inserting laps and creating,exporting the results:

I’m going to make some small adjustments, refactor to use english variables and not dutch variables. Have a GUID for every lap to make updating the laps easier. Once that is done I’ll post it on sourceforge and everybody who does something like this can reuse the code base maybe even update it. You can even check it out for Nhibernate, the documentation of NHibernate isn’t quite as good as the java version.

Ps yes I know, the interface is very ugly and not following the Gnome Guidelines, but it works like a sharm.

waiting

I always found it a pitty I hadn’t ordered a Nokia 770, I’m still considering getting one, but they cost a lot of money, if they had a built in cellular, I’ld probably had one by now. But wait what’s this, hmm a newer version coming up. Definitely got to keep my eyes on this one. O Wait, one of those guys is coming to FOSDEM if I’m not mistaken, hmmm. Maybe ask a question about it??? Sounds like a plan! 😀

Hmmm in the same category is this item , what’s sweet is the little additional comment about gnome. 😛
I’m still waiting for the first real cellular with PIM functionality running linux!! Does anybody know one? Give me comment would ya? thnx