Sunday, September 11, 2005

hacking the command line

I love the command line shortcuts, and I was looking for information about the 'cd history'. So I found pushd and popd. The pushd builtin adds directories to the directory stack as it changes the current directory, and popd removes directories from that stack changing the current directory to the last directory removed. To see the stack directory just:
$ echo $DIRSTACK 
or
$ dirs
If you are writing code on ~/Projecs/macaco/src and now need to jump momentarily to ~/Projects/Nazca, just 'pushd .' and when you finish your tasks on ~/Projects/Nazca do 'cd ~/Projecs/macaco/src'. Actually, you can store more than one directory at a time, remember, it is a stack (you can also use FIFO instead LIFO using unix pipes)

Tuning you box

Add to /.bashrc the next lines:
#redefine pushd and popd so they don't output the directory stack
# the output is redirected to /dev/null to prevent displaying the 
# dir stack when they are called
pushd()
{
    builtin pushd "$@" > /dev/null
}
popd()
{
    builtin popd "$@" > /dev/null
}

#alias cd so it uses the directory stack
alias pd='pushd'
#aliad pb as a command that goes one directory back in the stack
alias po 'popd'
# 
#To rotate between directories
alias r "pushd +1"
alias rr "cd "$OLDPWD"

Saturday, September 10, 2005

Working with Mono

These days I have been working with mono. I started to integrate MonoUML into MonoDevelop, you can read more about it in http://planet.monouml.org.

Today I patch Glade# Code Generator to generate Nemerle code. It was very easy and the patch was comitted today:

Index: src/Language.cs
===================================================================
--- src/Language.cs (revisión: 7)
+++ src/Language.cs (copia de trabajo)
@@ -4,5 +4,6 @@
{
 CSharp = 0,
 VisualBasic = 1,
- Boo = 2
+ Boo = 2,
+ Nemerle = 3
}
Index: src/GtkGladeCodeGenerator.cs
===================================================================
--- src/GtkGladeCodeGenerator.cs (revisión: 7)
+++ src/GtkGladeCodeGenerator.cs (copia de trabajo)
@@ -304,6 +304,8 @@
    codegen.GenerateCode(Language.VisualBasic, outputDirectoryEntry.Text);
   else if (languageComboBox.Active == 2)
    codegen.GenerateCode(Language.Boo, outputDirectoryEntry.Text);
+   else if (languageComboBox.Active == 3)
+    codegen.GenerateCode(Language.Nemerle, outputDirectoryEntry.Text);
   else
    throw new Exception ("What is " + languageComboBox.Active + "??");
   
Index: src/Generator.cs
===================================================================
--- src/Generator.cs (revisión: 7)
+++ src/Generator.cs (copia de trabajo)
@@ -282,6 +282,9 @@
      Assembly assembly = Assembly.LoadWithPartialName("Boo.Lang.CodeDom");
      provider = (CodeDomProvider)assembly.CreateInstance("Boo.Lang.CodeDom.BooCodeProvider");
  //          provider = new Boo.Lang.CodeDom.BooCodeProvider();
+     } else if (language == Language.Nemerle){
+      Assembly assembly = Assembly.LoadWithPartialName("Nemerle.Compiler");
+      provider = (CodeDomProvider)assembly.CreateInstance("Nemerle.Compiler.NemerleCodeProvider");
     } else {
      throw new Exception ("Unsupported language");
     } 
Index: data/gladecodegenerator.glade
===================================================================
--- data/gladecodegenerator.glade (revisión: 7)
+++ data/gladecodegenerator.glade (copia de trabajo)
@@ -770,7 +770,8 @@
         True
         C#
Visual Basic
-Boo
+Boo
+Nemerle
         False
         True
      
     }