Monday, May 11, 2009
Monday, May 11, 2009 2:42:09 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [0]Trackback
 Wednesday, October 08, 2008

I drove down from Vancouver to Seattle early this week with the bags leftover after the movers took my other stuff. I am put up in Seattle downtown temporarily until I find myself an apartment. Seattle downtown is fun, much better than my previous stay in Bellevue downtown though not as good as Vancouver city. The best part to being back though is the face to face meetings with people I work with. And that I can walk into people's offices instead of typing a formal email, making a call or using IM. Just the pleasure of being able to get an issue addressed right then is awesome.

I am thinking of making frequent visits to Bloomington in the next year. Something along the lines of spend  a few days every month and work from Bloomington. It will be interesting to make real world use of all the technology we build for remote scenarios.

We use Office Communicator internally at Microsoft for all our internal IM converstaions, audio/video calls/conferences, file transfer etc. In the past when I worked in IDC, Hyderabad, we used email and VTC for communication with the Redmond team. The last 3 months I have been working remotely from Vancouver with the Redmond team. Things would have been definitely tough without communicator. And I am not saying that just because I work in the Communicator team. The round table is pretty awesome too.

Wednesday, October 08, 2008 12:47:56 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [2]Trackback
 Wednesday, August 08, 2007

I recently got an invite to join Shelfari through email and I decided to join. It suggested that I sign into my gmail address book so I could look up who's already on shelfari. It showed me a (rather small) list of people already on the network and I intended to send them add requests. Instead what seems to have happened is that every person/unit I have had any correspondence with through my gmail id was sent an invite. Uggh. I do not like the idea of gmail being smart enough to store every email address I communicate with. Stop watching so carefully and ask me if I want to save any of these.

So, if you got such an email from me, apologies. It was unintentional.

Wednesday, August 08, 2007 9:53:40 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [9]Trackback
 Thursday, August 31, 2006

This is my first week of class in the third semester of my course. I have enrolled for Theory of Computing & Quantum Computing. For my third course, I am inclined to take Nonclassical logic theory. The problem is that its a 600 level course and I do not have the adequate background for it. The course is being taught up Prof Michael Dunn, a logician, philosopher, mathematician, computer scientist, informatician and the Dean of Informatics at IU. [Well, that is how he introduced himself :-)]. I will sit in for one more class and decide if I can take this course realistically. I plan to audit it in any case.


I will be working as a Research Associate to build a journal submission system with citeseer like filter capabilities & del.icio.us like tagging abilities. I had to switch advisors & drop my thesis plans with change in my funding source. Last year I was funded by Department of Energy (DoE) through Ohio Supercomputing center. The next year I will be funded by Microsoft through the community grids lab.

Quantum computing is a course that I could not take last year as my plate was full. So the way there is classical physics & quantum physics, this course will talk about quantum computing as opposed to classical computing. It is the sort of thing that could potentially change a lot of things we do in computing today. For eg: If some of the claims about quantum computing being able to work on the superpositioned quantum bits are true then the entire complexity theory as we know it today will be tossed away. The other more fancy things include time travel & parallel universes. A good inspirational small introduction to this is available on A short introduction to quantum computation. I can imagine how exciting & big the invention of transistor would have been ... and the applications following it. QC feels a little like that, The professor said studying some of this would result in us either becoming laughing stocks or winning Noble Prizes :-). Jokes aside, a lot of really smart minds have been studying this for years now. "Quite early in the 20th century Niels Bhor remarked that anyone who isn't shocked by quantum mechanics has not understood it". I am reading David Deutsch's paper on Quantum theory, the Church-Turing principle and the universal quantum computer and am looking at the Schrodinger cat experiment again.

In the next couple of weeks in the course of the course, I will be using haskell to simulate quantum behavior. Its a language I dread learning. Back to the paper now!

Thursday, August 31, 2006 4:52:36 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [8]Trackback
 Monday, July 24, 2006

Recently, I saw a cool demo on the "Round Table" device...Boy, is it neat or what! "Microsoft Office Roundtable" in my opinion is a totally new meeting experience with a rich set of unique features. This baby can detect & display the active speaker at any instant. Using six cameras, it stitches together different (360 deg) views & displays a panorama view of the conference participants at the remote end.  Imagine how a typical conference could be now ... and compare that with the traditional cumbersome Video-Tele Conferencing (VTC) where I would have to struggle to be "in the view" ! ['course the flip side is that now I can only hide under the table ;)]

Jeff Raikes said "you can record meetings, you can have synchronized views of the speakers or data, which also means that then if you miss the meeting you can attend after the meeting.

And one of the things that we've learned from our research is that it's possible to view the meeting in about half the time just by using good compression of the normal pauses in human speech, which, of course, leads to the great paradox: if you can review the meeting in half the time after the meeting, who wants to go to the meeting in the first place?"

The round table has the potential to change the way you and I collaborate in the future. Having said that, now the question is, how soon will it make to yours and my conference rooms???

Monday, July 24, 2006 4:33:21 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [1]Trackback
 Saturday, January 28, 2006

A quine is a program that writes itself.

Consider the syntax: <Function> : <Argument>

For example:

(1) Write this twice : Write this twice would output  Write this twice Write this twice 

(2) Write this twice : Write this twice : would output  Write this twice : Write this twice :

We are working with a register machine in the recursion theory class, and we wrote a quine in it. Later I wrote a quine in scheme and then tried writing one in C. That set me thinking as to whether the problem of being able to write a quine in a given language L was decidable. Is there a formal method to prove that a quine, or other quine like programs can be written in an arbitrary language? Talking to Roshan and Ramyaa about this, we concur that if the language is turing complete [i.e you can build a universal turing machine or eqvt (in lambda calculus, pi calculus)] then it should be possible to model a quine in it. You can find some quine implementations in different programming languages at http://www.nyx.net/~gthompso/quine.htm

We are working on a Register Machine (RM) with 7 possible instructions:

0*m# - add 0 at the end of Rm
1*m# - add 1 at the end of Rm
**m# - add * at the end of Rm
*0m# - add # at the end of Rm
n#    - go forward n steps
n*#   - go backward n steps
n**#  - cases on Rn in the order empty, 0, 1, *, #

I have 7 problems for the weekend, one of the interesting problems is to write twin programs s1 and s2 with the properties that s1 <> s2 and a) running s1 with all registers empty gives s2 in R1 b) running s2 with empty registers gives s1 in R1. Phew!

I wrote a scheme parser and interpreter for the langauge, so I can write code and execute it. If anybody wants a copy, drop me an email.

Saturday, January 28, 2006 7:04:25 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [2]Trackback
 Thursday, January 12, 2006

                I finally decided to build the mini kanren system in ruby for one of my class assignments. I have uploaded the code here.  My implementation does a run* always, so for

               a divergent case the run will always diverge giving no results. There is no provision for run1, run2,..., runn etc to get n values. I have kept the code similar to the

               scheme version as far as possible. Surprisingly, it wasn’t very difficult.

 

                Roshan has a comega version.

Thursday, January 12, 2006 9:11:03 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [2]Trackback
 Sunday, September 11, 2005

Spent the weekend doing my scheme assignment. More precisely spent most of the weekend thinking about how to write a macro for letrec. No clean solutions yet.

However, I see that there is a class of problems that need *something* extra to be solved. Its all guesswork at this stage, so I could be totally off the mark.
Here's a simple problem.


(let ([a 5] [b a]) ..)

A let* or a nested let will make the above assignments work by making a visible to b.  The sequential approach would require a to be defined before b or b to be within a's scope.

(let ([a 5])
    (let ([b a])
       .....
))


This would probably solve the above problem.
Now, how about


(let ([a b] [b "B"]) ...)
   
In (letrec ([x1 v1][x2 v2]...[xn vn])How can you ensure that all x's can see other x's?
In scheme, my guess is that this is implemented as a function [How? Dont arguments need to be evaluated then?]

An attempt to write this as a macro,
without using any side-effecting operations will prove the need for some kind of a parent structure that embeds all the variables and passes the structure around for each assignment. This problem led me to the discovery of  (1) and (2).  While the first url is very readable, the 2nd one is more complete and much less readable.

I keep trying to shut out the imperative part of my brain, How would you do this functionally?

Sunday, September 11, 2005 5:00:48 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [20]Trackback
 Monday, September 20, 2004

The new release of Monad (partner drop 3) is put up on http://beta.microsoft.com. This also means that besides all the cool features of Monad, we can now see Sammy the snake (game written in monad) running on msh :)

Monday, September 20, 2004 11:53:38 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [5]Trackback
 Thursday, September 02, 2004

Here are some links that talk about the changes in the shipping plans and features for Longhorn.

 

Jeremy Mazner’s blog entry about WinFs

 

Jeremy Mazner’s blog entry about Longhorn

 

CNET interview with Bill Gates

 

Official announcement by Microsoft

Thursday, September 02, 2004 6:30:31 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [2]Trackback
 Friday, July 16, 2004

SQL forms a good candidate for a cmdlet provider in Monad/MSH. Using something like this you will be able to browse through the database, DB tables, SPs etc as though it were a filesystem. I was thinking ways of writing a C# app to do the work, especially about connecting to SQL and getting all information besides Databases. Before I could make up my mind, I found an option to expose the SQL server group as an AD object in the AD.

 

The registry and AD cmdlet providers also come with MSH. Now since the AD provider exposes the AD as a browsable system, you should be able to browse through the SQL server on the msh commandline! Is it really as simple as that or am I missing something here. Unfortunately I don’t have the resources to test this out now.  

 

We’ll find out soon J

Friday, July 16, 2004 7:38:37 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [2]Trackback
 Monday, July 05, 2004

I have been using dasblog for a few months now. While I have fixed some of the minor issues, there are some issues that are pending.

 

One of the major issues with dasblog is the time settings. Besides the time [of posting a blog/comment] not being displayed correctly, there is yet another issue. We cannot make a blog post post-midnight for a couple of hours. After Pandu and Rosh had some bad experiences with this in the past, we three deliberately avoid making posts between 12.00 – 5.00 am in the nights.

 

A big thing missing in dasblog is an archive view, there is no real way of viewing your past blog entries based on some archive view. I saw somebody’s implementation of archive view in dasblog, not exactly what I would have liked to have but atleast there is an archive. I should check that out. Anybody else has an archive implementation for dasblog?

 

Some of the other minor issues:

 

  1. No delete comment feature
  2. Post a comment and you are brought to the main page [I have fixed this]
  3. No obfuscation of your own email-id [I have fixed this. You can now add the text you wish to replace @ and . with in the e-id in the config file. Neat?]
  4. Time display error
  5. Sometimes, when you edit an old entry, it makes a new entry. I am not able to re-produce this though. Happens once in a while.
  6. Delete category
  7. Rename category

 

This blog entry doesn’t talk about the good things in dasblog [Yeah, you could read it as whatever is not listed here works good in dasblog ;)]

Monday, July 05, 2004 8:27:15 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [5]Trackback
 Tuesday, June 29, 2004
  1. get-command

The idea of being able to see all the commands supported by a shell is pretty cool. Has this been there in the past? I doubt. This command outputs not only the standard commands that come with msh but also the cmdlets that have been added by the user.

  1. get-help

get-help followed by a command name gives a detailed help for that command. Try (get-help get-command).synopsis, the get-command here could be any other command. Cool?

  1. get-member

Any command gives its output as an object in msh. This object could offer a set of methods and properties. Get-member uses reflection and lets you see these members. For eg: get-command | get-member -methods lists the methods available for the command object

  1. Programmability on  the commandline – write functions, use foreach, if-else etc.
  2. out-*

Killer feature. Try get-process | tail | out-excel. Now try get-process | sort id | tail | out-chart processname, id. You are gonna love what you see J. For other output options, type get-command out-*

  1. –Whatif

What if you had a series of commands, pipes and weren’t 100% sure if it did what you thought it did. What if you spend 2 min thinking if you should press the carriage enter key or not.  You use exactly this feature => the –whatif feature provided by msh. You type in the command and append it with a –whatif. Now the output you see is the output that the command if executed would have given. This is a way to let you know the output of a command without it really executing. Should reduce the average tension in an admins life ;)
stop-process 12,4 -whatif

  1. errorpolicy –confirm

This option gives you an option Yes to all, No to all, yes, no and suspend. Suspend is new. Suspend launches a new shell, lets you explore and find out about the problem, exit and come back to the same option. The idea is that you are probably now surer of which option to choose.

  1. The idea of having cmdlet providers. [Yeah you can traverse the registry as though it were a filesystem. You can write your own providers!!]
  2. where/where-object/reduce-expression

lets you specify a condition, filter. For example.

                                                               i.      gps | where “processname -like n*”

                                                      ii.      $ps get-process

foreach ( $p in ps | where { $_.handlecount -ge 500 } | sort handlecount) {  $p.processname,$p.id }

 

That was a listing of some of the commands that are aha!!

Tuesday, June 29, 2004 2:47:09 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [2]Trackback
 Monday, June 28, 2004

I have been wondering about the cmdlet lifecycle. 

 

How do you add a new cmdlet?

How are the cmdlets loaded by MSH?

 

You use registercommand.exe <Path/dllname> and the new dll is registered. Now what happens when msh is started again? Does it load all the dlls in memory? Or does it load it when a cmdlet in the dll is explicitly invoked? Loading all cmdlet dlls in memory seems like too much memory consumption and overhead. The converse argument could be that practically the number of cmdlets wouldn’t be a very huge number; so doing this at start would give a performance hit.

 

Then again, when do we design stuff for pracrtical cases alone, we usually think of the worst cases!

 

Well, so how do you really find out how MSH is handling commandlet life cycle? There is no cordbg for .Net 2.0 yet and no CLR profilers in the picture.

 

There still is filemon.exe. Thanks to filemon.exe, these are my observations.

 

  1. All the cmdlet dlls are not loaded at msh start up.
  2. get-command doesn’t use reflection on all dlls’ to get all cmdlet names.
  3. Typing a specific cmdlet name loads the corresponding dll, processes and closes it

 These observations lead to the following conclusions:

 

  1. At start-up, msh does not load all the cmdlets in memory
  2. On typing get-command, it does a look-up [may be something like a file lookup], finds all the cmdlet name entries and outputs them
  3. On typing a specific cmdlet at the msh prompt, the corresponding dll is loaded by msh, the processing done, results obtained and dll unloaded [I think]
  4. Due to caching, all cmdlets take time during their first invocation and are faster thereafter.

 

How is a cmdlet executed?

 

First the corresponding dll is found and loaded. Then the cmdlet class is instantiated.

StartProcessing() if overrid is executed. If there are any input parameters, then they are filled with the values by msh and passed to ProcessRecord() if one exists. If pipelined input is enabled then the input parameter is filled with the current pipeline object and ProcessRecord() is exceuted for each of the input records. [So, this kind of looping is not the cmdlet’s responsibility, msh handles it and pumps in the value each time into the input parameter variable]. Finally if EndProcessing() is overrid, then it is executed. The object is then disposed off. Msh handles the output display/formatting/piping/redirection.

 

DISCLAIMER: These are my views only. This is not documented stuff, so I am just taking a guess as to how things may be working under the cover. I could be wrong!

Monday, June 28, 2004 1:15:42 PM (US Eastern Standard Time, UTC-05:00)  #    Comments [0]Trackback
 Friday, June 25, 2004

I took a session on Monad at the Bangalore .NET User Group meeting yesterday. Here is a brief write-up about the session for those of you who missed the session. People starting off on Monad may be interested in reading this.

 

Introduction

Unlike conventional shells that work on text streams and expect the end user to be an expert in text parsing, MSH introduces the idea of using structured object pipelines where objects instead of text flow between commands.

 

At the msh prompt, if we type

MSH C:/ > dir

we see a list of files [the same way the dos dir worked]. We see the same output for ls.

 

In Monad commands are called cmdlet [Commandlets]. Each cmdlet is a combination of a verb-noun pair. For example the cmdlet get-children or get/children gets all the children [files and directories when invoked in a FS]. dir and ls are aliases of get-children. By default the verb ‘get’ is assumed for a command given without a verb. So typing children gives the result of get-children and command gives the result of get-command. Alias is an exception. Typing alias gives the result of set-alias and typing aliases give the result of get-alias.

 

To see all the commands type command. To see all the aliases type aliases.

 

Some example Commands

 

MSH C:/> get-process

 

By using reflection, any object can list the methods and properties that it supports. To get a list of methods supported by a get-process object [which is a System.Diagnostics.Process object] try the command below.

 

MSH C:/> get-process | get-member -methods

 

MSH C:/> $a = get-process

 

MSH C:/> $a[0]

 

MSH C:/> $a[0].ToString()

 

Here $a is an array of Process Objects. We can invoke any function or property from the process class on object $a[0] and see the results like the ToString() example above.

 

MSH C:/> get-process | get-member -property

 

MSH C:/> $a[0].handlecount

 

MSH C:/> gps

 

MSH C:/> gps | tail

 

MSH C:/> gps | sort id | tail

 

MSH C:/> gps | where “processname –like cmd*”

 

MSH C:/> gps | reduce-expression {$_.handlecount -ge 500}

 

get-process or gps returns an array of objects. Reduce-expression works like a lambda in functional programming languages [similar to anonymous method]

For example in scheme (lambda((a b)(+ a b))) acts as a block of code.

In Monad the block of code after reduce-expression in braces is the script that will be carried for each pipeline object. $_ is set to the current pipeline object. So for each object in the object array returned by gps, $_ is filled with an object (the current pipeline object) for which the block of code is executed.

 

MSH C:/> gps | sort handlecount | tail | out-excel

 

MSH C:/> get-process | out-chart processname,handlecount -Title "Processes" -Filename Processes.html

 

MSH C:/> gps | sort handlecount | tail | out-grid processname,handlecount

 

MSH C:/> get-command out-*

 

MSH C:/> foreach ($p in $a | where "handlecount -ge 500"  | sort handlecount) { "{0,-15} has {1,6} handles" % $p.processname,$p.handlecount }

 

Notice the .NET style for formatting strings above.

 

MSH C:/> function n{notepad}

 

MSH C:/> n

 

MSH C:/> n;n;n

 

MSH C:/> gps [a-c]*,[t-z]* -exclude *[p-t] | stop-process –whatif

 

MSH C:/> gps | where “processname –like notepad*” | stop-ps1 –confirm

 

For invalid process ids, an error message is displaying when trying to stop them.

 

MSH C:/> stop-process 123,345,100000,200000,300000

 

MSH C:/> stop-process 123,345,100000,200000,300000 -errorpolicy notifystop

 

MSH C:/> stop-process 100000,200000,300000 -errorpolicy inquire

[Error stop-process]: (No process found for given ID :  : 100000) 100000"

 

[Error stop-process]: (No process found for given ID :  : 100000) 100000"

Continue :[y/yes/ n/no t/yestoall l/notoall s/suspend] s

MSH C:/> exit

 

[Error stop-process]: (No process found for given ID :  : 100000) 100000"

Continue :

[y/yes/ n/no t/yestoall l/notoall s/suspend] l

Stopped (Cmdlet:stop-process): User requested stop

 

MSH C:/>

 

Cmdlet

Each cmdlet is a managed class and not a separate executable. A simple cmdlet code is given below.

 

using System;

using System.Diagnostics;

using System.Management.Automation;

 

namespace SampleCmdlet

{

#region GetPs1

       [CmdletDeclaration("get", "ps1")]

       public class GetPs1: Cmdlet

       {

              public override void ProcessRecord()

              {

                     WriteObjects(Process.GetProcesses());

              }

       }

#endregion

}

 

The class that is to be exposed as a cmdlet is annotated with a CmdletDeclaration property specifying the verb and noun that is to be used to access this cmdlet. Also your class must inherit from the Cmdlet class and override atleast one of the three functions StartProcessing, ProcessRecord and EndProcessing.

 

A cmdlet that receives some input parameters and does exception-handling is given below

 

using System;

using System.Diagnostics;

using System.Management.Automation;

 

namespace SampleCmdlet

{

#region StopPs1

       [CmdletDeclaration("stop", "ps1")]

       public class StopPs1: Cmdlet

       {

              [ParsingParameterMapping(0)]

              [ParsingAllowPipelineInput]

              [ParsingMandatoryParameter]

              [ParsingPromptString( "Input the id: "  )]

              public int [] Id;

      

              public override void ProcessRecord()

              {

                     Process p = null;

                     foreach ( int i in Id )

                     {      if (ShouldProcess(i.ToString()))

                           {

try

                                  {

p = Process.GetProcessById(i);

                                         p.Kill();

                                  }

                                  catch (System.ComponentModel.Win32Exception e)

                                  { WriteErrorObject("No adequate permissions",e); }

 

                                  catch (System.ArgumentException e)

                                  { WriteErrorObject("No such process exists",e); }

                           }

                     }

              }

       }

#endregion

      

}

 

The code declares the input parameter, annotates it with attributes and assumes that the input values have been filled in. It doesn’t care if the input is coming form the pipeline, file, console or any other means. All the parsing and filling up the value is taken care by the shell. The same goes for output. The code calls WriteObject() function to do any output and the shell takes care of the formatting, displaying and routing of output as per the context.

 

The code above is for Monad, March 2004 build. Sample code for July, 2004 build is available at

http://msdn.microsoft.com/theshow/Episode043/Transcript.html

 

Cmdlet Providers

Cmdlet Providers provide the user with a basic set of cmdlets like pushd, move, copy, cd, dir etc that make the provider as navigable as a file store. Two standard providers come with the msh installation, one for registry browsing and the other for active directory.

 

[ProviderDeclaration("REG", "Microsoft", "Windows", "6.0", "MSH", "Registry", "1.0", ProviderCapabilityFlags.None)]

public class RegistryProvider :  NavigationCmdletBase

{

    protected override void GetItem(string path)

    {

        RegistryKey key = GetRegkeyForPath(path, false);

 

        if (key == null)

        {  WriteErrorObject(path, new ArgumentException("does not exist"));

        }

        WriteObject(key);

    }

    ....

}

 

For installing registry provider use:

MSH C:/> new-provider -Assembly "${MSHHOME}\System.Management.Automation.Core.dll" -Provider REG

 

 

 

 

 

Registry Example

To add a new item to the context menu of directories, some values need to be added to the registry. Here is an example that adds a “Launch MSH” option in the context menu of a directory such that on right clicking a directory and selecting “Launch MSH”, Monad is launched and a changedir [or cd] to the corresponding directory is done.

 

For this we create new items, “Launch msh” and “Command: in the registry using msh commands to give HKLM:/Software/Classes/Directory/Shell/Launch MSH/Command. Note: The escape character in MSH is ` => the back quote character.

 

MSH C:/> $val = format-string "`"{0}`" `"{1}`" `"{2}`" "  "${MSHHOME}\msh.exe" "-command" "cd  '%1' "

 

MSH C:/> $val

 

MSH C:/> new-item -path "HKLM:/SOFTWARE/Classes/Directory/shell" -name "Launch MSH"

 

MSH C:/> new-item -path "HKLM:/SOFTWARE/Classes/Directory/shell/Launch MSH" -name "Command"

 

MSH C:/> set-item -path "HKLM:/SOFTWARE/Classes/Directory/shell/Launch MSH/Command" –value $val

 

Now on right clicking any directory an option “Launch MSH” should appear. On selecting that option, MSH is launched with the current directory as the directory that was right clicked. Neat?

 

MSH C:/> Get-drive

 

MSH C:/> cd HKLM:/

 

MSH HKLM:/> dir

 

MSH HKLM:/> cd Software

 

Yeah, the registry provider lets you move through the registry just the way you move through a file system!

 

Download and Installation

Monad Beta Release 1.0

  1. Go to beta.microsoft.com
  2. Sign in with your passport id
  3. Enter Guest login as mshPDC
  4. Fill up the form with your details and submit
  5. After 24-36 hours you should be able to login to the system. Click the downloads link on left pane
  6. Click the Microsoft Command Shell link.
  7. Download .NET framework 2.0. Install this [22.16MB] [It does not interfere with your earlier .NET versions]
  8. Download msh – Microsoft Command Shell Preview [1.88 MB]

 

System requirements

Windows XP or Windows Server 2003.

[If you are on another windows version read 1 and 2]

 

Reference Material

http://msdn.microsoft.com/theshow/Episode043/default.asp

 

The best way to learn monad is to download the shell and read the documentation that comes with the shell. As of now, there are no technical resources about the shell except for the video by Jeffrey Snover – Architect, Monad and Jim Truher – Program Manager, Monad[link above]

 

Take a look at profile.msh file that is installed along with Monad in the user’s home directory.

There is a lot of code using aliases, environment variables, functions, commandlets etc – a good place to pick up some tips from.

 

Do write to me your feedback about Monad – good and bad.

Friday, June 25, 2004 6:22:04 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [14]Trackback
 Tuesday, June 15, 2004

Monad works on .NET framework V2.0. After a comment on one of my earlier entries, I decided to find out if there were any framework 2.0 dependencies in Monad. If not, then we could get it to run on an earlier version of the framework with a bit of work. Else, it will be good to know what features of the new framework are being used by Monad. [Optimistic, ain’t I? ;)]

 

I modified the version numbers in the IL generated by ildasm [.NET framework V1.0 and V1.1] on msh.exe and tried assembling the modified IL using ilasm. Worked smoothly. Next step was to take the dependent assemblies and generate each of them for .NET framework 1.1. On disassembling System.Management.Automation.Core.dll [one of the assemblies referenced by monad], changing the version info in the IL and assembling it back an error message with failure popped up. Looking through the IL generated I noticed generics being used throughout the code.

 

Okay, so monad is using generics. Well, that ensures that Monad will not work on earlier version of .NET framework. Generics is one of the new additions in the new .NET framework. So I have decided not to get too ambitious as to try and get this working on the earlier version(s) of .NET framework.

 

So much for installing Monad J

 

I noticed that .NET framework 2.0 doesn’t come with ildasm.exe. ilasm.exe is there though.

 

[If you are not able to install monad do read my previous post]

Tuesday, June 15, 2004 2:53:58 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [11]Trackback

Recently, an installation exe refused to run on my OS with an error message saying that the adequate OS was not present. All I wanted to do was extract the files from the package. If I could just get past the OS check within the installation exe, then I could get the files. Changing the OS string and environment variable etc didn’t help in this case.

 

Fortunately, I found an easier way to do this.

 

How do you extract files from an install shield exe?

 

If it is based on install shield wizard you may want to take a look at i6comp tool.

If it is based on msi package, then you first need to get the msi out of the exe.

 

From Brad’s e-mail:

Quote

To Hack the MSI file you have to first get to the .MSI file. Begin the install process by double clicking on the .EXE file. When you get the error message DO NOT click ok. Browse to your /local settings/temp folder in /Documents and Settings/. In the temp  folder look for a new folder with current date and time. Inside the folder you will see  file called, "Microsoft command shell Preview.msi" This file can be edited with a program called ORCA.

Unquote

 

Once you have the msi file, you need to edit the target OS version in the file using orca. [Refer this KB article]. Save the msi file after making the changes. Run the msi and you should be able to install the package.

 

Credits: Thanks to Brad Hite for helping out with install shield exe/msi packages.

Tuesday, June 15, 2004 1:32:45 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [10]Trackback
 Thursday, June 10, 2004

Microsoft Command Shell [codename Monad] is Microsoft’s upcoming shell that is planned to ship with Longhorn. I read up a bit about the shell and decided that I have to try things for myself to believe that it was actually true. There is not much material about Monad on the internet now, except a lot of blogs, most people blogging about it are PDC attendees.

 

I downloaded the monad beta bits, its release notes claim that monad will work on Windows XP and Windows Server 2003 only. Monad requires .NET framework 2.0. I installed the framework on my Win2k Professional machine and tried installing monad. The monad installer started off and displayed a message box with the message “The operating system is not adequate for running Microsoft Command Shell Preview”. I did the same things on another machine with win2k3 server. Monad installed and I could work on the shell. Monad is a .NET application and I can’t think of reasons why this shouldn’t work on my win2k machine. Good time to use the deployment feature of .NET apps that I keep talking about. I copied the extracted files [dll,exe and configs] from the server machine to my machine. Launched cmd.exe, moved to the monad folder in my machine [where I copied the monad files from server] and started msh.exe. Bingo, after a minute the shell prompt appeared. Something was different though. I did not see the regular message “Microsoft Command Shell (msh)” that is displayed when you start msh. I took the profile.msh file from my home directory on the server machine and copied to my home directory in my machine. And presto, I have msh.exe working on my win2k machine now. I haven’t found anything missing until now, the behavior of the shell seems to be the same on my machine as on the server machine.


Monad is cool :), absolutely!

Thursday, June 10, 2004 6:54:34 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [17]Trackback
 Friday, April 23, 2004

Finally, setup Antlr to successfully generate the C# parser and lexer files.

I am on a win2k professional machine with Visual Studio.NET installed.

Things to take care of:

 

  • Have one of the later versions of java installed and ensure that java is working fine [its in the PATH and stuff]
  • Install the antlr binaries.
  • Define a CLASSPATH environment variable to point to your antlr.jar file.
  • The java.g that ships with antlr will not compile as it has an extra character in line 1627. Comment that line and it works as expected. [This file will generate those 4 missing files I spoke about in my previous post]
  • The command line arguments to generate code is
    java antlr.Tool <filename.g> where filename is the path to your rules file. The expected language output is given in the rules file itself, by default it is java.

 

Quite neat.

 

Okay now the reason I was checking out antlr is so that I can start working on the DDL with Rosh. Originally we had used Lemon to generate the parser for us and used the parser tree generated to write further code. Recently we ported the DDL to .NET and are now considering writing a compiler for it. Instead of writing the parser by hand and the code following, I thought I would give antlr a shot and see what its generated files are like. Saves us a lot of time and lets us concentrate on the main problem at hand.

 

I like the exception handling that antlr does on its own and the way it leaves room for the programmer to add custom exception handlers. It wouldn’t have been a big pain to do this on your own all together, but like I said, it saves you time and lets you concentrate on the real issues.

 

I definitely do not believe in re-inventing the wheel J. Removing parts of the wheel and re-writing, adding to the wheel etc are different but simply re-inventing the wheel – NO. Time is too short.

Friday, April 23, 2004 1:29:21 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [5]Trackback
 Tuesday, April 20, 2004

I thought the day went well until I came to office and checked mail about an hour back.

 

Today I went for a stress management workshop from my office at Taj Gateway, Bangalore. We were about 20-25 people and the facilitator was a lady from Chennai. The workshop was in a huge hall with single sheets laid out on the carpet for each of us. We did some basic yoga, sitting, lying down and even walking around the place.

Three of the most embarrassing things we did today

-          We were asked to sit down, open our mouth wide, stick out our tongues as much as possible and pant like dogs. So we all go “huh huh huh…” This was an exercise to get our voices from our diaphragm, to conserve energy (like dogs).

-          crawl on all 4’s again like a dog in a square on your sheet. And facilitator said things like growl if somebody encroaches your territory, boy that was hilarious. [Just to tell you, we 25 people had people of both genders and almost all designations].

-          We were asked to just walk around casually in the hall after lunch until she asked to stop. After which we had to find a partner and look into his/her eyes until the facilitator asked us to stop. This was the most uncomfortable. We did that two more times, we had different partners each time. The fourth time, the lady asked to us to be friendlier and asked us to greet the other person with our palms joined in a Namaste, a gesture of kindness and love. Quite funny if you think about it, as we faced our partners in that gesture the facilitator continued speaking “give love, … admire the partner’s beauty … “ Glad it didn’t last long.

 

It was a relaxing workshop, especially since it wasn’t my daily routine and I could lie down after lunch J

I thought I would drop in at office to check mail, I have been expecting to hear from Antlr support and my university admissions. Come here to find that I have a reject mail from a university. And no mail from Antlr team.

 

I have been trying to setup antlr to generate C# code. It generates the java files as expected. Now the documentation for this talks about building a C# solution provided which has two projects. One of the projects has a few files missing. There is no mention of where to get the files from or how to generate them. I downloaded the binary and had the C# runtime dll required to generate C# code. Now again, there is no mention in the documentation about how to actually reference the dll in an example rules file that you write or what command line parameters/switches to include while running the tool.

 

After fiddling around with some example files and intelligent guesses when I tried running the tool for C# it gave me the standard error. The only relevant discussions I found were this, this and this. The last one talks about modifying the config.make file in V2.7.2. I do not have a config.make file in V2.7.3. [Also I think some of their example files are not right, like \antlr-2.7.3\examples\csharp\java\java.g has an extra paranthesis] I had spent two days trying to figure this out and had finally sent a mail to the antlr folk. Hopefully they will get back with some solution. I really wish their documentation was better.

 

I am going to download and try NAnt for the first time. I hope that can help me with the antlr setup also.

Tuesday, April 20, 2004 9:12:25 AM (US Eastern Standard Time, UTC-05:00)  #    Comments [5]Trackback