Yesterday I came across this short article on dev.to which advised against using timestamps as unique IDs in file names when handling file uploads. The author instead recommended using a random string generator like the Read More
Str::random() in Laravel which he highlighted by using 8 character long random string.
Last time I posted a similar titled post, it was 15 years ago and about a benchmark comparison on four PHP frameworks out of which one is no more, one is pretty much alive only in name and one is struggling against its status of irrelevance. In short, only one of those four PHP frameworks is still up, alive and kicking. Read More
Headless CMS are all the rage from past some time. The idea of rendering a full page from the CMS itself for every request seems old & boring. To a certain point, the benefits of going Headless are valid & quantifiable.
To put it plainly, in a Headless implementation, the backend and frontend are separated out. The CMS (backend in this case) would just be responsible for managing the content. The frontend is decoupled from it & it can be built on an entirely different tech stack than what the backend is built on. Both frontend and backend are connected by an API (provided by backend) which the frontend uses to fetch data to display it on the screen. This way, the whole page (containing data + layout elements) would not have to be loaded and rendered for every request. This provides a few benefits right off the bat: Read More
Offlate I’ve been working on a pet project, part of which involved restoring an old MySQL database. The backup was of MySQL data files and not a SQL dump. However, restoring database from those data files was not much of an issue; I just hopped over to PuPHPet and downloaded config for a VM which was quickly setup, MySQL data files copied over to Read More
/var/lib/mysql/<db-name>, repair command run and a SQL dump created.
iG:Syntax Hiliter v5.0 is now available for download. Its been about two and half years since last release of v4.2 (v4.3 was a bugfix release made next day).
What has changed?
Well, lots on the code front, a bit on the user front. Some of those things are:
- Language file/name cache was not re-building automatically, fixed now.
- Finer control over GeSHi behaviour & code parsing.
- Plugin stylesheet can be disabled if you want to use your own for code boxes.
- CSS & JS assets are enqueued only if they’re needed.
This version sees a major code over-haul, a major re-write/restructuring of the code which has resulted in a cleaner, modular & better performing code. Also the PHP version requirement has been bumped up to PHP 5.3.0. The core code of the plugin would not load if installed PHP version is less than 5.3.0, fail gracefully & show you a friendly notice in Read More
wp-admin about it.
This is something that I’ve been meaning to do for a while but didn’t get around to it till recently, or rather, mid November last year. I wanted a neat, clean, Object Oriented way to create metaboxes in WordPress, which would be light & fast, and yet flexible enough to allow override on both UI render and data validation/sanitization. The other requirement was that I was looking to over-haul some old code that we’ve been using at PMC (my employer), so naturally the code has to be WordPress.com VIP compliant as pretty much all our sites are hosted there. And because I’ve the uncurable itch to roll my own thing, I just had to do it! 😉 Read More
What are abstract properties? There are abstract methods but the notion of an abstract property seems a bit ridiculous. Why so, you might ask! Well, the thing is, methods are declared & defined (not necessarily at same time). So you can declare a method without actually defining it (ie., no body, no set of commands which it will execute) and the same can be defined at a later stage. But there is no such thing as defining a property of a class; properties are always declared as containers of data which reserve a space in memory on class initialization. Read More
When I was first started playing around with NodeJS few months back, I came across Mongoose, a really neat ODM for MongoDB. You just needed to define the schema for each entity and pass it to that model and Mongoose would validate all data against that schema. That concept kinda intrigued me, as you wouldn’t need to create your own validation for the data. Read More
Few days back I was going through the usual rounds of some forums I visit now & then and once again I came across more than one post where some poor soul used undocumented API of a library/package to achieve his goals and when the next update came out for the said library/package, his shit broke because the API changed in a stupid way. Read More