Twitter Updates

    follow me on Twitter

    Saturday, December 23, 2006

    Google Sets

    I think Google Sets should have constructed artificial neural networks.
    Neural networks are particularly useful for solving problems that
    cannot be expressed as a series of steps, such as recognizing patterns,
    classifying into groups, series prediction and data mining.

    Neural networks are often not suitable for problems where you must know
    exactly how the solution was derived.

    Correct me if I think wrong!

    reference:
    How I think Google Sets should work
    What its uses are?

    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

    Tuesday, June 27, 2006

    WALK ON THE WILDE SIDE

    THREE Indian boys recently asked a 27-year-old archaeologist from New Zealand why the tourists in India are so rude to the Indians, and the Indian press seems puzzled by why the tourists aren't coming here. Some light on both matters. For a start, every foreign female here reports having had "hello hello" whispered in her ear, had some part of her body touched or had someone follow her and be obscene. In the daytime. No matter how she's dressed. In English.
    A 35-year-old post-graduate in education wanted to take a picture of the Prince of Wales Museum. He was stopped by the security guard, whose job it is. "But I was also subjected to a stream of abuse by some passing upper-crust Indian yelling 'bloody tourist, go home', and other offensive rubbish."
    Before we even get here we're supposed to have injections against typhoid, cholera, malaria, hepatitis, even Japanese encephalitis. The timing of the planes to and from India expose the exhausted to lying taxi-drivers with their extortion, their "breakdowns" and their "don't know the address" tours of strange cities at 3 am. Then there's road, train and plane accident statistics, possible natural disasters and the question of prompt and effective rescue. And on the well-worn tourist tracks you face non-stop clamours and lies of touts and would-be vendors.
    "Bangkok and Kuala Lumpur are crowded, but I don't think I've seen anywhere as filthy as India," says one 26-year-old teacher after 18 months travelling in the Far East, Australia and India. India in reality is a contrast for someone whose best friend 'at home' is Indian neighbours have shown her pictures of a beautiful country, or who was raised in a predominantly Asian district of an English city with Asian school-friends.
    We saved for years to come here. After being treated as walking cash dispenser, walking sex dispensers, and being ripped off at every step, what can we say to people who ask "Ah hi, how was India?"
    We would really appreciate some understanding of our position here. We are not all rich, and we do not all like shouting and swearing. But we are all being harassed and insulted, in the street and in the media, at just about every turn, and it is exhausting.

    OUTLOOK September 3, 2001
    ELIZABETH WILDE:(The author is a British academic based in Mumbai.)

    CIA'S TOY GONE AWRY

    IRONICAL as it may sound, Osama bin Laden, the most wanted man in the world and the perceived symbol of evil, received his first lessons in the art of clandestine operations and subterfuge from the CIA.
    In the late '70's. It was at Jawora base near Host, Afganistan, that US intelligence set up a training ground to equip young men to fight a guerrilla battle against the erstwhile USSR.
    Belonging to the royal Saudi family, bin Laden was a VIP student of the CIA. Fired by a strong anti-Left stand, bin Laden lanuched his operations against the Soviet troops in Afganistan with religious fervour.
    The once-favoured pupil of the CIA is the one man the agency now badly wants. The motivation against the US is its alliance with Saudi Arabia during the Gulf War and its anti-palestine position; Israel is on his hit-list for Zionism and India, for Kashmir.
    **No one terrorist is known to have such a wide-ranging agenda.**

    OUTLOOK September 24, 2001

    Cutting a jewel from the crown

    FROM HIGH ATOP the Himalaya, snow-melt flows down the Ganges, Brahmaputra, and Indus Rivers, nourishing a fertile plain that has sustained civilisations for more than 4,000 years. Harappans, Aryans, Greeks, Huns, Muslims, Portuguese, and French, among others, all settled and shaped the Indian subcontinent, perhaps none with greater impact than th British.
    By the mid-1800s Indians were chafing under Britain's imperial yoke, although their resistance lacked unity and direction. Not until Mohandas Gandhi assumed leadership of the Indian National Congress in 1920 did the drive for independence become a truly mass movement.
    What sort of nation should an independent India become? Some Muslims considered life amid the Hindus intolerable and demanded a separate Islamic state(the future Pakistan). The British agreed to partition, but Gandhi warned, "You will have to divide my body before you divide India."

    VOL. 191, NO. 5 MAY 1997 NATIONAL GEOGRAPHIC

    War in Kashmir*

    Kashmir, a princely state inhabited predominantly by Muslims, became the next major source of friction between India and Pakistan. Here, the situation was the exact opposite of that in Junagadh. On Oct. 24, 1947, Muslim insurgents, supported by invading coreligionists from the North-West Frontier Province, proclaimed establishment of a "Provisional Government of Kashmir." Three days later the Hindu leader Hari Singh, maharaja of Kashmir (1895-1961), announced the accession of Kashmir to the Union of India. Approving the maharaja’s decision and promising a plebiscite after the restoration of peace, the Indian government immediately dispatched troops to Srinagar, the capital of Kashmir and the major objective of the insurgents. Hostilities quickly attained serious proportions, and at New Year 1948 the Indian government filed a formal complaint with the UN Security Council, accusing Pakistan of giving help to the Muslim insurgents. Despite repeated attempts by the Security Council to obtain a truce in the troubled area, fighting continued throughout 1948. The peacemaking efforts of the Security Council finally met with success at New Year 1949, when both India and Pakistan accepted proposals for a plebiscite, under the auspices of the UN, on the political future of Kashmir. Cease-fire orders were issued by the two governments on the same day. Among other things, the UN plan provided for the withdrawal of combat troops from the state, for the return of refugees desirous of participating in the plebiscite, and for a free and impartial vote under the direction of a "personality of high international standing." In March UN Secretary-General Trygve Lie appointed U.S. Adm. Chester W. Nimitz administrator of the Kashmir plebiscite, scheduled for later in 1949. Meanwhile both the Union of India and Pakistan had suffered the loss of outstanding leaders and the Indian government had become embroiled in a dispute with the nizam of Hyderabad, Mir Osman Ali Khan Bahadur (1886-1967). Gandhi was assassinated by a Hindu fanatic on Jan. 30, 1948, and Jinnah, the founder of Pakistan, died the following September. The tension between the Indian government and Hyderabad, inhabited preponderantly by Hindus, resulted from the reluctance of the nizam, a Muslim, to bring his state into the Union. Protracted negotiations for a peaceful solution of the dispute ended in failure and on September 17 Indian forces occupied Hyderabad, the capital city, ending the nizam’s resistance. The ruler subsequently signed instruments of accession making Hyderabad part of the Union of India. Although India and Pakistan agreed (July 1949) on a line demarcating their respective zones of occupation in Kashmir, the two nations were unable to reconcile basic differences on the terms of the proposed plebiscite. The deadlock was primarily due to Indian insistence that Pakistani troops be withdrawn from the disputed territory before the plebiscite and to Pakistan’s refusal to withdraw its troops unless the Indians also withdrew theirs.

    SIMON & SCHUSTER NEW MILLENNIUM ENCYCLOPEDIA AND HOME REFERENCE LIBRARY 1999 AND BEYOND*