?umbDebugShowTrace=trueIt enables the tracing information that may, or may not help identify the problem. In my case, not so much, but it's handy non-the-less.
Monday, December 17, 2012
We use Umbraco as our Content Management System. Today, I had an error pop up, and I needed to debug it. I found this useful tip. Call your umbraco page and pass it this query string
Tuesday, November 13, 2012
How to Write to an Identity Field
We have an online application system for folks who are registering as an EMT or Paramedic. We received a request from one of our clerks, to delete an application from our database.
Our database is Microsoft SQL Server 2000.
Turns out the record wasn't to be deleted anyway. So I get yesterday's backup of the database, and go to insert the deleted rows. I got an error saying that I can't insert into an identity column.
In order to properly restore the database, I needed to restore the ID. After some searching, I found the solution.
Assuming that you are restoring a record to the foo table, the following fixes the problem
Our database is Microsoft SQL Server 2000.
Turns out the record wasn't to be deleted anyway. So I get yesterday's backup of the database, and go to insert the deleted rows. I got an error saying that I can't insert into an identity column.
In order to properly restore the database, I needed to restore the ID. After some searching, I found the solution.
Assuming that you are restoring a record to the foo table, the following fixes the problem
SET IDENTITY_INSERT dbo.foo ON
INSERT dbo.foo
(ID, Occurred, [Status])
Values (1234,'2011-08-09 09:27:51.383','new');
SET IDENTITY_INSERT dbo.foo OFF
Monday, September 17, 2012
Our Office's HR person wanted us to submit a vacation-use form to account for taking off early after working late earlier in the week. For example, if I worked over two hours on Monday, and knocked-off two hours early on Tuesday, she wanted a vacation form to show why I wasn't at work for the two hours on Tuesday.
The problem is that our vacation-use form wasn't designed for such a thing, and I needed to modify it to fit this need.
Alas, some well-meaning soul had placed a password on the file that prevented me from adding the extra category.
Since I didn't know who that well-meaning soul was, I went to the all-knowing Google. I found this tip so helpful that I wanted to share it.
Thanks to James Welch at Jameswelch.com, I have the answer.
More details can be located here
The problem is that our vacation-use form wasn't designed for such a thing, and I needed to modify it to fit this need.
Alas, some well-meaning soul had placed a password on the file that prevented me from adding the extra category.
Since I didn't know who that well-meaning soul was, I went to the all-knowing Google. I found this tip so helpful that I wanted to share it.
Thanks to James Welch at Jameswelch.com, I have the answer.
- Save the password-protected document in RTF.
- Open the file using your favorite text editor.
- Find the string {\*\passwordhash ########}, where the ######## represents the password hash. (hint look for the passwordhash portion.)
- Remove the hash
- save the file
More details can be located here
Tuesday, August 14, 2012
The Right Cred
I have a very long running update to a SQL database that I need to tame. The problem is that the database to which this process writes is a production system, and the data just has to be there. I need to make optimization changes and not have to worry about shutting down production if my efforts fail.
While the real answer is only downloading those records that have changed, I need to have a the database update fixed so we can use the data and so I can verify the correctness of the incremental approach when I finish.
I say all of that to say this. I backed up the database using the
It seems that the SQL Server services is running at local-only credentials. The only way to restore the file is to copy the file to the local drives, or change the user that the service uses to a domain user. You see, I assumed that since I was using the front end, it would be using my network credentials. Not so.
So, I copied the file, and attempted to restore the file. It didn't work.
Seems like I have to specify a new MDF file name for the restored file with a MOVE clause.
But, to use the MOVE clause, one must know what to move. That's where this statement comes in.
I combined all this knowledge to produce
RESTORE DATABASE newdatabasename
FROM DISK ='path to bak file'
WITH MOVE 'logical name of database' to 'path to the mdf file',
MOVE 'logical name of log file' to 'path to the ldf file'
While the real answer is only downloading those records that have changed, I need to have a the database update fixed so we can use the data and so I can verify the correctness of the incremental approach when I finish.
I say all of that to say this. I backed up the database using the
BACKUP DATABASE databasename TO DISK ='d:\sql\backup\databasename.bak'I stored the backup on the network share, to free up the room on the server. I attempted to restore the backup, to create a copy of the database, found that I couldn't do it.
It seems that the SQL Server services is running at local-only credentials. The only way to restore the file is to copy the file to the local drives, or change the user that the service uses to a domain user. You see, I assumed that since I was using the front end, it would be using my network credentials. Not so.
So, I copied the file, and attempted to restore the file. It didn't work.
Seems like I have to specify a new MDF file name for the restored file with a MOVE clause.
But, to use the MOVE clause, one must know what to move. That's where this statement comes in.
RESTORE FILELISTONLY FROM DISK ='location of backup file'This command lists the logical and physical names of a database inside the backup file.
I combined all this knowledge to produce
RESTORE DATABASE newdatabasename
FROM DISK ='path to bak file'
WITH MOVE 'logical name of database' to 'path to the mdf file',
MOVE 'logical name of log file' to 'path to the ldf file'
.
Friday, June 29, 2012
Text shadows
We should strive to learn everyday, especially in computers. Just because you did something yesterday one way, doesn't mean that there isn't a better way to do it today.
Case in point is today and what I learned about text shadows. Besides making text look more attractive, shadows can improve contrast and readability when using a text color that doesn't pop as well with the background as you would like.
I was building a web page and wanted the colors of the headings to match the colors in the logo graphic. The colors were blue and gold, and the gold header didn't pop against a egg-shell background. I said "I need a drop shadow here."
In the past, I would have went to the GIMP (my favorite image editor. It's free and very powerful.) and created a graphic with the text shadow. But, I heard of a CSS property, text-shadow, that would do it. I tried it and it worked wonderfully. Well, wonderfully in everything but IE. But, since 54% of the desktop market runs IE, this will not do.
While nobody has ever accused Microsoft of being standards-compliant, they aren't slackers either. There's usually a Microsoft-specific way of doing something when the compliant-specific way doesn't work.
And, of course, there is. I found a really handy filter to use from Heygrady.com . Please note: it's not fast, so if your page is a bandwidth-hog, use the graphics method instead.
The code would be
Case in point is today and what I learned about text shadows. Besides making text look more attractive, shadows can improve contrast and readability when using a text color that doesn't pop as well with the background as you would like.
I was building a web page and wanted the colors of the headings to match the colors in the logo graphic. The colors were blue and gold, and the gold header didn't pop against a egg-shell background. I said "I need a drop shadow here."
In the past, I would have went to the GIMP (my favorite image editor. It's free and very powerful.) and created a graphic with the text shadow. But, I heard of a CSS property, text-shadow, that would do it. I tried it and it worked wonderfully. Well, wonderfully in everything but IE. But, since 54% of the desktop market runs IE, this will not do.
While nobody has ever accused Microsoft of being standards-compliant, they aren't slackers either. There's usually a Microsoft-specific way of doing something when the compliant-specific way doesn't work.
And, of course, there is. I found a really handy filter to use from Heygrady.com . Please note: it's not fast, so if your page is a bandwidth-hog, use the graphics method instead.
The code would be
h1{The great thing about this is that everybody but IE ignores the filter property, and IE ignores the text-shadow property.
text-shadow: 2px 2px 2px #000000;
filter: progid:DXImageTransform.Microsoft.Shadow(direction=135, strength=2,color=000000);}
Friday, May 11, 2012
Concatenate stings with nulls
I was pulling a report in SQL Server, and getting strange results.
SELECT FIRSTNAME + ' ' +The result set had ContactName as null whenever any of the three fields were null. Any field concatenated with a null will be null. The way to fix that is to wrap a ISNULL function around the field like this.
MIDDLENAMEORINITIAL + ' ' +
LASTNAME as ContactName,
EMAILADDRESS
FROM aTable
SELECT ISNULL(FIRSTNAME,'') + ' ' +This works with no problem!
ISNULL(MIDDLENAMEORINITIAL,'') + ' ' +
ISNULL(LASTNAME,'') as ContactName,
EMAILADDRESSS
FROM aTable
Subscribe to:
Posts (Atom)