With a wide variety of devices available for viewing web content, responsive design has become a necessity rather than a feature of a website. Below are some frameworks and tools that will help you in designing advanced responsive websites for any viewing device.
Read More

Intercepting mouse events on an iPad

Posted in: javascript |  

10 May 2013

In the last post we saw how we could easily work with mouse events on an iPad. Touchscreen devices like the iPad do not have a cursor, so the user cannot exactly move the mouse over an HTML element triggering a ‘mouseover’ event. One of the readers requested on how we could use a different interaction pattern on an iPad for a ‘mouseover’ event than on a desktop browser. For example in the following web page code the image-container class is attached to images div which displays a preview link overlay on mouseover.
Read More

Because of the way Safari on iOS creates events to emulate a mouse, some of your web page elements may not behave as expected on iOS. In particular, some elements that only use mouseover handlers need to be changed because iOS doesn’t recognize them as clickable elements, such as the div below. As the image-container div is not clickable in iOS, the corresponding mouseover event is not fired.
Read More

A recent project of mine entailed replicating a RETS database on a local MySQL database server. The client had a new real-estate mobile search app in development and wanted to have a local copy of the RETS database for search queries instead of a remote RETS server. This approach has several advantages:

  • Response times for accessing your local database are significantly faster than connecting to a remote RETS server for each request.
  • RETS servers requires that you query using certain combination of fields and also limits the number of fields you can search on. Using a local database would allow you to search on any field with any combination.
  • RETS servers also limit the time of day you’re allowed to access the RETS server and also restricts how much queries you can run per hour. You may also be limited to the number of records you can retrieve per query from a RETS server while a local database wouldn’t have that limit.

Read More

Single Page Applications (SPA) are on the rise and with it various JavaScript frameworks. A decade back the notion of developing whole web applications in javascript would have sounded ludicrous. But now things are different. We now have many complex frameworks that enable you to easily develop web applications using nothing but JavaScript, even on the server side. Below are a few frameworks listed that have been loved by developers and some new ones that show real promise.
Read More

Piwik is a Open source web analytics application that has a huge number of valuable functions related to SEO and other analytics stuff built-in. One such module is RankChecker. This module provides page rank information for Google, Dmoz and Alexa. With some modification to the original RankChecker.php we can use it in our own application (with appropriate license). The following is a example code for the same using RankChecker.
Read More

Image plagiarism is one of the common issues faced by websites, specially by designers and photographers. Besides the technique of attaching a copyright text or a hidden watermark, the other most common method of preventing casual copying of images from websites is by disabling right-click using JavaScript. Another scheme I recently found uses a method wherein the image is split into three parts and then displayed on the page. So whenever the user tries to save the image he gets three different parts of the image rather than a single image. This prevents casual copying of images from web pages. Of course, this is not a fool-proof method, and with some workaround one is able to create the original image but with some extra effort. This method can also be useful to prevent automated bots from easily downloading your images.
Read More

WordPress upgrades is a task most users do on a frequent basis,and most of the time it works flawlessly. But once in a while something goes wrong and WordPress doesn’t behave the way we expect. The most common complaint I see is the following error being thrown during wp-admin login after a WordPress database upgrade.

“You do not have sufficient permissions to access this page”

This innocuous message however is the source of many a wasted hours. Although there could be many reasons for the above message, the one I most often see cited is the inconsistency between WordPress prefix for the following values:
Read More

As with many other databases, MySQL provide a BLOB type that allows you to store binary data – images, wav files, videos etc. A frequent question developers have is regarding to storing images in the database. There is much discussion and argument with no final say on the issue. In one of my recent project the same issue was raised; the client and myself discussing the benefits and drawback of storing the images into a database. The project needed storing around 50,000 images, so it was important to get the question resolved satisfactorily.

After much deliberation we settled on using the file system. The major factor in the decision was that we needed the database and images decoupled as we would be having multiple databases using the same set of images. Also in the future it was possible that we would require some processing done on the images (cropping, resizing), which would be tedious and taxing if the images where stored in the database. So in light of these factors we found using a filesystem a suitable solution.
Read More

One frequently needs to export some MySQL tables along with certain queries that will work with that table for testing. Usually one only needs a subset of records from the table which will work with the selected queries, rather then the complete table. This can be required when the table contains thousands or millions of records and we do not want to export the complete data set, as this can be time consuming during import, or maybe we only want to provide the other user with some selected records for security reasons.

Say we have a simple WordPress database with a SELECT statement like the following:

SELECT * FROM wp_posts WHERE post_status = 'draft'

If you want to only export records that will match the corresponding query above, then we can use the ‘mysqldump’ command-line utility with the ‘–where’ option.
Read More