Showing posts with label ruby. Show all posts
Showing posts with label ruby. Show all posts

Friday, April 19, 2013

Inserting data into DB2 from CSV file (using Ruby)

I recently had to import some data into DB2 and I came up with this little program to help me out. I had to search the Internet for a few hints and finally came up with this code that was useful to me. I hope that it will help anyone that needs the same thing. I am pretty sure that this can be accomplished even easier, so if you have a suggestion, please let me know.


Before you use this you will need to install appropriate gems.

gem install activerecord
gem install ibm_db

If you are behind the proxy, do not forget to set it: SET HTTP_PROXY=http://user:password@ip-address:port

Thanks

Friday, August 31, 2012

JSF2 Byte Boolean Checkbox

A few days ago I needed to convert old Icefaces 1.8.2 (JSF1.2) project to Icefaces 3.1 (JSF2) and found a problem when converting Byte to Boolean for the checkboxes. Byte value was generated by Hibernate from database and that is the model that already exists so we really cannot change that. The option with JSF1.2 was to implement Byte to Boolean converter and override rendering kit to call it. JSF2 does not allow this anymore or it is not working (expression library only coerces String to Boolean). After some research, the only option was to automatically generate Boolean getters and setters for existing files. Since there is quite a bit of them spread through different projects, I needed an utility to do this. I ended up writing a small Ruby application for this job. Here is the code:


This is by no means perfect code, but it did the job. If you have a better suggestion, please let me know!

Thanks

Tuesday, January 24, 2012

Ruby log analyzer: rula

This would be my first Ruby application. Name of the application is rula, meaning RUby Log Analyzer. I started this project as I needed to do several searches on the log files that would include previous filters and that would not consume a lot of memory (I intended to run this on the server). I have submitted the code to Git, to location https://github.com/bcavlin/rula, so please feel free to check it out. Application is only working in console mode right now, but I intend to create curses support too. As far as the version, this would be version 0.1. Please feel free to develop it to suite your needs. Here is the image: