Tuesday, November 30, 2010

Setting content expiration on IIS 7

See also Mike Knowles post on SharePoint IIS Content Expiration settings.
On IIS Manager, click on the site under the "Sites" folder.
Expand to show the subfolders under the site.
Click to select the subfolder you want to modify.
Go to Features view on the main panel.
Open the "HTTP Response Headers" feature.
Under "Actions" on the right column, click on "Set Common Headers..."
You should see the content expiration settings in the popup ("Set Common HTTP Response Headers") that appears.

Thursday, November 18, 2010

Error: "Could not load file or assembly ... or one of its dependencies. The system cannot find the file specified."

Created a class with common functions and included it in a SharePoint solution.  Deployed successfully.  But when browsing a page on the site it gets the "could not load file or assembly..." error.  The class dll isn't getting in the GAC.  Got the solution from this stackoverflow thread:
Add an Assembly element for the missing dll into the manifest.xml by double-clicking on Package.package on Visual Studio, going to the "Advanced" tab, and adding the assembly.

Wednesday, November 17, 2010

Site columns deployment error

Was getting this VS deployment error on a SharePoint 2010 solution:
"Error occurred in deployment step 'Activate Features': The field with Id {guid1} defined in feature {guid2} was found in the current site collection or in a subsite."

Found that workaround #1 from this article worked for me.

Tuesday, October 19, 2010

Converting a virtual drive from Virtual PC (.vhd) to VirtualBox (.vdi)

I wanted to make a copy of a Windows 7 virtual drive.  It was created with Virtual PC (.vhd) and had been running under VirtualBox as-is.  Can't make a simple copy because the Virtual Media Manager will complain about duplicate UUIDs.  So might as well convert it into VirtualBox's .vdi format--the process will also generate a new UUID.  Use the CloneVDI tool.

Sunday, October 17, 2010

Team Fortress 2 Crafting Blueprints

The TF2 Backpack Examiner page provides a great summary of crafting blueprints.  Hover over the images to see the name and description of each item.

Friday, September 17, 2010

A different IE6 transparent PNG fix

While searching for a jQuery solution for the IE6 transparent PNG issue, I came across this StackOverflow discussion that led to DD_belatedPNG by Drew Diller.  It works indeed:  on images, backgrounds, and repeating backgrounds.  Whee!  Thank you!

My Yahoo Homepage Ads

Recently noticed that my Yahoo home page was showing an ad that took up a large chunk of the right column.  Found the solution here:  install the AdBlock Plus add-on to Firefox!

Sunday, September 5, 2010

Import Palm DateBook to Google Calendar

Found a discussion on importing Palm DateBook information into Google Calendar (and eventually to iCal for iPod/iPhone).  At the bottom of the thread is a link to Palm2CSV, a free tool for converting Palm DBA files into CSV (which is imported into Google Calendar).

Wednesday, September 1, 2010

Don't forget the DOCTYPE!

I learned this some time ago, but for completeness sake: 
If your styles aren't working as expected, check the DOCTYPE!  See A List Apart's article "Fix Your Site With the Right DOCTYPE!"

Styling the button element

Found this article by the Filament Group about styling the button element with CSS Sliding Doors while looking for a way to fix the extra padding that browsers put around buttons.

How to style for IE6, IE7, and IE8 without conditional comments

Suppose the page you're fixing is in an iframe and you're not allowed to change the HTML and can only make adjustments to one CSS file.  No conditional comments then.  Even worse, there is no DOCTYPE on the page, and so it ends up sending the browser into quirks mode.  Here's the CSS-hacky way to target specific versions of IE:
  • IE8 and below:  put a "\9" at the end of the style value
    { width:98px\9; }
  • IE7 and below:  put a "*" at the beginning of the property name
    { *width:80px; }
  • IE6:  put an "_" at the beginning of the property name
    { _width:106px; }

Wednesday, August 25, 2010

SharePoint forcing users to save PDFs

Solution at Nerdtastic Tips for the issue of SharePoint forcing users to save PDFs instead of opening them in-browser.  It all comes down to making sure Browser File Handling is truly set to "permissive" for the relevant lists.

Tuesday, August 24, 2010

Getting "specified file is not a valid spreadsheet" error when importing a spreadsheet into SharePoint

Was getting the error when trying to create a new list in SharePoint using the "import from spreadsheet" option.  Found the solution here:  add the site's URL to the list of trusted sites on IE security settings.

Configuring SharePoint Global Navigation

Was having problems getting pages to show in the dropdown of the main menu (global navigation) on SharePoint.  Found the solution on this article on how to customize the top link bar.  Relevant quote:
If you are configuring navigation for a top-level site, and you want pages or subsites underneath the subsites of the top-level site to appear on drop-down menus from the top link bar, you need to configure the top level site to show subsites and pages, and you also need to configure the individual subsites to show their subsites and pages.

Thursday, August 12, 2010

My Firefox Add-ons

Here's my list of add-ons for web development:
And for safe web browsing:
Not using this, but thought the list included was interesting:  AddonFox

Saturday, August 7, 2010

Wednesday, July 28, 2010

USB speakers too loud

Recently got the Logitech S150 USB speakers for my laptop (Windows 7 - 64bit). They work great but are way too loud. Same issue with a headset/mic combo connected to a USB sound adapter. Googling for "usb headset too loud" came up with many others experiencing the same earsplitting issue.

I did find a solution for the speakers in this post by mgoblue62 in a Logitech forum thread and the response from SamuelBMorse:
  1. Go to the volume mixer
  2. Set the USB speaker volume to 70%
  3. Set the volume of your application to a comfortable level
It didn't seem to work as well on my USB headset, at least not with Windows Media Player. May have to go back to using the KOSS volume control for that.

Thursday, July 22, 2010

Getting "access denied" errors on SharePoint WCM pages

This happened to me after setting the portalsuperuseraccount:
stsadm -o setproperty
-propertyname portalsuperuseraccount
-propertyvalue mydomain\cachesuperuser
-url http://blahblah.com
Need to give the portalsuperuseraccount full rights.

Monday, July 19, 2010

jQuery plugin jCarousel gives "No width/height set for items ..." error on Safari

Need to make sure that the container that jCarousel is applied to is visible (e.g., not styled to display:none) when the carousel is initialized (got the clue from this discussion on drupal.org). In the case of a couple carousels activated by a tabs (implemented also with jQuery), initialize the hidden carousel only when the tab is activated, say, in a callback function like this:

function myTabCallbackOnActive() {
// Find carousel object from active tab
var activetab = $('#blahblah .selected a').attr('href');
var carousel = $(activetab + '.jcarouselstrip').data('jcarousel');
if (carousel == null) {
initCarousel(activetab);
carousel = $(activetab + '.jcarouselstrip').data('jcarousel');
}
// Do other actions as needed for now-active carousel.
// For example, go to the first item:
carousel.scroll(1,false);
}

Friday, July 9, 2010

Enabling eSATA on Dell e6400

Found that my work Dell e6400 was not configured on the BIOS to use eSATA, and changing the BIOS SATA settings to AHCI to allow for eSATA causes Windows boot to fail. You’ll need to change a registry setting first. Found the proper steps here:
http://en.community.dell.com/support-forums/laptop/f/3518/t/19269913.aspx
(look for the Jason Hofmann posting)

For step 5 (http://support.microsoft.com/kb/922976), I changed the subkey
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Msahci
to have Start value = 0 (originally: 3 hex).

Tuesday, June 29, 2010

Validation prevents SharePoint publishing check-in

The following error appears on check-in:
"This page contains content or formatting that is not valid. You can find more information in the affected sections."
As pointed out by one of the replies here, use Validation Groups. And hide the validation controls in display mode. To check if it's in display mode, see if:
SPContext.Current.FormContext.FormMode == SPControlMode.Display

Wednesday, June 9, 2010

SharePoint 2010 not serving SWF files

Found the answer on this thread response by Manoj Jadoun:

SP2010 has restrictions on displaying SWF files. You need to go to central administration and check the "Browser File Handling" to "Permissive" for that web application's general settings.

JW Player on Fancybox

Using the advise from this thread, here's how I got JW Player working inside FancyBox (to play FLV files in a lightbox):

<a id="viewflv" href="js/player.swf?file=video.flv&amp;autostart=1"
title="Test Flv">Click to view FLV video</a>
<script type="text/javascript"> //<![CDATA[
$(function() {
$("#viewflv").click(function() {
$.fancybox({
'autoscale' : false,
'transitionIn' : 'none',
'transitionOut': 'none',
'padding' : 0,
'title' : this.title,
'width' : 370,
'height' : 301,
'type' : 'swf',
'href' : this.href,
'swf' : { 'wmode':'transparent', 'allowfullscreen':'true' }
});

return false;
});
});
// ]]> </script>

Tuesday, May 18, 2010

jQuery plugin for a styled scrollbar

jScrollPane from kelvinluck.com
When combined with an accordion plugin or anything that sets the scrollpane to display:none, the scroller gets initialized to height:0, so you don't see anything. Workaround is to wrap the jScrollPane with show and hide like this:
$('#myDiv').show().jScrollPane().hide();
Another way I found is to add it to the click handler for the accordion tab, like so:
$('a.myTab').click(function() {
$('#myScrollWrap').jScrollPane();
});
(discussion of the issue and workaround here)

How to add a Twitter feed to a page

Add Twitter to your blog (step-by-step)
This uses the getTwitters script from twitter.js.

Another way: using jQuery plugin juitter. Code for formatting the timestamp at drupal.org.

How to clone a VirtualBox disk

How-To: Clone or Copy a VirtualBox Virtual Disk

For me, I wanted to convert a .vhd to .vdi, so I did the following:
  1. Created a copy of the .vhd (I'm paranoid).
  2. Changed the UUID of the copy:
    VBoxManage internalcommands sethduuid mycopy.vhd
  3. Cloned the copy into .vdi format:
    VBoxManage clonehd mycopy.vhd mycopy.vdi --format VDI

Tuesday, May 11, 2010

Friday, May 7, 2010

Monday, May 3, 2010

Friday, April 30, 2010

IE7 and linked CSS files

Looks like IE7 doesn't distinguish between two linked CSS files if they have the same file name. I think it's ignoring the second one. Fixed by renaming the 2nd one.

Friday, April 23, 2010

Cool Flash-based tag clouds

In the Blogumus example, the URLs no longer work. Need to change the URL for the swf to:
http://www.roytanck.com/wp-content/plugins/wp-cumulus/tagcloud.swf
and replace the URL for swfobject.js to:
http://www.roytanck.com/wp-content/plugins/wp-cumulus/swfobject.js

On this blog, the widget code is:
<b:widget id='Label99' locked='false' title='Label Cloud' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<script src='http://www.roytanck.com/wp-content/plugins/wp-cumulus/swfobject.js' type='text/javascript'/>
<div id='flashcontent'>Blogumulus by <a href='http://www.roytanck.com/'>Roy Tanck</a> and <a href='http://www.bloggerbuster.com'>Amanda Fazani</a> via <a href='http://bloggerstop.net'>BloggerStop.Net</a></div>
<script type='text/javascript'>
var so = new SWFObject("http://www.roytanck.com/wp-content/plugins/wp-cumulus/tagcloud.swf", "tagcloud", "200", "200", "7", "#DDDDAA");
so.addParam("wmode", "transparent");
so.addVariable("tcolor", "0x5588AA");
so.addVariable("mode", "tags");
so.addVariable("distr", "true");
so.addVariable("tspeed", "100");
so.addVariable("tagcloud", "<tags><b:loop values='data:labels' var='label'><a expr:href='data:label.url' expr:style='8 + data:label.count'><data:label.name/></a></b:loop></tags>");
so.addParam("allowScriptAccess", "always");
so.write("flashcontent");
</script>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>

Wednesday, April 21, 2010

Cross-browser CSS Gradient

This cross-browser CSS gradient also works on IE6.

Cannot reset hasLayout for display:inline-block

Learned (to my horror) that, on IE7, using display:inline-block sets hasLayout=true, and that resetting display to inline does not also reset hasLayout. There's no way to reset it in this case. You can "!important" all you want and it won't work. See this article about hasLayout. This is one case when IE6 behaved better than IE7.

[I was having issues with SharePoint 2010's core CSS setting display:inline-block on the current breadcrumb span element. I adjusted the styles so the crumbs were shown in the usual linear manner (as opposed to a folder structure), but long crumb text ended up as an inline-block instead of wrapping properly to the next line. To get around it (without changing the core CSS), I added some jQuery to change the class attribute of the element to something else, just so the inline-block didn't get applied to the element anymore. And then realized later that modifying the ListSiteMapPath to use a different value for CurrentNodeStyle-CssClass will accomplish the same thing.]

Saturday, April 10, 2010

Lightbox jQuery Plugin

Fancybox is a jQuery plugin for displaying content (images, video, etc) in a lightbox. Simple to use. And can display YouTube videos (see the tips & tricks page).

Thursday, April 1, 2010

Script to get query string

From the answers here (which refers to this article):

// Get the query parameter string.
// Usage: If URL is "blah.com/index.html?view=classic", then do this to get the value of "view":
// var parm = $.urlParam('view');
// See http://stackoverflow.com/questions/901115/get-querystring-with-jquery.
$.urlParam = function (name) {
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (!results) { return 0; }
return results[1] || 0;
};

Ancient Rome in 3D

3D Model of Ancient Rome on Google Earth

Thursday, March 25, 2010

VirtualBox domain controller

How to setup a pair of virtual machines on VirtualBox so that one is a domain controller. Got the clues from here and here.

IE issues with jQuery fadeIn/fadeOut

ClearType gets disabled on IE7 and IE8 when using jQuery's fadeIn/fadeOut effect. Fixed by removing the "filter" attribute (see here too). Also saw articles about setting a background color and removing positioning.

Regarding pixel-shifting on IE8, I saw something about setting an initial opacity, but I couldn't find the reference anymore.

Thursday, March 11, 2010

Wednesday, March 10, 2010

Use colgroup or col to style table columns

Use the <colgroup> tag or the <col> tag to style table columns.
Note that not all attributes work for Firefox (see w3c). Alternative using CSS selectors at webmasterworld.com:

td:first-child { }
td:first-child + td { }
td:first-child + td + td { }
td:first-child + ...

Friday, February 12, 2010

jQuery plugin for social bookmarking

jQuery Bookmark
Description from the site: "The bookmark sharing functionality can easily be added to a div or span with appropriate default settings. The resulting links allow the user to easily post your current page to any number of bookmarking sites."

(I haven't tried this yet, but it looks promising.)

Wednesday, February 10, 2010

Clean up (and expand minified) Javascript

Paste your Javascript code here to get it cleaned up. Can also use it to expand minified code.

[edited 21may2010: Added link to minifier.]

Strict XHTML deprecates "target" attribute

The target attribute of the <a> tag is deprecated in HTML 4.0 Strict and XHTML 1.0 Strict: New-Window Links in a Standards-Compliant World

(Updated 2/12/2010 and 2/24/2010:)
I like the jQuery solution in Justin Scheetz's comment on this article in badlyDrawnToy:

$(function() {
  $("a[href*='http://']:not([href*='"+location.hostname+"'])").click( 

    function() {
      window.open(this.href);
      return false;
  });
});


(Updated again 2/24/2010:)
Here's the jQuery for just setting the target attribute (with a little help from NerdyDork):

$(function() {
$("a[href*='http://']:not([href*='"+location.hostname+"'])").attr("target", "_blank");
});


(Updated again 10/06/2011:)
Found earlier that the above solution failed for https, so I had to add another line for that.  And then found that the comparison for .hostname needs to be case-insensitive.  So my latest solution is the following, using some tips from the electric toolbox (which also mentions that, with HTML5, "the W3C has un-deprecated the target attribute"):

$(function() { 
  $("a").filter(function() { 
    // find all links that have a hostname 
    // that doesn't match the current location
    return this.hostname && 
      this.hostname.toLowerCase() !== location.hostname.toLowerCase();
  }).click(function() { 
    // open those external links on another window 
    window.open(this.href); 
    return false
  }); 
})



Tuesday, February 9, 2010

Removing the image rollover toolbar on IE6

When you hover over an image on IE6, you'll eventually see a toolbar with 4 buttons: Save this image, Print this image, Send this image in an e-mail, Open My Pictures folder.

Several ways to do it, as described here:
  • Set the galleryimg attribute to "no" on the img tag:
    <img src="blah.jpg" galleryimg="no" />

  • Site wide:
    <!--[if IE 6]>
    <meta http-equiv="imagetoolbar" content="no" />
    <![endif]-->

  • Disable it in the client IE6 browser:
    Internet options > Advanced > Enable Image Toolbar (under Multimedia)


The image toolbar was removed from IE7.