Validate multiline TextBox

Because it is rendered to TextArea the MaxLength property does not work. One way around this is to attach a regular expression validator to that control. What is important is to set the ValidationExpression to something like “^[\s\S]{0,255}$“. Where 255 is the maximum length allowed.

Hope this helps 🙂

What is coming with VS2011 and Framework 4.5

ASPNET vNext What is coming with VS2011 and Framework 4.5Read here from Scott Hanselman’s post.

Download Links

Readmission to hospital within 28 days of discharge

This is very common question when we deal with patients in NHS data. Here is how the task is defined – Readmission rates and HES. In short we need to know how many times(or when) a patient was readmitted within 28 days of his last hospital discharge. Here is how I do that in SQL with self join.

The dates are being transferred from “DDMMYYYY” to SQL server datetime “YYYY-mm-dd”.

You can always ad disease code or any other conditions to the query. Hope it helps!

The columns are:
[Column 8] – Patient identifier
[Column 11] – Admission date
[Column 15] – Method of admission
[Column 19] – Discharge date
[Column 28] – Spell end – Yes/No
[Column 123] – PCT code
[Column 187] – Unique record ID

Clean whole database from unwanted string

Often we end up having an unwanted string injected into our database. It might be a virus or any text that you don’t need. This stored procedure is doing the hard work to remove all the unwanted instances.

Thursdays links part 2

What is Node.js?

Let’s start with V8. V8 is the JavaScript implementation used within Chrome. It utilises “Just In Time” compilation to achieve performance that was previously unattainable in JavaScript. In fact, these improvements lift V8 JavaScript into the same realms of performance as Clojure, Java or Go.

Should I use HTML5 or Silverlight?

I was in Belgium and The Netherlands this last week presenting and talking to folks in the community. After I presented on ASP.NET MVC 3, HTML5 and jQuery, one fellow came up after and said, “Should I use Silverlight or HTML5. I don’t understand what Microsoft’s strategy is or what to use in my app.”

Thursdays links

Countdown to Ext JS 4: Drawing and Charting

Build a Data-Driven Enterprise Web Site in 5 Minutes

Understanding the Dynamic Keyword in C# 4

Programming Windows Phone 7 Free eBook

ProgWinPhone7 246x300 Programming Windows Phone 7 Free eBookThis book is from the famous Charles Petzold. Here is the introduction:

This book is a gift from the Windows Phone 7 team at Microsoft to the programming community, and I am proud to have been a part of it. Within the pages that follow, I show you the basics of writing applications for Windows Phone 7 using the C# programming language with the Silverlight and XNA 2D frameworks.
Yes, Programming Windows Phone 7 is truly a free download, but for those readers who still love paper—as I certainly do—this book will also be available (for sale) divided into two fully-indexed print editions: Microsoft Silverlight Programming for Windows Phone 7 and Microsoft XNA Framework Programming for Windows Phone 7.
With the money you’ve saved downloading this book, please buy other books. Despite the plethora of information available online, books are still the best way to learn about programming within a coherent and cohesive tutorial narrative. Every book sale brings a tear of joy to an author’s eye, so please help make them weep overflowing rivers.
In particular, you might want to buy other books to supplement the material in this book. For example, I barely mention Web services in this book, and that’s a serious deficiency because Web services are likely to become increasingly important in Windows Phone 7 applications. My coverage of XNA is limited to 2D graphics and while I hope to add several 3D chapters in the next edition of this book, I don’t really get into the whole Xbox LIVE community aspect of game development. Nor do I discuss any programming tools beyond Visual Studio—not even Expression Blend.
My publisher Microsoft Press has a couple additional Windows Phone 7 books coming soon: Windows Phone 7 Silverlight Development Step by Step by Andy Wigley & Peter Foot offers a more tools-oriented approach. Although Michael Stroh’s Windows Phone 7 Plain & Simple is a guide to using the phone rather than developing for it, I suspect it will give developers some insights and ideas.
Moreover, I also hear that my old friend Doug Boling is working hard on a Windows Phone 7 enterprise-programming book that is likely to be considered his masterpiece. Be sure to check out that one.

To download click here.

10 Tips for Writing Quality Code

quality code matrix 10 Tips for Writing Quality CodePre-Development
– Gather all the requirements from clients up front. Schorr recommends thinking of these in terms of “stories” as “it’s more in line with how the non-developer thinks.”
– Clarify what is necessary and what’s just “nice-to-have.”
– Refuse to reproduce lousy code. In other words, turn down work if you’re going to be asked to reproduce a poorly designed system – unless you are being given the freedom to do it right. (This begs the question, of course: How do you define “lousy code”?)
– Reject unrealistic timelines
– Out-engineer user-error as much as possible. “In other words,” writes Schorr, “never trust that the user will do what you expect, especially when entering data.”
– Be open to including other languages and technologies where appropriate.
– Don’t reinvent the wheel.
– Review your code for speed, stability, security, and usability.
– Have non-technical people do real-world testing on your product.
– Revisit old code periodically and see what you would’ve done differently.