![]() |
|
|
A Google Chart API Custom Server Control
Last week's article, Creating Charts with the Google Chart API, looked at how
to use Google's free Chart API to generate line, pie, bar, and other types of charts from an ASP.NET page. The Google Chart API is callable via a
URL that contains the chart type, size, data, and other parameters in the querystring and returns the chart as an image. Displaying a chart
using this API is as simple as adding an Image Web control to a page and setting its Last week's article explored the essential querystring parameters and provided an example on how to programmatically construct this querystring to plot data from a database query. In a nutshell, constructing this querystring involved about 50 lines of code to get the data, express the data as percentages relative to one another, and build up the other parameters. Wouldn't it be much easier if we could create a chart by dropping a Google Chart API Web control on the page, set a few properties, and then bind it to a data source control, like a SqlDataSource or ObjectDataSource? That way we could create and display charts using the Google Chart API without having to write a lick of code.
Over the past week I built such a Web control. The Web control does not provide the full suite of Google Chart API features - it only allows for the
creation of line, bar, and pie charts, and it only allows a single data series - but it makes creating and displaying data-driven charts as easy as
drag-and-drop and point-and-click. This article shows how to use this free custom server control and highlights some of its more interesting aspects.
You can download the compiled server control, its complete source code, and a demo application at the end of this article. Read on to learn more!
Creating Charts with the Google Chart API I've always wondered how the phrase "A picture is worth a thousand words" came about. I like to think that it was coined by some mid-level manager viewing a sales figures report that consisted of metrics from the past 1,000 days. After scanning this long list of numbers, he found, at the bottom of the page, a line chart that summarized the numbers, and uttered that now well-known adage. Charts and graphs provide a succinct synopsis of large amounts of data. With charts a person can quickly spot trends, compare different resultsets, or recognize patterns.
This article looks at how to use the Google Chart API to create charts. The Google Chart API is a
free service from Google that enables web developers to generate chart images on the fly by creating an
Troubleshooting Website Problems by Examining the HTTP Traffic
I started my career as a web developer with Microsoft's Active Server Pages (ASP), the predecessor to ASP.NET. ASP was a very simple scripting engine
and lacked the tools that ASP.NET developers today take for granted, most notably a debugger. Debugging an ASP script typically involved littering
the code with
While the Visual Studio debugger has greatly improved the debugging story, there are certain scenarios where a server-side debugger is of little or no
help. In certain cases the problem is not in the server-side code but instead in what is being sent from the client to the server (or vice-a-versa).
These types of scenarios are quite common when creating AJAX-enabled web applications, as the data exchanged between the client and server during a
partial page postback affects the code executed on the server-side and how the page is updated on response. This technique is also quite useful when
debugging pages that perform different
Unlike debugging server-side code, examining the HTTP traffic sent between the client and the server is typically done on the client - namely, from
the browser rather than from within Visual Studio. Fiddler is a free, excellent tool for debugging HTTP traffic. This article provides an overview
of Fiddler and shows how to use Fiddler to assist with debugging. Read on to learn more!
Converting Flat, Comma-Delimited Values Into a Normalized Data Model In my job as an independent software developer I help a lot of small businesses enhance their existing company website or internal web applications to include new features or adopt best practices. Many of these businesses have vital line of business applications that were created many years ago by an employee who was not a professional software developer, but perhaps a member of the IT team or someone who was learning how to program or programmed as a hobby. A common mistake made by people without a solid background in creating data-driven applications is using flat, non-normalized data models.
Consider an application used in a healthcare setting may need to record each doctor's professional and educational degrees. Because there are a fixed
number of degrees - PhD, MD, DDS, OB/GYN, RN, etc. - these degrees should be spelled out in a separate database table. And because each doctor can have
multiple degrees, there should be a third table that maps what doctors are associated with what degrees. Such a data model would be normalized. A non-normalized
data model would instead try to capture each doctor's degrees within the same table that contains the doctor's other information (his name, address, DOB, etc.).
This might be implemented as several columns in the table (
While there are certain circumstances where non-normalized data is ideal, in the vast majority of situations having the data expressed in a normalized
manner is ideal. Normalized data is easier to work with, is easier to report against, is (usually) more efficient in terms of both disk space and
time to execute queries, and is less likely to suffer from any data integrity issues, which are all too common in non-normalized data. I recently helped
a client who had a many-to-many relationship implemented in a flat, non-normalized manner convert that data into a normalized data model through the use
of a T-SQL script. This article discusses why it is worhtwhile to convert flat, non-normalized data into a normalized data model and steps through
how this T-SQL script can be used to normalize your data. Read on to learn more!
Improving Web Development Using Virtualization Most web developers have a particular development environment on their computer. They may have the .NET Framework version 3.5 and Visual Studio 2008 installed, along with Microsoft SQL Server 2005, Internet Explorer 7 and Firefox 3. In a perfect world this environment would be static and the developer would not need to install beta or old versions of software that may or may not allow side-by-side installation with the current version. But in the real world, the site needs to be tested against Internet Explorer 5.5, 6, and the beta version of version 8, as well as against Firefox 2. And the developer may want to install the the ASP.NET Futures, which provide an early preview of future functionality for ASP.NET. Anyone who's worked extensively with beta software - or has needed to maintain old versions of software products for backwards compatibility testing - knows all too well the challenges: beta software might require the beta version of a framework, which will break current development; old versions of the software may not work properly when installed on the same machine with the current version; and so on. The good news is that these hassles can be overcome with virtualization. In a nutshell, with virtualization you can create "virtual machines," which are simulated environments with their own operating system and applications that are managed by your "real" machine.
This article looks at Microsoft's free virtualization software, Virtual
PC, and shows how to use it to create guest environments where you can cleanly install alternate development environments to assist with web
development. Read on to learn more!
Examining ASP.NET 2.0's Membership, Roles, and Profile - Part 13 ASP.NET's forms-based authentication system in tandem with the Membership API and Login Web controls make it a cinch to create a user store, create user accounts, and allow visitors to log into the site. What's more, with little effort it's possible to define roles, associate user accounts with roles, and determine what functionality is available based on the currently logged in user's role (see Part 2). Many ASP.NET sites that use Membership have an Admin role, and users in that role are granted certain functionality not available to non-Admin users. Consider an online store - Admin users might be able to manage inventory, whereas the only way normal members could interact with the inventory was by adding items to their shopping cart. I was recently working with a client who had an interesting request: he needed the ability for Admin users to be able to log into the site as another user, and perform actions as if that other person had logged in herself. Returning to the online store example, imagine that some customers periodically phone in their order, or mail or fax in an order form. An Admin, receiving this order, could then log into the site as that customer and place the order on the customer's behalf.
This article shows how to allow an Admin user to log into a Membership-based website as another user, and includes a complete working demo available
for download at the end of the article. Read on to learn more!
New Date Data Types in Microsoft SQL Server 2008
In August 2008 Microsoft released
the latest version of the database server software, SQL Server 2008. SQL
Server 2008 includes a number of new features not found in SQL Server 2005, including: a terser T-SQL syntax; the new
In previous versions, SQL Server had only two date-related data types:
This article explores the
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||