Programming concepts and ideas in convienant discussion and code snippets.

Snow on the ground, cold in the air, music all around. It’s Christmas time and with the season brings Tuba Christmas again. After a decade of rest for my lungs, it’s been nice getting the rusty brass behemoth to sound good.

At times, I have fun creating devices. The similarity to programming amazes me and the ability to be able interact with the physical world is a lot of fun. I took my standard game, a tank that moves side to side and shoots objects from the sky (think Space Invaders). Here’s the shopping list.

So for a relatively small amount of shopping, you have the ability to make an interactive game. The wiring basically merges basic wiring for the tactile switch, standard input for triple axis acelerometer, and

So, working to get away from WX as my main GUI source and using GTK as I’ve been an Ubnutu, then Mint user with Gnome for years. Building windows in Glade3 was not too bad and the rapid prototyping with Python makes it a great tool. Sadly, the documentation for PyGTK 3 does not exist. There are differences yet the examples that are found are all for PyGTK 2. Don’t believe me? Try finding information on drawing to a window. Most notable difference is the use of Cairo instead of GDK but it just starts there. Anyhow, just venting on what should be a great set up which is made difficult by the lack of documentation.

Okay, I realize that I have not posted anything new to this blog in about 6 months. For those of you who are not new to this blog, I apologize. It’s been a very busy year. I have picked up a command position for a large company and this has taken most of my time. And, it’s been a busy year for my civilian job as a corrections officer. Between those things, this blog has been pushed behind. But, there are many projects I’m working on so I wanted to post a message saying:

Just a fun fact. Apparently, from The Beatle’s White Album, the song Martha My Dear is inspired Paul McCartney’s Old English Sheepdog. named Martha. As a sheepdog owner, these dogs are one of my favorite breeds so figured this is a fact worth passing on. Enjoy the picture as well:

So tinkering with OpenCV the past day has been fun. This past summer, a co-worker and I made an application to crop images and resize them automatically to speed up booking at the jail we work at.

The first problem was face detection. To create a method, we first invert the image. Then run a line from left to right until the background color changes. Do the same thing from right to left and then find the center. Do that several times through the picture would lead us to a good center location for the face.

The second problem was that we did all this with Windows API/GDI. These methods were very low level and difficult to run simple methods on.

For some reason, we never found OpenCV until reading a slashdot article last night. This library is awesome for face detection and other visual work. I use a Linux box at home and the work computers use Windows, so I like that code can be compiled with only changes to the compiler going between each computer.

Installation

The install in linux was very easy. Ubuntu has great documentation for installing anything with apt. Since I’m using Mint 12 (gotta get away from Gnome 3!), I was able to follow this guide.

For Windows, it was a bit more tricky. I read guides walking me through CMake and such. Fortunately, I found that OpenCV 2.0’s installer does not need to be compiled, just extracted. Using this guide I was able to get it work. To simplify things, I’ve put two zips on my server for anyone to use.

OpenCV_INSTALL.zip has the installer for OpenCV 2.0, CMake guide for those using Visual C++, and a sample codeblocks project.

OpenCV_DONE.zip includes the extracted source and a sample codeblocks project.

Let me know if you have any issues. Remember, for the codeblocks project to compile, you’ll have to sent compiler search directory to [src]/include/opencv and the linker search directory to [src]/lib

Recent progress with doing XFDL forms in PHP. I put some time into this project recently figuring that this web based viewer would be the most applicable. Think if AKO’s MyForms, a setup where you can pass forms from one user to the next to get it filled out and signed; if that program never needed to leave the web? With doing XFDL forms in PHP, that is possible! My code is a mess right now so I will put up the PHP, Javascript for the page on a later post.

For now, go to the old version to see what the forms should be like and go to the new version to see progress on the viewer.

My nomination for Time’s “Person of the Year.” The though when I made this image was that the Seal Team 6 Member that shot Osama Bin Laden would be so secreted that he’d have name redacted and even his silhouette would be hiding his eyes. Enjoy the picture and Merry Christmas!

Since wxWidgets > 2.8 has dropped wxODBC, I decided to learn how to use sql.h on my own. I made a simple program to retrieve and print data in C for the command line and everything worked well. Unfortunately, when I placed this code in my wxWidgets GUI program, it failed. This was due to wx being unicode, so I had a whole world of learning on how to make sql.h talk with wx. I’ve outlined the steps to make this work:

With ODBC, sql.h can work with unicode, the functions are the same, but different variables are sent. WX defines as Unicode (as it’s usually compiled) and ODBC will map the function to the unicode variant. For example, in a C++ program with #define UNICODE 1, such as WX, SQLDriverConnect will map to SQLDriverConnectW, the unicode variant. The other option is SQLDriverConnectA which will allow ANSI variables. Most of the functions you’ll need have an ‘A Variant’, which is what I’ll refer to the functions ending in A.

It’s like if php and java met on a lonely night, dart would be the result.

Google Dart, a new language developed to be the ‘new javascript’ is soon to be available from Google. Check out the webpage that’s set up to show you the language and give a nice tutorial. It has an interpreter on the page so you can tinker and get a feel for it. It seems to me, after playing with the language a bit, it’s like if php and java met on a lonely night, dart would be the result. An advantage of this language, is unlike HTML5, you will not have to wait for a browser to be made to understand this language. It can be cross-compiled to javascript on the server side until browsers catch up! Unfortunately, this is not something I’ve been able to apply to a live server, yet.

Lately, I have started working on the OpenXFDL project again, concentrating efforts in making a C++ application with WX Widgets that can compile for Windows, Mac, and Linux. Getting frustrated with libxml2 and wanting to learn more of xpath queries, I decided to make a XFDL reader in PHP. This can be applied easily as browser/e-mail plugins to view XFDL forms without the need of an external viewer. I’ve been bad about posting but I’ll work to add more to this blog soon. For now, here is a sight to try it out with. Unlike previous stuff, you can do a straight XFDL form instead of converting to XML first. Try it out!

I know its been awhile since I’ve posted on here. About a month ago, I got a new job where I’m working overnights so its been tough getting programming as a hobby in and especially writing as it while I adjust to the new work shift. Some projects I’ve been working on:

1. I’ve gotten real heavy into using microprocessors. Recently, I’ve gone to programming on the Arduino to using the ATMega in its own circuit (programmed while on the Arduino board for testing and then once ready to complete, finishing it on its own circuit.)

2. As usual, working on an XFDL for Linux project. The GUI in WXWidgets is coming along, working out using libxml2 to parse the file, which is taking awhile but its beginning to flow. Keep checking back for updates as they happen.

3. Finally got a Mac OSX running with xCode in Virtual Box. I’m going to get back into Objective C and iPhone apps as I get it working more smoothly.

Thank you for checking in, I’ll be posting more regularly from here on out.

With my new CAC card, I found that libcoolkey.so was not working with Firefox correctly. The new, 144k CAC cards do not play well with the old version of libcoolkey. I did find that the ‘experimental’ release of libcoolkey will fix this problem, here is the fix:

Netflix is a great resource for watching videos, particularly the ‘Watch Now’ feature for instant streaming. Unfortunately, for Linux users, Netflix uses a Microsoft PlayReady, Silverlight plugin for this feature. This is to protect the content from piracy (arrgh, pirates!!) so they have no problems with copyright. Too bad for Linux, as this feature is not available in any way, shape, or form. There is no way to develop a fix for to use this in Linux either, as PlayReady is proprietary. If this angers you as much as it should any Linux user, that the only work around is to use Windows, then please visit and sign this petition.

This week I switched to #! (Crunchbang) because my Ubuntu was getting slow. I love the speed and was very happy with the wifi because it had the b43 driver working by default. Except, I could not get on my network after the most recent upgrade, but I found a work-around after a day of reading forums. Surprisingly, it’s not too complicated! You just need to create a conf file for b43 to use PIO and it will not through a DMA error anymore… my hardware is: Broadcom Corporation BCM4312 802.11b/g LP-PHY [14e4:4315] (rev 01). This is the only line you should need.

A pivotal question in development is whether to use new technology or not. HTML5 and CSS can make great pages but Internet Explorer, being a huge portion of the browsers used, does not handle these except in the most recent versions. A quick google search led me to this page which had a great script to work with this problem. The work around is to create new elements to match HTML5. The detailed analysis is located in the link above.

EDIT: Got the page looking like I want it in IE, Firefox and Chrome/Safari but found the above script was not needed. I surrounded my HTML5 elements (<header>, <footer>, and <nav>) with <div> tags that include the desired HTML5 element. This makes for an easy move to HTML5 when it’s more broadly implemented. Example:

<div class="footer">
<!-- Include the same class name only if you want CSS styling specific to the footer -->
<footer class="footer">This is my footer text.</footer>
</div>

Today I received a warning e-mail about an e-mail virus. Immediately I responded to the sender to let me know if they get an e-mail with this attachment because it would be a nice ‘exhibit’ for my ‘virus zoo.’ To explain, I have a computer lab I’ve set up to run and test viruses (correct plural form of virus). For anyone with interest as to why, it is the best way to understand vx problems and make resolutions. Additionally, I just find it fun to reverse a virus and do my portion of good Samaritan duty and send any resolutions to the internet so that the virus can be fixed and therefore mitigate the ability of that virus to be destructive.

On the second read, I realized that this was ‘too good to be true’ from the perspective of a virus junkie. Here is the e-mail with the signs of a hoax highlighted:

You should be alert during the next few days. Do not open any message
with an attachment entitled ‘POSTCARD FROM HALLMARK,’regardless of who sent
it to you. It is a virus which opens A POSTCARD IMAGE, which ‘burns’ the
whole hard disc C of your computer.

This virus will be received from someone who has your e-mail address in
his/her contact list. This is the reason why you need to send this e-mail
to all your contacts. It is better to receive this message 25 times than
to receive the virus and open it.

If you receive a mail called’ POSTCARD,’ even though sent to you by a
friend, do not open it! Shut down your computer immediately. This is the
worst virus announced by CNN.

It has been classified by Microsoft as the most destructive virus ever.
This virus was discovered by McAfee yesterday, and there is no repair yet
for this kind of virus. This virus simply destroys the Zero Sector of
the Hard Disc, where the vital information is kept.

Here’s a breakdown of that e-mail. Keep in mind this e-mail was supposedly forwarded from a group that has some decent computer knowledge (enjoy the Christmas color theme!):

To be fair, a couple of those came from a search for ‘zero sector’ which resulted in finding this previously used e-mail (Does this sound familiar?):

You should be alert during the next days: Do not open any message with an attached filed called “Invitation” regardless of who sent it. It is a virus that opens an Olympic Torch which “burns” the whole hard disc C of your computer. This virus will be received from someone who has your e-mail address in his/her contact list, that is why you should send this e-mail to all your contacts. It is better to receive this message 25 times than to receive the virus and open it.

If you receive a mail called “invitation”, though sent by a friend, do not open it and shut down your computer immediately.

This is the worst virus announced by CNN, it has been classified by Microsoft as the most destructive virus ever. This virus was discovered by McAfee yesterday, and there is no repair yet for this kind of virus. This virus simply destroys the Zero Sector of the Hard Disc, where the vital information is kept. SEND THIS E-MAIL TO EVERYONE YOU KNOW, COPY THIS E-MAIL AND SEND IT TO YOUR FRIENDS AND REMEMBER: IF YOU SEND IT TO THEM, YOU WILL BENEFIT ALL OF US

Now, I think it’s pretty well established that this e-mail is a hoax. The point of this post is just to make the reader aware of the e-mail itself. Regardless, it is important to remember to update your anti-virus software and use all due caution when opening e-mail attachments. Several viruses do exist and reproduce in this manner and it is important to realize these consequences are real.

Sorry for anyone who watches this site. After the last server upgrade, this site went offline and I was not able to focus my attention on it until I’d returned from my Army school. Now that I’m back though, I have several projects getting ready to go, here’s a list of what to expect over the next couple months:

Return to the garmin wardriver project.

A python based minesweeper (ncurses).

XFDL projects (primarily MS Access integration).

That’s just a short list of what is on my mind. It’s great to be back on-line!

Some of the avid readers may of noticed a slow down in the frequency of my posts. That is because I am preparing to go to a school with the Army (BOLC) for the next four months. Due to the pace of this school, I will be doing far less development and it’s likely I’ll have less internet access. I have not gone away and this page is not dead though. I will post as able while gone but everything will return to normal when I’m back home.