February 2007 Entries

So PHP has this neat built in function ( highlight_string($var) )to do code formatting / coloring and for PeaceLoveCode, I want it to do this.

SO I was looking around and came across Jean-Claude Manoli's site and his Code Formatter for C#, VB, HTML, XML, SQL, and MSH. He gives out the source for free too.

So I had a Vista VM I built at work and ran into a very bad problem, the ethernet drivers wouldn't load.

I totally forgot about this issue and the VM until QA started to ask for it. So after a quick google search, I found that VMWare told you how to solve the problem and it is really rather easy.

Just install VMWare Tools on the image.

Seriously, these suckers are great.

Just ported some VB6 to c# code and got my working force sensor on a 8/8/8.

using System;
using System.Windows.Forms;
using Phidgets;

namespace ForceSensorTest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
InterfaceKit ifKit;
private void Form1_Load(object sender, EventArgs e)
{
trackBar1.Minimum = 0;
trackBar1.Maximum = 1000;
trackBar1.TickFrequency = 50;

ifKit = new InterfaceKit();
ifKit.open();
ifKit.SensorChange += new Phidgets.Events.SensorChangeEventHandler(ifKit_SensorChange);

}

void ifKit_SensorChange(object sender, Phidgets.Events.SensorChangeEventArgs e)
{
if (e.Index == 0)
{
trackBar1.Value = e.Value;
textBox1.Text = e.Value.ToString();
}
}
}
}

Ok, so new desktop computer time.

Mouse: LogitechMX Revolution - Purchased
Keyboard: No clue
Monitor: No clue but want 22" or 24" widescreen
Desktop computer: Mac Pro (boot camp)
Operating System: Windows Vista Ultimate - Purchased
Speakers: No clue

SO long story short, my current desktop is about ready to be dead. It is a Frankenstein of old and older parts. It was built when I was in college and for the time, it was the best I could build with the amount I had budgeted. A ton of the parts are from a Dell Pentium 2 box that I got I'd say 8 years ago. It actually runs a GeForce MX2 chipset (figure about 7 years old). Counter-Strike stresses that video card. So

I'm going to reuse my 17" monitor so I get dual monitors but over all, everything in my PC is going to die. Die with extreme pleasure actually. It does have a 250 gig HD that is nice but is IDE so won't fit in with a new style system.

So what am I getting? The list is above. Why a Mac Pro? From what I've seen, it is dollar for dollar the best computer I can buy that can run Windows and is dead silent. It looks nice and if for whatever retarded and doubtful reason I need to run OS X, I can.

My current speakers suck big time so I'm looking for new ones. I'm thinking 2.1 are fine for my PC. More so, a decent receiver / speaker set that accepts digital audio (Mac Pro has optical out) would be sweet.

So most of this code was done by a coworker, I was just tasked to make it so there is no UI visible. Another solution was to make this a service, but this is SO much easier just to comment out the Application.Run(new Form1()); line. So more or less, between 1 and 5 minutes it will randomly open up your CD tray.

Consumes no CPU too.

Have fun being evil.

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;

namespace SysOpenerServ
{
static class Program
{
///


/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// Application.Run(new Form1());

Random RandomClass = new Random();

while (true)
{
CD_ROM_API.mciSendString("set CDAudio door open", null, 127, 0);
CD_ROM_API.mciSendString("set CDAudio door closed", null, 127, 0);
Thread.Sleep(RandomClass.Next(60000, 5 * 60000));
}
}

public class CD_ROM_API
{
[DllImport("winmm.dll", EntryPoint = "mciSendStringA")]
public static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);

[DllImport("kernel32.dll", EntryPoint = "GetVolumeInformationA")]
public static extern int GetVolumeInformation(string lpRootPathName, StringBuilder lpVolumeNameBuffer, int nVolumeNameSize, int lpVolumeSerialNumber, int lpMaximumComponentLength, int lpFileSystemFlags, string lpFileSystemNameBuffer, int nFileSystemNameSize);

[DllImport("kernel32.dll", EntryPoint = "GetDriveTypeA")]
public static extern int GetDriveType(string nDrive);
}
}
}

Ok, I got a yet another domain. This one I know I'll actually use since I got it for a direct purpose.

To show off code I wrote and maybe make it a tad more global. Who knows.

Pretty much I have code that spans multiple sites. I dislike that aspect. I have no central repository that I can say "Here is all my stuff" since it is all over the place.

http://clint.rutkas.com does that a bit. But it is horribly out of date and to be honest, I can't remember how to even update it anymore. I'd imagine inserting into a database and BAM, I'm done.

I'll bet initally everything will be done with a simple XML file that will be parsed out and with some javascript, cool thingies will happen. Maybe it will make me a peanut butter and jelly sandwich ... or bacon, meat of the gods.

Update: Help if i posted the domain. http://www.peacelovecode.com

I really need to stop betting. This is stupid. It worked ... but the comport isn't writing. I think I need to do a simple comport writer app.

orb

Think I got my orb code finally fixed. I love writing code without the hardware being there. Already lost 1 bet (had to buy lunch), lets see if I can get attempt 2 and win lunch. Who's up for the bet?

Now on to more cool projects. Need to see if I have permission to write about them.

Ok, when Mel was showing me around Microsoft, I mentioned I've read Rory's blog a bit and would like to met the guy. Rory works for Channel 9 / Microsoft.

After he showed me around, he interviewed me for Channel 9 on MSDN. It is about 17 minutes long and my favorite part honestly had to be people cracking up about my domain name better than everyone. That happens around 11:20 minutes into it.

Best of all, I'm on the main page.

Pictures can be found over at one of my other sites, pronerd, since they aren't really relevant to this site. It houses pictures of me / friends being ... well ... retarded. So here is the link to snowboarding pictures.

So recapping the event, I'm sore, I got a speeding ticket (Why must Wisconsin cops have IL drivers? Seriously, where is the love?), I ran into my coworker Knox who when with us, drove for 16 hours + hours, and found the best game ever, Run You Ragged.

I used the MapPoint 2006 with GPS and I have to say, it ruled. Drained my battery like no other, but at no point did we get lost. It was kind of fun to hear people say "You have 200 ft before you have to turn left" in the pitch black for getting to the lodge and magically in 200 feet, BAM, there was street.

Must snowboard again only to come back 100% sore again.

Picture recap.
Seriously, who thought this was a good idea?

Locking in

Mmmmm, negative 2 outside

Best game EVER

Off to Big Power Horn with my new copy of MapPoint 2006. Planning on doing GPS tracking tango and figuring out how to exactly get there. I'll have pics too.

So I'm not sure if I'm allowed to actually say exactly why I was in Seattle for five days, but I was. I built a 4x8 foot disco dance floor too while I was there. The hardware boards / LEDs / Breakout boards didn't come until 3pm on Wednesday. At this point in time, I had the floor built and the wires crimped / stripped. This was all I could actually do without more parts. So literally tracking down the FedEx van (package was suppose to be there at 8:30 AM), work started. I had some of the people over at Martini Design help out with the grunt work of wire cleanup, snipping LEDs, putting the LEDs into the breakout board, and running the crimped wires into the housing while I did the soldering.

One massive thing I realized about soldering for about 8 hours straight is that it sucks. The fumes really did get to me and I had a wicked headache that I would only wish on Andy. So as you see, 3pm + 8 hours = 11pm. Running the wires took another couple hours then final tweaking, verifying the software ran on their laptop, getting drivers for the Serial to USB, �⿦ next thing you know it is 3:30 AM.

Big flipping deal? Well, that is 12 hours of work after being up at 7 AM waiting for the boards. Still a 'quit your bitching'? My plane was wheels up at 8:30 AM which meant I had to be getting up at about 5:30 AM. See where this story is going? Yeah, I'm tired.

So as of right now, my laptop claims it is noon which still means another 2+ hours until landing.

NOW for the cool stories:

  • Tomorrow I head over to the upper peninsula of Michigan to go snowboarding.
  • I went to Redmond three times and chatted with some awesome people as seen in the two

  • previous posts.
  • I'm going to be on Microsoft's Channel 9 since Rory Blyth interviewed me for it.
  • Did you know that XNA was developed in 6 months from dream to finished product?
  • I pretty much built a dance floor ( I cheated in a few areas such as buying the boards prepopulated (thanks Mike over at Drop Out Design for rushing them) ) in 5 days.
  • My DDF software works with v3.1 firmware (this actually does surprise me since I thought there was a change in the protocol).
  • Attempting to flip a dance floor over (ran wiring radically different this time around) with glue that hasn't cured is a very bad idea.
  • Letting people that are high do wiring was interesting but not as bad as it could have been.
  • I dramatically under-ordered 1 part so much so that I only had 5 spares when I should have had about 50. I was glad I had that morning epiphany that I needed to only run 4 wires not 5 before I got into some serious deep trouble.
  • I can actually wake up with 2 hours of sleep after being up for almost 20+ hours and 12 hours of work.
  • SUPER HAPPY FUN TIME SPECTATULAR EXTREME PIRATE PHOTO HOUR GALLERY!
    So here are some of my pictures from Seattle. The rest can be found in the gallery via this link. ( I really need to start using my personal blog for some of this crap instead of better than everyone)






    So Mel Sampat (thanks once again for showing me around when people were there) showed me around the campus again today. SO ... I met Rory who seemed to be a tad to happy to meet me. Kind of freaked me out. However he was super nice and showed me around and I got to meet a ton of people including Jeff Sandquist. I met some people from G4 network and everything else got blurry.

    I think Rory's ego beats mine since he did end up on the front page of iTunes. However he did boost my ego by interviewing me for Channel 9. I'll post that when it goes live. I really need to stop giving thumbs up.

    I also got to meet Brian cross who built something called a WiMo bot.

    Pictures will be posted soon as I get back to my apartment in Chicago where my SD card reader is.

    So today I hit up Microsoft for lunch with Dan Fernandez. I ran into some Channel 9 people and chatted for a while. I'm bet I had a stupid look of happiness all the time while I was there. Metting up with Mel Sampat (who I did a consulting job for way back in the day) later on tonight. I have yet to meet Rory though.

    Good times. I have pictures, i'll post them later. I even have a movie of me doing something retarded (suprise suprise) at the vistor center. Now only if they let me buy a copy of Microsoft Bob ... that would have been sweeeet.

    I found out I'm suppose to have my laptop out AND take off my shoes to get into the airport. And I'm pretty sure me listening to the new Shin's album will not crash the air plane on take off or landing.

    With that said, Southwest did actually take off on time and got us to Seattle 10 minutes fast.

    I haven't even busted out my light jacket yet. I seriously should have brought shorts.

    Top is Seattle, bottom is Chicago.

    I'm going to Seattle til the 8th.

    Lets show the tempature for the next 7 days between Chicago and Seattle.

    Chicago

    Seattle

    HAHAHAHA ... suckers. Like that nice artic cold front I'll be missing? I like it.

    The difference between 25F and 15F is night and day for those warm weather people. Imagine spending time in your refridgerator (25F) or your freezer (15F). Yes both are below freezing, yes both are cold, but one is far worse. Walking is painful, breathing is painful, being out in it just sucks.

    But you see, I won't be in that crappy weather, I'll be in nice warm 50F. I should be packing shorts.