Tuesday, January 27, 2009

Accessing images from Google Sites

I recently wanted to modify my blog template a bit and had to create my own images and use them. I decided to upload the images to Google sites, where I have kept a bunch of my other files and preferred to maintain them all in one single location.

I uploaded the .gif images which had transparent areas in them and I copied the link and added to my harness blog and tested. I noticed that it displayed fine in Chrome, Firefox, Opera and Safari, but not really so in IE 6.

The transparent areas of the file were filled with a light blue color which was sufficient enough to mangle the appearance of the page.

The problem was with the URL I had used. The actual URL from the Google Sites was:

For some reason, I found that query at the end of the URL to be unnecessary and removed it and hence faced this error.

This is what you see when accessing this link in IE6 (notice the blue/gray area? That is supposed to be transparent)

This is what you see when accessing this link in IE6 (notice the ?attredirects=0 query string)

Fiddling with this further showed that when the attredirects=0 query string is passed along, Google appends the URL with an “auth” key value which in turn redirects to a more messy URL. Not sure what happens internally, probably they extract it from some location and authenticate if the file is available to all users, but adding that query string value back to the URL fixed things.

Update 1
Apparently there has been some issues with accessing images from Google sites:

Not sure what exactly Google does to fetch the image and why it would behave differently without the query string input.

Modifying Blogger Template – Resizing main Blog Area

The Google blogger has a decent bunch of templates to choose from and when I had to choose one I took a couple of minutes to think.

I would be posting code snippets and occasionally diagrams or images, maybe screen captures to explain something. But primarily the content will mostly be text with a lot of code.

I did not want a dark background with white fonts – I think no one will ever want to use that for writing technical content. Somehow I did not like the fully white templates as well. Most of the templates offered looked too simple and without many colors.

I finally chose the Rounders-3 (Green version) because it was simple and slick and the colors were fine and looked professional. However there was one drawback with it which I noticed as I started to post. The space reserved for the main blog was too little and any post that I did looked obtrusively lengthy. The code snippets that I posted had to be broken down to multiple lines despite using a smaller font. Making the fonts any smaller would be make it impossible to read.

So the only options I had were to either expand the main blog area or choose another template. But then, since I liked the template and also because did not want to perform a huge face-lift to a blog with steady traffic, I chose option A.

The change, I presumed, should not be difficult to make and it was not that difficult at all.

The default template was done to fit 800x600 resolutions and hence the max size of the title and footer was at 740 px. I am not sure if there are any more people using such low resolutions, but anyways I had my Google analytics stats to answer my question. There was less than 1% of the total visitors in that screen resolution.

Convinced that it would not affect the majority of the users, and even for those affected, they only have to scroll to see the profiles section, I proceeded to make the change.
Just wanted to jot down the exact changes made, as a ready reckoning for myself and others:
1. CSS properties had to be changed for the main blog area and the Title
2. Noticed that the rounded corners were not images for just the corners, but were a strip, hence had to modify the images and adjust it to the new width

That was all that needed to be done.

I used Google sites to upload my modified images. There was a snag in accessing the images from Google sites. Read more about it here.

Actual CSS Changes

change image – used

change image – used

change image – used

.main .widget
width: 668px;

.main .Blog
width: 684px;

change image – used

change image – used

change image – used

change image – used



Tuesday, January 13, 2009

Fixing Corrupt Fonts Windows XP

Recently while I uninstalled a Game I was playing, it corrupted my Windows XP fonts. It had a copy of it taken from the Windows directory and when it prompted to delete some files, it showed the path of the game directory, and I thought it was safe to delete. But it totally messed up things and left my PC with bloated fonts.

A little bit of googling and quite a few options were suggested including reinstalling the OS (Nah, I was not planning to do that though). But this solution saved my day:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes]
"MS Shell Dlg 2"="Tahoma"
"MS Shell Dlg"="Tahoma"


Copy the above content into a text editor and save it with some name and make the extension as .reg - you can then double click this to set Tahoma back as the default font and get back the original Windows XP settings.

Or you can download the one I created from here.

Be careful with editing the registry, if you are not sure of what you are doing, i would advise you to take a backup of the registry before proceeding.

Sybase Stored procedure error Select permission denied on object

Yesterday we finally resolved a strange issue which was troubling us for a few hours.
We had a web page which was calling a newly created stored procedure. This stored procedure was returning results, but most fields of the result set were NULLS.

While we know that there is no chance for the data to go missing, we were left with the following options:
  1. Execute just the query used inside the stored procedure
  2. See the IO statistics to see if the correct tables are internally mapped (we had faced a similar issue a few weeks back, Check it here)

On running the IO statistics, we found that there was a warning - Server Error Number 10330, Severity 14. Select permission denied on object dbName..tableName.

We were logged into the database with very limited access and permissions and so after getting a login which had sufficient Select and Exec permissions, we proceeded to find out and fix the issue.

  1. There were two databases involved. Let us call it db1 and db2
  2. Stored procedure created in db1, selects from a table in db2 (db2..tablename)
  3. The db1 stored procedure was granted exec permissions to user group Group1
  4. The login used from the UI connection string belonged to the db1..group1 but did not belong to db2..group1
  5. The reason why the old stored procedure worked was because – that procedure was created by a user who had sa rights – and Sybase applies the rights of the owner to the queries inside it

Adding the login user (from the UI connection string) to db2..Group1 resolved this issue.