Saturday, October 15, 2011

Cannot Modify the Needed File

Upon restarting Windows, my StumbleUpon toolbar in Firefox seemed no more.

I went to the StumbleUpon site and tried to reinstall the add-on, but got this error:

StumbleUpon could not be installed because Firefox cannot modify the needed file.

My setup is a bit unusual in that I have a QSoft RAMDisk drive set up on my 4 GB system to utilize the extra 768 MB or so of PAE memory, normally inaccessible to Windows 7. I configured my system to use a folder on this drive, R:, named TEMP as a scratch space, and set up Firefox to use R:\ for its cache.



I discovered, however, that I'd forgotten to create a little script or batch file to create this TEMP folder on the R: drive. This meant that for some programs that might use the system's default temp space, it might fail, the folder R:\TEMP being nonexistent.

To get around this I simply modified my environment variables for TEMP and TMP to reference the root of the RAM drive, R:\. Now the StumbleUpon toolbar add-on installs successfully.

In case you encounter this error, make sure that you have sufficient space available in whatever folder you tell Windows to use as scratch space, and of course that it exists in the first place and is accessible.





Sunday, September 25, 2011

Center Text AND Images Within ASP .NET

I recently integrated the handy AddThis sharing and analytics tool into an ASP .NET site I'm working on.

Whether due to peculiarities of the markup or browser idiosyncrasies, I couldn't get the widget consistently centered. The widget code lives in a div tag, and despite a popular few suggestions, I simply couldn't get things centered horizontally.

Centering text is no big deal; simply applying a CSS style usually does this well enough:

text-align: center;


Images, however, aren't accounted for by this markup. 

I ended up enclosing the widget in a Table control with the HorizontalAlign attribute specified to "Center", and this did the trick.


Centered!

Much easier to allow ASP .NET to handle the grunt work of emitting the necessary markup in this case than messing (directly) with styles.