Nimble Coder

Adventures in Nimble Coding
posts - 76, comments - 39, trackbacks - 0

c

There are 5 entries for the tag c
Spinning Wait Symbol in Silverlight, Part 2

After my previous spinning wait symbol, I decided to see how difficult it would be to create a Silverlight version of the Mac OSX wait cursor that I referenced in the previous post. The Mac OSX cursor is commonly referred to as the "Spinning Pizza of Death" or the "Marble of Doom" and in fact there is a Marble of Doom web site dedicated to the amount of time spent waiting while watching the spinning cursor. The Marble of Doom web site has a very nice and large version of the cursor using Flash although it doesn't have any vector...

posted @ Monday, October 20, 2008 3:08 PM | Feedback (0) | Filed Under [ C# Programming SilverLight ]

On Sample Simplicity

I was working through a Communications sample of connecting SilverLight to POX, then Web Services, and finally WCF and I came across the following instructions: (Part 1: POX) The Generic handler will process an incoming request using the code declared in the ProcessRequest function. This function should create some new instances of CityData and add them to the myCities list. Here are some examples of cities with longitude and latitude { (London, 51.5, 0), (Stratford-upon-Avon, 52.3, -1.71), (Edinburgh, 55.95, -3.16) }. See if you can write the code to do this. (And later in the lab...) In this example...

posted @ Friday, June 13, 2008 4:08 PM | Feedback (0) | Filed Under [ C# Programming SilverLight LINQ ]

Automatically setting the Specified property in WSDL Generated files

The wsdl.exe tool with Visual Studio can be used to manually generate a code file to use with a project. If you use the nillable or minOccurs attributes in the XSD though, the wsdl.exe tool generates a boolean 'Specified' field that must be set to true in order to transmit the data through the web service. For example: WSDL File (myfile.wsdl)<xs:element name="duedate" type="xs:dateTime" nillable="1" minOccurs="0" maxOccurs="1" /> Generated CS File (wsdl.exe myfile.wsdl)// ... private System.Nullable<System.DateTime> duedateField; private bool duedateFieldSpecified; // ... /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] public System.Nullable<System.DateTime> duedate { get { return this.duedateField; } ...

posted @ Tuesday, April 01, 2008 3:51 PM | Feedback (0) | Filed Under [ C# Tools Programming ]

Best Practice for Verbatim String Text Block

I was browsing various blogs today and I came across a good example for using a verbatim string instead of a StringBuilder object. The code I came across looked like this (I mean absolutely no disrespect to the author, so I won't include the original link):private void ClientScript() { StringBuilder sb_Script = new StringBuilder(); sb_Script.Append("<script language=\"javascript\">"); sb_Script.Append("\r"); sb_Script.Append("\r"); sb_Script.Append("function cb_verify(sender) {"); sb_Script.Append("\r"); sb_Script.Append("var val = document.getElementById(document.getElementById" +"(sender.id).controltovalidate);"); sb_Script.Append("\r"); sb_Script.Append("var col = val.getElementsByTagName(\"*\");"); sb_Script.Append("\r"); sb_Script.Append("if ( col != null ) {"); ...

posted @ Friday, November 23, 2007 12:05 AM | Feedback (0) | Filed Under [ C# JavaScript ]

Efficient String Blocks

One of the things that bothers me a lot is using a lot of string concatenation when you can just use the verbatim string literal (@"") to define a large block of text. For example, I saw some code on a blog the other day that looked something like this:string strValue = "<div id='test'>"; strValue += "<input type='text' id='name' value='" + strName + "/>"; strValue += "<input type='submit' />"; strValue += "</div>"; // Many more lines before it finally // finished building the string There are many things wrong with the code sample above including not using StringBuilder. I have seen the same type of code...

posted @ Friday, November 09, 2007 3:18 PM | Feedback (0) | Filed Under [ C# ]

Powered by: