Skip to main content

Posts

Showing posts from December, 2008

Getting started with the CMUCam3

One of the toys I got this Christmas is the very nifty CMUCam3 . I haven't done much with it yet (the first picture I took with it is below). But, I did hit a small bump in the instructions for setting it up under Linux. The CMUCam3 Linux Quick Start Guide (overall, quite good) suggests downloading the Linux ARM-gcc compiler from the CMUCam downloads page. However, the link you'll find there has you download an installer binary instead of the bzip package referenced later in the instructions. In the CMUCam3 source directory, however, you'll find that BUILDING.txt provides a link to the CodeSourcery download page . From there you can find the bzip packaged version of the toolchain. I recommend that route instead. Update Be sure to download the EABI target OS version.
Read more

Python on Android

Note: This post is out of date. If you'd like to run Python on your Android device, please see my Android Scripting Environment project. Here's an early Christmas present for all those Python fanatics (self included) out there! With a lot of help from my friends (thanks Manuel and Thomas !) I managed to install Python 2.4.5 on my G1. It's still rough around the edges, but I think it's a good start. Klaus Reimer has a nice overview of how to cross-compile Python . My instructions borrow a lot from his. Download and build the Android source . These directions assume that you have installed the source to /android_src . Download and build the Python 2.4.5 source . These directions assume that you have installed the source to /python_src . Make copies of python and pgen for use later in the build process then clean up. $ cd /python_src $ cp python hostpython $ cp Parser/pgen Parser/hostpgen $ make distclean Apply the following patch to the Python source. diff -r -c -b P
Read more

Lua on Android

Note: This post is out of date. If you'd like to run Lua on your Android device, please see my Android Scripting Environment project. After messing around for two days trying to get Python running on Android, I decided to give Lua a try. It didn't take much to get the interpreter running (especially compared to Python which still isn't running for me). Here's a very small patch for Lua 5.1.4 . diff -r lua-5.1.4/src/llex.c lua-5.1.4-android/src/llex.c 179c179 < struct lconv *cv = localeconv(); --- > //struct lconv *cv = localeconv(); 181c181 < ls->decpoint = (cv ? cv->decimal_point[0] : '.'); --- > ls->decpoint = '.';//(cv ? cv->decimal_point[0] : '.'); 461d460 < diff -r lua-5.1.4/src/lvm.c lua-5.1.4-android/src/lvm.c 205c205 < int temp = strcoll(l, r); --- > int temp = strcmp(l, r);//strcoll(l, r); 763d762 < You'll also need get the Android source and build it. Then grab agcc (a small Pe
Read more

Plant Monitor

Tonight I threw together a quick plant monitor. I followed the directions for the Botanicalls Twitter DIY to build a moisture detection circuit (I used a 2N3904 transistor). It works pretty well. I found that the analog readings tend to be quite high and do not vary much (450 for dry soil, 545 for moist soil, 555 for a glass of water). I think these variables probably need to be adjusted to match individual conditions. The plan is to move this quick and dirty Arduino prototype to an ATtiny13 with wireless data transfer and solar power. Using the tiny13, I should be able to monitor 3 plants (without disabling the reset pin). Here's my Arduino code and pictures. int PROBE_PIN = 5; void setup() { Serial.begin(9600); } void loop() { int val = analogRead(PROBE_PIN); delay(1000); Serial.println(val); }
Read more

Email Injection

Not so long ago, I ran a wiki called SecurePHP. On that wiki, there was one particular article about email injection that received a lot of attention. Naturally, with all the attention came lots of spam. As a result, I disabled editing of the wiki and content stagnated. Still, the email injection article remained popular. About a year later, the server that hosted SecurePHP died and I never had a chance to hook it all back up. I saved the article though and I'm reposting it now. It may be a bit old (I've been away from PHP for a long time), and I didn't write all of it, so feel free to leave comments about needed updates and corrections. Though this article focuses on PHP, it provides a lot of general information regarding email injection attacks. The PHP mail() Function There are a lot of ways to send anonymous emails, some use it to mass mail, some use it to spoof identity, and some (a few) use it to send email anonymously. Usually a web mailform using the mail() funct
Read more

JavaScript Painting with Canvas

I spent some time today messing with JavaScript canvas stuff. Here's a simple paint snippet. Enjoy. <head> <script> function draw() { var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); ctx.fillStyle = "black"; ctx.beginPath(); var x; var y; canvas.onmousedown = function(e) { x = e.clientX; y = e.clientY; ctx.moveTo(x, y); } canvas.onmouseup = function(e) { x = null; y = null; } canvas.onmousemove = function(e) { if (x == null || y == null) { return; } x = e.clientX; y = e.clientY; x -= canvas.offsetLeft; y -= canvas.offsetTop; ctx.lineTo(x, y); ctx.stroke(); ctx.moveTo(x, y); } }; </script> </head> <body onload="draw();"> <canvas id="canvas" width="300" h
Read more

Ubuntu Ibex Wireless and RT61PCI

Ever since I upgraded to Ubuntu Ibex, my wireless has stopped working. Network Manager was able to scan and display available networks, but couldn't connect. I waited a while to see if a patch might fix it, but none did. I got it working again tonight. My solution involves removing Network Manager (which isn't a problem for me since I'm doing this on my desktop). Basically, I followed some directions from the Ubuntu Forums . However, I've made some small changes and added some instructions where I felt there were gaps. Disable and remove Network Manager. sudo killall NetworkManager sudo apt-get remove network-manager Remove the rt61pci module and blacklist it to prevent it from loading in the future. sudo modprobe -r rt61pci echo 'blacklist rt61pci' | sudo tee -a \ /etc/modprobe.d/blacklist Download the serialmonkey rt61 legacy CVS tarball and install it. tar zxvf rt61-cvs-daily.tar.gz cd rt61-cvs*/Module make sudo cp rt61.ko \ /lib/modules/`uname -r`/kern
Read more