Twitter Updates

    follow me on Twitter

    Friday, August 11, 2006

    Error executing child request for ~/viewPicture.aspx

    I got the error message listed below and this was because the Windows ACL and permission system prevented it from writing to ngallery.xml. nGallery is updating information about the number of times a picture is viewed in this file.

    Also the photos directory needs to be writable to produce cached versions of the pictures.

    Error message:

    Server Error in '/ngallery' Application.
    ________________________________________
    Error executing child request for ~/viewPicture.aspx.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Error executing child request for ~/viewPicture.aspx.

    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): Error executing child request for ~/viewPicture.aspx.]
    System.Web.HttpServerUtility.ExecuteInternal(String path, TextWriter writer, Boolean preserveForm) +1788
    System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) +24
    System.Web.HttpServerUtility.Transfer(String path) +27
    nGallery.Lib.AlbumRequestHandler.ProcessRequest(HttpContext context) +1569
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +179
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +87

    ________________________________________
    Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

    Thursday, August 10, 2006

    asp.net 2.0 error: "Error executing child request for ~/albumListing.aspx"

    nGallery is not able to run it in 2.0. When I set it up in IIS to run as a 1.1 assembly, it works fine. There will not be a fix for this since nGallery has become a part of the Community Server! and are not continuing to work on nGallery individually.

    Error message:

    Server Error in '/nGallery' Application.
    ________________________________________
    Error executing child request for /nGallery/albumListing.aspx.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Web.HttpException: Error executing child request for /nGallery/albumListing.aspx.

    Source Error:
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [HttpException (0x80004005): Error executing child request for /nGallery/albumListing.aspx.]
    System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride) +3179649
    System.Web.HttpServerUtility.Execute(String path, TextWriter writer, Boolean preserveForm) +747
    System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm) +56
    System.Web.HttpServerUtility.Transfer(String path) +26
    nGallery.Lib.AlbumRequestHandler.ProcessRequest(HttpContext context) +1534
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +154
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64

    ________________________________________
    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

    SyncToy for Windows XP

    You probably have thousands of digital photos and documents that you want to backup or copy to external media. In my case, I copy everything to my development workstation to my laptop for working from home and bring back my work to office. I have used the xcopy in the past, and I've had very good results. However, there is an handy tool for Windows XP called SyncToy, and based on my few days of experience, it appears to do everything I need. Here are a few of its features:

    Provides easy and flexible copying, moving, and synchronization of files in different directories
    Manages multiple sets of directories at the same time
    Can combine files from two folders in one case, and mimic renames and deletes in another
    Keeps track of renames to files and will make sure those changes get carried over to the synchronized folder
    Configuring SyncToy is as easy as setting up one or more folder pairs and corresponding actions for each pair. For example, I might setup one pair to synchronize changes between two folders (which works both ways) and setup another pair to simply echo changes from one folder to another (echo is the action I use for backup purposes). If you want to get more specific, there are additional options that can be configured.

    If you'd like to know what operations SyncToy would perform on your folder pairs, you can run the convenient preview feature. The preview feature analyzes the folders, then tells you what it would do if it ran, but—most importantly—it doesn't actually make any of the changes. This is a great way to get comfortable with the tool before letting it loose on your precious files. And if you want to automatically process your folder pairs, there's even a topic in the help file (lookup Schedule in the index) that explains how to schedule SyncToy to run on a periodic basis.

    Download SyncToy v1.2 for Windows XP or to learn more, grab the whitepaper titled: Synchronizing Images and Files in Windows XP.

    reference: http://www.microsoft.com/windowsxp/using/digitalphotography/prophoto/synctoy.mspx

    Thursday, August 03, 2006

    Date and Time Manipulation in SQL Server 2000

    SQL Server 2000 does not have separate data types for date and time. Instead the Microsoft SQL Server Team chose to combine both the data types into one and store it as a datetime data type. Date and time can be stored in SQL Server in datetime or smalldatetime. The datetime data type can store dates from January 1, 1753 to December 31, 9999 to an accuracy of up to 0.003 part of a second. The smalldatetime data type can store data from January 1, 1900 to June 6, 2079 with accuracy of up to the minute.

    SQL Server takes into account a system reference date, which is called the base date for SQL Server. This base date is January 1st, 1900. It is from here that the main problem stems. SQL Server stores the datetime data type internally as two 4 byte integers and smalldatetime as two 2 byte integers. The first integer in both the cases stores the number of day difference from the base date. The second integer part stores the number of milliseconds/minutes since midnight.

    So, the most common question that is asked is:

    Q: How do I get SQL Server to return only the Date component or only the Time component from the datetime data type?
    A: By using the Convert function. The syntax for using the convert function is:


    CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

    convert(varchar,DateColumn,101)


    The list of styles that can be used are:






















































































    Style ID Style Type
    0 or 100 mon dd yyyy hh:mi AM (or PM)
    101 mm/dd/yy
    102 yy.mm.dd
    103 dd/mm/yy
    104 dd.mm.yy
    105 dd-mm-yy
    106 dd mon yy
    107 Mon dd, yy
    108 hh:mm:ss
    9 or 109 mon dd yyyy hh:mi:ss:mmm AM (or PM)
    110 mm-dd-yy
    111 yy/mm/dd
    112 yymmdd
    13 or 113 dd mon yyyy hh:mm:ss:mmm (24h)
    114 hh:mi:ss:mmm (24h)
    20 or 120 yyyy-mm-dd hh:mi:ss (24h)
    21 or 121 yyyy-mm-dd hh:mi:ss.mmm (24h)
    126 yyyy-mm-dd Thh:mm:ss.mmm (no spaces)
    130 dd mon yyyy hh:mi:ss:mmm AM
    131 dd/mm/yy hh:mi:ss:mmm AM


    reference:
    http://sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk

    Crosstab Queries in SQL Server 2000

    I have had to produce crosstab/pivot queries from SQL Server 2000 before, and it ain't pretty. Typically the data is stored in rows, and the data in one field needs to be turned into a column header. To cut straight to the chase, here's an article and stored procedure on SearchSQLServer.com that will do exactly that: A simple way to perform crosstab operations By Brian Walker

    Keep reading to find my slower, non-dynamic SQL way to do it. Here's some psuedo-code for when you know the columns that will be produced (an example is months of the year, although in this fake code I'm only producing two "pivot" columns):



    --this is fake code, it does not work!
    SELECT BaseColumn, SUM(X), SUM(Y)
    FROM (
    SELECT BaseColumn,
    IF ColumnHeader = x THEN FigureToBePivoted AS X,
    IF ColumnHeader = y THEN FigureToBePivoted AS Y
    FROM (
    SELECT BaseColumn, ColumnHeader, FigureToBePivoted
    )
    )
    GROUP BY BaseColumn



    And here's an example that works in Northwind, with months of the year across the top:



    --the outer-most query SUMs the OrderTotal for each month and groups by the ProductName
    --so that a product appears once, with all its OrderTotal dollar values in month columns.
    --Note there will be NULLs returned where a ProductName had no orders in a month
    SELECT X.ProductName,
    SUM(X.[01_Raw]) AS [Jan], SUM(X.[02_Raw]) AS [Feb], SUM(X.[03_Raw]) AS [Mar],
    SUM(X.[04_Raw]) AS [Apr], SUM(X.[05_Raw]) AS [May], SUM(X.[06_Raw]) AS [Jun],
    SUM(X.[07_Raw]) AS [Jul], SUM(X.[08_Raw]) AS [Aug], SUM(X.[09_Raw]) AS [Sep],
    SUM(X.[10_Raw]) AS [Oct], SUM(X.[11_Raw]) AS [Nov], SUM(X.[12_Raw]) AS [Dec]
    FROM (
    --this query splits each OrderMonth to its own column. However after the result of this we
    --end up with staggered results where no two months appear on the same line, so we need to
    --SUM the results at a later step
    SELECT I.ProductName,
    CASE WHEN I.OrderMonth = 1 THEN I.OrderTotal ELSE NULL END AS [01_Raw],
    CASE WHEN I.OrderMonth = 2 THEN I.OrderTotal ELSE NULL END AS [02_Raw],
    CASE WHEN I.OrderMonth = 3 THEN I.OrderTotal ELSE NULL END AS [03_Raw],
    CASE WHEN I.OrderMonth = 4 THEN I.OrderTotal ELSE NULL END AS [04_Raw],
    CASE WHEN I.OrderMonth = 5 THEN I.OrderTotal ELSE NULL END AS [05_Raw],
    CASE WHEN I.OrderMonth = 6 THEN I.OrderTotal ELSE NULL END AS [06_Raw],
    CASE WHEN I.OrderMonth = 7 THEN I.OrderTotal ELSE NULL END AS [07_Raw],
    CASE WHEN I.OrderMonth = 8 THEN I.OrderTotal ELSE NULL END AS [08_Raw],
    CASE WHEN I.OrderMonth = 9 THEN I.OrderTotal ELSE NULL END AS [09_Raw],
    CASE WHEN I.OrderMonth = 10 THEN I.OrderTotal ELSE NULL END AS [10_Raw],
    CASE WHEN I.OrderMonth = 11 THEN I.OrderTotal ELSE NULL END AS [11_Raw],
    CASE WHEN I.OrderMonth = 12 THEN I.OrderTotal ELSE NULL END AS [12_Raw]
    FROM (
    --this inner query returns the column(s) we want to return results for (ProductName),
    --the data (OrderTotal), and the column headings (OrderMonth)
    SELECT Products.ProductName,
    MONTH(Orders.OrderDate) AS OrderMonth,
    [Order Details].UnitPrice * [Order Details].Quantity AS OrderTotal
    FROM dbo.[Order Details] INNER JOIN
    dbo.Orders ON [Order Details].OrderID = Orders.OrderID INNER JOIN
    dbo.Products ON [Order Details].ProductID = Products.ProductID
    WHERE YEAR(Orders.OrderDate) = 1997
    ) I
    ) X
    GROUP BY X.ProductName
    ORDER BY X.ProductName



    And here's another that works in Access Control (I am not sure how many of you might have had access to the ACS Lenel OnGuard based system), with days of the month across the top:



    SELECT B.BaseColumn as EmployeeName
    ,MAX([01]) as [01], MAX([02]) as [02], MAX([03]) as [03], MAX([04]) as [04], MAX([05]) as [05], MAX([06]) as [06], MAX([07]) as [07]
    ,MAX([08]) as [08], MAX([09]) as [09], MAX([10]) as [10], MAX([11]) as [11], MAX([12]) as [12], MAX([13]) as [13], MAX([14]) as [14]
    ,MAX([15]) as [15], MAX([16]) as [16], MAX([17]) as [17], MAX([18]) as [18], MAX([19]) as [19], MAX([20]) as [20], MAX([21]) as [21]
    ,MAX([22]) as [22], MAX([23]) as [24], MAX([24]) as [24], MAX([25]) as [25], MAX([26]) as [26], MAX([27]) as [27], MAX([28]) as [28]
    ,MAX([29]) as [29], MAX([30]) as [30] ,MAX([31]) as [31]
    FROM (
    SELECT A.BaseColumn,
    CASE WHEN A.ColumnHeader = '01' THEN A.FigureToBePivoted END AS [01],
    CASE WHEN A.ColumnHeader = '02' THEN A.FigureToBePivoted END AS [02],
    CASE WHEN A.ColumnHeader = '03' THEN A.FigureToBePivoted END AS [03],
    CASE WHEN A.ColumnHeader = '04' THEN A.FigureToBePivoted END AS [04],
    CASE WHEN A.ColumnHeader = '05' THEN A.FigureToBePivoted END AS [05],
    CASE WHEN A.ColumnHeader = '06' THEN A.FigureToBePivoted END AS [06],
    CASE WHEN A.ColumnHeader = '07' THEN A.FigureToBePivoted END AS [07],
    CASE WHEN A.ColumnHeader = '08' THEN A.FigureToBePivoted END AS [08],
    CASE WHEN A.ColumnHeader = '09' THEN A.FigureToBePivoted END AS [09],
    CASE WHEN A.ColumnHeader = '10' THEN A.FigureToBePivoted END AS [10],
    CASE WHEN A.ColumnHeader = '11' THEN A.FigureToBePivoted END AS [11],
    CASE WHEN A.ColumnHeader = '12' THEN A.FigureToBePivoted END AS [12],
    CASE WHEN A.ColumnHeader = '13' THEN A.FigureToBePivoted END AS [13],
    CASE WHEN A.ColumnHeader = '14' THEN A.FigureToBePivoted END AS [14],
    CASE WHEN A.ColumnHeader = '15' THEN A.FigureToBePivoted END AS [15],
    CASE WHEN A.ColumnHeader = '16' THEN A.FigureToBePivoted END AS [16],
    CASE WHEN A.ColumnHeader = '17' THEN A.FigureToBePivoted END AS [17],
    CASE WHEN A.ColumnHeader = '18' THEN A.FigureToBePivoted END AS [18],
    CASE WHEN A.ColumnHeader = '19' THEN A.FigureToBePivoted END AS [19],
    CASE WHEN A.ColumnHeader = '20' THEN A.FigureToBePivoted END AS [20],
    CASE WHEN A.ColumnHeader = '21' THEN A.FigureToBePivoted END AS [21],
    CASE WHEN A.ColumnHeader = '22' THEN A.FigureToBePivoted END AS [22],
    CASE WHEN A.ColumnHeader = '23' THEN A.FigureToBePivoted END AS [23],
    CASE WHEN A.ColumnHeader = '24' THEN A.FigureToBePivoted END AS [24],
    CASE WHEN A.ColumnHeader = '25' THEN A.FigureToBePivoted END AS [25],
    CASE WHEN A.ColumnHeader = '26' THEN A.FigureToBePivoted END AS [26],
    CASE WHEN A.ColumnHeader = '27' THEN A.FigureToBePivoted END AS [27],
    CASE WHEN A.ColumnHeader = '28' THEN A.FigureToBePivoted END AS [28],
    CASE WHEN A.ColumnHeader = '29' THEN A.FigureToBePivoted END AS [29],
    CASE WHEN A.ColumnHeader = '30' THEN A.FigureToBePivoted END AS [30],
    CASE WHEN A.ColumnHeader = '31' THEN A.FigureToBePivoted END AS [31]
    FROM (
    --select empid as BaseColumn, left(convert(varchar,eventime,103),2) as ColumnHeader, 1 as FigureToBePivoted from events where eventime>'2006-06-30 23:59:59.999' and eventime<'2006-08-01 00:00:00.000' SELECT firstname + ' ' + lastname AS BaseColumn, events.ColumnHeader, events.FigureToBePivoted FROM emp LEFT JOIN ( select empid as BaseColumn, LEFT(CONVERT(VARCHAR,eventime,103),2) AS ColumnHeader, 1 AS FigureToBePivoted FROM events WHERE eventime>='2006-07-01 00:00:00.000' AND eventime<='2006-07-31 23:59:59.999' ) events ON emp.[id]=events.BaseColumn WHERE firstname + ' ' + lastname IS NOT NULL AND lastname NOT IN ('Temp Emp','Ground Floor Security','First Floor Security','Housekeeping Supervisor') AND firstname NOT IN ('Temp') ) A ) B GROUP BY B.BaseColumn ORDER BY B.BaseColumn



    reference: http://dotnetjunkies.com/WebLog/thomasswilliams/archive/2005/10/23/133383.aspx