Thickbox 3.1 with jQuery 1.3 – Stuck on loading image.

Thickbox hasn’t been updated in a while, and it is now incompatible with recent versions of jQuery (1.3+). What happens is that when you click the thickboxed element, the screen goes gray and the the loading “barber pole” image loads as expected, but then nothing happens… it just hangs on the loading image. The reason why is because Thickbox uses ‘@’ in jQuery, which is now deprecated.

To fix, simply open up the un-compressed thickbox.js file and go to line 79 and change the following:

TB_TempArray = $("a[@rel="+imageGroup+"]").get();

… into …

TB_TempArray = $("a[rel="+imageGroup+"]").get();

Once you make that change, Thickbox should work as expected!

Reference: http://codylindley.com/thickboxforum/comments.php?DiscussionID=1791&page=1#Item_0

CSS: How to pin an image to the bottom of a DIV

If you’d like to pin an image to the bottom of a DIV, it is a bit tricky. There is an relatively un-known property of an absolutely positioned element — if you wrap it in a relatively positioned element, the absolute positioning of the wrapped element will be positioned relative to the wrapper rather than absolutely in the browser window. Below is an example of how to pin an image (or any other element) to the bottom of a DIV. Note that the height on the imageWrapper is only there to illustrate that the image will attach to the bottom of the taller wrapper and is not required.

HTML:
<div id="imageWrapper">
    <img src="image.jpg" width="100" height="100" id="bottomImage" alt="Some Image" />
</div>

CSS:
#imageWrapper { position: relative; height: 500px; } /* height is for display purposes only */
#bottomImage { position: absolute; bottom: 0; }

Apache: Address already in use: make_sock: could not bind to address 0.0.0.0:80

Every now and then my Apache webserver becomes un-responsive, and attempting to restart it with apachectl graceful gives me the following error:

Address already in use: make_sock: could not bind to address 0.0.0.0:80

This error means that there is already a process running that is using port 80, so Apache is unable to start up and use it. To solve this problem, we need to figure out what process is currently using the port in question and kill it so that Apache can start. Use lsof to find out what is using our port:

shell> lsof -i :80
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
httpd 23506 apache 3u IPv6 1206927465 TCP *:http (LISTEN)

You can see from the output of lsof that an httpd process already exists under PID 23506. This is simple enough to get rid of:

shell> kill -9 23506
shell> lsof -i :80
shell> apachectl start

I run lsof again after issuing the kill command to make sure that whatever was using port 80 is gone.

Using a Seagate FreeAgent XTreme over eSATA with the ASUS P5B Deluxe motherboard.

Seagate FreeAgent XTremeI just purchased a 500GB Seagate FreeAgent Xtreme, hoping to take advantage of the super-fast eSATA port on the back of my ASUS P5B Deluxe motherboard. Sure I could have easily used the USB2 or Firewire 400 ports on the drive for a quick plug and play, but I wanted the blazing speed of eSATA. I’ve spent the last couple hours trying to get this thing to work right, so I figured I’d jot down my notes here in case any one else comes across the same problems.

First problem, the JMicron JMB363 SATA controller wasn’t enabled in my motherboard’s BIOS, so the drive wasn’t recognized. Easy enough: just go into the BIOS (hit DEL on bootup) and navigate the menus to Advanced > Onboard Devices Configuration > JMicron SATA/PATA Controller, and set to ‘ENABLED’. Set the JMicron Controller Mode to ‘IDE’.

With that enabled, Windows should now detect your drive. You should be able to see it under My Computer or in Disk Management as a Healthy Online drive. At this point, everything works fine as a drive, but I ran into a problem with the Seagate Manager software: Under the ‘My Drives’ tab, I received the error ‘No drives detected.’ Bummer. I ran Windows Update to make sure all my drivers were current (they were) and checked the ASUS site to see if there were any BIOS updates (there weren’t). At this point I was ready to give up on eSATA and just use the Firewire port. But after some detective work on the Seagate site, I found out that the JMicron JMB36X drivers need to be v1.17.46 or higher in order for the drive to work with Seagate Manager. Because this motherboard is a few years old, I was running an older driver. So after a few minutes of searching the JMicron site for updated drivers, I downloaded them, installed, rebooted, and PRESTO, my drive now works with Seagate Manager! Now all I need is a ‘Mission Accomplished’ banner.

One caveat to updating the JMicron JMB36X drivers: I had to re-activate my Windows install. So buyer beware for those of you running a ‘stealth’ copy of Windows XP.

Reference:

Fish Marinade

A nice marinade for fish.

Combine the following in a bowl:

  • (2) cloves garlic, minced
  • (1) teaspoon dried basil
  • (1) teaspoon ground black pepper
  • (1) teaspoon salt
  • (1) tablespoon fresh parsley, chopped
  • (1) tablespoon lemon fresh juice
  • (6) tablespoons light olive oil

Marinade fish in the sauce for an hour, turning occasionally. After marination, place fish in foil, and pour marinade over fish. Wrap foil over fish so that it is sealed. Bake in the oven (temp & time depends on fish).

PHP: How to capture output of echo into a local variable.

I’ve been customizing a WordPress install and have been needing to capture the output of the bloginfo() function, which simply echo’s a string. I wanted to capture the echo into a variable without actually echo’ing the string. You can do so by leveraging PHP’s output buffering functions. Here’s how you do it:

ob_start();
echo 'Hello World';
$myStr = ob_get_contents();
ob_end_clean();

$myStr will now contain ‘Hello World‘ without actually outputting it to the screen.

Reference:

iPhone / Gmail / Google Calendar wishlist.

I’ve had my iPhone for about a year now, and while I love it and the fact that it has made me more productive, it is still not perfect. There are still a few things which give me a headache, so I thought I’d compile a wishlist here for no reason other than my own sanity.

To start off, here is the context under which I have compiled this list:

  • Running Windows XP
  • Using Gmail’s hosted mail for my domain
  • Using Google Calendar for all of my events and time tracking
  • Using iPhone 3G, firmware v2.2.1
  • Using iTunes v8.0.2 to manage and sync my data

My main goal is to have all contacts & calendars sync seamlessly between all of my devices: my desktop workstation, my iPhone, and my online Gmail/Google Calendar accounts. To break it down, starting with contacts:

Contacts
When I first got my iPhone, I synched my contacts with Outlook. This is annoying to me because I hate Outlook. It’s also an unneccesary step because I don’t use Outlook for my email, I use Gmail. So while I had a decent backup of my iPhone contacts on my desktop machine, this didn’t help at all with my daily Gmail usage. In order to keep things in sync I would have to manually export from Outlook to CSV, then import into Gmail. Who wants to manually export/import contacts all the time? I do so much emailing that my contacts change at least weekly, if not daily. Undoubtedly I’d give up on a regular manual sync, causing my contacts to became a clusterfuck of chaos.

Then to my surprise, I noticed that iTunes has an option to sync with Google Contacts. “Yay, my prayers have been answered! I can finally ditch the middleman (Outlook) and my life is complete!” Or so I thought. The problem is that it syncs all of your contacts, even Gmail’s “Suggested Contacts,” which I never use. The sync worked flawlessly, with the unfortunate side effect of filling my iPhone with hundreds of random email addresses, most of which I don’t know who they belong to and I will ever need to contact again. So here is my wishlist to make my iPhone/Gmail experience perfect.

  • iTunes: Allow me to chose which contacts to sync from Gmail. A checkbox of groups would be ideal. If I could disable the syncing of the “Suggested Contacts” group, things would be perfect. Or…
  • Gmail: Allow me to disable the “Suggested Contacts” feature. I don’t like it, don’t use it, and it messes up my iPhone sync. Just add a simple checkbox to settings that allows me to enable/disable Suggested Contacts. How hard is this to add?

Calendars
First off let me say that I love Google Calendar. I use it to track everything from friend/family birthdays to my work hours as a freelance contractor. The problem here again is that I am reliant on Outlook as the middleman to sync all of my calendars between my Google Calendar and iPhone. I have installed the Google Calendar Sync app, and it works great between Google and Outlook. iTunes then syncs with Outlook so that I have events synced to my iPhone. The problem here is that Google Calendar Sync only syncs your main calendar. I have all birthdays in their own “Birthday” calendar in Google in order to keep them separate from personal/work events. So when I sync calendars, my iPhone doesn’t contain any birthdays because Google Calendar Sync only syncs my main calendar. It sure would be nice to have birthdays on my iPhone! I could move all of the birthdays back into my main calendar, but then they’d be intertwined with my work hour tracking and personal events, resulting in a big confusing mess. So here is what I need in order for this process to be perfect:

  • iTunes: Direct sync with Google Calendar so that I don’t need Outlook and Google Calendar Sync. Also, let me select which calendars to sync. Or…
  • Google Calendar Sync: Allow me to select which calendars to sync.

Overall
Overall, I wish that iTunes would sync directly with Gmail and Google Calendar, with the option to select which Contact Groups and Calendars to sync. That way I could ditch the middlemen (Outlook and Google Calendar Sync). I’m sure that these changes will come eventually, but I am throwing a digital temper tantrum here because I want these NOW NOW NOW! What is so frustrating is that these seem like trivial changes that could be made with minimal work. Google has provided APIs for Contacts and Calendars, so why doesn’t iTunes use them to their full potential? Probably because they want me to pay for MobileME. Also, why doesn’t Gmail give users control over their annoying and useless Suggested Contacts feature? Does Google know better than me? Reminds me a lot of that old dinosaur Microsoft. It drives me crazy that fixes which are so simple and obvious haven’t been implemented a full year and a half after the original iPhone was released.

If anyone has any suggestions to tackle the items I’ve listed above, I’m all ears. I know there are better syncing apps out there, but I don’t feel like paying $40 to accomplish something that I feel should be standard in today’s mobile world. Switch to Mac and use iCal? Sure, I’ll get around to that someday. MobileMe? I’ve thought about it, but would rather use a simple and free solution.