Wednesday, November 28, 2007

Midlets using MotoDev Studio

MotoDev Studio is a new IDE platform to develop J2ME applications for Motorola phones.

I just did a basic test using this.


  1. Install latest JDK SE
  2. Install MotoDevStudio

Build Steps:

  1. Launch MOTODEV Studio for Java(TM) ME v1.0
  2. Create a new project
  3. Select Phone type
  4. Create a package under src folder. (not necessary, but a good practice. else default package will be selected)
  5. Create class
  6. Add code (simple hello world using LCDUI)

    package MyPackage;

    import javax.microedition.lcdui.*;

    import javax.microedition.midlet.*;

    public class HelloWorld extends MIDlet
        private Form mainScreen;

        private Display myDisplay;

       public HelloWorld()
            myDisplay = Display.getDisplay(this);

            mainScreen = new Form("Hello World");

            StringItem strItem = new StringItem("Hello","This is a J2ME MIDlet.");

         * Start the MIDlet
        public void startApp() throws MIDletStateChangeException

         * Pause the MIDlet
        public void pauseApp()


         * Called by the framework before the application is unloaded
        public void destroyApp(boolean unconditional)


  7. Edit Jad file MyMidlet.Jad; Goto Midlets tab (below); Add Midlets e:g MidletName,icon,Package.Class
  8. Build project, default setting is autobuild
  9. Create Package;Rightclick on MyMidlet Project (root element), From pulldown menu click J2ME and click on select CretePackage
  10. If everything goes well you should have MyMidlet.jar and MyMidlet.Jad files in ~:\Documents and Settings\user\workspace\MyMidlet\deployed
  11. Use MidletManager or your favourite tool to install this midlet
  12. Restart phone and test midlet

Note: This is without signing

Monday, November 26, 2007

VIM ftp editing

VIM supports easy editing of remote files.
Just Open ftp://domain.tld/path/to/file
It prompts for username and password!!!

Friday, October 26, 2007

Dave Winer on SOAP, REST and XML-RPC.

A good link

Note: Reproduced from site

SOAP Request

GET /stock HTTP/1.1

<?xml version="1.0"?>
<soap:Envelope xmlns:soap=""


The SOAP request tends to be overly verbose, but generally (not always) easy to understand. The SOAP envelope wraps an optional Header and the Body. The Body contains the actual XML request object. The Header contains information not required to service the request, but that help in some other way. A common use of the SOAP Header is the attachment of user credentials to the request. The beauty of SOAP is that it's not bound to the HTTP transport, although HTTP is by far the most commonly used transport for SOAP messages.

SOAP Response

HTTP/1.1 200 OK

<?xml version="1.0"?>
<soap:Envelope xmlns:soap=""


The SOAP response, also slightly overly verbose, but easy to understand. Now, imagine getting this response and you want the m:Price element text. How would you formulate the XPath to acquire this bit of information? Very simple ("//m:Price/text()").

REST Request

GET /stock?StockName=HUMC HTTP/1.1

The beauty of REST is that GET requests do not require a request package. In this case, the parameter data is simply passed as an HTTP request parameter. Of course, this simplicity comes with a price. You are now bound to the HTTP protocol. Although the argument has been made that the principles of REST are not bound to HTTP, nobody has ever documented that approach.

It's important I explain here that REST is primarily used to service GET requests. By GET, I mean REST requests using the HTTP GET verb. REST uses three other HTTP verbs POST, PUT and DELETE. GET is used to retrieve data, POST to create, PUT to edit and DELETE to ... umh... delete. The HTTP verb is another element that binds the REST protocol to HTTP.

REST Response

HTTP/1.1 200 OK

<?xml version="1.0"?>
<m:Price xmlns:m="">27.66</m:Price>

The REST response is often very similar to the contents of the SOAP request body. And it's very easy to express an XPath and retrieve the data ("//m:Price/text()"). Note the REST response is actually simpler than the SOAP Body. This is by convention. SOAP transactions typically contain an element named with the method name and the strings Request and Response appended. This is actually unnecessary, but does have one advantage. REST request typically embed the method name within the request URL, which again binds the protocol to HTTP, whereas embedding the method name within the package allows SOAP to exist over any protocol.

XML-RPC Request

POST /stock HTTP/1.1

<?xml version="1.0"?>



The XML-RPC request is the most verbose of all the protocols. This verbosity is what makes XML-RPC both difficult to use and lacking in inter-op. For example, the <string> element is optional, so the <value> element could have been expressed as <value>HUMC</value>. Several MetaWeblogAPI (the most common implementation of XML-RPC) providers assume the <string> element is present, while others assume it's not present. Whichever way you code it, at least one MetaWeblogAPI provider will fail. This leads to a lot of frustration for developers trying to write XML-RPC applications. You often have to code the request differently to compensate for different server implementations.

XML-RPC Response

HTTP/1.1 200 OK

<?xml version="1.0"?>


Again, the XML-RPC response is the most verbose and again it contains a gross limitation. What's the XPath for retrieving the data? If you said ("//double/text()"), then we might have a problem down the road. Imagine the provider augments his response with new elements that includes the stocks 365-day high and 365-day low. The XPath would fail. Neither SOAP or REST have this problem, because the elements are named semantically.

Thursday, September 27, 2007

Happy Birthday to Google

Today is 9th birthday for Google.


Saturday, August 11, 2007

Regular Expressions - Part3

In previous post Regular Expressions - Part2, we discussed about regular expression engines and concept of backtracking. In this post we will discuss about the basis constructs of regular expressions , how to use them t o match simple words and lines.

Meta Characters

Meta characters are a sub-set of ASCII character set which take part in building a regular expression. e.g. +,$,^ etc.. Thus these characters instruct regex engines to perform specific operations. If we want to instruct regex engine to deal with thm as normal characters instead of meta characters we need to escape them with backward slash '\'.e.g regex "firstname\.lastname" instructs the engine to ignore special meaning of '.' and to consider as a '.' character.

Following list gives overview of mostly used meta characters.

. Dot - any character in a line

In normal search we use ? to specify a single wildcard character and * to specify sequence characters till next character. e.g. to search a file we use IAdb*.dll But in regex * is used for repetition. Also note that in a line phrase. This mean that the behavior of ‘.’ can be altered using mode settings like SingleLine or MultiLine mode to notify regex engine whether to match a newline (\n or \r\n) with a ‘.’ or to stop at new line. e.g:

Search String:
using System;
using System.IO;
using System.Text;
RegEx: “System.*”
Explanation: In MultiLine mode this matches all references with System and its decedents till end of line.
Matches in non-Single Line mode:
Matches in Single Line mode:

Note that semicolon is also matched in each line

\ - back slash
It is already mentioned that these are used to instruct regex engine to consider them as
normal characters. And when used with a number like \1 or \2, this specifies a back reference number. Back references will be covered seperately.

[ ] - opening and closing square bracket

Any group of characters to be matched are specified within these brackets. Examples are mentioned below.

( ) - round brackets
These are used to ho sub-expressions or back references. Back references will be covered later. Sub-expressions are similar to programming language sub expressions.

{ } curly brackets
These are used with iterators. We have seen this in Part 2 for five digit length. Its format is like {x,y}. where specifier is anything that need to repeated. Here x is
mandatory and can contain values from 0 to value of y. And y is optional to specify. and has to be any integer.

* Iterator to iterate for zero or more times. (0 or more times)

? Iterator to iterate for zero or one time only. (0 or 1 times)

+ Iterator to iterate for at least once or more times. (1 ore more times)

\w alphanumeric character including underscore

\W non-alphanumeric

\d numeric character

\D non-numeric

\s any white space; include , , and

\S non white space

| - pipe character
This is used to match alternatives. We used this in Part to test regex engine. Its syntax goes like [matcha | matchb]

\b - word boundary
We used this in part2 .

\B - any non- word boundary
Search String:

regex: ^[A-Z]{3}\B[a-zA-Z0-9]+\B


^ - beginning of a line

It matches from start of the line. In MultiLine mode it matches at the beginning of each new line. e.g.

Search String:
thisofLine1 of thisstring100
thisofLine2 of thisstring200
thisofLine3 of thisstring300
RegEx: ^this[a-zA-Z0-9]+
This matches this from the start of each line.
Matches in MultiLine Mode:
a) thisofLine1
b) thisofLine2
c) thisofLine3
Matches in SingleLine Mode:

f you take out initial caret(^) in above regex, it will match both instances of this in each line

^ got a meaning of inversion when used within square brackets []. We will cover this in character classes.

$ - end of line
It matches at the end line. In MultiLine mode it matches at the end of each new line. e.g.
Search String: Let us the same string as above
thisofline1 of thisstring100
thisofline2 of thisstring200
thisofline3 of thisstring300
RegEx: this[a-za-z0-9]+.$
note '.' before $.
Matches in MultiLineMode:
Matches in SingleLineMode:

\A - start of text
Start of text matches only at the start of string irrespective mode setting

\Z - End of text
End of text matches only at the end of string irrespective mode setting

Thursday, August 09, 2007

Regular Expressions - Part2

In my last post Regular Expressions - Part1, I gave some introduction about regular expressions and presented code to build a tool that can be used to test basic regex constructs.

In this part I will discuss about how regular expression engines work. Before going there I just want to make a point about non-printable characters. Just have a look at ASCII chart once. Look for control characters, printable characters, non- printable characters etc..

Brief on Regex Engines

Regex engine is a library that can process regular expressions for search and replace operations. These engines operate on each character and thus composed of complex algorithms.

Editors supporting regex provide front end for this library. You can use this library with programming languages. As such there is a native support for regular expressions in some languages like Pearl, Ruby etc.. Microsoft got regex support from vbscript days. vbscript supports regular expressions with RegExp object. And look for class library reference of System.Text.RegularExpressions namespace for regex support in .Net. We used this in last example.

As these engines operate on each character and try to match with patterns; performance plays a major role. There are two kinds of engines to chose from. One is called Text Directed Engine while other one is Regex Directed. I will describe them in brief.
Of course no programming language offers a choice to select a particular regex engine. Its matter of what it supports.

In case of editors there is a simple way to test what kind of engine it is. Just apply regular expression "regex | regex not" on string regex not. If search result is regex then it is regex engine otherwise if the search result is regex not then it is text directed engine. There are couple of points to note here.

  • Expression you applied tries to match string "regex" or "regex not". '|' is a meta character in regular expressions character set. You can think this as an instruction for 'or' operation.
  • When you apply this regex on string regex not it got option to chose just the first word or both words. Regex engines characterizes eagerness, mean they are eager to return results to be quick and faster. Where as text based engines look for longest possible match. Thus former returns regexregex not.
Thus one of the differences between regex engine and text engine is eagerness.

In simple terms, one can categorize them based on search time. Say that with text directed engines, search time depends on length of the search string. And with regex directed engines search time depends on length of the regex.

Back Tracking

Another important concept is back tracking. As the name suggests back tracking is about tracking how we traversed while coming back. Did I confuse you? That is not intentional; let us see this with an example.

Suppose you are looking at financial report. And you are interested in values between 10K to 99K.

Now let us take figure "INR75063.37" . You know that it starts with INR and it is in the format of INR(x).(y) where x >= 0 and y = (00 to 99).

So you are looking for five digits before paise separator '.' This can be expressed as


Let us apply this regular expression on following text

The amounts are Auto INR30.00 Onward Flight INR450454.34
Taxi INR435.65 and Return Flight INR34543.43 etc.

Observe result with five digits INR34543.43 the figure in desired range.

Now let us walk through what happened here.

First with regular expression - \bINR[0-9]{5}\.[0-9]{2}\b. Outer \b at the beginning and at the end specify word boundary.

Obviously all amounts are within a word boundary. (To check about word boundary click at the start of search string, then press Ctrl+[right arrow ->]. Of course this includes space, forget space for this discussion.). So here goes the part wise description of this regex

  1. INR will be matched literally.
  2. Then [0-9]{5} specifies to look for 5 digits(0-9).
  3. Then we have a dot '\.' dot is a meta character in Regular expression character set, thus we need to escape it. It might work without escaping too, but just follow it as a good practice.
  4. Then we have [0-9]{2} which is obvious for two digit of paise. And closing of boundary with '\b'

Ok we understood the regular expression, now let us understand how regex engine might have done this search.

It starts with text string 'T' in The of search string, and looks at part1 of regular expression which is expecting I of INR, it is invalid and thus moves to next word.Then it finds 'a' in amount, which is invalid and moves ahead.

When it comes to INR30.00, it matches INR then moves regex to [0-9]{5}.

Here regex can match it in two ways.

(a) Collect characters till paise separator '.' then verify that each one is a digit(0-9) and number of digits is 5. If paise separator is not found till end of word (\b) skip this word

(b) Collect each character and then check it to be a digit and add to count, if the count is 5 then check for paise separator as sixth digit. If sixth character is a paise separator search passes else search fails am moves to next word.

Here first option (a) assumes that if paise separator is not there, then no need to check each character to be a digit and to add to counter. If it finds a paise separator then it will track back each character and then does necessary operations.

In case of (b) engine anticipates paise separator and does character validation and counter operation for each character.

Assume a case where we are searching for 10 digits. In that case performance penalty with option (b) would be very high.

Option (a) describes case of backtracking. Backtracking is like leaving a pile of bread crumbs at every fork in the road.

If the path we choose turns out to be a dead end, then we can retrace our steps giving up ground until we come across a pile of crumbs that indicates an untried path. Should that path, too, turn out to be a dead end, we can continue to backtrack, retracing our steps to the next pile of crumbs, and so on, until we eventually find a path that leads to our goal or until we run out of untried paths [1].

With text directed engine each character is looked at only once, while with regex directed engines each characters might be looked at many times. Regex directed engines support back tracking and Text Directed engines doesn't.

While at back tracking I should mention about meta character dot '.' in Regular expressions. Dot means any character (except new line). Back tracking plays major role when working with dot. We will look into dot and all other meta characters in next post.

Next -> Regex Meta Characters

Wednesday, August 08, 2007

Regular Expressions - Part1

Regular expressions. Most (u|li)n(i|u)x programmers might have used them with grep. What are they and why they are so different? By this time you might have got a doubt about (u|li)n(i|u)x. If you interpretedit as unix or linux, then you know about Regular expressions.

If you don't know yet you could interpret it; then regular expressions are not difficult for you. It is just a matter of time you pick a book and understand the rules of this new game. If you got puzzled about those words then just think that you are learning a new technique.

What is this all about
Regular expressions can be used to search and replace text patterns in more structure manner. I am not defining the word regex here. But just bringing you to the context of text search / replace and structure. Just remember structured text search and replace.

Some taste and smell

Above regular expression matches an email id with regular tld like .com or country specific tld like DONT try too hard to match it to an email address. I assure you, by end of this session you will find lot many problems with this regex, and you will optimize it with a much better one.

Before we start:

1) It takes time and requires dedicated time of at least 10 hours before you gain momentum with regular expressions. But here I want to make this process simple and easy. Thus I want to stretch these 10 hours over 10 days, one hour on each day.

2) need a regex editor to test. You can pick some from google. But I feel it is better to write your own with minimal effort.

Build MyRegex test tool (Option 2 as mentioned above):

At the core, this tool is going to have three text boxes. (a) to enter text to be searched (b) to enter regex pattern (c) to show results.

Optionally we can have some check boxes to select few options and labels to address text boxes. I used .Net 2.0 and C# windows application.

I attached screen shot here. I used a context menu on regex textbox to avoid a button click.

In designer code just add this.tbRegex.ContextMenuStrip = this.contextMenuStrip1;

I named my regex text box as tbRegex. You can also find two check boxes to select

Singleline mode and Multiline mode. Don't bother about these things now.

Just add them in a frame for better looks. Then just add references for RegEx and event handler on

Find Context menu click. See code below for form.cs.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace RegExApp
public partial class Form1 : Form
RegexOptions regexoptions;

public Form1()

private void findToolStripMenuItem_Click(object sender, EventArgs e)
tbreults.Text = "";
string results = "";

string txtstr = tbintext.Text;
string regex = @tbRegex.Text;

if (cbSingleLine.Checked)
regexoptions = RegexOptions.Singleline;

if (cbMultiLine.Checked)
regexoptions = RegexOptions.Multiline;

MatchCollection matches = Regex.Matches(txtstr, regex, regexoptions);
foreach (Match m in matches)
results += m.Value + Environment.NewLine;

tbreults.Text = results;


Now we can test this tool. Just copy and paste following text in top text box i.e. serach string box,

my email id is online
send me mails to FIRSTNAME.LAST@GMAIL.COM collections
yahoo id is on check
also aliased to checked often
and hotmail ID is least
or is also fine

then copy and paste following regex in regex textbox (use Ctrl+v as right click opens context menu)


right click on regex text box to trigger context menu and click on Find.

Check following results in results text box

Experiment by adding new email ids, extra tld's etc..

Next -> Non printable characters, Regex engines and how it works?

Wednesday, August 01, 2007

Programming assemblies and modules in MSIL


This is about building assemblies and modules using MSIL language. To have a reasonable insight about internals of .Net Framework understanding of IL is must. There are many articles that describe how CLR loader loads an assembly how JIT compiler compiles and points the the method to newly created memory block with compiled code etc. But I couldn't find a simple guide to build basic units of execution modules using IL like
  1. a net module

  2. a multi file library

  3. an assembly with library reference

This article describes this process in step by step manner. We are going to create two net modules. Then we link them together to form a library. Then we build an application assembly which refers to methods defined in net modules of library. Before going there I would like to describe some theory in one paragraph describing theoretical aspects of this subject. If you cant bare it, just skip following section. You can always come back to have peep if needed.

Theoretical background

CLR CTS CLS - quick focus. CLS defines minimum set of rules needed to offer interoperatability among .NET application written and compiled in different languages and targetting CLR. In .NET's context IL,MSIL and CIL are synonyms. Intermediate Language (IL) ~= Microsoft Intermediate Language (MSIL) ~= Common Intermediate Language (CIL). CLS compliance ensures interoperatable in terms of naming conventions, the data types, the function types etc. But CLS compliance is not mandatory but a recommendation. CLR doesn't doesn't impose any restrictions for an application even it is non-compliant with respect to CLS. But in such cases interoperatability can not be achieved with modules/assemblies developed in different languages. On the other hand Common Type System enforces its rules on each every construct of any language that is targeted for CLR. For examples assemblies and modules are standard types. Managed .NET application are called assemblied and managed executables are referred as modules. An assembly ca contain many modules. Each module contains MetaData and IL. And an assembly contains a Manifest too. CLR offers a safe execution environment above operating system. Safety is achieved by enforcing type control, structured exception handling, garbage collection etc.

With that let us jump to files and code. Recollect that we are going to create two net modules. Then we link them together to form a library. Then we build an application assembly which refers to methods defined in net modules of library. Copy code for these three source files, and And we will build mylib.dll by linking net modules nm01 and nm02.

Files and Source

net module 01 - []

I could have taken more IL files to build this net modules.
This got just a constructor and two static methods.
There is no need for them to be static, but they are there without any strict reason.

.assembly extern mscorlib{}
.class public mymath01
.method public void .ctor()
.maxstack 1
ldarg.0 //push "this" instance onto the stack
call instance void [mscorlib]System.Object::.ctor()
.method static public int32 mysum(int32 i1,int32 i2)
.maxstack 2
.method static public int32 mysub(int32 i1,int32 i2)
.maxstack 2
net module 02 - []

.assembly extern mscorlib{}
.class public mymath02
.method public void .ctor()
.maxstack 1
ldarg.0 //push "this" instance onto the stack
call instance void [mscorlib]System.Object::.ctor()

.method static public int32 mymul(int32 i1,int32 i2)
.maxstack 2

.method static public int32 mydiv(int32 i1,int32 i2)
.maxstack 2

Application - []

.assembly extern mscorlib {}
.assembly extern mylib {}
.assembly hello {}
.method static public void main() cil managed
.maxstack 4
.locals init (int32 first,
int32 second,
int32 result)

ldstr "First number:"

call void [mscorlib]System.Console::WriteLine(string)
call string [mscorlib]System.Console::ReadLine()
call int32 [mscorlib]System.Int32::Parse(string)
stloc first

ldstr "Second number:"
call void [mscorlib]System.Console::WriteLine(string)
call string [mscorlib]System.Console::ReadLine()
call int32 [mscorlib]System.Int32::Parse(string)
stloc second

ldloc first
ldloc second
call int32 [mylib]mymath01::mysum(int32,int32)
stloc result

ldstr "{0} + {1} = {2}"
ldloc first
box int32
ldloc second
box int32
ldloc result
box int32
call void [mscorlib]System.Console::WriteLine(string,object,object,object)

ldstr "Hello, World!"
call void [mscorlib]System.Console::WriteLine(string)

I guess most of this stuff is pretty obvious except for maxstack.


At the IL level, the CLR needs to know the maximum stack depth of each method. This is not a plain arithmetic. It depends on code flow and depends on max number of stack slots required for any operation that is performed within this method. Though it is not simple it is not dynamic too. Compilers targeting for CLR can calculate this before producing executables. Compilers of high level languages like csc (CSharp ) and vbc (VB) does calculate this number embed it before producing executable code. But for some reason ILAsm doesn't do this. If you don't specify .maxstack, stack defaults to 8. But if methods more stack slots program will crash at runtime.

Partial Classes

Some might have thought that why I created a new class in each net module; rather I would have used a partial class. This makes sense because I am actually building an arithmetic class. But this is not possible here. Because IL doesn't know anything about partial classes. This feature is offered by high level language compilers with syntactic sugar. That makes it clear about why partial classes can not be spanned across assemblies. Compilers merge code in partial classes to make a single class while building. Thus all references for that class should be resolved before building the assembly.

Build commands

I guess you have .Net Framework and SDK(or Visual Studio 2003/2005) installed on your machine. The command I am describing here are for local host. If you are building for other targets than build machine, specify flags for respective targets. Now start Visual Studio Command prompt or SDK command prompt. Navigate to location of source files.

  1. Building net modules
    ilasm /dll /output=nm01.netmodule
    ilasm /dll /output=nm02.netmodule

  2. Building library - we use assembly linker for this purpose
    al /t:lib /out:mylib.dll nm01.netmodule nm02.netmodule

  3. Building application

  4. IL dis-assembler - ildasm
    For the purpose of this article use command line options of ildasm instead of GUI.
    ildasm /All hello.exe /out=hello.dil
    This produces helo.dil file which contains complete information

  5. dumpbin
    You may also want to use dumpbin if you are interested to see headers and sections of PE files.

    Please note that there is mention of linking mylib.dll while building Actually this linking is specified in source; ".assembly extern mylib {}".

Now run hello and check for results like this
First number:
Second number:
3 + 7 = 10
Hello, World!

How to Debug

Debugging a managed code itself becomes a separate topic. This is because CLR won't execute IL code , it actually executes native(machine) code compiled by jitter. And any loss of fidelity from IL to Native will confuse the debugger. This entry ran quite long. I will keep Debugging for another entry.

Tuesday, July 31, 2007

Split letters and numbers

using System;
using System.Text;
using System.Text.RegularExpressions;

namespace Program
    public class App
        static void Main(string [] args)
            string strtemp ="AB324hgdf89dfg";
            string strpart;
            Nullable<int> npart;
            SplitLettersAndNumbers(strtemp,out strpart,out npart);
            Console.WriteLine("{0} : {1} - {2}",strtemp,strpart,npart);

        /// <summary>
        /// This method extracts all numerals and alphabets from a given string
        /// </summary>
        /// <param name="instr">String input</param>
        /// <param name="strpart">all alphabets as string</param>
        /// <param name="intpart">all numerals as string</param>
        /// <returns>return if success else false<returns>
        public static bool SplitLettersAndNumbers(string instr, out string strpart, out Nullable<int> intpart)

            string strtemp = null; //buffer to hold letters
            string nstrtemp = null;//buffer to hold numbers

            if (instr == null) // invalid option
                strpart = null;
                intpart = null;
                return false;

            string[] m1 = Regex.Split(instr, @"\d");//All letters
            string[] m2 = Regex.Split(instr, @"\D");//All numbers

            //Concatenate all strings
            StringBuilder sb = new StringBuilder(instr.Length);
            foreach (string si in m1)
                //Do extra processing if needed
            strtemp = sb.ToString();

            //Concatenate all Numbers.
            foreach (string si in m2)
                //Do extra processing if needed
                nstrtemp += si;

            //Update out parameter for letters
            if (strtemp != "")
                strpart = strtemp;
                strpart = null;

            //Update out parameter for numbers
            if (nstrtemp != "")
                intpart = int.Parse(nstrtemp);
                intpart = null;

            return true;

IronRuby Math patch and Release build

Teaching IronRuby math tricks

And find my comment for release build option.

Friday, July 27, 2007

First Look at Working IronRuby

Got IronRuby

Build.cmd got this %frameworkdir%\%frameworkversion%\msbuild.exe /p:Configuration=Release /t:Rebuild IronRuby.sln

For some reason I don't have frameworkdir and frameworkversion environment variables set.

I just used

msbuild.exe /p:Configuration=Release /t:Rebuild IronRuby.sln.

I will mention my environment in a bit detail. Go through this if you got similar errors, else skip this part.

I don't have Visual Studio 2005 installed on my
OS Name: Microsoft(R) Windows(R) Server 2003, Standard Edition
OS Version: 5.2.3790 Service Pack 1 Build 3790

I use web install of "Microsoft® Windows® Software Development Kit Update for Windows Vista™"

Here is the Build Log
Setting SDK environment relative to C:\Program Files\Microsoft SDKs\Windows\v6.0.Targeting Windows Server 2003 x86 DEBUG C:\Program Files\Microsoft SDKs\Windows\v6.0

C:\IronRuby$\\msbuild.exe /p:Configuration=Release /t:Rebuild IronRuby.sln
The filename, directory name, or volume label syntax is incorrect.

C:\IronRuby$msbuild.exe /p:Configuration=Release /t:Rebuild IronRuby.sln
Microsoft (R) Build Engine Version 2.0.50727.42[Microsoft .NET Framework, Version 2.0.50727.42]Copyright (C) Microsoft Corporation 2005. All rights reserved.
Build started 7/27/2007 5:06:24 PM

Project "C:\IronRuby\IronRuby.sln" (Rebuild target(s)):
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:06.79

Here are some sample tests with "Hello, World"


Windows Command Prompt Customization

Now and then we happen to work on Windows Command Prompt. What makes me annoyed is its lengthy prompt. It becomes so irritating when you work deep inside hierarchy.

Here is an option to have path for ready reference as well as space to enter long commands.

To get this check for following registry settings

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
"AutoRun"="prompt $P$_$$"

Here I added registry settings for path completion too.

Also I customized my title, you can see that in pic.


This is from author of Beyond Code, Rajesh Shetty.

I attended his session sometime back. Here is the link for these points.

1. //Focus on ROII.(Return on Investment for an Interaction)
Time is precious for everyone. Ensure that you provide the highest value for anyone investing time in an interaction with you.

2. //Keep the promises you make to yourself.
Making promises to yourself is easy. Keeping them is very hard!

3. //Set right expectations
The first step in trying to exceed the expectations is to set them right in the first place.

4. //Set higher standards
Raise your standards higher than the general norm and watch miracles unfold!

5. //Avoid complacency at all costs!
There is nothing like maintaining the status quo. You are either falling or rising.

6. //Commodotize your work at regular intervals
You don't have to wait for someone else to commodotize your work.

7. //balance home runs with small wins
Home runs are great. But small wins are important too!

8. //Think!
Set aside time to "Think." Most often thinking is done in parallel to other activities.

9. //Never take people for granted
Would it be any fun if someone took you for granted?

10. //Ask the right questions
Answers help. But, it's not always the answers that matter.

Wednesday, July 25, 2007

Collections Best Practices

This is referenced form an article in August issue of CLR Inside Out. Link

The basic purpose of collections is to tie certain objects together as a group because they have some logical connection to each other.

General criteria to select a particular collection object goes like this

  1. Are you going to be adding all the elements at once?
  2. Are you going to be dynamically adding and removing elements?
  3. Do you only need to iterate over the entire collection, or do you also need to locate and use specific elements?
  4. Are you exposing your collection through a public API?
  5. What are the performance characteristics and requirements of your application?

If you’re using the .NET Framework 2.0 or later, using the old non-generic collections is strongly discouraged. Following table shows the mapping between

.NET 1.0 Collection classes and .NET 2.0 Generic collection classes

Non-GenericGeneric Replacement
BitArrayNo replacement exists
SortedListSortedList<TKey, TValue>

Pros and Cons of each type:

When you want additions(fast), removals(fast), and lookups(average) to be very quick, and when you are not concerned about the order of the items in the collections, your first inclination should be to use a System.Collections.Generic.Dictionary<TKey, TValue>.

If your usage pattern requires few deletions and mostly additions, and if it is important for you to keep the collection in order, you may want to choose a List<T>. If you do not care about sorting or inserting items in the middle, nor do you care about looking up individual items in the list but want to iterate over complete list.

to implement a first-in-first-out (FIFO) order

to implement a last-in-first-out (LIFO) order

when you need to maintain order yet still achieve fast inserts. But increases increased activity by the garbage collector. While the actual act of inserting an item into a LinkedList<T> is much faster than doing so into a List<T>, finding the particular location at which you want to insert a new value still requires traversing the list to find the correct location.

uses a balanced tree implementation as the underlying data store; this provides relatively fast lookups and maintains items in a sorted order, but insertions will most likely be slower.

which uses two separate arrays to maintain the keys and the values separately and to maintain them both in order

Extending Collections
The System.Collections.ObjectModel.Collection<T> class implements all of the standard collection interfaces, and your custom collection type can simply derive from Collection<Double> in order to provide the additional overload methods. You could also use extension methods in C# 3.0 to achieve the same.

Gist on Collection Interfaces

GetEnumerator - returns IEnumerator


ICollection - extends IEnumerable
CopyTo - copies items to an array
Count - Readonly count
IsReadOnly - items cannot be removed or added
(mutable items can be modified even if the collection is read-only).

IList - extends ICollection
indexer: allows to get and set any item in the collection, just as you can when using arrays

IDictionary - extends ICollection
Add - overload that associates a key with the item that is added
ContainsKey - method will check for the existence of a particular key
Keys - returns an ICollection of all the keys
Values - returns an ICollection of all the values
remove - overload based on the key instead of the value
indexer: using the key.

Tuesday, July 24, 2007

Type forwarding in .NET 2.0 - TypeForwardedToAttribute

Type forwarding is a feature added in .NET 2.0. But I guess it was not publicized as much as Generics or any other new feature that was added. TypeForwardedToAttribute is about forwarding calls to methods in a type from one assembly to another assembly. Here goes its story.

Assume that you are developing a library, mylib.dll,  with some helper functions. And one of the types in that library is named FindText. FindText is a class with two member functions. Apart from FindText there are so many other classes and structures in that class. And an application named AppProjectA that consumes this dll.

But while implementing mylidb.dll you found that FindText is  becoming too complex with lot of Internationalization code and other stuff. So you thought of you can moving whole of FindText to a new library called strsearchlib.dll.

As application AppProjectA  is already distributed you are hesitant to recompile it. But you want to consume strsearchlib.dll for FindText instead of mylib.dll.

This is possible using TypeForwardedToAttribute in .NET 2.0.

Here goes Step by Step Guide.

1) Build mylib.dll

[Source] mylib.cs

namespace ProjectA
    public class FindText
        public bool Find(string inputstr)
            System.Console.WriteLine("In mylib");           
            return (inputstr=="text1");
        public string Add(string inputstr)
            System.Console.WriteLine("In mylib");           
            return (inputstr+=" end of line");

Launch VS2005 Command Prompt and build mylib.dll

$csc /t:library strsearchlib.cs

2) Build AppProjectA.exe

[Source] AppProjectA .cs:

using System;

namespace ProjectA
    public class App
        static void Main()
            string str1 = Console.ReadLine();
            FindText ft = new FindText();
            if (ft.Find(str1))
                Console.WriteLine("Not Found");


$csc /r:mylib.dll AppProjectA.cs

3) Test AppProjectA.exe

Enter text "text1" and observe result Found.

4) Now build strsearchlib.dll 

Copy code for FindText from mylib.cs to strsearchlib.cs. Dont change anything, just copy.

[Source] strsearchlib.cs:

namespace ProjectA
    public class FindText
        public bool Find(string inputstr)
            System.Console.WriteLine("In strsearchlib");
            return (inputstr=="Search");
        public string Add(string inputstr)
            System.Console.WriteLine("In mylib");           
            return (inputstr+=" end of line");

$csc /t:library strsearchlib.cs

5) Rebuild mylib.dll

Add TypeForwardedToAttribute in mylib.cs and remove type FindText. You must comment/remove it.

[Source] mylib.cs:

[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(ProjectA.FindText))]
namespace ProjectA
/*    public class FindText
        public bool Find(string inputstr)
            System.Console.WriteLine("In mylib");           
            return (inputstr=="text1");
        public string Add(string inputstr)
            System.Console.WriteLine("In mylib");           
            return (inputstr+=" end of line");


Some other types


$csc /r:strsearchlib.dll /t:library mylib.cs

6) Test AppProjectA.exe again and observe that calls to Find and Add methods are redirected to strsearchlib.dll

7) Observe change in manifest of mylib.dll

$ildasm mylib.dll

open manifest and observe forwarder

.class extern forwarder ProjectA.FindText
  .assembly extern strsearchlib

8) Metadata and IL Assembly syntax for Type forwarding in .NET 2.0

Metadata presentation of type forwarders
    ExportedType table
        Flags        | tdForwarder (0x00200000)
        Implementation    = mdAssemblyRef

IL Assembler syntax
    .class extern public forwarder ProjectA.FindText
        .assembly extern strsearchlib

Wednesday, July 18, 2007

Add-ins Plug-ins Extensions

I cant find any reference which explains how Add-ins, Plug-ins and Extensions differ from one other. I just cant accept them to be synonyms.

Here is an account of how I interpret each one. Please correct me or point me to appropriate source.

I guess add-ins are those modules which bring-in a specific fuctionality, at runtime, for such requirements which are unknown at build time. That mean Application is unaware about source of Add-ins. Normally they are chosen from list to add. eg.Excel Ad-Ins

I guess Plug-ins are those modules for which an adapter is built inside the application at build time. Thus a trust relation ship exists between application and Plug-In at Runtime.

I guess Extensions are those modules which are added to bring in additional functionality by installation and probably with a restart of main application. Extensions operate in isolation with build time functionality.

FreeMind - Mind mapping tool

About Mind Mapping

Mind mapping is considered as most convenient method to capture ideas analyze them. Other uses include to visualize,classify,structure,generate ideas,aid in study,problem solving,decision making etc.. As such it is a generic tool and can be used for any purpose at any level. In simple terms it is a structured notes taking tool. It offers much more than a flat hierarchy, more than a tree structure. And it is inline with xml but in pictorial form.

It starts with a central concept which will be placed in the middle of background of a map. Then ideas around it projects in radial direction around it. Tony Buzan is considered as father of modern mind mapping technology.

Get Tool

Commercial tool Mind Mapper costs around 175 USD. You can find other tools in this category in wiki site. But Free Mind is an open source tool (GPL v2 licensed).

Other Links

Here are some links User's Guide, Main Page , Review, WikiLink, Getting Things Done.

Ease of use

I found it so easy to use. It took me 2 hours to get a hold on it. Prior to this I don't have any background about it. I read 60 page user's document in just 45 minutes. And then in no time it changed the way I think and work. Most attractive thing about this tool is its speed and keyboard short cuts. That ensures that you don't need to pause from thinking mode to editing mode to take notes. It just flows without any dampness.


It offers three modes of operation.

MindMap (~edit) editor Alt+1
Browse(~read only) mind map files or web Alt +2
Files(~view files on local computer Alt + 3


Node is a key word that makes up a think stream. To create a node just press insert and type the keyword. Each node can be represented as a Fork or bubble. I use fork if I think that I can add more down to that node. And I use bubble if the node is the last one in that thought process. This gives some sort of closed feeling. You can also join nodes from two streams.

Formatting node

Each node can be marked with icons. This is very useful. Just highlight node and then press Shift+I. You can assign an icon.

Each node can be named with html. And that can include images <img src="">

Physical Layout

Physical layouts are about text format and background format of each node. Its is not about shape. Sample layouts are like, OK, Not OK, Needs action, Larger topic etc.. You can add additional physical layouts by editing "C:\Program Files\FreeMind\atterns.xml".


You can cloud around nodes to form a set or group and then color them. I found it very useful.

Some quick keyboard shot cuts I adopted

Insert,delete to insert and delete nodes at selected level
Ctrl+K to insert hyperlink manually
Ctrl + Shift + K for inserting link from local disk
Ctrl + Up/Down to move nodes up and down among siblings
In non editing mode esc brings to root and Auto adjusts to fit the page
Toggle fold unfold using space bar
Renter on node to create siblings below it and shift+enter to create above it
Long note editor-Alt+enter
Editing node with F2/Home/End
Press Alt=I to insert icon

Some more pleasure with mouse

Click on any node to toggle between fold and unfold
Point at node to see extra bubble to move up and down
Just right click on surface to access other windows

Import/Export - You just need to name it

Its import/export offering is extraordinary. Html, applet, jpg, svg etc..

Couple of aspects that I don't like with this tool

1) You cant pin selection of node. While trying to access menu bar selection changes. On mouse over event need to be handled with more delay to make automatic selection.

[You can do this by just holding down Alt or Ctrl]

2) Automatic layout option doesn't offer much. I guess some kind of alignment options would have solved this problem. Like Right align, left align Top, distribute etc..

Friday, July 13, 2007

Why Net DDE

Last week some one tried to make a joke about usage of Net DDE in WW products. Actually I was also not so convinced why WW still supports DDE and SuiteLink (DDE+ avatar). Since then I was trying to collect some information to educate myself on DDE.

I have been using DDE since 1998. Then I used it to create some custom report formats for customers. I used to collect information from DCS Systems to populate excel sheets. Those were the times OPC (OLE for Process Control) is stabilizing. OPC is COM based as the name itself contains OLE. Every DCS system is offered with DDE support for connectivity to excel. A simple formula in excel to access data made is quite a suitable approach. Like Application!Topic.Item for local DDE. and \\server\ndde$|share_name!tag_name for Net DDE. This is simplified by WW to be \\nodename\application_name|topic!'tag'.

WW DAServers offer all the three protocols. DDE, Suitelink and OPC. Older IO servers offers prior two and DAServers offer last one too. Thus the question about why Net DDE sounded quite logical.

Couple of reasons can be quoted here. a) It is developed by WW and then incorporated into Microsoft Windows. So importance of this protocol differs from WW to Microsoft. 2) InTouch primary understands Suitelink and DDE only. But some questions here.

What is DDE

Dynamic Data Exchange is developed by Microsoft during 1989. Its based on Windows Messages. It offers simple infrastructure to communicate between processes. So it is an IPC. Yes it is an IPC.

What is Net DDE

Net DDE is an extension for DDE for IPC across hosts.

Where is it used

Copy Paste. Everyone uses it. Copy Paste is achieved by DDE. Start Menu is populated with DDE. And in Industrial Automation sphere, it is used extensively.

What is the architecture

 DDE operates in Client Server mode. But unlike COM it doesn't have any broker service. It uses windows infrastructure to queue up Windows Messages. When client want to communicate with server it posts a message and then carries on with its work. Then System processes this and sends it to Server. Server receives it as a message and processes request. From then on Server post messages to client about the information requested periodically.

So it is different from COM

Yes it is different from COM in many aspects. DDE operates in advise mode and it is more suitable for continuous communication rather than transaction based communication. Industrial Automation relies on continuous communication. COM is best suited for transactions. COM is synchronous where as DDE is asynchronous. So for continuous communication DDE eliminates frequent poll requests.

In COM,  client can interact with object in server's address space. There the need is to operate on objects via interfaces. Mean data access is restricted. Where as DDE exchanges current state of data. So predominantly COM is more suitable for state transition whereas DDE is suitable for State monitoring.

COM client can not decide timeout for connection with  server, where as DDE clients can.

COM requires supporting runtime infrastructure, whereas DDE applications are light weight and easy to develop.


So I feel that using Net DDE based protocols is advantageous in some scenarios. But as world moves ahead with new technologies one need to convince upon continuing with old ones.

Every technology got a span. Beyond which either it should go to museums or or take a new avatar and contest for acceptance in new world.

Microsoft clarified that Net DDE will not be supported from Vista.  Rather not distributed with Vista. But WW can still distribute the Net DDE installer and install on Vista machines. So from now on Net DDE becomes a WW product than Microsoft product.

Hope WW will find some new avatar for it to continue selling their start product InTouch !

GUIs from Microsoft

There are so far 14 versions of Windows operating Systems.

UI of these operating systems improved from time to time. Following Website collected screen shots of these version. Its fun to have a look at them

It covers following Windows operating Systems.

1983  Windows 1.0 is announced
1985  Windows 1.0 (30 screenshots)
1987  Windows 2.0 (32 screenshots)
1990  Windows 3.0 (35 screenshots)
1992  Windows 3.1 (74 screenshots)
1993  Windows NT 3.1 (41 screenshots)
1994  Windows NT 3.5 (48 screenshots)
1995  Windows 95 (98 screenshots)
1996  Windows NT 4.0 (102 screenshots)
1998  Windows 98 (102 screenshots)
2000  Windows 2000 (103 screenshots)
 Windows Millennium Edition (51 screenshots)
2001  Windows XP (108 screenshots)
2003  Windows Server 2003 (50 screenshots)
 Windows Vista, the successor of Windows XP, is announced (under the code name Longhorn)
2007  Windows Vista (50 screenshots)

Tuesday, July 10, 2007

From Windows Live Writer

Just testing a post from Windows Live Writer. It looks good, it offers editing in a rich text editor as well as in plain html.

One definite advantage is we don't need to type in those funky pictured letters. And spell check is handy.

But cant add a picture!

Changing SQL Server 2005 sa password

Changing the password in SQL Server

for Sql Server 2000.

sp_password 'Old','New', Account

for Sql Server 2005.

PASSWORD = 'New_Password'
OLD_PASSWORD = 'Old_Password';

Monday, July 09, 2007

Over Pay - Reverse Offshoring

Basic rule of the game is to encourage key performers to deliver more. But what to do when they reach their saturation point? If it is the case of a ship or an aircraft they will be decommissioned and probably sent to a museum. But what could happen to a human resource in a high profile job. They need to treated with dignity but at the same time
they need to be informed to clear the slot. Easiest way to do that is to over pay him. Then make him realise that he is no more economically feasible. Another one is post him to some least preferred authority line.

As we started reading about reverse offshoring, it makes an interesting point to observe the career graph of this kind of people who were key performers but reached their saturation. Hope I get to read some articles about this subject in the near future!

Thursday, July 05, 2007

Swindon Trip

I had been to Swindon (80 miles from London) last month. Its an official trip for a week. Some snaps from this trip ..

Trying to keep up again

Many times I promise myself to update blog regularly. But for some reason I just skip it.

Here is one another attempt to restart.

Hope I do better this time.

Thursday, April 19, 2007

HYSEA Technology Day

Today I attended HYSEA Technology Day event. Just thought of sharing few things from this event.

Chief Guest: Dr.Jayaprakash Narayan of LOKSatta

He expressed his concern about unfulfilled potential and avoidable suffering persisting in great measure in our county. Few other areas that he illustrated are

  • to make technology reach the needed. He said that many people doesn't even know a tool like email exits, even if they know they dont understand the potential value that it can bring to individual's needs. He said that email concept helped him bringing a Govt. policy about contestants with grievous criminal background during 1996

  • He talked about how technology is being underutilised by television media. He said that we tend to hear more about wins and loses rather than problems and solutions.

  • then he spoke about how attitude of bureaucrats hinder good proposals. Basically any long term proposal is approved only when substantial growth is esured by next general elections. He also stressed that Tomorrow will always be better than today, even if no new initiatives are taken by political establishments. Initiatives where the result is dicy and just to make things better than today are of no use in this fast moving times

Apart from this he stressed about few fundamental problems that country is facing today.

  1. Health Care

  2. Urban Transport

  3. Alternative energy systems using Bio waste.

In this regard he appealed to technologists to go behind problems rather waiting for problems to come to them as projects and use cases.

Key Note was presented by Sudin Apt from Forrester Research

He presented on Technology and OutSourcing Trends. He tried to sketch out Fourth Wave Computing trends as following

  1. Digital Business Architecture

  2. Extended Internet and Executable Internet

  3. Innovation Networks

He said that the business objective with which an innovation is made, need to pass through Initiators, Transformers,Financiers and Brokers. He emphasised on perfect harmony among these stages to bring out the best. Talking about Innovation networks, he said a person within four walls of a company or and R&D department of an organiation can't alone solve the complex problems faced by this generation. Innovation networks need to co-operate well to bring out best of customer.Then he spoke about social computing. In this regard he said that customers trust in institutions is failing. Cosumers are becoming less loyal. Then he spoke about how Jack Welch applied Diamond model instead of BowTie model to set right aircraft business.

Then he analysed indutry trends during last year. His version is top three companies TCS, Infosys and Wipro together increasing their share quarter after quarter while new million doller babies like HCL, Satyam etc. and other small size players are losing on pie section. He described this phenomenon as polarisation which he thinks is not good for industry growth. He says that smaller companies cant end up taking what ever comes in their way for long time. They might do this while building up, but cant afford to do this forever. If they dont concentrate on focus areas they may not have many options for sustainable growth after some time.

Venky Chennepragada of Keane spoke about Information Architecture & Rich Internet Applications

He stressed on gaining emotional bonding with customer. In his opinion an SOW/RFP are tough ones which need to pass through legal barriers. Rather he emphasizes on Addendums on existing contracts. He says many end users doesn't understand use cases. Thus asking them to review your use cases for reaching common consensus is not always a good idea. He says that UX design teams need to work closely with BU's, end user and architects to come up with UI applications that can bring emotional bonding. Information Architects, Visual Designers and web Developers need to work closesly to bring out good UX applications.

Anuraag Agrawal (Motorola) about User Experience on Mobile Devices

Anuraag's presentation was like a fiction novel. He was talking about the magic that mobile devices are going to do in furture. His ideas revolved around

  1. voice as input

  2. usage pattern recongnition

  3. identification of gesture

As such trends are quite exciting. Hope coming years will bring more of intelligence by means of gadgets in life style..

Thursday, January 04, 2007

Linux adoption in India

During August last year I heard that around 12500 schools in Kerala adopted Linux[1]. Further Richard Stallman's visit to Kerala boosted enthusiasm in that state[2].

Today I read that ELCOT (Electronic Corporation of Tamilnadu) adopted Open source applications.
All their servers including access control systems are on Red Hat Linux[3].

All along it remained merely a hobby or fun or learning(for most of the users). But now the wave is creeping up from southern states in India.

According to the State Minister for IT and Bio-Technology of Karnataka, Prof. B.K. Chandrashekar, the State is also planning to broach this idea with neighbouring States such as Andhra Pradesh in order to gain wider acceptance for Linux[4].

Hope the day is not far away where Linux skill becomes defacto necessity to excel in software industry in India.



We had been to Srisailam during last week. Though we thought of going to this place since long time, it worked out only last week that too without much planning.

We were under the impression that getting a Punnami guest house (AP Tourism) or any other hotel at Srisailam wont be a problem. But we were wrong. We need to book at least a month ahead of time during new year season.

What we understood from web is that Srisailam is around 220 KM from Hyderabad and it normally takes app. 5+ hours to reach there by road. And many suggested to go by AP Tourism package.
That would have been a more organized trip. But we chose to drive ourself.

We started from Hitech city in Madhapur at 6:30 in the morning. In search of Srisailam road we reached Uppal as suggested in one of the blogs. Then we headed towards LB Nagar Police Station.

For some reason we ended up in Nagarjuna Sagar Road rather than Srisailam Road. But that is not a major problem as both are more or less parallel. In Sagar road we headed up to Kondamallepalli, which is also called as mallepalli(app 80 km from hyderabad). From this place we took a right turn to head towards Devarakonda. Up to this road is good enough to drive at a speed of 80 to 100kmph. But please mid few speed breaks in between.

From Devarakonda the road is under construction and is a single road up to Dindi diversion(app 40 Km from Mallepalli) . Here your average speed will come down to 30KMPH and is really very narrow road. Dindi diversion is main diversion for Srisailam. Even if you take regular srisailam road from Hyderabad, you will head up to Kalwakurthy and then take a left turn towards Dindi.
In a way you can say that Srisailam diversion is between Mallepalli on Sagar road and Kalwakurthy.

From Dindi the road is good enough except for a patch at Dindi(Tributary of river Krishna).
On this road you head up Srisailam Tiger Reserve forest. This stretch is app 20KM long. Then you will reach the last 80KM stretch which completely in forest region and is a Ghat road section.

You need to make an entry at Forest department check post while entering the Reserve forest zone. Drive inside this 80KM is simply awesome. First we will reach Patalaganga. We reached this place by 11:00 AM. This place has an awesome view point with power generation plant, Srisilam dam, AMR SLBC(Srisailam Left Bank Canal) tunnel and clean Krishna river. We enjoyed boat ride here. Those special circular boats offer a splendid experience.

From here Srisailam temple is just 20 KM away. You need to cross a small bridge across the river.

For us the darshan took just 25 minutes. No need to special tokens or anything else. You can just walk in. Please note that the speciality of Srisailam temple is, you can touch the idol.
But this is allowed only after 6 PM in the evening. We had darshan by 1:45 PM.

Then started return journey at 5:00 PM. Thus reached Hyderabad by 9:00.