I was looking for open source calender server with CalDev support. I finally decided to go with "Darwin Calendar Server", that is being developed and maintained by Apple. Darwin calendar server is developed with Python. Here are the instructions to build darwin calendar server on ubuntu,
a) apt-get install following components, if you don't have it,
build-essential
python-openssl
python-xattr
python-zopeinterface
python-xml
ibkrb5-dev
krb5-config
b) Create empty directory, check out CalendarServer inside empty directory (while building, system will download number of other necessary libs inside empty directory you have created),
svn checkout http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk CalendarServer
c) Enable extended attributes for the filesystem (CalendarServer expects extended attribute enabled file system for storing calendar data),
edit, /etc/fstab and add user_xattr
Here is how my "/etc/fstab" looks after adding user_xattr,
UUID=2594fb7b-cb60-490c-8d08-1fbee11f1e5f / ext3 relatime,errors=remount-ro,user_xattr 0 1
d) Activate fstab changes, with 'mount -o remount /<mountpoint>'
e) To build CalendarServer, follow the instructions listed at,
http://trac.calendarserver.org/wiki/QuickStart
f) If everything goes fine, open browser with http://localhost:8008/calendars/users/admin/calendar (If you are challenged by security realm, enter admin for both username and password). You should see admin's calendar listing
g) You may use any calendar client that supports "CalDev" to access your calendar. If you plan to use sunbird as your client, follow the instructions at
http://trac.calendarserver.org/wiki/Sunbird
Monday, August 3, 2009
Tuesday, August 26, 2008
Register VMs : Rise of the machines
I am currently designing and implementing small language with in-built concurrency for experimental/learning purpose. I decided to go with virtual machine approach, but when we implement a virtual machine, we hit by a long-running question in the design of virtual machines, whether to go with stack architecture or with register architecture?
Many of virtual machines are implemented with stack architecture.
Stack based VMs:
There is lot of interest in implementing VM based on register architecture too and practical register based VMs are started emerging.
Register based VMs:
I decided to go with register based VM, thought of below two options and decided to go with first.
1) Implementing my register based VM in C
2) Implementing my register based VM in Java (Hey, java is improving and sun is adding multi language support and it is open!!!, so why not?) - In this case my VM itself interpreted on stack based JVM!!!
Many of virtual machines are implemented with stack architecture.
Stack based VMs:
- The Java Virtual Machine.
- .NET CLR
- Perl 5 virtual machine.
- SQLite Virtual Database Engine.
There is lot of interest in implementing VM based on register architecture too and practical register based VMs are started emerging.
Register based VMs:
- Parrot VM - http://en.wikipedia.org/wiki/Parrot_virtual_machine
- Android Dalvik VM - http://en.wikipedia.org/wiki/Dalvik_virtual_machine
- Webkit Javascript VM - http://webkit.org/blog/189/announcing-squirrelfish/
I decided to go with register based VM, thought of below two options and decided to go with first.
1) Implementing my register based VM in C
2) Implementing my register based VM in Java (Hey, java is improving and sun is adding multi language support and it is open!!!, so why not?) - In this case my VM itself interpreted on stack based JVM!!!
Sunday, May 4, 2008
Magic of Multilanguage Environment
We need to create methods at runtime (say, based on some user input we need to construct an behavior in the form of methods) and associate/execute that methods in the context of particular existing object instance. How could we achieve this in Java?
1) Use features of mlvm. Currently it is in prototype stage. So we may have to wait for some time before being available as part of standard distribution.
2) We could use any of byte code engineering libraries and include a method in the class at runtime. But we are trying to include a method for a particular object instance of the class. Not in the class itself.
Hey, Javacript/Ruby very much allow adding new methods to a particular instance and good news is that we have matured Javascript (Rhino) and Ruby (JRuby) implementations in Java. You may be aware that Rhino javascript implementation is included as part of standard java 6 distribution. With the help of Rhino engine, we could take advantage of power of javascript and implement our scenario.
Include JDK_6_HOME/bin in your path.
Type jrunscript in command prompt.
var fr = new javax.swing.JFrame()
fr.title = "My Title"
fr.setSize(200, 200)
fr.show()
var fn_title = function(title_text) {this.title = title_text}
fn_title.call(fr, "My New Title")
"fn_title" is the method, that we have associated with "JFrame" instance "fr"
PS: Rhino engine is written in Java. How easy to simulate above behavior with our own java classes and byte code engineering? Look at these slides for answer.
1) Use features of mlvm. Currently it is in prototype stage. So we may have to wait for some time before being available as part of standard distribution.
2) We could use any of byte code engineering libraries and include a method in the class at runtime. But we are trying to include a method for a particular object instance of the class. Not in the class itself.
Hey, Javacript/Ruby very much allow adding new methods to a particular instance and good news is that we have matured Javascript (Rhino) and Ruby (JRuby) implementations in Java. You may be aware that Rhino javascript implementation is included as part of standard java 6 distribution. With the help of Rhino engine, we could take advantage of power of javascript and implement our scenario.
Include JDK_6_HOME
Type jrunscript in command prompt.
var fr = new javax.swing.JFrame()
fr.title = "My Title"
fr.setSize(200, 200)
fr.show()
var fn_title = function(title_text) {this.title = title_text}
fn_title.call(fr, "My New Title")
"fn_title" is the method, that we have associated with "JFrame" instance "fr"
PS: Rhino engine is written in Java. How easy to simulate above behavior with our own java classes and byte code engineering? Look at these slides for answer.
Wednesday, April 9, 2008
Jax India 2008 - Open JDK Multi Language Virtual Machine (MLVM) / The Da Vinci Machine
Yesterday, I spoke at Jax India 2008. My session was on "The Da Vinci Machine - Multi Language Environment for Java Virtual Machine". There were around 70 to 90 participants.
My session went fine with number of good questions from participants. Started my talk with "why we need other languages support on JVM" then pitched into "Introduction to porting new languages on JVM" and ended my talk with discussion on various "MLVM features (Light-weight byte code loading, light weight method objects, Dynamic Invocation, Symbolic freedom, Continuations and Tail recursion)". Click here for presentation slides.
My session went fine with number of good questions from participants. Started my talk with "why we need other languages support on JVM" then pitched into "Introduction to porting new languages on JVM" and ended my talk with discussion on various "MLVM features (Light-weight byte code loading, light weight method objects, Dynamic Invocation, Symbolic freedom, Continuations and Tail recursion)". Click here for presentation slides.
Wednesday, March 26, 2008
Interesting open source license
When we build project for clients based on number of open source libraries, we typically look into licensing policy of each open source library and analyze how well they fit with client policies. While analyzing one such policy of open source library, I was asked by my colleague what was the interesting licensing policy you have come across?, without second thought i replied back, policy of SQLite. Here is extracted license text from SQLite
“ The author disclaims copyright to this source code. In place of a legal notice, here is a blessing:
May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give. “
Isn't it interesting?.
“ The author disclaims copyright to this source code. In place of a legal notice, here is a blessing:
May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give. “
Isn't it interesting?.
Tuesday, March 4, 2008
Customizable Closure with OpenJDK MLVM and javac
The customizable closure code listed below, take advantage of following,
=================
Before customization..
Dear bob, Welcome to closure...
=================
================
After customization..
Dear bob, Welcome to MLVM closure customization..Experience the power of AnonymousClassLoader...
=================
OK, what's going on?
- Closure data types are converted to inner classes at compile time.
- AnnonymousClassLoader in MLVM, allows us to load multiple definitions of same class in the same instance of the class loader at run time.
import java.dyn.AnonymousClassLoader;Output:
public class CustomizableClosure {
static private {String => void} welcomeClosure =
{ String name => System.out.println(name + ", " + shortWelcome);};
static String shortWelcome = " Welcome to closure...";
static String detailedWelcome =
" Welcome to MLVM closure customization..Experience the power of AnonymousClassLoader...";
public static void main(String[] args) throws Exception {
CustomizableClosure.testSimpleClosure();
CustomizableClosure.testCustomizableClosure();
}
static void testSimpleClosure() {
System.out.println("=================");
System.out.println("Before customization..");
welcomeClosure.invoke("Dear bob");
System.out.println("=================");
}
static void testCustomizableClosure() throws Exception {
AnonymousClassLoader acl = new AnonymousClassLoader();
acl.setClassFile(welcomeClosure.getClass());
Class hostClass = CustomizableClosure.class;
Class acls = welcomeClosure.getClass();
acl.putSymbolPatch("shortWelcome", "detailedWelcome");
acls = acl.loadClass();
{String => void} obj = ({String => void}) acls.newInstance();
System.out.println("================");
System.out.println("After customization..");
obj.invoke("Dear bob");
System.out.println("================");
}
}
=================
Before customization..
Dear bob, Welcome to closure...
=================
================
After customization..
Dear bob, Welcome to MLVM closure customization..Experience the power of AnonymousClassLoader...
=================
OK, what's going on?
- {String => void} welcomeClosure = { String name => System.out.println(name + ", " + shortWelcome);} this closure snippet is converted to inner class at compile time.
- In method "testSimpleClosure", we are executing closure code as is.
- In method "testCustomizableClosure", we take closure (compiled inner class) as base template, customize it (by changing welcome text) at run time and execute it.
- Build OpenJDK and Hotspot.
- Apply MLVM patch and rebuild Hotspot.
- Download javac for closures from javac.info
- Prepend MLVM AnonymousClassLoader.class and javac.jar to bootclasspath of java and javac. In my local machine, i used following commands for compilation and execution.
- javac -J-Xbootclasspath/p:/share/software/OpenJDK/closures-2008-02-12/lib/javac.jar:/share/software/OpenJDK/mlvm/bootcp -source 7 -d classes/ CustomizableClosure.java
- java -Xbootclasspath/p:/share/software/OpenJDK/closures-2008-02-12/lib/javac.jar:/share/software/OpenJDK/mlvm/bootcp -cp classes CustomizableClosure
Wednesday, February 13, 2008
AnonymousClassLoader in OpenJDK Mlti-Language VM (MLVM)
When we implement JIT interpreter for dynamic languages on JVM, we typically deal with set of data (Environment) and Operations (Methods, Lambda etc).
Design and loading of class definition for data and operations on JVM, has following challenges (pains),
a) We can't define a light weight / anonymous methods in JVM on the fly.
Method definition must live in a class. (Relationship between class that defines method and data could be composition or inheritance).
b) We can't load multiple class definitions of same class / overwrite previously loaded class definition with new one, in the same class loader.
Class loader keeps track of all loaded class in its System Dictionary. When we try to reload class definition (even though class definition is changed after first load), class loader checks for any entry in System dictionary for a given class name. If so, it will return class definition of system dictionary entry.
To circumvent above issue, we instantiate (custom) new class loader every time when class definition changes.
c) Garbage collection issue
Class loader is another Java class in JDK. When a class (Let's call host class) instantiates our custom class loader; say CL1, class loader of host class (could be system class loader or ext class loader or another custom class loader) can reach CL1 class loader. Make sure custom class loaders like CL1 are eligible for GC (there by all classes loaded by that class loader) when they are no longer useful.
OpenJDK Mlti-Language VM, introduces java.dyn.AnonymousClassLoader that alleviates above pain points,
1) No System Dictionary in AnonymousClassLoader and AnonymousClassLoader is independent of existing class loaders in JDK. (Refer AnonymousClassLoader.java)
2) We can load multiple definition of same class using same instance of AnonymousClassLoader and it is responsibility of the user to choose preferred class definition among loaded class definitions to create instance. (Refer testAPI method of DVMTest.java)
3) Classes defined by AnonymousClassLoader are not reachable by class loader of host class. Making not-in-use class definitions available for GC is simple.
Above points are not theory, we have tested and working prototype ready. If you want to try yourself, refer my previous post on building MLVM.
QR code for building MLVM :
Design and loading of class definition for data and operations on JVM, has following challenges (pains),
a) We can't define a light weight / anonymous methods in JVM on the fly.
Method definition must live in a class. (Relationship between class that defines method and data could be composition or inheritance).
b) We can't load multiple class definitions of same class / overwrite previously loaded class definition with new one, in the same class loader.
Class loader keeps track of all loaded class in its System Dictionary. When we try to reload class definition (even though class definition is changed after first load), class loader checks for any entry in System dictionary for a given class name. If so, it will return class definition of system dictionary entry.
To circumvent above issue, we instantiate (custom) new class loader every time when class definition changes.
c) Garbage collection issue
Class loader is another Java class in JDK. When a class (Let's call host class) instantiates our custom class loader; say CL1, class loader of host class (could be system class loader or ext class loader or another custom class loader) can reach CL1 class loader. Make sure custom class loaders like CL1 are eligible for GC (there by all classes loaded by that class loader) when they are no longer useful.
OpenJDK Mlti-Language VM, introduces java.dyn.AnonymousClassLoader that alleviates above pain points,
1) No System Dictionary in AnonymousClassLoader and AnonymousClassLoader is independent of existing class loaders in JDK. (Refer AnonymousClassLoader.java)
2) We can load multiple definition of same class using same instance of AnonymousClassLoader and it is responsibility of the user to choose preferred class definition among loaded class definitions to create instance. (Refer testAPI method of DVMTest.java)
3) Classes defined by AnonymousClassLoader are not reachable by class loader of host class. Making not-in-use class definitions available for GC is simple.
Above points are not theory, we have tested and working prototype ready. If you want to try yourself, refer my previous post on building MLVM.
QR code for building MLVM :
Subscribe to:
Comments (Atom)