PHP

PHP Bijoy to Unicode Converter

In our latest project at PROGmaatic, we needed a converter to convert lots of information written in Bangla. Unfortunately  everything was in Bijoy (SutonnyMJ) font. But our requirement was Unicode formatted data and language preference was PHP.

 

I thought, no big deal. There should have been lots of converters available, and most of them might be in PHP. After hours of searching (Yes I don’t like coding when I can find something free :D).

Well, I haven’t found a single script which would do what I needed. Two of the following did help me to understand how to develop the converter:

So finally I end up coding one myself. Fork it from my Github account.

In the coding process I have learnt two valuable lessons 🙂

1. javascript string method ‘substring‘ is not equivalent to PHP’s string function ‘substr‘ [I spent only 5 hours for this mistake!!!]

2. Nothing is better than step-by-step Debugging!

 

Future modifications:

1. Make mbstring independent. (I actually figured out the way, but right now I don’t need it since I have mbstring support :))

2. Make memory efficient.

 

Check the code and let me know if you find a better way, find a bug or need some modification. I will be happy to make the changes and give you the credit 🙂

 

How to add scheduled task to run php scripts in Windows

Few days ago, for one of our PHP / MySQL project, we were needed to run two php scripts at every minute. We usually develop/deploy our projects in LAMP environment, where we use crontab for our scheduled tasks. But our client have wanted us to run the system in Windows. So we have chosen  XAMPP. To run our two php scripts every 1 & 2 minute, we thought of developing a simple tool for windows which would run at background and execute those two php scripts. Fortunately we have found about schtasks, a native scheduler in Windows to run scheduled task smoothly in command prompt.

What is the difference between the variables of Python and other language

If you are from C/C++/Java and started learning Python, this should be an interesting topic for you.

In languages like C, C++, Java, PHP etc a variable is a memory location where its value is saved. When you copy a variable into another variable, both of them still in existence and you can use both of them.

But in Python, its different. As a matter of fact Python don’t have any variables, it has ‘name’ or ‘identifier’ attached to an object (everything in Python is an object).

Let me clear this using an example: