Apr 22 2009

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

Tag: CSS, HTMLAdministrator @ 4:47 pm

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; }

Mar 08 2009

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

Tag: Apache, Linux, TechAdministrator @ 1:19 pm

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.


Feb 28 2009

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

Tag: Hardware, Tech, WindowsAdministrator @ 6:22 pm

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:


Feb 22 2009

Fish Marinade

Tag: Cooking RecipiesAdministrator @ 5:44 pm

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).


Feb 10 2009

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

Tag: PHP, ProgrammingAdministrator @ 6:53 pm

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:


Feb 06 2009

iPhone / Gmail / Google Calendar wishlist.

Tag: Apple, Google, iPhoneAdministrator @ 1:05 pm

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.


Dec 02 2008

No wonder they’re all going bankrupt.

Tag: MiscAdministrator @ 11:50 am

I knew it was only a matter of time before the financial clusterfuck of the century would affect me. Last week I received a letter from Citibank stating that the APR on my Citi Mastercard would rise from 7.99% to 19.99% effective immediately.

The first thing that came to mind was: WTF??!!? If they were to jack up the rates to maybe 9.99% or even 10.99%, whatever, that’s understandable. But to raise them by twelve freakin’ points??? What are they thinking? Did I miss a payment or something? Am I over my limit? Nope.. none of the above… this is nothing more than highway robbery.

To clarify, I absolutely hate credit cards, and believe that they are the cause of much of the trouble modern society has experienced over the last 20 years. People live way beyond their means, and cheap and easy credit facilitates this facade. The current economic crisis is simply the pimple coming to a head, caused by people spending more than they make and kicking the can down the road. Out of sight, out of mind. I rarely use my credit card, mostly when using it makes the purchasing process easy — like for plane tickets or hotel rooms or online purchases. I’ve always payed off my balance right away, and very rarely carry a balance. I’ve worked hard to establish a great credit score and am what I consider would be an ‘ideal’ customer to any credit card company. I refuse to be a slave to a creditor… I don’t like to be owned by anybody.

Anyway, I knew what this letter was all about and why my rates were being jacked up, but I wanted to call and hear straight from the horses mouth. The nice customer service lady verified what I already knew: because of the increasing number of defaults of their customers, the card companies are having to raise rates and lower limits to the rest of their customers in order to offset their losses. This is regardless of the quality of those customers. I asked her if there was any way for me to keep my current rate, seeing how I’ve never been late making a payment and have been a customer of theirs for over 10 years. She replied by saying, “unfortunately, this is a financial decision that has been made by management and I am unable to reverse it.” I retorted, “can you please inform your management that punishing your good customers because of the actions of your bad customers is going to cause you to lose all of your good customers.” She replied that they have been keeping track of the complaints and will act accordingly, whatever that means. Apparently they’ve been getting a lot of angry calls from customers about this.

Can someone please answer this for me: in what business, any business, if you were to penalize your best customers, would you be able to stay in business? If you owned a bar, and someone skipped out on their tab, would you turn around and ask your regular bar patrons to pay more for their drinks? No, because if you did, they would no longer be regulars. Say goodbye to your bar.

At the end of the day, I don’t really care. I pay off my balance right away, so the APR doesn’t affect me, but it’s the principle of the matter that pisses me off. These companies make billions, yet they can’t even afford to hire some mathematicians to come up with an algorithm that determines which customers to punish and which to reward. Decisions like this make me say: no wonder they’re all going bankrupt.

Let them fail. Citibank lost a good customer today. The free market has spoken!


« Previous PageNext Page »