Saturday, May 23, 2009

hibernate code generation

Now a days, I'm working on a server side backend service that exposes an API using a REST interface. To get to the data model, we first created a business domain model which contained business entities, value objects and some enumerations. From this domain model we created a ER diagram and from there a db data model. Next comes the ORM layer(using hibernate) and we figured out that there were two ways to go...
  1. Write hibernate hbm files and generate code and db-scripts from them.

  2. Create db-scripts from the data-model and reverse engineer this schema to generate hibernate classes and hbm files

At the moment we decided that we want to keep a close grip on what gets created inside db, so we went ahead with the second approach. After some use it looks like, we're taking alot of pain in work-arounds to not to touch generated java code(so that we can change data model anytime and regenerate the code). Let us see if this approach works out fine or if at some point we switch to 1st approach and start modifying the hbm files and generate db-scripts from them.

Wednesday, May 13, 2009

telnet protocol impl for scsh

I'm trying to port telnetlib from lisp to scheme for scsh. Code is hosted here and yes, its a work-in-progress, I work on it mostly during the weekend only. Anyway, from this exercise I've certainly observed following...

  • Lisp is just so feature rich. Its taking many workarounds to (almost)direct port telnetlib from lisp to scheme.

  • Domain knowledge is important. I always thought it was easy to understand the domain and I could just start with anything and I started this project without knowing much about telnet protocol itself and Now I realise that to do it I *have* to understand the nuances of it.

[Update] Its completed.

Tuesday, May 5, 2009

running cygwin bash within emacs

I've used cygwin on windows for a long time and I don't like the cygwin interface that much. So, I decided to run cygwin bash from within emacs. I put following(found here) in my emacs init file:
(defun cygwin-shell ()
"Run cygwin bash in shell mode."
(let ((explicit-shell-file-name
(call-interactively 'shell)))

Now, I can do "Meta-x cygwin-shell RET" to run bash inside emacs and get all the editing power of emacs :) .
PS: Don't forget to append "C:/path/to/cygwin/bin/" to PATH or else most of the commands like ls, grep etc would not work.