I created an account using delicious com and it is so easy to maintain your favorites using this. The beauty of this is that you can save bookmarks and access it online whenever you need them. There are also addons provided by IE as well as other browsers from where you can directly store items added to your favorites under delicious account. You can also at any time import / export all your entries maintained under this account. You can also categorize links by giving tags just to add more information to the link.

Create your account using http://delicious.com and you can access browser addons at the following link http://delicious.com/help/tools

I find it an easy and efficient way to bookmark all useful links and access it based on my needs.


The below macro will ensure that :
1. Subject is not empty
2. You are not missing any attachment

Steps :
1. Open OutLook
2. Press Atl + F11 to open VBA editor
3. Towards left pane, you will find Microsoft Office Outlook objects, expand it.
4. You will find “ThisOutlookSession”
5. Copy paste below macro and save it to project
6. Open Outlook window, Tools tab
7. Click on “TrustCenter” and then “MacroSecurity”
8. Check “No Security Check for Macros” option
9. Close and Open Outlook and this macro will start working

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim strSubject As String strSubject = Item.Subject Dim intRes As IntegerDim strMsg As StringDim strThismsg As StringDim intOldmsgstart As Integer If Len(strSubject) = 0 Then Prompt$ = “Subject is Empty. Are you sure you want to send the Mail?” If MsgBox(Prompt$, vbYesNo + vbQuestion + vbMsgBoxSetForeground, “Check for Subject”) = vbNo Then Cancel = True End If End If intOldmsgstart = InStr(Item.Body, “—–Original Message—–“)’ intOldmsgstart is the location of where old/re/fwd msg starts. Will be 0 if new msg
If intOldmsgstart = 0 ThenstrThismsg = Item.Body + ” ” + Item.SubjectElsestrThismsg = Left(Item.Body, intOldmsgstart) + ” ” + Item.SubjectEnd If’ The above if/then/else will set strThismsg to be the text of this message only,’ excluding old/fwd/re msg’ IE if the original included message is mentioning an attachment, ignore that’ Also includes the subject line at the end of the strThismsg string
If InStr(LCase(strThismsg), “attachment”) > 0 ThenIf Item.Attachments.Count = 0 ThenstrMsg = “Attachment Checker:” & Chr(13) & Chr(10) & “Your message mentions an attachment, but doesn’t have one.” & Chr(13) & Chr(10) & “Send the message anyway?”intRes = MsgBox(strMsg, vbYesNo + vbDefaultButton2 + vbExclamation, “You forgot the attachment!”)If intRes = vbNo Then’ cancel sendCancel = TrueEnd IfEnd IfEnd If
End Sub

Windows WorkFlow Foundation

Posted: June 11, 2008 in General Tech

Windows Workflow:
This is a framework for building workflow into applications. Workflow are set of activities that co-ordinate work or activities. Activities are the basic building blocks of Workflows. The primary activity or root activity which mainly comprises of basic workflow activity is called WorkFlow definition which inturn maintains activity tree comprising of all other activities. The root activity can be sequential activity or a state machine activity.
Remoting concepts :
· Marshal by value: the server creates a copy of the object passes the copy to the client.
· Marshal by reference: the client creates a proxy for the object and then uses the proxy to access the object.
Workflows are :
1. Stateful – Application state is maintained.
2. Long running
3. Flexible Control Flow – can be sequential or rule based.
4. Transparent
Biztalk is used for B2B scenarios. It is a Server.
WF is a programming framework and is used for defining workflow and is exposed via WinFx.
Future version of BizTalk will use WF for orchestration. Orchestration in BizTalk refers to defining business processes or workflows. BizTalk is designed for multiple applications (B2B scenarios) use while BizTalk is designed for single application use.
Workflows run in a Host process (Application or Server).
WF Components:
1. Base Activity Library : Out of box activities as well as base classes for building custom acitivites.
2. Runtime Engine : State management and workflow execution environment. Have Instance Manager, Tracking infrastructure and Activity scheduler.
3. Runtime Services : Hosting flexibility and communication. Out of Box runtime services support transactions, persistence, tracking and require SQL Server.

· Timer Services : Manages timers (Ex: delay)
· Persistence Services : Stores and retrieves instance state.
· Tracking Services : Manages profiles and stores tracked information.
· Threading Services
· Transaction Services

4. Visual Designer : VS.Net IDE
WorkFlows may be defined in code or XAML.
· There are two main kinds of workflows:
o Sequential: Its actions are executed in some predefined order with a beginning and an end. Examples of sequential workflows may include installations.
o State machines: These workflows don’t have a path, but it’s represented as a set of states and transitions between states. External events and rules drive processing order.
o Rule Based : Is rule based. Can have sequential or state machines as root activity. These have conditions and based on that decision will be taken,
WorkFlow Authoring Modes :
1. Code
2. Xaml
3. Xaml and Code
WorkFlow Compiler (wfc.exe) – Workflow constructor defines structure of the workflow.
Code / Xaml à WorkFlow Compiler à Dotnet Language compiler -àWorkFlow Runtime
Activity Class : Initialize(), Execute(), Cancel() and Close() methods. When WorkFlow runtime loads, it has Activity tree in memory.
By default, the WF runtime engine will execute the workflow asynchronously, which is not desirable in this simple example. To avoid that, you block that thread through a AutoResetEvent object and wait for workflow to complete.
Workflow can accept parameters in the form of a Dictionary object.
Out-of-box services are provided that support SQL Server. SQL Persistence and SQL tracking services are examples for this.
Exceptions are handled using FaultHandlers. We need to implement FaultHandler Activity.
Sequence Activity is a Composite activity. Delay activity is an example of Basic activity.
WF Runtime : There can be one workflow instance per App Domain. WorkFlow Instance will interact with WorkFlow Service Layer and has WorkFlowRuntime within (which has Activites tree in memory and also manages state management). WorkFlows are identied by a GUID and we can use GetWorkFlow() method and get a WorkFlow if we supply the GUID. WorkFlow Instance will have WorkFlowRuntime within it.
WorkFlow events :
Started, Stopped, WorkFlowCompleted, WorkFlowTerminated, WorkFlowIdled.
WorkFlowInstance :
WorkFlowRuntime.GetWorkFlow(instanceid) – Will get the WorkFlow Instance.
WorkFlow Instance methods : Start, Suspend, Terminate, ApplyWorkflowChanges, GetWorkflowDefinition, Resume
WorkFlow Instance Status :
The Base activity class exposed ActivityExecutionStatus enum which determines the status of the entire WorkFlow instance.
ActivityExecutionStatus : Cancelling, Closed, Compensating (Transaction has failed and compensation has to be initiated), Executing, Faulting and Initialized.
ExecutionResult : Gives the status of the last run of the WorkFlow. Possible values are Canceled, Faulted, Succeeded, Compensated and None.
Dehydration and Rehydration : If a workflow has large number of tasks executing, you can unload tasks and store the necessary context information in SQL Server. The goal is to unload some tasks and store them in SQL server temporarily and reload them when time is right.
Activities :
Single task within workflow. Grouped into Basic and Composite.
ActivityExecutonContext Object : Provide activity with methods and services tied to WorkFlow instance such as initialization, timers and general execution flow. It represents the execution environment of the Activity. It is similar to HttpContext object of ASP.Net which (Encapsulates all HTTP-specific information about an individual HTTP request.).
Dependency properties :
Allow different activites to reference to the same property.WF ActivityBind class facilitates the same for us. .Net Runtime gives us platform to use Dependency Property.
State Machines : Consists of State Activity. Each State Activity is a composite activity. State Machines need to have InitialState and FinalState. Completed State do not have any events. Event driven Activity can only have a receive event or a delay.
Events can be attached to composite State as well.
StateMachineWorkFlowInstance is wrapper around WorkFlowInstance class which gives details about StateMachine.

Make use of “SetState” activity (SetState API) to reset to any state within the StateMachine. This is WF way of dynamically changing State Activity.
WorkFlow Tracking :
There are certaing pluggable and optional services which can be used with WorkFlows such as Tracking Service, Queuing Service, Runtime Service, Scheduler Service, Transaction Service.
WorkFlow can be tracked using SqlTrackingService which can be used to track WorkFlows . Track data can be workflow, activity or user data. We can use SqlTrackingService or we can create our own custom services. Tracking also serve for auditing process.
Tracking architecture :
Tracking profiles defines events of interest..means of filtering events like which we want workflow events or activity events or user events. Tracking profile object can populated programmatically or through xml.
Tracking runtime sits between host application and Tracking Services. There is Tracking Store outside host application. Tracking Runtime requests for Tracking profiles from Tracking Services . The TrackingServices will return TrackingProfile to the TrackingRuntime. The TrackingRuntime will do the data and event filtering based on TrackingProfile and send it to the TrackingService through TrackingChannel which will be later written on the TrackingStore.

Loading and Unloading WorkFlow Instances :
WorkFlow Persistence Services : WF provides options to unload and reload workflow instances . WF ships with a pluggable service known as SqlWorkFlowPersistenceService that is designed to serialize and store WF instances in SQLServer database. When an assembly is idle for a while, which in this case occurs when the DelayActivity activity is executed, the Windows Workflow Foundation can persist your workflow to storage until it has to resume.
Workflow instances can be persisted in the following scenarios :
1. When the WF execution is completed.
2. When WF enters the idle state.
3. When we manually unload the WF instance.
We can control persistence by calling specific methods on the WorkFlowInstance object or allowing the WorkFlow to enter into idle state using Delay Activity. If the delay is executed and if the application has SqlWorkFlowPersistenceService plugged in, then the workflow runtime will automatically persist the workflow instance and recall it when the delay period expires.
WorkFlowInstance methods :
1. Load – loads the instance into memory from database.
2. TryUnLoad – does not block if it cannot be unloaded (persisted in database).
3. UnLoad – Blocks the current thread until the unload (persisted in database) is successful.
Retrieving WorkFlow tracking data :
We can use SqlTrackingQuery.GetWorkFlow(Guid instanceId) to get the WorkFlow instance tracking data.
Tracking User Data :
If we execute Activity.TrackData and set User key and User Data , this will go as User Events in dbo.UserEvent table.
Creating New Profiles : This will create a new TrackingProfile and also add Activity tracking point and Workflow tracking point. This can be done programmatically as well through XML by using TrackingProfileSerializer class. We can apply filters on tracking events.
Creating a new Custom Service : Inherit ICustomService interface and IChannelService interface and implement GetProfile and Send method.
Basic Activity Operations :
Code Conditions : The Code Condition refers to Boolean return value through ConditionalEventArgs argument.
Code Activity : Used to provide basic code execution within workflows. ExecuteCode should be set to the name of the method which should be run.
Throw Activity : Used for exception handling. When we throw expection, workflow Termination event will be executed and WorkFlow will be halted. We need to use combination of Throw and Fault Handlers.
If we do not set FaultType or Fault Property, we will get System Exception with message as ‘Fault Property Not Set”.Each FaultHandler is designed to handle only one fault i.e only one exception. Faults thrown by an activity can be only handled by parent.
By using throw and FaultHandlers, the workflow instance will get stopped . The advantage here is that we are handling the exception rather than leaving it to the WorkFlowRuntime to dispose it. If we want to continue processing even when exception occurs, we have to use try catch block inside activity code.
Compensation vs. Fault Handling
A typical scenario for compensation handling would be when an activity successfully completes, but an exception is thrown in another activity later in the workflow. Different than Fault Handling, we now want to cancel the completed work and not to undo any partial and unsuccessful work of the activity in which an exception has occurred.
The triggering of a compensation block is done by the workflow designer, and not only by the workflow runtime. This is done using the CompensateActivity
Suspend Activity :
Suspended means not currently executing but it not unloaded (persistence wont come into picture). We need to set Error string and this will be available throught the WorkFlowSuspended event handler. WorkFlow is in waiting state , waiting for some user action.
Terminate Activity :
Kills the WorkFlow instance. Can be handled using WorkFlowTerminated event.

SQL File and FileGroups :
SQL Server databases have three types of files:
• Primary data files
The primary data file is the starting point of the database and points to the other files in the database. Every database has one primary data file. The recommended file name extension for primary data files is .mdf (Microsoft Data Format File).
• Secondary data files
Secondary data files comprise all of the data files other than the primary data file. Some databases may not have any secondary data files, while others have multiple secondary data files. The recommended file name extension for secondary data files is .ndf(NimbleGen Design File).
• Log files
Log files hold all of the log information used to recover the database. There must be at least one log file for each database, although there can be more than one. The recommended file name extension for log files is .ldf(Layered Data Format File). Log files are never a part of a filegroup. Log space is managed separately from data space.

SQL Server data and log files can be placed on either FAT or NTFS file systems, but cannot be placed on compressed file systems.
FileGroups are logical containers used to store database files.
There are two types of filegroups:
• Primary
The primary filegroup contains the primary data file and any other files not specifically assigned to another filegroup. All pages for the system tables are allocated in the primary filegroup.
• User-defined or Secondary
User-defined filegroups are any filegroups specified using the FILEGROUP keyword in a CREATE DATABASE or ALTER DATABASE statement.

SQL System Databases

Posted: June 11, 2008 in SQL

Following are the SQL Server System Databases :
1. master Database – Contains information about the server overall and all databases created. The information in this database includes: file allocations, disk space usage, system-wide settings, user accounts, and the existence of other databases and other SQL Servers.
2. model Database – This database provides a template for all newly created databases. If you ever need to add a table or stored procedures to all the new databases you create, simply modify the model database.
3. msdb Database – Used by the SQL Server Agent service. Stores information related to SQL Jobs and Alerts.
4. tempdb Database – Is a workspace used for holding temporary information.

Bheemeshwari water rafting

Posted: October 1, 2007 in TimePass

Bheemeswari is a place situated between Mekhedatu and Shivanasamudra. It lies in Mandya district. It is about 100 kms from Bangalore. It takes around 2.5-3 hours from Bangalore. It lies on the banks of river Cauvery and is also known as ‘Cauvery Fishing Camp”. It is world-renowned as home to the great ‘Mahseer’ – the finest & the largest tropical sporting fish known to man. Also, Bheemeswari has jungle resort. It is 5 kms from Mutathi.

We started at around 7 am (initial plan was 6 am) and we left Banashankari our last transit point at around 8 am. From there we went to Kanakpura . Road was good. From Kanakpura we went to Sathnur. Thereafter, ghat section started and roads were bad and we had horrible time with flocks of sheep and cows blocking our passage. We reached Bheemeswari around 12 . The route was superb with dense forests and Cauvery river almost running parallel to the road. Some spots in Ghats were really quite wonderful. We had completely forgotten Bangalore for a while.

When we landed in Bheemeswari, we were asked to enjoy a little time in resort. Our raft was supposed to start around 2 pm. The resort was awesome. We were a bit scared when we were asked to fill forms stating that “We are only responsible for our death”. We were little happy though as most of us had insurance in our names. We had done some homework and we knew that these forms are for namesake. We had a stroll around the river banks. We got ourselves ready for raft. Then we had a good lunch served at the resort. It was purely vegetarian food. Then we had some time left, we rested on hammocks for a while.

We are getting frustrated as the raft was not getting started. We had some conflicts with the organizer. Our bandwagon comprised of 8 people and we wanted to raft in the same boat. But, according to rules, maximum of 7 people are allowed inside a single boat and one guide also accompanies in a boat. We were forced to split 4-4. The best thing is at the same time all 3 boats start rafting. We got ourselves ready wearing life jackets and helmets. Then everyone had paddles in their hands and soon we were all seen taking “Chakde”’ snaps. Soon, we assembled and we were asked to check whether we had worn life jackets and helmets properly. Thereafter, we had some rafting training.

There were a set of rules which our guides explained to us. How to hold paddles, how to paddle, how to address the situation when someone falls in water, how to lock our legs so as to eliminate the chance of falling into water due to imbalance and other things. Believe me, there is nothing to get scared, the guides are really good and the boat as far as I know never topples. We initially thought that raft is not so difficult. So, 20 people along with 3 guides were ready for a race. Also, guide told us that co-ordination and team work is required. Weekend also team work…we were not able to forget IT life in jungle also…

Raft started. We were following 3 commands only, forward paddle, back paddle and most relaxing command-stop (stop paddling). There are some other commands like left side forward paddle in which case right side people have to back paddle to maintain momentum. Raft is about 8 kms. and it is through dense forests on both sides and mind blowing landscapes all around. Guide told us that the water depth is about 30 feet maximum and it is not uniform. The water current level at Bheemeswari is Grade 2+ which is not much as compared to Grade 5+ water current level at Hrishikesh. There were some crocodiles and we saw 1-2 with open mouths. Our guide showed us crocs and he clapped hands.The crocodile had disappeared. I guess these guides have enough experience and that is only reason I was confidently rafting (I had enough confidence that they will rescue me even if the boat topples or I fall down).Once we were inside a rapid, boat started wobbling…We all started shouting..again we were relaxed as the rapid had passed by. Our guide also showed us some vortexes…he told us that if we get caught inside a vortex no one can save you even if you know swimming…In between, our guide was showing us some crocs and trying to scare us.

Our guide also showed us to how to rotate the boat …the experience was really great. Some people started asking guide that we should win the race and not to fall behind…Initially we were ahead but due to some swirling exercises we were lying back now. Our guide was master. He was crafty. He had plans up his sleeve. He had rich expertise in rafting at Hrishikesh. Slowly we started moving ahead. At one point, guide shouted “Team work is needed”. He asked us to stop paddling and told that rhythm was missing. He told us that due to improper sync between team members boat is slowing. He further added that if this is case better to stop paddling as we will travel much faster than when we are paddling. Soon, now, we were in sync and slowly but surely we started moving ahead to win the race. There was sledging going way from opposition camp though it was not on field. As and when rival teams came nearby, there was a lot of water splashing going on and it was awesome experience.

There were some rocks in between and our guide told us that if we hit some rocks we can’t escape . He also told us that even though you have helmet, due to speed of water, you will get badly injured. Now, we were almost at the end. We had time to plunge into water.I also plunged seeing all my counterparts doing it but came up early as I could not resist much…Now, we were ahead and we wanted to win the race. There was one last rapid but dangerous rapid which would decide everyone’s fate and it was really exciting. Water rushing towards boat from all ends. The last rapid had some hole and once we were inside the hole we were asked to paddle with all the remaining energy to come out. At last, we had overcome the final hurdle and that too on a winning note. We started shouting “Yeah Yeah”.

Then, we were asked to get down from the boat and cross a small passage of water though water was around 4-5 feet. I was almost scared as I did not know swimming but somehow reached the other end. I thanked god for having had a safe journey but it was too much exciting. We were asked to settle down. The organizer came to me personally and said “Did you get answers to all your questions”…Initially, I had raised an argument that we wanted to raft together…He had told that they win balance all the teams so as to have a safe rafting…They don’t allow too much girls in one raft and also not more than 7 people in a raft..

The KFC also has cottages available. They arrange special elephant rides, fishing and jungle trekking. Rafting will be conducted on all Saturdays, Sundays & Public Holidays. During week-days it is purely based on request. The best time to visit is Monsoon from June to Aug. September to Feb is cool and right time to visit as we found out. Summer is warm, especially during afternoons. We can also fill online forms to avail this facility and believe me it is worth going. They charge Rs. 1.200 Rs per participant inclusive of transportation( Transportation from Bangalore & Back is arranged by them) . 900 Rs ( Rupees Nine Hundred only ) per participant without transportation(Transportation from Bangalore & Back to be taken care of by the participants). Per day they schedule 3 rafting batches. More details can be obtained at http://www.careindia.in/wwr_rafting.html.
Now, we had to get back to Cauvery Fishing Camp by road. They had transportation in in place for that. We thoroughly enjoyed the trip. Then we headed back to Bangalore by 6.30 pm and reached here by 9 pm. While returning, it started raining heavily…Thank God it did not rain while going. It was totally relaxing and exciting Sunday for all of us.

Good C# and .Net sites

Posted: May 25, 2007 in General Tech