Using Memcached with Java on Windows

Windows Memcached software is available on this page: http://code.jellycan.com/memcached/

Download the Win32 binary zip file. Unzip the file (memcached.exe) in a directory of choice and then do the following to install memcached as a service.

c:/bin/memcached.exe  -d install

At this point the service is installed, it can started or stopped using the following commands

c:/bin/memcached.exe -d  start
c:/bin/memcached.exe -d  stop

By default, the memcached service has a limit of 64MB. If that is not enough, you can increase by tweaking the Windows Registry. Open the following entry.

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/memcached Server

Locate the entry called ImagePath. To increase the limit to 128MB set the value to…

“c:/bin/memcached.exe” -d runservice -m 512

A good Java client for memcached is spymemcached. Download the jar file from here: http://code.google.com/p/spymemcached/

// Get a memcached client connected to the local server
MemcachedClient c = new MemcachedClient(AddrUtil.getAddresses("127.0.0.1:11211"));
// Store a value (async) for one hour
c.set("someKey", 3600, someObject);
// Retrieve a value (synchronously).
Object myObject= c.get("someKey");

Connecting to an EC2 instance using Putty, WinSCP and a PEM file

First install the necessary tools

From this site (http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html), install Putty and PuttyGen.

From this site (http://winscp.net/eng/index.php), install WinSCP.

Convert the PEM file to a PPK file

When you created the EC2 instance, you were given a private key file (extension: .pem). This private key file is in a form called PEM – “Private Enhanced Mail”. Putty cannot work with PEM files. Putty uses a different format called PPK. You can convert the PEM to PPK file using Puttygen.

  1. Run Puttygen.
  2. From the menu option “Conversions”, select “Import key”
  3. In the dialog, locate the pem file and “Open” it.
  4. Change the comment from ‘imported-openssh-key” to a something more descriptive like “my-db-server”
  5. Optional: Enter a passphrase.
  6. Create PPK file by clicking on “Save private key”

Connect to the server using WinSCP

  1. Run WinSCP
  2. In the Login dialog, click on the “New” button
  3. Enter the “Host” name or IP address
  4. Enter “User name” (ec2-user, root etc.)
  5. Select the PPK file in box “Private key file”
  6. Click on “Save…” and give it a descritive name like “my-db-server”
  7. Close and run WinSCP again, this time select server name and click in the “Login” button

Connect to the server using Putty

  1. Configure WinSCP to invoke Putty
  2. Goto “Options->Preferences”
  3. Select “Integrations/Applications”
  4. Locate putty.exe and click on “OK”
  5. Restart WinSCP and login to the server.
  6. From the WinSCP toolbar click, on the Putty icon (usually 8th icon from the left)
  7. You should be now logged into the server using Putty.

Disabling Internet Explorer’s “Enhanced Security Configuration”

Turning off Internet Explorer Enhanced Security Configuration in Windows Server 2003

  1. Start -> Control Panel -> Add/Remove Programs -> Add/Remove Windows Component
  2. Un-check “Internet Explorer Enhanced Security Configuration”
    • To disable this for Administrators but not for all users, leave this option checked and click on the “Details” button”
  3. Click next

Turning off Internet Explorer Enhanced Security Configuration in Windows Server 2008

  1. Start -> Administrative Tools -> Server Manager
  2. Under “Security Information” section in the main (right hand side) pane, click on “Configure IE ESC”
  3. A dialog box will be shown, where it can be disabled for Administrators or Users or both. Make the choice and click “OK”

Converting a FAT32 drive to NTFS on Windows 7, Vista and XP

A FAT32 partition can be converted to NTFS using an inbuilt utility in the Windows operating system called CONVERT. This commmand can be used to convert any drive, even a USB thumb drive. The conversion is done without destroying the data. But as a precaution, take backup of any important data on the drive before running this command.

Step 1 : Go to the command prompt (Start > All Programs > Accessories > Command Prompt)

Step 2: CONVERT E: /FS:NTFS

In the example above, the E drive will get converted to NTFS.

Creating Linux style symbolic links in Windows Vista

Windows Vista supports symbolic links (soft links). One way of creating these links is using the command line utility called MKLINK.

Run Command Prompt and type the comman MKLINK.

If the system warns saying…“You do not have sufficient privilege to perform this operation”. Run the Command Prompt as Administrator

Usage:

MKLINK [[/D] | [/H] | [/J]] Link Target
        /D      Creates a directory symbolic link.  Default is a file
                symbolic link.
        /H      Creates a hard link instead of a symbolic link.
        /J      Creates a Directory Junction.
        Link    specifies the new symbolic link name.
        Target  specifies the path (relative or absolute) that the new link
                refers to.

Example: To create a directorty link called src what points to c:\users\foo\src

     mklink /D src c:\users\foo\src
Thats it!