Latest Posts

Java XML Formatter

eXtensive Markup Language (XML) is one of the popular medium for messaging and communication between different applications. Since XML is open source and provides control over data format via DTD and XSDs, it’s widely used across technologies.

Few days back, I came across a situation where the third party API was returning Document object and XML message as String. So I wrote this simple XmlFormatter class to format the XML with proper indentation and convert Document object to XML String.

Java clone object – cloning in java

Java Object class comes with native clone() method that returns the copy of the existing instance. To use java cloning, all you need is to implement the marker interface java.lang.Cloneable so that it won’t throw CloneNotSupportedException at runtime.

So if clone() function returns the object copy, why do we need to over-write it and in which cases?

How to change Applications icon in Mac OS

In Mac OS, all the applications have .app extension but it ships in the form of a zip file. So you can easily check the contents of any application.

The application icon is actually an icon file with .icns extension stored in the application. To change the icon of application, you need to find out the existing icon file and then replace it with the desired one. For example, here I am changing Firefox icon to some other icon.

How to install Memcached Server on Windows as Service

In my earlier posts, I explained how to install memcached server on *nix and Mac OS systems. Today I will explain how to install memcached server on Windows operating system.

To install Memcached Server on Windows, we need to have its exe or batch process but memcached server was written for *nix operating system and you can’t get a Windows version from memcached server official website.

The problem is solved by Jellycan Code and they provide the Win32 version in binary format that can be used to install memcached server on Windows.

Memcached Java Client Example

In my previous post, I listed down most common telnet commands for memcached with sample execution terminal logs. Today I want to discuss about the Memcached Client program available in Java language.

There are three most widely used memcached client programs in java

1. xmemcached
2. spymemcached
3. gwhalin memcached client

I have used Greg Whalin memcached client and found it easy to understand and use. It provides all the basic functionalities with thread pooling. Its available under BSD license and you can download it from below URL:

https://github.com/gwhalin/Memcached-Java-Client

Memcached Telnet Commands Example

In earlier posts, we saw how to install memcached server on Mac OS and Unix systems. After that we worked on it to start at boot time as a daemon process in Mac OS. Today, we will go through some of the basic memcached telnet commands that we can use to check the health of memcached server. These commands are very helpful in debugging purpose and can be used from any operating system with telnet installed.

If you are on unix system, then using “ps -eaf | grep memcached” command you can check the port on which its running.

How to setup Memcached Server to run at boot time in Mac OS

If you want to run memcache when system boots for Mac OS, then you have to put the PList configuration file in /Library/LaunchDaemons/ directory and set the owner to root user.

Create a file in the /Library/LaunchDaemons/ directory with name memcached.plist having below content.

How to install Memcached Server on Mac OS/Linux

Memcached is an open source high performance distributed memory object caching system. It is one of the most widely used cache mechanism used by some of the biggest websites like Wordpress.com and LiveJournal.com. It is also used by VBulletin software, for faster performance, that is one of the best software for Forums. Its easy to install and there are so many client programs available on Internet in different languages.

Memcached is a memory based caching mechanism and build using C language. To install memcached server on Mac OS or Linux we need C library. Here I am assuming that C library is already present in the system. If its not, then you can download C compiler and install it or install XCode that installs gcc compiler with it.

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages