Tuesday, December 30, 2008

Changes made to deploy ASP.NET 2.0 AJAX 1.0 control in MOSS 2007 application

- Downloaded ASP.NET 2.0 AJAX 1.0 extentions from http://www.microsoft.com/downloads/details.aspx?FamilyID=ca9d90fa-e8c9-42e3-aa19-08e2c027f5d6&DisplayLang=en

- Downloaded ajax.config feature and from http://www.codeplex.com/features/Release/ProjectReleases.aspx?ReleaseId=2502

added and deployed wsp and activated ajax.config feature on necessary web application.


-Made a web part

using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
using System.ComponentModel;

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


namespace CompanyName
{
[XmlRoot(Namespace = WebPartConstants.WEBPART_NAMESPACE), DefaultProperty(WebPartConstants.DEFAULT_XML_ROOT_PROPERTY)]
public class TestWebPart : Microsoft.SharePoint.WebPartPages.WebPart
{
public TestWebPart()
{
this.ExportMode = WebPartExportMode.All;
}
protected override void CreateChildControls()
{
//EnsurePanelFix();
this.Controls.Add((UserControl)Page.LoadControl("~/_controltemplates/CompanyName/TestControl.ascx"));
}

/*protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
// Register the ScriptManager
ScriptManager scriptManager = ScriptManager.GetCurrent(this.Page); if (scriptManager == null)
{
scriptManager = new ScriptManager();
this.Controls.Add(scriptManager);
}
}*/



/*private void EnsurePanelFix()
{
if (this.Page.Form != null)
{
String fixupScript = @"
_spBodyOnLoadFunctionNames.push(""_initFormActionAjax"");
function _initFormActionAjax()
{
if (_spEscapedFormAction == document.forms[0].action)
{
document.forms[0]._initialAction =
document.forms[0].action;
}
}
var RestoreToOriginalFormActionCore =
RestoreToOriginalFormAction;
RestoreToOriginalFormAction = function()
{
if (_spOriginalFormAction != null)
{
RestoreToOriginalFormActionCore();
document.forms[0]._initialAction =
document.forms[0].action;
}
}";
ScriptManager.RegisterStartupScript(this,
typeof(TestWebPart), "UpdatePanelFixup",
fixupScript, true);
}
}*/



}
}

-Made a user control

--- ascx file---------
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestControl.ascx.cs" Inherits="TestControl_TestControl" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI" TagPrefix="asp" %>








---code file----------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class TestControl_TestControl : System.Web.UI.UserControl
{
protected void TimerFunc1(object sender, EventArgs e)
{
newLabel.Text = DateTime.Now.ToUniversalTime().ToString();
}
}


- Modified masterpages. Added scriptmanager control in the masterpage right under the webpartmanager tag. Set EnablePartialRendering to true and set SupportsPartialRendering to true in the asp:Scriptmanager tag. Removed return from onSubmit in form tag.

- Added web part on a page.

- Ajax worked!!

Thursday, December 11, 2008

Web Part Lifecycle

Following is the series of events which occurs for every web part on the page.

1. protected override void OnInit(EventArgs e)
2. protected override void OnLoad(EventArgs e)
3. protected override void CreateChildControls()
4. protected override void LoadViewState(object savedState) //Only at Postback
5. protected override void OnPreRender(EventArgs e)
6. protected override void Render(System.Web.UI.HtmlTextWriter writer)
7. protected override void OnUnload(EventArgs e)
8. public override void Dispose()

Calculated Columns

This blog post is an addition to the knowledge served under the technology domain in my blog. Going specifically into MOSS 2007, which has been the source of my bread and butter (no wonder I've gained weight :)), there is a feature in this product called as MOSS 2007. All people associated with the technology know deep into how to deploy the site column through features, how to create a new site column, types of site columns. What I thought people would love to know is that there is a feature called as calculated site columns in MOSS 2007. The formulas mentioned below can be used in MS EXCEL as well in case you are not a MOSS buff :).

The real mantra here is that there are site columns that need the currently logged in user name or the current date at times. The way to do these is to use the [Me] and [Today] objects. There is a further flaw in this approach. Directly entering this value in the visual code editor for the column value will throw an error. For this first create a column as Me in the content type and use that in the formula. Delete Me after the calculated column has been created to achieve the desired result. The same applies to Today object as well. Happy developing from here on :).

  • How to deploy these calculated columns through features:

It is not very easy to find a sample of how to define a site column of type calculated using the SharePoint 2007 features framework. The documentations shows how to do it using the user interface (see Calculate data in lists or libraries ). The documentation in the WSS SDK about the  Formula Element in the CAML Core Schemas points in the right direction but is maybe not clear enough. I tested the sample code below by using the site columns in a list definition. You might want to test it out in a content type as well - please provide feedback in the comments.

Code sample feature.xml

<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/" Scope="Site" Title="Calculated Sitecolumn" Id="49C90DCA-6C76-4b30-99DB-7C4C7D100761">
<ElementManifests>
<ElementManifest Location="calcsitecolumn.xml"/>
</ElementManifests>
</Feature>

Code sample calcsitecolumn.xml

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field Name="CalcDemo" StaticName="CalcDemo"  Type="Calculated" DisplayName="Calculated column" ID="{DD01AF0E-5E58-4e50-B3E8-1BFC866CA9A0}" ResultType="DateTime" Format="DateOnly" ReadOnly="TRUE">
<Formula>=StartDate+7</Formula>
<Default></Default>
<FieldRefs>
<FieldRef Name="StartDate" ID="{64cd368d-2f95-4bfc-a1f9-8d4324ecb007}" />
</FieldRefs>
</Field>
</Elements>
  • How to use the formulas in the site column (Its basically simple VB code):

You can use the following examples in calculated columns. Examples that do not include column references can be used to specify the default value of a column. For details on how to use these formulas refer to: http://office.microsoft.com/en-us/sharepointtechnology/HA011609471033.aspx

Monday, December 8, 2008

Christmas

This is the exact time uncle Pumblechook got Joe a bottle of port wine and commented on pip being a totally ungrateful boy. He said that pip should be grateful to his aunt for bringing him up so well. The reason i mention this is to hyperlink the fact that many people in so many lives try to help but end up hurting people in turn. This is the perfect time to say the wonderful word to your peers and relatives that might have been hurt sometime. This is the season of perpetual hope. The season people find their true love. The season when people share secrets that are really close to their hearts. This is the season when people get time out of their busy lives to live freely and enjoy with family and friends.

Sitting under the mistletoe,
Bells ringing overhead.
They think of Santa,
and the angels singing overhead.
The sledge of hope is there in the minds,
be the person old or young sleeping in a bed.

Opening presants has been everyones twinkle in the eye moment on this day, since ages that I have seen. Every year there is so much excitement all around.. the christmas carols, the bells, the smiles on peoples faces, the christmas discounts, and a whole lot of goodwill everywhere.
Children love it immensly when you wish them a merry christmas. And since every great man has said there is a child in all of us, do not forget wishing your friends and family "FELIZ NAVIDAD y PROSPERO AÑO FELICIANO"

Friday, November 28, 2008

White Knights.. awesome dance..



White Nights - The dance

You might wanna see this as this is what dance used to look like in the 90's. You gotta step it up if you need to live in dance right now :/

Michael Jackson Rules! Period!



Hip Hop Dance Moves for Men : Hip Hop Dance Moves for Men: The MJ Step

Wednesday, November 26, 2008

Sharepoint is bloody deep

If you go to understand what MOSS is, you will be baffled by the number of features and the number of references it has. MSDN is itself so vague in explanations. Blogs are the god of MOSS development.

I was reading about the Excel services Architecture in MOSS 2007. It is a doctorate in itself!!

Tuesday, November 18, 2008

Caught in the wrong job?

Its really like one of those "Caught in the wrong job" kind of times nowdays. I'm doing development, design, architecture, and whole lot technical documents on MOSS 2007. Yesterday the client told me that he needed a development document for MOSS 2007. So I made one - 2 MB in size. Huge document containing all the best coding practices and stuff that I did not know before.

As usual -> luck is not really what I bank on and it turned out a correct investment gyan. I got raped by my manager, that this is a bible, not a best practices document. So the 180 pages document had to be reduced in size to a 30 page document, including TOC, references, etc. I mean 1/5 th the size of the original document. And then it was supposed to go to the client. I ended up mailing the first document altogether.

Bloody e-mail. Then I called back the first mail, sent an apology to the client (my performance score is expected to suck after this) and sent him the correct documentation.

What I need now is i think: http://www.drinksmixer.com/drink8127.html. Anyone for accompanying me on that?

If you feel that I love my job is the mantra you need. Hey you. Welcome to my club.

Friday, November 14, 2008

CAT exams

hey CAT.. meeeow...

Cat is one of the most competitive written examinations in India so far. It is the entrance Criteria for almost any Management college in India. It stands for Competitive Aptitude Test. The cat is divided into three gruesome sections. One is the Analytical section, then there is an English section and the third is a Data Interpretation section. Now these three sections are supposed to test the awareness of the person, the amount of speed math the person is able to do and the verbal ability of the person. There are about two lakh participants who sit in this examination every year and the competition gets more and more difficult each year.


I happen to be one of them and have no prep whatsoever. May the great lord get me above 80 percentile. Rest I leave to lady luck :).

Sunday, November 9, 2008

Shit Happens.. This is the way to camouflage it

If you have had a shit day.. Look on the bright side of it.. It might change your next.. ROTFLMAO.

"Daddy!  Daddy!  I got a 100 in school today!"
"That's great, Sweetheart," said her daddy.
"Come in to the living room and tell me about it."
"Well,"  began the confession, "I got 50 in spelling, 30 in math's and 20 in science."

Friday, October 3, 2008

Awesome Truth

One of the women offered to find out the process of refining silver and get back to the group at their next Bible Study.
That week, the woman called a silversmith and made an appointment to watch him at work. She didn't mention anything about the reason for her interest beyond her curiosity about the process of refining silver.     
As she watched the silversmith, he held a piece of silver over the fire and let it heat up. He explained that in refining silver, one needed to hold the silver in the middle of the fire where the flames were hottest as to burn away all the impurities. 
The woman thought about God holding us in such a hot spot; then she thought again about the verse that says: "He sits as a refiner and purifier of silver." She asked the silversmith if it was true that he had to sit there in front of the fire the whole time the silver was being refined.  
The man answered that yes, he not only had to sit there holding the silver, but he had to keep his eyes on the silver the entire time it was in the fire. If the silver was left a moment too long in the flames, it would be destroyed.
The woman was silent for a moment. Then she asked the silversmith, "How do you know when the silver is fully refined?"
He smiled at her and answered, "Oh, that's easy -- when I see my image in it" 
If today you are feeling the heat of the fire, remember that God has his eye on you and will keep watching you until He sees His image in you.

Monday, September 29, 2008

Answers To the Questions about Relegion

It is true that it is believed that God is supposed to be an Omnipotent, Omniscient and personal being. In our philosophy there is one major God (Ishwara). He is assumed to be the creator and controller of all. Basically he can summon whichever power he wishes to and perform any task. Also there are Gods of different powers individually. They are reffered to as deities in the western cultures.

The concept I was trying to inculcate is still unclear with the above explanation. I was trying to explain that our scriptures talk about henotheism. This is a concept meaning devotion to a single primary god while accepting the existence or possible existence of other deities.

So while there is one single God (Ishwara), there are a lot of deities with unique powers and they in turn are responsible for the various acts of nature. For example, agni(fire), vayu(air), et cetra. We all believe that God is within us all. A person can become a Devotee and then a deity. As the book says, Ishwara lies within us all. So there is no need to become Ishwara. You already have Ishwara within you. In our concept it is more like you may use Ishwara to either do good deeds or do bad deeds and they will be repayed to your sons and daughters in time. There is a concept of Hell (Narak) and Heaven (Bhagwaan's place) as well.

So as we said the concept of omniscience is there. As God is always with us, since he exists in us and everything around us. The trees, birds, air, everything. And he knows all that is happening in the world. All that is planned to happen and all that has previously happened. It is even said that there is a person designated on the gates of death who keeps record of all the activities a living thing has performed, so that his/her/its place in heaven or hell can be determined at the time of death.

I hope this answers the first part of the question. The rest I'll answer in further posts.

Sunday, September 28, 2008

Journey to the Center of the Earth

Good adventure movie. Only thing is lot of it does not make sense. For example there is a lot of content in the movie that does not self justify how or why it is there. But at the same time it is a good break from reality, and gets the viewer a good laugh. So it can be seen as an example of a form of alien attack film. Not too much sense of what or why is happening but the picture as a whole makes good entertainment.

Hindu Religion

I am just trying here to explain whats good about my religion(Hinduism). So basically all religions are the product of a lot of reading through various epics. Its what written in the epics followed that decides what the people follow. So if the Epic says there was a God, people believe that there actually was a God, who did divine things. Let us assume for the time being that there actually exists a God (I have a joke to share in this context. Once there was a war between Russia and USA where Russia claimed that God does not exist and USA believed that God does exist. Both countries sent out their best people - scholars, scientists, explorers, et cetra to find about the truth. A month later Russi called a press conference and said that God does exist. The reason they cited was that their scholars came to India. And it is only by the grace of God that this country is running they cited. So therefore God must exist. I know I'm bad at jokes).

The feature that stands out in the religion is the concept of multiple Gods for different tasks. It is like a whole community of Gods up there in the sky, performing diffenet tasks. Which makes it simmilar to the board of directors concept in any company. So over here the company reffers to the world and each director performs a different task. For example, let us consider Indra. This God is the God of rain. There is Shiva, Rama, Hanuman (God of Monkeys - follower of Rama), Bhramha (God of thought), Lakshmi (Goddess of Prosperity), there is Saraswati - Goddess of Studies/Intelligence. Now it is more logical a framework for so many Gods to be managing people rathere than a unified God managing all activities of all people. Makes more sence to me this way.

All people are not the same. Some like prosperity, some like fame, some like truth. Next feature that stands out in this religion is that people have the free will and choice to choose what God of the relion they intend to follow. For example many people follow Hanuman. They keep fasts for this God. This is done so that their future mate is good, or for other strong good wishes for their families as well. There is Tirupathi in the south and his name is mentioned in the Kannada language scriptures. In our sanskrit text we have references to Ram, Hanuman, Lakshmi, Indra, Vayu, et cetra. So its a more versatile concept. People can choose what God they like most and worship them.

We have different festivals for different Gods, making life all the more exciting, as in we see more happy faces all the time. Not everyone waits for a unified date or season to worship their God the most. For example there is Shiv ratri, Ganesh Chaturthi, Maha Lakshmi Ashthami, then there is Diwali, Holi. All of these festivals are related to different Gods and there are lots of stories about each event. The whole history is not based on one God, but one God reaching out for help to the other God for help to solve a problem. One God blessing someone for something and the other Gods helping him.

People have the free will to switch from one God to another any time. There is no concept of switching your idols or favourite Gods making trouble in your life. So it is a very clean concept as such. The fundamental truth being that God exists within us all.

There is one good thing about our Religin for which I firmly stick to it in all faces of deserting it and that is it taught man that whatever you have is a loan you have from your children and not an inheritance from your forefathers. What you do is to be good for them. Only then will you repay your eternal loan. If every person on the Earth knew this concept then there would not be so much fighting, so much enimity, so much terror. It is painful to know what has already been taught by one religion is not accepted by other religions only because their texts do not speak about any such thing. It is painful to know that we humans are causing our own death due to ignorance and that too ignoring what we will face in our future definately.

Buddhism for instance talks about not hurting or hating others. Hinduism does not talk about this at all. What it says is that you must do what will create enough for your children that they can carry your loan to themselves and repay it off to their children. So this concept was made with the understanding that children does not reffer to your imeediate family. It reffers to an entire generation of people after you. Unfortunately people do not understand it this way because this is hard. It is the right path, but it is hard. So they mess up the entire cycle by believing what they can achieve and in process make lives terrible for other people sometimes. There would be no concept of beggars in todays streets if this concept was followed by the intention it meant.

I hope that clarifies a little as to what drives me to believe my religion is good. But at the same time my God is always changing from one to the other. Some days I worship Vishnu, some days it is Shiva, then there is Saraswati and Bhramha that I worship with all devotion. And with Diwali coming up, I guess Lakshmi also deserves praise this time of the year. So worshiping which God you feel like is a choice and free will, and it makes people be educated more often than not. People love to find out what is the hidden truth at all times even if they intend to find very little. That in process educates them. Since our texts and religious history is so vast, if a person starts following even a little and gets inquisitive, then he/she is bound to learn a lot and become more educated than he could get in school. I mean it is beyond the ABCD that we learn here. So many different languages, ideas and theories.

I wish there was more time. I'd be writing further to this topic. I have made a label called religion in my notes and this post and the further upcoming ones will be classified under it.

Sunday, September 21, 2008

Break Dance.. Wow.. Plz teach me..

I love break dancing.. but the  way this guy did it.. I mean salute bow and honour.. loved his donce..



best break dance ever.........

Does full justice to the name.

Flute Inspector



Beatboxing flute inspector gadget remix rocks.. The beatboxing is so real. I love it when he starts the beverly hills cop theme. Lovely stuff. You gotta check it out.

Thursday, September 18, 2008

Living Life the Shared way

Its slog time all over again. MBA preparations are happening.

tech stuff

Hey nowdays i am working on sharepoint. i am with Sapient (website www.sapient.com). its a great technology. I would love to solve all the doubts you have on this technology. I can solve a lot of stuff now. lets see what you got to ask.. ask me at aagarwal10@sapient.com.

            The site's live. Its an intranet site, so you all cant see it, ask me for pics and i'll give them to you with pleasure.

            For all the people who need a higher download speed on their bit torrent clients, I suggest the following url.. Please read the instructions carefully and do not screw up your router in any other way. http://forums.afterdawn.com/thread_view.cfm/73686

            Also one more thing. If you are using a wi-fi network. Please please use a password protected network at home/work. That is because the government of India has passed a law that if you use a open network there is a possibility of the terrorist groups using your network to send terror threats. So please be aware that it is a crime punishable by law, to set up an open wi-fi network.

Saturday, September 13, 2008

Pixar Animated Music

Animusic - Downloads

Get to listen to all the pixar animated music. Including pipe dream. I heard this awesome music called aquamusic harp at http://www.snotr.com/video/1607. Its from the same collection. Blew my mind. Totally b-e-a-u-tiful. Loved the harp. If I'm able to make enough cash outta my job, i'll buy this someday. Fantastic. Too good.

Saturday, September 6, 2008

Youtube

http://youtube.com/watch?v=dsU3B0W3TMs This is awesome.. you must listen to this.. And if you have time.. listen to all around the world.. bob sinclair. It rocks.

http://in.youtube.com/watch?v=kUX9ffXdPYk&feature=related

Free tickets to these guys on my bus of life.. Great community service.. great song and they got soul.


http://www.youtube.com/watch?v=6JohDkmnssA

Kayne west Ft Chris Martin - Homecoming..

This song owns. Period.

Sunday, February 24, 2008

music

Listen to this track called "World Hold On"(Bob Sinclair). I love the music. And you may even want to listen to Rihanna-"Please dont stop the music". Its a good song.

By the same artist there is a song called Take A Bow.. its really good..

You may even want to listen to Shreas_groove. I found it really interesting.

One must listen song i give my heart to is: homecomming - kayne west.

One guy i'd bow down to is: The legendary soul singer and arranger/composer Isaac Hayes

visit: http://www.bendingcorners.com/2008/hayes/
or http://www.in.com/listen/podcastplayer.php?podcastid=1255 for the direct songs to stream.

Its what i call music.

Movies

Watch this movie called the last known mohicans. Its basically a story of how love survives a war.

One more movie you need to watch is Death Race if you like action.. If you liked counterstrike in college, you'll love this..

And if you like marvel comics and the hulk, you'll love the incredible hulk. He's better than ever, and he almost gets the doctor.

And one more thing.. watch this movie called.. get smart.. if you haven't.. just in case.. its hilarious.