A small hack

“Hi can you help us? Everyone has gone home and we need the financial transactions for our new financial app, it is super many transactions. Is there any way we can get them to our Windows share with period number in the filename before tomorrow. We like to test the new app during the Midsummer.  Everyone is gone, you are the only one we could get hold of. Can you help? And yes we need the file to be tab separated.”

In Sweden we take Midsummer seriously, we basically close down the country to party. But this was just a five minute hack, so I promised to help out just for the hell of it. First a little detective work, where the f-k are the transactions after a short while I found them already being in a SQL table in the Data Warehouse, great! It’s just copy a job and adjust a bit. Five minutes later I could call back “You have your transactions in your WinShare.” “Thank you ever so much, you are fantastic!” Some times it is not easy to be humble, this is one of those times. I remember another midsummer when I was not so cocky.

Some years ago I rebuild the Linux system in the ETL server of the Data Warehouse on midsummer eve morning in an attempt to connect ODBC to Iseries DB2 systems. In the middle of this my siblings called me and told me they were waiting on me going out to the countryside. I stopped my rebuilding sure my tinkering could not possibly intervene with the normal operations of the ETL server. Of course it did, it killed all ETL jobs for the entire holiday. The guys responsible for the Data Warehouse had to work two days repair the damages, and they made me promise never to do ANYTHING  next midsummer eve or ever any midsummer eve after.

And now I just did it again! I hope noone ever finds out:) The job I just assembled and run:

A mini app!

Yesterday a consultant called me “Hey Lars I’m building a new app feeding a new financial app with master data from SAP. They need the the data in tab separated files exported to a windows share. Do you have standard functions for that in the Data Warehouse or do I have to code that myself?”
“Funny you mention this, I created a similar app  the day before yesterday.”
“First the tab separation.    
You do this by adding a delimiter to the sqlconverter_CSV.php”:
“Next export to a Windows share. The Data warehouse supports the CIFS file system, just do a CIFS mount and copy the data to the windows share.”
“Okay” the consultant replied.
Later at the the end of the day on my way home I passed the consultant. I asked the consultant if he had any more problems. “No I’m done. Six feeds from SAP exported to this new application, tested and put into a daily production schedule ”:
“And a button on an Excel sheet, so the finance manager can fire off the export at will..”
“Why in Excel” I asked
“Why not” the consultant replied.
“It looks you made a nice little mini app today.”
The consultant looked at me and said “Miniapp?!? Do you realise how long time this would have taken any other place?”
“Yes I know” I replied, “but here it’s a nice miniapp”.

Actually it was a hell of a job done by the consultant, no matter where.


ITL - awful syntax awesome functionality

Last week I was asked If I could help design the integration between ERP systems and a Jira application, the idea was to deploy a new SQL server instance and an application server to create a “funnel” application of some sort. The ERP data should be massaged into an access friendly  format for the Jira app.
I like agile development so I created a crude prototype for testing and then  iteratively refine the prototype together with users, the first thing I did was to create a process map:
For the prototype I suggested the Data Warehouse since it is up and running and is designed for this type of applications. For this first prototype we decided to use a few handmade MS Excels as data, these Excels were FTPed over to the DW FTP landing zone, and then I created an ITL script:
If you look carefully  you can see I added support for an XML and a cvs format as well.
The I run the script:
And the result:

Now we have to wait wait for the Jira guys to tell if this table is OK for them or if we have to modify our prototype.
As you can see there are some functionality cramped into the script. Look at the <forevery>  line, intersect=FTP, means this list is sifted by the actual FTP directory, removing lines which have no corresponding file in the FTP directory, which makes the script simpler since we do not have to think about ‘file does not exists’ conditions.

FTP is not something used for anything else than truly public data these days, but it is easily to setup and for the prototype with test data it works well.


PHP at Bloomberg's - 4

Part four, requesting data (this post)

In the last post (which I hoped to be the last) in the series PHP at Bloomberg’s I described how you fetch a result with a responseId after you have requested information from Bloomberg’s.
Having shown the ‘retrieve app’ for the business owner I was asked “Can’t you request an information set in one shot mode, and then retrieve the result”. “Why do you want to do that? We schedule a request periodically at Bloomberg and then we just retrieve the result when time is due and have ever green data. Schedule once fetch fresh data forever” I responded. “Schedule periodically at Bloomberg has contractual implications. We like to be able to schedule ourselves. We like the abillity to request "one shot" or “ad hoc” reports then fetch the result, and schedule this daily. We know this is more cumbersome, but can you have try?”  
Easy I thought, first I create a job to send the request to Bloomberg and then wait for the report to be produced:
Then I had to modify the PHP code from the previous post a bit. In the original code I create the parameter list directly in the PHP code as it is just a one liner:

But here the parameter list is hundreds of lines. I decided to specify the list as plain XML text following Bloomberg SOAP standard, (you see it above in the <soaprequest> tag). And add code to convert it to an array:

I added a <top> node making the XML well formed and via JSON encode/decode created a perfect array for the soap request.
Then I just run the job and after a few tries it worked. This was easy, unfortunately it turned out to not be as easy with the scheduling. Right now I’m thinking about how to solve the scheduling, but there are some twists to it that I don’t get my head around. When the scheduling is done I might write yet another post about PHP at Bloomberg’s.


Den Bock zum gärtner machen

Some while ago the company decided to make the goat the gardener, so they put me in charge of group codes, not only the application managing the codes (which I agreed to), but also the codes themselves. I told all and everyone I’m not qualified to do that and all and everyone agreed. The codes are serious business e.g. we have a number of codes to classify our products to keep track of what we sell and analysing marketing trends etc. We have number ranges for parts. If these codes are messed up the consequences may be dire. I take the codes dead serious, that’s why I said “I’m not qualified” in the first place. Some may think it is easy to hand out and keep track of codes you only have to be careful, accurate and meticulous. It’s easy to say, but if you are the antithesis of those traits it is very very hard to keep accurate records of things. If you add to that inability to correctly repeat manual tasks and periods of indolence, it is difficult. (That’s why I became a programmer not a keeper of records.)

I was assured “You do not have to keep track of the codes, the responsibility sits in the business. This is a self service application.” And sure as hell the first thing happend “Hi Lars, I’m Riccardo responsible for new spareparts at the Milano Factory, I need new spare part numbers, can you help?”
“Well you know, you are supposed to do that yourself, frankly I do not know how to do it” I responded.
“I’m told you are the expert and this is a matter of urgency we need those numbers now, please”.
After an hour I had figured out how to assign spare part numbers to Riccardo.
Riccardo was just the first, almost every day I get new requests which I forget about or put at the bottom of my pile of tasks to do. It takes me hours to do these tasks, which in the hands of a capable keeper of records would have been expedited in minutes, what they do swiftly with confidence, I have to check, cross check and check again, as I said I take this seriously this must be correct the first time.     
The other day I was cced a mail conversation about MAC addresses. I did not look at it, but these mails just kept coming, I opened the fifth MAC address  mail, to my astonishment I realised I was responsible for handing out MAC addresses, not only within the company but to sub suppliers too.
In this last mail a purchaser begged for more MAC addresses, a supplier had just stopped production of a component the Tierp Factory was in short supply of. I take codes serious, but that’s nothing compared with production stop in a factory. I take great pride in helping the factories improving their processes by better IT systems, Reading about halted production really got me going, in no time minutes that is I produced the required MAC addresses, later it took almost half an hour for me to check I done it right.

Riccardo does not exists, but I get similar urgent requests almost daily.


Find an item in SharePoint

I got a request from user “Can you help me find number series owned by ‘AFS’, it seems I cannot search myself”. Sure this easy - SharePoint to the rescue:

Easy peasy I thought, but Oh no the dreaded 5000 limit again:

I tried the search window, but no SharePoint is relentless:

No! Search cannot be done in SharePoint. Why am I not surprised?
Ok, Excel to the rescue:
Export the SharePoint list to Excel. First I get a friendly reminder:
Yes MS Excel is compatible.
Then I get another friendly security notification:
This I’m not sure what it is about but let’s go crazy, Rock’n’Roll I press ‘Enable’.

And voila here is Excel with its working search function, working in no time on super large datasets (5000 items and even larger than that):

And the result:  

Can it be simpler? Thank you SharePoint for superior search functionality😀


Expiration date

This night my telephone rang the alarm bell to tell me my mail password had expired. To my surprise it just did it once, I expected it to wake me up every hour or so.
This morning when I switched on my computer I was greeted by ‘your outlook password has expired, consider changing…’.
‘Great’ I though, Sunday morning at home changing Windows/Outlook/AD password have never worked for me before. I always end up calling the support desk and hear them say ‘this look odd’ and then they reset all that can be reset for my account and then it works for another password period. That procedure however requires I’m at the office work hours.  
‘Great’ I though, ‘Sunday morning and I cannot log in to the company network’, I had planned to work the whole day. Anyway I had to try the password change, lo and behold, I just ctrl+alt+del ‘change password’ and it worked like a charm, the same thing with my mobile, just changed the password and the mail started to replicate. I was stunned! First time ever the password procedure worked for me. Now I only have to sit back and wait for a number of ‘job failed’ mails. Many backend jobs need access to network resources like email, databases etc. In theory you should create special userids+fixed passwords or ‘bypass procedures’ for such jobs, but this often takes effort and time you do not have and you definitely do not want to wait for this while you are developing a new backend process. I use my own userid. I’m sure many of you do the same. After a while you forget all about it, which means ‘failed job’ mails turns up somewhere and you say ‘f-k I forgot about this, I need to fix this properly’, then you update the password and forget about it until next time you password expires.

Software expiration timing.

Many years from now, 04:00 in an Italian hotel on our first honeymoon night, the night porter was banging on the door, telling me he had an important message for me. It was from the company, the company computer had stopped, it refused to do anything from midnight. After an hour discussing with the operator back home I realized the RACF compatible security system ‘Top Secret’ had silently expired three months in advance. We had to wait until the ‘Top Secret’ guys woke up, they promptly sent a patch and promised to remove all hard stops out of the software, later I was told all ‘Top Secret’ installations had stopped the same night.
2009-01-01 05:00 coming home after a serious new year's party, almost still with the funny hat on I turned on the computer just to check everything was OK. Of course it wasn’t, (the VPN software had expired 2009-01-01 00:00). I ordered a more nearby colleague to take a taxi to the office to check what the problem was, he reported all was OK, it took me a while to find out it was ‘only’ the VPN that had expired. Together with IT-support I had it all fixed by the afternoon and could go to sleep.

Software should ideally only expire the second or third  ‘work’ Wednesday in the month at 11:00 nonsensitive months, at the company that is February, April, May, October, November. There is as far as I know no software that have an expiration mechanism that can follow my recommendation. I try to go for the 15th in nonsensitive months, December and January is a nono! Interestingly the old Romans did not have month names for this period of the year, they only had ten months, I bet they foresaw the evil of having software expire that time of the year.