Xorg (Xgl) and Vista

I was reading over lunch today and I stumbled across this:

Redirecting GDI, DirectX, and WPF applications – http://blogs.msdn.com/greg_schechter/archive/2006/05/02/588934.aspx

A couple of weeks ago I was at Microsoft and upon seeing a demo of Vista, some guy in the audience said “how do they do that?” and I said “I know exactly how they do that.” Of course I don’t know the code behind it, but since Apple is doing it and Linux is doing it, I figured I had a good idea of the abstract. The concepts are all the same.

At the break I proceeded to discuss it with a small group of people and I mentioned that this is nothing new and that OSX and even Linux has it. Specifically I told them to check out the Brainshare keynote to see a demo that is just as impressive, if not more so.

The above post I find interesting because it is the first time I’ve seen the challenges of this from MS point of view listed out. They look exactly like many of the X11 performance issues of the past. Specifically the section named “Drawing To and Reading From the Screen — Baaaad!” reminds me exactly of some very terse emails sent by a certain programmer of the enlightenment window manager 7 or so years ago now.

At the time uninformed people were always complaining about X. They said it was too slow and we should abandon it in favor of something else. With things like Xgl right around the corner in mainstream distributions, I think time has proven these people wrong. It is interesting to see that MS had to deal with some of the same performance issues.

Penguicon 4

Penguicon is rocking.

My demos went poorly on Friday regarding Mono and ASP.NET.

http://home.comcast.net/~jrwren04/Penguicon4.0/ASPNETMonoIntro/Presentation.html

But I think the overall message of the presentation was well recieved. I tend to NOT put all the points I make on slides. The ASP.NET presentation is indicative of this. It is only 5 slides. There is a title, 2 pictures, an analogy and a list of references.

Saturday’s Mono GUI apps panel went awesome. There were times where I could hear the audience awe when I showed the GTK# app I built using MonoDevelop on Dapper was copied to windows and executed. I did the same for a trivial Windows Forms app built using Visual Studio 2005 and the executable ran fine in Mono on Dapper. Thank you Ubuntu. Thank you Mono.

I wanted to simply demo some GTK# apps on Ubuntu, but my VMWare image doesn’t have any interesting photos for f-spot or music for Banshee. I thought I would remote X run my app from home, but I stumbled upon Xorg on Dapper lacking LBX support. I think the deps have changed in 7.0. I filled a bug and I’m working to fixing it.

MonoRails, ActiveRecord, NHibernate, Castle, Ayende

Ayende Rahien’s blog has had the highest signal to noise ratio of any blog which I can think of in recent history. He has posted a series over the past three days on using Castle’s Active Record, including using his own NHibernate.Generics.dll assembly to use .NET 2.0 Generics instead of ISet, IBag, etc with NHibernate. As someone new to NHibernate and ActiveRecord his series of posts arrived at the perfect time.

His posts really sum up to an excellent article. They are of excellent quality. They start with a teaser post that points the reader on where to get some great Castle information. Then he preps you with telling you what he plans to do the next few days. Finally he gets to the first post with all the meat and he does not disappoint. He continues with the aforementioned NHibernate.Generics and Iesi.Collections post. Those posts alone should be enough to get a programmer new to ActiveRecord going. Then he give a where clause example. I’m thinking that along the way he found some room for improvement in his NHibernate.Generics library, because his next blog post is out of the series. He posts an update to his library! I read these in Bloglines and even I noticed that he was making lots of posts. He noticed it himself.

Two more super meaty posts! He even covers lazy loading here! Of course most relational databases have many to many relations and he covers that so finally we programs have all the tools we need to get started.

I recommend you subscribe to his feed, or grab his entire February page and print it. It will be like a fun book. A fun tech book of ActiveRecord with some intermediate SQL sprinkled in for good measure. Between all those Castle Demo App posts he finds time to write about some interesting SQL experiences.

Thanks for the weekend of hard work Ayende. Some of us are watching with great anticipation.

Swallowing my ogg, passing mp3

I’m still an idealist. I still plan on using ogg vorbis instead of mp3. However, the convenience of just using iTunes for listening to music is too great.

474

Four hundred seventy-four ogg vorbis files that I don’t get to play with iTunes. All of which I have ripped myself from my own CDs. All of which I’ve been missing the sound of due to lack of iTunes ogg playback. Today I implemented my interim solution. I’ll put mp3 files right next to the oggs.

http://marginalhacks.com/bin/ogg2mp3 has a nifty perl script, which could just as easily be shell, but in a linux world, we always have perl 🙂

This script uses ogg123 to extract a wav file from the ogg, then uses lame to encode that wav file. Coupled with my shell prowess, I can put mp3s right next to all my oggs.

What shell prowess? I like this oneliner.

find . -name '*.ogg' | while read i ; do if [[ ! -e "${i%%.ogg}.mp3" ]] ; then echo doing $i ; ~/src/ogg2mp3 "$i" ; fi ; done

Not a oneliner you say? Well I typed and constructed it on one line.

Maybe this is easy to read?

find . -name '*.ogg' |
while read i
do
if [[ ! -e "${i%%.ogg}.mp3" ]]
then
echo doing $i
~/src/ogg2mp3 "$i"
fi
done

I love bash.

If you aren’t a master of the shell, then you may want to know just what is going on here.

I used find and piped to while read. why?

I could have used for i in `find`, but for splits on spaces, and many of my files have spaces in the name, so I used while read to capture the entire line output of find, which in this case is the filename.

I could have used find . -exec “ogg2mp3”, but then I don’t have access to shell builtins which I used to do my if statement.

My if statement checks to see if the ogg file is already there. The %% is a TrimRight function. It trims the .ogg off the end of whatever is in the i variable. Then I add the mp3. So if the mp3 doesn’t exist, then we create it. This makes it easy to stop can continue the process as well. Files that are already there will not be converted again. Of course if lame writes incrementally as it is doing the conversion, you could break in the middle of a conversion and have only part of an mp3. Don’t do that.

About the shell builtins, I used to sysadmin unix on some old slow computers. Creation of new processes was expensive. I’ve never given up always thinking about process creation and costs. ogg2mp3 wouldn’t take multiple files to convert on the command line, or else I would have used my beloved find -print0 | xargs -0 pattern. If I had used -exec and started bash instead of it, maybe something like find . -name '*.ogg' -exec 'bash -c \'if [[ ! -e ${\{\}%%.ogg}.mp3 ]]; then ...fi\''. It would have started a bash process for every cycle of the loop. Sure it is only 400+ in this case, but I’m used to scaling to 10,000, 30,000, or 100,000 … to I don’t care how big. Not to mention I find the escaping of the quotes and the curly bracets to be less readable this way. In fact, I think I have curly bracets escaped incorrectly in that -exec block. oh well.

After a day at work in Windows world, it is nice to return to the power and simplicity of the bash shell and gnu tools.