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
This question came up in a forum where I drop by now & then. It is also something that I recall answering previously on one or two occasions. So I thought I’d write about it here with a rudimentary example to provide a gist of how it works.
There’s no mystery or secret voodoo involved in having AJAX work in a Laravel app. On its own Laravel 4 (current version) doesn’t have any API for implementing AJAX, so you’ll need to do the footwork yourself. The basic concept that applies everywhere else applies here as well; grab the data from a HTML form, create an AJAX request and send it to server to a URL on which data is expected. Form data is retrieved on server just like any normal form data would be, the only key part is since you’re dealing with an AJAX request you can’t send back a normal View as response, you’ll need to make your own response with proper headers. Read More
At BarCamp Delhi 9 someone asked me how I go about developing on WordPress and what would I advice to someone starting on it. We had a good discussion at length & though its been a couple of months since then, I thought I’d share my insights here as well.
The usual basics and good development practices apply here as well, so keep them in mind. WordPress has documented & sane coding standards, so make sure you understand & follow them. Other basic principles like DRY, KISS, etc. also apply. If you don’t already, then document your code. Use code comments extensively, document each function and every complex code block. Read More
Sometime back I wrote a step-by-step guide for setting up PHP development environment in a virtual machine. This is a simplified (& less tiring) version of that.
You’ll need a few things to proceed:
- A computer, ofcourse. I used a MacBook Pro running OS-X Lion.
- Oracle’s VirtualBox VM software – get it from here.
- A linux distro. We will use Ubuntu Server here. Current LTS version is 12.04. Download the 32 bit ISO from here. Remember to download 32 bit version, the 64 bit version is kinda sluggish on less than 4 GB of RAM. 32 bit version is good enough for running web development stack unless you have specific needs.
Twitter Cards are quite the rage now when it comes to sharing your stuff on Twitter. They add that zing to sharing. But there are loads of plugins for WordPress already, so why did I create my own?
Well, here’s the brief rundown:
- The ones I saw, none of them are WordPress.com VIP compliant
- Most just get the job done but the code is well….. unhealthy!
- The ones I saw, none supported player card
- I needed filters to be able to override the output etc. fully or partially
- Being the attention seeking douche I am, I wanted to roll my own plugin 😀
Its all pretty easy and neat to use. Just activate the plugin, set a few global options on plugin settings page and done. By default it produces summary card tags for all posts and pages. If you want finer control or want player card for any post or page then select the global option for control on post pages and it will provide a meta box on post/page add and edit pages in wp-admin where you can set card to player card. Read More