by tracker1
23. February 2010 19:08
Okay, so I wanted to return a paged result set from a Stored Procedure in Microsoft SQL Server in T-SQL.
The results in question can be easily fed via a web service endpoint to a Silverlight, DHTML or other dynamic
grid. My own use is to populate a jqGrid.
The features I need are to be able to return only the relevant results for the current page, as well as a
count of the total rows available. I need to be able to input the current page number, an arbitrary page
size, as well as dynamically sort on a given column. My real world use is a fairly complex set of joined
tables, with several input parameters, so I am going to limit me queries to one table with the following
format:
CREATE TABLE MyList (
[id] UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
[created] DATETIME NOT NULL DEFAULT GETDATE(),
[name] NVARCHAR(100) UNIQUE NOT NULL DEFAULT '',
[description] NVARCHAR(250) UNIQUE NOT NULL DEFAULT ''
);
More...
by tracker1
15. February 2010 11:14
Okay, this is a quick one. There are several states that can be considered empty in JavaScript, a non-numeric value in a number, an invalid date, and empty string, an undefined value, and a null value. The issue is that some of these require testing against isNaN, and others will evaluate as matching null or an empty string (ex: the number zero and the boolean false). What I wanted was a simple method to check for a non-empty object or string, here it is.
function isEmpty(obj) {
if (typeof obj == 'undefined' || obj === null || obj === '') return true;
if (typeof obj == 'number' && isNaN(obj)) return true;
if (obj instanceof Date && isNaN(Number(obj))) return true;
return false;
}
How it works, is first it tests for an 'undefined' object, an object that is explicitly equal to null, or explicitly equal to an empty string. If it matches, it's empty. From here there's some more specific checking, if it's a number type of variable, and isNaN (Not a Number), then it's empty. If it's a date, and Number(obj) (which gets the value of the date as a Number) isNaN, then it's an invalid date, and ergo isEmpty. Otherwise the isEmpty returns false (valid, non-empty value). Hope this helps some of you. :)
by tracker1
22. July 2009 10:52
Okay, so you love the Firebug Console, and related output to the console tab within Firebug. Don't we all, however there is a minor problem in leaving in all your log, and debug (etc) statements, and that is the fact that the console object doesn't exist in other browsers, or Firefox without Firebug. You will want to put the script segments below into a file that is called before other scripts on your page. More...
by tracker1
13. May 2009 02:34
Okay, I love Javascript. It is hands down my favorite language (C# is a near second). In fact, it was the first language I ever learned, even before having a good handle on html markup in the mid-90s. I used it server-side with Livewire on Netscape server. I transitioned to (now Cassic) ASP, and picked up vbscript (COM enumerations via JScript were so evil). When .Net first came out, i hacked my way through using the JScript .net command-line compiler, and early ASP.Net (ASP+), after translating a litteral ton of code from VB.Net and C# samples, I caved and learned C#. Allong the way, I picked up on several SQL Dialects, VB6, some perl and others; but I always get back to Javascript. More...
by tracker1
19. December 2008 04:53
The past few weeks, I've been working on Apollo.Common, which is meant to provide some easier to use functionality to enterprise applications. A lot of this functionality, and more is provided by the MS PnP team's Microsoft Enterprise Library. However, ent-lib tends to be overly complex, difficult to use, and require a lot of customization before you can get moving. I want Apollo.Common to be easy to use, implement and deploy with a minimal learning curve. More...
by tracker1
11. November 2008 22:14
My goal is to create a personal website application that implements the features needed, and wanted for someone who wants to create a personal site that extends beyond just a blogging engine. I've been wanting to work with ASP.Net MVC and some other technologies, so I'll be focusing on using them in MySite. More...
by tracker1
5. November 2008 18:31
Okay, as an extension to the last post on String.Format, I'm doing a quick introduction to the System.Text.StringBuilder class. Why, you ask. Because when you append to a string, there is a lot of memory being allocated, transferred and dumped behind the scenes. Say you have a string of "My string is" and you want to append " cool." what happens is a new string is allocated in memory, with enough space for the original string, and the appended value. Then the original string is copied to the beginning, and the appended string is copied after. This is very inneficient. StringBuilder pre-allocates additional space, and handles the concatenation behind the scenes. More...
by tracker1
1. October 2008 14:59
Today I had to create a FAQ page. In order to make this work nicely I started with a simple Dictionary List markup, and some jQuery sugar to make an expand/collapse list. Although I love prototype.js, jQuery's nesting and inline DOM object creation really comes in handy. More...
by tracker1
12. September 2008 08:55
Okay, this snuck by me a couple weeks ago, but the Silverlight Dynamic Languages SDK 0.3.0 was pushed out on August 30th, 2008. Although the main focus of this SDK is for use in Silverlight, the DLR included in this SDK can be used to generate a nice, multi-language scripting environment for your own applications.
by tracker1
11. September 2008 18:07
Okay, I was playing around with the DOM Ready vs Window Load events with prototype.js and noticed that in my simple example, the window event actually fired before the dom event in IE8. This could lead to some issues, especially on cached pages, so I wanted to make a note of it. Why is it even an issue? Well, using the DOM ready event will allow you to hide things as soon as the tree has it. Using the window loaded event is necessary in order to handle flowing layouts in terms of size/proportion. More...