Thursday, May 20, 2010

Unable to load DLL ‘FileTracker.dll’


Last two days i am getting the error Unable to load DLL ‘FileTracker.dll’ when i create windows application ,getting this error not for other projects.

I am using visual studio 2010 B2 in a Windows 7 machine.

How i resolved the issue 

I installed in visual studio 2010 B2 in C:\Windows\Microsoft.NET\Framework

There where two folders v4.0.21006 and v4.0.3004. I deleted the v4.0.3004(which is not required). If you want to come out from this problem delete the higher version of v4.0.21006 folder,Which is not required.

Now it is working fine.

Wednesday, May 19, 2010

operation could not be completed – Visual studio 2010

Today i was working on visual studio i got one error: operation could not be completed

how i resolved

open the run(windows + r) type

C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe  /resetuserdata

Press enter –> now its working fine :)

How to clear the temp folder in windows start up using C#


Today i decided to create an application using C# which clears the temp folder when ever windows startup.So no need to clear your temp file always.

Here is the code what i have tried:

RegistryKey regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
regKey.SetValue(Application.ProductName, Application.ExecutablePath);

string path = Path.GetTempPath();
if (!string.IsNullOrWhiteSpace (path))
DirectoryInfo d = new DirectoryInfo(path);
Array.ForEach(Directory.GetFiles(path), s =>
{ try { label1.Text = s; File.Delete(s); } catch (Exception ex) { } });
label1.Text = "Done";

If any exception will come it wont show that exception,it will proceed from the next

If put the application in "Software\Microsoft\Windows\CurrentVersion\Run" when ever the windows starts it automatically runs.

Tuesday, May 18, 2010

Twitter API in C#


Today i have seen a thread in my favorite site Stackoverflow on Twitter. So i decided to create a small Twitter API WCF application.

Twitter is designed on REST architecture. Here is a sample code to integrate the Twitter in C#.

Download the TweetSharp

To Authenticate user in the Twitter:

ITwitterLeafNode twitter =FluentTwitter.CreateRequest()
.AuthenticateAs(StaticProperties.Username, StaticProperties.Password)

if (twitter.Request().ResponseHttpStatusDescription == "OK")

To Update new Tweet:

ITwitterLeafNode twitter =FluentTwitter.CreateRequest()
.Statuses().Update("Hello World).AsJson();
var request = twitter.Request();

Note: By using this API you will get all the Twitter related things,Like all Followers,To ReTweet etc.

Tuesday, May 11, 2010

Zip Extension

Today i was going through some of the blogs.I have seen the Zip extension method in .Net 4.0 .
I like this very much here is the one sample example of Zip extension.

int[] numberArray = { 0, 1, 2, 3, 4 };
string[] nameArray = { "zero", "one" };

var combinedArray = numberArray.Zip(nameArray, (number, name) => number.ToString() + "(" + name + ")").ToArray();

Array.ForEach(combinedArray, s => Console.WriteLine(s));