Posts

Wolfram's Cellular Automata, A New Kind of Science and Example Squaring Rule (2)

Image
Overview - Playing the Game Of Life When most computer users upload a profile image from their desktop to Facebook's website they don't stop to think about the simple binary math rules that are fundamental to most digital devices. We realize that 4 gigabytes of RAM is more memory than 512 megabytes but we don't visualize the logic chips that are involved in an xor $0x100, eax operation for a 32-bit CISC processor. Software developers have to consider memory management or how a computer's operating system loads their programs into memory. They don't normally consider VHDL logic circuit designs, the data paths, arithmetic logic units or the millions of transistors that make up a modern CPU. Those low-level details have been intentionally hidden from the user application developer. The modern CPU may have changed dramatically over the last decade but at the heart of early digital computing were simple Boolean operations. These simple rules were combined togeth...

Internals of the OpenJDK - HashMap

Image
Here is the implementation of HashMap from OpenJDK 6.  It is interesting how simple it truly is.  Essentially HashMap consists of an array called 'table'.  On the 'put' call, we use the hashcode of the key and then call another hash function, then convert that into an index into the array.  Place the 'value' object at the index array position. OpenJDK HashMap Implementation

Basic word frequency analysis

Image
Here are some interesting terms in the Democratic presidential debate from 2008: I believe we're at a defining moment in our history. Our nation is at war; our planet is in peril.... ------------------------------- Total Count of most terms : 9125 Interesting Word Freq Count: 1952 ------------------------------- id=1 ct=112(39.16%) term=think id=2 ct=101(35.31%) term=applause id=3 ct=97(33.92%) term=clinton id=4 ct=97(33.92%) term=people id=5 ct=85(29.72%) term=senator id=6 ct=66(23.08%) term=health id=7 ct=62(21.68%) term=obama id=8 ct=56(19.58%) term=care id=9 ct=56(19.58%) term=blitzer id=10 ct=47(16.43%) term=right id=11 ct=44(15.38%) term=president id=12 ct=40(13.99%) term=country id=13 ct=35(12.24%) term=make id=14 ct=34(11.89%) term=plan id=15 ct=32(11.19%) term=question id=16 ct=30(10.49%) term=believe id=17 ct=30(10.49%) term=important id=18 ct=28(9.79%) term=issue id=19 ct=28(9.79%) term=take id=20 ct=27(9.44%) term=time id=21 ct=26(9.09%) ...

Just some code

Image
Just some code
jdistprop Distributed Property Files With Java This project supports distributed property files for easy loading with Java projects. This project is a solution to this problem: In a J2EE environment, we are normally used to storing text in a property/resource file. firstName=First Name someOtherData=This is the data to display on screen, from property file If you are in an environment, where it is difficult to update those property files on a regular basis, what architecture are developers using to change text/label content that would normally reside in a property file? Or let's say you need to change that content before re-deploying a property file change. One solution is to store that in a database? Are developers using memcache-db? Is that usually used for caching solutions? Would you use a solution outside of the java framework? Like a key/value datastore? memcachedb? http://code.google.com/p/jdistprop/

Build a java virtual machine that is actually readable/modifiable for Win32

Is it possible to build a Java virtual machine for Win32 in an sort of understandable way?  It is mostly impossible.  The OpenJDK build will take hours just to build and will take a day to prepare your environment.   If you aren't a core JVM developer, who actually is going to take several days to prep their environment so that they can hack OpenJDK.  The jikes RVM may work with cygwin/win32 but it is mostly designed for linux or some other open platform.  You are really only left with JamVM.  I was actually able to install all of the dependencies with cygwin and perform a build in 15 minutes.  And then actually edit the C source, add a log statement, rebuild and run against a bytecode class file.  JamVM is the only JVM project that is understandable (20-30 core C files) and the build actually works with a modern version of cygwin. I will go through some of the setup.  It helps to actually install JamVM through cygwin.  Full install. ...

Code snippet of the day: Haskell for the dumb idiot lazy programmers

Image
The euler project problem reads as such, "If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000." Here is one of many implementations in Haskell.  I used a verbose recursive approach, iterate up to 1000 and then build a list with the items of interest.  In this case, 'multiples of 3 or 5'.  The first implementation contains a logging utility for writing a string at each iteration. Figure 1: Euler Problem1 in Haskell Here is the second source snippet, I just wanted to provide something more practical, a log parsing example that you can run against your web log files. Figure 2: Applied Haskell, simply read each line of a file, find a term and output the results to another file. Source: https://javanotebook.googlecode.com/svn/trunk/math/MathServices/docs/haskell