Tuesday, October 20, 2009

First Day - Afternoon session

On the afternoon, we heard the Jose Caballero's talk. He employed an introductory presentation in which different technologies and concepts associated with Grid infrastructures were presented. He also talked a little bit about Condor which is a job manager for pool of workstations. Condor exhibits interesting features such as check pointing, resuming  and  migration of processes.
Condor can be categorized as an opportunistic job manager which harnesses idle CPU cycles found into pool of workstations. When idle work stations are found, Condor uses them for executing foreign tasks. When an 'idle' node are claimed for its owner, any process submitted by Condor is then evicted and resumed to another 'idle' workstation detected by Condor.
OSG has selected to Condor as its job manager by default.
At the end of this afternoon, for the hands-on session, we follow the instructions given here.

c u tomorrow

First Session...

Today, we held our first talk session thanks to Rob Gardner.
I have to mention that this event is been held and sponsored by different organizations and institutions such as Colciencias, Universidad de los Andes, Universidad Javeriana and OSG, of course.
In this talk, Rob gave an overview about Grid Computing and the outline of that two week workshop.
He mentioned, during the first week, we'll have many theoretical sessions given by important members of the OSG community. They'll present projects on different areas such as applications and system.
The second week will have a different emphasis, mainly directed toward practical work. As Rob mentioned, never before a practical session in which 25 'virgin' computers will become part of a grid environment has been carried out. So, that will be very exciting.





Sunday, October 18, 2009

Converting ogg and m4a audio files to mp3 [Linux]

Days ago, I bought a 'mp3 device'. The nice thing about this gadget is that it is more than a mp3 player. This device can also take pictures, record audio and video, display plain files, among others. It's is very cheap, $60.oo, and now it's my partner during my daily long trips.
Today, I was setting up my device with some e-books and meditation CDs. However, I found that some audio files were with  m4a and ogg extension. I googled, how to convert from these formats  to mp3 and I found some useful thinks that I'm sharing with you.

From ogg to mp3

for file in *.ogg;do oggdec -o - "$file"|lame -h -V 4 –-vbr-new - "$(basename "$file" .ogg).mp3";done

From m4a to mp3

for i in *.m4a; do echo "Converting: ${i%.m4a}.mp3"; faad -o - "$i" | lame - "${i%.m4a}.mp3"; done

For additional short scripts, check this link http://gimpel.gi.funpic.de/wiki/index.php?title=Howto:convert_aac/mp4_to_wav/mp3/ogg_on_Linux.

Friday, June 26, 2009

PGF/TikZ and OpenSUSE 11.1

There are many Unix powerful tools that I love. Linux per-se and LaTeX.
If you're excited to present your technical ideas in a clever and elegant way, I encourage you to use LaTeX. I totally agree that PowerPoint and Impress offer a straight way to develop ordinary presentations. I mean, every one could put some bullets, add graphics, write a fancy title and so on. However, if you are interested to present a more interactive and attractive presentations, LaTeX is an important candidate.

LaTeX offers a wealth ecosystem of libraries to support the creation of elegant presentations such as:  Seminar, Propser, Beamer, and Powerdot, among others. I have not evaluated all of them but my favorite package is Beamer. This package offers interesting features for creating attractive presentations with moderate effort. Aside to those marvelous presentation packages, I found the PGF/TikZ package. It's an amazing library to create awesome diagrams, graphics and interactive presentations.

Nowadays, my laptop distro is OpenSUSE 11.1. I found it quite stable. However, OpenSUSE 11.1 comes with outdated packages for supporting the current PGF/TikZ release (2.00). Thus, I downloaded the PGF source code from sourceforge web site, but I found the installation documents very confuse.

So, I'm describing the steps that I have followed in order to enable the latest stable release of PGF/TikZ on my OpenSUSE 11.1 installment.
  1. Download the PGF/TikZ source code.
  2. Uncompress the downloaded file.
  3. You'll get a directory named 'pgf-2.00'. Inside of this directory you'll find the following directories: context, doc, generic, latex and plain. (As well, the README file). I assumed that you have uncompressed this directory in the ~/src/ directory.
  4. In my OpenSUSE distro, the pgf package is distributed in the following directories:
    • /usr/share/texmf/tex/generic/pgf
    • /usr/share/texmf/tex/latex/pgf
    • /usr/share/texmf/tex/plain/pgf
  5. Now, make a copy of these directories in a safe place.
  6. Erase them.
  7. Move the directories found in the recently downloaded PGF/TikZ package to the standard OpenSUSE LaTeX installation, as follows:
    • mv ~/src/pgf-2.00/generic/pgf /usr/share/texmf/tex/generic/
    • mv ~/src/pgf-2.00/latex/pgf /usr/share/texmf/tex/latex/
    • mv ~/src/pgf-2.00/plain/pgf /usr/share/texmf/tex/plain/
  8. Run the texhash command.
That's it. Now, you can test and enjoy the benefits of this powerful package (Check this link).

Good hack!




Saturday, May 30, 2009

diff -q -r

I love to program in Groovy/Grails platform.
I have developed a framework for executing applications over Grid infrastructures such as PRAGMA. This project is in early stages therefore new features and modifications are actively added.
However, sometimes there are changes to cause that some components interfere negatively with other components and to track errors are challenge task, specially in this kind of projects who exhibit loosely coupled architectures. In fact, this is a service-oriented framework if you wish. As consequence, in rare situations a set of events fall in place and produce unexpected errors. That situation happened to me.
Thanks God, I decided to use git for managing versions in my software and I could identify the last date when the software worked well. However, I was pretty sure that many modifications were not the cause of the fault. Then, I started to check differences between the last stable version and the last version. So, I employed the 'diff' tool.
If you use 'diff -q -r <firs-dir> <second-dir>', it searches for differences between these two directories and print out the files to actually present differences.

OK, you got the files to present differences, now what? OK, use 'vimdiff'. If you invokve 'vimdiff file-one file-two' it would present a screen divided in half, left side shows 'file-one' and right side 'file-two'. In addition, the program highlights the text segments different between the files. Then, you could decide what changes make and what ignore.

In conclusion, git is a great tool for managing files versioning, diff is an elder tool used for building the 'patches' of early versions of Linux kernel but it stills do a great job. Finally, vimdiff is a great complement to diff. :-D.

Good hack,

REFERENCES

Monday, May 25, 2009

Running groovy scripts from command line

Groovy is another language for the Java Virtual Machine(JVM).
Further of the ubiquitous Java language programming, there are several alternative languages for JVM, such as Clojure, JRuby, Jython, Rhino and Scala, among others.
Groovy is a relative new language who incorporates features from widely adopted and accepted languages such as: Python, Smalltalk, Ruby, and of course Java, among others.

One catching feature is that Groovy allows rapid prototyping. As mentioned above, Groovy incorporates a lot of fancy features such as closures, implicit casting, powerful operators over data collections, etc.
In particular, I love the possibility to write a snippet of code and quickly check if it fulfills with my expectations.

Lets look a trivial example. You are a newbie Java programmer and you wish to know if you understand how a loop works. How do you that in Java:
  • Write a Java class
class Looping {
  public static void main(String args[]) {
    for (int i = 0; i < 10; i++) {
       System.out.println("i: " + i);
    }
  }
}
  • Save this file  as 'Looping.java', compile it 'javac Looping.java' and run it 'java Looping'
Now, lets see how this can be done in Groovy (I assume that you usually work in a real operating system like Linux):
  • Write a text file
#!/usr/bin/env groovy
for (int i = 0; i < 10; i++) {
  println("i: ${i}")
}
  • Save this file as 'example.groovy', change its permissions 'chmod +x example.groovy', run it './example.groovy'. That's it.
No 'main' methods were required, no compilation of source code in JVM machine code; just write your code and run it.
Groovy offers a lot of interesting features. I mentioned just one that I considered useful for rapid prototyping, but there are more serious, well-elaborated, and amusing features that this modern language can offer.
However, the Groovy  Achille's heel is its poor performance. However, when current releases are compared with earlier releases we can say that great achievements has been made. (However, more work is required)

Anyway, if you are a Java developer and are starting to test new Java features and don't want lose a lot of time writing testing classes but scripts to test snippet of code, Groovy is an option. (...and slowly you'll start loving it and adopt it for production releases not just for testing purposes, I'll assure you :-D.)

Good hack!

References

Thursday, March 26, 2009

Installing packages in R

R is an open source statistical tool which has received a lot of attention in recent days.
For some time, I have been an active user of that tool because my PhD research requires some kind of statistical analysis. I found an interesting article about fitting distributions with R in which the author employs some R libraries that don't come included with the R basic installation.
The easy way to install additional libraries is using your 'root' system account. Thus,  execute 'R' and invoke the 'install.packages()' command from the R prompt.
In my case, I  selected the required libraries ('vcd' and 'fBasics') and 'OK' button. However the compilation process failed. So, previous to install/compile any additional R package it is necessary to install the 'R-devel' package.
Afterward, I installed 'vcd' first and then 'fBasics'. Now, I got a succeeded installation.

Additional Resources


Tuesday, March 17, 2009

inserting hibernate_sequence and current date and time in PostgreSQL

Recently, I need to add a record in a table from a database instance created by Grails.
Grails relies on hibernate to make persistent all domain classes defined in an application. Thus, most of the Grails applications define a hibernate_sequence in their database model.
In particular, I'm working with grails 1.0.3 and PostgreSQL as my back-end.

Now, I needed to insert a new record in one table from my Grails application which also has an  attribute of type 'Date'.

For simplicity assume that my table exhibits the following structure:

Table 'demo'

id -> bigint
date -> timestamp
name -> character varying(255)

Indexes:
     "demo_pkey' PRIMARY KEY, btree(id)

In order to make a proper insertion of a new record, execute the following line:

insert into demo (id,date,name) values (nextval('hibernate_sequence'),now(),'John');

;-) (It works on PostgreSQL, may be possible that other back-ends require a slightly different syntax).


Resources



Friday, February 13, 2009

My experience deploying the new security scheme in PRAGMA

New year and new security scheme has been deployed on PRAGMA.
In order to enable your Grid resource for all the PRAGMA users is necessary to uncompress the content of the following files in the '/etc/grid-security/certificates' directory:

Now, assure that you have enable the 'vdt-update-certs' service. In my case, the 'vdt-control --on vdt-update-certs' command failed, so it was necessary, prior to enable this service, to execute the 'vdt-register-service --name vdt-update-certs --enable' command.
Then, I follow the instructions provided in this link.

Finally,
  • vdt-control --off
  • vdt-control --on
I tested the certificates submitting a couple of 'globus-job-run' commands toward two different grid resources (komolongmace.uprm.edu and rocks-153.sdsc.edu).

Good Hack!

Monday, January 26, 2009

too many files open... error

Today, while I was saving one chapter of my thesis, I got this 'venerable' error:

Too many open files.

As consequence, the last modifications were not possible to be saved. Promptly, I looked for an answer and I found two links that you can visit here and here. The former link talks about 'confluence' application, that my Linux box doesn't run, but provided a useful hint, confirmed later in the second link.

The solution for my FC10 Linux box was append the following lines:

josanabr soft nofile 2048
josanabr hard nofile 2048

to my  '/etc/security/limits.conf' file. In fact, my user had a limit equals 1024.

Now, I'm in the game, again :-D

Wednesday, January 21, 2009

Installing hfbright - error 'cannot open type 1 font hfbr10'

Recently, I installed FC10 distribution in my new laptop. I employed the live CD available from the Fedora site.
One benefit of installing Linux from a live CD distro is that it does a minimum installation, different from DVD-distros that install you a lot of packages that you will never use.
However, many times you require some exotic packages that don't come in compact distros.
For instance, I write my documents in LaTeX and compile them with pdflatex.
Now, when I tried to compile my source files to include special mathematical symbols, an error message containing words like 'cannot open type 1 font' and 'hfbr10' appears in my Kile's log message window.
I solved this problem following the manual installation procedure defined in this readme file.
Then, I downloaded all the pfb files located in the pfb web directory, and copy these files in my /usr/share/texmf/fonts/type1/public/hfbright/pfb/ directory.
The following files config.hfbright and hfbright.map were copied to the /usr/share/texmf/dvips/config/. Theser were downloaded from the dvips web directory.
Finally, the updmap program was executed and my error messages were blowed out :-D.


Thursday, January 8, 2009

Advice for buying a laptop

Nowadays it is possible to find diverse price reductions in multiple articles, due to the current economic crisis.
Technological gadgets don't scape from this kind of discounts and you can find a lot of these discounts via Internet or in a mall store.
My favorite sites is compusa.com, in particular I'm subscribed to its RSS.

OK, I'm highly interested in update my four years-old laptop. It is a Compaq Presario R3000. I don't have any complains again it but new software products demand edge technology (I'm not talking about games, I'm talking about compilers and virtualization tools, :-P).
So, I started to look into computer manufacturers web sites such as HP, Sony, and Dell (I did not consider Lenovo but you can ;-) ).

From these sites, I liked HP and Dell because they allow me to configure my laptop according to my needs. However, I have an additional requirement, the new laptop needs to be sent to Puerto Rico (does mean, America Latina).
Although, HP sells laptops to America Latina, it does not allow laptop customization for America Latina, instead, you have to choose from one of the predetermined models for the zone.
Then, I began my purchase process with Dell.

Dell has a free telephone line in which you can contact to a sales representative and you can star to customize your computer. There is support on English as well as Spanish.
It was great, though it took more time that I expected, however, the process worth that amount of time.
(Note aside: Dell offers three years of guarantee for $75. Very cheap ;-).)

A final tip, due to my computational requirements I found very useful this site processorfinder.intel.com. There, Intel provides a friendly interface where is possible to select the processor family that you require. Then, a new page containing multiple characteristics associated with the family processor that you selected will appear. Again, you'll select the characteristics that you wish in your new processor, press the 'filter' button and 'voila', you will get a list of processors with their corresponding code names to satisfy the search criteria.
Excellent page!

An non-required advice, create in your mind the kind of computer that you'll need for the next three or four years, look around, compare prices, don't be rush in your buy, consider this buy as an investment then you need to think very well what is the purpose of this buy and try to balance the relation cost vs benefit. Then, go ahead, buy your selected item and enjoy it.