Friday 19 December 2008

Removing XP from Windows Boot Manager

The other day I figured I'd try installing XP on my Vista lappie. Unfortunately, I did not bother to read properly, and just went ahead and tried. Now one problem I have is that my DVD drive in the laptop has been wonky from the getgo. I also did not bother creating a second partition (d'oh).

Anyway, after starting the installation and going through the initial setup steps, my laptop started showing a new screen called Windows Boot Manager which showed the new XP setup, and was for some reason using that as a default boot. The end result was constant blue screens.

I eventually solved the problem by first having Vista display hidden folders and files, as well as OS files. Having done that, removing the XP entry is as simple as deleting the boot.ini file from the root folder of the drive. You can also remove the XP install folders called $WIN_NT$.~BT and $WIN_NT$.~LS.


Read more!

Monday 8 December 2008

Business Objects - Custom entry to list of values

After recently having joined a new employer, I'll be blogging a bit more about Business Objects and some tricks and tips to get certain stuff done.

Let's start with adding a custom entry to a list of values (lov). In this case, we want to give a user the ability to select in order to select all the values in the lov.

First we of course create the lov itself. In this case, Iøll show a mockup of a lov of clients that pulls data from a table created specifically for the purpose. Imagine that during the ETL process, a SELECT DISTINCT (ClientName) fills the table every night, in order to avoid having to do the SELECT every time an end-user retrieves an updated copy of the universe. It would look something like the following:





With the list of values itself in place, we now create a new object that will contain a dummy string called . In Oracle, we can do this by referencing the SYS.DUAL table. Let's start by creating the value itself:



Add the SYS.DUAL tab le to the universe, and then proceed by clicking on the "Table" button. There, select sys.dual from the list of tables. This will ensure the object will parse properly.

Now open the original list of values again, and select the "properties" tab. Supply a meaningful name for the list of values, and then click the "Edit" button. Here, we will add the newly created object to the existing list of values. Click on the "Combine Queries" button (circled) in order to add the extra object. You will notice a second tab called "Query 2" appearing. Delete the existing variable there, and select the object:



Click "OK" twice to return. At this stage, I usually choose to hide the object, as its only purpose is to enhance the list of values already there. It also is recommended to ensure that on the properties page of the object, you turn off "Associate a list of values".

To finish up, create a filter prompting the user to select a value from the list of values. To this, we will add the option to also select . It would look something like the following (this does assume there is an object "Blog\Client" available, from which the value will be compared with the filter):



This should do the trick. Please be aware that the screenshots contain mockups that have not been validated against a real database, and therefore they might be not neccessarily work 100%. If you find this is the case, please let me know, and I will try to do it over again, and ensure it works against the eFashion universe.


Read more!

Monday 9 June 2008

Failed to execute the request because the ASP.NET process identity does not have read permissions to the global assembly cache. Error: 0x80070005

I started working on a new website yesterday, and this time, rather than starting it as a webpage, I figured I'd use the proper TheBeerHouse (TBH) approach, and actually create a blank project, and then add the website as an existing project to it.

I referenced the other projects required for everything to run (a web captcha control and a CustomEvents project), renamed all the namespaces, and figured I'd be on my way.


But my trustworthy Internet Explorer decided to give me hell, and just showed a page with an error message in bold red:

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.

Administrator Note: An error message detailing the cause of this specific request failure can be found in the system event log of the web server. Please review this log entry to discover what caused this error to occur.


The application log showed the following messages (abbreviated)

Failed to initialize the AppDomain:/LM/W3SVC/1/Root/

Exception: System.IO.FileLoadException

Message: Could not load file or assembly 'System.Web, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Access is denied.

Followed by:

Failed to execute the request because the ASP.NET process identity does not have read permissions to the global assembly cache. Error: 0x80070005 Access
is denied.


And finally:


aspnet_wp.exe (PID: 1924) stopped unexpectedly.

As it turns out, due to setting up the site as a project, ASP.NET doesn't automatically get its permissions assigned to the project folder. Doing that manually solved the problem.


Read more!

Security tab missing in XP

I was troubleshooting an annoying problem on my PC when I ran into another annoying problem. Whenever I wanted to check access rights to a specific folder, there was no "Security" tab available. Kind of makes it hard to determine whether the account has the proper permissions.

Here's how to solve it:

1) Open up Windows Explorer.
2) Tools -> Folder Options -> View
3) All the way at the bottom of the listbox under "Advanced settings", ensure “Use simple file sharing (Recommended)” is not checked.
4) Click OK, and check permissions at will.

(I can see why simple file sharing is recommended by default, but some form of indication would have been nice).


Read more!

Monday 12 May 2008

Collation and CHECKSUM do not play together nicely.

If you work with data warehouses, like yours truly, most likely you’ve had to write code that checks your dimension tables for changes. Our usual approach is to pump the most recent copy of the table into a staging table, and then compare it to the latest version of the data.

Roughly, the comparison would be something like:

SELECT
P.Column1
, P.Coulmn2
FROM
ProductionTable P
INNER JOIN StagingTable S ON P.PKID = S.PKID
WHERE

Followed by a piece of code where the individual columns are compared. There’s two methods that we use: A column by column comparison (WHERE P.Column1 != S.Column1 OR P.Column2 != S.Column2), or a CHECKSUM method, where a CHECKSUM is done over all the columns of the staging table, and compared against the CHECKSUM over all the columns of the production table (WHERE CHECKSUM(S.Column1, S.coulmn2) != CHECKSUM(P.Column1, P.Column2).


Today, when testing some new code, I found that even though the values in the two tables were identical (except for one column I excluded), and yet, SQL Server reported the checksums to be different. A bit more investigation revealed that the reason behind this was because of collation differences. For those of you who never heard of it (I didn’t until about a year ago, despite having worked with databases for 5+ years in numerous international organizations), here’s an excerpt from BOL (“Selecting collations”):


Collations specify the rules for how strings of character data are sorted and compared, based on the norms of particular languages and locales. For example, in an ORDER BY clause, an English speaker would expect the character string 'Chiapas' to come before 'Colima' in ascending order. But a Spanish speaker in Mexico might expect words beginning with 'Ch' to appear at the end of a list of words starting with 'C'. Collations dictate these kinds of sorting and comparison rules. The Latin_1 General collation will sort 'Chiapas' before 'Colima' in an ORDER BY ASC clause, while the Traditional_Spanish collation will sort 'Chiapas' after 'Colima'.


Now the source system we pull our data from has a default collation of US-English, and our warehouse system uses Norwegian/Danish. Essentially, this means whenever we try and run comparison checks or updates between staging and production, we have to add a COLLATE DATABASE_DEFAULT clause in order to “convert” one set of values to another. That this also was an issue with CHECKSUM never occurred to me.

Here’s some sample code to prove my point. We create a test table with two different collations, and insert identical values into them. First, we’ll run a SELECT to see the CHECKSUMs are different, a second select which does a collation conversion on the US-column, and finally a statement that boxes the “other” collation column to the proper one for the database, which will result in an identical CHECKSUM. The code was run on a database with a US collation, by the way:

CREATE TABLE dbo.CHECKSUM_TEST
(
US nchar(10) NULL,
DK nchar(10) COLLATE Danish_Norwegian_BIN NULL
) ON [PRIMARY]

INSERT INTO CHECKSUM_TEST
(US, DK)
VALUES ('foo', 'foo')

INSERT INTO CHECKSUM_TEST
(US, DK)
VALUES
('bar', 'bar')

SELECT US, DK, CHECKSUM(US), CHECKSUM(DK)
FROM CHECKSUM_TEST

SELECT US, DK, CHECKSUM(US), CHECKSUM(DK COLLATE DATABASE_DEFAULT)
FROM CHECKSUM_TEST

DROP TABLE CHECKSUM_TEST

I’ve deliberately used Unicode rather than non-Unicode for the columns, to prove that doesn’t really help to deal with this particular issue. Below are the results from the three statements:

US DK
---------- ---------- ----------- -----------
foo foo 59294611 24735
bar bar -2088615046 25698

(2 row(s) affected)

US DK
---------- ---------- ----------- -----------
foo foo 59294611 24735
bar bar -2088615046 25698

(2 row(s) affected)

US DK
---------- ---------- ----------- -----------
foo foo 59294611 59294611
bar bar -2088615046 -2088615046


The lesson learnt here is to be careful when using CHECKSUM in combination with mixed collations, and when you do, it’s important to use the COLLATE statement on the proper column ;)


Read more!

Friday 1 February 2008

How to use a Mac

Instructions on how to use a Mac:

1) Unplug Mac from any electrical input.
2) Get 1 gallon of water. Personally, I find water from the toilet works fine. If you're environmentally friendly, or your name is Al Gore, rainwater is the way to go.
3) Pour the water into any crevice in the Mac you can find.
4) Take a 5 minute break while surfing www.microsoft.com and chanting "WINDOWS, WINDOWS, WINDOWS".
5) Find a heavy object. Anvils, bowling balls, Oprah, whatever. Tie heavy object to the Mac.
6) Open the window. If the number of your floor is less than 5, take the stairs up, or find another building.
7) Drop Mac out of the window onto concrete underground (best results achieved when no potential passerby's are between Mac and concrete when gravity does its wonderful work).
8) Grab sledgehammer and go outside.
9) Until no pieces of the Mac are bigger than 1 square centimeter, bring down sledgehammer onto Mac.
10) You're done! Now go back inside, buy a REAL computer, and read Bill Gates' memoires.


Read more!

Thursday 17 January 2008

.NET Framework source code available!

Granted, this has little to do with developing the website (something that I've been slacking in for a bit now), but it's just damn cool.

Scott Guthrie posted a note yesterday that the source code of the .NET Framework Libraries is available now. This means you can actually debug the Microsoft .NET classes!

In the comments he also mentions that a downloadable version will be made available as well, which ensures you don't have to be online to see the source.

Very cool. Read more on Scott's blog here.


Read more!

Monday 14 January 2008

[w] - Waiting for

How often doesn't it happen that you find yourself digging through your mail in order to see if there's anything you initiated, but for which you are dependant on others?

If you're chaotic like me, that happens quite a lot. Often I'll have tried setting things in motion, only to find out later that nothing happened so far. Usually this means I'll have to waste quite a bit of time digging through my mail in order to see when I sent the mail, to who, and whether anything happened.

This morning I came across an easy tip that will possibly save me all that time. In short, you create a new Outlook folder, and a rule that checks your outgoing mails. Should your mail contain a [w] tag, it will automatically be moved to your newly created folder, and you'll have a very easy way to have all items that require interaction from others listed together in a single spot.

Find out more on http://waiting-for.com/.


Read more!

Friday 4 January 2008

SQL Server 2005 varchar(max) in C#

An interesting question at work today: How to properly define a parameter that's varchar(max) in Sql Server 2005 from within C#?

Sure, it should be possible to use the signature without adding the integer value. But what if a custom DataAdapter is being used that does require a value if you supply a string? We could use 4000 as a value, but that kind of defeats the purpose of using the new datatype. 8000 then? Same difference; you still possibly end up with truncated strings. Should we make it 2bn? That's 2GB of memory. Not really an otpion in my book.

After some googling, we found the answer: the size of the parameter should be set to -1. There's an example here, where the -1 value is not explained in detail, but just shown in the code. We tested, and it works like a charm.


Read more!