Author Archive

ESN Conversion

Wednesday, January 13th, 2010

Today, our Sprint Liaison passed a spreadsheet with 100+ decimal ESN numbers matched to our phone numbers. Our cards report ESN numbers in Hex. Turns out there’s a smidgen of knowledge needed to switching between the two.

Then you get something like this.

perl -nE 'say hex( substr($_, 0, 2) ) . hex( substr($_, 2) );'

perl -nE 'say uc(sprintf("%x%x", substr($_, 0, 3), substr($_, 3 ) ));'

Happy Coding.

Lojack my macbook

Sunday, January 25th, 2009

I just got a macbook. The first Macintosh I have owned since my LC III. I decided that I wanted to track where I have been and roughly how long I was online at each place. If for some reason I misplace my mac, I would love to have a way to track it’s last online location. Nothing Fancy.

So I thought up a simple solution to my dilema. Query a web site I have log access to. I used wget to query my homepage, with a little bash magic to generate a useful query string. The “local” time, and IP address of my macbook.

With a little log sifting and a charting module, I can show all kinds of neat statistics.

Taking a Screen Shot in .NET

Wednesday, February 20th, 2008

:-D

Hello to whoever is reading this. I hope your having a good day.

The other day I was thinking about writing a screen shot program for that windowed operating system. And being the bored semi-productive person that I am; I set out to make it a reality. My next thought(not literally) was .NET must have a built in function for this. :-D Lucky for me they did. The function is CopyFromScreen(int SourceX, int SourceY, int DestX, int DestY, size SquareSize) .

Here is a link to Microsoft’s information about the function.

Sadly my journey to that information took 2 hours. Partly because I didn’t know exactly what I was searching for. I started by looking for “capture screen shot using .NET”. This brought up a lot of links, and some even had solutions. To bad for me that I didn’t like them(lol at saving time).

  • The majority of the solutions suggested using a keyboard event to send a print screen key press to the system. Then copy the contents of the system clipboard into the program. This feels like rapid development to me. Or maybe a quick hack to be fixed later. :-S
  • Another Solution I saw said to do a complicated device initiate and copy function.
  • There apearntly is another way. My coworker informed me of it, but I have forgotten what he said(me - sleep = forgetful).

I mentioned that the first solution seemed too much like a hack. Also if I only want portions of the screen I would have to do image editing and/or other stuff. Seeing as I don’t do much winshield programming let alone .NET I searched until I found the way I thought was proper. At some point in the future I will post my program up on my site, … and … maybe the code.