All hope for the future of professional cycling lost

And so it happened, the last of the great ones finally confessed: both Bobby and Pim used doping in excessive amounts during the period from 1984 until 2007. I am left totally speechless, all hope is now lost…

Team Easy On indrømmer doping (Danish)

Confession Part 1

Confession Part 2


Retro/Turbo Encabulator

Retro encabulator by Rockwell Automation

Transcript

  Here at Rockwell Automation’s world headquarters, research has been proceeding to develop a line of automation products that establishes new standards for quality, technological leadership and operating excellence. With customer success as our primary focus, work has been proceeding on the crudely conceived idea of an instrument that would not only provide inverse reactive current, for use in unilateral phase detractors, but would also be capable of automatically synchronizing cardinal grammeters.

  Such an instrument comprised of Dodge gears and bearings, Reliance Electric motors, Allen-Bradley controls, and all monitored by Rockwell Software is: Rockwell Automation’s ‘Retro-Encabulator’. Now, basically the only new principle involved is that instead of power being generated by the relative motion of conductors and fluxes, it’s produced by the modial interaction of magneto-reluctance and capacitive diractance.

  The original machine had a base-plate of pre-fabulated amulite, surmounted by a malleable logarithmic casing in such a way that the two spurving bearings were in a direct line with the panametric fan. The lineup consisted simply of six hydrocoptic marzelvanes, so fitted to the ambifacient lunar wane shaft that side fumbling was effectively prevented. The main winding was of the normal lotus-o-deltoid type placed in panendermic semi-boloid slots of the stator, every seventh conductor being connected by a non-reversible tremie pipe to the differential girdlespring on the ‘up’ end of the grammeters.

  Moreover, whenever fluorescence score motion is required, it may also be employed in conjunction with a drawn reciprocation dingle arm, to reduce sinusoidal depleneration. The ‘Retro-Encabulator’ has now reached a high level of development, and it’s being successfully used in the operation of milford-trenions.

  It’s available soon; wherever Rockwell Automation products are sold.

Turbo encabulator by Chrysler


References


Paging large amounts of data in ASP.net / SQL2005

If you have a huge dataset, doing standard paging in ASP.net is definitely not the solution. In the normal paging methods all rows are retrieved in the application and the selection is done in code. So if you have 1.000.000 records and a page size of 20, every time you swap page you read 1.000.000 records and then select 20 of these (this is of course if you do paging the “Visual” way).

However if you have SQL 2005 there is a much, much better way of doing paging, albeit it requires some more coding, both on the web-frontend and in the database. The solution is based on the Common Table Expressions (CTE) and the Ranking functions (more specifically the ROW_NUMBER() function) introduced in SQL 2005.

[sql]
CREATE PROCEDURE [schema].[table_List]
@PageIndex int, — Page number from 0 to inf.
@PageSize int — The size of each page
AS
BEGIN
WITH Data AS (SELECT ROW_NUMBER() OVER (ORDER BY [sort order]) AS RowNumber, * FROM [schema].[table] WHERE [condition])
SELECT * FROM Data WHERE
(@PageIndex IS NULL) OR (@PageSize IS NULL) OR
(
RowNumber >= @PageIndex * @PageSize AND
RowNumber < (@PageIndex + 1) * @PageSize
)
END
[/sql]

What this does is create a CTE with all the data (same as in the "old" version) and add a ranking to this based on some sorting condition (fx. sort by primary key) and apply the ROW_NUMBER() function to this. So if we have a table like this:

Id Name
85241F67-100D-4DD0-996D-DBFA8DB08B4A John
2569F112-E026-4B71-BD3D-AC16F12DFDC7 Paul
8479CDFB-B4A5-487B-9A98-9CABDC912F6E George
287D7DDA-F1DB-4C60-B2C2-A7E041DF11B6 Ringo

And apply the SP “scheme” above with sorting by Name to this we would get:

RowNumber Id Name
1 8479CDFB-B4A5-487B-9A98-9CABDC912F6E George
2 85241F67-100D-4DD0-996D-DBFA8DB08B4A John
3 2569F112-E026-4B71-BD3D-AC16F12DFDC7 Paul
4 287D7DDA-F1DB-4C60-B2C2-A7E041DF11B6 Ringo

Now we have a way of selecting a subset of the dataset based on absolute position within the dataset (which paging is actually all about).

Another thing we (most likely) need is to a method to return the total number of rows the query “would have returned”. This is to be able to display a “Page n of m”. It is actually possible to use the ObjectDataSource instead of the SqlDataSource (which you most likely would do already, if using the DataSource server controls at all) and have it “select a specific page” by using parameters along with a “select count method” (the SelectCountMethod) thereby making it possible to use standard ASP.NET server controls to paging in the database.

However while using DataSource server controls lets you do some RAD style VB-ish development – no I’m not biased ;) – it is at the cost of “loosing control” of binding (fx. I have never figured out how to force a bind to occur with DataSource controls – I actually was in a situation where this was needed once). Besides this it is also at the cost of performing two calls to the SQL database (most likely): one for retrieving page count another for retrieving the specific page. But if using manual binding this can easier be accomplished in one step, simply by modifying the stored procedure to:

[sql]
CREATE PROCEDURE [schema].[table_List]
@PageIndex int, — Page number from 0 to inf.
@PageSize int — The size of each page
AS
BEGIN

SELECT COUNT([pk]) AS TotalCount FROM [schema].[table] WHERE [condition];

WITH Data AS (SELECT ROW_NUMBER() OVER (ORDER BY [sort order]) AS RowNumber, * FROM [schema].[table] WHERE [condition])
SELECT * FROM Data WHERE
(@PageIndex IS NULL) OR (@PageSize IS NULL) OR
(
RowNumber >= @PageIndex * @PageSize AND
RowNumber < (@PageIndex + 1) * @PageSize
)
END
[/sql]

If you anyway parse your queries (like I hope you do) into some business objects, then if using a IDataReader (and the Data Access Application Block from the Enterprise Library) could give you something like (0 = page index, 20 = page size):

[csharp]
Database db = DatabaseFactory.CreateDatabase(“con.string name”);
int totalCount = 0;
using (IDataReader reader = db.ExecuteReader(“some sp”, 0 /* page index*/, 20 /* pages ize */))
{
if (reader.Read())
{
totalCount = Convert.ToInt32(reader["TotalCount"]);
}
reader.NextResult();
while (reader.Read())
{
/* Instantiate and initialize objects */
}
}
[/csharp]

So now all we have to do is create some custom paging mechanisms in ASP.net that handles the page selection for us and then executes the SP when binding the data (this could be the topic of another post).


Differences between using Cassini and IIS

Before I begin, let me just clarify: the intent of this post is not to say you should run IIS instead of Cassini or vice-versa, but instead just to outline what one must be aware of if Cassini is chosen as development “host”.

What are the differences in using Cassini instead of IIS when developing ASP.NET applications?

Short:

  • Only serves local requests
  • Runs in user context
  • All requests are parsed by ASP.NET

Longer:

Only serves local requests: It is not possible to access the application from remote machines. This makes it rather difficult (or tedius at least) fx. to debug authorizations when using Windows Authentication.

Runs in user context: An IIS normally runs as Network Service, i.e. a very well defined restricted account. When running the Cassini web server it runs in the context of the user starting Visual Studio. Most often this is a local administrator, which then gives the web application administrative priviliges when run using Cassini. A case where this has the direct cause of some hours of debugging.

A web application was developed that used the Report Viewer to view a report on a MS Reporting Services server. The report pulls data from a database located on another server that running the Reporting Service. The user/developer running the web application was dbo on the database using Windows Authentication. The connection string in the report was set to use Windows Authentication as well. Everything works like a charm. Then deploying to test, where database authentication was done using the machine account (i.e. Windows Authentication is performed on the NetworkService account – not a super method, granted, but lets ignore that for now) of the web server. In this case authentication fails on the Reporting Service to SQL server hop.

All requests are parsed by ASP.NET: This simply means, well, exactly that “All requests are parsed by ASP.NET”. This includes static items such as html, css, js, images, files, etc. Why does this matter? If you are thinking about rewriting URLs this will be obvious. For example you might create a rewrite rule based on HttpContext.RewritePath() (either directly or through a library, fx UrlRewriter.NET), mapping /Profile/JohnDoe to /Profile.aspx?user=JohnDoe. When run in Cassini this will work “out-of-the-box”, because the request for /Profile/JohnDoe is parsed by the ASP.NET engine and the mapping is performed. However when run in IIS the request will fail (for 2 reasons actually). First of all /Profile/JohnDoe will be translated to /Profile/JohnDoe/ and the default page will be tried served (fx. /Profile/JohnDoe/Default.aspx). This file does most likely not exist and IIS will probably serve a 404. Lets ignore this for a second and assume that it will try to serve /Profile/JohnDoe as a file directly. Since files without extension are not handled by aspnet_isapi.dll in a standard IIS installation, this IIS will try to serve the file directly, and again, since it does not exist IIS will probably serve you a 404 instead.

This was just a brief highlight of some of the differences (I have felt on my own CPU) between using Cassini and IIS when developing ASP.NET applications. Maybe more exist, I don’t know, but we can leave this as an exercise for the reader ;)


Follow

Get every new post delivered to your Inbox.