Archive for the ‘Web’ Category

Use Gmail To Filter Hotmail Spam

Wednesday, April 7th, 2010

Still haven’t managed to get rid of that embarrassing Hotmail account? Me neither!

Gmail allows you to retrieve the email from other email accounts via POP3 (just as many desktop email clients do). The nice thing about it is that it will also filter email from that account and mark suspected SPAM as such.

This feature is found in:
Gmail -> Settings -> Accounts and Import (tab) -> Check mail using POP3

I set mine up to delete mail from Hotmail’s server upon retrieval to prevent email clog up. Also be sure to tag your Hotmail, so it doesn’t get mixed in with the important stuff. You may still need to log into Hotmail occasionally to prevent them from shutting down your account. I’ve thought about setting up another Gmail account to replace my beloved Microsoft email acct. but…

Test With IE On Your Mac OS X

Saturday, April 3rd, 2010

Requirements:
- Mac OS X (Snow Leopard was used for this article)
- XAMPP/Apache or Mac webserver of your choice
- VirtualBox
- Windows XP, Vista, or 7 install disk
- IETester
(allows for testing in multiple flavors of Internet Explorer using tabs)

We’ve all seen this show before. The tricky part is finding your way back to XAMPP (Apache) from IE Tester while maintaining a consistent base URL. This isn’t important when running a few static websites, but many frameworks have this value stored in its database. When you view your site using a different URL, links to static files (CSS, images, etc.) and other pages become broken. In a few easy steps I’m going to show you one method to resolve this issue.

Go ahead and install the above applications and OSes if you haven’t already. Use the default network mode of “NAT” for VirtualBox. I’m going to assume that you can access your local sites (from your Mac) using – http://localhost/sitename/

- Step 1: Boot up your Windows install and use ipconfig (Run -> cmd -> ipconfig) to get your gateway IP. It was 10.0.0.2 for me.

- Step 2: Add the following lines to both system’s (Mac and virtual Windows install) hosts files (http://en.wikipedia.org/wiki/Hosts_file). ‘localhost.com’ can be replaced with a URL of your choice.

# Mac:
localhost.com 127.0.0.1
# Windows:
localhost.com 10.0.0.2

- Step 3: Be sure that all of your web frameworks (Wordpress, Magento, etc.) are aware of your new base URL ‘localhost.com’ (or whatever you chose in step 2).

- Step 4: Access one of your sites from each of your operating system’s browser using – http://localhost.com/sitename/

Content Expirator – jQuery Content Expiration Plugin

Saturday, March 27th, 2010

Content ExpiratorContent Expirator is a jQuery utility plugin that provides an easy way to give DOM elements an expiration date. If the element is found to be expired, its ‘display’ parameter is set to ‘none’. A better approach would be to perform this function server side with a server side language, but this is a quick and easy way to implement it client side.

Download: jquery.content_expirator-0.1.0.js

 

Let’s say your client has given you a flyer to put on their website for an event.

<img src="easter_flyer_2010.jpg" class="aligncenter" alt="Easter Flyer" />

After Easter is over, you’re going to want to take this flyer off of their site. Instead of manually editing the site on the Monday after Easter to take it down, you can give it an expiration date so that it isn’t displayed after Easter.

<img src="easter_flyer_2010.jpg" class="exp-2010-04-04 aligncenter" alt="Easter Flyer" />

The Content Expirator looks for an element containing a class name (must be the first one listed) containing the prefix ‘exp’. When it comes across one, it compares the date (formatted year-month-day) with the current day to decide if the element’s ‘display’ (style) parameter should be set to ‘none’.

Calling The Function:

default:

$(document).ready(function(){
    jQuery.contentExpirator();
});
// looks for -> 'exp-year-month-day'

custom prefix:

$(document).ready(function(){
    jQuery.contentExpirator('end');
});
// looks for -> 'end-year-month-day'

Plugin Source:

(function($){
        $.contentExpirator = function(prfx){
            var pfix = prfx || 'exp';
            $("[class|="+pfix+"]").each(function(){
                var eString = $(this).attr('class').split(' ')[0];
                var dString = eString.split('-');
                var d = new Date(dString[1],dString[2].toString()-1,dString[3]);
                var today = new Date();
                if(d < today){
                    $(this).css('display','none');
                }
            });
        }
    })(jQuery);