Wednesday, May 15, 2013

Unjustified Mysticism

I have a great deal of interest in the subject of consciousness. It is a quality that is vastly important, but poorly understood. Many times I have stayed up late at night watching Youtube videos or reading web article on scientific theory and research into the subject. There will be a post about the subject eventually. But for right now, I'd like to talk about something else.
As I combed the web, it became apparent that pseudoscience had taken a liking to the subject of consciousness. Whereas science adhered to known biological and physical theories and adhered to the scientific method (propose theory, experiment to test theory), pseudoscience completely avoided any know scientific theories and lacks any supporting evidence, instead choosing to discuss the topic from a subjective view. I suppose the lack of understanding and formal theories around consciousness has made it a breeding ground for pseudoscience.

Go do a search for videos on "consciousness" and you will find many, many videos from this point of view. They're the ones with pretty graphics of space or nature rather than someone speaking in front of a classroom. One video in particular caught my eye, though. It's a clip from an episode of ABC's Face-Off of an exchange between Deepak Chopra and Sam Harris.

Deepak Chopra: "I believe that there is a transcendent core consciousness that is comprised of meanings, contexts, relationships, archetypal ideas that recycles itself."
Sam Harris: "So it's in no sense a product of the brain."
Chopra: "It's no sense a product of the brain and our whole endeavor in spiritual discipline is to go actually beyond that personal consciousness, that ego consciousness so we can identify with that transcendent reality which is the source of space, time, energy and anything else that exists."
 
Notice the vocabulary that Chopra uses. "Meanings", "contexts", "relationships". All very personal, subjective ideas. You can't measure them, and that works towards pseudoscience's advantage. You can't disprove that which can't be measured. Chopra then goes on to divorce the concept of consciousness entirely from any know theories of biology or physics and something presents something of an Assimilation Plot. Nowhere does he present a competent explanation for the spiritual consciousness, theories that could be tested. It works to pseudoscience to keep things vague, to keep them untestable.
And the last part of that exchange is perhaps the most interesting. Consciousness “is the source of space, time, energy and anything else that exists”. You can see more of this way of thinking at this article penned by Mr. Chopra: "Every quality in the outside world exists because you create the quality. Your brain is not the creator – it’s the interpreter and deliverer. The real creator is mind. It will likely take more to convince you that you are creating all of reality. We understand."
It is his theory that it is our consciousness that gives rise to reality. He’s not far off, but there’s a big distinction to make: It is our consciousness that gives rise our interpretation of reality. It’s actually pretty easy to test Mr. Chopra’s theory. Have you ever been wrong? Perhaps you sat on a chair expecting it hold your weight, but instead it collapsed. If your consciousness was truly giving rise to the physical universe, this would be impossible. In your mind, the chair would hold your weight, thus the reality created would be such. Even young children understand this. Just because you don’t understand fire, does not mean it will not burn you.

And Deepak Chopra is not the only one espousing this theory. I don’t suppose you’ve heard of The Landmark Forum. They are at worst an opportunistic pyramid scheme and at worse a cult. They too buy into the “reality as a creation of the mind” mythology: "We observe not so much the particulars of the realities we construct, but that it is human to construct such realities, and then forget that we are the ones who constructed them."
I think it’s more telling what they say latter on the page: "We explore choice as a profoundly human ability to create. When choice is understood and known in this way, what had previously seemed simply part of “the way things are” – inevitable or impervious to change – appears in a new light." And that’s really what is at the center of this pseudoscience mess: choice. What better carrot on a stick to those disenfranchised, depressed masses than choice. “You need not live life as a looser; you can choose a different reality.” Perhaps there’s even a little Social Darwinism in that thinking. “Your life is only bad because you are making that reality.”
But that’s not really true. Sure you can change your outlook on life, change your action in the world. It certainly doesn’t hurt to look at things from a new perspective. But no amount of belief will change your physical reality. You can not muster a home out of your consciousness, nor a happy family. Fire will always burn you. Belief alone will not make those things such. Sometime bad things happen for no reason. No one’s consciousness created it. Meaning can’t be found in everything. That is the nature of reality.
Perhaps it is a bit depressing to think in those terms. But you can still affect this world. You have agency as much as anyone else. However that doesn’t excuse pseudoscience from pushing a false hope that helps only swindler.
I think Mr. Harris phrased it best Mr. Chopra in that episode Face-Off:

Chopra: "You are so dismissive of subjective experience, which has given rise to poetry to music to art. I am saying that the whole universe is imbued with subjectivity"
Harris: "There is nothing more important than subjectivity. It's all we could possibly care about. The changes in our conscious experience have some relation to the physical universe."
Chopra: "Absolutely, they give rise to the physical universe."
Harris: "That is a statement of metaphysics that is totally unjustified and could not possibly be justified".

Wednesday, May 8, 2013

The Perils of a Long Transit

I live a few hours from a major city. Consequently, I saw a lot of job offers available in the area. One such was a small business I had multiple interviews with. About 3 if I recall correctly.
This means getting up quite early, putting on my spiffy suit and traveling on public transit for a few hours. This also meant a considerable expenditure on my part, as small businesses aren’t going to pay an interviewer for transit.
There was more than once that I was stuck at the transit hub waiting for the next ride out or the next interview to start.
In the end I didn’t get the position. On the plus side, one time as I walked down one of the crowed city streets in my full suit, a stranger told me I looked “cool”.

Tuesday, May 7, 2013

Spam: Stupid Pointless Annoying Messages?

Spam: Stupid Pointless Annoying Messages?
I meant to post this as part of the post on AI, but I felt that some of this information fell out of the scope of that post. So, why the post on spam? Well, it something all of us has run into in some way and it makes a wonderful case study, as you are about to find out.

I’m sure most of you have at one time or another looked at you inbox, found the countless spam messages, and though “why?”. What could these spammers, who go to such extreme lengths as to compromises other’s computers to add to their bot-nets, possibly hope to gain? Well, like most things, it boils down to money. Garry Pejski has an interesting DEFCON presentation on his time as a malware developer. Some reputable company, say GM or IKEA, will want to advertise their product or service in the hopes of attracting more customers. Another reputable middleware company, say Google, creates ads for these companies for a price and offers others a cut of this money if they display these ads on their website or product. Here’s the problem, some unscrupulous individuals look to capitalize on these offers by having others view as many of these ads as possible, whether they would actually buy any of these products or not.
There are other reasons why spammers are doing what they’re doing. Some could be trying to perform a phishing attack. But, here a more interesting case, also coming out of DEFCON, by Grant Jordan on the use of spam to affect the stock market. A spammer buy a stock, spams others to buy that stock, and then sells when it hits its height. Some interesting things brought up in this study: similar looking ads came from same spammer and would usually perform the same. Also, due to the advent of spam catching techniques, text based spam never worked.
Spam filtering is actually a highly intellectual field of computer science. It relies on computer learning, but there are two ways it can be preformed, using classification in the case of supervised learning or using clustering in the case of unsupervised learning. Both use features of a message (tokens that occur, number of capital letters)to add it to a group with similar features. In the case of classification, training data provides examples of the groups (spam and non-spam), while clustering uses input data to define groups and may only require the number of clusters to start the algorithm.

Monday, April 1, 2013

Artificial Intelligence: Finding Ourselves

I suppose you’ve heard of Watson, the Jeopardy playing robot. It’s a great case study for artificial intelligence. Watson has an almost limitless amount of information at its disposal (several terabytes). But, yet it gets things wrong. How is this possible? Consider the question “Its largest airport is named for a World War II hero; its second largest for a World War II battle”. Watson’s response: “Toronto”. Watson kind of works like a search engine, it gives a weight to key words in the question and the categories. It makes adjustments based on previous answers and produces a set of results it chooses from. So, it does a search for airports, people in WW2, battles in WW2, and cities. Then it combines, weighs them appropriately and produces an answer. The answer was probably right, but not “right”, the game show is US based and therefore a US answer is more likely.

The problem is universal to computers, they lack the basic assumptions you and I have. When I say a person X is dead, people understand what that means, a person that is dead is no longer animated and will always remain dead. But if you tell a computer that (say, in Prolog) it doesn’t understand that, I just assigns “person X” the value “dead”. Computer learning can help, but as with Watson, it can’t make this problem disappear.
One of the greatest problems facing the field of artificial intelligent is figuring out how to determine intelligence. One of the early computer scientists interested in this question was Alan Turing, who proposed the Turing Test. The idea was, essentially, if a person, through conversation, could not differentiate between a computer and a person, that computer was capable of thought.

An interesting aside about Alan Turing. Although a brilliant scientist, he was sentenced to chemical castration for being a homosexual as was the law in Britain during the time. Unable to live with the treatment, he committed suicide by ingesting an apple laced with cyanide. Rumor is, Apple’s iconic logo is in tribute to Alan Turing’s contribution to the field of computer science.
Back on track, there are several problems with the Turing Test. In practice, human judges become too suspicious and end up actually rating several humans as bots. In theory, there is the Chinese Room. In this theory, a man sits in a room with a book with responses to Chinese symbols. Chinese characters are passed to the man in the room and, after consulting the book, the man jots down the response and passes it out of the room. The theory holds that even though the outside observer may believe the box to know Chinese, the man inside the box does not actually “know” Chinese. Similarly, a computer just follows instructions (a program) and can never really “know” things.
Well, it’s an interesting view, but lets take the example a little further. The book that our man would be consulting would be very large, it would need to responded to every inquiry one could make in Chinese. Our man is only doing the simple work of finding and responding. Essentially our book plus man combo, and not the man alone, would be able the Turing Test.
Perhaps the problem isn’t the question we’re asking, but rather understanding what we’re trying to find in the first place. Perhaps the question should be: What is consciousness? It’s a question philosophers have grappled with for some time. Some define it as self awareness, emotions, or, if you’re religious, a soul. The best way that I have found to describe it is “our first person perspective”. When your body experiences something, your body does not just respond with a reflex “you” feel it. This raises some interesting questions. How do we know others are conscious, are they intellectual zombies? Are animal? Babies? Those that have undergone brain damage? How can we tell if a computer has gained a consciousness?
If a computer did become conscious, how would people react? Looking at popular fiction, some might accept it, as in Neuromancer, others may look to prevent it’s existence, as in Ghost in the Shell. Perhaps some would react in disgust, knowing that something exists like you but “different”. That is certainly the case of the Uncanny Valley.

Friday, March 29, 2013

Job Search Dos and Don’ts

I’m sure you’ve seen one of those articles about “10 tips for job seekers”. They usually speak to some analysts or hiring managers and get some choice quotes about what they thing job seekers should do to improve their odds of finding a job. I actually had an entire college course similar to this. The problem is, hiring isn’t scientific. There’s no “best way” to hire, so different hiring managers will give different answers.

In my course it was explained that the job seeker should always ask for when a hiring decision will be made and if they haven’t heard back by then, they should call back to follow up. My instructor explained that a job seeker should never call before then, because it would be seen as needy or bothersome to the interviewer. About a month into my job search I read an article explaining the same tip. However, the article explained one should call up before the decision date, in order to remind the interviewer of their qualifications. Clearly, these two people have a different job selection process.
So, with that in mind, I’ll try to avoid specifics, and keep in mind, every interviewer is different.

Always research the company you’re interviewing with. Be informed of recent news and what their business does.
Have questions. There’s always a “do you have any questions” section of the interview. Always have a question, even if it’s “what’s it like to work here”.
Never bring up salary. Until the offer, be as vague as possible about your price. Say you have to research it.
Be timely. Arrive on time to interviews, if not early.
After an interview, send a thank you email to the interviewer. The idea is it will remind the interviewer about you. Don’t be afraid to list some of your qualifications.
Have a 2 minute ad for yourself, as short story about your qualification. In case the interviewer asks to “tell me about yourself” or another open ended question.

Thursday, March 28, 2013

The Power of C in the Cloud

In my last post, I introduced you to the cloud IDE Codenvy. The primarily reason I used it is because it has a simply way to hook into Google App Engine. However, for a more robust cloud IDE, I would recommended Compilr. Compilr has support for many of the languages Codenvy does (Ruby, Java, PHP, Python) but it also has support for Objective-C and C# as well as low level languages like C and C++.
That last point leads to some interesting results. Because we have access to such low level languages, we can use the Compilr servers for general computing. From what I can tell, the Compilr servers that execute the code are running a Unix-like operating system on x86 hardware. So if you’re in a pinch and need access to a Unix like environment, Compilr can be very useful. I happened to run into such a situation while trying to make use of WoLF PSORT for a rather long sequence and lacking the necessary Linux PC to compile and run the program locally.
So, how do you execute commands on commands on Compilr’s servers? First, create your C++ project. Your program will be run in the “content” folder of your project so if you have any external files you need, place them there:
 

If you get an error message when uploading, but you also get “Upload complete”, you upload has finished. Refresh the page for the files to show up in the project panel.

The key to our program is the system function. Simply hand it commands to execute and it will do so. To untar our WoLF PSORT file execute the following:
system ("tar -zxf WoLFPSORT_package_v0.2.tar.gz");
Remember to mark the files for execution if nessessary:
system ("chmod 777 ./WoLFPSORT_package_v0.2/bin/psortModifiedForWolfFiles/psortModifiedForWoLF");
There are a few restrictions Compilr has placed on free accounts.
First, you are forced to make public project and you are restricted to 50 builds/runs. These aren’t huge problems and you can always create a new account and port code if you go over 50 builds. In fact I have noticed the build counter often reset after refreshing the page, so this never became an issue for me.
Second, you are limited to 4000 characters of output. A very simple solution, pipe output into a log file by appending > log.txt to your command:
system ("./WoLFPSORT_package_v0.2/bin/psortModifiedForWolfFiles/psortModifiedForWoLF -t ./WoLFPSORT_package_v0.2/bin/psortModifiedForWolfFiles/all.seq > log.txt");
You may also need to pipe errors and warning, in which case you can log to the same file by appending >log.txt 2>&1 to your command. Or you may wish to disable errors and warnings completely while still capturing output, in which you would append the following 1>log.txt 2>/dev/null .
Third, if your program has not accepted input in 40 seconds, it will be terminated. This requires a tricky work around. I ended up spawning a child process to accept input while the parent process was busy. The child process will send an alert for input every 30 seconds. If you choose to do something similar, remember to flush stdout before sleeping. The syntax is as follows:
fflush(stdout);
sleep(30);
Interestingly, this method triggers a security measure when one process exits before the other and will terminate the program. So make sure no process exits before your program has finished doing it’s work.
Some final points about Compilr:
Much like Codenvy, Compilr has issues with Internet Explorer. I managed to get it working in Firefox.
The first compile of every session will fail with “Lost connection to server”. Simply use a dummy application to trigger it and continue your work. If you run an application that takes a long time and it loses connection, it could block you from running further applications until it finishes.
Always backup your progress! I can’t stress this enough. If the server that stores the code loses connection to the server that runs the code while “Syncing application data”, you can lose large chunks of your work.
Finally, I’ve attached some sample code on the download website.

Tuesday, March 26, 2013

Programming with Java on Google App Engine

I wrote a draft post about Google App Engine many moons ago when it was Python only. As I’m not a Python man, the post isn’t very technical. Anyway, things have changed and GAE now supports Java. Albeit a customized subset of Java, which I’ll go into later.
Google App Engine is a cloud computing service: run your programs on their servers and pay by CPU usage. It’s similar to Amazon’s EC2 and Microsoft’s Azure, but unlike them in there is an absolutely free trial. You’re only required to provide a telephone number when signing up.
Step 1: Create the proper account
Sign up for a Google account here and a Google App Engine account here. After the GAE account is created, you should be prompted to create a new Google App Engine ID.
Now, if you’re like me, I won’t want to have to download and install the various SDKs and IDE to make your GAE app. So, I suggest Codenvy. Be sure your logged in to your Google account and click “Connect with Google”. Be sure you’re not using Internet Explorer, Codenvy seems to have issues with it.
Step 2: Create a project
On the welcome screen, choose “Create a New Project From Scratch”

Choose  Java Web Application (WAR) -> Google App Engine

You have to select the sample project, but you can skip using the JRebel plugin.

Use the Google App Engine ID you just created.

Step 3: Clear out the sample code

Click the project tab in the left menu (next to the Package Explorer tab)
Delete the src\main\java\com folder.
Delete the src\main\webapp\display.jsp file.
Open src\main\webapp\WEB-INF\web.xml and empty the “servlet” and “servlet-mapping” items. You can add java code to the src\main\java folder at a later time and add the proper information in these tags to specify it as a servlet.
Add the following in the “web-app” item after the “servlet-mapping” item:
<welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
Open src\main\webapp\WEB-INF\appengine-web.xml and make sure the “application” has enclosed your Google App Engine ID
 Customize src\main\webapp\index.jsp as you wish.
Step 4: Run your app on Codenvy servers
Make sure you save! Codenvy does not auto save changes when building.

Run -> Run Application

Step 5: Load your app into Google App Engine:
Make sure you save! Again, Codenvy does not auto save changes when building.
Go to Project -> PaaS -> Google App Engine

Select Application Update


If you get an Oath token error:

PaaS -> Google App Engine -> Logout

PaaS -> Google App Engine -> Login

Also, see this link for setting up cron jobs.