« Back to home

Advanced SQL Injection

Ok, here’s a great blog post by Chris Shiflett about a crazy-creative SQL injection technique: http://shiflett.org/blog/2006/jan/addslashes-versus-mysql-real-escape-string

Very cool.  His technique relies on tricking addslashes into breaking up a two byte character with a slash, creating a valid two byte character followed by a valid one byte character.  He mentions that this (specific attack) is impossible with UTF-8 because all two (or more) byte characters have continuation bytes that start with 0b10.  Hrm.

Read more »

"Yoda" Conditions

Here’s a creative idea I’d never considered before.  I’ve written code like this, but accidentally, and then it looks wrong so I change it back.  Here’s a quick example:

if ( 42 == myInt )  as opposed to  if ( myInt == 42 )

The former may be better to use because occasionally we all forget to put that second “=” in there, and we accidentally turn our comparison operator into an assignment operator.  Compilers will complain if you try to assign a value to “42”, but not if you try to assign 42 to a variable, and that’ll make it easier to catch your mistake.

Read more »

LCD Modules

I’ve never built anything with an LCD on it before, but it seems like it’d be useful.  Here’s some good info on creating an project with an LCD and an Arduino:

http://arduino.cc/en/Reference/LiquidCrystal

It’s a library of functions that make it very easy to work with the LCD controller.  The controller has to be compatible with the HD44780 controller’s instruction set, but that’s basically an industry standard.  Mouser has a selection of 20x4 character displays:

Read more »

MinGW and Cygwin to build a Windows DLL

I was writing C++ in Linux - gvim + aterm is my development environment of choice.  I needed to turn my code into a Windows DLL, though, and the following webpage was really helpful.

http://www.mingw.org/wiki/sampleDLL

I installed Cygwin in a Windows XP virtual machine, used Cygwin to install MinGW, modded my code and Makefile a bit based on the samples on that page, then ran “make windows” in that virtual machine.  Everything built great and let me put my code into LabView on a computer which didn’t have Cygwin libraries.  Job done.  Thanks MinGW and Cygwin.

Read more »

Geotagging Photos

Posted on

Well, I’m disappointed by the way Picasa handles geotagging photos in Linux. It looks like the newest version doesn’t support geotagging. Not only that, but when it resizes images to upload to Picasa on the web, it kills any EXIF information that may have specified a location. What the heck Picasa? Why you gotta clobber my shit?

I can preserve the geotags by uploading directly from my G1 (slow), or by going to the Picasa website and uploading from there (can’t do a batch upload, also can’t resize automatically).

Read more »

Current Chili Recipe

Posted on

Here’s my current chili recipe. This one is going to be awesome when it’s all done. It’s good enough right now that I have a hard time sticking to my plan to make it awesome without the spiciness, then add the spicy in later. The last few times I’ve made it I’ve added in the peppers… Shame on me. It’s just too tasty to resist.

1 can bush kidney beans 1/2 can bush pinto beans 1 lb browned ground beef 1 can hunts diced tomatoes 1.5 tbsp chili powder - I’ve been using McCormick’s 1 tsp Mexican oregano 1 tsp garlic powder 1 red bell pepper, minced 1/2 red onion, minced 4 jalapeños, minced 8 serrano peppers, minced

Read more »