PHP TDD (Test Driven Development)

Nowadays almost all back-end developers are familiar with TDD. It has much more upsides and very little downsides once the actual classes and the test are in place. If you are just experimenting with your code and do not need it for a longer term, you may not need TDD in that case. TDD is actually essential if you want to maintain your code base for a long time. So what does the Test Driven Development consist of? Well, there is the unit test that…

Continue reading »

How to Convert your javascript file to a Windows .exe or .dll

Nowadays an average web developer will need to know a broad matrix of skills in order to do his/her development job. HTML, CSS, JavaScript, AJAX, XML, some server side language, some linux/unix/redhat command skills, some apache, some database skills, standards, accessibility, SEO, etc…, the list goes on. Parts of the list are also multiplied by (or raised to the power of at least 10) number of browsers you want to support.

Continue reading »

Turning on/off warnings and errors in PHP

Write a script to determine whether the page is on a local, testing, or live server, and set $state to “local”, “testing”, or “live”. Then: Or if you are sure your script is working perfectly, you can get rid of Warning and notices by putting this line at the beginning of your php script: error_reporting(E_ERROR); Before that, during the development, I would properly debug my script so that all notice or warning disappear one by one. So we should first set it as verbose as…

Continue reading »

How to disable cache for images in all browsers

This tag was recommended by some developers but it may not work if you have dynamic file uploaded to your server. <img src=”my-image.jpg?cache=1″> The best tag you can add to display a brand new image is to use the function time() in php to generate different time for each time a photo was uploaded to your server. <img src=”my-image.jpg?cache=<?=time()?>”>

Continue reading »