Latest Entries »

jQuery Mobile Internal Hash Links

Using jQuery mobile for the client site today I came across an interesting problem.  The client had an existing HTML privacy policy document with a bunch of anchor tags linking to hashes within the page.  Since jQuery mobile uses the hash for it’s ajax loading the #top, #whatWeCollect and so on links would of course trigger a new (non-existant) page to load.

To get around this limitation in jQuery Mobile I wrote a little script:

$('.ui-page').live('pagebeforeshow',function()
{
	$('.retroHashes').find('a[href^="#"]').unbind('click').click(function(e)
	{
		e.stopPropagation();
		e.preventDefault();

		var $target = $(this).parents('.ui-page').find($(this).attr('href')).eq(0);
		if($target.length == 1)
		{
			$.mobile.silentScroll($target.offset().top);
		}
		return;
	});
});

Essentially, what is going on here is that when a “page” is loaded by jQuery Mobile, I am looking for a wrapper element with the class “retroHashes”. Inside this element is the old [ugly] code I got from my client.

The I look for all the anchor tags where the href begins with the hash.  If it does I unbind anything that might have been attached to click by other methods.  Not very nice and you might not want to do that step but in my case I was fragging all other behaviors on these links.

I bind new functionality to the click.  stopPropagation() prevents jQuery Mobile from doing it’s ajax load.

The rest is finding the target.  In my case the client was setting the the id of the target element and not the name, so I can actually just use the href attribute of the link as the selector.

I check to make sure that I found a target, and scroll to the offset within the document.

There you have it.  A quick hash link hack for jQuery Mobile.  If people like it I may expand this example to more use cases.

Komodo Edit Theme

Anybody want my spiffy dark komodo edit color scheme?  Based off of this excellent theme: http://www.dottedidesign.com/node/16

Download Charcoal Rainbow Mod here:
https://www.sugarsync.com/pf/D910673_8064236_268889

Mac Annoyances

I recently bought a new Mac Mini and had the following issues with it. This is, in part, me venting, but it also serves as a list of things for me to find the “Mac Way” for.  I plan to own and use this thing for a year before I truly judge it.

What is up with the Home and End keys? They don’t do anything like I’d expect.  I’m trying to figure out what the equivalent of windows/linux home/end functionality is on MacOS.

Magic mouse detects up scroll when I had no intention of such.  (Update: sold it.  Too annoying.)

Hard disk is a pain to upgrade. (Did the SSD thing.)  No really.  I have built, at least 50 PCs in my day. (Ok, so ~30 of them were entirely the same) but have never found a computer that was so hard to take apart or put together as this one.

iTunes can’t really watch a folder.  Don’t even get me started on the “work-arounds”.  They all suck.

Some things are in the apple menu, other things are in the hard disk. Yet more is in the dock. Much more confusing than the Start Menu.

I was impressed with how simple it was to set up the print functions of my new Epson Stylus NX625 in Ubuntu 10.10 over the network!

I followed the steps found here: http://avasys.jp/eng/linux_driver/download/lsb/epson-inkjet/escp/

A huge number of Epson printers are listed.  I used the AMD-64 .deb file.  It took a while to install and once the driver was loaded I needed to add the printer in CUPS. CUPS was able to discover the printer on the network and install it with just a few clicks.  Had the driver been provided with the printer this would have been simpler than setting up the NX625 in my Windows 7 machine.

I’ll go into greater specifics later or if interest is expressed.

Had a small issue today and found the answer here: http://forums.thedigitalfix.co.uk/forums/showthread.php?t=600250

The problem was that while playing Portal or Red Alert 3 the Esc Key was not working.  As the post above says the fix was that Photoshop was capturing the keystroke for some unknown reason.

So, if you run into this issue while playing a game or otherwise, try closing Photoshop and potentially other applications to see if that resolves the issue.

FYI: I was playing Portal through Steam and have Photoshop CS4.

Stuck Uploads in SugarSync

In short you can “reset” SugarSync using:
ctrl-shift-R
Choose to maintain your synced folders when you start back up. (it’s the default option)

I ended up with an issue in SugarSync where after rapidly creating and deleting/renaming directories in Windows, SugarSync got confused and thought that the hidden file Folder.jpg needed to be uploaded when in fact the file no longer existed.

So what do we do when SugarSync get’s it’s upload queue messed up.  Wouldn’t it be nice if there was a way to reset the queue?  Well it isn’t documented but after spending 3 days to get a customer service reply I learned that ctrl-shift-R will perform the reset.

It is essentially like uninstalling and reinstalling SS from what I can tell and you should leave the box checked to maintain your synced folders when you restart the SugarSync Manager.

IE absolute URLs

It seems that there is a bit of a strange issue with Internet Explorers 6 and 7 where if you have an absolute href in an anchor tag.  That will be rewritten to include the protocol and domain name.  This won’t effect the way the link works, but if we are doing some fancy javascript handling of our links, then we have a problem.

Tonight I had a terrible annoyance while upgrading to the latest Catalyst Drivers.  Now, for the most part this whole AMD / ATI thing has been very good for me.  As a fan of both companies for many years the tighter integration of their product lines has yielded a number of products I’ve bought in recent years.

The Problem

After uninstalling the old catalyst driver from my machine (which I did using all the default settings)  I rebooted my machine before installing the new ones and windows 7 would not boot.

Solution

It turns out that the RAID driver for the motherboard chipset is in the catalyst suite now.  I had to download the driver from my Motherboard MFG and then put that on a USB drive.  When the recover console came up I click “Load Drivers” at the bottom and this allowed me to select the first option and and run the startup repair.

Other Thoughts

Really AMD?!?!?  The catalyst driver set should be the video driver.  At the very least if the whoel thing is going to be so integrated it should be made smart enough to warn you if you are going to cause yourself a headache.  RAID drivers and graphics drivers have no business being part of the same install or uninstall.

When you copy files and there is already a file of the same name in the folder Windows will kindly ask you what to do with it.  If you choose to keep both files it will add a (2) or (3) to the end of the filename of the file being copied in.

After a large copy it can be very difficult to find these potential duplicates because the Windows 7 search is poor.  Finding parenthesis is a real pain in the neck.

After some searching I was able to find the answer I was looking for here: http://social.answers.microsoft.com/Forums/…

Quite simply use the following in the search field:

name:~"*(2)*"

I plan to elaborate as to what the means to windows, but clearly windows needs more than just quotes to make a literal string.

Simple Site Maintenance Page via .htaccess

I wanted to post this as I often forget those code snippets I use only a few times each year.  This simple addition to the .htaccess file will allow you to display a page to people coming to your site while letting you still see the site normally.

RewriteEngine On
RewriteCond %{REQUEST_URI} !/maintenance.html
RewriteCond %{REMOTE_HOST} !^10\.10\.10\.10
RewriteRule $ /maintenance.html [R=302,L]

Simply replace the 10s with your IP and if desired change the name of the file you want to display (2X).  If you already have “RewriteEngine On” in your .htaccess file be sure to remove that part as it will be redundant.

The first line simply ensures that you don’t redirect forever.  The second ensures that you won’t redirect yourself, or others at your public IP address.  The last will send everyone else to your maintenance message, in this case at /maintenance.html.

Also, if you want users to still be able to access your site’s asset files you can add something like:

RewriteCond %{REQUEST_URI} !(\.gif$)|(\.jpg$)|(\.png$)|(\.css$)|(\.js$)

to the beginning of the rewrite rule which will ignore the redirect to maintenance.html for image, css and javascript files.

Powered by WordPress | Theme: Motion by 85ideas.