YUI Menu & IE7 – Submenus Closing

Big fan of the whole set of YUI tools (http://developer.yahoo.com/yui/), but recently I’ve had an issue with the YUI Menu. The version I was using is the latest, v2.6.0

I use the YUI menu as a vertical menu, at the top of my web application. The menu and the application are quite extensive.  The menu system I use has the root menu, then when dropping down there are single items and submenus. I never go past a single tier of submenus.

It’s always worked great on my computer, until I upgraded to IE7. Each time I would use it, and try to click on a item in the submenu, the damn thing would close on me. It wasn’t 100% of the time, but well over 75% of the time. I eventually worked out a trick where if I held down the mouse button, and then moved the mouse I could keep the submenu open.

While a very small percentage of my user base is IE7 browser users, I couldn’t imagine what they were going through. It was annoying the hell out of me, and just made the entire application look bad.

After checking it on firefox, chrome, and IE6, I was able to realize it is just an IE7 issue. Unfortunately, I didn’t really find anyone else via google with this same problem.

After playing with it I finally fixed it:

1. I noticed that when the submenu was closing, it seemed to be finding elements behind it.

2. I increased the z-index of the menu. While this did not work alone, I still believe it helps.

3. When z-index didn’t work, I noticed in the documentation this nugget:

iframe Boolean false (true for IE) (Inherited from YAHOO.widget.Overlay.) Boolean indicating whether or not the Menu should have an IFRAME shim; used to prevent SELECT elements from poking through an Overlay instance in IE6. When set to “true”, the iframe shim is created when the Menu instance is initially made visible. This property is only applied when the “position” configuration property is set to dynamic and is automatically applied to all submenus.

4. While that appears to include IE7 in the default, I decided to force it on anyhow.

BAM! Submenu items fixed, YUI menu is wonderful again! No noticeable downside to Firefox and Chrome. Life is good.

Transfer a domain between Godaddy Accounts

Today, I was a little hard on godaddy because I found a more suitable web host, but I want to give godaddy a little credit.

Somehow years ago, I created two godaddy accounts. I don’t remember how or why this happened, but its so annoying. I’ve always wanted to move those domains to a single account, but short of letting them expire or going through a complicated process similar to selling I couldn’t find out how to do it. It was an annoyance so I wasn’t about to spend a lot of time on it.

Yesterday, while moving web hosts, I discovered a some what recent godaddy feature. You can move your domains to another godaddy account. Their support system didn’t really explain how it works, so I’m going to try to explain it from memory.

1. I found a transfer/move option, one of them was to another godaddy account.

2. It asked me to enter the godaddy account’s username I was going to transfer it to.

3. It then required that I put in some contact information for the new account.

4. I signed off that I wasn’t going to change registars within 60 days and some other warnings.

5. I then received a few emails from godaddy, as they began to process it.

6. About 10 mintues into the process, on the account i was going to transfer them I was able to accept it. I had to complete the same forms again.

7. All done! It took about 3 minutes of actual work and about 20 minutes of godaddy processing time.

Thanks godaddy!

Steadfast Networks – Review – Day 1

I’ve made the switch. I’m extremely picky about web hosts, and I don’t have many crazy requirements. I barely use any disk space or bandwidth, and although I care about uptime, I probably wouldn’t notice it if I went down for a while.

What I care about is a good price, the ability to pay monthly, quick, and instant access. I am looking for something more of a playground. I program all day at work, so I want to try out new things in my free time. If they don’t work, no big deal.

That being said, I think I found my soulmate in Steadfast Networks. Now, I’ve only been a customer for a little over 24 hours, but so far I’ve had a great experience.

I was a godaddy customer at their $4.95 a month plan. I was only allowed to host this domain. Their control panel while extensive was difficult to navigate and every major action seemed to take several minutes for the server to process. I don’t fault them, but I wasn’t thrilled.

The other day, I discovered that some web hosts are offering an “unlimited domains” under a single account. This was perfect for me, I could play on multiple domains for the same low price. So I began the search for a new provider since godaddy did not offer this service in their basic package.

After reading a ton of reviews, I took a serious look at Site5, Bluehost, and Hostgator. While Bluehost and Hostgator looked great, I didn’t like the fact that you had to sign up for a year. There’s little chance I would leave within a year, but if the service is terrible right at the start, I would want to move. So, sorry Bluehost and Hostgator.

I came within minutes of signing up with Site5, until I found hostjury.com which seems to be one of the few websites host reviews that isn’t an obvious marketing site for a web host. Site5, while it seemed to enjoy great ratings before, was recently bombing out on Site5. Supposedly, some new management was causing problems. While I can’t confirm this one way or the other, I decided not to go with them.

From hostjury, coming in around #5 was Steadfast Networks. From the reviews, the customers seemed to love them. They offered multiple domains and I could pay monthly if I so desired. After doing some snooping, I signed up with their 2nd level account at $4.95 a month.

I was blown away by how quickly I had access to the account and how wonderful their control panel was. It was simple and straight forward. Let’s be honest, most people using these control panels know a thing or two about computers and we don’t need to be glamored by graphics. We just want to be able to do things quickly ::cough godaddy cough::. I transfered a few domains from godaddy paid and free hosting and within minutes the sites were up and running. Multiple domains under a single account.

I tried their one click install of wordpress, and while it worked it was a few versions behind. I decided I’d do it myself. Steadfast’s DB tool was great, the FTP worked immediately, and everything seemed great. Within an hour I had several blog software up and running.

As of right now I’d give Steadfast Networks a 10/10. As long as the uptime is reasonable and they don’t screw up billing I don’t see where this could go wrong. I’ll try to update as I get some more time on their servers.

ClickOnce Cert Expired Issue Solved By RenewCert of May.be

Yesterday, I went to publish a new version of our clickonce application, when I was greeted by a message that Visual Studio wasn’t going to let me publish, because our certification had expired. Oh no.

We’d often talked about getting a real certification and not using the temporary one, but we never saw the real benefit, and now in hindsight, I’m really glad we did not.

So, here’s the problem:

After your first clickonce publish, Visual Studio creates a certification key file, and stores it in your project as “ProjectName_TemporaryKey.pfx”. As far as I can tell, this is used only to sign the manifest it’s never sent to the client. The only visible downside is when installing the application, it warns that it’s an unknown publisher. This temporarykey, like actual keys are good for one year from the issue date.

Once that year is up, you can’t publish anymore. If you change certs, your updates no longer work (The deployment identity does not match the subscription. ) and everyone has to reinstall the application. It seems that Microsoft acknowledges that this was by design but it was bad design, and I believe it’s much better in VS 2008.

So panic sets in, we talk about abandoning clickonce, how to get these updates to people in the mean time. We found a knowledge base article, which offers two work arounds. http://support.microsoft.com/kb/925521

The first work around is out of the question, if we do that, we get rid of clickonce for good.

The second work around, sounds confusing and I feel like we get one shot, if that doesn’t work the project is gone.

Then, I find my new favorite website: http://www.may.be/renewcert/, A wonderful person, Cliff Stanford, seems to have encountered this problem, and took Microsoft’s Workaround #2 and made it better and offered some real help.

I downloaded his version of renewcert, and tried it on one of my temporarykeys. I used the following command at first: renewcert MyProject_TemporaryKey.pfx MyProject_FiveYearKey.pfx CN=”My Company” super_dooper_password

It failed.

I got the following error:

PFXImportCertStore failed with error 0×56: The specified network password is not correct.

I didn’t see any mention of this on Cliff’s site so I started to get worried again. Decided to try again, this time, I looked at how the temporarykey was issued.

renewcert MyProject_TemporaryKey.pfx MyProject_FiveYearKey.pfx CN=”MYDOMAIN\MYUSERNAME” super_dooper_password

I had no clue what to use as password, my current domain password? The one from a year ago? I did some googling and found that when VS creates these certs, it doesn’t use a password, so I left it off:

renewcert MyProject_TemporaryKey.pfx MyProject_FiveYearKey.pfx CN=”MYDOMAIN\MYUSERNAME”

It worked! I went into VS, went to the Signing Tab in the project properties, did “Select From File”, picked my new fiveyear cert. It added it to the project for me, and extened my expiration date to 2013!

IF we would have used a real certification, I think we would have been in trouble. You would need your certification agency to issue you a new cert every year, but it would have to use the same key. This isn’t something they do often.

So, we’re going to keep on keeping on, and migrate off of ClickOnce eventually, but atleast we were bought some time. I’m suprised this issue only cost me about an hour of my time, and a little worrying.

Thank you Cliff Stanford of may.be

Duplicate a database via T-SQL

I needed to make a stored procedure that could make a copy of a database on a SQL 2005 server. I wanted to do it entirely through T-SQL.

I found this excellent guide at: http://weblogs.asp.net/mschwarz/archive/2004/08/26/220735.aspx

So, thank you Michael’s blog for the start, but the problem was it did not seem to work on SQL2005. So I had to make a few changes:

So starting with Michael’s original code I made the following modifications:

1.  Added INIT to the backup database. This tells the sql server not to append to the backup file but to overwrite it. I was going to run this fairly often so I did not need a ever growing backup file.

2. I got rid of the drop. Instead the procedure only runs if the database does not already exist. I did not feel comfortable with this.

3. RESTORE FILELISTONLY FROM DISK appears to return a different result set than it did in SQL2000, so I had to update the temptable.

4. @@ROWCOUNT and RESTORE HEADERONLY FROM DISK were not playing nicely together in 2005. It always returned 0 records. Instead of fight with it, I did away with the file argument in the BACKUP DATABASE. So this does concern me that if the backup fails it will attempt to restore it. But it’s a risk I’m willing to live with at this time.

So here’s my changes to Michael’s code. All credit to him for sharing the original method:

USE master
GO

– the original database (use ‘SET @DB = NULL’ to disable backup)
DECLARE @DB varchar(200)
SET @DB = ‘PcTopp’

– the backup filename
DECLARE @BackupFile varchar(2000)
SET @BackupFile = ‘c:\pctopp\sqlserver\backup.dat’

– the new database name
DECLARE @TestDB varchar(200)
SET @TestDB = ‘TestDB’

– the new database files without .mdf/.ldf
DECLARE @RestoreFile varchar(2000)
SET @RestoreFile = ‘c:\pctopp\sqlserver\backup’
– ****************************************************************
–                    no change below this line
– ****************************************************************

DECLARE @query varchar(2000)
DECLARE @DataFile varchar(2000)
SET @DataFile = @RestoreFile + ‘.mdf’
DECLARE @LogFile varchar(2000)
SET @LogFile = @RestoreFile + ‘.ldf’
IF @DB IS NOT NULL
BEGIN
SET @query = ‘BACKUP DATABASE ‘ + @DB + ‘ TO DISK = ‘ + QUOTENAME(@BackupFile, ””) + ‘ WITH INIT’
EXEC (@query)
END

IF NOT EXISTS(SELECT * FROM sysdatabases WHERE name = @TestDB)
BEGIN
DECLARE @File int
RESTORE HEADERONLY FROM DISK = @BackupFile
SET @File = @@ROWCOUNT
DECLARE @Data varchar(500)
DECLARE @Log varchar(500)
SET @query = ‘RESTORE FILELISTONLY FROM DISK = ‘ + QUOTENAME(@BackupFile , ””)
CREATE TABLE #restoretemp
(
LogicalName varchar(500),
PhysicalName varchar(500),
type varchar(10),
FilegroupName varchar(200),
size int,
maxsize bigint,
FileID bigint,
CreateLSN numeric(25,0),
DropLSN numeric(25,0),
UniqueID uniqueidentifier,
ReadOnlyLSN numeric(25,0),
ReadWriteLSN numeric(25,0),
BackupSizeInBytes bigint,
SourceBlockSize int,
FileGroupID int,
LogGroupGUID uniqueidentifier NULL,
DifferentialBaseLSN numeric(25,0),
DifferentialBaseGUID uniqueidentifier,
IsReadOnly bit,
IsPresent bit
)
INSERT #restoretemp EXEC (@query)
SELECT @Data = LogicalName FROM #restoretemp WHERE type = ‘D’
SELECT @Log = LogicalName FROM #restoretemp WHERE type = ‘L’
PRINT @Data
PRINT @Log
TRUNCATE TABLE #restoretemp
DROP TABLE #restoretemp

SET @query = ‘RESTORE DATABASE ‘ + @TestDB + ‘ FROM DISK = ‘ + QUOTENAME(@BackupFile, ””) +
‘ WITH MOVE ‘ + QUOTENAME(@Data, ””) + ‘ TO ‘ + QUOTENAME(@DataFile, ””) + ‘, MOVE ‘ +
QUOTENAME(@Log, ””) + ‘ TO ‘ + QUOTENAME(@LogFile, ””)
EXEC (@query)

END