Welcome to MSDN Blogs Sign in | Join | Help

May 2006 - Posts

SYSK 137: A Quick Way to Get to System Information Dialog

As you know, Windows System Information dialog shows you the hardware resources, installed components, and other configuration related information. It also gives you a chance to run some diagnostics tools and much more… The help file says that to display
Posted by irenak | 0 Comments

SYSK 136: INSERT SHRED(DelimitedString) INTO TABLE MyTable

In SYSK 131, Bill Wendel shows us how to convert a SQL string representing a boolean (e.g. ‘T’, ‘Y’, ‘1’, ‘N’, etc.) to a bit. In this post (again, special thanks to Bill for creating and allowing me to post this function), you have a user defined function,
Posted by irenak | 0 Comments
Filed under:

SYSK 135: Hot Key for Windows XP System Properties Dialog

Many of us open Windows Explorer, right mouse button click on My Computer and click on Properties menu item just to get to System Properties dialog… There is a much easier way – just press Windows Key + Pause/Break key at the same time – and you’ll get
Posted by irenak | 1 Comments

SYSK 134: Intellisense for SQL Server

Do you want Intellisense in SQL Server Management Studio, Query Analyzer and SQL queries in VS similar to Visual Studio? Then check out this great product from Red Gate Software at http://www.sqlprompt.com/ !
Posted by irenak | 1 Comments
Filed under:

SYSK 133: Oh, the Mighty OUTPUT Clause!

SQL 2005 now has the new OUTPUT clause – see documentation at http://msdn2.microsoft.com/en-us/library/ms177564.aspx. A lot of examples show how you can use the OUTPUT clause to store inserted/updated/deleted values into another table or a table variable.
Posted by irenak | 1 Comments
Filed under:

SYSK 132: Loop Performance Comparison -- foreach vs. for

Do you think there is a performance difference between the following two loops? foreach (int x in _data) { . . . } vs. for (int i = 0; i < _data.Count; i++) { . . . } My tests show that foreach is slower than the for loop. The larger the collection
Posted by irenak | 14 Comments

SYSK 131: SQL: String to Bit Conversion

Say you want to convert any of the following ‘1’, ‘-1’, ‘true’, ‘t’, ‘True’, ‘t’, ‘Yes’ to bit 1 and ‘0’, ‘f’, ‘false’, NULL to bit 0. How would you do that in one SQL statement? One way (special thanks to Bill Wendel who presented this solution) is this:
Posted by irenak | 0 Comments
Filed under:

SYSK 130: The Sexy Side of Internationalization in ASP.NET

Yes, let’s admit, internationalization (just as security) has not been the favorite of most developers… However, if you take a look at the ASP.NET 2.0 localization support, you just might be pleasantly surprised with how easy and how cool it is! Here
Posted by irenak | 1 Comments

SYSK 129: A Tool Every ASP.NET Developer Should Know

Want to inspect all HTTP Traffic (both, incoming and outgoing data) from your computer? You can see session being created, cookies being sent, data being cached, and much more… You can diagnose performance problems… You can record a web session (just
Posted by irenak | 1 Comments

SYSK 128: Unexpected Behavior in NumericUpDown Control

Did you know that while setting ReadOnly property to True on a NumericUpDown control prohibits the user from typing in a value in the text portion of the control, does not prevent a user from changing the value using the up/down arrow keys? You need to
Posted by irenak | 1 Comments

SYSK 127: ResetBindings To the Rescue!

.NET 2.0 came with a lot of cool (new and improved) controls, one of them is the System.Windows.Forms.BindingNavigator and the BindingSource class. The only problem I found so far with this control is that if in the Load event you bind it to a BindingSource
Posted by irenak | 2 Comments
Attachment(s): BindingExample.zip

SYSK 126: Protect Yourself – Use ‘deployment retail’ Setting

As you know, compiling your web application with <compilation debug=”true”/> in web.config creates debug binaries rather than retail binaries -- see SYSK 101: How to Release Build an ASP.NET application ( http://blogs.msdn.com/irenak/archive/2006/04/10/572415.aspx
Posted by irenak | 0 Comments

SYSK 125: Custom Controls in ToolBox

Have you ever wondered how is it that your custom controls automatically show up in the toolbox after first compilation? Open menu option Tools -> Options and then click on Windows Forms Designer tree node on the left side. The very last setting on
Posted by irenak | 0 Comments

SYSK 124: IDENT_CURRENT Without an Identity Column

SQL Server’s function IDENT_CURRENT(‘tablename’) returns the last identity value set on a specified table. While this is very useful, sometimes you need to get the next available primary key on a column that is not an identity field. In this case, SELECT
Posted by irenak | 3 Comments
Filed under:

SYSK 123: Expand Your Horizon – Learn About How BitTorrent Works

BitTorrent is a populare peer-to-peer download method, which enables fast downloading of large files using minimum Internet bandwidth. Instead of downloading a file in its entirety, BitTorrent gathers pieces of the file you want and transfers them simultaneously
Posted by irenak | 0 Comments

SYSK 122: Clone a WinForms Control with all its Properties

As you know, WinForms controls (e.g. TextBox, ComboBox, etc.) are not serializable. So, how do you create a copy of a control? The other day I needed to do just that, and here is the code I ended up with ( note : it has not yet been thoroughly tested,
Posted by irenak | 0 Comments

SYSK 121: When it’s Not Only Acceptable, but Recommended to Check into Source Control Your .user File

Developer’s personal settings and preferences are stored in a .user file. This is why it’s not recommended to add .user files to VSS or other Source Control tool – keep personal to yourself. However, when using ClickOnce deployment, the published version
Posted by irenak | 6 Comments

SYSK 120: When == is not same as Equals

What do you think will be the output in the code snippet below? object o1 = 5; object o2 = 5; System.Diagnostics.Debug.WriteLine(o1 == o2); System.Diagnostics.Debug.WriteLine(o1.Equals(o2)); System.Diagnostics.Debug.WriteLine(((Int32) o1).CompareTo(o2));
Posted by irenak | 3 Comments

SYSK 119: Granular Role Based Security via an Attribute

Most applications implement role based security to assure that only authorized users have access to restricted application functionality (features). You know the drill—"only certain users can modify salary information in an HR application," or "only managers
Posted by irenak | 0 Comments

SYSK 118: ReadOnly or ContentEditable?

Consider this: you want a text box on a web page to be not editable by the user, but you want to be able to change the text box’s contents in client side script and see the updated text on the server. Did you know that if you set TextBox1.ReadOnly = true,
Posted by irenak | 11 Comments

SYSK 117: Are You Using Eval or Bind for your ASPX Data Binding?

Many ASP.NET 1.0 and 1.1 developers have been using DataBinder.Eval method to evaluate binding expressions at run time (late-bound data) and optionally format the result as a string. While, personally, I prefer early binding due to performance benefits,
Posted by irenak | 2 Comments

SYSK 116: Which Code is Faster and Why – Using ‘As’ or ‘Is’ + cast?

Which code segment below is faster? #1 MyClass classInstance = new MyClass(); IDoWork iDoWorkClass = classInstance as IDoWork; if (iDoWorkClass != null) { // Do something so compiler doesn't think it's dead code System.Diagnostics.Debug.WriteLine("testing");
Posted by irenak | 3 Comments
 
Page view tracker