strife's devLog

Category: Programming

SVN Log Generator based on user history

I faced with the problem of writing reports. Most of cases what I do at work is the same as what I pushed to the repository. If you still use SVN (no idea why though) then you can use this script to show all your comments in svn log in this week. It shows logs only in current week.


Example Output:


300px-Python-logo-notext.svgConverting Large XLS, XLSX files to CSV using Python

I was in troubles to convert big xlsx files in PHP because there is no such a library that could make it as good as possible. What I’ve found out were libraries that could manage xls / xlsx files but it took a lot of time and performance was horrible.

So, not spending too much time to think about it I’ve figured out to leave PHP and try to make it in Python. What I wanted to achive was converting xls files into csv and handle it in PHP.

In Python we got xlrd library that enables us to make this “crazy” thing. Here it is: You can install it using pip, such like:

But for my case it was better to use VirtualENV which is better solution when someday you’d like to move your software somewhere and you forgot about installing all those stuff. However, each way you chose would be fine till it’s working.

After installing required items all you need is to run the script that converts xls into csv. I have already written simple script that can make it. Please find code below and save it to your local system setting the proper permissions right (chmod +x filename).

If you have a python script created in your local filesystem the next step would be manage it from PHP. And this is most simplest solution. Using exec, system, or shell_exec solves the problem.

OR in command line.

I know that solution is not really clean but it works. To have it more elegant I would suggest to create some kind of service in Python that handles it in a good way. I will think about it …

Note: I have also fixed issue with Long numbers in XLS.

If you need to parse big XLS, XLSX files I would suggest not to make in in PHP. Just parse this using JAVA where PHP would be used only for UI.

Any questions, let me know. Please find comment form below.


prestashop-logo[Prestashop] How to Debug Prestashop API?

There are severals ways to make it right. Below I described my way of testing Prestashop API using cURL as the tool that checkes all dependencies. After enabling Prestashop API in your administration panel, save the API Key.

Depends what you want to check your xml files would be different. All possibilites you can find in the Prestashop API documentation, for instance: Most important thing here is the XML file.

In our example we will add a new product to the Prestashop API. Here is ours XML file with data.


Save it and execute command below.

Pretashop has RESTful API so it depends on the http methods that you would be able to add / edit or remove products.


scripts-drupal-logoDrupal, UberCart – How to return / get back the cart from database

I’ve tried to found the solution how to revert the cart that is already in the database but as always I didn’t found any good solution though. I was looking the files which can help me to regenerate it and finally I’ve found it! Below you got the code that get any cart from the db and populate it.



prestashop-logoHow to Change the Original Price in Prestashop

That’s a really useful snipet for anybody who wants to change the original price to the new one.

Solution for this is very easy …

Ok .. here it is:

Product.php, line 1686