Everything about my daily life as a programmer/Electrical Engineer!

Running Asp.Net without a webserver

If you ever need to generate web pages that are static (for reporting etc) you often find yourself emitting html. Turns out Asp.Net is perfectly suited to do this.

class Program
{
static void Main(string[] args)
{
Page pg = new Page();
Label lbl = new Label();
pg.Controls.Add(lbl);
lbl.Text = "Look ma no web server";
StringWriter sw=new StringWriter();
HtmlTextWriter tw = new HtmlTextWriter(sw);
pg.RenderControl(tw);
Console.Write(sw.ToString());
}
}


All thats left is to either save the file or embed the file in the embedded ie window. You can leverage all the cool controls of asp.net but be sure to remember that there is no way this can postback.

Getting printf to work in avr-gcc \ winavr

Printf wiring in avr-gcc is fairly easy. First, make sure you add libm.a and printf_flt.a in avrstudio. See project options for help on this. Otherwise the lines below will get you started.

int main(void)
{

Init(); //init the system
fdevopen(&sys_putchar,NULL);//wire in stdout to sys_putchar
return 0;
}

//simple function that receive chars from stdout
int sys_putchar(char val,FILE* fle)
{
//write out to the LCD for now
LCD_putchar(val);
//Put code here to pump a char to the uart port!
//TODO: uart_putchar
return 0;
}


Let me know if this doenst work! I wish I would have known about this earlier!

Hacking Gateways WinPE install disks

So if you hate bloatware on your gateway install disk you've probably done some crazy things to avoid it. I have tried slipstreaming a new xp install with disastrous consequences. My work around and this is awesome..... After gateway copies all the files to your computer it will boot in as a hidden user and show a screen telling you that its running scripts to setup your system. Wait until it has installed your drivers then... ctrl+alt+del and kill the install process. WinPE will shutdown your system and boot you back into windows. Its that easy to avoid bloat ware!

System:
Gateway CX210X

Once done with this I image my machine using the "System Rescue CD" and use PARTIMAGE to image the HD.

The best setup i have found:
  • Get windows running.
  • Split your HDD into two parts (OS,FILES) using gparted on the "System Rescue CD"
  • Make sure your profile is on the FILES drive. (This is a bit tricky).
  • Image the OS drive using PARTIMAGE and a USB Harddrive.
  • Use Microsoft Sync Toy to sync your files with a server (who needs icremental backups?

Why linux hates my tablet

So with all the buzz about Virtual Box's seamless integration I decided to give windows the boot as my desktop enviroment.
http://ubuntuforums.org/showthread.php?t=584111

What I found... My gateway CX210X does not play well with ubuntu. I had to compile drivers for the pen and it still doesnt work that well. Not only that but there is no way to rotate the screen. Everything else has worked well but its going to be sometime before I go down that route again.

I love ubuntu, hate windows but love my tablet even more than anything!

Dive into robotics

I have been taking a robotics class and have fallen in love with robotics. I am currently planning on teaching a robotic class for High School Students this summer. I will follow up with more information about what I am playing with for this class:

Explored:
Beetle Bot (6 direction with use of H bridges)
Hex Bug (2 direction)
RC car bot (6 direction but H bridges come for free!)

It turns out RC car bot is the cheapest at $5.77 from walmart who can beat that! I'm planning on using Atmel MicroP's in the class with the AVRUBD firmware. My goal is to build simple line following robots for <$15 a piece.