PHP – Remove numbers found in a string

I was coding today and i needed to remove all occurrence of numbers in a given string. I'm going provide two solutions it is up to you to choose which best suite you. Method 1 create an array populated with number 0-9 then use PHP str_replace function to do the search and replace. Here is a simple function for it. [php] function remove_numbers($string) { $num = array(0,1,2,3,4,5,6,7,8,9); return str_replace($num, null, … [Continue reading]

Solution to Invisible CHM E-book Content

CHM book content invisible

Compiled HTML is an ancient electronic book format with a .chm file extension. We are all familiar and used to popular alternatives like Portable Document Format (.pdf), EPUB, and Mobipocket (.mobi). Few days back, I downloaded a chm eBook, when I opened it for reading on my Windows 7 PC (you don't need any reader to view a chm book as it is supported internally by Microsoft Windows), the content wasn't visible or rather it was hidden. If … [Continue reading]

Change In File Mime Type – My PHP Story

I shared previously how I easily downloaded all images in a webpage without having to individually download each image. I got inspired by it and I decided to build a simple web tool using PHP that scrap and download and archive all images found in a specified webpage in ZIP format. It isn't production ready yet as it's still in Alpha stage. While building the tool, I discovered a mistake by me which added a newline /n after the image name … [Continue reading]

Generating Website Screenshot Using WordPress API

Website screenshot in WordPress comment

I have always noticed that whenever I mouse over a commentator’s website URL while moderating comments, I am shown a screenshot of the website. Few days ago, I decided to use Google chrome inspection tool to inspect the screenshot html image code. Below is the code result; http://s0.wordpress.com/mshots/v1/http%3A%2F%2Ftech4sky.com?w=600 Changing the http://tech4sky.com encoded URL above to any other URL will generate a screenshot of that … [Continue reading]

How To Fix XAMPP – Error: Apache shutdown unexpectedly

Apache failed to start in Xampp

I have been using XAMPP as my developmental server for years now. I have come to love it simplicity and effectiveness which is why I still haven't use other alternatives like Wamp and EasyPHP. Few days ago, I started Apache on XAMPP and to my surprise it will run and stop and afterward displays the below error message; Error: Apache shutdown unexpectedly. This may be due to a blocked port, missing dependencies, improper privileges, a … [Continue reading]

Bulk Download All Images In A Web-Page Via FireFox, Chrome, Opera

Save selected web page images - Firefox

My friend and I were googling for free high quality frame images to use for a Photo-album we were working on. We came across a website that had over 60 picture frames with no download link to download the archive. Downloading the images individually wasn't considered an option by us as it will be time sapping and boring. I am going to show us how to jump past the hurdle of downloading all images or multiple selected images found in a web page … [Continue reading]

MySQL Search and Replace to the rescue

MySQL Search and Replace WordPress plugin

I have been using Crayon Syntax Highlighter WordPress plugin since the inception of this blog. While examining the number of request made by this blog via Firebug, I discovered that Crayon Syntax Highlighter alone made over 5 GET request which I deem too much for a mere code highlighter. I finally decided to replace it with a light-weight alternative "Syntax Highlighter for WordPress" The hurdle I had to face next was, editing previously … [Continue reading]

Aptana Studio FTP Relationship With File Permission

666 file permission / chmod

If you are a regular visitor to my blog, you already know Aptana Studio is my favourite IDE. Today while using Aptana built-in FTP client, I discovered that whenever I create or download a file, the file always have a file permission of -rw-rw-rw- or chmod 666 I call this the Devil's CHMOD permission. Setting a file permission to 666 means all users can read and write but do not execute. This may pose a security threat to your website … [Continue reading]