Mar 20 2008

Reviving the Veo Observer

Filed under: Daily Events, Programming

Recently I came across an old Veo Observer camera. I remember the Veo cameras as being refreshingly easy to use, and quite inexpensive for all the functionality you get.

This camera seemed to power up normally, and acquired an IP address as expected. However, when I logged on to the camera with a web browser, all it gave was a “404 Not Found” error. Also, when I tried to use the Veo Observer Studio software from the CD that supposedly came with the camera, the software said that there was a “Protocol Version Error.”

This led me to believe that someone may have tried to upgrade the firmware in the camera, and either disconnected before completing the upgrade, or loaded the wrong firmware. So all I had to do was find the correct firmware, as well as the correct utility for loading it onto the camera. This turned out to be a lot more difficult than I thought. The manufacturer (Veo) no longer exists, and all I could find on the Web were complaints from users who are just as SOL as I was. Fortunately, I stumbled on an obscure website that turned out to contain a repository of old device drivers, one of which happened to be the Veo Setup Utility and the Veo firmware. I was then able to load the firmware successfully, and then log on to the camera and see the video stream from it. I’ve decided to host the Veo Setup Utility and the latest firmware here on my website, in case someone else comes across the same problems.

During my search for Veo software, I also found that someone has written a clever Perl module for communicating with the camera (making it usable from virtually any OS), and another person has written Java code for it, too. This inspired me to make a quick-and-dirty C++ application based on the Perl code. My little program controls pretty much all the features of the Veo observer, and displays the image stream from the camera. Here’s the program and the source code for it.


Oct 29 2007

How to Save YouTube Videos

Filed under: Daily Events, Programming

Have you ever wanted to “save” a video from YouTube, so that you can play it back anytime you want, even when you’re not connected to the internet?

There are numerous programs out there that supposedly let you do this, but they all look very suspicious (as in spyware-ish), so I decided not to bother with any of them. Instead, I figured out a quick way of saving YouTube videos the manual way:

  • When your Internet browser views a web page, it stores most of the page’s content in a “cache” folder on your hard drive, so that the page loads faster the next time you go to it. This includes pictures, script files, and videos. So, technically, when you view a YouTube video, it’s already saved on your hard drive! The important step is to find the video in your cache folder.
  • If you’re using Internet Explorer, the cache folder should be located at “C:\Documents and Settings\yourname\Local Settings\Temporary Internet Files“, where yourname is your Windows login name.
    If you’re using Firefox, the cache folder should be located at “C:\Documents and Settings\yourname\Local Settings\Application Data\Mozilla\Firefox\Profiles\default\Cache“.
  • It’s a bit complicated to actually find the video you want in the cache folder, since neither Internet Explorer and Firefox give cached items proper file extensions. The best you can do here is sort the files by size, and look for files of a video-worthy size (several megabytes). Under Firefox, the files named _CACHE_nnn_ are special files, and not videos. A good method of doing this would be to clear your browser’s cache, then go to YouTube, view the video you want (and only that video), then go to the cache folder: the largest file in the cache should be the video. Now copy it out of the cache folder and rename it with a “.flv” extension, and you’ve got it!
  • Now, to play back the saved FLV files is the remaining road block. Windows Media Player will not play these videos; neither will QuickTime, or Real Player. The best solution I’ve found is to use FLV Player, which is a small standalone utility just for playing FLV files.

Oct 15 2007

Farewell, FileZilla

Filed under: Daily Events, Programming

What used to be a fast, efficient FTP client for Windows is now a lame, crippled FTP client for Windows and Linux.

I used FileZilla all the time to transfer files to and from my website(s). And, weighing in at just over 3MB, it was a compact program, considering the number of features it supported.

But the developers of FileZilla just had to mess with it. For “version 3.0″ of the program, they decided to completely rewrite it from the ground up, for the sole purpose of making the program “cross-platform.” And so we see yet another example of great software going astray.

The obvious point is that Linux already has plenty of FTP clients! Anyone who uses Linux already has a favorite FTP client, and would not be eagerly anticipating the release of FileZilla for Linux, making the entire effort marginally useful.

And for Windows users, the rewrite of FileZilla came at a devastating price. The package now weighs in at over 10MB (unacceptable for a simple FTP client), and its user interface is now painfully sluggish, not to mention buggy, and actually less feature-rich than before.

Is “software bloat” an inevitable destination in the lifetime of a program? Like a red-giant star that expands when it runs out of fuel, is all useful software destined to end up a bloated monstrosity?


Sep 18 2007

More Modding of the RAZR V3xx

Filed under: Daily Events, Programming

The quick-start guide that I gave two days ago is hereby out of date!

On another Motorola hacking website, modmymoto.com, I found a vastly superior program called P2KTools. This utility allows you to access absolutely everything the phone can possibly support. It even lets you switch communications between P2K, AT, and Flash mode.

Best of all, P2KTools doesn’t require PST Phone Programmer to operate. Apparently, PST is a proprietary Motorola application, and is illegal for distribution to the public. The good folks at hacktherazr.com fail to mention this clearly (naughty!).

When downloading P2KTools from modmymoto.com, make sure you get the latest version, which is 3.0.8 at this time. For some reason they have multiple earlier versions also available in their Downloads section. Are they trying to confuse people?

Once again, to communicate properly with the RAZR V3xx, go into the program’s Settings, and check the “P2K05″ check box under “P2K Settings.” As we learned earlier, the V3xx only supports the newer P2K05 command set, and will not work with the regular P2K commands.


Sep 16 2007

Modding the Motorola RAZR V3xx

Filed under: Daily Events, Programming

[Disclaimer: Modding your phone probably voids all kinds of warranties, and is not recommended for anyone.]

Update: I found a better program for RAZR hacking!

This is a quick-start guide for anyone who wants to start hacking away at the RAZR V3xx. For some reason, other guides that I’ve found on the web either don’t apply to this particular model, or often contradict themselves and drove me into further confusion.

I recently “upgraded” my cell phone to a V3xx, with AT&T as my provider. Naturally I wanted to see what kind of features I could access within the phone, and to what extent I could customize its skin, sounds and interface.

Here is the exact sequence of steps I took to get my phone connected to my PC and start modifying its filesystem:

  • Go to hacktherazr.com, which is a site with plenty of loosely-knit resources for hacking the RAZR. The only drawback of the site is that it doesn’t contain any information specific to the V3xx, and all of their “get-started” guides only pertain to earlier models.
  • From the site’s “Start here” guide (not from their “Downloads” section), download the Motorola USB Driver Installer, install the drivers, and follow the rest of the “Start here” guide.
  • From their “Downloads” section, download and install “PST 7.2.5,” which is a utility from Motorola to facilitate communication with your phone. Make sure you apply the “patch” included in the Zip file! Installing this tool will probably require you to restart your computer.
  • The last tool that you’ll need is called P2K Commander. But do not use the version that they have on their site — it’s outdated and will not communicate with the V3xx! To get the latest version of P2K Commander, go to the author’s website and download it from there. As of this writing, the latest version is 4.9.D. The author requires you to register in his forums to download the files, but registration is free.
  • To prepare your phone for communicating with your PC, you must set its USB mode to “data connection.” To do this, go to Main Menu → Settings → Connection → USB Settings, and set the Default Connection to “Data Connection.”
  • On your PC, launch the PST Phone Programmer before you plug in your phone! Let PST load completely before plugging in.
  • Now plug in your phone, and give your PC a few seconds to recognize it. Then give PST a few more seconds to configure the phone for communication. You should hear the phone’s “charging” sound two or three times as it’s being configured, as well as the PC’s USB plug/unplug sound.
  • Now you’re ready to launch P2K Commander, so launch it. P2K Commander is a gateway to the phone’s internal filesystem. But, before doing anything in this tool, click on its “Options” menu, and check the “Use P2k05″ check box! This is the critical step, since the V3xx uses the P2k05 command set, unlike its predecessors.
  • Finally, you’re ready to use P2K Commander to your heart’s content. From this point on, you’re welcome to follow the other guides outlined at hacktherazr.com, since most of them still apply.

Here is a very simple example of what could be done with P2K Commander and the RAZR V3xx:

Changing the secondary display image

When the phone is opened, its secondary display (the smaller display on the outside) only displays the AT&T logo. But suppose you wanted it to display something that was meaningful to you, such as this:
To change this graphic, use P2K Commander to navigate to the phone’s file system (”/a”) and go to the “mobile” directory.

In this directory, there is a file called cl.gif. That’s the file that gets displayed in the secondary display! This means that you can replace this file with whatever you want (as long as it’s called cl.gif), and it will be shown! Of course, keep in mind that this file must be a GIF file with dimensions of 96 x 80. Et voilà:
Short of reprogramming the phone’s firmware, there’s no end to the customizations you can make to your V3xx by simply editing or replacing certain files in the phone’s filesystem using P2K Commander. As always, don’t forget to back up any files you edit or replace. Enjoy!


Feb 01 2007

Mandelbrot Set in VB.NET

I finally downloaded the Express edition of Microsoft Visual Basic .NET, and started a long-overdue peek into the much-hyped .NET technology. Up till now, most of my code has been plain C++ with straight Windows API calls. I generally stay away from languages that remove the programmer from the underlying architecture. But I must say that programming .NET has been nothing but a pleasure so far, despite the cons of .NET programming, of which there’s also no shortage.

I was actually pretty surprised that the Express editions of all .NET languages (VB, C++, C#, and J#) are freely downloadable and, for all intents and purposes, fully functional.

My first stab at programming VB.NET is a simple Mandelbrot Set viewer:

Download the program! | Browse source code repository

Mandelbrot Set

The total time to get this program written was about 25 minutes, which says a lot about the possibilities for tremendous productivity using .NET, although this application hardly scratches the surface of .NET functionality…


Jan 24 2007

Hyperbolic Tessellations

A tessellation refers to a uniform tiling of a plane with polygons, such that an equal number of identical polygons meet at each vertex. For example, the tiles in a bathroom, the squares of linoleum on an office floor, or the honeycomb pattern in a bees’ nest are all tessellations of the Euclidean plane.

Hyperbolic TessellationHowever, tessellations are also possible on non-Euclidean spaces, such as the elliptic plane (like the stitching pattern on a soccer ball), and the hyperbolic plane (like… nothing you’d find around the house). In fact, the Euclidean plane has only three regular tessellations (with squares, hexagons, and triangles), while the hyperbolic plane can be tessellated in infinitely many ways.

Since we do not exist in hyperbolic space, we cannot truly “see” hyperbolic tessellations. We can only “represent” them in Euclidean form. A common way of doing this is on the Poincaré disk, which is a finite circle that represents the boundary of the (infinite) hyperbolic plane that is contained inside. The image on the right is a hyperbolic tessellation drawn on the Poincaré disk.

Since tessellations of the hyperbolic plane are especially interesting and mesmerizing to look at, I wrote a small program that generates them, with a great deal of configurable options.

Download the program! | Browse source code repository

Tessellation Application

Using the Program

The program allows you to create an unlimited number of tessellations by selecting “File -> New” from the menu.

When viewing a tessellation, click-and-drag inside of it to shift its position within hyperbolic space. You can also click-and drag with the right mouse button to manipulate the truncation of the tessellation.

Tessellation ControlsThe “Tessellation Controls” window allows you to change the settings for the tessellation that is currently active.

  • p and q — The numbers specified by p and q refer to the Schläfli symbol {p,q} of the tessellation. The Schläfli symbol is a simple way of classifying tessellations where p is the number of sides in each polygon, and q is the number of polygons that meet at each vertex.
  • Max. Vertices — This specifies the number of vertices that will be drawn (how far the tessellation will extend towards the disk boundary). More vertices will take exponentially longer to draw. Also, with more vertices, clicking-and-dragging the tessellation will become slower. With a good screen resolution, 10000 vertices fills up the Poincaré disk almost completely.
  • Model — Select “Poincaré” to draw the tessellation on a Poincaré-style disk, and “Klein” to draw on a Klein-style disk. The Klein disk is similar to the Poincaré disk, except the Klein disk transforms hyperbolic space so that a line between two points appears as a straight line, instead of a circle arc, which is what the Poincaré disk gives.
  • Quality — Select “Low” to display simple straight lines between vertices (and let the tessellation be drawn much faster). Select “High” to draw actual curved lines between vertices. This will slow down drawing considerably.
  • Truncation — This is a list of predefined levels of truncation for the tessellation. Select from this list to apply a certain truncation. You can also do free-form truncation by clicking-and-dragging on the tessellation with the right mouse button.
  • Colors — This allows you to select different colors for each of the components of the tessellation, and to enable or disable drawing of each component.
  • Driver — This selects what functions the program will use to draw the tessellation. Select “OpenGL” to use OpenGL technology, or “Windows GDI” to use plain Windows functions. In most cases, selecting OpenGL will enable the images to be drawn considerably faster, especially with Antialiasing enabled. However, OpenGL is not supported on some (very) old graphics cards. Also, if you create multiple tessellations, only one can be drawn with OpenGL at any given time.
  • Antialias lines — Check this box to draw “smooth” lines.
  • Line Thickness — This specifies the thickness (in pixels) of the lines that make up the tessellation.
  • Advanced — These options are mostly experimental and will not be discussed here.

Gallery

Here’s a brief collection of images created using this program. Click on an image to view a larger version.

{7,3} tessellations, with various truncation:
none, (0,1,0), (0,.5,.5), runcinated, omnitruncated, and snub.

No Truncation(0,1,0) Truncation(0,.5,.5) Truncationruncinatedomnitruncatedsnub

Links

  • This program borrows a substantial amount of code from Don Hatch’s page, which has an exhaustive gallery of {p,q} permutations and truncations, as well as a tessellation Java applet.
  • David E. Joyce’s tessellation page at Clark University.

Jan 05 2007

Ulam’s Prime Number Spiral

There is an infinite number of prime numbers, and yet the prime numbers themselves do not display any apparent pattern, nor does any formula exist that generates prime numbers. In fact, Legendre proved that there cannot be an algebraic function which always gives primes.

Prime SpiralHowever, prime numbers do exhibit a curious phenomenon when arranged in a spiral along with other consecutive integers, as in the figure to the right (in the figure, prime numbers are highlighted in white, twin primes are green, and Mersenne primes are red).

The Phenomenon

It was first noticed by the physicist Stanisław Ulam in 1963, when he got bored in a meeting and started doodling spirals of numbers. He noticed that, if he makes a spiral of consecutive integers, and circles only the prime numbers, strange diagonal “lines” of prime numbers emerge.

This is quite surprising, since we would intuitively expect a random distribution of prime numbers. However, these diagonal segments occur on an impressively large scale, and arbitrarily far from the center of the spiral. The following image is a spiral containing about 4000 primes, and next to it is the same image with some of the diagonal paths highlighted.
Prime Spiral

Application

Prime Spiral Application
To explore this phenomenon on a large scale, I wrote a small program that generates arbitrarily large spirals, with configurable coloring and other options.

Download the program! | Browse the source code repository

The program generates a spiral based on the total number of integers that you specify. It also allows you to specify the colors to use for the background, prime numbers, twin primes, and Mersenne primes.

In addition, the program allows you to use a custom polynomial (up to degree-2) for generating the spiral. By default, the polynomial is set to

f(n) = n

so the spiral will have the normal sequence 0, 1, 2, 3, etc. However, as an example, suppose you want the spiral to consist only of odd integers (1, 3, 5, 7, etc). You can simply set the polynomial to be

f(n) = 2n + 1

Odd Prime Spiral
by writing “2″ in the text box next to “n“, and “1″ in the last of the three text boxes. The image to the right shows a spiral constructed from odd integers only. Notice the prominent “patterns,” this time extending vertically and horizontally.

Conclusions

Ultimately, all that these patterns show is that certain polynomials are more “likely” to generate prime numbers than others. In fact, we can speculate that these kinds of patterns would emerge if we arrange the integers in any ordered design, not just a spiral. Even if we arrange the integers in a simple table, we would still see occasional “streaks” of prime numbers similar to the ones seen in the spiral.

The existence of “prime-generating” polynomials was known since the time of Euler, who discovered a polynomial that gives 40 consecutive prime numbers, namely

f(n) = n2 - n + 41

The reason why some polynomials generate more primes than others is still not known.

Extreme Spirals

Using my program, you can generate extremely large spirals, limited only by the amount of memory on your computer. Here are some fairly large ones that I generated:

Links


Feb 15 2006

Getting NTFS to Work in Linux

Filed under: Linux Notes

This is really not that difficult, but I thought I’d document it here for my own reference later on. First, download the kernel module RPM from the official linux-ntfs site. Install the RPM:

# su
# rpm -ivh kernel-module-ntfs*

Then load the kernel module:

# /sbin/modprobe ntfs

And that’s it. If you want to permanently mount an NTFS partition at a certain directory, add a line to /etc/fstab:

/dev/sda1 /home/username/mydir ntfs ro,umask=0222 0 0

It’s best to mount NTFS partitions as read-only, since NTFS support in Linux is still incomplete, and we don’t want to risk damaging the partition.


Feb 13 2006

Open-Source Tools for Everything

Filed under: Linux Notes

I thought I’d post a list of the best open-source utilities (at the present time) for performing various tasks. This isn’t necessarily a list of the “best” tools, but just tools that have worked the best for me.

  • OpenOffice.org - Word processing, spreadsheet, presentations, etc.
  • Firefox - Web browser.
  • Xine and/or MPlayer - Play DVDs and various video formats. (Linux only)
  • VideoLAN - Play videos, DVDs, and streams.
  • XMMS - Audio player (Linux only). Requires a special plugin to play MP3 and WMA files.
  • The GIMP - Drawing and image processing
  • The Paint.NET - Simple yet very powerful image editor.
  • dvd::rip - DVD ripping and transcoding (Linux only)
  • CDEx - CD ripping (Windows only)
  • Audacity - Audio track recorder and editor
  • VirtualDub - Video capture/processing utility
  • FileZilla - FTP client and server (Windows only)
  • WinMerge - File and directory compare (Windows only)
  • 7-Zip - Archive utility (Windows only)
  • gaim - Instant messaging client
  • Wireshark - Ethernet packet analyzer (formerly Ethereal)
  • Metasploit - Framework for testing exploits
  • HxD - Hex editor

Miscellaneous open-source (or otherwise free) things that are nice to have:


Older Articles »