February 18, 2005

Presentation of table with alternate row background colors (works with Java, .NET, Ruby, everything else too)

Yesterday my team member asked me (after spending 2hrs) for logic for presentation of table with alternate row background colors. I felt that it may be simple to people who know it and difficult to others, hence I am blogging about the solution.

This solution works with Java, .NET, Ruby, every other language. I’ll use HTML example for simplicity and focus on solution rather than technology syntax.

First, declare two style classes (or something you need to set the font/background/etc that needs to be altered):

<style>

.rowstyle1 {background-color:white;}

.rowstyle0 {background-color:lightyellow;}

</style>

Second, declare a numeric (int) variable to count (running number of) the table rows:

int rowNumber = 0;

Third, increment the running number before rendering the table row:

rowNumber++;

Fourth, use the running number to assign the style class to each row:

class='rowstyle<%=(rowNumber % 2)%>'

Post me if you need help with logic building in any situation. I’ll try to help.

January 26, 2005

Using NDM (Network Data Mover)

This is my old posting posted at planetsourcecode.com which I am re-posting on my own blog...

Recently, I got an assignment to create a module for archiving the transaction files. The files range from 1KB to 100GB. The system gets about a million such files everyday for transactions generated for Asia pacific region from Citibank customers all over the world. The destination can be any type of system (windows, unix, mainframe, etc).

Good thing for us is that these files can be identified by its sources and time zone. The best part is that 100GB files comes from US, they are consolidated files and max 12 a day. I need to focus on the Japan firm banking system since they have multiple 1KB files and all need to process immediately.

Unfortunately, there is no Java API to do it and we cannot use 3rd part tools. I have written such solutions in Unix shell scripts earlier too, hence the concept is clear.

Solution:

1. Java component to go round-robin to poll the incoming folders (one for each destination) to look for files. This component will manage threads for using existing NMD licenses of Citibank (configurable in XML file).

2. Java thread component to create threads using the priority set in configuration for each destination folder.

3. Java component to write the Unix shell script and execute it using JNI and track the Unix process.

My own free web email website (not yet hosted)

This is my old posting posted at planetsourcecode.com which I am re-posting on my own blog...

I am fascinated by the free email websites coming up every since Hotmail was bought by Microsoft. I am ready with my own free web email website solution for someone to buy or hire me to create for them. Let me give an overview of what and how I created.

Tools and Technologies: Microsoft Exchange Server, COM components, , SQL server 6.5 and site server

Microsoft Exchange Server will be used to send and receive the mails.

We’ll deploy the COM components in transaction server to use cluster of servers to scale for high number of users expected on a free web email website.

SQL server 6.5 to store the emails. Exchange has its limitation with number of users and size of data.

Site server to authenticate the users.

We’ll create COM components for:

1. User registration and Login using site server

2. Inbox view using SQL server

3. Compose and send mail using exchange. Save mails in SQL

4. Read mails (anything@mydomain.com) and save into the user’s account.

I am also working to create this solution in CGI or Java based technologies. Send your comments, it will help me.

Understanding Component Object Model and Distributed Component Object Model

This is my old posting posted at planetsourcecode.com which I am re-posting on my own blog...

Component Object Model (COM) is Microsoft's object-oriented programming model that defines how objects interact within a single application or between applications. In COM, client software accesses an object through a pointer to an interface (a related set of functions called methods) on objects. Both OLE and ActiveX are based on COM.

Distributed Component Object Model (DCOM) allows to run COM remotely to facilitate the transparent distribution of objects over networks and over the Internet.

January 23, 2005

Internet Printing Protocol (IPP)

We have to deliver a POC in 3 days using IPP, that is Internet Printing Protocol. Essentially, IPP is a standard network protocol for remote printing. Remotely, we can do all the things we do with a printer on our desk like printing pages, managing print jobs in the queue, setting the paper, etc.

An IP is assigned to the printer which enables us to uniquely identify the printer. Now the printer can be placed locally (on your desk) or anywhere in the world. As long as it is connected with the internet, we can use it.

Think of it as an e-post enabler, we can take print job on our website (or any application) to deliver printed pages (anywhere in the world) to the intended recipient of our user. All we have to do is setup print shops across the world with printers on IPP. As soon as an order is received, the print is fired.

We can authenticate and encrypt the print jobs to make IPP safer to use.