After postponing the release date due to performance issues new release date of Visual Studio 2010 has been announced yesterday.
So we will be able to enjoy new toys at April 12. For those of you who likes to try new tools before full release – you can download a Visual Studio 2010 Beta2 and start exploring the new Microsoft's offering for developers.
Enjoy,
Yevgeni
Recently I needed to measure an exact size in memory for a string – asked a developer sitting next to me how would he do it. An answer was: “Take a string’s length multiply by 2(it’s a UTF-8 encoding) – you will get an exact size”.
Well this answer was wrong…
And the explanation is in a definition of UTF-8 encoding.
Here is a quote from Wikipedia:
UTF-8 (8-bit UCS/Unicode Transformation Format) is a variable-length character encoding for Unicode. It is able to represent any character in the Unicode standard, yet is backwards compatible with ASCII.
The simplest way to measure it, I’ve found so far, is to use an Encoding class from .NET Framework.
Example:
[STAThread]
public static void Main()
{
string str = "בדיקהה test";
int size = Encoding.UTF8.GetByteCount(str);
Console.WriteLine("Length * 2: " + str.Length * 2 + " Bytes");
Console.WriteLine("Real size: " + size.ToString() + " Bytes");
Console.ReadKey();
}
Output:
Enjoy,
Yevgeni
Wow, it’s so nice from time to time to read a simple post that refreshes our overloaded memory :)
Following link reminds us 5 simple attributes, that can be very useful in a development:
http://hatim.indexdev.net/2009/12/17/5-very-useful-c-attributes/
One of simplest ways to reduce network load is to minify java script files downloaded to a clients. By minifying I mean removing all “Enters”, “Tabs”, “Spaces”, Comments etc. all those that help us to turn our scripts into a readable story.
Since I’m a typical lazy software developer – I hate doing those manually, especially if it should be done each release… Another spoiler is that minifying java script converts it into barely readable bunch of string – not so pleasant to debug…
So I’ve found that grate article by Dave Ward that describes a way to integrate automatic java script file minifying into development lifecycle “Automatically minify and combine JavaScript in Visual Studio”.
Do it once … and do it right…
For those of you who enjoy playing with brand new Visual Studio 2010 Beta 2 – Training Kit was released, so have fun… Visual Studio 2010 and .NET Framework 4 Training Kit.
Since after Windows Azure goes to release at PDC 2009 this November – all the services are going to be a paid services – following is a great news for cloud developers.
In Visual Studio 2010 Ultimate Edition, among zillions of features, there is a complete toolbox for Windows Azure developers and this edition will include 250 hours/month of Azure cloud computing(Compute hours, Storage, SQL Azure, .NET Services).
Related Links:
ScottGu’s post:
http://weblogs.asp.net/scottgu/archive/2009/10/19/vs-2010-and-net-4-0-beta-2.aspx
AzureJournal.com post:
http://www.azurejournal.com/2009/10/visual-studio-2010-is-cloud-friendly/
Today was published release date of Visual Studio 2010 Beta2 and final release dates.
Currently it’s October 21 for Beta 2 and March 22, 2010 for Final Release.
http://www.theregister.co.uk/2009/10/19/visual_studio_2010_second_beta_packaging/
Strange problem was found while upgrading Data Dude GDR r1 to r2.
While the setup ends successfully and log does not indicates about any kind of error or failure happened. Any try to create new database project or to open existing fails with following error:
After hours of googling I’ve found only solution that is available on net by Gert Drappers:
1. Make sure that Visual Studio (devenv.exe) is closed
2. Start command prompt
3. Run following two commands:
a. “%Program Files%\Microsoft Visual Studio 9.0\DBPro\DBProRepair.exe” RemoveDBPro2008
b. “%Program Files%\Microsoft Visual Studio 9.0\Common7 \IDE\devenv.exe” /ResetUserData
4. Start Visual Studio 2008 IDE
Hope this solution helps…
Regards,
Yevgeni
AjaxLine website has published nice collection of libraries for generating PDF files. There are two libraries for .NET developers and … they are free of charge.
10 best libraries for generating PDF files.
Enjoy,
Yevgeni
There are allots of improvements that can be done within application’s configuration file the only catch with it – you have to know that it’s exists. In this post I will show how to improve garbage collection performance according to application’s type.
There are 3 modes of garbage collection that can be defined in a configuration file:
- Workstation mode with enabled Concurrent flag
- Workstation mode with disabled Concurrent flag
- Server mode
Workstation mode with enabled Concurrent flag
This mode is designed to get a better responsiveness of an application’s UI and the price for the responsiveness is more CPU and memory usage.
By default this mode is enabled in Windows Forms applications, Console Applications and Windows Services .
Workstation mode with disabled Concurrent flag
This mode is optimized for height throughput applications running on single CPU computers although it is stops current thread when GC is active. Therefore it is not a best choice for an applications with UI present.
To configure this mode following must be inserted at configuration file:
<configuration>
<runtime>
<gcConcurrent enabled="false"/>
</runtime>
</configuration>
Server mode
In the Server GC mode, GC heap and GC thread are created for each CPU available, making application’s throughput and scalability higher. This mode is available only on multiprocessors systems and it is default at ASP.NET applications.
To configure this mode following must be inserted at configuration file:
<configuration>
<runtime>
<gcServer enabled="true"/>
</runtime>
</configuration>
Summary
In the age of parallel processing when most computers are already have at least two CPUs might be a good idea to test application’s performance with GC mode set to Server mode. Good example for such applications is WCF services host, which in many cases is Console application or Windows Service. In a upcoming Parallel Extensions Library the Server GC mode is a recommended mode by Microsoft for a better performance.
For a dipper exploration of GC principles and modes please refer to a Maoni’s posts.
Today’s Codeproject’s newsletter was full of pretty exciting news that I have to share with you, so it goes like this:
1. IE 8.0 will be released today – this published by Coputerworld news site.
2. Microsoft released SuperPreview - great tool for validation website’s look in known browsers(now available for IE 6.0, 7.0, 8.0 in full release will be able to validate for another browsers) – published at ZDnet
3. A great post by Tim Heuer with a list of new features of Silverlight 3.0 Beta that was announced at MIX09.
Enjoy,
Yevgeni
Lots of developers are not familiar with the fact that string variables are stored in memory as a plain text and can be stolen with simple memory dump. Therefore they are revealed to anyone who has an access to a server. So all the credit card numbers, passwords, database connection strings etc. are literally exposed when no measures are taken…
A simple solution has been always there ... Starting from .NET 2.0 framework there is a SecureString class in System.Security namespace. It’s functionality is similar to a string data type with several changes.
Here are several advantages of this class:
- It’s not stored in heap memory
- Can be made immutable edit stage was finished by calling MakeReadOnly() method
- Stored encrypted with DPAPI
- Can be cleared without leaving a copy (implements IDisposable)
- Can be passed around without leaving a copies in memory (is not stores in managed heap)
SecureString does not contain any methods or properties to inspect it’s content. Therefore to get a stored value System.Runtime.Marshal.SecureStringToBSTR method must be used:
private static SecureString _SomeSecretData;
public static string SomeSecretData
{
set
{
char[] tmpData = value.ToCharArray();
_SomeSecretData = new SecureString();
foreach (char val in tmpData)
{
_SomeSecretData.AppendChar(val);
}
//make string immutable
_SomeSecretData.MakeReadOnly();
}
get
{
IntPtr ptr = System.Runtime.InteropServices.
Marshal.SecureStringToBSTR(_SomeSecretData);
string decryptedString = System.Runtime.InteropServices.
Marshal.PtrToStringUni(ptr);
return decryptedString;
}
}
Summary
SecureString class provides easy to use tool for preventing … or at least making harder, to get sensitive data that is stored in-memory without any additional development overate.
Today I was amazed getting an email from Guy Burstein saying that I got an award “Blogger of the month” in Microsoft’s monthly magazine MSDN Pulse.
What can I say, it’s a great feeling to get such appreciation from the community. It’s one of those things that causes you to sit down and write more and more…
For those of you that still don’t get an MSDN Pulse by email. You can find a subscription data at the bottom of a magazine’s page or contact Guy Burstein directly and get tons of hottest information for developers.
Recently at VSLive! San Francisco 2009 new Visual Studio 2010 key features were presented by Jason Zander, brief description of it is published this article .
In Jason’s blog several screenshots of our new toy can be found.
In one of my previous post about IIS 7.0 data compression I’ve described how to enable this functionality, without drilldown to recommended configuration values .
In this great post Scott Forsyth known specialist in IIS performance area made a great job on testing IIS 7.0 server performance under various configurations and with different files sizes.
It helped me a lot , so I recommend to add this post to your favorites:
IIS 7 Compression. Good? Bad? How much?
Enjoy.
More Posts
Next page »