Monday, October 13, 2008

Add Windows Explorer to your Visual Studio tools menu

So glad that there is a solution to this else it takes so many clicks to get there.

Quote:

To set it up, click Tools, then External Tools..., then click Add. Now enter the following data:
Title: Windows Explorer
Command: explorer.exe
Arguments: /select,"$(ItemPath)"

Leave Initial directoy blank, and click OK. Now when you click Tools, Windows Explorer, Windows Explorer will open with the current file you are editing selected.



Link: http://dotnettipoftheday.org/tips/explorer-in-tools-menu.aspx


Looking for the perfect gift? Give the gift of Flickr!

Friday, October 3, 2008

Site: .Net tip of the Day

Adding user to Team Web Access 2005

Problem:

Add user to team web access for TFS

 

Solution:

When you add a user from visual studio Team menu option to be able to access TFS projects, it doesn’t give permissions on team web access in sharepoint. In order to do that, there is a windows group on tfs server machine called TWSA, if you add the user in this group, user gets access to sharepoint tfs site.

Monday, September 15, 2008

Response.End and download file problem using asp.net code inside sharepoint

Issue:

To download file from Sharepoint doesn’t work but works fine in plain asp.net environment.

Solution:

Solution is very simple, Add the following code for the button or link which initiates the download:

MyButton.OnClientClick = "document.getElementById(""" & Me.Page.Form.ClientID & """).onsubmit = function() {return true;}"

Link: http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/107b2c17-07fe-4a15-ad81-dcb31e1e9c84

Friday, September 12, 2008

Impersonating in Windows (WinForm)

Impersonating in asp.net is as simple as just adding a tag in web.config but in windows I found few links which were using kernel dll to impersonate. Article I found on theserverside.net shows new features in .net 2.0 which makes it very easy to do this.

Quote:

System.Diagnostics.ProcessStartInfo pInfo =   new System.Diagnostics.ProcessStartInfo();
            SecureString ss = new SecureString();
                          ... append password characters
            pInfo.Password = ss;
            pInfo.UserName = @"domain\alice";
            pInfo.FileName = @"c:\windows\notepad.exe";
            pInfo.UseShellExecute = false;
            Process.Start(pInfo);

Link: http://www.theserverside.net/tt/articles/showarticle.tss?id=NewSecurityFeatures

Wednesday, September 10, 2008

SPTraceView - Lightweight Tool for Monitoring the SharePoint Diagnostic Logging in Real-Time

Very small application, only 65kb zip, great tool for SharePoint diagnostic tracing

Quote:

SPTraceView moniors in real time all SharePoint diagnostic tracing (also called ULS tracing) and can notify you using a balloon-style messages in the tray bar when any information of particular interest to you is sent (traced) by any of the MOSS services and components.

Link: http://hristopavlov.wordpress.com/2008/06/19/sptraceview-lightweight-tool-for-monitoring-the-sharepoint-diagnostic-logging-in-real-time/

CoreFtp - Free Excellent ftp application

Used to have problems with FileZilla uploading files, it would upload files with 0 bytes. Found this new program, works great and lite weight. A must have for ftp users

Quote:

This free, secure FTP client gives you a fast, easy, reliable way to update and maintain your website via FTP. It also provides a secure method (via SSL, TLS, or SFTP) to upload / download files to and from FTP servers. Check out the list of features and you'll find almost every feature you need, all in a free ftp program. There are no popup ads, advertising or spyware and you're never asked or reminded to register.

Site Link: http://www.coreftp.com/

Download Link: http://www.download.com/Core-FTP-LE/3000-2160_4-10195752.html

Play with spider

Saturday, September 6, 2008

OLE DB Connection string issue using Excel

Issue:
I came across two issues while trying to load a excel file in asp.net. I'll explain both of them separately.

1). Exception: The Microsoft Jet database engine could not find the object
This exception happens when the path is not fully qualified to the excel file used in the oledb connection string. Without path, its not going to through an exception while creating connection.

Before: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='MyFile.xls'; Extended Properties=""Excel 8.0;HDR=NO;"""

After: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='" &
Server.MapPath("MyFile.xls") & "'; Extended Properties=""Excel 8.0;HDR=NO;"""

Solution: use Server.MaptPath to get fully qualified path to a file to avoid this exception.

2). Exception: Could not find installable ISAM.
When using extended properties be careful with the syntax

Before: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='MyFile.xls'; Extended Properties=Excel 8.0;HDR=NO;"

After: Dim dsn As String = "provider=Microsoft.Jet.OLEDB.4.0;data source='" & Server.MapPath("MyFile.xls") & "'; Extended Properties=
""Excel 8.0;HDR=NO;"""

Solution: use quotes around the value of extended properties. If the syntax is wrong, it tries to look for another driver.

Tuesday, September 2, 2008

Virtual Clone Drive - Great tool for ISO mapping as a drive

Quote:

Virtual CloneDrive works and behaves just like a physical CD/DVD drive, however it exists only virtually. Image files generated with CloneDVD or CloneCD can be mounted onto a virtual drive from your hard-disk or from a network drive and used in the same manner as inserting them into a normal CD/DVD drive.

Probably the best virtual drive software, Virtual CloneDrive allows you to enjoy the freedom of a virtual drive and is completely free.

Link: http://www.slysoft.com/en/virtual-clonedrive.html

Google browser is here, today!

Long awaited, there had been rumors for about 2 years that google is coming up with their browser. Initially I thought it'll be some sort of firefox extension or built on top of it but apparently its not.

It'll be interesting to see what Microsoft reaction will be on this. Seriously, I'm tired and sick of IE, it sucks real bad as compared to firefox. It is still trying to barely catch up with firefox and here comes the new rival! I'll update this post to add the link to the site since its not there yet. Hoping to see it in next few hours.

News Link: http://news.yahoo.com/s/ap/google_browser;_ylt=AvYgJ5cZ5H.Sui7LU4Cx7TUDW7oF

Official Site: http://www.google.com/chrome

Thursday, August 28, 2008

Store user information on J2ME platform

Problem:

J2ME doesn’t support property files

Solution:

In J2SE properties file can be used to store information but that’s not available on J2ME platform, instead it provides a record store. A sample is available at Sun website.

Sample Link: http://developers.sun.com/mobility/midp/samples/#persist

Problem:

Export excel file from SQL Server 2005. In order to do SQL gave the attached error.

Solution:

Quote: (MSDN)

“By default, SQL Server does not allow ad hoc distributed queries using OPENROWSET and OPENDATASOURCE. When this option is set to 1, SQL Server allows ad hoc access. When this option is not set or is set to 0, SQL Server does not allow ad hoc access.”

MSDN Link: http://msdn.microsoft.com/en-us/library/ms187569.aspx

In order to turn this option on follow the link below

http://www.kodyaz.com/articles/enable-Ad-Hoc-Distributed-Queries.aspx

Tuesday, August 26, 2008

HTTP Post multipart file upload with J2ME

Task:

Upload images from a blackberry device to a website

Solution:

There are a lot of tutorials available to upload form data to a website but we spent sometime looking to post a file to a web server using Multi part. Found the article at Nokia which does the job exactly what we need to do. It’s a very to the point code sample with also a usage sample. Also attaching the code as a zip file incase the link is broken and because the site didn’t have a code download option. All credit goes to Nokia.

Link: http://wiki.forum.nokia.com/index.php/HTTP_Post_multipart_file_upload_with_J2ME

Friday, August 22, 2008

Wednesday, August 20, 2008

ShowDialog Memory leak in WinForm

Recently we had to use a common form to display all the reports for a windows application. For some reason all the reports would work only once. We were using a ReportForm.ShowDialog() to show the report form. Apparently ShowDialog doesn’t dispose the form when its closed as a normal form does when its shown using Form.Visible = True. After a lot of search I came across the article which mentioned that there is a memory leak issue if you don’t dispose the form properly after ShowDialog.

Best Practice according to the article is open the form using the following code and it works, solved our issue.

Quote:

using( SomeDialog sd = new SomeDialog() )
{
sd.ShowDialog();
}

Link:

http://kevin-berridge.blogspot.com/2007_08_01_archive.html

SharePoint Object Browser

Code project article for Sharepoint object browser. It comes very handy when doing programming with sharepoint.

Link:

http://www.codeproject.com/KB/sharepoint/sharepoint_object_browser.aspx

Tuesday, August 12, 2008

Javascript Search Tabs

Nice and short tutorial about using javascript search tabs like google/ yahoo. It has few issues in IE but people have fixed it (check comments).

Link:

http://woork.blogspot.com/2008/01/tabbed-search-bar-using-css-and.html

Wednesday, August 6, 2008

Nice free css template site

Contains templates, menus, tutorials

Link: http://www.free-css.com/

Tuesday, August 5, 2008

Import/Export Sharepoint site

Recently we had to transfer a site from one sharepoint site to a different domain. Sharepoint does give you ability to export site/list templates but it has a limit of 10MB. There are ways to increase the limit through stsadm.exe (max 500MB) but if the file gets too big for export then it doesn't work.

Found this very good and short post which does it without any problems. It uses stsadm to import/export.

Quote:

* stsadm.exe -o export -url http://intranet/test -includeusersecurity -nofilecompression -filename C:\backup

Once you finish your export use the stsadm import command with the same nofilecompression attribute. For example:

* stsadm.exe -o import -url http://intranet/test -includeusersecurity -nofilecompression -filename C:\backup


Link:

http://ragavj.blogspot.com/2008/02/failure-decompressing-data-from-cabinet.html

ReportViewer changes application path once report exported (WinForm)

Apparently a bug, when a report is exported on a winform using the ReportViewer control, it changes the path for the application. If application tries to access any local files then it will look in the directory where the report was exported.

Solution is to save the path before the reportviewer is displayed and change it back to application path when the form is closed. The following two events worked in my case.

Dim _AppDirectory As String

Private Sub ReportViewerForm_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed

Environment.CurrentDirectory() = Me._AppDirectory


End Sub


Private Sub ReportViewerForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Me._AppDirectory = Environment.CurrentDirectory()


End Sub



Link:
http://forums.msdn.microsoft.com/en-US/vsreportcontrols/thread/d5d5e224-f906-4c3f-88e0-258ee2b2e149/

Reusing ReportViewer WinForm

Spent sometime figuring out that you can't use multiple Reporting services report unless you call the reset method of ReportViewer.

Link:
http://forums.msdn.microsoft.com/en-US/vsreportcontrols/thread/b039e765-3cc8-43ec-ae67-14b9656bc981/

Quote:

The key is to use the Reset method of ReportViewer.

ReportViewer1.Reset();

I put it above the LocalReport datasource clear/add and it worked!