Tag-Archive for » erlang «

Saturday, December 06th, 2008 | Author:

I spent my birthday yesterday polishing up FANG for it’s initial release to the public, after adding some error handling so it would fail more gracefully and adding the ability to parse in files and save the current state of the system to a file for later retrieval. I also did away with the rather hideous use of the process dictionary and moved to an auto balanced tree structure for storing the data.

Over break, I’m hoping to add enough other features to warrant a 0.2 release, which I’d like to have support for soft-processes (ala Erlang), multi-node support and transactional shared memory (using Mnesia). I would also like to add permissions and process jailing for the soft-processes to allow for running untrusted code in a sandbox of sorts.

I’ve started a very simple (and ugly) site to put my progress and releases. You can check it out here and please comment with suggestions or other features you’d think would be a valuable addition. Good luck on everyone’s finals and projects! Have a wonderful break!

Peace and chow,

Ranok

Tuesday, October 28th, 2008 | Author:

For the past few days, I have been slaving away working on my latest creation: FANG, a programming language that I’m hoping will combine some of the best features I’ve found in my studies and remove some of the cruft. It will have scheme/lisp like syntax and Erlang like processes, and some other neat features from other languages I’ve come across. After this weekend, I have a rough start which supports variables, lambda functions, and auto-memoizing clean functions. You can download the source from SVN (username = password = anonymous) and check it out. Please feel free to comment with features to add, or things to change.

Features I want FANG to have:

  • Clean scheme/lisp syntax and macros
  • Lightweight processes and multi-node support
  • Arbitrary precision number support
  • Process jailing and permission setting
  • Simple networking and file I/O
  • Others I’m sure I forgot…

Code Examples:

  • (defvar ‘fib (lambda ‘(n) ‘(if (< n 3) (1) (+ (fib (- n 1)) (fib (- n 2)))))) – A plain recursive function that automatically will get memoized, so it’s rather speedy (use dirty-lambda to turn off the memoization)
  • (defvar ‘max (lambda ‘(a b) ‘(if (> a b) (a) (b)))) – A simple max function used in findset
  • (defvar ‘findset (lambda ‘(l) ‘(if (== (length l) 0) 0 (if (== 1 (length l)) (hd l) (max (+ (hd l) (if (== 2 (length l))) 0 (findset (tl (tl l)))) (findset (tl l))))))) – A function for a homework assignment to find the highest weighted independent set in a path
  • (defvar ‘fact (lambda ‘(n) ‘(if (== 0 n) (1) (* n (fact (- n 1)))))) – A memoized factorial function

Peace and chow,

Ranok

Wednesday, October 01st, 2008 | Author:

For one of my cryptography assignments, I had to implement RSA encryption. I figured I’d use my current language of choice, Erlang, to try and tackle this challenge. After implementing some nicely optimized tail-recursive algorithms, I found that Erlang was very slow at doing large numerical operations. Feeling as if I’d hit a brick wall, I started looking into using other languages as libraries for the math operations. At first, I was looking at connecting Erlang to GMP though the ei library for data conversion. Alas, I was not really feeling like programming in C at the moment, and so I got really excited when I found JInterface, a java library to connect to Erlang nodes using the native networking protocol. After playing around with the code for a little, I ported most of the important BigInteger methods to an Erlang wrapper module javabignum, which would deal with starting the Java server, and handle all the communication to and from the server. This solution worked wonderfully, and I implemented a simple RSA cipher in less than 30 lines of Erlang code! To checkout the code, visit the SVN repository using the username ‘anonymous’ and the password ‘anonymous’.

Peace and chow,

Ranok

Category: Projects, Technical  | Tags: , ,  | One Comment
Thursday, September 04th, 2008 | Author:

In spirit of last night’s COSI meeting, I figured I should get ahead of the game and post a little bit about what I’ve been up to with OSP. There were a number of shortcomings with the 0.2 release in terms of permanent storage and replication. Since r65 (version 0.2) there have been a number of changes, mostly some old ones centered on ERLFS and the most recent ones, which tweak the mnesia settings. Below are some important revisions and their impact:

  • r88 – Now will autosense is a node has a disk, and will determine whether or not to keep a copy of the applications table on the disk or just in RAM
  • r89 – Made gen-join.pl which asks the user a bunch of questions to make a join script for easier setup
  • r93 – When you first install OSP, you should run ./setup-osp.sh to initialize the database on the first/master node
  • r96 – Added the add-backup-server, which will make a disk copy of all the tables to that backup server incase of node failure, there’s a backup copy

While thse changes are small, they are still very needed in creating an actual application. Currently, OSP is at r97, only 3 away from the big 100. I thought that we should have a mini OSP party when we reach r100, but since OSP is distributed, so should the party. So when you get word of the 100th commit, please raise a glass or eat a slice of cake.

Category: General, Projects, Technical  | Tags: ,  | Leave a Comment
Monday, April 07th, 2008 | Author:

After less than a week OSP has reached another milestone in it’s development! Version 0.2 was just released with a few big fixes, performance improvments and added functionality. Also the documentation has been improved and made consistant with the code.

The most important bug fix was a performance issue that caused a slowdown over time, this has been fixed and along with it, the performance and scalability has increased! The biggest feature added was support for UDP (and soon SCTP, and SSL) which can be set without changing the code! Imagine writing a server and deploying it using TCP, UDP, SSL and SCTP, just by changing one line in the XML servlet.

Setup should be simple too, just download from Google Code, extract, make and then compile your servlet. Now on the first node, run ./start-osp.sh and then you can telnet to port 9876 and administer your cluster.

Links:

Enjoy,

Ranok

Category: Projects, Technical  | Tags: , , , ,  | Leave a Comment