September 2007 Entries

383-theitcrowd[1]I've been having a horrid month with hardware.  For what happened and why I didn't think of how to solve this, I'll deduct 50 nerd points from myself.  This is something I should have been able to solve myself.

SO yes, I did have my laptop on, plugged in, but it wouldn't turn on, it would just beep at me.  I had my new RAM in it for a few days too and it worked great.  Better than great actually.  But all of a sudden, it just stopped working for no reason that I could tell.

Mike, the IT guy in my building quickly realized it after he got back from vacation.  The problem was I called MS tech support since he was on vacation so a new system board was ordered.  All that happened was my RAM became unseated (not plugged in correctly).  So in the future, if your laptop starts beeping at you after you installed new ram, see if it became unseated.

installingRam

how do the commercials tie into the game damn it.

Plus the ending? I seriously had to miss something.

2 Days before the Halo 3 launch and this?   COME ON.

godHatesMe

This isn't even funny.  I've already sent you for repairs once.  I wasn't even pushing you, I was watching Boston Legal.

What is even worse is I was at Best Buy and the Circuit City yesterday and they were sold out of 360's.  If there is a god, that god seriously hates me.

Here is my Ambient Orb wrapper code as it is.  It isn't complete but it can do some.  Most of this was written on an airplane without being tested.  Sorry but without a physical working orb, it is just asking for trouble.  People will say, "wtf, this isn't working properly" and I'll look at the code and I'll tweak it and then they'll still say it doesn't work and since I can't test it properly, I'm going to release broken code and hope someone else will pick up where I left off due to hardware failure.

My Ambient Orb c# wrapper code.

orb

So I've been attempting to get my orb wrapper done and I finally busted out my orb after I moved.  When altering values, I noticed it was 'acting up' and it and figured I just wasn't doing something properly so I popped open the Java app the ambient company gives out and got the same result.  This is the orb at full power, it is PGB, Pink Green Blue.  Pink is not Red.  I demand Red.  I should be able to make it Pink by lowering the power, not maxing it out.  The orb now has a new function I think as an expensive paper weight.

What the hell.  I can't finish my c# wrapper now!  This was going to be a great demo tool for presentations I was going to give.  DAMN YOU MOVING COMPANY!!!

And since I know Konkol will mock me since that is his M.O., I'll beat him to the punch ... "Wah wah"

I think I may need to upgrade to an Optimus Mini Three Keyboard.

clintAndDadOnSegways480<email_from_my_dad>

Yo WTF is AJAX?

Your Ol'Fart Dad.

</email_from_my_dad>

This is what happens when your dad reads your blog that is more on the technical end of things (I do however enjoy making fun of him so his email was posted).

So I made a bad assumption that everyone knows what Ajax is.  Ajax is both household cleaner and a way to make asynchronous calls to a web server without causing your webpage to post back to your server.  Jesse James Garrett has an awesome diagram showing this concept.  It also instantly makes anything you do look really awesome and neat.

So why isn't everything Ajax'ed if it is so eff'in neat?  Cause it is a pain to create, the site still needs a backup if the browser can't support it, and the developer coding needs to know JavaScript (which seems to be way harder to find than I thought).

For the past few days I've been creating a PowerPoint deck on ASP.Net Ajax and seeing how it would make my life easier if I were to use that instead of one of the 50 other frameworks or just by hand.  Now, one should know, I've been doing the "by hand" way for a year now and have grown to like it since it has some raw power.

My opinion shifted however when I did a line count on a pretty simple task.  And that task didn't even include failure code!  Basically with the .Net way of doing Ajax, I had to write 1 line of code.  1 line.  No need to parse the XML properly or if I'm transversing the DOM tree properly.  It just works.

Now I haven't pushed the boundaries of ASP.Net Ajax to where some of the stuff I've done in the past, but with the toolkit they have on CodePlex, I'm fairly sure I have nothing to worry about.  MS provides some feature rich controls with their source code so people can see how to build some truly great web sites.

For my deck, I was going to do some Ajax with some hardware devices (my relay boards and ambient orb) but without a good webcam to show this example over the Internet for this presentation, it is semi pointless.  When I have more time, I'll work this demo into the presentation.  I'll end up posting this presentation too I believe on BTE so then my ol' fart dad can become educated on the wonders of Web 2.0.

Girls are far smarter than me.  So I've been spending time on my Ajax presentation and to fit code on a slide, I had alter it and slim it down to reduce white space.  It makes it a less readable but I'm able to fit everything at a decent font size on the screen.

Me, being the wonderfully developer I am, just altered and moved on.  I actually committed two bad acts of development.  Code late at night while being tired, and not testing.

This is what I had.

<snip>

if( xmlRequest == null )
   alert( "could not create request" ); return;

</snip>

Can anyone spot the problem?  I couldn't either for a solid 5 minutes since I knew this code worked yesterday afternoon.  I clicked the link, and nothing happened.  "Hulk Angry Powers" started to activate.

Due to indenting, this is how the actually ran

<snip>

if( xmlRequest == null )
   alert( "could not create request" );

return;

</snip>

The code should have read

<snip>

if( xmlRequest == null )
{ alert( "could not create request" ); return; }

</snip>

ajax[1] So things have been a tad crazy lately.  I'm gearing up a presentation on ASP.Net Ajax for myself to give to students and after just a few seconds of playing with it, I realized how much simpler things are with ASP.Net Ajax.  I'm still at the skin level with it and am wondering about some of the dynamic stuff I can do with it. 

A traditional, super basic Ajax call I would do would take about 75 lines of code from start to finish.  That includes C#, JS, and HTML code.

The same function but done in ASP.Net Ajax with the HTML code structured exactly the same is 13 lines of code.  And 12 of those lines are from the HTML.  Yup, 1 line for the Ajax call is all I had to write.

Toys

So I have some new items I've gotten and attempting to play with them and finally get stuff wrapped up with multiple projects before I go crazy with new projects.  I want to wrap up my Ambient Orb wrapper, drunktender with the new relay boards, and do an article for each at Coding4Fun.  I have oddly enough most of each article completed too.

Now I have 4 iPAQ phones and am wondering what trouble I can use these for.

Events I'm doing

Halo 3 Events I'm putting on (or helping out at or maybe just showing up to)

Sept 24th - Minneapolis, MN

Sept 26th - Washington University, MO

Sept 27th - University of Missouri - STL, MO

Sept 29th - DePaul University (Chicago REPRESENT!) - IL

October 1-4th - Stuff in Arizona, I believe ASU at a min

October 5th - University of Iowa, IA

October 12th - Missouri State, MO

 So I've been at Microsoft event for the past few days at the YMCA Ozark area doing team building stuff.  I found out my strengths line up pretty much with what I thought.  I also learned I'm an Activator, which means I'm impatient and want to do stuff now, or as I like to put it, have it done yesterday.

This is my award I earned with pride:

clintandnature

Before it was bandana wearing for the constantly changing the style.

Few people have made references to my new apartment and since I pretty much finally moved all my stuff in or threw it away, here are some pictures. Even though I now live in the most dangerous city in the United States, note how I live on the edge and use my roomba as my attack dog. Seriously, I'm going to make it bark and attack.

My living room which will soon rock some Halo 3 and Chicago Bears season

My new vacuum, my roomba 560, I highly recommend it after 2 uses.

A few of the toys on my wall, i crave more

My blank hallway

My 2nd bathroom, I have 2. As you note, the seat is proudly up.

My books

Kitchen with a half eaten pizza

Partly disassembled Drunktender, don't worry, he'll be rebuilt harder, better, faster, stronger

The view from my balcony in my kitchen

The ever so popular bedroom, it has well commented CSS at times.


Video: Relay Board Test for my automated beverage system

YouTube link - MSN SoapBox link

Why do code on a long weekend? Because I haven't done much coding in the past month and it makes me feel happy. Time to brush off some of that rust. Plus these relay boards that Robotics Connection help make were just sitting idle with no LEDs to turn on and off randomly.

So how to make them tick?
Here is some code from my WinForm which is pretty basic yet, still haven't added in all the diagnostic code I want to.

   1:  using (RoboticsConnection rc = new
RoboticsConnection(18, 1, false))
   2:  {
   3:      int totalAmount = 8;
   4:      int boardNumber = (int)numCycleBoard.Value;
   5:   
   6:      RoboticsConnection.RelayBoardPourCommand[] commands =
new RoboticsConnection.RelayBoardPourCommand[totalAmount];
   7:   
   8:      for (int i = 0; i < totalAmount; i++)
   9:      {
  10:          commands[i].BoardNumber = boardNumber;
  11:          commands[i].RelayNumber = i + 1;
  12:          commands[i].Milliseconds = 100;
  13:      }
  14:   
  15:      rc.PourDrinks(commands);
  16:  }

And here is the code from the actual Relayboard object that does all that voodoo.

   1:  public class RoboticsConnection : IDisposable
   2:  {
   3:      //ComPortIO ComPort;
   4:      SerialPort comport;
   5:      ArrayList relayBoards;
   6:      Thread pourThread;
   7:   
   8:      private const string returnLine = "r";
   9:   
  10:   
  11:      private const string pour = "pour";
  12:      private const string pourFormat = " {0}:{1}:{2}";
  13:   
  14:      private const string ack = "ACK" + returnLine;
  15:      private const string firmwareVersion = "fw" + returnLine;
  16:      private const string reset = "reset" + returnLine;
  17:   
  18:      public delegate void DrinkCompleteEventHandler
(object sender, EventArgs e);
  19:      public event DrinkCompleteEventHandler DrinkCompleted;
  20:   
  21:      public void Dispose()
  22:      {
  23:          //ComPort.Dispose();
  24:          if (comport.IsOpen)
  25:              comport.Close();
  26:      }
  27:   
  28:      public RoboticsConnection(int ComPortNumber, int MasterBoardNumber,
bool DisableComWriting, params int[] AdditionalBoardsNumbers)
  29:      {
  30:          //ComPort = new ComPortIO("COM" + ComPortNumber, DisableComWriting);
  31:   
  32:          comport = new
SerialPort("COM" + ComPortNumber, 19200, Parity.None, 8, StopBits.One);
  33:          comport.Open();
  34:   
  35:          relayBoards = new ArrayList();
  36:          relayBoards.Add(MasterBoardNumber);
  37:          for (int i = 0; i < AdditionalBoardsNumbers.Length; i++)
  38:          {
  39:              if (relayBoards.Contains(AdditionalBoardsNumbers[i]))
  40:                  throw new ArgumentException(string.Format(
"Duplicate RelayBoard Detected.  Value: {0} has already been initialized", AdditionalBoardsNumbers[i]), "AdditionalBoardsNumbers");
  41:   
  42:              relayBoards.Add(AdditionalBoardsNumbers[i]);
  43:          }
  44:      }
  45:   
  46:      public string GetFirmwareVersion()
  47:      {
  48:          comport.Write(firmwareVersion);
  49:          return comport.ReadLine();
  50:      }
  51:   
  52:      public void ResetBoards()
  53:      {
  54:          comport.Write(reset);
  55:      }
  56:   
  57:      public void PourDrinks(params RelayBoardPourCommand[] Commands)
  58:      {
  59:          StringBuilder sb = new StringBuilder(pour);
  60:   
  61:          foreach (RelayBoardPourCommand command in Commands)
  62:          {
  63:              sb.AppendFormat(
pourFormat, command.BoardNumber, command.RelayNumber, command.Milliseconds);
  64:          }
  65:   
  66:          sb.Append(returnLine);
  67:  //            ComPort.ComPort.DataReceived += dataReceivedEventHandler;
  68:          comport.Write(sb.ToString());
  69:      }
  70:   
  71:      private void dataReceivedEventHandler(object sender, SerialDataReceivedEventArgs e)
  72:      {
  73:          if (comport.ReadLine() == ack && DrinkCompleted != null)
  74:          {
  75:              DrinkCompleted(this, null);
  76:          }
  77:   
  78:          comport.DataReceived -= dataReceivedEventHandler;
  79:      }
  80:   
  81:      public struct RelayBoardPourCommand
  82:      {
  83:          public int BoardNumber;
  84:   
  85:          /// <summary>
  86:          /// The amount of time in milliseconds that the relayboard should fire
  87:          /// </summary>
  88:          public int Milliseconds
  89:          {
  90:              get { return _milliseconds; }
  91:              set
  92:              {
  93:                  if (value < 0)
  94:                      throw new ArgumentOutOfRangeException(
"Milliseconds", value,
"Value must be greater than zero");
  95:   
  96:                  _milliseconds = value;
  97:              }
  98:          }
  99:          private int _milliseconds;
 100:   
 101:          /// <summary>
 102:          /// Which relay on the board should be fired, a value between 1 and 8
 103:          /// </summary>
 104:          public int RelayNumber
 105:          {
 106:              get { return _relayNumber; }
 107:              set
 108:              {
 109:                  if (value < 1 || value > 8)
 110:                      throw new ArgumentOutOfRangeException(
"RelayNumber", value,
"Value must be between 1 and 8");
 111:   
 112:                  _relayNumber = value;
 113:              }
 114:          }
 115:          private int _relayNumber;
 116:      }
 117:  }