OpenVPN in Windows 7

I often need to work remotely from work, luckily my work has a VPN server that allows me to get access to the companies internal resources. I have been using OpenVPN in Windows XP for a long time to do this, through the use of OpenVPN GUI. Well when I got a new laptop it came with Windows 7 installed. So one of the first things I did was set up my development environment which required me to get into some of the file shares inside of my companies network. I thought it wouldn't be a problem at all to do, I installed OpenVPN GUI and just copied over my configuration and key files. When I went to connect I got quite an interesting error:

Thu Jul 08 23:05:33 2010 ROUTE: route addition failed using CreateIpForwardEntry: One or more arguments are not correct.   [if_index=16]
It turns out to be very simple to fix. In Windows 7 and I believe in Vista you need to do a few extra steps to get OpenVPN GUI to work with Windows 7. First you need to go C:\Program Files\OpenVPN\Bin and make sure openvpn-gui.exe is always started as Administrator (in the compatibility menu of the file properties). Then you will need to edit your configuration file and add two lines after the line that describes your cipher:
route-method exe
route-delay 2
That should do it. Let me know if you have any questions.

Nexus One Support in Ubuntu 10.04

I recently purchased the Nexus One from Google. It is quite an amazing phone and I've been really happy with it. I've taken interest in developing for the Android platform now that I have one. Luckily Google has provided a very good resource for Android app development at http://developer.android.com/.

Today I was working on allowing me to upload my applications onto my Nexus One so that I could test the software on a real device. Well I ran into an issue after following Google's tutorial on how to do it located here. I run Ubuntu 10.04 on my main development machine and so I followed the instructs for how to do it for Linux. Well when I got to the end of the tutorial when it tells you to test your the setup with the following command:

adb devices

I got the following output:

List of devices attached
???????????? no permissions
It turns out that Google's instructions have not been updated so reflect how to get the Nexus One to work under Linux. Well after a bit of research I came across the following blog post that explained it. Basically the list of USB Vendor IDs does not have listed the proper value for the Nexus One. I had selected to use HTC's Vendor ID ("0bb4") being that the Nexus One is actually produced by HTC, however that is incorrect. Instead you need to use the Vendor ID of "18d1". So the following line should be in /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
NOTE: Be sure not to capitalize the D in 18d1, doing this will cause this solution not to work.
Now that you have added that line to the file, you will simply need to restart udev. With the Nexus One unplugged from your system run this command:
sudo service udev restart
Now you can plug in your Nexus One and run:
adb devices
You should see something like this:
List of devices attached
???????????????? device
I hope this helps and post below if you need any further help.

Examining Security Of Open Source and Closed Source

I recently just completed a research paper, with two of my colleagues: Clint Caywood and Matt Strayhall, on the security of Open Source Software. The paper went very in depth and I feel helped fill a void of the lack of credible information in this hotly debated topic. Here is the abstract:

In this paper, we examine the security of open source software versus that of closed source software. Facets examined include a brief history of the growing need for security in software, a comparison of the different philosophies driving the development of security in open and closed source software, arguments for obscurity in closed source versus the “many eyeballs” theory in open source, and the pros and cons involved with both development processes. We also look at the two approaches in practice, focusing on competing software like Linux and Windows, OpenOffice.org and Microsoft Office, and Apache and Windows IIS Server. Finally, we examine the impacts on society from software security, as well as who is responsible for maintaining secure software.

You can find more, including download links, if you visit my Research section of this website.

Floating Point Guide

I came across a great article about the pit falls of using floating point numbers in programming. All to often software bugs come up because developers expect something like 0.1+0.2==0.3. The article goes into very clear detail as to why it is not the case that we can expect exact equality while using float point representations.

Risks of Modern Life

According to Confused using social websites such as Twitter or Facebook can increase your risk of being robbed. It is even being said that using Facebook or Twitter may soon increase your home owners insurance. At first glance this seems pretty scary and is something that most people likely never considered.

Robbers want to rob a house when they will have the greatest chance of not getting caught. That means they do not want anyone to be home. These articles point out that when you post your ware abouts online, you are informing robbers. They could use the information that you are not home to go to your house and rob it. The first assumption is that your address is freely available. After doing a quick check of my computer illiterate friends on Facebook, I didn't find any with that information available. However, the robber could use your name and a phone book to look you up.

The other problem is robbers already have tons of ways to find people that are not home. Simply picking up a phone book and calling numbers in order and going to the houses that do not pick up. In fact the robber could get lucky and they home owner would have put a message on their voice mail saying they will be out of town. Robbers also know that nearly everyone works during the day. So they can simply go up to a house during the day and knock to see if someone answers the door.

If we look at someone who can guarantee is not home during a certain time, such as a news anchor who is live on air at a certain time each day. We do not see an increase in the likelihood of robber for news anchors versus the average person.

I'm not saying its perfectly fine to post your ware abouts online. I just want to point out that it is very doubtful it increases your likelihood of being robbed. I hope the smart people at the insurance companies actually look at some data and not just jump on the chance to charge more money.

Future of AI

AI has always intrigued me. The idea of recreating human or at least intelligent behavior with software is an amazing idea. Unfortunately modern AI is nothing like the dream of creating human behavior. Sure the current solutions can solve some pretty cool problems, but its not the types of problems that people think of when they dream of AI. At h+ Magazine an article was posted discussing what the experts of the AI field predict to happen over the next century. Most seem to think we are a long way off from even being able to pass a 3rd grade exam and possibly 100 years off from making smarter than human AI.

The thing about most AI style problems is that we can solve them in a much easier ways without AI. Passing a 3rd grade exam could be done with advances in natural language processing and some clever Internet searching. It turns out to be very difficult to find ways to test AI. Even the famous Turing Test may not be as satisfactory as one might think. Its hard for a human to tell even if they are talking to another human even if they are, in fact, talking to another human.

The reason why it is so hard to identify another human during the Turing Test is because we don't know what we expect from another human. It comes down to the fact that we have no idea what makes us human. Its nearly impossible to describe a humans intelligence and identify the intelligent parts. So it would be very difficult to quantify how an AI system is better than a human, let alone equal.

I think before we are able to make any true AI system we first need to figure out how the human mind works. Which is turning out to be much easier said than done. Every time we figure something out about the brain, it creates at least ten more questions about the brain. To put this problem in some sort of perspective: We had a theory of computation decades before the first computer hardware and we had predictive models of space centuries before we had the ability to test them. However we have the hardware to run our AI systems on, but no theory as to how to do it. So I think we are at least half a century away from having anything near what we dream AI to become.

Fast Case Converter

Often I find myself needing to convert between upper case to lower case and vice versa. This is a fairly simple thing to do if you understand ASCII encoding. A good reference for the ASCII Table can be found here. As you can see, to convert a letter to lower case you would add 32 to the current value and subtract 32 to convert it from lower to upper. However to implement this it takes a few lines of code to put some conditions in that check to see the current case and decide to add or subtract.

I was looking at the ASCII Table the other day and came up with a simplistic method to swap the case of a given character. That is to exclusively-or the value of the character with 0x20. This will convert the upper case to lower and the lower to upper. Its probably the fastest method to swap ,CPUs can xor in one cycle (excluding memory load time). However you still need some type of conditions to make sure the character is actually a letter and not a number of symbol.

Enjoy!

A Walk Through the Human Mind

I wrote the following paper for a Philosophy class that I am enrolled in. The paper mostly deals with dualism versus naturalism and focuses on some common arguments for both sides. I do a bit of a critical review of each side and attempt to conclude with my own views.

Whether Dualism or Naturalism is true hangs on more than just general philosophical debate. As would run contrary to the first glance, dualism would make the humans mind off limits to science, while naturalism gives science complete control. Both describe where the soul of a person is contained, but use radically different belief systems to come to their conclusions

The first question that would be asked is what is a soul? Webster gives the following definition: “the immaterial essence, animating principle, or actuating cause of an individual life.” At first glance this seems very well defined. As a human being I notice that I am radically different from any of my animal counterparts, however what exactly is it that makes me so different? On the physical side I obviously look different from any animal, but most animals look different compared to other animals. Also most dualists believe that only humans have souls, thus it cannot be physical traits that set me and the animal world apart. Is it intelligence, language, or reasoning? Well all three can be seen in some form or another in the animal kingdom. It is not so easy to find exactly what it is that makes us human and everything else not human.

To give a partially complete answer of what makes us human it would be in the way humans constantly reevaluate their thoughts and actions. We do more than low level reasoning to solve simple logic problems, we use high level reasoning that allows us to gain knowledge from little to no actual experience. For example, the ability to reason about the existence of a soul is a high-level reasoning problem that no animal is able to do. This seems like a huge leap from the most intelligent, non human animal but it is the next logical step after low level reasoning. While, most low level reasoning requires a single pass through of all of the information at hand to yield a result, high-level reasoning requires multiple passes, taking what we have previously decided to be true and using that as part of our input for the next round of reasoning to gain new meaningful information. So to be human means to have the ability to do high level reasoning and gain knowledge from no experience.

Now that we understand what the soul is, we must examine where the soul is. This is the heart of the debate between dualism and naturalism. In dualism it is believed that the soul is an immaterial object that is physically separate from the brain. Naturalism takes the stance that the soul, commonly referred to as the mind, is simply part of the brain. Which one is correct?

Descartes argues that dualism is the correct answer. He takes his arguments against scepticism and turns them into an argument for dualism. The argument often takes the form: I can imagine that my body does not exist, but I cannot imagine that I myself do not exist therefore I must be entirely distinct from my body. The two premises nearly follow directly from Descartes' own arguments and the arguments of scepticism, however, the conclusion tends to be a bit of jump. Descartes does show that I myself and my body can be two separate things in this argument but he does not show that it is necessarily true. In fact the only way that it be necessarily true would be if the sceptical argument was correct, something that even Descartes has argued against.

It is a bit ironic that Descartes argues for dualism while he argues against scepticism. By forcing the mind to be separate from the body, as it is in dualism, he is creating a world in which nothing has to exist except for the soul. If souls are what make us human than we could simply be brains in a vat, or in the case of dualism, non-physical entities that either simulate a physical world or are actually connected to a physical body. Both cases would make the sceptical arguments virtually true.

Other arguments for dualism turn out to be a bit of a let down as well. Descartes attempts to argue for the connection between the human mind and the soul, but it doesn't appear to be scientifically possible to transfer the information from our physical world to the non-physical world of souls. One could then argue that perhaps souls are part of this physical world and we have not yet found a way to measure their existence. If this were true, it seems scientifically silly to think the soul has to be outside of the brain.

With so many strikes building against arguments for dualism it seems like it cannot be correct. However, no matter how many individual arguments for a topic are proven to false, the topic, itself, could still be true until someone proves that it is not. In order to disprove dualism we must examine dualism itself and see what it implies, and see if these implications fit our model of the world or not.

Modern science believes that humans came from creatures that evolved over a very long period of time here on earth. At some point two creatures that where very human-like mated to give birth to a human child. Now starting with the assumption that evolution is correct, at what point did the soul come about? Well there are two answers: the first is that the souls were there prior to the existence of humans; the second is that they existed upon the creation of the first human child.

The first argument would imply that every creature has a soul. This argument doesn't exactly make sense because we have already defined the soul to be what makes us human. It is possible that we ill-defined the soul, but most modern dualists do not believe that every creature has a soul. This isn't exactly a satisfactory reason to discredit the argument. The idea of the soul is generally believed to stem from religion. Which says that the soul is what lives on after we have died in this physical world. From this it seems strange to believe that a god would make animals live on after they have died.

This leaves us with the second argument, which is that when the first child was born, a soul was either created or assigned for this first human. What was it that the parents of the first human didn't have but the child did have? From evolution it is known that very subtle changes are the only ones that are made from parents to offspring. So the parents likely had pretty similar DNA and physical traits compared to the first human. It is hard to imagine that such a small change could have such a dramatic change on this world. Again, however, this isn't exactly a fulfilling proof that the soul couldn't have been attached at the first birth. Let's assume that the first human did get a soul when it was created. How did this child mate to create new humans? Well, other non-human creatures could have created human offspring which had the exact same change from the non-humans that allowed the soul to be attached. These offspring would need to have been created fairly close together so that they could eventually meet and mate. This seems very unlikely, as the probability of this happening is very low. Another option is that the first human mated with other non-humans and again created a human. This seems to take away what makes a human special, the human offspring could be more like its non-human parent than its human one. Why would a soul attach to a slightly human creature and not other non-human creatures? The final option is that the first human had a sibling of the opposite sex who was also born with the unique set of traits that made it human. Then the siblings mated to create more humans. This seems unlikely because the only universal law of humanity is that siblings should not mate. That rule appears in every culture in some form or another. Why would the first generation of human violate what appears to be an inherent law of human nature?

Thus it appears that the dualist argument has been defeated given that evolution is true. It would be nice if we could get rid of the condition of evolution being true. There are arguments that attempt to do just that, but they tend to involve a lot of other assumptions and are not completely satisfactory proofs.

Let's now turn our attention to that of naturalism. It seems natural to feel that you exist separate from your body. This part that we feel is separate we generally call the mind. The brain is not the same as the mind, but rather the physical vehicle for our mind. We can consider our brain as a black box; by this we mean that lots of input goes into our brain and a lot of output comes out of our brain. Our brain cannot directly interact with the world around it, all it can do is use the inputs from our senses to gather information and use our body to express information. Using this view of the brain it is natural to see where the mind comes from. The mind is an emergent property of our brain attempting to exist outside of itself. The brain must place itself outside of our bodies to be able to interact with the world around us. Thus our mind is created to be that imaginary thing outside our body.

So it appears that our belief in dualism is a natural side effect of the way our brain attempts to make sense of the input it receives in order to interact with the world. It is important to remember that disproving dualism does not disprove religion or cheapen the value of a human life. Religion sits in a different domain than science it answers what happens after this life, while science answers how this life works.

MySQL and Java common problem

Have you ever received the following error while using Java and MySQL:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '????????????????' at line 1

This is a common error when you first set up Java and MySQL to work together. To correct it simply add the following lines of code to your my.cnf in the section [mysqld]

collation_server=utf8_general_ci
character_set_server=utf8

Self Replicating Code

For a class recently the teacher challenged us to write a code snip-bit that would be self replicating. By that I mean write a program that when executed would write out its own source code. This is a bit harder than you'd initially think it to be. My first attempt tried to store the source code within the program when execute it would output what was stored within. However this creates a chick and egg problem. The source code contains the source code. Something that at first stumped me. Then I remembered Stringification in the C preprocessor and I came up with this:

 
#include "stdio.h"
#define M(Code) main(){FILE* fp = fopen("source.c", "w");fprintf(fp,"#include \"stdio.h\"\n#define M(Code) %s\nM(%s)\n",#Code,#Code);fclose(fp);}
M(main(){FILE* fp = fopen("source.c", "w");fprintf(fp,"#include \"stdio.h\"\n#define M(Code) %s\nM(%s)\n",#Code,#Code);fclose(fp);})
 

This is a pretty cute program if I can say so myself. When its ran it will create a file called source.c that will be exactly the same as the code above. You could even recompile source.c and it will create another source.c. You should attempt to do this on your own to see if you can come up with other cool ways of doing it.

Download: SelfRep.c