Friday, August 3, 2007

How to get a free SVN repository?

Why we need SVN or any kind of source control, off course we  want to keep our source safe and want to maintain our source so that no one can see our private code. One easy step is to private SVN repository in your local network. In this particular scenario we have to install server all by yourself, all backup and labeling needs to be done all by our self as well.
www.assembla.com
It would be nicer if we have hosted SVN repository where we can keep our source as private, all backup and system recovery solutions will be provided by the hosting company. Luckily there are some services in the internet for that, for instance http://www.assembla.com/ is a wonderful site which allows commercial trails and if you have a open source project you can get a free SVN repository. You can also get limited space of around 250mb of free personal private SVN repository.
www.sourceforge.net
Yet another solution is to use Source forge or other free open source code hosting sites, note that we need to confirm what kind of open source SVN they support.
Unfortunate thing is that I kind find a good Microsoft based, source control on internet for free, that would be a nice addition to the open source work force.
Update 1:
Now we can host code in google code and also have svn support, but code needs to be open source.
Update 2:
Now we can also host code in codeplex which is sponsored by Microsoft. In this case code needs to be open source.
Update 3:
CodePlex now support team foundation server and teamexplorer of VS2008
Update 4:
https://bitbucket.org/ is now offering unlimited private project hosting... awesome

Thursday, July 5, 2007

How to Add Web Application Project in Visual Studio 2005.

The new version of visual studio does not content the web application project template, which was available in visual studio 2003. The way you can create web project is to create a new web site. I have no idea why its like that but the web application project was cooler than web site template.

Anyway may be Microsoft wanted to try new things. But there is always a work around for the problems, you can download the web application project template from  here. Installing this project template would give you web application project template for both c# and vb.net.

Update 1:

We found a very cool web site about Visual studio web application project template and lots of help with it. Thanks to Scott Gu. He have provided a awesome site with lots of tutorials.

image

Please visit Visual Studio 2005 Web Application Project for more information.

Update 2:

Never mind the old stuff web project is now available with the latest service pack. Life would be lot easier if they had provided it earlier.

Cheers.

Thursday, June 21, 2007

Asp.net File Upload Control Using with just one step

In our projects sometimes we need to use the file upload control. Asp.net 2.0 have
a build-in File-upload. In asp.net 1.x web controls didn’t had any builtin file-upload
control. Then we had to use a html input tag with type attribute set to “file” and
to use in server side add runat=”server” attribute.

<input id="myfileuploader" type="file" runat="server"/>

We all know how to work with a file upload control, today we will be discussion
about a new approach of file-upload. file-upload consists of two step . first we
have to select the file and then submit the page with a button or some kind of other
mechanism. To day we will try to minimize one step. If we want to upload the file
with just one step that is selecting the file here is the Technique

A file upload control which is eventually truned into a input html element have
three client side events

    * onBlur      
    * onChange
    * onFocus

we will utilize the onChange event… here is what we will do. frist add a asp.net
2.0 fileupload control in our page. then in pageload event add a attribute in attribute
collection. then write a javascript funtion to submit the form and in code do what
ever we whan….

 
task 1 : add a fileupload control

task 2: add the onchange attribute as FileUpload1.Attributes.Add("onchange", "doSomeStuff()");

task 3: add the javascript to submit the page

<script language="javascript"
type="text/javascript">

function doSomeStuff()
{

         document.forms[0].submit();

}

</script>

Thats it you are good to go.. in page load event check wheither the filename is
empty or not and then do the file upload.

Wednesday, May 2, 2007

Select Items of a html Select

As you all know in asp .net when we define a dropdown list it is converted to a html select.

<asp:DropDownList id="ddlNewsLetter" runat="server"></asp:DropDownList>

Now in html…

Its look like this

<select name="GcbsUC:ddlNewsLetter" id="GcbsUC_ddlNewsLetter">
<option value="1">July 11, 2006</option>
<option value="2">June 14, 2006</option>
<option value="3">May 14, 2006</option>
<option value="4">April 9, 2006</option>
<option value="5">March 16, 2006</option>
<option value="6">February 19, 2006</option>
</select>

In C# code i have populated the dropdown list with a counter and a data…

Well if we what to select a perticular dropdown item from the list… how we do it…

Option

1 . document.getElementById(‘ControlName’).selectedIndex = ‘ourvalue’; [here ourvalue must be an integer and between a range of the options.length.

2. document.getElementById(‘ControlName’).value = “ourknownvalue”;

[here ourknownvalue can be 6 that is <option value="6">February 19, 2006</option>]

3. well can can always loop through the items and do what ever we like with the property

    document.test.test2.options[0].value
    document.test.test2.options[2].text

Here is an example


var ddlNewsLetter = document.getElementById('ddlNewsLetter');
if(ddlNewsLetter!=null)
{
for(var i=0; i < ddlnewsletter.options.length; i++)
{
if(ddlnewsletter.options[i].text == strnewsletterdate)
{
ddlnewsletter.options[i].selected = true;
break;
}
}
}

Wednesday, April 11, 2007

VS 2005 Windows Work Flow ToolBox Section...

Hi Recently i had to work with Windows workflow foundation for some conceptual demo or proof of concept demo. During development time i faced a strange problem. some of the windows workflow tools are not showing in tool box.

 

BeforeReset

 

I try to reinstall the workflow extention for Vs2005 but the problem remain. if you see care fully i can not drag and drop a code activity from the tool box. That was a little but disturbing … then i reset the tool box. and every thing got back on line again. i just right click on the tool box a popup menu come up which has a reset menu item.

 

afterReset...

 

Some time in some other extention of vs this thing can happen. Dont forget to reset your tool window.

Saturday, March 3, 2007

Install assembly into Global Assembly Cache

Option One

Step One add the sn.exe to External Section of VS2005

1. Click on Menu->Tools->External Tools
2. A window with all external tool listed will popup.. click on add button
3. In title type “String Name tool”
4. In command brows for sn.exe tool [Generally in the bin directory of your sdk folder]
5. Check the use output window and prompt for argument check box…
6. Click on apply to dismiss the widow…

Now you can see that in tools menu you will have a menu item named “Strong Name Tool”. Click on the menu will launch a window asking the argument …. In the argument text box type

–k “c:\\mykeypair.snk”Click on okey to dismiss the window… in output window you will see that successful keypart creation message will be shown…

Your key is reated but not yet associated with any

Adding the key to the project to associate with assembly1. Open your project…
2. Open the property of the project…
3. You will see a tab called signning is bottom of the window… click on the signning button
4. In siginning tab check the sign the assembly check box.
5. In choose a strong name key file … click on brows …. And brows for your mykeypair.snk file…
6. save the project and build it…

That’s it your assembly is strong name signed on….

Option Two [Too Easy]

1. Open your project…
2. Open the property of the project…
3. You will see a tab called signning is bottom of the window… click on the signning button
4. In siginning tab check the sign the assembly check box.
5. In choose a strong name key file … click on new…
6. A window asking for snk file will popup… type the desiered name and click on okey to dismiss the window… save the project and build it…

That’s it your assembly is strong name signed on….

Deploy the assembly in GAC…

1. Add the gacutil.exe tool just like the sn.exe tool
2. Now open the gacutil tool from tools….
3. In the argument window type….
4. -i "$(ProjectDir)\bin\debug\DataBaseHelper.dll" or [-I “yourprojectdir\buildmode[debug or release]\bin\filename.dll”]
5. Click on okay to dismis the window..
6. In output window you will see a successful message….
7. “Assembly successfully added to the cache”

Happy programming!