Scary fast, simple and effective C# CSV Parser

B3y steven 11/9/2008 10:47:00 PM

Ok so this guy scares me just a little.

His CSV parser works better then any other I have seen and its succient and insane effecient.

For some reason I thought the diagram on how it works was some sort of joke, but then I looked at the code and realized - well I am kinda a nucklehead.

Enjoy!

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Neat, Quick Debug to Console Output

B3y steven 10/26/2008 4:18:00 PM

A very easy wayt to get Debug output for your debugging purposes:

 


  • Add the 'System.Diagnostics' using statement to the class.
  • use the 'Debug.WriteLine("Batman is totally kick butt");' syntax to send debug signals to any listeners
  • Add a Debug listener to your tester app; 
TextWriterTraceListener myWriter = new TextWriterTraceListener(System.Console.Out);
Debug.Listeners.Add(myWriter);

By the way, the syntax handling in BlogEngine is for crap. Its a total friggin' joke.

Enjoy!

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

OpenID, Anyone?

B3y steven 10/15/2008 8:23:00 AM

So I am playing around with OpenID, anyone else? Seems basically like another Passport (er, excuse me its "LiveID" now, *ahem*) type service just not MS centric. I will have to get it worked into my new project, DVDCrate.com.

Found this c# library for using authenticating users against the OpenID framework. Nifty.

Enjoy!

My OpenID Badge

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

BlogEngine makes Hulk Angry!

B3y steven 9/27/2008 9:25:00 AM

Gotta say getting syntax highlighting working properly in BlogEngine is a real PITA.

Working on this theory but it seems currently Code Highlighting is broken. :(

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Using, IDisposable and Such

B3y steven 9/16/2008 7:38:00 AM

I was messing with a PDF generating class (PDFSharp, an excellent free .NET PDF Toolkit for creating PDF's) and had to create a class that will load up some images (logos, watermarks, etc.) and then use those for the PDF. The problem is that these type objects are GDI+ type objects and are unmanaged objects. This became a problem because the logos I created during the PDF generation would remain in an opended state by the PDF generation class. This prevented me from deleting the logo file and just really pissed me off.

So IDisposable to the rescue. This allows me to manually manage the disposal of the unmanaged objects and then I could implement the PDF generation class in a using and viola! I was able to delete the image file with no issues.

Here and Here are a couple of great websites with notes and hints about implementing the IDisposable interface in C#.  

The only part that got me is the Finalizer and realizing that the Finalizer is called when the object is destructed by the GC. This is not safe to assume this is at the same time that the object is being disposed (end of a Using statement). So that is why some of the examples you find will have a Dispose(false) to a Dispose method. This prevents the managed objects from being collected in the destructor as the order is unpredictable. If that makes sense to you, great!

Here is a very simple class implementing the IDisposable interface; 

  

Enjoy!

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

A GUID of by any other name?

B3y steven 8/25/2008 8:59:00 PM

I was mokeying around today with GUID's and had a time with the durn things returning '00000000-0000-0000-0000-000000000000' as the GUID value.

The code I was using was;

[code:c#]Guid g = new Guid();[/code]

Then that would create a new Guid and set its value to '00000000-0000-0000-0000-000000000000'. Blah.

So instead I find this;

[code:c#]Guid g = Guid.NewGuid();[/code]

This generates a proper Guid value (was '1b6d4d3c-0e6e-4967-a389-281c4fb435d3' in this case).

Geez. You figure that would do what you want, someone smarter than I am about Guid's can leave a comment to clear up the mystery.

Enjoy!

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Subversion (svn) MonoDevelop on Ubuntu Hardy Heron (8.04.1)

B3y steven 7/18/2008 8:11:00 PM

So I tried to get the MonoDevelop release in Subversion to work with Ubuntu Hardy Heron (8.04.1) and had a heck of a time getting it to work.

Finally after much chatting on the IRC channel I did these steps;

  1. Setup badgerports as a repository
  2. Do the the 'ol 'sudo aptitude update && aptitude upgrade' 
  3. Run this; 'sudo apt-get install build-essential mono-mcs mono-gmcs mon-devel libmono-dev lipango1.0-dev libgtk2.0-dev libgtksourceview2.0-cil libgecko2.0-cil monodoc libmono-system-runtime2.0-cil gettext'
  4. Ensure you have 1.9 mono-gmcs installed; 'gmcs --version'
  5. Ensure you have 1.9 mono installed; 'mono --version'
  6. Follow the Subversion setup on the Monodevelop website, all should work now

Enjoy!

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

VirtualBox Clone Not Booting Windows XP

B3y steven 7/8/2008 10:06:00 PM

I was playing around with the new 1.6.2 Sun branded VirtualBox and thought I would clone one of my existing VDI's to a new one and then setup a new VM to use that VDI to play with.

So the first thing I did was clone the VDI using the cmd tool that comes with VirtualBox:

C:\Program Files\Sun\xVM VirtualBox\VBoxManage.exe C:\users\steven\.virtualbox\vdi\foo.vdi C:\users\steven\.virtualbox\vdi\bar.vdi

Nifty. Worked like a charm. Then you just go into the VirtualBox Virtual Disk Manager and add the newly cloned bar.vdi and then setup a new VM as usual to use that VDI.

But then of course it didnt want to boot Windows, just a series of lovely BSOD and reboots. Joy.

I trolled around on the forums and found that Innotek (or I guess Sun now) changed the default IDE controller from  PIIX3 to PIIX4 and this change seems to make Windows XP very unhappy. Go into the VM under the Advanced tab change from 'PIIX4' to 'PIIX3'. Now it boots. 

My only real compliant with VirtualBox is, well ok my only two complaints are; 1. Virtual Networking is a real PITA and 2. Why not have a UI for all the awesome options found in the VBoxManager.exe utility. Ah hell the price is awesome, and I get great USB support (boo! no USB device support for Virtual PC) and I dont have to download a 125MB download and register (boo! VMWARE).

Enjoy!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Simple Char

B3y steven 6/18/2008 9:50:00 PM

Ok so I evidently am not the sharpest knife in the drawer. I was trying to figure out how in the heck you set create and set a char variable.

Example:

[code:c#]char c = new char("s".ToCharArray[0]);[/code]

Yea I know now its as simple as using the single tick to specify the char literal;

[code:c#]char c = new char('s');[/code]

Good grief. Ah well, live and learn.

Currently rated 2.5 by 4 people

  • Currently 2.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Reading Gmail with Sup

B3y steven 5/26/2008 12:13:00 AM

I wanted a simple mail client that would handle all the mail I receive from various accounts and ran across Sup. Impressivly simple and very nicely done in a console application.

Here are the steps I took to get Sup both reading mail in my Gmail account and sending mail out via my Gmail account on my Arch workstation;

  • Installed  Yaourt
  • Installed Ruby and Rubygems via Yaourt
    • yaourt -Sy ruby rubygems
  • Installed VI via Yaourt
    • yaourt -Sy vim vim-colorstamplerpack
  • Installed sSMTP via Yaort
    • yaourt -Sy ssmtp
  • Setup sSMTP following this Wiki Entry
  • Installed Chronic (a date parser, dependency of Sup) via the Ruby Gems tool
    • sudo gem install chronic
  • Downloaded the latest Tarball of Sup, unpacked it into /tmp and installed it via the Gems
    • sudo gem install sup -y
  • My ~/.sup/sources.yaml file looks like this;
  • 	steven ~/.sup $  cat sources.yaml
    	---
    	- !masanjin.net,2006-10-01/Redwood/IMAP
    	uri: imaps://imap.gmail.com:993
    	username: myaccount@gmail.com
    	password: mygmailpassword
    	cur_offset: 12117761440000842
    	usual: true
    	archived: false
    	id: 1
    	labels:
    	- gmail
    	- !masanjin.net,2006-10-01/Redwood/SentLoader
    	cur_offset: 555
    	- !masanjin.net,2006-10-01/Redwood/DraftLoader
    	cur_offset: 0
    	

I found this guide very helpful for Sup

Enjoy!

ps; Man does posting from this HTML interface suck rocks. Gotta get some sorta MS Live Writer going. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Powered By BlogEngine Enhanced with Snapshots

About the author

Steven Hildreth Steven Hildreth
Proof that anyone can setup a blog.

E-mail me LinkedIn Profile

Send mail Sign in

Recent posts