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.

Wednesday, December 31, 2008

Mozilla your new Desktop?

Since Netscape released its navigator source code, the developers community has an active participation in the development of the Mozilla platform, 1998.
This platform has leveraged the development of multiple, different and exciting projects such as Thunderbird, Songbird, Flock and Firefox, of course.
Mozilla exhibits a modular design that allows to expand the projects functionality through an architecture based on plug-ins.
Of course, I'm a fan of Firefox and I want to mention three plug-ins that have gotten my attention.
  • NoScript: This project aims to block all the scripts contained in the web pages that you regularly visit. Then, it avoids that you browser becomes overloaded for executing multiple instances of javascript code and saves you from running javascript code from unstrusted sites, as well.
    As a matter of fact, three weeks ago appeared a news about how malicious javascript code embedded on Internet web pages, retrieves your PayPal account info and sends it to Russian servers. Certainly, NoScript will reduce the possibility of lose your valuable info.
  • ScribeFire: This plug-in provides a simple to-use interface for publishing entries to your blog. In addition, it allows you to incorporate ads to your blog in such a way that you can earn some money meanwhile you write for fun ;-). In fact, I write for fun and I subscribed to the ScribFire ad program but still I didn't earn a penny for my writings ;-), but who cares :-D, I'm enjoying this journey ;-).
  • Ubiquity: This project was introduced on August, 2008. As its statement says It's an experiment for connecting the web with language. Then, it provides a friendly interface that allows you to execute multiple tasks such as to look up info on google and wikipedia, share info with popular social networks, edit web pages, interact with google maps, among others.
    I have never written something about this plug-in, because I found that it imposed to my browser a high overload, however, today I downloaded the last version and I found it very functional, gorgeous and exhibiting a promptly response to my requests.
As you can see, Mozilla, in particular Firefox, offers an amazing platform that can leverage your productivy if you know the proper plug-ins that best fulfill your needs. I have shared some of them with you and I hope that you give a change to open and smart computing platforms.

Happy new year :-D

PS: BTW, my computer is a Compaq R3000 with 1Gb of RAM and AMD Athlon(tm) XP Processor 3000+, running Fedora Core 7. :-)

Sunday, December 28, 2008

Variety of Virtualization Appliances

On December 17, was announced the release of VirtualBox 2.1.
This release comes with a lot of new features such as support for 3D graphics and support for virtualizing x86 and x64 appliances.
Now, you could execute your 3D Windows games inside your Linux box.
As well, you could test any x64 operating system and your x86 legacy system.
However, if your machine has a modest hardware resources you might experiment a low performance of your appliances.

That situation can be alleviated if your machine is empowered with processors that include a set of virtual instructions.
These instructions are tuned for reducing the overhead to occur during the virtualization process.
Intel offers the VT technology. This technology masks the virtualization operations enhancing the performance of virtual appliances.

Then, if you want to exploit all benefits of VirtualBox, I highly recommend you to upgrade your hardware. Thereby, buy a multi-core processor with support for VT Technology, 3 Gbytes of RAM, and video card with GPU.

Good hack!


Resources