Parallel Development Environments? Pulque!

¡Quiero pulque!

By Claire L. Evans / CC BY-ND 2.0

This is an updated version of Multiple Parallel Mono Environments.

What is Pulque?

Pulque is a collection of applications written in Ruby and Bash scripting to maintain parallel development environments.

Why does Pulque exist?

Three reasons:

  1. I need to keep multiple versions installed of the same software,
  2. I need to know what Version Control System is used by the software, and the most important
  3. I want to keep myself sane.

At work, I have to interact with different open source projects, most of them use Subversion and Git, but some others use Bazaar and Mercurial. Keeping track of the current parallel development environment and the VCS used by the software is exhausting.

You spend time focusing on something that shouldn’t be that important:

  • Managing your parallel environments and,
  • Keeping track of the VCS used by the software

Is easy to get confused when interacting with the repository, for example, executing svn update when the software is stored in a git repository. Is silly, but it happens. Unless you are using an IDE that support Multiple Parallel Development Environments you will need the terminal to configure and build your projects.

Pulque helps you maintaining parallel development environments by:

  • Printing in the bash prompt the name of the parallel development environment and the type of the VCS, this information is updated depending on the working directory,
  • Defining aliases to the default commands used to configure and build the software project, to always prefix your projects using your parallel environment, and
  • Showing a failure or success alert when the command finishes.

Installing and using Pulque

Follow the instructions in INSTALL, or if you are using openSUSE 11.2:

OneClick Install
Click here to drink Pulque!

Don’t forget to add the function pswitch to your .bashrc. Bash will autocomplete your environment name when using TAB TAB.

function pswitch {
  source /usr/bin/__pswitch $1
}

Read the USING file to understand how to use Pulque in the daily basis. If you find something weird or interesting please create an issue to fix it.

Colophon

According to Wikipedia: “Pulque, or octli, is a milk-colored, somewhat viscous alcoholic beverage made from the fermented sap of the maguey plant, and is a traditional native beverage of Mexico.

Shorten URL: http://bit.ly/ay65poshorten url

The Ruby Programming Language

english — Tags: , , , , , , , , — @ 23:50

Ruby

A couple of days ago I finished reading: The Ruby Programming Language, book written by David Flanagan and Yukihiro Matsumoto. If I have to say anything about the book and, the language, of course, is: I am impressed. The syntax is pretty for writing and simple for reading. Its simplicity makes you understand the code, is like visualizing the goal of the program in your mind by reading it, not running it. It is like reading a well written letter. You just understand.

I must say, when I was reading the book, at the beginning. I did not feel comfortable with the weird, at that time, syntax. Method decorations such as “!” and “?”, and the support for methods aliases made no sense. Actually I thought I was wasting my time by trying to learn the language. I was wrong.

When I learned C++ several years ago, I did not have reference to object orientation or any object-oriented programming language. Learning it was difficult, but, at the same time, easy. Difficult because I did not know the paradigm, easy because it was my first time learning that kind of syntax. After learning C++ I decided to learn Java and after that, I decided to learn C#.

And I learned them all the same way. I “translated” the syntax. Translated it from the “new language” to the “old language”. I did learn them all. And I thought, for long time, that the rule was: “Learn all the languages the same way: by translation”. I was wrong. Again.

Learning a new programming language, in my opinion, is better when you do not translate the new language. Similar to learn to speak a new language. In both cases, you have to think in the language. I decided to think in the new language. To do it that way. The Ruby way. The results were amazing. Were so amazing that inspired me to write a project in Ruby. I wanted to try out the syntax, the platform and the community. To see if the language was that good as I thought.

After trying it out. No disappointments at all. Actually is interesting that C# and Ruby share a lot of things, syntactically speaking. Both of them are pretty languages. Probably they do not share goals. However, I’m sure they share one goal: to make the life of the software developer easier. And, to a software developer, a programming language, and everything around it, that makes your life easier is what matters the most.

Shorten URL: http://bit.ly/5drYK7shorten url

Hackweek IV: Gwibber + Sharing

english — Tags: , , — @ 13:51

I decided to try something different this Hackweek to learn a programming language and get involved into another exciting software libre project. There were too many options, too many good projects to work on. I selected gwibber because of three reasons:

  1. gwibber supports several microblogging services, including my favorites: Twitter and Facebook.
  2. gwibber is written in Python.
  3. gwibber doesn’t integrate with other gnome applications, for example Cheese or Nautilus.

So… what’s the new cool feature?

Something I like to call “Sharing Services”. What’s a sharing service? A sharing service is a service using an online provider to share data, easier impossible. For example: Images would be shared using Twitpic, Videos would use yfrog, Files would use Drop.io and Plaint Text files would use Pastebin (this is configurable, in case you were wondering) I’m sure you got the idea.

Data Sharing on Gwibber  Data Sharing on Gwibber

Technical approach

The implementation is based on the following UML class diagram:

Data Sharing on Gwibber

The idea is simple, subclass Provider and override share method and you are pretty much all set. I already implemented 3 services: twitpic to share images, yfrog to share images and video, and pastebin.ca to share plain text files. My plans include to implement the following providers:

Plain text

Video

Files

To allow communication between gnome/gtk/dbus-based applications I added a new dbus method: share(filename,message), that way you can “share” your file using a message, you don’t need to explicitly tell the provider+service to use, gwibber will use the filename’s mime-type to get the valid provider and the configured service, convenient isn’t it?

Data Sharing on Gwibber

Where to get it?

I branched trunk to implement this feature, you can read launchpad to get more information, basically you need to:

bzr branch lp:~mario-carrion/gwibber/gwibber-services

and execute:

./bin/gwibber

I also included a patch for cheese, I’m using gnome-2-26 branch, in case you want to share your videos and images on gwibber using cheese.

Cool video

Known bugs and issues

I’m aware of several bugs, for example: web timeouts, invalid responses and random deadlocks, so take it easy, remember: this is a preview, be happy. Also I need to think about multiple instances and implementing a real HTTP handler instead of using the MultiPartForm class, will decide it later.

OpenSUSE 11.1 Users: you may need to install python-related dependencies. OpenSUSE 11.1-64, if you want to use the nautilus extension, you will need create a symbolic link in /usr/lib/ for libpython2.6.so. I’m going to report the packing bug as soon as possible.

BTW, you can always follow me on twitter: @mariocarrion in case you want to recommend me a new provider.

Multiple Parallel Mono Environments

english — Tags: , , — @ 13:20

If you are a Mono developer, either you develop Mono or you use Mono for development, I’m sure you already have your Parallel Mono Environment set up and you are happy using it. Keeping a parallel environment is necessary because that way you don’t break your default Mono installation or an specific mono application, so you can keep using the latest version of whatever you need, however sometimes you need more than one parallel environment, usually because you are working on different versions, for example mono-2-6, mono-head and mono-package; in the Accessibility Team we are always working on different Mono versions jumping from one version to another, so we need to keep multiple parallel environments, and we don’t want to compile everything every time over and over. One way to accomplish multiple parallel environments is to keep n copies of mono-dev-env (something like mono-dev-env-2-6 or mono-dev-env-trunk); but since I like to keep everything in one place and use the same procedure to set up my environments, I updated the default environment file to something like this (you can always get an updated version from: here):

#!/bin/bash
#
# Based on http://www.mono-project.com/Parallel_Mono_Environments , with the
# following modifications:
#
# - Aliases for make:
#   - mk = make
#   - mki = make install
#   - mku = make uninstall
#   - mkuci = make uninstall, clean, autogen and install
#   - mkc = make clean
#   - mkdc = make dist-clean
#   - autogenmono = autogen.sh with prefix, you also add your arguments
#   - configuremono = configure with prefix, you also add your arguments
#   - bootstrapmono = bootstrap with prefix, you also add your arguments
# - Success/Failure messages raised depending on executed command.
#
# You will need to add the following alias into your .bashrc:
#
# function exportmono {
#   source ~/path/to/mono-dev $1
# }
#
# so you can use:
# - "exportmono trunk"
# - "exportmono 2.4"
# - "exportmono whatever"
# to use multiple parallel environments, when no argument is used "trunk"
# is set by default.
#
#
# You can also use "lcustom" to load custom scripts, for example
# if you need to define environment variables instead of adding those here
# you will write a custom-var.sh and will use:
#
# "lcustom ~/custom-var.sh"

# Use this variable to add local enviroment paths
# (i.e. to include a custom executable script)
EXTRA_PATH=$HOME/Documents/Repository/uia2atk/tools

# Colors, based on http://wiki.archlinux.org/index.php/Color_Bash_Prompt
NO_COLOR='\e[0m'
# regular colors
BLACK='\e[0;30m'
RED='\e[0;31m'
GREEN='\e[0;32m'
YELLOW='\e[0;33m'
BLUE='\e[0;34m'
MAGENTA='\e[0;35m'
CYAN='\e[0;36m'
WHITE='\e[0;37m'
# emphasized (bolded) colors
EBLACK='\e[1;30m'
ERED='\e[1;31m'
EGREEN='\e[1;32m'
EYELLOW='\e[1;33m'
EBLUE='\e[1;34m'
EMAGENTA='\e[1;35m'
ECYAN='\e[1;36m'
EWHITE='\e[1;37m'
# underlined colors
UBLACK='\e[4;30m'
URED='\e[4;31m'
UGREEN='\e[4;32m'
UYELLOW='\e[4;33m'
UBLUE='\e[4;34m'
UMAGENTA='\e[4;35m'
UCYAN='\e[4;36m'
UWHITE='\e[4;37m'
# background colors
BBLACK='\e[40m'
BRED='\e[41m'
BGREEN='\e[42m'
BYELLOW='\e[43m'
BBLUE='\e[44m'
BMAGENTA='\e[45m'
BCYAN='\e[46m'
BWHITE='\e[47m'

# We are going to load CUSTOM FILES
#
# Basically the idea is to split multiple development paths or variables
# into different files, that way we can keep this file as clean as possible.
# This magic function tries to load those files.

function lcustom {
  if test x"$1" = x; then
  	echo -e "${RED}>>${NO_COLOR} Nothing to do, no arguments provided."
  else
  	source $1 && echo -e "${RED}>>${NO_COLOR} Loaded: '$1'" || echo -e "${RED}>>${NO_COLOR} Not loaded"
  fi
}

MONO_REV=$1
if test x"$MONO_REV" = x; then
	MONO_REV="trunk"
fi

HOME_ROOT=$HOME/.root-dev/$MONO_REV
MONO_PREFIX=$HOME_ROOT
GNOME_PREFIX=$HOME_ROOT

if [ -d $HOME_ROOT ]; then
  echo -e "${RED}>>${NO_COLOR} Using environment: ${RED}$MONO_REV"
else
  mkdir -p $HOME_ROOT && echo -e "${RED}>>${NO_COLOR} Using environment (for the first time): ${RED}$MONO_REV" || echo -e "${RED}>>${NO_COLOR} Unable to create local path."
fi

# configure-related functions
function autogenmono {
  ./autogen.sh --prefix=$MONO_PREFIX $* && mynotify "autogenmono" || mynotify 1 "autogenmono"
}
function configuremono {
  ./configure --prefix=$MONO_PREFIX $* && mynotify "configuremono" || mynotify 1 "configuremono"
}
function bootstrapmono {
  if test x"$1" = x; then
    echo -e "${RED}>>${NO_COLOR} Use bootstrapmono bootstrap-file"
    echo -e "${RED}>>${NO_COLOR} For example: bootstrapmono bootstrap-2.12"
  else
    ./$1 --prefix=$MONO_PREFIX $2 && mynotify "bootstrapmono" || mynotify 1 "bootstrapmono"
  fi
}

# make-related functions
function mkuci {
  make uninstall && make clean && autogenmono $* && make install && mynotify "mkuci" || mynotify 1 "mkuci"
}
function mk {
  make $* && mynotify "mk" || mynotify 1 "mk"
}
function mki {
  make install $* && mynotify "mki" || mynotify 1 "mki"
}
function mku {
  make uninstall && mynotify "mku" || mynotify 1 "mku"
}
function mkc {
  make clean && mynotify "mkc" || mynotify 1 "mkc"
}
function mkdc {
  make dist-clean && mynotify "mkdc" || mynotify 1 "mkdc"
}

function mynotify {
  MSG_CONTENT=$1
  MSG_URGENCY="normal"
  MSG_RESULT="done"

  echo $1 | grep "[^0-9]" > /dev/null 2>&1
  # Is first argument a numeric value?
  if [ "$?" -ne "0" ]; then
    if [ "$1" -eq "1" ]; then
      MSG_CONTENT=$2
      MSG_URGENCY="critical"
      MSG_RESULT="failed"
    fi
  fi

  notify-send -t 2500 -u $MSG_URGENCY "$MSG_CONTENT $MSG_RESULT: '`basename $PWD`'"
}

export DYLD_LIBRARY_PATH=$MONO_PREFIX/lib:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=$MONO_PREFIX/lib:$LD_LIBRARY_PATH
export C_INCLUDE_PATH=$MONO_PREFIX/include:$GNOME_PREFIX/include
export ACLOCAL_PATH=$MONO_PREFIX/share/aclocal
export PKG_CONFIG_PATH=$MONO_PREFIX/lib/pkgconfig:$GNOME_PREFIX/lib/pkgconfig
export MANPATH=$MONO_PREFIX/share/man:$MANPATH
# a11y support
export GTK_MODULES=gail:atk-bridge

PATH=$EXTRA_PATH:$PATH
PATH=$MONO_PREFIX/bin:$PATH
PS1="$WHITE@mono-dev$NO_COLOR:$RED$MONO_REV$NO_COLOR:\w-> "

To use this script you will need to define an alias in your .bashrc:

Mono    Screenshot

This environment should work on any recent bash version, if not let me know.

HP Pavilion TX2500z. Final.

english — Tags: — @ 23:44

I’ve been using this tablet for about 4 months with OpenSUSE 11.1, I’m happy: performance, design and hardware support are good for me, however there are few complaints about it:

Hardware

  • Keys are small. Are not small as keys in netbooks, but you get tired if you spent more that 6 hours hacking.
  • Temperature. This is really painful, the hard-disk gets really warm and you can’t touch the bottom if you are using doing hard work.
  • Noise. Same as temperature, using the DVD is somehow annoying, unless you are wearing headphones you don’t notice the noise. When using the hard-disk, for example, compiling or searching, happens the same.

Recently noticed that HP released HP TouchSmart tx2z, this is similar to TX2500z, however the big differences include more memory (up to 8gb) and multi-touch support. Hopefully my complains are already fixed in this newest hardware.

Software

Installing OpenSUSE 11.1 in super easy, so installing won’t let you down, however you will need extra tunning if you want to support all hardware, in particular sound, wireless and video:

radeonhd, open driver

1.2.3 is installed by default, this version doesn’t support Screen Rotation nor 3D Acceleration, according to 1.2.4 releasing notes Screen Rotation is now supported however xrandr doesn’t report any rotation information. If you want to upgrade add the following repository and upgrade:
http://download.opensuse.org/repositories/X11:/Drivers:/Video/openSUSE_11.1/.

fglrx, proprietary driver

I recommend to generate the rpm and use zypper to install the generated file, if you are running 64bit you will need to recreate the symbolic link because seems the fglrx driver is using 32 paths instead of 64, according to documentation Screen Rotation is also supported, but not enabled by default, so execute as root:
aticonfig --set-pcs-str="DDX,EnableRandr12,TRUE"
to enable it, notice this command doesn’t change /etc/X11/xorg.conf, it works however sometimes rotating the screen will lead to a black screen.

Verdict

I like it, is smaller and lighter that my previous laptop, however the temperature is really really annoying.

Last day of the year

english — Tags: — @ 16:44

Another year is almost gone. I can’t say 2008 year was “another year“, actually I think 2008 is the most exciting and interesting year I ever lived. I joined a great company and I’ve been working with a great group. I’m looking forward next year.

Huevudo

Smolt

english — Tags: — @ 22:00

If you install OpenSUSE 11.1 don’t forget to send your hardware profile using smolt, it should run by default when logging in the first time, however if isn’t run then you can execute smoltGui to send your profile, my tablet is here: HP Pavilion tx2500 Notebook PC Rev 1.

HP Pavilion TX2500z. Part IV

english — Tags: — @ 21:03

If you haven’t updated to OpenSUSE 11.1 RC1 you should do it, GNOME Keyring bug was fixed and this release includes kernel 2.6.27.7-4 that fixes the weird SSH-unable-to-connect bug.

Mario's point of view by @damog

Thanks to Raquel&David for the great week in NYC.

HP Pavilion TX2500z. Part III

english — Tags: — @ 20:12

There a lot of improvements and fixes in OpenSUSE 11.1 B5, for example you don’t need to add the RadeonHD repository because B5 already includes the fix, however there are some new bugs to be fixed:

  • Bug 441764 – GNOME: gnome-keyring support partially broken.
  • Bug 445724 – gdm: problems with xvkbd on TabletPCs
  • Bug 445923 – File Selecion Dialog changes its size and position
  • Bug 438071 – root owned icons on the desktop

GNOME 2.24.1 is awesome in OpenSUSE 11.1 B5, everything is supported by default and you don’t need anything but some clicks to fully configure your tablet, however by default the current kernel (2.6.27.5-2) doesn’t include the BCM4322 wireless module (wl), and making the current tarball will return building errors, however, I’ve found the solution, apply the patch, follow the instructions and enjoy.

BTW. I love my new Canon Rebel XSi, replaces my old camera, I’m looking forward to take a lot of photographies! My official first photography:

Monkey

Podcast about UML

english — Tags: — @ 15:44

Do you like Podcasts and UML?, then you must listen the podcast:
Bran Selic on UML.

Next Page »
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.
(c) 2004-2010 Mario Carrion | powered by WordPress with Barecity