Its pretty easy to do in VS 2010
->Open solution explorer for a solution
->Right click the project you wish to run in partial trust mode
->select properties
->select the security tab
->check "Enable ClickOnce security"
-> select "This is a partial trust application"
and your application will run in partial trust mode from now on...
Vaibhav
Friday, February 12, 2010
Executing C# WinForms application in Partial trust mode
Posted by
vaibhav
at
5:55 AM
0
comments
Tuesday, February 9, 2010
String matching with pattern having wildcard characters in C#
The solution makes use of Regex class in .NET and supports both '*' and '?' wild cards.
private bool IsWildcardMatch(String wildcard, String text, bool casesensitive)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder(wildcard.Length + 10);
sb.Append("^");
for (int i = 0; i < wildcard.Length; i++)
{
char c = wildcard[i];
switch(c)
{
case '*':
sb.Append(".*");
break;
case '?':
sb.Append(".");
break;
default:
sb.Append(System.Text.RegularExpressions.Regex.Escape(wildcard[i].ToString()));
break;
}
}
sb.Append("$");
System.Text.RegularExpressions.Regex regex;
if (casesensitive)
regex = new System.Text.RegularExpressions.Regex(sb.ToString(), System.Text.RegularExpressions.RegexOptions.None);
else
regex = new System.Text.RegularExpressions.Regex(sb.ToString(), System.Text.RegularExpressions.RegexOptions.IgnoreCase);
return regex.IsMatch(text);
}
I picked up the above sample from http://adamsen.wordpress.com/2008/10/16/c-string-wildcard-match/ but it only supported '*" and not '?'.
I added a case block to support ? as well.
vaibhav
Posted by
vaibhav
at
9:00 AM
0
comments
Thursday, June 11, 2009
Restoring a .bak file to a SQL Server database
source: http://blog.sharepointdevelopment.nl/post/Restoring-a-bak-file-to-a-SQL-Server-database.aspx
Author:Nick Boumans
Sometimes you have to restore a .bak file to a SQL Server database where the .bak file was not originally back-upped from. You can do this either by a script or using SQL Server Management studio. By using Management Studio, you have to follow the next steps:
- Open SQL Server Management Studio (either Enterprise or Express)
- Right Click Databases -> Restore Database…
- Select your To Database e.g. OrdersNew
- Select from device and select your .bak file
- Move to the item options (you're standard in General)
- Check or the database paths are correct, otherwise correct them
- Go back to the general tab
- Check your database and hit the OK button
Vaibhav
Posted by
vaibhav
at
3:41 PM
0
comments
Wednesday, May 6, 2009
Citrix Receiver for iPhone and Doc Finder
Citrix is a nice company and they work really well towards innovative stuff.
Finally Doc Finder is out. We worked pretty hard for around 6 months for the release of version 1.0 of this project. Both my site director and my test lead were superb in their approach towards the development of this project and I must say without both of them this thing wouldn't have been possible. VPRD team was very nice and innovative as well. They came up with amazing designs for the UI and they also knew what a user expects for the best experience. I really loved working on this project and I must say all the people involved in this project came up with some awesome ideas.
I found this demo video on you tube, it's a must watch at least for all citrites and iPhone/ XenApp users.. This is video for 0.9 version of Doc Finder project and v1.0 has some more cool features like search, recent documents, stylish help screen and an animated settings page:o)
My favorite part of this video are the last 2 minutes of the demo coz that's the part in which we get to see Doc Finder.
It was fun working on it as a developer :o)
All the best Citrix...
Cherio!!!
vaibhav
Posted by
vaibhav
at
10:58 PM
0
comments
Thursday, April 16, 2009
Could not find any resources appropriate for the specified culture or the neutral culture.
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "XXXYYY.en-US.resources" was correctly embedded or linked into assembly "AAABBB" at compile time, or that all the satellite assemblies required are loadable and fully signed.
I wasted a lot of time to find out the reason behind this error. This was coming up when I was trying to use culture specific satellite DLL.
After search the complete web I found the following answer:
It is not because the resource manager didn't find the satellite assembly but because the embedded .resources file in the satellite assembly doesn't have a full
name. In this case, the full name is "MyLib.Resources.es-MX.resources", but
the .resources file's name is "Resources.es-MX.resources".
When you use the resgen tool to convert .resx file to common language runtime binary .resources file, you should add the namespace name of your project in the front of the converted .resources file. The following is a sample.
resgen Resources.es-MX.resx MyLib.Resources.es-MX.resources
Thus, the .resources file has a full name. Then you use AL.exe tool to bundle the .resource file into a satellite assembly and place this satellite assembly to the es-MX subdirectory of the application's bin/debug folder.
Run the application again and you should see the correct result.
Thanks to Linda Liu [MSFT] for the answer...
source : http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic55934.aspx
vaibhav Chugh
Posted by
vaibhav
at
3:58 PM
0
comments
Wednesday, April 8, 2009
Remove flicker in listbox C#
I read over 100 articles on the web just one was able to help me and that too was ignored by others in the discussion.
Well, if you are adding less number of items to a listbox then
listbox1.beginupdate()
listbox1.add(item);
listbox1.endupdate();
should work for you just fine. There shall be no flicker.
using doublebuffered user control / form may also solve the problem. In some cases
this.SetStyle(ControlStyles.UserPaint ControlStyles.OptimizedDoubleBuffer
ControlStyles.AllPaintingInWmPaint ControlStyles.SupportsTransparentBackColor,
true);
may also work.
but in my case the data was coming at a very high speed and high quantity and I had to display this large amount of data in an owner drawn list box.this.SuspendLayout();
foreach (DataItem ditem in ditems)
{
listbox1.Items.Add(ditem);
}
this.ResumeLayout();
the above code helped me in getting a pretty smooth layout.
hope it helps
Vaibhav Chugh
Posted by
vaibhav
at
11:21 AM
0
comments
Thursday, March 5, 2009
CopyRight symbol in C#
This was funny to find....
2 good ways to do it
string copyright="\u00A9";
string completetext=copyright + "myCredits";
Much better way =>
press Alt and then 0 1 6 9..this will convert into the copyright symbol
n u r good to go :)
vaibhav
Posted by
vaibhav
at
1:55 PM
0
comments