Thursday, December 20, 2007

IE8 Passes the ACID2 Test!


Well the word is out. The IE8 Team has just officially announced that they have rendered the "ACID 2 Face" in I8 Standards mode. This is HUGE!! Finally no more workarounds or hacks on your CSS. Passing the ACID 2 test basically means that the browser follows the W3C HTML and CSS 2.0 specifications. The announcement also talked about supporting the many different types of users and older web pages. I think the IE8 Team has another trick up its sleeve and will later reveal a backward compatibility mode for older sites so that standards and nonstandard sites will work in IE8.

Good job IE8 Team!

Tuesday, December 11, 2007

SharpDevelop IDE

About 2 years ago I went on a search for a zip library because the .NET Framework at the time did not have one. I found this really nice zip library that came from the SharpDevelop IDE project. At the time the SharpDevelop project was pretty basic and they were at version 1.1. Well things have really changed since then. They have added some really cool features such as multiple framework support, refactoring, Subversion integration and Mono support.

Here's a list of some of the features...

  • Open source, LGPL licensed

  • Write C#, ASP.NET, ADO.NET, XML, HTML code

  • Forms designer for C#, VB.NET and Boo

  • Code completion for C#, VB.NET and Boo (including Ctrl+Space support)

  • Integrated NUnit support plus code coverage (NCover)

  • Multi-framework support (.NET 1.1 and 2.0, Mono, Compact Framework)

  • XML Editing (source and tree view) with XPath search

  • Subversion integration

  • Code template support

  • Easily extensible with external tools

  • Re-host SharpDevelop with SDA

  • Easily extensible with Plug-Ins





If your looking for a Free alternative to Visual Studio or even a Windows Mono IDE this is a very good alternative.

Friday, November 30, 2007

Silverlight 1.1 upgraded to Silverlight 2.0


Microsofts Silverlight is a cross platform and cross browser version of the .NET Framework. That's right folks it runs on Windows,Mac & Linux.

First quarter of 2008 they will be releasing Silverlight 2.0. This release has so many new features that they decided to up the number from 1.1 to 2.0.

Here is a break down of the new features...

WPF UI Framework: The current Silverlight Alpha release only includes basic controls support and a managed API for UI drawing. The next public Silverlight preview will add support for the higher level features of the WPF UI framework. These include: the extensible control framework model, layout manager support, two-way data-binding support, and control template and skinning support. The WPF UI Framework features in Silverlight will be a compatible subset of the WPF UI Framework features in last week's .NET Framework 3.5 release.

Rich Controls: Silverlight will deliver a rich set of controls that make building Rich Internet Applications much easier. The next Silverlight preview release will add support for core form controls (textbox, checkbox, radiobutton, etc), built-in layout management controls (StackPanel, Grid, etc), common functionality controls (TabControl, Slider, ScrollViewer, ProgressBar, etc) and data manipulation controls (DataGrid, etc).

Rich Networking Support: Silverlight will deliver rich networking support. The next Silverlight preview release will add support for REST, POX, RSS, and WS* communication. It will also add support for cross domain network access (so that Silverlight clients can access resources and data from any trusted source on the web).

Rich Base Class Library Support: Silverlight will include a rich .NET base class library of functionality (collections, IO, generics, threading, globalization, XML, local storage, etc). The next Silverlight preview release will also add built-in support for LINQ to XML and richer HTML DOM API integration.

This should spur a major migration from applications that would have been built on the desktop to be moved to the web. I'm really interested in what kind of performance this new framework will have and how far you can push it in terms of size. I wonder if there is a built in asynchronous framework to handle calls to different web services.

The blurry line between desktop application and web app has gotten a lot bigger.

Sunday, November 4, 2007

Single & Multiline TextBox with MaxLength Validation

After doing a bit of searching online I couldn't find an easy way to control the character length in a text box and a multi line text box. Plus the limit is defined by the schema of the table in a database. So I did what any developer would do with this problem. I used it as an excuse to write some code!

Here is one example of limiting characters in a text box or a multi line text box in a asp.net form. This example will also show how to add a dynamic warning message once the limit has been reached.

This example has 3 parts.

  • A Stored Procedure

  • Some C# code

  • A Javascript function



Lets get into the code!

Create the stored procedure

CREATE PROCEDURE [dbo].[GetFieldWidths]
(
@TableName nvarchar(40)
)
AS
BEGIN
SELECT COLUMN_NAME,
CHARACTER_MAXIMUM_LENGTH,
DATA_TYPE
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = @TableName
END
RETURN

Create a C# function to read all valid fields widths into a Generic Dictionary Collection.



// helper function
public static Dictionary FieldWidths
{
get
{
System.Web.HttpApplicationState ApplicationState = HttpContext.Current.Application;
if (ApplicationState["cDatabase.Tables.tblUsers.FieldWidths"] == null)
{
ApplicationState["cDatabase.Tables.tblUsers.FieldWidths"] = cDbaseFunc.FieldWidths(tblUsers.TableName);
}

return ApplicationState["cDatabase.Tables.tblUsers.FieldWidths"] as Dictionary;
}
}

// main function
public static Dictionary FieldWidths(string Table)
{
//Load field types
string[] aryStringTypes = new string[6] { "char", "nchar", "ntext", "nvarchar", "text", "varchar" };
List StringTypes = new List(aryStringTypes);

Database db = DatabaseFactory.CreateDatabase();
DbCommand dbCommand = db.GetStoredProcCommand(cDatabase.StoredProcedure.GetFieldWidths);
db.AddInParameter(dbCommand, "@TableName", DbType.String, Table);
IDataReader dr = db.ExecuteReader(dbCommand);

string FieldName = string.Empty;
int FieldLength;
string FieldType = string.Empty;

Dictionary FW = new Dictionary();
while (dr.Read())
{
FieldType = dr.GetString(2).ToLower();
if (StringTypes.Contains(FieldType))
{
FieldName = dr.GetString(0);
FieldLength = dr.GetInt32(1);
FW.Add(FieldName, FieldLength);
}
}
dr.Close();

return FW;
}

Create the Javascript function that limits the characters and creates the dynamic message.



function CheckCharMaxLenLimit(control,maxlength)
{
var ErrorMsgID = control.id + "_$MAXLENGTH_ERROR_MSG$";
var ErrorMsg = document.getElementById(ErrorMsgID);

var MaxLength;
if(maxlength != null)
{
MaxLength = maxlength;
}
else
MaxLength = control.maxLength - 1;

var TextLength = control.value.length;
if(TextLength > MaxLength)
{
control.value = control.value.substring(0,MaxLength);

if(ErrorMsg == null)
{
control.outerHTML = control.outerHTML + MaxLength + " character limit!";
}
}
else
{
if(ErrorMsg != null)
ErrorMsg.parentNode.removeChild(ErrorMsg);
}
}

The final step is too attach the javascript function to your text box control "onkeyup" event.
You can do this in the code behind like so....
this.txtUserName.Attributes["onkeyup"] = "CheckCharMaxLenLimit(this," + this.FieldWidths["Username"] + ");";

Summary


The nice thing about the C# function is that it caches the returning list of fields and widths into an Application State variable. If your tables schema changes allot you could always cache it in a session state variable. This reduces the hits to SQL server which improves performance.

The character limiting and checking is handled on the client side using the javascript function. This function also supports the "maxLength" attribute of the text box control. The dynamic message is also created on the client side by using the DOM to attach a child element to the text box. This creates a very quick UI response. Lastly the dynamic message can be formatted using standard CSS.

Like so...
.MAXLENGTH_ERROR_MSG
{
color:red;
}

This method uses SQL2005 but I'm sure it could easily be used with any database platform. I hope this helps someone out there with the same problem.

Monday, September 24, 2007

Top 10 IIS 7 changes

If you don't already know Microsoft uses there own applications while still in beta on there production servers. Right now www.microsoft.com is running on the beta 3 Windows Server 2008 and the beta 3 of IIS 7. The 2 products are very stable and are in a functional release.

Here are the top 10 major changes in IIS 7...


  • Simple, Configurable Command Line Setup

  • Great Compatibility with older asp apps

  • No More Metabase!

  • Centralized Configuration

  • Delegated Configuration

  • AppCmd and Other New Management Options

  • Failed Request Tracing

  • Request Filtering

  • UNC Content

  • Output Caching of Dynamic Content




IIS 7 Totally modular


Get more details here..

Wednesday, September 19, 2007

SQL Server 2008 Spec sheets are OUT!!

Well it looks like Microsoft has released the new spec sheets on SQL Server 2008 and man there is a lot of sweet stuff they have added.

Here are the highlights..

  • Policy-based Management
    A framework that enables policies to be defined for explicit and automated administration of server entities across one or multiple servers.


  • New Language Integrated Query (LINQ) extensions
    This enables developers to be more productive by working with logical data entities that align with business requirements instead of programming directly with tables and columns.


  • Beyond relational data
    New data types such as a geospatial type, filestream type, 4 new data & time types and a Hierarchy ID type have been added.



Another really cool feature that will help in the swelling of database sizes is the addition of Sparse columns. Its a highly efficient way of managing empty data in a database by enabling NULL data to consume no physical space.

I'm sure all the GIS nerds out there are chopping at the bit to get there hands on the new geospatial functionality. Well its here and it looks very promising.

Check out some of the features below...

Comprehensive Spatial Support

  • Work with geodetic and planar data types
    Implement Round Earth solutions with the geography data type; using latitude
    and longitude coordinates to define areas on the Earth’s surface. Implement
    Flat Earth solutions with the geometry data type; storing polygons, points,
    and lines that are associated with projected planar surfaces and naturally
    planar data, such as interior spaces.


  • Build on industry standards
    Import and export spatial data in industry-standard formats, such as Well
    Known Text, Well Known Binary, and Geographic Markup Language (GML).


  • Perform spatial operations
    Use the methods provided by SQL Server 2008 spatial data types to write
    Transact-SQL code that performs operations on spatial data, such as finding
    intersections between geospatial objects and distances between locations.


High Performance Spatial Data Capabilities

  • Store large and complex spatial objects
    Use the spatial types in SQL Server 2008 to accommodate spatial objects,
    regardless of whether the objects are simple or very complex.


  • Build high-performance solutions with spatial data indexing
    Enhance query performance by using indexes for spatial data that are
    integrated into the SQL Server database engine. Take advantage of accurate
    query optimizer cost assessment for spatial queries that can determine the
    optimal query plan and identify appropriate index selection.


  • Consolidate relational and spatial data in business applications
    Use the native support for spatial data types in SQL Server 2008 to
    seamlessly incorporate spatial data into line-of-business applications.



Geospatial Application Extensibility

  • Build spatial solutions of any scale
    Take advantage of spatial support in multiple editions of SQL Server 2008,
    from SQL Server Express to SQL Server Enterprise Edition.


  • Use spatial standards support to integrate applications
    Leverage a .NET-based geometry library that supports OGC standards. Build
    applications that consume and manipulate spatial data. Integrate with
    geospatial services, such as Microsoft Virtual Earth™, to build
    comprehensive location-enabled solutions that render your spatial data for
    display.


  • Benefit from spatial community support
    Take advantage of spatial products and services offered by Microsoft
    partners that integrate with SQL Server 2008.


These are just the highlights. There is a ton of additional enhancements and features they've added that's really worth looking at.
Get more info here...SQL Server 2008

Monday, August 13, 2007

AJAX Loading

Recently I was building an AJAX site and needed an animated gif. To show that something was processing in the background. I ran across this gem of a site that lets you create custom animated gifs. www.ajaxload.info You can pick up to 35 different kinds of animations and choose there background color and foreground color. Plus make them transparent.

Check some of these out...









Pretty cool!

Sunday, July 29, 2007

Singularity v1.0

Looks like Singularity has reached the first release stage.
This is a project that Microsoft has been working on for a while, since 2003.
It’s basically a research OS prototype answering the question, "what if you built an OS with dependability and trustworthiness at its core from the ground up".

Here are some of the items the Singularity team is working on.

For example, Singularity uses type-safe languages and an abstract instruction set to enable what we call Software Isolated Processes (SIPs). SIPs provide the strong isolation guarantees of OS processes (isolated object space, separate GCs, separate runtimes) without the overhead of hardware-enforced protection domains. In the current Singularity prototype SIPs are extremely cheap; they run in ring 0 in the kernel’s address space.


I think the best thing about this new OS is the SIPs (Software Isolated Process).
Every program, device and system extension gets its own SIP.

Imagine this scenario...
You go out and buy some cheap ass web cam, printer or any external device and plug it into your machine. You install the drivers and restart your pc.....BAM!!! Blue Screen of Death



Your new cheap ass device just killed your OS because drivers are first class citizens and have hooks into the kernel. This scenario could not happen in a Singularity based system. In a Singularity based system the device would have its own memory space. There is no memory sharing or modifying of its own code. Every SIP gets its own data layouts, run-time system, and garbage collector. If this happened, in a Singularity based system, it would just die in its own little memory space and the rest of the OS would not be affected. Once the system finish booting, the OS can just tell you which devices have not booted and would you like to uninstall them.

I guess the other coolest part about this OS is the new language built for it called Sing#, which is an extension of C#. This language has first-class support for OS communication primitives as well as strong support for systems programming and code factoring.

Too get more info on Singularity check out their page... Singularity

Also here’s a really good white paper that goes into the specs of the whole system here.

Wednesday, July 18, 2007

Interview with Linus Torvalds

I just read this interview with Linus Torvalds over at www.oneopensource.it .
One of the questions that really stood out for me was this one.


A curiosity: which is your favourite distribution, and which on e do you consider more secure?

I don’t really tend to care much, I’ve changed distributions over the years, and to me the most important thing tends to be that they are easy to install and upgrade, and allow me to do the only part I really care about - the kernel.

So the only major distribution I’ve never used has actually been Debian, exactly because that has traditionally been harder to install. Which sounds kind of strange, since Debian is also considered to be the “hard-core technical” distribution, but that’s literally exactly what I personally do not want in a distro. I’ll take the nice ones with simple installers etc, because to me, that’s the whole and only point of using a distribution in the first place.

So I’ve used SuSE, Red Hat, Ubuntu, YDL (I ran my main setup on PowerPC-based machines for a while, and YDL - Yellow Dog Linux - ended up the easiest choice). Right now, most of my machines seem to have Fedora 7 on then, but that’s only a statement of fact, not meant to be that I think it’s necessarily “better” than the other distros.


I thought this to be a very funny comment, coming from a major kernel developer. Allot of Linux zealots bash windows users because of there dependence on so called dumb down user interfaces and lack of knowledge of the command line. When at the end of the day one of the main creators of Linux likes to use the distro that is the easiest to install with the dumb down GUI.

Now I know this question is talking about system installations. But I want to take it a step further to application installs. One of the major missing features that I think is holding back Linux is a standard install and uninstall service across all distros. This would make the lift to switching to Linux, for first time users, allot easier.

Full interview here...

Saturday, July 7, 2007

MonoDevelop 0.14 has been released



Here are some of the highlights...
  • Subversion add-in.
  • Refactoring operations.
  • New smart indenting for C#
  • Project exporting and conversion (includes Visual Studio 2005).
  • New features in Gtk# designer.
  • Desktop Integration Features (editor for launchers, .desktop files).

This IDE is one of the best IDE's for Mono. If your a VS lover you'll find your self at home using this IDE for linux.

Check it out here... MonoDevelop

Plus checkout the Mono Project here if you haven't already... Mono Project