James John – Software Engineer

Archives

Fun!

How I redefined my Getters & Setters Methods with Enums

PHP Enums came in with 8.1 and it has been a very groundbreaking feature introduced into PHP. For me, the getters and setters approach has been modified. Some people agree that the Getters and Setters system is outdated since the defined data type for objects came out, but I still find myself trying to run […]

How I Append Data Into JSON at Constant Time – PHP

php-jsondb is a light framework that provides an object and methods to perform CRUD operation on a JSON file, using a similar interface to that of RDBMS. In a situation where you are within a small scale project, you can use this library to read and store data in a JSON file, allowing cross-language support […]

How I Created AWS S3 Hierarchical File System Using PHP

Story cut short, I got a project to pull files from Amazon S3 and allow users to navigate into sub-directories knowing S3 is a Flat file system. I wrote some PHP functions to take the folders and make them array keys of an multidimensional array. The plan was the put the files into the arrays […]

WP Meta Query: Query to Strictly Get Not Existing Meta Key and Value

This is the second time I am working on a plugin project like this, first time I don’t remember the project so I couldn’t get back the code, had to rewrite it. This time I am making a post so I could come back to it in the future. So in this case, lets say […]

How to Escape MySQL REGEXP Strings in PHP

It’s usually weird with MySQL in everything I guess. Again, I ran into using Regex in MySQL using REGEXP which is pretty cool. MySQL escape strings with double backslash \\, unlike other programming languages using single slash. But the problem here is that the string to be escaped is in a PHP variable, how do […]

MySQL Default Column Value with Control Flow Operations

After a long while, I faced another problem which I solved and it feels awesome which I’m going to share right away! I must say, MySQL is awesome! The more you write MySQL the less you write PHP vice versa. So on this post I’m going to share how to input default column value with […]

PHP-JSONDB: A PHP Class that Reads JSON File as Database

It’s funny though. One noon at Cafe Neo in Sabo, Yaba, I was waiting on my friend Magnus while he met his friend. Sipping my coffee and using my laptop, with the bad network there, I couldn’t browse with my GLO SIM; I then decided to play around. I exported my MySQL Database as JSON […]

MySQL2MySQLi: A Small Program to Help Migrate from PHP mysql_* to mysqli_*

Stumbled upon a very monstrous PHP project, very old of course, the client complained that the web host refused to downgrade the server for them and this project doesn’t work anymore because it was written with bunch of mysql_* depreciated function. Now it was my job to start editing these files one after the other, […]

Python-SiDB: A Less Query SQLite Database Library

SiDB – A Simple Database Library for sqlite3, after writing similar thing for PHP MySQL, since I use Python too I decided to build for it too for my easier coding. After building and seeing how helpful it is, I decided to share. What Does SiDB do? In all, its for less SQL Queries, it […]

PHP SiDB – A Simple Database Framework

With the purpose of faster work, I wrote this framework last year and I recognized it would be useful for others. What does it do? SiDB makes it faster to Insert data to Database Retrieve data from Database Delete data from Database Run other queries All happens in just a line and no worries of […]