obov v1.1.0 released
by ricardoz on Aug.04, 2008, under Security
A new version of obov is available for download. Some nice new features were added:
- Methods to generate passwords using the HMAC-SHA1 algorithm
- A handy utility method to generate secret keys (seeds) based on any given string
Go get it!
Read a file into a byte array
by ricardoz on Jul.22, 2008, under Tips
Need to read a file into a byte array in memory, here’s a simple code sample.
(continue reading…)
obov v1.0.0 released
by ricardoz on Jun.27, 2008, under Security
obov stands for OATH Based OTP validator. It’s a 100% pure Java library that provides simple to use methods to validate (and related utilities) one time passwords generated by OATH compliant devices.
(continue reading…)
Paginated lists made really easy (part 1 of 2 – front-end)
by ricardoz on May.14, 2008, under Articles, JavaScript, Web related
You have to display a list of items in a web application, for each item allowing several operations (ie modification, deletion, etc.). The list can potentially be quite long, so pagination is required.
This scenario is common in backoffice web applications and public web sites, be it for administering information or as search results display, etc.
I’ll describe a simple way to implement a lightweight pagination engine that minimizes load on the server and gives the user the better experience possible. In this first installment I’ll focus on the front-end side, describing how to lay out the HTML, load it using AJAX and implementing the basic operations the user needs to navigate in your paginated list.
(continue reading…)
Authenticate users using i5/OS (AS400) credentials
by ricardoz on May.12, 2008, under Security, Tips
The folks at IBM have a nice API to use i5/OS (AS400) stuff from Java code. Check it out at http://www-03.ibm.com/systems/i/software/toolbox/index.html.
What I particularly find very useful and have used often is to validate user names and passwords with the AS400 authentication services. The following code validates a userName and password.
(continue reading…)
Very easy FIFO cache
by ricardoz on May.02, 2008, under Performance, Tips
There are plenty of times when you need a cache for Java objects in your code. A very easy to use and simple implementation of a cache is provided with Apache ORO, wisely called CacheFIFO (http://jakarta.apache.org/oro/api/org/apache/oro/util/CacheFIFO.html).
(continue reading…)
Authenticating users using Unix or Windows credentials
by ricardoz on Apr.22, 2008, under Security, Tips
It’s usually very nice, and sometimes a requirement, to validate usernames and passwords using existing credentials. And in most situations big frameworks or single sign-on systems are just damn overkill and complex.
If you need to check your users credentials via an existing Unix system (that supports PAM) or a Windows domain controller check out (continue reading…)
AJAX autocomplete
by ricardoz on Apr.17, 2008, under JavaScript, Tips, Web related
Using a nice AJAX auto completable input box is much nicer (for the user) than a combo box with 100 options. If you use jQuery, you may use a quite easy yet powerful plug-in called jquery.autocomplete (original, eh?). Grab it at http://www.pengoworks.com/workshop/jquery/autocomplete.htm.
(continue reading…)
Don’t raise exceptions for every little thing
by ricardoz on Apr.10, 2008, under Performance, Tips
Just in case you didn’t know, raising an exception makes the JVM do a lot of dirty work breaking execution flow and stuff. (continue reading…)
Keep it simple!
by ricardoz on Apr.06, 2008, under Performance, Tips
Do you really need to have a database table with all existing countries? What’s the benefit? Apart from adding one more database query to each page hit and an array to each users context while loading that form…
Think it over, every software component’s goal must be, first of all, to satisfy the users needs as fast and as reliably as possible. Considering the “fast” part, you must always evaluate if it’s really necessary to store this kind of info in a database table, and penalize the applications overall performance by adding another database query, recordset run through and a whole bunch of new objects in an array in request or session context.