Sunday, September 1, 2013

Dart vs Java runtime performance benchmark

 Looks like Dart VM became faster than JVM.
This means we may consider Dart for server side language.


http://www.infoq.com/news/2013/05/Dart-Java-DeltaBlue

 http://bonovox.be/blog/dart-vs-java-the-deltablue-benchmark/

http://www.reddit.com/r/programming/comments/1e2jhr/dart_vs_java_the_deltablue_benchmark/c9wloq3


https://github.com/xxgreg/deltablue

Results, allowing enough iterations for the VM's to warm up.
gcc -O3   1x
JVM       1.2x
DartVM    1.3x
V8        1.6x
gcc       2.5x
 
http://code.google.com/p/v8/ 

How to create Dart language spec pdf/epub

Dart site does not provide pdf document of Dart language specification.

 https://www.dartlang.org/docs/dart-up-and-running/contents/ch02.html

I don't understand the reason, but it is definitely inconvenient.

So I created pdf/epub on linux(Ubuntu)

[pdf creation]

http://www.cyberciti.biz/open-source/html-to-pdf-freeware-linux-osx-windows-software/

$ sudo apt-get install wkhtmltopdf
$ sudo ln -s /usr/bin/wkhtmltopdf /usr/local/bin/html2pdf

html2pdf https://www.dartlang.org/docs/spec/latest/dart-language-specification.html#h.5c9w1alpe7y datlang-spec-0.51.pdf


[epub]

$ sudo add-apt-repository ppa:n-muench/calibre
$ sudo apt-get update
$ sudo apt-get install calibre


save above url to local file with browser and name it as dartlang-spec-0.51.html.

$ ebook-convert dartlang-spec-0.51.html  dartlang-spec-0-51.epub 
 

Message queue system for Dart

Dart  has rereating idiam of message massing in various places.
This may be simplified with a Message queue system like Qpid.

[abstraction of event driven message sending/receiving pattern]
Future is probably implemented as a generic class in Dart class.   so no language extension would have been required to support Future.

Other event driven communication also requires couple of functions to be associated with the communication.
In this book, these are written in codes which is scattered in the source code.
Also it requires similar code need to be repeated again and again.
It might be possible to provide generic class which may be similar to Future class for these setup of communication.

[replacing message passing by message queue system]
These message passing is quite similar to message queue system like Qpid(Apache). If we use such system as communication mechanism, there will  be more uniformity and  flexibility.
For instance, some of the queue can be processed in C/C++ applications.
If we need have high performance server side engine, some of the job can be delegated to such C/C++ codes interacting with Message queue system(e.g,  Qpid) without changing code.
Also it might be possible to make local/remote process transparent for the client.
for instance if some job is simple, it will do locally, but if it require more resources, it may distributes the jobs in distributed servers, and yet client may not notice these things are happening. 


[writing sender and listener on the same side ]

It might be possible to define both logic on teh same side(client or server).
The current approach need to write corresponding codes on both of client and server. these are going to be confusing if they maintained separately.
For instance, listener code may be shipped to client using dart or javascript, and that code may be loaded dynamically in the client, and these VMs are communicated with message passing approach.


connectors/drivers for Dart

There are a few thirdparty library of connectors/drivers for SQL/NoSQL.

sqljocky for MySQL
https://github.com/jamesots/sqljocky

Postgres
http://pub.dartlang.org/packages/postgresql
 
MongoDB
https://github.com/vadimtsushko/mongo_dart/

CouchDB
using httpclient

Riak database
https://code.google.com/p/riak-dart/

Manning 'Dart in Action' by Chris Buckett

I finished reading a book 'Dart in Action' by Chris Buckett.

I have already read a few other books of Dart, this book was most useful.

It explains the end to end web application development using new Dart language features.

As Language, I think Dart is well balanced language influenced from mainly JavaScript, Java, C++.

interesting aspect of this language is more direct support of client/server communication.
An application involved in these aspects often very complicated in other language, but now they can be directly supported as language level (by library as well).
 
Many of them are related asynchronous nature of programming logic. 
  • Future
  • Event Driven(Message Passing) Communication:
    • among different JVM on Blowser(Dart and JavaScript) on a browser
    • among client/server using websocket
    • among isolates
    • among DOM/human interaction
  • Isolate
Dart support following client/server communication machanins
  • Websocket(server can call client as well as the reverse)
  • httpclient(server call other server)
  • httpserver(browser call server)

Also Dart is designed to be used in both of client and server from the begining.
This is also quite good to simplify web applications to allow more code sharing between them.
And some of the feature in Dart will be more useful in server side.

There is a difference of Dart execution mode.
if it run on browser, dart:html is available, but not for server.
dart:io is only available on server.

Essentially these are just a difference of library.

Also httpclient to access other webservers from server are supported as default. this is also quite useful.


This books has useful  idiom in client side.
  • Page navigarion.(how to support browser back/forward feature)
  • cookies
  • localStorage
  • webstorage

The Chapter 12 has a lots of interesting topics.
  •  The technique called JASONP for avoid same origin restriction. 
  •  Server less browser apps(AppCache for offline browser)
  •  Packaging Chrome Web Application





Monday, November 19, 2012

a setting for root desktop login for kubuntu 12.10

I don't like ubuntu/gnome GUI(desktop).

The simple way to use KDE on ubuntu is to use Kubuntu.

Right now, 12.10 is available but, if we want to use root for desktop, we need to change different conf file  than 10.04.


sudo sh -c 'echo "greeter-show-manual-login=true" /etc/lightdm/lightdm.conf'

Also we need to change the  login screen setting from User Bar to Classic since User bar does not offer root user.

after these change, we can login root user desktop.

Additionary we would need these things:

 sudo passwd root

You should have a file called kdmrc. In Debian, this file resides in /etc/kde4/kdm. Look for a 'AllowRootLogin=false' entry. Change it to 'AllowRootLogin=true'. #Then add or change the following entry:
#AutoLoginEnable=true
#AutoLoginUser=root