Viewing Category » Web Development

[Javascript] Search Box to Show Default Text on Load and Cleared When Focused

Post Thumbnail of [Javascript] Search Box to Show Default Text on Load and Cleared When Focused

Very often we want our search box to show a default text such as “Search…” when it is loaded. Then when users clicked on the search box, the word is cleared, allowing user to enter their search query. We will see how to do that in this short guide in both plain Javascript and jQuery.

Filed in Web Development
Posted on 9 July 2012 • 1 comment

PHP Code to Get Current Page’s URL

Post Thumbnail of PHP Code to Get Current Page's URL

It is quite often that we need to redirect users back to current URL. I wrote my own function for this purpose, but then I realized some weaknesses: it cannot capture HTTPS and the port number, which is very important for some websites.

Filed in Web Development
Posted on 1 July 2012 • 1 comment

Fixing Javascript Error: Property ‘submit’ of object #<HTMLFormElement> is not a function

Post Thumbnail of Fixing Javascript Error: Property 'submit' of object #&lt;HTMLFormElement> is not a function

If you come across this error when you code your javascript, most probably you are trying to submit the form dynamically using javascript. Don’t worry, the solution is easy.

Filed in Web Development
Posted on 1 April 2012 • 1 comment

How to Remove Facebook Cache of Your Page’s Metadata

Post Thumbnail of How to Remove Facebook Cache of Your Page's Metadata

Whenever Facebook visited a page (most probably when someone shared your URL on Facebook), your page’s metadata will be cached. I am not sure when the cache expires, but you can actually clear the cache easily by directing your browser to this address below

Filed in Facebook,Web Development
Posted on 4 March 2012 • 0 comment

Reducing Image File Size (Compression) using PHP GD

Post Thumbnail of Reducing Image File Size (Compression) using PHP GD

Most of the time, photos uploaded by users are not optimized for web. In other words, they might not be using the best file format for their photos, thus taking much more spaces in your server than it actually need. Using PHP, you can easily reduce the file size of those uploaded images during upload time. But of course, when reducing the file size, we sacrifice the image quality. Therefore, if you are running image uploader website, this is not recommended.

Filed in Web Development
Posted on 16 February 2012 • 6 comments

PHP – Using oEmbed API to Embed Videos

Post Thumbnail of PHP - Using oEmbed API to Embed Videos

oEmbed is a format for allowing an embedded representation of a URL on third party sites. Which means, if we have a video page’s URL, we can easily get the video thumbnail photo, video title, HTML code to embed it in our website and more. But of course, the video site must have oEmbed support in order for us to do that.

Filed in Web Development
Posted on 30 January 2012 • 0 comment

PHP MySQL – Get Next Auto Increment Value of a Table

Post Thumbnail of PHP MySQL - Get Next Auto Increment Value of a Table

We do not often need this but sometimes when we need to retrieve the next auto increment value of a table (without incrementing the auto increment value of course), this solution below will help.

Filed in Web Development
Posted on 14 January 2012 • 1 comment

PHP Smart Date Function – Display Time Elapsed (Difference) Based on a Given Timestamp

Post Thumbnail of PHP Smart Date Function - Display Time Elapsed (Difference) Based on a Given Timestamp

As a web developer, we often need to display dates in our website. As a web user myself, I don’t like to read full dates like “26 November 2011 11:30PM” because it takes me a little while to interpret the date. I prefer reading smart dates like “1 hour ago” or “6 months ago”. Therefore, here I wrote a quick and simple function in PHP that display the time difference/elapsed based on a given timestamp value.

Filed in Web Development
Posted on 12 December 2011 • 0 comment

Cannot Access Localhost After Editing etc/hosts and Flushing DNS Cache

Post Thumbnail of Cannot Access Localhost After Editing etc/hosts and Flushing DNS Cache

I was developing a new website that uses Facebook Login as the membership system. I came across this situation where I needed to create a “fake” domain by editing the etc/hosts file. Somehow, after editing the etc/hosts file (following an online guide), I cannot seems to browse http://localhost in my browser anymore. However, I can still browse my local apache server using http://127.0.0.1

Filed in Apple/Mac,Web Development
Posted on 22 November 2011 • 1 comment

Legacy Facebook “Share” Button Codes (Bubble Count, Box Count and More)

Post Thumbnail of Legacy Facebook "Share" Button Codes (Bubble Count, Box Count and More)

Few months ago, Facebook removed the page that allow us to generate codes for their official “Share” button. They replaced it with “Like” button instead. While “Like” button is fast and easy but we cannot add our comment along with the “Like” action. Therefore, in some cases, we still need the old Share button. Fortunately, the sharer.php still exists, so we can add the Share button using Facebook’s official script.

Filed in Facebook,Web Development
Posted on 17 November 2011 • 9 comments
 Page 1 of 4  1  2  3  4 »