How I made html look almost like word

So one of my projects was to take an existing program and port it to the SAP Web Portal. Yippee… not… The existing program was written in VB and takes data from some source, don’t know what it was, and plugs it into a set of word templates, and the templates are merged together to make a single Word document. At the time time I did not know anything about Apache POI and looking back at that technology, it really wasn’t that well developed.

So what was the solution that I proposed? Since it is going to be on the SAP Web Portal why not display it in HTML format? I mean it is a web page. All the nodding heads nodded, and all the nay sayers started to plot my destruction. So the data coming from R/3 was a given. So how would I display the data? I had to mimic the merging of documents as before. Average Joe Body Builder’s solution was to have the data returned in a flat XML string, and then XSL would have been used to transform the data to HTML. Java was used to execute the transformation. What about the merging? The XSL’s had to be merged. Since XSL is just a grammar of XML I used another set of XSL to merge the XSL’s together. Lovely. For those of you who would like sample code please place some comments, and I will do so.

Data was retrieved from R/3 using JCA/O, since that data was in XML format the rest of the process was as is described above. I had some utility functions to determine if the connection to R/3 was successful, that was important since the stability of the entire SAP Web Portal was like ummm not there! So I had to actually assume that connection to R/3 would at first fail before it would succeed.

I must say I did learn alot about how management works in this place. Basically it is “you will do what we tell you before we even tell you it!” and if we need something from management it is “we will get back with you at our earliest convenience”. This is during the time that I started to become more health conscious after a period of about 13 years. I would like to thank, we will call him M (M for Moe), for that. More on that later.

So in any case, R/3 to XML transformed to HTML. The HTML used a combination of CSS and javascript to make the result look almost like the origina word document! What do you say?!

work environment

Here is how things happened where I worked. CYA (cover your ass) and don’t expect anyone to ever admit a mistake. They would rather lose a finger than do that. Which eventually explains a lot about the state of affairs in this part of the world.

One of the reasons why I wanted to work in the middle east is because I was told the work environment here is very casual, very laid back and my off hours are my own. This is still essentially true. The only problem is that one can still be jerk in a casual work environment. Since I work in IT being a jerk just compounds everyone’s misery, and since I am in idealist that believes in the Golden Rule, that affects me even more. As a result of my experience here, I don’t believe in the Golden Rule as much as I used to. That is not to say that I have lost my ideals, I am just not as willing to give others the same kind of leeway as I used to unless I see that they are similar to me.

It started out like this. We will call him V (as in Vendetta which he seemed to have). He is one of the most sarcastic and arrogant people I have every met. I never knew someone could be as sarcastic as this V (for Vendetta), but he sure did let me have it. I am not sure what was going on in his head, but he smoked like a chimney, his breath was constantly of cigarettes, his lips were purple, and on top of that he thought he was Mr. Wonderful. He was actually Mr. V (for Vendetta).

He gave me a programming task which I knew was not done efficiently, so after analyzing his problem, I told him that I could reduce the development time from 9 days to 3 days by changing how it is coded. He said great, and he told me to get it done. He then comes back and says that I could get it done in one work day if I work the weekend. So the fool that I was I did it (more about why I accepted later). I spent 36 hours straight writing the code and another 5 hours testing it thoroughly. That would be 41 hours. Overtime was … DENIED…. On top of that I had to come into work on time after the weekend. That was my first taste of dealing with V (for Vendetta) and that lasted for almost 3 years. In another instance he came to my desk demanding an explanation for some code, and he was kicking the ground as he was doing it like one of those bulls in a bull-fight. I had to tell him to leave my desk. In another instance the wonderful V was giving me the wrong formulas for my work! I started cursing him in the boss’s office. Man that felt good! But that was a mistake.

I had another coworker. We will call him F (F for faggot farthead Farsi). This guy was shorter than me, I am only 5’9”, but he had the ego of Napoleon. Every few weeks was a threat from him, he would say things like “You still work here?” or “You’re a contractor, you could go at anytime”, and then I would work like greased lightning. I suppose it did the job for what he wanted, but then finally I had an epiphany. After all the hard work, and working overtime, and extra effort, and acceptance of their threats, and abuse for almost 3 years mind you, they were going to release me. I couldn’t accept that. Nothing in me could accept that. Which is when I realized I was being played for a fool by the various people whom I reported to. Sure others had it worse, but I couldn’t accept the fact that I had played the games by the rules they wanted and I accepted whatever they gave me out of hope that things would get better if I just remained patient. They were going to release me! My mind was racing… ‘Hey F, didn’t I take whatever you could give?! Why did you abuse me all this time?! Hey V what did you want from me?!’

They put my on assignment in a different group, where I saw the opportunity for my own survival. I hurried up and made a fabulous demo showcasing my computer skills, and I made everyone look good, all in record time by working nights and weekends to get this demo. The result was a demo showcasing crude oil data in a report that looked very similar to a word document. After the demo I had made the case to be transferred over to this new group. They did, but I had to stab my soon to be former boss in the back to do it. I hated myself for it, but I hated all of them for what they did to me. This was the first time I have ever back-stabbed anyone, and in my defense, I did it because I wanted to keep my job. Otherwise if I played the nice guy I would have been back to America 4 years earlier.

My first memory

I reached the Bahrain airport on my way to KSA, and met my aunt and uncle who were waiting for me there. It was almost a sense of relief that I had some relatives who would be able to watch out for me. I was overwhelmed by a sense of grief for turning a page of my life, and I knew I would never be able to look back again. My marriage was on the rocks, but recovering, I had paid off all my debts and I was looking for a new life. Prior to my accepting my job at KSA, I was working in the telecommunication industry in America. I got started as the dot com busted (great timing eh?). So every job that I was getting was turning out to be a dud. Reaching KSA, I thought, I have reached the place where I need to be, I am not going anywhere else!

My first blog

It is ironic that my first blog comes at a time when it seems that I am nearly completing a stage of my life which was filled with events that I should have written about on an almost weekly basis. I wish that I had the energy during those past almost 7 years to state my thoughts about where I have been and why I went there. I suppose now is as good a time as any to begin with a retrospective, and then move forward by looking farther into the past as best as I can recall. Hindsight is 20/20 but in this instance I almost guarantee that it will be clouded by my present emotions. Part of me feels a loss

Living for the past 7 years in Saudi Arabia, I think I can offer the perspective of an outsider looking in, which for many Saudis will be hard to take. Not all of what I have learned is about KSA, but almost all of it is a result of being in KSA, whether it is my interest in computers, body building, health, Islam, workers rights, or tasavvuf, or comedy.

Many of those who know me, know about my sense of humor whether it is, the dry kind or the wet kind. Now I might seem down now, most of my time is spent trying to work as little as possible, and laugh as much as possible, just ask Wade….