Fosstodon Mastodon

How I made my web pages load 10x faster

The most typical advice you get when it comes to improving site performance these days is purely technical things like using CDNs or other serving optimization, using X hosting mechanism instead of Y, going serverless, cache optimization, etc. I'm not talking about those things, I'm talking about the old school … Read More

"API first" apps are the future

Tags: API  
Apps tend to become very complex beasts, especially when they start to scale. Part of the complexity is due to the fact that the users could be a diverse set of people with multitude of tastes and preferences which could all be conflicting. A classic example here is this recent … Read More

How to handle long-polling of XHR requests in PHP

A common need you often face in PHP scripting these days is writing a long-polling endpoint for things like sending notifications or other kinds of responses back to the client. While using something dedicated like node, cometd or websocket makes ideal sense for such things, there are use-cases when you … Read More

[PHP/Codeigniter] Getting multi-queries right with SQLITE

My earlier article dealt with multi-query issues of MySQL, this one is dedicated to SQLITE. Multi-queries are often discouraged to begin with but there are times when you find yourself using them. One typical use case is populating the database initially when it's empty. You do this by running an … Read More

[MySQL] Setting default date to current date

The most typical way people set default values to mysql date fields is by using the CURRENT_TIMESTAMP constant as follows: create table ledger_entries ( id int(11) not null auto_increment, entry_date datetime default CURRENT_TIMESTAMP ); This will obviously work if you need both date and time parts in the value. But in … Read More

[PHP/Codeigniter] Playing with multi-queries in MySQL

Multi-queries are often discouraged with mysqli functions but there are times when you must use them. One obvious use case is initializing the database. One of the first things your app must do is determine if the database tables exist or not, and then run an initializing SQL script if … Read More

Page 1 / 12 »