Yearly Archives: 2008

Free Shrimp Ramen

August 1, 2008 » Life

A while back I posted a (sincere) offer for some shrimp ramen to anyone in the PKI building on craigslist. No one wanted them and I forgot about it. However, today I got this lovely email…

** CRAIGSLIST ADVISORY --- AVOID SCAMS BY DEALING LOCALLY
** Avoid:  wiring money, cross-border deals, work-at-home
** Beware: cashier checks, money orders, escrow, shipping
** More Info:  http://www.craigslist.org/about/scams.html

HELLO, gas is almost $4.00 a gallon!  Can't you just put those into a
food donation barrel next time you go to the grocery store or are 
you starving for attention that bad.

------------------------------------------------------------------
this message was remailed to you via: [email protected]
------------------------------------------------------------------

Do you suppose someone is just cruising around craigslist looking at month old listings for something to criticize? Dear Internet: You are weird.

Tags: ,

CameraBooth Monitor

July 14, 2008 » Geek

I’ve been working on CameraBooth some more and I separated out a launcher/monitor window for the application. You can load configurations then run them without having to use the command line. In that same vein you “should” be able to use it on multiple monitors now, so you can have your launcher on one screen and the booth window on another. I haven’t been able to test that for lack of having multiple monitors.

This is just a “preview” of what’s to come, right now it is super unstable. I don’t thread correctly, I just kind of hijack the glib main loop, so it’s a bit prone to crashes. I’ll fix that soon though. Until then here are some preview images of the new monitor screen.


Showing a failed booth window launch (didn’t plug in camera)


Showing the “live” monitor view. You can see what’s going on in the booth as well as monitor events like image captures.

libvcvideo Working

June 18, 2008 » Geek

I started yet another project a few weeks ago. This one, called libvcvideo, is intended to be a super simple way to access video devices, especially web cams. I’ve been writing it to replace the more feature rich, but heavier OpenCV in my other projects. Yesterday in class I got the first working product, so I made a flurry of refinements, added some documentation, and I’m now showing it off.

It’s nothing amazing yet, it only works in Linux on V4L devices that are web cams and use the RGB24 data format. That said, it’s still a lot of devices, especially from the spca5xx and gspca drivers.

I’ll be adding more to it over time, but here is some proof of concept items.

Here is a fullscreen shot of the library running my gtkmm test program. The library was compiled with it’s debug option which provides all that information in the terminal window.

One cool thing I added is a sigc++2 signal for measuring the progress of operations. Here I have it hooked up to my gtkmm test program showing where it is in the initialization process.

Here is the first image I captured with the library. If it looks a little off color, it is because I hadn’t corrected the byte ordering on the format yet, so blue and red are swapped. Yes, it is a boring first image, but the camera was under my desk and I didn’t want to offend the teacher by openly working on this during a macroeconomics lecture.

Here is about the most simple example possible. It safely creates, opens, initializes, and grabs a frame from the device “/dev/video0”.

#include 
using std::cerr;
using std::endl;
#include 
using std::string;

#include "lib/videoDevice.h"

int main (int argc, char ** argv) {
  vc::videoDevice device ("/dev/video0");
  vc::vdFrame frame;

  try {
    device.init();
  }
  catch(string s) {
    cerr << "Device initialization failed: " << s << endl;
    exit(1);
  }

  try {
    device.getFrame(frame);
  }
  catch(string s) {
    cout << "Failed to get frame: " << s << endl;
    exit(1);
  }
}

You can get more details on the project page.

Why I Love Kate

June 12, 2008 » Geek

First of all, no, I haven’t ditched my fiancĂ©e Darcy. I’m talking about the flexible powerful plain text editor that comes with KDE. I’m personally of the opinion that full blown IDE’s are way over rated. I used Anjuta for about 6 months at work, and it really didn’t impress me. My other issue is that I program in a bunch of languages. I tend to have projects going in 2 or 3 languages at once, and I haven’t found a consistent IDE that covers C++, PHP and JavaScript well at the same time. Don’t even say Eclipse, that thing is just ungainly.

So what to do? Well I ended up just going with the plain text editor of KDE, called Kate. Over time I’ve found some really great features that make this a flexible and powerful editor. These are just a few of them.

The Basics
The basics of configuring Kate are as powerful as any other “advanced” text editor. I trim down those fat tabs to being just two spaces wide, turn off wrapping and turn on the line numbering. Last I turn off automatic backups, because the tilde files are annoying and real men don’t program with nets ;-). This is not a complete list of the core features by far, just about everything is configurable.

Highlighting
Syntax highlighting in Kate is very good, and handles oodles of languages. Plus it’s colors are configurable by an easy interface. You probably won’t change them though, as they are fairly consistent between languages, so variables will still look like variables even when you switch languages.

Bookmarks
This is one I didn’t find until recently, but you can bookmark locations in files and jump there real quick. The shortcut it CTRL-B, and I usually use it when I’m working somewhere and need to reference some other code. I bookmark my spot then scroll away to the code I need to look at. Getting back is easy through the bookmarks menu, or if you are above it you can use the shortcut ALT-Page Down or if you are below it, ALT-Page Up.


A Bookmarked Line

The Bookmarks Menu

Sidebar
The sidebar is a powerful part of Kate. There are many plug-ins which can take advantage of the sidebar (which can actually be any combination of left, right, top or bottom bars). The ones I use are the C++ symbol viewer, the file list and the file chooser. The symbol viewer is handy for jumping around your files in C++, I use it a lot along with the bookmarks to check on code quickly. The file chooser is pretty standard, with a list view that includes icons for checking file type. Last is the file list. All your open files are in here. Two short cuts you will want to know are ALT-(Left Arrow) and ALT-(Right Arrow) which will scroll you through the file list. This is very handy for switching between files without leaving the keyboard. The file list is also “heat mapped” with colors on the last files you’ve been in. When closing a file (CTRL-W) you jump to the last file you were in.


The Symbol Viewer

The File Chooser

Sessions
Kate stores all of its setting in sessions, which you can name and arrange as you wish. This is handy as is, but there is integration with a KDE menu bar widget that makes them even better. This KDE sessions menu is great for jumping straight into projects and picking up right where you left off.


The Kate Session Menu

Useful Dialogs
There are several useful tool dialogs in Kate too. The first one is the GoTo dialog, invoked with CTRL-G. This is great for jumping to lines when fixing compile errors or debugging. The other handy one is Find and Replace. There are flexible regular expressions built in, with place holders for the replace dialog. I use this a lot when creating setters and getter for my methods. A few slick regex’s and they are all written.


The GoTo Dialog

The Replace Dialog

Auto-Complete
The last feature is the helpful auto-complete. It’s not terribly intelligent, it won’t track down things by symbols and types, but it does the job and when it kick in is configurable, I have it set so after I type 3 characters it pops up suggestions.

I hope that this quick overview of Kate is helpful to someone, I just wanted to share my love for it. Good luck with your endeavors!

Javascript Countdown Timer

May 20, 2008 » Geek

I wrote a little countdown timer for my wedding while waiting for stuff to compile today. It uses PHP to get itself initialized, and should be accurate as long as the server has the correct date set. Below is the basic guts of the script. You would call refreshClock() onload.


now_j = new Date();
diff = Math.ceil(now_j.valueOf()/1000) - now_p;
function refreshClock () {
  now_r = new Date();
  seconds = end - Math.ceil(now_r.valueOf()/1000) + diff;
  document.getElementById('days').innerHTML = Math.floor(seconds/60/60/24);
  document.getElementById('hours').innerHTML = Math.floor((seconds/60/60)%24);
  document.getElementById('minutes').innerHTML = Math.floor((seconds/60)%60);
  document.getElementById('seconds').innerHTML = seconds%60;
  setTimeout("refreshClock()",1000);
}