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...
Read more →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 →While it’s a topic which has already invited hair splitting debates ad nauseam, it has also invited a lot of hype and there is a need to unclutter that hype and think about this topic objectively. The Toolbox Approach This has been the classic or traditional approach when programming used...
Read more →One of the most challenging aspects of blogging is how to perform research and more importantly, organizing your research. As a technology blogger, I face this problem too, so some days ago, I did some research on… guess what? Yep, on how to organize research for writing articles or blog...
Read more →Today morning, I woke up to this dull news that Github is soon going to introduce “Sponsor Only” feature, which means the ability for an open source project to hide its source code from everyone except the one who sponsors them. This incident shouldn’t be taken in isolation but as...
Read more →Writer’s block is a common challenge that even the most seasoned writers face from time to time. Finding effective strategies to overcome it can feel overwhelming, but understanding the root causes is the first step. Drawing from various techniques, including the 10 content-types method, I’ve compiled a comprehensive checklist to...
Read more →If you’re suffering from writer’s block or don’t know what to write about or how to research content for your next blog post, this guide will help you. There are just about 10 basic content-types or patterns around which weblog articles are written these days, and by creatively combining them...
Read more →This is one of those commonly occurring nags in web development which I’ve solved several times before but still have to scavenge the googles and stack-overflows each time I run into it. That’s why I’ve decided to document the simple solution to it in this brief article. What happens is...
Read more →Making additions or subtractions to datetime variables is one of the most commonly encountered programming endeavors and that’s what the built-in datetime.datetime.timedelta object is for in python. Its very useful in adding hours or days to your datetime variables as follows: import datetime now = datetime.datetime.now() tea_time = now +...
Read more →Yesterday, I learned during deployment that your Django app when used in combination with gunicorn will refuse to serve static files, do whatever you may. I looked up almost every Stack Overflow answer post on this topic including this, this and this. I meddled with almost every hopeful setting including...
Read more →