Simulating Load on a File-System

Sometimes you want an easy way to simulate load on a file-system that you are trying to test. Here’s a quick and easy way. Suppose your mount point you want to perform this IO is “/myspecialmount”. (Assuming you have plenty of space to test) Then the easiest way to load some IO is through the following bash-script: [sourcecode language=“bash”] #!/bin/bash while true do echo “=== Starting clean-up ====” rm -fr /myspecialmount/usr echo “=== Starting load ====” rsync -avp /usr /myspecialmount done [/sourcecode]

Cross-Browser Testing for WebSockets

The traditional way to test for websockets is this: [sourcecode] function WebSocketTest() { if (“WebSocket” in window) { alert(“Browser supports websocket”); } else { alert(“Browser does not support websocket”); } } … Run WebSocket test [/sourcecode] Although the above example will be technically correct for modern browsers it is important to consider some of the “experimental” implementation of this feature in earlier FireFox (Mozilla) browsers. In FireFox (Mozilla), experimental features (until they graduate) gets added with a prefix of “Moz”.

MyThinkPond has moved... www.MyThinkPond.com

MyThinkPond has moved… www.MyThinkPond.com Dear Readers, I felt that it was high-time to move the blog to it’s own domain. I will continue to focus on topics of interest on the new blog. Please update your bookmarks (if needed) and I’ll see you at the new site… http://www.mythinkpond.com/ Venkatt

Wordpress Export Import Site Escaped Character Challenges - "

When you export a Wordpress site and import the site into a new Wordpress site you will notice that a few HTML entities that are not allowed in an XML output got escaped. In simple terms, you will see a lot of " and if you use a Mac OSx system, your will see - “ and ” displayed as content in your blog pages. Well here’s a way to correct them.

Ingenious Idea : Whitelines + iPhone = Great Wireframing/Design Tool

I’m an Android user and today I’m wishing I owned a iPhone or iPad after seeing this idea… It’s called Whitelines. To create a printable paper that uses “white-lines” instead of the usual “solid-black/blue lines” and to take it a step further to add some scan marks such that a iPhone can take a digital picture of your notes and make it available online. The possibilities are endless. Here how the process works:

Python pycharm - configuring remote interpreters from Windows to Linux

If you are an avid Python developer, you may all be excited about the new features available in the Pycharm 2.5 release, especially the remote interpreters, virtualenv and setup.py support. You can read more about the new exciting features here. But as I started to tinker with the “remote interpreter” feature - I stumbled upon some challenges and I thought I’d document them for other PyCharm users who might benefit from this blog entry.

Configure static resources in Django - Python

Working on a Django project, one of the first things that one would encounter is configuring Django for static resources such as “css”, “images”, “jpeg” and “js”. In looking at the “StaticResources” link that’s part of the Django documentation, it’s a bit cryptic for someone who’s starting out in Django and Python. So here’s a step-by-step on two ways to configure your static-resources in a Django project. This method is described in the Django documentation and is probably the preferred approach.

Minimal Maintainable HTML5 Page - Template - index.html

Sometimes I keep searching for a starter HTML5 “hello-world” - index.html page. So I thought I’d blog about it so that others who need it can also take advantage of it. <!DOCTYPE html> <html lang=en> <head> <meta charset=utf-8> <title>Sample HTML5 index.html from MyThinkPond</title> </head> <body> <p>Sample HTML5 index.html from MyThinkPond.wordpress.com</p> </body> </html> Feel free to copy and use as needed. At some point of time, you’re going to need something more than a ‘hello-world’ and when you cross that road go download the “HTML5 Boilerplate”.

How-To Install mod_python and the compile error - apxs:Error: Command failed with rc=65536

Below are my steps to installing mod_python under Apache HTTPD in CentOS 6.2. Download mod_python-3.3.1.tgz or a later version of mod_python available here: http://archive.apache.org/dist/httpd/modpython/ [sourcecode] curl -O http://archive.apache.org/dist/httpd/modpython/mod_python-3.3.1.tgz tar zxvf mod_python-3.3.1.tgz cd mod_python-3.3.1 ./configure make [/sourcecode] You may encounter the following error at this point: apxs:Error: Command failed with rc=65536 If so… no worries… This bug has been addressed here: https://bugzilla.redhat.com/show_bug.cgi?id=465246 Download the patch and (if you can figure out how to patch like I did, I manually opened the file and examined the contents: ` diff -rNu mod_python-3.

How to upgrade to Python 2.7 on CentOS

If you tried upgrading to Python 2.7 on CentOS, you will quickly find out that the RPM’s don’t exist for this in the repos. So here’s a short summary of what I did to upgrade my Python to 2.7 on CentOS. Based on a few Google searches… I discovered that a few dependent packages are required before you try upgrading to Python 2.7. [sourcecode] yum -y groupinstall ‘Development Tools’ yum -y install openssl-devel* ncurses-devel* zlib*.

How to list the package contents of a yum install?

Sometimes you need to see what’s installed as part of a package via yum. To see the package contents you can use a utility that’s available on the RHEL/CentOS. [sourcecode language=“jscript”] $repoquery –list packagename [/sourcecode] If you do not have this utility available, you can install it by using this command [sourcecode] $yum install yum-utils [/sourcecode] Here is a sample output from looking at the package contents of Apache httpd.

Copy to Clipboard - a browser agnostic way to script this functionality

Have you tried to present some code or sample content for the end-user that you wanted to allow them to easily copy to their clip-board? If you use the JQuery Javascript library then you can use the plugin called zClip available here - zClip Using zclip you can attach an event to a button or a text-area such that when the event occurs, the content is copied to the clipboard.

Grails - Groovy - Alternative to HttpBuilder - adding headers to your HTTP request

Developing with Grails and Groovy can be a blessing and and pain all at the same time. The development moves at a rapid rate but when you decide to include libraries that depend on other libraries, your pain starts to build up. For example, when you include the module “HttpBuilder"in your project you may run into issues with Xerces and xml-apis, especially when you attempt to deploy the WAR file under Tomcat.

Grails H2 Database 1.4.M1 Issue

I’ve noticed a peculiar behavior that I’m documenting here for others. I’m using Grails 1.4.M1 and it bundles with it H2 database version [H2 1.2.147 (2010-11-21)] If you decide to run H2 in a server mode, you would most likely download the latest version of H2 Database from the website. As of writing this article, the stable version of H2 is [H2 1.3.158 (2011-07-17)]. Issue: If you run your Grails application using 1.

Desktop timer for Pomodoro Technique users

If you are looking to improve your productivity when you are working on a mindful task then Pomodoro Technique is the way. It’s a technique where you sit for twenty-five minutes at a time focused on one task. At the end of the cycle, you take a “required” short break and then start on your next cycle. Why twenty-five minutes and not thirty? If you find out why, let me know.

Java Tools for Source Code Optimization and Analysis

Below is a list of some tools that can help you examine your Java source code for potential problems: 1. PMD from http://pmd.sourceforge.net/ License: PMD is licensed under a “BSD-style” license PMD scans Java source code and looks for potential problems like: Possible bugs - empty try/catch/finally/switch statements Dead code - unused local variables, parameters and private methods Suboptimal code - wasteful String/StringBuffer usage Overcomplicated expressions - unnecessary if statements, for loops that could be while loops Duplicate code - copied/pasted code means copied/pasted bugs You can download everything from here, and you can get an overview of all the rules at the rulesets index page.

Not all Tomcat 6 classloaders must be equal

Today, while doing some Grails development I came across a peculiar issue that perplexed me and I’m documenting it for all others to benefit. (Also see my other blog from today for the issue that started this journey). Here are my specifications: Development Machine Windows-7, 64-bit java version “1.6.0_24” Java(TM) SE Runtime Environment (build 1.6.0_24-b07) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02, mixed mode) Grails 1.4.0.M1 Tomcat - apache-tomcat64-6.0.32 Local Deployment Server

Tomcat 6+: Infamous "SEVERE: Error listenerStart" message - How-To debug this error?

I’m sure if you have been developing with Java and Tomcat for sometime, you are likely to run into the infamous debug error. SEVERE: Error listenerStart You will most likely start Googling it trying to find out what the heck is going on. And in trying to see the extended logging on what that “listenerStart” error means. After some lucky searches, you will see links asking you to drop a “log4j.

Tired of "Terminate batch job (Y/N)?", try this

When you invoke a batch file or most applications in a command-prompt and when you wish to close the application by doing a CTRL+C, you get the annoying “Terminate batch job (Y/N)?” prompt. And in most cases, even if you type a “n”, it still kills the application. Example is the Tomcat startup. To avoid this, try this: [sourcecode language=“jscript”] YourScript.cmd < Nul [/sourcecode] This should no longer ask you with the annoying prompt “Terminate batch job (Y/N)?

How-To: Turn off Firefox browser cache during development

Sometimes (when your are developing) you may want to force fetching all content fresh all the time including images, resources such as style sheet etc. To facilitate this you can do the following: Open a new window or tab in Firefox. Type about:config in the address bar. Search for “cache” in the search bar and look for network.http.use-cache in the filtered results. Double-click it will toggle it from “true” to “false”.

How-To: Change Grails User work and cache directory under windows

The directions below will help you move the Grails user work and cache directory to a different location. Why? Sometimes your default “primary drive” may be running out of space and you need to move your workspace else where. How? Create a file called “settings.groovy” under “C:/Users/.grails” directory. Edit this file and add the following line: [sourcecode language=“jscript”] grails.work.dir=“D:/grailswork” [/sourcecode] Make sure that the defined folder exists. Remove all other content, files and folders in the “.

IntelliJ - serialVersionUID - enabling

If you are wondering why when you make a POJO bean to implement Serializable, IntelliJ does not throw any warnings to create the serialVersionUID variable… It’s because you need to enable it. Here’s how: Cheers!

How to extract public key from certificate?

How to extract public key from certificate? Recently I had to extract the public key from a certificate. Each time I do this I end up looking up the man pages for openssl and so I thought I’d blog it for myself and for others to use when needed. $ openssl x509 -inform pem -in certificate.pem -pubkey -noout > publickey.pem Enjoy