31. 7. 2012

I'm coding again

I loved to programming in my childhood and during the beginning of my career I just did some bash scripting and little bit of PHP. Now I devised the project which my boss approved and I returned to the coding. First things first and I'm doing little steps. Project is on PHP again and while I'm upset of the whole PHP, I'm planning to code in Java in the future. Funny thing - two of my friends with a similar nicknames have different experiences with Java - while Smoula hates Java, Shmoula loves Java. Greetings to them both and let's look at my project.

Short about, but I'd like to tell you more about generally useful tools instead of my project. It client/server application, providing telephone billing, imports from PBX and ITSP billing systems, custom reporting and exports, customer management, etc. That's enough for now...


This is a new for me and I haven't too much time for own API, so I read this short list of APIs and this comparison and winner is ....      SLIM [applause].

Client application w/ JS

Ajax based client application is imho the best way for my project. In my first research I chose jquery + jqueryui + dynatree, etc. I'm not fully satisfied with the jquery, mainly due to lack of object oriented notation, I feel dizzy({with(all)}, {that(really, {creepy, brackets})}) and closures. This is very nice comparison of JS frameworks, friend of my recommends me YUI and I'm considering MooTools Google Closure Sencha Ext JS too. But next time, at this moment a lot of working code is in jquery yet. Now I'm using:

PDF exports

I've tried the mPDF and html2pdf classes. First one is based on FPDF and HTML2FPDF and second on TCPDF. Both are huge and neither one can satisfy me. These classes have little bit different interpretation of the CSS and next limitations. Maybe you'll be satisfied, take a look at them, maybe not. Plan B? Of course, my plan B is generate PDFs thru TeX (probably ConTeXt) and plan C is Apache FO with XSL-FO. (I'll update this blogspot with the results)

XLS exports

I found PHPExcel (v. 1.7.6) and believe me, you don't wanna make Excel sheets. The overall CDR reports are huge and I need to setup some number formats, column width and bold text sometimes. I can use shared style which is great but I can't set any style to the whole column, i.e. "B" or "B1:B" or "B1:B65535". Due to this bug some reports are 5MB big and whole generating is so sssloooooow (up to 10 minutes)! Then I found that some method changes something in the PHP and it screw up some float calculations. Alternative way is write pure html table and save it as filename.xls, at first I thought about it very bad things but now I think this is much better way than using 22MB big disobedient and slow framework.

CSV imports

One of the few things which is working at first time is parseCSV. Next I needed to convert text files with the fixed width (columns) to the CSV. My advice: do not try to write anything in the PHP, it will be too slow and laboring. Use python instead: