• t
  • g
  • B
  • Z
  • @
  • e

portfolio & blog of senior web developer, Fahd Murtaza



  • About
  • Portfolio
  • WordPress
  • CV
  • Blog
  • Contact


  • About
  • Portfolio
  • WordPress
  • CV
  • Blog
  • Contact

PHP: Removing last instance of a character within text using Regex

August 28th, 2011 by Fahd

I recently encountered a situation where I needed to remove the last instance of the character ‘|’ in the menu that was being dynamically generated. So I came up with the following code

<?
$menu = 'I AM |NOT| A BAD |BOY|';
$menu = preg_replace('/[|]([^|]*$)/', '$2', $menu);
echo $menu."\n";
?>

The output would be

I AM |NOT| A BAD |BOY

And that removes the last instance of a character (in this case a pipe sign, i.e ‘|’ ). Hope that helps others.

Posted in PHP

3 Comments

My blog now available for iPhone

April 24th, 2011 by Fahd

It was the default PC and Mac browser view a few days before and I have been thinking, what if I could make it so there is a clean and fast theme for iPhone which increases usability on iPhone. I am still working on making the YouTube videos work with iPhone 3Gs and above but my blog and portfolio is now available for iPhone.

Now the blog visitors on Apple iPhone / iPod touch, Google Android, Blackberry Storm and Torch, Palm Pre and other touch-based smartphones should be able to see it cutomised for these devices.

Here is a comparison of how my blog used to look like before on iPhone and how clean it looks now :)

Update: Pictures coming soon. Will also upload pics from iPad 2 viewing experience.

Posted in Uncategorized

Leave a comment

Firefox: Changing Address bar search engine

April 22nd, 2011 by Fahd

Lately, I have been having problems with my Google Chrome browser; it crashes way often. So I have to switch to Firefox. I was too used to searching through address bar in Chrome and it took me to Google search right away.

When Firefox performs a search from the Address Bar, it queries the search engine string you have setup within Firefox. Sometimes, it uses the search engine which you don’t want. If it’s using Yahoo, you can switch to Google. Don’t like Google? Use Ask. Here’s how to switch which search engine Firefox searches when you use the address bar to search. (more…)

Posted in General

1 Comment

WordPress: Restricting results by pages and posts on search pages

April 11th, 2011 by Fahd

Sometimes you want to change the way wordpress search works, for example you want it to force to search pages only or just posts. The code for that would be something like this

//Search only pages
function is_type_page() {
global $post;
if ($post->post_type == 'page') {
return true;
} else {
return false;
}}

//Search only posts
function is_type_post() {
global $post;
if ($post->post_type == 'post') {
return true;
} else {
return false;
}}

Then in the search page, i.e search.php just use this code

while ( have_posts() ) : the_post();
if (is_type_post()) continue;

Above code will restrict search to the pages only. Similarly you can restrict pages to be excluded from search with the following code

while ( have_posts() ) : the_post();
if (is_type_page()) continue;

Hope that helps :)

Posted in Blogging, Wordpress

2 Comments

Leaving for Lahore, Pakistan

November 11th, 2010 by Fahd

Hey everyone, I am over excited to back in my beloved country. Its such an amazing feeling going back home after a few months of moving to a new country for job. I moved to Oman on July 1st this year and since then, so much has changed for me. Its great that I lived with great people like Bilal who was once an internet friend and then a friend who occasionally visited me in Eid Holidays once or twice a year and then a guy whom I shared an apartment with in Muscat, Oman. He has been a great help to me during this this career upgrade. I have moved to a new country where there is no electricity problem. or any issues like bad internet. I end up being a more reliable professional. Thanks to everyone for support.

Long story short, today I am going back to Pakistan for a few days. My plane lands in Lahore at 1330 PKT and I am over excited. I am leaving fro airport now. See you Lahore. I am so excited to meet my Mom.

Posted in Travelling

Leave a comment

1010101010

October 10th, 2010 by Fahd

Its 1010101010 right now. Sunday, October (10th month) 10 (10th day of month), 2010 (10th year of the century) and time is 10:10 PM. In honour of the binary number, which makes 682 after coverting to decomal, I will work 682 hours on open source projects starting today.

Wish me luck.

Posted in Uncategorized

1 Comment

Quote: Prayer is not a …

September 24th, 2010 by Fahd

Prayer is not a “spare wheel” that you pull out when in trouble, but it is a “steering wheel” that directs the right path throughout

Posted in Uncategorized

Leave a comment

I got a Kindle :)

September 24th, 2010 by Fahd

Finally I got a Kindle. I waited for it for twenty days and yesterday while I was saying Dhohar prayer in Masjid, the FedEx delivery guy called me and I got embarrassed as my cell was not silent :( Anyhow I got it shipped yesterday.

big-viewer-WIFI-04-lrg._V188696053_
big-viewer-3G-BLK-PROFILE-lrg._V188702463_
big-viewer-3G-01-lrg._V188696038_

photo-1

 

Its a neat device. I am loving it. Readibility is great and I recommend you one if you haven’t got one already.

Product Overview
* Electronic-paper display provides a sharp, high-resolution screen that looks and reads like real paper.
* No computer, no cables, no syncing.
* Wireless connectivity – you shop the Kindle Store directly from your Kindle from anywhere, just like using a cell phone! When you buy a book, it is auto-delivered wirelessly in less than one minute.
* More than 88,000 books available, including 100 of 112 current New York Times® Best Sellers. Free book samples. Download and read first chapters for free before you decide to buy.
* Read top U.S. newspapers including The New York Times, Wall Street Journal, and Washington Post; read top magazines including TIME, Atlantic Monthly, and Forbes — all auto-delivered wirelessly. Read top international newspapers from France, Germany, and Ireland; Le Monde, Frankfurter Allgemeine, and The Irish Times.
* Read more than 250 top blogs from the worlds of business, technology, sports, entertainment, and politics, including BoingBoing, Slashdot, TechCrunch, ESPN’s Bill Simmons, The Onion, Michelle Malkin, and The Huffington Post.
* eBook device is lighter and thinner than a typical paperback; weighs only 10.3 ounces and holds over 200 titles.
* Long battery life. Leave wireless on and recharge approximately every other day. Turn wireless off and read for a week or more before recharging. Fully recharges in 2 hours.
* Unlike WiFi, Kindle utilizes the same high-speed data network (EVDO) as advanced cell phones, you never have to locate a hotspot. No monthly wireless bills, service plans, or commitments — Amazon.com takes care of the wireless delivery so you can simply click, buy, and read. Includes free wireless access to the planet’s most exhaustive and up-to-date encyclopedia—Wikipedia.org.
* Email your Word documents and pictures (.JPG, .GIF, .BMP, .PNG) to Kindle for easy on-the-go viewing.

Here is what Amazon says about it :)


Kindle is our #1 bestselling item for two years running. It’s also the most-wished-for, most-gifted, and has the most 5-star reviews of any product on Amazon. Now it’s even better.
All-New, High-Contrast E Ink Screen – 50% better contrast
Read in Bright Sunlight – No glare
New and Improved Fonts – New crisper, darker fonts
New Sleek Design – 21% smaller body while keeping the same 6″ size reading area
17% Lighter – Only 8.5 ounces, weighs less than a paperback
Battery Life of Up to One Month – A single charge lasts up to one month with wireless off
Double the Storage – Up to 3,500 Books
Built-In Wi-Fi – Shop and download books in less than 60 seconds
20% Faster Page Turns – Seamless reading
Enhanced PDF Reader – With dictionary lookup, notes, and highlights
New WebKit-Based Browser – Browse the web over Wi-Fi (experimental)

See more details at Amzon.

Posted in Things I buy

Leave a comment

Javascript – One of the best Scripts resource

September 17th, 2010 by Fahd

Looking for a cool Web 2.0 Javascript resource. Filled with great examples and downloadable example code, a great javascript resource thats clean as well as useful.

Without any long description here is the link. http://www.scriptdeck.co.uk/

Script Deck’s interface is blog like with top image scroller highlighting the hot tutorials and tips.

Posted in Web 2.0, Web Design, Web Development

Leave a comment

JavaScript – The easiest way to clean-up your JavaScript code

July 28th, 2010 by Fahd

You can use any desktop tool to clean-up and beautify that poorly formated JavaScript you got from a blog or web resource.

I my case I am working on a JavaScript based event calendar that displays a calendar and highlights the current date with the dates which have events associated with them.

I got this great event calendar thats totally based on JavaScript from this link and it was not formatted correctly.  As I had to make a few adjustments to the code as for my needs, I needed it to be correctly formatted so I could work on it. (more…)

Posted in JavaScript

Leave a comment

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • ...
  • 33
  • »
  • Categories


Want to Hire Me?


Fahd Murtaza is the guy behind fahdmurtaza.com: your source for getting your web development projects done. Fahd sepcialises in Open Source Web Development and his favorite is WordPress. This site is a platform to his web development portfolio and blog all on a newly designed responsive website—try viewing it on your mobile.

If after viewing Fahd's portfolio, you think he might be just the guy to hire for your web / application development; check out the web development pricing page, then find out how to hire Fahd with a web development project idea and a brief of requirements.

 


Fahd Murtaza has put together a number of Web Development Articles that will help you see what he does, how he does it. You will also be able to see the level of work, and passion, that Fahad puts into each and every job. Understanding a little about the process can make the idea of investing good money much more palatable. People have always appreciated my Agile techniques. Its time you

Fahd Murtaza, Web Developer, Programmer, Wordpress Expert
U
This is portfolio & blog of senior web developer Fahd Murtaza, who has 9 years experience in: website development, WordPress, drupal, CMS and CRM application development with passion of making web better; one site at a time.


@
Mobile +968 93 678 199
email info@fahdmurtaza.com
Google Talk: fahdim@gmail.com
Skype fahd.murtaza
Location Muscat, Oman.


_
Developed using my beloved, love of my life, WordPress, built on the responsive, grid based, mobile optimised, Foundation Framework, and a modified Foundation theme. More Info →


Follow Fahd: Twitter / Google+ / Instagram / Facebook / Dribbble / Tumblr / Posterous /
Copyright © 2006-2012 Fahd Murtaza

    • WordPress.org
    • Documentation
    • Support Forums
    • Feedback