Archive for April, 2006

A few random bits:

April 29, 2006

"Code Camp" was on last weekend and there was a number of cool things shown off. Two classes I picked up on and everyone should check out are ObservableCollection of T and TransactionalCollection of T… No doubt checking out/using those will take you on a little tour of some cool bits and pieces out there in .Net 2.0 🙂

Going completely on another tangent this is also something that people might want to check out especially if you are into FPGA's – I noticed it was just posted up a day or so ago: http://www.netbsd.org/Ports/evbppc/

As for other things I have been working on, I now have sound in my code generator! I installed Quake 3 again for a Lan we had the other day and after realizing that a pk3 file is a zip file (for Quake anyway) I was able to extract some of the sound files. It's definitelly cool to generate with this bad boy now 🙂 The generator uses MyGeneration which is based on .Net 1.1 so I had to use the following to get to play the sound files:

using System.Runtime.InteropServices; …..

[DllImport("winmm", CharSet = CharSet.Auto)]
 public static extern long PlaySound(String lpszName, long hModule, long dwFlags); ……

PlaySound(@"F:\Program Files\MyGeneration\Templates\NHibernate\regeneration.wav",0,0);

(Note the file name! Yeah – thats the buisness!) 😉

Other stuff I'm working on is setting up Lighty + RoR and expermenting with a few different things in relation to hosting. I have Lighty working through scgi with RoR on top of a Postgres database at the moment… Maybe I should post up some details on that? 

My most favourite thing lately must be vmware – if you havent got this – seriously – get the free copy – its excellent to work with 🙂 The only thing to watch out for is if it says it can't find a bootable cd: 1) Check the vm's bios (F2 when you start the vm – move the cd rom drive to the top – the boot order is on one of the last tabs), 2) Check that the virtual machines cd rom is looking at your cd rom – sometimes the auto detect doesnt pick up the right one so just set it to look at your normal physical drive – once you have that sorted it should be smooth sailing.

The only issues I've had so far are to do with installing Fedora (very slow, booting etc, even when there lots of Ram allocated). As for windows/ubuntu – I would say once you install the vmware tools they are just as good as a physical machine…

Oh, and if your into starting working with device drivers on Linux then check out this article: http://www.freesoftwaremagazine.com/articles/drivers_linux With a good book to follow up with afterwards you should be away 🙂

Advertisements

VMware – Browser Appliance, IE6

April 13, 2006

I was reading Aprils atomic magazine the other day and spotted a small piece on vmware and there Browser Applicance – basically its a vm download of around 250M with Ubuntu and Mozilla installed. The idea is to run your browser inside the vm to keep your main machine all nice and clean – good idea – but nothing you couldn't setup yourself. The cool thing is it is all done and just seems to work – run the vm up, it connects to the network and away you go. (It also lets you have a look at Ubuntu as well if you haven't already done that – the version is a little old now though – the current Browser Appliance download uses version 5.10)

After I grabbed the download I decided to chuck on ies4linux (installed wine and cabextract first – follow the instructions here: http://www.tatanka.com.br/ies4linux/en/instructions/ ). This is very easy to do – tick a couple of boxes, double click a script, it does some downloads and its done – installing on linux has never been easier :-). Bascially I wanted to see how wine was going since I haven't used it for a while and I also find things like web outlook etc need IE. Anyway – it seems to all work and layout pretty nicelly (may need some font packs) – so could be something to give a try – considering everything (even vmware) is free you can't really go wrong 🙂

log4net – Logging for your .Net Apps!

April 10, 2006

Ok I’m no log4net expert but it is a very cool package that everyone should use – believe me – it’s very quick to chuck in and will save you mountains of time and make you look like a pro without even really trying 🙂 It’s been around for along time (google for lots of tutorials etc) but I thought I’d put up my most basic x step guide to get running with log4net (this is once again so I can remember too 🙂 ):

1) Grab the log4net dll and register it in the project you want to use it in. (http://sourceforge.net/project/showfiles.php?group_id=31983&release_id=171808)

2) Make up a static class / singleton and chuck something like this in it:

private static ILog _log;

….

XmlConfigurator.Configure();
_log = LogManager.GetLogger(“GlobalLogging”);

…..

public static ILog Log
{
     get { return _log; }
}

3) Chuck a section like this in your main app.config:

<configSections>
 <section name=”log4net” type=”log4net.Config.Log4NetConfigurationSectionHandler, log4net” />
</configSections>

<log4net>
 <appender name=”FileAppender” type=”log4net.Appender.FileAppender”>
  <file value=”Log.txt” />
  <appendToFile value=”true” />
  <layout type=”log4net.Layout.PatternLayout”>
   <conversionPattern value=”%date [%thread] %-5level %logger – %message%newline” />
  </layout>
 </appender>

 <appender name=”ConsoleAppender” type=”log4net.Appender.ConsoleAppender” >
  <layout type=”log4net.Layout.PatternLayout”>
   <conversionPattern value=”%date [%thread] %-5level %logger – %message%newline” />
  </layout>
 </appender>

 <root>
  <level value=”INFO” />
  <appender-ref ref=”FileAppender” />
  <appender-ref ref=”ConsoleAppender” />
 </root>

<logger name=”GlobalLogging”>
 <level value=”INFO” />
 <appender-ref ref=”FileAppender” />
</logger>
</log4net>

Note: Get rid of the console appender if you just want to chuck the logs to a file.

4) Use your logger: Helper.Log.Info(“This is a log message”);

Now there are different types of messages (warn, info, debug etc) so these types need to be specified in the config – just add <level /> nodes in for the ones you want to log – if they arent in there then they get ignored and wont be written to the file 🙂 That’s how you can say do logging on development (debug) and then turn those off on production without changing your code! Just remove your setting from the config!

Another trick is to use logger sections with named loggers (note the “GlobalLogging”). By getting rid of the <root /> node and only having the logger node you can filter the messages down. This is useful if other components also perform logging but you dont want there messages to come through i.e. it can be used as a filter 🙂

Anyway, its really easy to use and you will get the hang of it “just like that” 🙂 – definitelly worth much more than the 2 minutes it takes to chuck in!

Castle Project

April 10, 2006

I’ve been meaning to post about this stuff for weeks but I can’t seem to find the time so just go here and check it out for yourself 🙂 http://www.castleproject.org/index.php/Main_Page It’s definitely worth the effort! In particular I was loving the Active Record pattern/generator they have built to sit over NHibernate. I could’nt get the generator gui to work (seemed to be broken) but I may have just been having “one of those moments” at the time 🙂

It seems to be getting better and better – lots of examples in the solution and it seems to be pretty self explanitory at how the basics work – if you have written an NHibernate solution then there’s no doubt you will love this – if you havent then it’s probibly not a bad idea just to grab this guy straight off the bat 🙂

Kororaa – Prepacked XGL

April 10, 2006

If you want to play around with Linux (or get an install an up and running quickly) then you can't go past Kororaa (http://kororaa.org/) – Just download the iso, burn a bootable image, boot from the cd and away you go! This guy comes prepacked with all the stuff for Xgl and "just works" straight out of the box – check out the screenshots if you havent seen xgl running – this is very cool! The linux system you have always wanted 🙂 Bascially its a prepacked gentoo install (with xgl) just to get you up and running really quickly.

The part I liked most is that I could have a play with xgl without prep'ing my machine and then spending a week downloading packages and trying to get it all setup – it just worked 🙂  I run an ATI 9800 and it had no problems – came up first time – all the effects worked! Ye-yah! The only issue I found (which they already had logged in the known issues) was that the terminal doesnt work under gnome with an ATI card (how an issue like that comes about I dont know!) but in KDE it was away 🙂 I'm thinking this is cool enough to do a full install which also is just a click away 🙂 If you are thinking that you wouldn't mind checking out xgl then this is definitelly the way to go 🙂 

 Top marks to the Kororaa team – this is awesome! 😀