Friday, October 22, 2010

A server client socket example in java

Well I wrote this in eclipse in preparation for a school project, the idea was to write a server that can take and talk to multiple connections at the same time, or send data to a specific client. You must import the package in eclipse to run unless you want to compile from command line.

Download It Here:
http://gitorious.org/simple-server-client-messaging-experiment/simple-server-client-messaging-experiment/trees/master

To start the server: navigate in the package explorer to src> MultiConnectionTests> MultiConnectionServer.java and  right click, run as "Java Application" you may get a firewall warning, just allow it. The server uses the console for its io.

To start a client: navigate in the package explorer to src>Tests>hostageclient.java and right click run as "Java Application". This uses a swing interface for its i/o. It take the ip of the server as a cmdline instruction and assumes localhost if none is given.

Once you have a server and one or many clients open you can start communicating. The client must talk to the server so all you have to do is type into the text box at the bottom of the applet window to send a message to the server. The server however can talk to all clients at once, or one at a time. Each client is given a number when he connects to the server, if you want to talk to a single client, then prefix your message with the space separated client number. EX:

server~$ 1 hi there client one

sends the message "hi there client one" to client 1. If you want to send a message to all clients, you simply dont put a number there.


server~$ hi there all

sends the message "hi there all" to all the clients.

Balling Eh?

Thursday, October 21, 2010

Database Closure and Candidate Key Solver

This program uses sets to determine all the candidate keys and all non trivial closures of a given a list of single letter attributes and a set of functional dependences. Written in c++. As a learning exercise for my database class


TODO:
-make it find canonical covers

get it here, you will not need git to download 
http://gitorious.org/database-closure-and-candidate-key-solver/database-closure-and-candidate-key-solver/trees/master


Colloquium Paper
10/18/10
President Meets Representatives from Vulcan!
In a incredible turn of events the President of the United States as well as the leaders of several other nations have met with the Alien race called the 'Vulcans'. The crucial initial meeting was almost jeopardized by a group of political activists and conspiracy theorists that claimed a rendezvous on the Vulcan's nuclear powered space ship could simply be a clever ruse by the aliens to assassinate or assimilate the leader of the free world and his compatriots. Arguing that the ship's powerful reactor could easily release enough radiation to fry the President, the activists lead a full media assault against the meeting. The various world leader began to suspect the worst upon hearing this news and nearly all but the President refused to attend. While the Vulcan's fair skin, pointy ears and psychic powers might insinuate a bad attitude, their reaction to the activist's theories couldn't have been more compliant and logical. The Vulcans teleported all of their ship's reactor designs directly to the President's Oval Office and gave the President their personal assurance that no harm would come to him or the other leaders. Sources inside the White House claim the the reactor is powered by cold fusion and, stored inside a lead lined cavity in the heart of the ship. Despite the obvious proof from the teleportation device that the Vulcans could easily harm the leaders without an elaborate ruse; there was much concern over the leaders safety and the long term effects of the radiation. Conspiracy theorist Duke Taft argued that the radiation was designed to kill the world leaders in the long run and would simply serve to create mass political instability across the globe after their death. At which time the Vulcans would seize control and experiment on us. There was considerable confusion amongst the various world leaders upon reading Luke's blog post. Undeterred the President reviewed the reactor documents and after discussing them with his Science Staff, he concluded that the ship released about 80 rem of radiation. This number only fueled the activists concerns, but the President, determined to further humanity argued in a golden oratory that a radiation level of less than 100 rem was safe for healthy humans. “My health will remain unaffected by the radiation on this ship. In what is described as a 'threshold' effect my body will naturally repair the damage of the radiation below 100 rem. The long term possibility of cancer is not a danger as well, because of the limited time I will be in the ship. The cancerous effects of this limited dose of radiation would come long after my presidential term, if ever. As a result I have concluded that there is little health risk, the Vulcans and I will meet in their ship on Wednesday”. The activists and world leaders were put at ease by this news excluding the dictators and monarchs as their 'presidential terms' would never end. Regardless of their lack of attendance the negotiations continued as planed. The summit held between the world leaders, led by the President of the United States and the leader of the Vulcan people and the Vulcan High Counsel was reportedly a complete success. Not only did the President return unharmed but it seems that the Vulcans pose no threat to us and have even offed to take several emissaries back to their home world to sample its culture.
If you are looking for a program like artmoney on linux apparently scanmem is a good eqivilent. I have been looking for something like this for some time, so this is very exciting for me. It looks like its got a bit of a learning curve though. Let me know if you know of any, graphical or not programs that do this. GDB seems promising. Its in the ubuntu repo

sudo apt-get install scanmem