5Mar/130

How to connect to rare databases in PHP (informix, oracle, db2)

Recently I took part in integration project and faced interesting problem. PHP application that I deploy must communicate with Informix database for data selecte. This php application aims to corporate market, so its not a extraordinary case. I see that it may require connecto to Oracle or DB2 in near future.

Yes, PHP itself has wide choose of database connectors, which is a good option to have native database support. The only problem is that most of them are used so rare that are usualy not compiled in all modern Linux destributos. For example in Ubuntu server 12.04 there are five most pupular php5-sybase php5-interbase php5-mssql php5-mysql php5-pgsql.

Thinking of it, I found one interesting solution.

Filed under: dev, php, tricks Continue reading
2Oct/120

Why wordpress cron fails and how to fix

WordPress has its own cron job implementation that allows you to schedule your posts and events. It was done in a way to be simple and it works in most cases.

WP-Cron is not a real cron job, it only works when a page is loaded. When a page is requested, it will then check the database to see if there is anything scheduled and after displays to your reader.

However, in some situations, the WP-Cron does not work well and this leads to posts that missed publication schedule and events not executed.  May be you have seen the “Missed Schedule” status.

Filed under: tricks, web Continue reading
27Sep/120

Move wordpress site to new domain issue

WordPress has a interesting oddity, it stores site path with domain name in its settings in database. If you are moving your WP site, you have to change that setting before! I do not judge is it a good or bad decision, but it works this way.

If you forget to change Siteurl, WP installation won't work on new location. Here is how to fix it!

Filed under: tricks, web Continue reading
20Sep/120

Convert PDF page to JPEG image using ImageMagick

ImageMagic library not without reason is called magic, it can handle image operations like scale,resize,rotate,filter,clip and 1000+ others.

PDF -> JPEG

Here is simple CLI command to extract one page from PDF file and save it as JPEG image

convert -density 300 doc.pdf[160] page.jpg

Where

  • 300 is DPI, more better quality
  • [160] is page number, starting from zero. Can be list [0,1,2] or range [1-10]
  • page.jpg is output file, image type is based on extension

Easy!

Filed under: tricks Continue reading
16Jan/120

Change Mysql root password – The Right Way

Sometime MySQL root password is lost, because of last admin did not leave you any notes on the server or you are given your client server to fix some database or script related errors where MySQL root password is required.

I always knew one way of resetting it, but recently came up with another which is The Right Way.

Filed under: linux, tricks, web Continue reading
6Feb/110

@Gmail address tweak

It is known that "+" sign cab be used to create unlimited virtual gmail addresses using one box! For example you have mailbox  user@gmail.com, all addresses user+ANY_WORD@gmail.com are valid and will be delivered into your mail box. Good usage for this is leave not your direct email on site signups but something like user+spam@gmail.com, which can be filtered later.   For another cool address tweak see sub cat..

Filed under: tricks Continue reading