Using server-side PHP Datatables (grid) with SQLite / MySQL PDO 44

Using server-side PHP  Datatables (grid) with SQLite / MySQL  PDO
I have been a fan of using datatables for a while and always wanted to generalize the server side example to be able to use SQLite, MySQL or any other PDO supported database. For the longest time in my projects I have used PHP AdoDB as my Database abstraction layer, mostly because it came with ...

PHP backup monitoring and alert script: prevent backup rot… 3

PHP backup monitoring and alert script: prevent backup rot...
One of the key components with any IT software system is putting together an automated , reliable backup solution. Gone are the days of manually backing up files to a removable media, with our interconnected world we can simply setup some form of cloud back up and go. In a previous post I discussed how ...

Websockets : PHP code complete tutorial client & server 46

Websockets : PHP code complete tutorial client & server
Step-by-step to build a simple HTML5 using a PHP server for true server-push websocket communications I’m going to demo how you can create a simple and easy echo server, and communicate bidirectionally with various web clients.  The ability for the server to send (or “push“) communications to the client (browser) at any moment provides a ...

HTTP long poll example in php ajax 4

[icon name=”paper-plane” class=”” unprefixed_class=””] UPDATED: A better and easier way to do this is via Server Sent Events, Check out my recent post. Simple and easy PHP example of how to integrate long-polling (“hanging GET”) to simulate server PUSH and add more dynamic content to your web pages. As a standard HTTP is terrific protocol ...

Palindrome algorithms: What’s fastest reverse vs. compare. 1

Palindrome algorithms: What's fastest reverse vs. compare.
Today during a meeting a simple coding question came up as to how to write a palindrome function.  A palindrome is a word, phrase, number, or other sequence of symbols or elements, whose meaning may be interpreted the same way in either forward or reverse direction.[1]  Examples: mom , level, radar, tenet … There are quite a few programmatic solutions ...

Code Sample: PHP Javascript Currency converter + exchange rates caching RSS feed 28

Code Sample: PHP Javascript Currency converter + exchange rates caching RSS feed
Problem: For a recent project I needed to get the latest exchange rates to allow the sales folks to quickly calculate costs  while doing estimates in different currencies. There are many sites online where you can do this, but we wanted to create an in-app widget that could be re-used on various internal  pages. The ...

Code Sample: PHP Backup MySQL and files to Dropbox 16

Code Sample: PHP Backup MySQL and files to Dropbox
Most web hosts have the ability via their control panel to offer an entire site backup , and this is the minimal functionality you  should consider. Generally there’s a site backup link within the control panel that create a tar ball (.zip file)  of the entire site and its contents. then you can email,or simply download ...

Code Samples – Preventing simultaneous web updates 3

Code Samples - Preventing simultaneous web updates
Below are some interesting problems and solutions that I have come accross. Problem: In a web based system how to you prevent simultaneous web updates (aka overwrites) to the same record by different users seeing potentially different data. This is a play on the old airline reservation problem you find in older computer science text books. If ...

Sample Code: Quick and Dirty PHP Cache 4

Sample Code: Quick and Dirty PHP Cache
Here’s a variation of a PHP caching script. One of the things I frequently find myself doing for page(s) that take a long time to render, especially if they are a long running process, is to generally save a recent cached page (or more specifically) cached content and serving that up, when I need to have an immediate page ...