Tuesday, December 28, 2010

Self-inflicted trolling: 300 million Americans don't have iPhone insurance

Title Corrected

Oops. I meant to say, many Americans still don't have health insurance. The Kaiser Family Foundation released a report that states, 50 million Americans don't have health insurance. This group released a new report and now the print, digital, and TV news media have to run with this story. That is the headline, "50 million Americans don't have health insurance". If you said, "90% of iPhone users don't have iPhone protection insurance", you will probably think, who cares? But with 50 million without health care, we are supposed to get mad at our government. Get those people health insurance.

Wait a minute, shouldn't we at least ask the question, does everyone need health insurance? Do the 50 million without health insurance need health insurance? For Americans to experience a higher quality of life, I hope that most Americans have access to some kind of medical services. I just don't know if health care insurance is the silver bullet to a existence free of worry. And it is really interesting how the media presents the report, they will only focus on that one liner. Health insurance, health insurance. You won't hear, "five hundred thousand people died of heart disease" or "220,000 cases of lung cancer are expected in 2010". The focus in the media on the health care debate is not on health care but health care insurance. It is never, heart disease, cancer, advances in medical technology, or anything actually related to the cost of medical procedures. In most cases the anger from the people is in the form of, "There are too many uninsured", it is never, "There is too much cancer out there. Do something about the cancer and the heart disease". I would even suggest a debate on the procedures that are being offered, are they needed? So now, we expect our elected leaders to further exacerbate the problem by somehow getting more involved. Like I said before, people will expect the federal government to do something about getting those uninsured more insurance. From the standpoint of the health insurance companies, they can't possibly lose. With the current bad economy, small and medium sized businesses are dropping their employees from their insurance plans because they can't afford to cover them. So the insurance companies may lose those customers in the short term. But that is OK for the insurers, the media will just send out a press release detailing the ever growing lack of insurance problem. And the government will respond in kind by making sure that the uninsured get insurance from the health insurance companies. It is a textbook case of a boondoggle.

What if I DON'T want health insurance?

Ideally health insurers should offer health care plans based on the number of customers in a particular group or on a particular plan. Let the insurance models dictate the market rates in an unencumbered system. If federal government forces are involved in determining which customers can be dropped from insurance plans and ensuring that all Americans are covered by some health insurance, then the health insurance companies are guaranteed a large number of potential customers. In some cases, government is telling insurers who to cover and even taxing particular procedures. With the recent health care bill, some stipulations include a 10% tax on ultra violet tanning bed services and dependents must be covered up to age 26.

The actual health care service providers are guaranteed a check from the federal government or the large health care insurance companies. At the very least, the insurance plans won't offer competitive rates because there is no real competition. They are not competing for your money. Ideally, the health care debate should be about health care and not the insurance. Not only do people not pay for most health care out of their own pockets. They don't even pay for health insurance. You get a job, hopefully you will get a job with a large number of employees like Boeing or GE and you opt into their group plans.

Plastic surgery, laser eye surgery, cosmetic dental care (braces) prices have remained steady while other medical procedures have increased dramatically. Why? Most people will pay for these types of services out of pocket and not through an insurer. The market forces influence the rates for these services. You don't have as much fraud, waste, and abuse where the plastic surgery professionals have to compete for your money because the consumer is cautious about the type of services they are paying for directly.

My Opinion

I would really like to see a health care system that is driven by the market, like most of the non-health related services we pay for. The government shouldn't tax money given to us by our employees that may be used for health services. We shouldn't give employers tax incentives to keep large number of employees on our health insurance plans. The federal government just shouldn't be involved in the business of providing health care insurance plans.


[1] http://www.huffingtonpost.com/2010/12/27/uninsured-americans-50-million_n_801695.html

[2] http://www.ncpa.org/pub/ba437

Saturday, December 18, 2010

Standard Developer Toolkit - 2010 version

I don't know if it is because I am getting older but I am starting to record my thoughts online or digitally so that I can easily go back to that record. I do this by posting blog posts on blogspot and through other subversion code repositories.

One task that I have long neglected is creating a list of common developer tools. The toolkit suite contains a list of common software applications that a developer of any language or environment would need. Most of the software is open source of freely available. Obviously, different developers want or need different tools. Here is the list of packages that are essential for what I need. Yes, the list is bias with a emphasis on Java development. I marked the critical applications in bold. I would typically install of all of these tools on one machine over a long time period. Some of the tools seem similar in nature, for example, I do install Netbeans and Eclipse on the same machine. I may swap between the IDEs if there are tools built for one platform not available in the other environment.

Operating Systems:
- Use both WindowsXP/Windows7.
- Cygwin
- Use VMWare and an Ubuntu 9+ Image (only VMWare player is needed for win32)
- VMWare Fusion if you use Mac
- Ubuntu 10+ on a standalone machine (AMD64bit or Intel machine)

Programming Languages and Environments:

- Java (Java JDK from Oracle on Win32, possibly OpenJDK on Windows)
- Scala (JVM language for Java)
- Clojure (JVM language for Java)
- Python (install on both win32 and Linux)
- Perl (for some scripting)
- Haskell

Developer IDE Tools:

- Eclipse (you can easily install/setup multiple versions of Eclipse)
- Eclipse CDT for any C++ Development
- Eclipse PyDev for Python development
- IntelliJ IDEA (Great for Scala development, rapid Java development)
- Netbeans
- Emacs

Misc Developer Tools:

- Subversion client
- Git client
- Mercurial client (optional)
- Maven (for Java development)
- Ant (for Java development)

Text Editors:

- Vim (install on Cygwin if using Win32)
- Emacs (I prefer Emacs over XEmacs and use the Emacs win32 version)
- TextPad
- Notepad++ (notepad++ is open, textpad isn't, I like both)
Word Processing:

- Open Office
- Microsoft Office (I prefer older versions of the Microsoft Office suite. If you have the money, I would consider purchasing the software).

Web Browsers:

- Mozilla Firefox
- Install Firefox Firebug plugin
- Install Firefox Tamper data plugin
- Google Chrome

Network Tools:

- WinSCP (Win32)
- FileZilla (Win32)
- XChat (or XChat2)
- VMWare Player

Graphic Tools:

- Gimp

Misc Tools:

- 7zip
- WinMerge (open merging software, very useful)
- R (google R statistics application). Useful for charting data

Cygwin Installs

- Install Cygwin
- Download or make sure that these are installed: vim, find, grep, wget, gcc, g++, gtk libs, openssl libs, gnuplot

Eclipse Plugins for Java Development

- Subclipse
- Maven Plugin (m2eclipse)

Java Frameworks

- Spring Framework, Google's GWT, Apache Wicket, Hibernate, iBatis ORM, Lucene, AspectJ, ASM, Antlr

Practical AI: Hello World Bitworm Example with Numenta's Nupic (HTM for the masses)


Jeff Hawkins of Numenta and previously the creator of Palm Inc has shifted his focus from mobile computing to developing a sophisticated AI system. He has always been passionate about artificial intelligence. Jeff knew early on that the trends in AI research weren't very promising. He had concentrated his AI interest in human biology and neuroscience. Numenta has patented HTM (Hierarchical Temporal Memory) technology. According to Jeff Hawkins, you cannot mimic brain functions without including a hierarchical system of memory. The lower level has more input/output nodes than the level above it. According to Jeff, you must also take into account "temporal" memory. For example, the human brain has many parts of the brain that handle visual information. The brain may be able to detect a particular object but also factor in the time that the visual event occurred. If you are at the zoo, your brain predicts that you will see animals and animals in cages at the zoo. It is rare that you see a plane take off or land in the middle of your zoo visit. You would have had previous memories or seen pictures of the zoo in the past and parts of your brain activate other things associated the zoo. The context in time is a visit to the zoo. The memory of a zoo visit is probably in a different area of the brain than a trip to an airport. In the case of an airport, you expect to see planes landing and taking off. -- Repost from my previous blog entry.

Jeff's vision of HTM is implemented though Numenta's Nupic. Nupic is a HTM Python library and software suite that includes simple speech recognition demos, computer vision demos(picture object recognition), and other Nupic examples. Normally, you would have to pay hundreds for pattern recognition software of this quality. But all of these examples are functional and demonstrate the power of the HTM Nupic approach.

Bitworm Hello World Example

The Bitworm example provided with Nupic is a Hello World Example. But it is probably the most complex and thorough Hello World I have seen. It covers the basics but it also usable as a library or simple Nupic API. In the case of the Bitworm example, the goal is to track the movement of a bitworm through it's movement in 2D space and time. Think of the bitworm example in three dimensions. Dimension 1 is on the Y axis and is the height. In this case, the height is one. Dimension 2 is on the X axis. The X axis contains the length of the bitworm and movement along the X axis. And the third dimension is time. There are 20 time sequences trained for the bitworm examples. (OK, in reality you could think of the example in 2 dimensional space. The X and T axis are relevant).

There is one bitworm represented in the screen shot above. There are two bitworm lines from the top to the bottom of the screen. Line one is a representation of ONE bitworm and its position. In line two, the bitworm has moved in the X direction. Line two is a representation of the bitworm at TIME sequence two. There is ONE bitworm and 20 time sequences of that bitworm movement. The goal of the bitworm example is to train that movement and then predict the bitworm type based on a test set of bit worm examples.

I wrote a python example TK graphic program to render the bitworm's movement. The TK example is not provided with Nupic. The string of bits are created by the bitworm example, here is a representation of the training data set:

1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 [---- bitworm zero and time sequence 0
0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 [---- bitworm zero and time sequence 1
0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 [---- bitworm zero and time sequence 2
0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0
0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0
0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0
0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0
0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0

There are 420 lines of these bitworm bit vectors in the text file. Each line in the training set and the test set are representation bitworms.

The bitworm example is located at NUPIC_HOME\share\projects\bitworm

Summary to understand the bitworm example:
1. The bitworm python example does the following:
1a. The bitworm example creates the training data (File: training_data.txt)
1b. The bitworm python example creates the test data (File: test_data.txt)
1c. The bitworm example creates the bitworm categories (needed during the training process)
1d. The application trains the training test after the test and training data is created.
1e. The application validates that Nupic can learn the training data by verifying against the test data.

Think of training as training the Nupic AI software and test data as the way to check that the training worked.

2. training_data.txt and test_data.txt is a simple text file
2. Each line in the training_data.txt and test_data.txt database file consists of a bitworm (16 bits in the bitworm vector)
3. Each column or bit in the training and test file is a bit in the bitworm. There are 16 bits in the bitworm example.
4. Each line in the training and test data file is a bitworm and a representation of that bitworm at a particular time sequence.
5. There are twenty time sequences in a GROUP training set. Basically, line 1 of the training file represents a bitworm at time sequence 0. Line 2 of the training file represents a bitworm at time sequence 1, etc. At line twenty, that is the end of a time sequence group. At line twenty 22, a new bitworm example starts.
6. There are twenty EXAMPLE BITWORM time sequences.
7. There are 420 lines in the training and test data file, each line is bitworm at a particular moment in time.
9. There are zero bitworm vectors that delimit a time sequence

If you look at the file training_data.txt:

One bitworm is 16 bits:

1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 [---- bitworm zero and time sequence 0
Here is a formula to determine why there are 420 lines in the training and test file:

(1 bitworm * 20 time sequences) + (20 groups of time sequences)
+ (ZERO bitworm delimiter line * 20) = 420 lines in the file.

Example snippets from the Python Bitworm Example:

def generateBitwormData(additiveNoiseTraining = 0.0,
bitFlipProbabilityTraining = 0.0,
additiveNoiseTesting = 0.0,
bitFlipProbabilityTesting = 0.0,
numSequencesPerBitwormType = 10,
sequenceLength = 20,
inputSize = 16,
trainingMinLength = 9,
trainingMaxLength = 12,
testMinLength = 5,
testMaxLength = 8):

# Generate training data with worms of lengths between 5 and 8
trainingData = BitwormData()
trainingData['prefix'] = 'training_'
trainingData['minLength'] = trainingMinLength
trainingData['maxLength'] = trainingMaxLength
trainingData['sequenceLength'] = sequenceLength
trainingData['inputSize'] = inputSize
trainingData['numSequencesPerBitwormType'] = numSequencesPerBitwormType
trainingData['additiveNoise'] = additiveNoiseTraining
trainingData['bitFlipProability'] = bitFlipProbabilityTraining

Train and verify the bitworm example:

# Train the network
# TrainBasicNetwork: This function trains a basic network with the given data and category files and returns the trained network
bitNet = TrainBasicNetwork(bitNet,
dataFiles = [trainingFile],
categoryFiles = [trainingCategories])
print "Bit Net (TrainBasicNetwork-1): ", bitNet

# RunBasicNetwork: Runs the network using the given data files. The output of the classifier
# node for each input pattern is stored in resultsFile.
accuracy = RunBasicNetwork(bitNet,
dataFiles = [trainingFile],
categoryFiles = [trainingCategories],
resultsFile = trainingResults)
print "Bit Net (RunBasicNetwork-2): ", bitNet
print "Training set accuracy with HTM[a] = ", accuracy * 100.0

# RunBasicNetwork: Runs the network using the given data files. The output of the classifier
# node for each input pattern is stored in resultsFile.
# Run inference on test set to check generalization
accuracy2 = RunBasicNetwork(bitNet,
dataFiles = [testFile],
categoryFiles = [testCategories],
resultsFile = testResults)
print "Bit Net (RunBasicNetwork-3): ", bitNet
print "Test set accuracy with HTM[b] = ", accuracy2 * 100.0

Modifications to the Bitworm example and moving forward:

The bitworm example is a common type of example in the AI and pattern recognition world. You are given a bit sequence. Train the bit sequence and attempt to test the sequence against other sequences that have a similar structure. In the case of the bitworm example, a bit vector of 16 bits is trained. You could modify the example to train a 16x16=256 bit vector image.


[1]. http://www.numenta.com/

Wednesday, December 15, 2010

Practical AI: Machine Learning and Data Mining with Weka and Java

Practical AI: Machine Learning and Data Mining with Weka and Java

Most people tend to think of Artificial Intelligence with depictions of autonomous bipedal robots speaking and greeting humans in a monotone voice. The computer science field of Artificial Intelligence is far from that science fiction world that we see portrayed in the movies. The most prominent past AI research seems more like it would fit under a branch of mathematics and not computer science. AI research sub-fields include machine learning, data mining, computer vision, string match and indexing, search algorithms and neural networks. There is a new focus on not just faster search algorithms and pattern recognition, but building a relationship between computer science, neuroscience, philosophy, psychology, biology. AI is branching out beyond the algorithms and merging with those other general science and medical fields. Marvin Minsky, a prominent researcher in the AI field, called some of the previous interests like Neural Network, technology fads. Marvin Minsky's most recent book, the Emotion Machine describes some of human's behavior with a simple set of rules. The book is a useful guide for computer scientists that want to model that behavior. Jeff Hawkins of Numenta and previously the creator Palm Inc has shifted his focus from mobile computing to developing a sophisticated AI system. Numenta has patented HTM (Hierarchical Temporal Memory) technology. According to Jeff Hawkins, you cannot mimic brain functions without including a hierarchical system of memory. The lower level has more input/output nodes than the level above it. According to Jeff, you must also take into account "temporal" memory. For example, the human brain has many parts of the brain that handle visual information. The brain may be able to detect a particular object but also factor in the time that the visual event occurred. If you are at the zoo, your brain predicts that you will see animals and animals in cages at the zoo. It is rare that you see a plane take off or land in the middle of your zoo visit. You would have had previous memories or seen pictures of the zoo in the past and parts of your brain activate other things associated the zoo. The context in time is a visit to the zoo. The memory of a zoo visit is probably in a different area of the brain than a trip to an airport. In the case of an airport, you expect to see planes landing and taking off.

Basic Data Mining With Weka

In my post, I present a practical Hello World using WEKA. WEKA (Waikato Environment for Knowledge Analysis) is a suite of machine learning tools and libraries that can be used to mine data.

What is data mining and how could you use data mining techniques? Many enterprise companies are connected to large databases. These databases contain millions of records. Data mining and machine learning techniques are used to find patterns within that massive trove of data. These techniques can also used to filter out noise. Popular email filter software utilizes data mining to remove or categorize spam email.

Hello World Weka for Java Web Server Log Files

I have dozens of Apache web server log files. I wanted to find groups or clusters between some of the log files and the time that a user requested a page on my site. I used WEKA to find clusters and categorize various groups of relevant data.

12_15_10_10_14_03 [HASERR N] log.fileName1[]:Wed 22:14:03 EST 2010 [SIZE 144]
12_15_10_10_14_03 [HASERR N] log.fileName2[]:Wed 22:14:03 EST 2010 [SIZE 121]
12_15_10_10_14_03 [HASERR N] log.fileName2[]:Wed 22:14:03 EST 2010 [SIZE 156]
12_15_10_10_15_33 [HASERR N] log.fileName3[]:Wed 22:15:33 EST 2010 [SIZE 160]
12_15_10_10_15_33 [HASERR N] log.fileName3[]:Wed 22:15:33 EST 2010 [SIZE 146]

The timestamp with hour, minute and seconds are on the furthest column to the left. The middle column contains filename information. There are only four or five rows shown in the example. But the log files contains millions of requests. I determined the data that I want to categorize, then I converted the timestamp log file into an ARFF file format that WEKA requires. WEKA has several tools to convert generic CSV files into a ARFF format. ARFF is essentially a text database with column attributes and rows of the data that you to analyze.

Example ARFF File for Weather Data:
@relation weather
@attribute outlook {sunny, overcast, rainy}
@attribute temperature real
@attribute humidity real
@attribute windy {TRUE, FALSE}
@attribute play {yes, no}
Here is my arff file with web server log data. The attributes consist of the log file name and the rows contain information with a count the server wrote a line to the log file at a particular period of time.

Example arff file for server logs:
% Title: Database for application line count
@relation scan_app_data
@attribute LogXX0 real
@attribute LogXX1 real
@attribute LogXX36 real
@attribute LogXX37 real
@attribute LogXX38 real
@attribute LogXX39 real
@attribute timeperiod real
@attribute class { 'night_morn', 'earl_morn', 'midday', 'after', 'night', 'late_nigh' }

I used the WEKA GUI tools to visualize the patterns. I simply clicked on ./weka.jar to launch the WEKA explorer.

It was interesting to focus on the groups of requests. I could see a cluster of requests combined with errors displayed to the user. After looking at the visual tools, I could easily determine what time period had the most errors and in which log file.

I just wanted to cover some basics. WEKA is mature Java software but the developer and the researcher must do some work to determine which data to feed to WEKA. In the case of the log files, I wanted to cluster log file data, errors and the time period that these events occurred. In future test, I might change my ARFF file to include the web server execution time vs the application requested to see if there is any correlation between the two.




Tuesday, December 14, 2010

Trolling my site again: Taxes, Democrats and more

I want to reiterate this again. I am in essence "trolling" my site. Also, when I troll, I don't normally provide facts or figures. I am just bloviating. I am diverging from my main focus of software development and entering into other realms. To me, technology is easy. Politics is infinitely "complex". In the back of my mind, I think everything is related. For example, with the legislative talk of tax cuts and stimulus and jobs, no one talks about the reinvigorating our work force. We could do that with a focus on technology and education. We could encourage math, physics and engineering programs at the high school level and push incentives to enter into technology program as opposed to "the Arts". But that is another issue that I won't address in this post.

I really want to address the tax cuts and all of that. I guess I will have to profess, I lean more Ron Paul Libertarian. The stuff makes sense. The recent tax cut issue is one of those Libertarian classic topics. And I will make two points.

Point-1. If you are rich or poor, really really rich or poor, you should be entitled to keep your own stuff. It is your stuff. Yours yours yours. The income you receive, however you got it, is yours. Yours.

If you are given a toy or a Christmas card or a car. It is your car, your toy, whatever. We shouldn't have an third party entity (the federal government) make an

Point-2. The American government is one of the richest, most powerful organizations to have ever existed. Not only can we invade another nation (in two weeks), and not even declare war, we can occupy that nation for decades. We have set up hundreds of proxy governments all over the world. The massive amount of American influence is mind boggling. So, why why why are so many Americans excited to fund more federal government. If you let tax cuts expire, raise taxes, then you hand over more money to an organization with a trillion dollar budget. You are taking a small percentage of income from millions of rich American and handing it over to a couple hundred rich politicians so that they hand it over to poor Americans. Now that I said it, it seems that directly asking rich people (like Warren Buffett and Bill Gates and Mark Zuckerberg) to distribute their wealth to poor is a lot better way to distribute wealth than relying of the federal government to do it. Bill Gates can give a poor person hundred thousand dollars without any restrictions (and he has done this). It takes the federal government so long to do anything. Some poor aren't even poor by the time they receive their benefits (bureaucracy). Worse yet, the poor weren't poor to begin with (fraud). But But!! Reaganomics doesn't work. Supply-side, trickle-down economics does not work. It is funny to hear pundits use this language. I guess it doesn't work if you don't actually define what particular aspect of the strategy works or doesn't. I could say, "computers don't work". That doesn't make much sense but it is a valid declaration. "Computers and speech recognition software doesn't work well at understanding garbled speech". OK, that is better. I wish pundits would identify what aspect of lower taxes doesn't work. Right now, they are saying that lower taxes and supply-side economics doesn't create jobs. I don't know if any government policy outside of hiring federal workers (see the recent Census), can actually create jobs. I hope that good economic policy can encourage growth and then companies will hire new workers. It seems a little bit too simplistic to directly attribute Congress and the White House to jobs created or not created in the private sector. I would trust the GDP growth figures during one time period or another. I would trust federal revenue figures. Government policy has an impact on those numbers. Pundits are suggesting that the Bush policies, supply-side economics didn't create jobs. I looked at the GDP growth figures and the job numbers, they number are lower over time during the Bush years. At least the growth rates are lower. And during the Clinton years, there was more economic stability. But, were the economics of those times the result of White House policy or just the events of those time periods. The average GDP growth rate went down over time during the Bush years. But there was a lot of stuff happening. There was 9/11, Katrina, the Iraq/Afghan wars. I would suggest that long wars and major unplanned catastrophes contributed to a loss GDP. We can't tell if it was the cause, but it certainly was a factor. I can't say that tax cuts contributed to GDP growth loss.

I will be honest, I don't care as much as some should, what our government does or does not do. I don't receive unemployment. I don't have kids in the public education system. I don't have close family in the military. I am more a silent observer. To me (I am sitting here up high), I don't understand the premise behind the peons (the poor and middle-class) wanting to take money from the rich peons (the 250k+ households) and giving it to...the federal government (the trillion dollar organization).

I know, I know. If you take money from the greedy rich, then the government will give that money directly to the poor. And the poor will then be rich too. Not only has that never happened. It couldn't possibly happen. The entire premise of wealth distribution is impossible with how the system works. This is not the 1700s. We are not under the rule of some oligarchy. It is 2010. There are 300+ million Americans, some of them have fixed incomes. They work at hourly rates and in salaried positions. If you really wanted to fix a problem. I would start with Wal-mart and McDonald's. They employ 2 million Americans. You could look at retail and fast food chains as well. A lot of Americans work in low-paying jobs. The problem are these corporations that use American slave labor to fund their operations. But they are operating within the law.

We need to tell people NOT to take these low paying jobs. It is such a cost ineffective decision. Once you work at these places, that is less time that you could spend to further your education and building your real value. Your brain is a valuable, valuable commodity. You are not leveraging your resources by doing jobs that machines can do. And what have they done, Wal-mart and the retail companies have introduced machines to do the work that normally people would do. The self check-out is a good example. As opposed to paying someone five or six dollars to manage a register, they added a camera system, an easy to use bar-code scanner and there you go, jobs are replaced. And like most major corporations, they don't slim down their work force with the added productivity from the robots. No, the corporations normally just put humans on jobs that a machine can't do. The Wal-mart greeter that says "hello" when you enter the store is a good example. Seriously, Wal-mart uses productivity gains to make more money not to become a smaller organization. If you notice, the people that work at Target and Wal-mart are all equipped with radios and scanner guns. Wal-mart didn't get rid the people because of technology advances, they just shifted resources. And once again, Walmart is well within the bounds of the law to do so. With the might of 1.8 million employees (and McDonald's has 500,000), they seem to be growing and not shrinking. And human slavery is cheap, the average salary at Wal-mart is $11 a hour. Wal-mart employees are not paid a lot and Wal-mart has a lot of employees. So if you distribute that $11 salary across the 1.8 million works, you could employ all of those workers for 20 million dollars. That is nothing for the type of business that Wal-mart does. My theory is highly, highly suspect. But I hope you get my point. It is very cost effective for Wal-mart to hire people for those menial jobs and cost ineffective for the person that works there.

I want to go back to my point, there are a lot of people that work for these mega-corporations. They don't get paid a lot. And a lot of Americans are fighting to work for these places. You see the same human rights issues and social engineering in China and India. I guess it is different in America because these corporations are huge. Plus, we tend to have better marketing. How can you be mad at McDonald's, the corporation's mascot is a big clown in a yellow jump suit? Who cares that it takes half a work day for their employees to buy food from the restaurant that they work at? Not a well-seared rib-eye steak and champagne from a top New York restaurant. No, two big mac combos at McDonald's can still be a bit pricey. In America, it isn't just one broken down factory. We are looking at a hundreds of thousands, a million jobs. And all of their employees aren't making 250k a year. No amount of federal government intervention will substantially push up the hourly wage of a Wal-mart employee.

I am still swinging around back to my point. So we have this slave labor thing that is happening in America. It is bad and probably a lack of government is at fault, but it doesn't mean that we increase taxes on the higher income earners. The taxes probably won't be distributed to the really poor. The increase government revenue will get spent on earmarks and defense. I don't know what the legal procedures are with taxes and the deficit, but the reason we even have a deficit out of control spending. Tax cuts or lack of tax cuts still don't change the government's trillion dollar budget. If you want to address the deficit problem, I would cut non-vital government functions. I don't know have fifty thousand troops in Japan is a vital government function, when Japanese people don't want us there. I found it funny that the Congressional Budget Office included speculative revenue that they would have received from tax revenue if the Bush tax cuts expired in their figures for why the deficit is so large. It would be like suing an employer that never hired you, suing for funds that you should have received if you worked for them. The federal government includes tax revenue that "they should have" received. And guess what, I am excited to tell you, that there is a US debt ceiling. So, once the federal government has too much debt, then the government will shutdown. But it isn't like the ceiling in your house, where the height of the ceiling is mostly at a fixed position. No, the Congress can raise the ceiling. Is the power to raise the debt ceiling some hidden aspect of our law. No, they raise it every couple of years. The debt ceiling is set around 14 trillion dollars and they plan on raising the value in a couple of months. Also, if we reach the debt ceiling and Congress does not raise it, I am still a little suspect that government will actually shutdown. They will just create another law to subvert the government shutdown (probably).

I know, the Democratic position is to fight for tax increases on the upper income earners. It is Democratic dogma. It is Republican dogma to fight against those tax increases. To the Republicans, if the Democrats don't budge and you won't budge, I am surprised you don't look at other ways to decrease taxes (see Obama's recent tax framework). I wouldn't mind increases in other areas. We could start with increases for mega corporations. We should create a tax just for BP and their negligence in the oil spill. So, we can get more tax revenue, fix the deficit and make everyone happy. People just have to be more creative. But my position does still stand, I still feel those greedy, greedy rich people should be able to keep as much of their money as the law allows. And yes, rich people have the power to avoid taxes. And sometimes, we have tax limits in the tax code that make it unfair for the regular people. For example, there are limits on the payroll taxes that you pay. With the FICA tax (Federal Insurance Contributions), you are not taxed on income earned from capital gains/sale of a stock trade. So the tax code hasn't caught up to trends in our economy. If that is unfair, then change the code so that the really rich pay their fare share. Remove the tax limits or address capital gains. Now everyone is happy.

Up next, a post about machine learning and Numenta's nupic!

Saturday, September 11, 2010

Anime Reviews: Cyberpunk/Horror/Adult/Thriller....

What is Anime? Google it. Anime is Japanese animation. Animation that is not necessarily targeted for kids. In fact, some Animation can be pretty rough and make a 40 year old squirm. Basically, Anime has characters and culture, stories, plots. If you like interesting stories, then you will like most of the popular Anime.

What is the difference between Manga and Anime? I am American and usually just refer to anything that moves and is from Japan as "Anime" or Japanimation. But that isn't entirely accurate. There are some Anime TV series/movies that were Manga comic books in Japan and then made into movies. Manga to Anime. Manga is Comic Book in Japanese. If someone says, "Fullmetal Alchemist is a great Manga". I guess they could refer to the comic book version of Fullmetal or the TV adaptation. But normally they are referring to the comic book. Anime can be an animated series derived from a Manga.

Popular Adult Stuff

There are many genres of Anime. I like the adult themed stuff. Horror, Cyberpunk, Sci/Fi etc. With the adult themed Anime, you get similar story lines, violence and action that you would get from a Hollywood blockbuster. The difference is that the Anime is animated. When you think Cyberpunk, think Blade Runner. Cyberpunk focuses on technology, cybernetics, robotics but culture is at a lowpoint. Popular cyberpunk Anime focuses on wealth by big corporations but poverty is rampant among the lower classes. You see this with series like Ghost in the Shell, Akira and Ergo Proxy. Why cyberpunk? It is for those that like technology, sci-fi and a bit of nihilism.

What is some popular Anime?

Ghost in the Shell (theme Cyberpunk, rating = 11/10) - Ghost in the Shell is the iconic Cyberpunk series. It is cyberpunk, alongside Blade Runner. I can't even review Ghost in the Shell. It is the best of the best and you should get as many of the TV series and movies as you can. I encourage you to watch every episode. That is my review. Ghost in the Shell is a story about cyborgs and robotics fighting crime. That is the core of the series. But my short synopsis doesn't do justice to the intricate story lines. Just watch it.

Ergo Proxy (theme Cyberpunk, 10/10) - Ergo Proxy is popular but not as familiar as Ghost in the Shell. It is Cyberpunk with a mix of fantasy, horror and sci/fi. It is a long series and has a solid, dark theme. Ghost in the Shell is a detective cyberpunk series. Ergo Proxy is more fantasy and dystopia. Most of the series involves the main character running from the oppressive society.

Monster (theme Detective, rating 8/10) - Monster is pretty basic detective/conspiracy story. A doctor is falsely accused of murder and other crimes. He goes on the lamb and tries to find the sadistic conspirator. I gave Monster a score of 8 because the stories are pretty basic and plain. But it still is an enjoyable series.

The Last Exile (theme Steampunk/Military/Flight?, rating 9/10) - What is steampunk. Somehow in Japanese Anime world, steam and diesel? can be used to fly planes and control machines. Generally these steam punk series target a fictional time period around the early 1900s. Ironically, you have steam powered robots and other machines that seem quite advanced. Anyway, The Last Exile is a steam punk/flight series that focuses on two friends that are caught up in a war. A lot of the series focuses on their relationship and how the war tears them apart. It is solid Anime. Good story, animation. At times, there is too much a focus on the drama of their lives as opposed to the war going on.

Pumpkin Scissors (theme Military/Detective?, rating 7/10)

Heroic Age (theme Science Fiction)

Other Notable Shows:

Black Lagoon (8/10, part fan service, lots of bad language)

--- Berlin Brown (2012)
-- Ron Paul 2012

Friday, September 10, 2010

Movie Review: Girl with the Dragon Tattoo (rating 7.5/10)

**Contains Spoilers**

I rated this film a little lower than the movie review sites and user ratings on
IMDB. The film suffers from two problems. First problem: It is a basic, very obvious thriller movie. In the beginning of the movie, when a character tells you, "One of these persons in the picture killed her". And the movie leads towards one of the people actually killing that person. Who cares, you already know what is going to happen. And there are only two or three suspects. So, the thriller aspect of the movie isn't that interesting. It is unfortunate that they spent all of this energy to build up the suspense of the potential killer, when we already know it is either that guy, that guy or that guy. And to be honest, the older killers aren't even that interesting anyway. I don't care if any of them were the killers. They were Nazi's and/or Nazi sympathizers. So, the thriller elements in the movie weren't that interesting to me.

Second point: Outward displays of graphic misogyny. I don't know if the writer hated women or was a passionate fighter for the female cause. Either way, women are treated like crap in this movie. There are a couple of graphic rape scenes. So graphic, it took me a hour into the movie to even get the rape scenes out of my head. There is female and male rape. If you wanted to describe the overall theme of the movie. The theme is misogyny. The killer (shocker) kills women and the main female character was apparently raped in her past and hates women. And is continually treated like crap by other men.

So there are two issues; obvious ending and misogyny. Despite those issues, the movie could be one of the best pictures of the year. It has great direction and style. I really liked the main male character and the actresses. And wow on the actress. I hope Noomi Rapace gets every international movie award you can give out. Yea, she was the girl that was raped. She will probably get an Oscar or some award. Everything is great up to a point. I wish there was more conspiracy involved. The main character sleuths work hard at their case. But, I didn't really care about the case. And who knows, maybe the book did a better job at making us away of severity of their crimes. The movie didn't do that. You get the impression that something is going on and it is bad, but you don't feel the sense that it is a major conspiracy.

"Oh, he is a crazy, serial killer. Oh, OK. Well just arrest him and be done with. And you might save some time and just arrest all of them and search their houses. Problem solved".

In Summary: Great direction, great setting and mood. Great acting. Great build up. And overall a good movie. But there was a little bit too much man on woman violence for me and I bet the plot from the book was dumbed down too much for the movie. Either way, it probably will beat out most Hollywood movies this year.

Friday, August 27, 2010

Practical AI: Using ProgramD AIML platform

Using ProgramD AIML bot as a personal assistant



ProgramD is a fully functional AIML bot engine that is implemented with Java. It supports multiple bots, it is easy to configure and runs in a GUI application and also under a J2EE environment.

AIML, or Artificial Intelligence Markup Language, is an XML dialect for creating natural language software agents.

When the AIML markup language is loaded for your bot, then you chat with the bot. Once you become familiar with the AIML format, you can then build a simple personal assistant bot. For Java developers, you may add Java keyword definitions or links to useful resources.


To use ProgramD, you can use the mirrored binary/source version provided on this site (programd.zip) or visit


The version on this site includes jetty webserver configured with a programd web application.

Launch the GUI application

Navigate to:

the HOME\bin directory and click on the simple-gui-console.bat icon.

The ProgramD GUI application should launch.

At the prompt, enter the commands and dialog to interact with the bot. I entered "hello" and "java".


The bots are configured in the PROGRAMD/conf/bots.xml file.

In the screenshot below, the ../aiml/alice/.aiml and ../aiml/java/.aiml AIML files are loaded into the system.

The AIML XML dialect looks like other pattern matching formats. An input pattern is defined and the bot will respond with the matching output.

Running with jetty web servlet container

Jetty is provided in the download. It is configured for the programd webapp. Navigate to the PROGRAMD/jetty/jetty directory and invoke start.bat or java -jar start.jar. Jetty will launch. Use your web browser and navigate to:






Monday, June 7, 2010

Trolling berlinbrowndev: On the Maddow and Rand Paul Interview

Rand Paul made some controversial statements on Civil Rights... I am responding to the interview.

He doesn't have to answer the question directly on Civil Rights. He isn't setting up businesses that doesn't allow African-Americans or gays. He is attempting to serve his district as a legislator. I just don't see the question on private business discrimination as a major topic. Of course, no one goes into business to discriminate. At the same time, it is hard to stop businesses from very explicit, out right discrimination. But, hopefully the people will stand up against that business. In a political debate, under the civil rights act, a business can't discriminate based on race, religion. But in theory, a business can discriminate based on what kind of clothes you wear or how you smell, whatever. I don't think the topic Maddow brought up was very interesting or relevant.

People want to attack Paul? I say attack Maddow. What a silly series of questions. It smells of a cheap Bill O'Reilly. Most Americans won't setup a private business and then discriminate against people. It isn't good for business. But in theory, a business can covertly discriminate. What is the issue here? Is the government really going to spend time going after businesses that might discriminate against people (MSNBC included, do they even have any black hosts?) or should the federal government deal with more pressing issue.

Plus, it isn't the 1950s. Times have changed. There are some aspects of the Civil Rights Acts that might not be as relevant today. For example, they mention hotels, movie theaters. What about discrimination on online sites? Can I setup jdate for jewish people and not allow the amish to join my site. Some people might not complain about that. Would the government have a case against jdate or 100kplus jobs.

Civil rights laws are tough. So Maddow's incendiary questions are difficult to answer.

Trolling berlinbrowndev: On Mac/Linux/Windows Computer Viruses and Trojans

Why do some users get computer viruses and others don't?

I swap between using Win, Linux, Mac. I haven't gotten a bad/crippling virus on my Windows machine because I am careful. And I even do simple things like turn my machine off when I am not using it.

For windows machines, they are just insecure by design. Most people don't even use Windows with the knowledge that they can setup other user accounts. So they don't setup less privs accounts. There is one, login, one machine and a virus has a potential to disrupt that machine.

I don't know if Viruses, Trojans always get in this way, but Windows has some very insecure APIs. The ActiveX is basically a Win API component that can be triggered by the web or desktop software. ActiveX is a basically a gateway into your machine, if you the hacker know what you are doing. And now you have PDF, Javascript, Flash and all of these filetypes and runtimes that can read web documents. You read the document, a trojan is downloaded on your machine. The trojan launches ActiveX. ActiveX is a world into the WinAPI. You can add registry settings, setup windows services, etc, etc.

So, there are major flaws with Windows (at least WinXP and prior, I only know Windows XP, I haven't used Win7).

I am not bashing Windows, I am just pointing that there are major security issues. And these issues have been around for a decade or more. So, virus writers have been writing for Windows. The Win32 API hasn't changed much. And it is popular. It is a win/win if you are hacker writer.

On Windows, I haven't gotten a crippling virus. I watch what sites I go to. I only use Firefox. I use a less priv'd account for general use. I disabled Flash.

Trolling berlinbrowndev: On Immigration

We here at berlinbrowndev like to cover all topics. I am posting some comments that have I have posted on various sites on various topics.

"An estimated 50,000 Thousands of people walked five miles through the streets and heat of Phoenix on Saturday in protest of Arizona’s new immigration law, which is slated to take effect July 29."

I respond to the immigration marches and took a controversial position...

From what I have heard from the other side, including Arizona cops.

The law was created to curb illegal alien activity which the federal government won't do. Basically, the law was targeting the federal government in their unwillingness to curb an increase in illegal immigration crime. That includes the "rape trees", where coyotes and illegals rape people along the border. Also, coyote's that do illegal human trafficking and sex trading. Also, many Arizona kids have their social security and identity information stolen.

Also, the language in the bill is similar to the federal laws on illegal immigration. The states just want to give misdemeanor crimes maybe to curb the increase in illegals in their states. According to state officials, it doesn't look like the federal government is doing enough. That is the main legal issue I have. Normally state governments can't enforce federal law. E.g. Arizona can't wiretap people under the Patriot act.

"First, the person ultimately responsible for signing the bill into law, state governor Jan Brewer, can’t come close to verbalizing what, precisely, an alleged illegal immigrant might look like, admitting to reporters during a recent news conference, "

It is not so much looks but in the finding of illegal activity, the Arizona cops should be allowed ask about status and apply misdemeanor charges. Even federal laws requires that you have your papers if you are on a temporary visa or in the process of legal immigration.

"It’s one thing for a lawmaker to have a vague notion of the problems they want proposed policy to solve. "

I mentioned those above.

"The driver is white-looking but can only produce his license to drive, which isn’t proof of citizenship. Will the officer detain the suspect? Of course not."

I don't think the goal is to arrest people just because they might be illegal. But, in the process of a crime, like human trafficking, the cops may detain a person for being an illegal.

So, if the person is doing something illegal, why can't they just arrest them for that?

Apparently cops can't because trafficking and other similar laws fall under federal laws. But if an illegal is doing something suspicious, cops can use the SB1070 to stop them.

From a legal standpoint (I am not a lawyer), it seems sound. But like others have said, it may be abused.

Illegal/undocumented people are abusing the law by being here illegally. They are side-stepping how others have taken years to gain their citizenship.


Like this guy, he is human smuggling...

I guess it isn't as much a problem if we cherry-pick the scenario where a family comes here to work. But that isn't what the cops want to use the power for. They are trying to go after human traffickers and drug smugglers, adding the illegal immigration charge onto other charges. I can get the youtube video of the Phoenix and other Arizona police chiefs.

"Fifteen percent of state prisoners are illegal immigrants. Phoenix has become a hub of human trafficking, and it has kidnapping numbers that rival cities in Mexico because of smugglers who hold illegal immigrants hostage in drop houses."

Say, if a undocumented drug runner shoots someone, you want hold them on the gun charge but also the illegal immigration charge... I am thinking for legal purposes.

Why couldn't the police just charge them with the crime that they were originally stopped for? I am guessing that they want to do additional legal book-keeping. It looks like a lot of human trafficking, drug laws, blah, blah fall under federal law. Maybe Arizona wants to ADD this additional charge to keep track of the document violators without red-tape from the federal government

I think the Arizona immigration was created for two reasons. And the actual people who have created the law have basically said this:

1. Send a message to the federal government. Enact some kind of illegal immigration.
2. Some kind of legal scenarios where you want to keep track of illegals that break the law.

The law and local government operates almost like a business. The state and city governments have state and local funding. They collect tax revenue. They pay cops. They pay fireman. Part of the cop budget goes to keeping the peace, making sure the rule of law is followed, blah, blah. They could have harsh laws and enforce them. If you are going 1 mile over the speed limit in a car, you are ticketed If you are jay walking, ticketed. They can arrest and check people that might have an ounce of weed on them.

This "business" still has to manage resources properly. They may task Arizona cops with dealing with drug cartels at the border or arresting DUI offenders. Solving murders. For whatever reason, they believed that dealing with the 500k illegals in Arizona was a problem for them. So, they created a possible law to add an arrest charge to being here undocumented.

The state business does factor "racism" into. What race is hateful towards whatever race? Do you really believe that a state government went through hearings and state sessions to come up with a racist law? Arizona State Legislature: "How can we be more racist?"

Ask yourself this, would the city governments spend their resources to arrest legal citizens, put them in jail, send through the courts and then possibly facial charges for detaining people? Or would they try to use the law to curb problems associated with illegal immigration. Like I said, it comes down to a resource issue. Most police forces are strapped for cash. I can't imagine that the Arizona cops are going to get into just arresting random people.

Especially in the name of racism. At some point, people need to realize that we live in a diverse culture. When I say that, there a lot of people in political positions that AREN'T white. So, it is hard to claim racism on this law, when it is possible that immigrants helped design the law. California has an immigrant governor. There are a lot of people in Arizona that are Hispanic that serve at the state level.

Is it possible, heaven forbid, that the illegals that are here illegally ... are the problem? And amnesty and relaxed federal laws that contribute to so many illegals being here are also a problem.

I have heard that illegals don't commit as many crimes. Or that they are just hard working people. That is really non-issue. A lot of people arrested are hard working. Drunk drivers, habitual speeders, the guy stealing a loaf a bread, marijuana users. But (for whatever reason), these laws are on the books and sometimes they are enforced.

On the illegal immigration issue, there could be a host of reasons to detain people that remain undocumented. There are laws for legal citizens (say operating a vehicle) to get "documented". We have to have driver's license, motor vehicle registration, proof of insurance. Aren't you pissed if someone gets into an accident and they don't have a license or insurance. Or worse yet, what if they don't have any documentation as a legal citizen at all?

It is a law. It is up the police to decide when to use the law. The police can arrest you for any suspicious behavior. Why are people suddenly complaining about this particular law?

It is possible that the police don't have infinite resources to arrest all brown people and then go through the court process only to find out that the people won't do anything. What a waste of time. It is possible that the cops want to deal with people committing crimes and they also want to keep track of legal status by adding an additional charge.

OK, that is two.

But if you wanted people to be racist, they will be racist. How does a cop asking for immigration status in the process of some other violation and misdemeanor charge and a $1000 fine contribute to racism.

For example, it will not make sense for Rhode-Island to have harsher immigration laws, but I could see where Arizona might add additional charges to immigration violators.

(image from http://upload.wikimedia.org/wikipedia/commons/6/6a/NashvilleProtest2006.jpg)

Sunday, February 28, 2010

AI Notebook - AI and Tron Bot

Java OpenGL and the Google AI Tron Bot Challenge.

The Challenge

Google and the University of Waterloo a Computer Science Club (Waterloo, Ontario, Canada) have created an AI challenge. This is more algorithm AI and not Turing Strong AI. "The objective is to create an AI to play the classic game Tron, Surround, Snafu, Snake, etc." You must submit your entry by Feb 26th, 2010. Imagine Tron, there are two opposing players on a N x N (say 50x50) grid and the goal is to trap the other player. The players can move north, south, east, west in the adjacent squares but into a wall or the other player's previously occupied squares. I thought I would try my hand at the challenge. I was actually quite pleased with their handling on the contest. There are normally about 600+ active bots in the challenge. The website provides great stats on how your bot is doing. There is a graph with wins and losses and a javascript application that can replay any game. I really didn't want to talk about my particular entry, but I wanted to show you how I tested my bot with Java's OpenGL (jogl) library. The default google challenge starter pack comes with some crude console based game output. I needed something more visually appealing for my testing. I created a small testing environment in Java. I was able to test my particular bot but the bot and the OpenGL initialization and rendering are embedded with the bot. If I have more time, I hope to separate a running bots from the OpenGL rendering. It would be nice for the 3D window to bind to a socket connection and wait for input from several bot clients and render the game that way.


OpenGL and jogl (Java Binding for the OpenGL API)

There is one benefit when working with Java, you can interact with a number of different mature libraries. Even though, you normally think of writing OpenGL games or graphics programs with the C++ programming language. You can just as easily use OpenGL with Java. OpenGL is a framework and API for writing 2D and 3D graphics. Most programming languages have a similar interface to OpenGL including initialization, rendering vertices and displaying the content. OpenGL provides a lot of the legwork for rendering fast through the 3D graphics pipeline on your machine, the core OpenGL libraries do not provide a framework for developing complex games or demos. OpenGL is as low-level a library as say the Socket API is for writing web applications. Also, I would strongly encourage you to use OpenGL for both 2D and 3D graphics. The framework is highly portable and the visualizations are extremely fast. I created two versions of the tron board, one in 2D and the other in 3D. Despite your fears about 3D or 2D graphics, OpenGL has always remained fairly simple for getting starting. Like a lot of other graphics frameworks, OpenGL requires a set of initialization calls and then subsequent double buffering display routines. In Java, a couple more calls are made to create a GLCanvas object and then attaching the Canvas to a Java Swing JFrame or other Swing widget.

To get started, visit the jogl website and download the jogl libraries. I am using jogl version 1.1.0. I needed to ensure that jogl.jar, gluegen-rt.jar gluegen-rt.dll, jogl_awt.dll, jogl_cg.dll, jogl.dll were in my runtime classpath. For Eclipse, I also needed to add the jogl directory to the java.library.path setting.


Once the libraries are included, you can start with developing your Swing JFrame/main application.

Jogl Hello World

This is the simplest Java OpenGL application you can create:

package org.berlin.pino.test.functional.jogl;

import java.awt.Color;
import java.awt.Frame;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.media.opengl.GLCanvas;

public class Basic {
public static void main(String[] args) {

Frame frame = new Frame("Hello World!");
GLCanvas canvas = new GLCanvas();
frame.setSize(300, 300);
frame.setLocation(400, 400);
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
} // End of the class //

Java Open Nehe Game Dev Example, Rendering a Box

package org.berlin.pino.test.jogl.box;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

import javax.media.opengl.GL;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLCanvas;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.glu.GLU;

public class GLBox implements GLEventListener,
MouseListener, MouseMotionListener {

private final GLU glu = new GLU();
private float rtri = 0.0f;
private float rquad = 0.0f;

public static class Builder {

public GLCanvas buildCanvas() {

GLCanvas canvas = new GLCanvas();
canvas.addGLEventListener(new GLBox());
canvas.setSize(100, 60);
return canvas;

} // End of the Class //

public GL renderGLScene(final GLAutoDrawable drawable) {

final float shiftXPos = 1.2f;
final GL gl = drawable.getGL();
gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); // Clear and depth buffer bit
gl.glLoadIdentity(); // Reset The View
gl.glTranslatef(-4.0f + shiftXPos, 0.0f, -7.0f);
gl.glRotatef(rtri, 0.0f, 1.0f, 1.0f);

gl.glBegin(GL.GL_QUADS); // Draw A Quad
gl.glColor3f(0.0f, 1.0f, 0.0f);
gl.glVertex3f(1.0f, 1.0f, -1.0f); // Top Right Of The Quad (Top)
gl.glVertex3f(-1.0f, 1.0f, -1.0f); // Top Left Of The Quad (Top)
gl.glVertex3f(-1.0f, 1.0f, 1.0f); // Bottom Left Of The Quad (Top)
gl.glVertex3f(1.0f, 1.0f, 1.0f); // Bottom Right Of The Quad (Top)

gl.glEnd(); // Done Drawing The Quad

return gl;


public void display(final GLAutoDrawable drawable) {

final GL gl = this.renderGLScene(drawable);

public void displayChanged(final GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged) {


public void init(final GLAutoDrawable drawable) {

final GL gl = drawable.getGL();
System.err.println("INIT GL IS: " + gl.getClass().getName());
System.err.println("Chosen GLCapabilities: " + drawable.getChosenGLCapabilities());


gl.glShadeModel(GL.GL_SMOOTH); // Enables Smooth Color Shading
gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // This Will Clear The Background Color
gl.glClearDepth(1.0); // Enables Clearing Of The Depth Buffer
gl.glEnable(GL.GL_DEPTH_TEST); // Enables Depth Testing
gl.glDepthFunc(GL.GL_LEQUAL); // The Type Of Depth Test To Do
gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST); // Really Nice Perspective Calculations

public void reshape(final GLAutoDrawable drawable, int x, int y, int width, int height) {

final GL gl = drawable.getGL();
System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR));
System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER));
System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION));

if (height <= 0) {
height = 1;
final float h = (float) width / (float) height;

gl.glViewport(0, 0, width, height); // Reset The Current Viewport And Perspective Transformation
gl.glMatrixMode(GL.GL_PROJECTION); // Select The Projection Matrix
gl.glLoadIdentity(); // Reset The Projection Matrix
glu.gluPerspective(45.0f, h, 0.1f, 100.0f); // Calculate The Aspect Ratio Of The Window

... Click event methods

} // End of the Class //

My Bot

I am using kind of a mishmash of broken algorithms. Basically, use my post for finding out visualizing my bot. I would go elsewhere for a good algorithm for beating the google challenge. My bot is hovering around 290 / 600. It was something I created over a couple of hours. I started out with the random, select a valid direction. Then I went to favoring an order of directions. It seems that the best algorithm is a combination of a working flood-fill pattern, a min-max strategy in close combat and possibly a good attack strategy in an open environment. I used a simple min-max strategy that found good paths with open squares. My score/evaluation was based on 1 point for the the number of open squares for a particular move. Here is a more robust set of strategies on the Waterloo forum:

"The evaluation function is simple. Partition the board into squares OUR bot can reach first and squares THEIR bot can reach first. I think of this as a Voronoi partition of the board. The score is simply count(OUR squares) - count(THEIR squares)."


Basic Favor Order Algorithm:

public void makeLogicMove() {

// If dead, don't make a move //
if (this.isDead()) {
if (this.getVerbose()) {
System.err.println("Making logic move for aibotscorer - " + this.getMoves().size());
final Move lastMove = this.getLastMoveNull();
if (lastMove == null) {
this.addMessages("-3000-AI: using default move, last move null");
// Revert back to the default move

final Move north = lastMove.decy();
final Move south = lastMove.incy();
final Move east = lastMove.incx();
final Move west = lastMove.decx();

final Stack stack = (Stack) this.getMoves().getMoves();
final boolean nb = validateMove(stack, north);
final boolean sb = validateMove(stack, south);
final boolean eb = validateMove(stack, east);
final boolean wb = validateMove(stack, west);
if (wb) {
if (nb) {
if (eb) {
if (sb) {

Source for the Java OpenGL Code and the Tron Bot


// Packages and Code of Interest:
package org.berlin.tron.gl (GLGridApp)
package org.berlin.tron.gl.game (GL3DGridBoard)

Note: I did include the source for the bot. By the time, you figure out how to get it deployed and usable for the Google challenge, you probably would have found it better to have created your own.
Enter a comment:


Sunday, January 17, 2010

Download and Cache Youtube/FLV files with Firefox

If you want to cache/copy youtube videos for later use, go tor you firefox cache and just copy the flv files over.

My Name\Local Settings\Application Data\Mozilla\Firefox\Profiles\rxxs25wm.default\Cache


The filenames are like:

Add .flv as your file extension and then open a valid flv player.

Look for the files that are over 2mbs. And normally you have to watch a complete youtube video, wait until it caches and then close firefox for the cache to be saved to disk.


And another note, I watch a lot of youtube videos. Every youtube download may cost you 15mbs of bandwidth. So I would consider watching the videos from file.

I ate up 20gigs of bandwidth last month. I think my isp is considering charging me extra.

Friday, January 15, 2010

A Look at the Internet Troll

What is an Internet Troll?

"In Internet slang, a troll is someone who posts inflammatory, extraneous, or off-topic messages in an online community, such as an online discussion forum, chat room or blog, with the primary intent of provoking other users into an emotional response[1] or of otherwise disrupting normal on-topic discussion." -- Wikipedia.

Here are some classic responses from top trollers on the site, CrazyOnTap. If you look at most of the responses, you cannot even tell what is being discussed. This is the classic tell of a troll post. The topic of discussion could be economics or the Iraq war, it doesn't matter because the classic troll will completely stray off-topic.

Discussion about Creationism:

"that's from reddit.
and this is a troll. foad." -- argv

"well, i have it on good authority that you have some batshit insane ideas as well.
the difference? you lack the courage of your convictions to post what you believe on your cubicle." -- argv

Discussion about Jaron Lanier and the recent NY Times entry on the hive-mind:

"Dude, I can't even take you seriously anymore, when you ask too many of these questions in a row." -- STH

"To answer the original, stupid, and banal question: no, CoT isn't a mob. Neither is the Internet.
The reason that it's a stupid question is that you can't simplify the dynamics of a huge system of interaction to a yes or no" -- Ward

On the tragedy in Haiti:

"Toast doesn’t toast toast, toast toast toast." -- argv

On Java vs C Performance:

"Hell that article is ugly. I couldn't even bring myself to skim it." -- Wayne

On Tiger Woods

"you probably think that because he's black, right? or maybe it's because of the lifestyle you lead?" -- argv

There you have it, trolls will start discussions about nothing.


-- http://crazyontap.com
-- Dodo bird image from wikipedia.


-- Ron Paul 2012