Salient Digital Techno Blog

Ramblings on technology with a dash of social commentary
RSS icon Email icon Home icon
  • JQuery Timer Opens ColorBox…Then Flash Displays on Top in IE

    Posted on November 22nd, 2010 phpguru No comments

    I’m in the process of adding a new feature to the home page of a client’s website. The desired functionality is best described as follows:

    When visiting the home page, after a few moments, I want an overlay to appear, and inside the overlay will be a promotion to sign up for the website’s email newsletter.

    A friend of mine (o3c) recently turned me onto ColorBox, from Colorpowered.com. Excellent stuff! I’m almost done implementing it, and ran into a few integration issues that I thought I’d share. For the record, I want to state that none of the issues I ran into are problems with ColorBox! The ColorBox code is rock-solid. No, as usual, the problems are with Flash content on the page, and particularly within Microsoft Internet Explorer. As usual, everything works fine in Firefox, Safari & Chrome.

    So we have a couple of questions to answer. One is: How do you open ColorBox with a Timer? And the second is: How do you open a ColorBox over Flash in IE?

    Timers are still done with “old school javascript.” The syntax is a little goofy, but it’s not specifically JQuery related. We’ll come back to that.

    You have Flash on a page, and when your ColorBox appears on the page in IE, the Flash content underneath the overlay draws over top of the ColorBox overlay content, right? Contrary to how the rest of the world behaves (correctly), Adobe Flash (by default) draws last, which causes it to look like it’s on top of everything else. There are usually some easy fixes for that (most often, #3, below).

    Still reading? Ok, let’s get down to it. Here’s some general troubleshooting tips before we begin.

    1. Make sure your page Validates. Use the validator.w3.org
    2. Depending on your usage, you may have to make IE8 behave like IE7… a.k.a. force IE7 compatibility mode
    3. Tell the Flash content to have the “wmode” parameter, and set the value to “transparent

    Now, you may have already tried all of these things. I did, and the Flash content was still showing on top of my ColorBox content.

    So what’s a web developer to do. JQuery to the rescue. What we can do is hide the Flash content before the ColorBox appears, and turn it back on when the ColorBox goes away. It’s not a perfect solution, but it will hopefully work on all browsers so we can go about our day.

    In looking at the ColorBox API/Documentation, they’ve provided two events that look to be very helpful to this type of situation. Scroll down to the bit about “Extending,” almost to the very bottom where it says “Event Hooks” and look for the following:

    ‘cbox_open’ triggers when ColorBox is first opened, but after a few key variable assignments take place.
    ‘cbox_closed’ triggers as the close method ends.

    The container on my page that contains the Flash content has an id=’img_accordian’. My first thought was to do something like:

    $('#img_accordian').bind('cbox_open', function(){
       $(this).hide();
    }).bind('cbox_closed', function(){
       $(this).show();
    });

    but the above did not work! When I reloaded the page, it had no effect. No errors, but nothing happening. A quick Google search revealed this tidbit on the ColorBox Discussion Group on Google. So I just tried the more obvious…

    $().bind('cbox_open', function(){
       $('#img_accordian').hide();
    }).bind('cbox_closed', function(){
       $('#img_accordian').show();
    });

    Boo-yah! Now I can move onto something much more fun. So much of my time wasted due to inadequacies of Internet Explorer. Sigh… such is life.

    Whoops — not so fast — now that we have our signup form opening into a ColorBox iFrame, it shows every time we visit the home page. We want it only to show this pop-up-style signup form once during the user’s session. A cookie is the perfect place to store a simple “yes,” value, indicating that the user has seen the popup already.

    Another Google search on JQuery Cookie found the JQuery Cookie plugin. To make use of this, we need to open the signup form ColorBox only if the user has not seen it already. Then if we open it, we can set the cookie that says they saw it, thus preventing it from showing again (until we clear cookies or the cookie expires.)

    The two last features you’ll see in the code below are the finished timer, which I have set to open in 7.5 seconds. In testing, I may change it to 7, 6 or even 5 seconds. Also, I wanted a second “signup for e-news” link on the page in the footer that triggered the ColorBox overlay. So you’ll see in my code I created a custom object, “cbprops” to store the custom ColorBox configuration values, and then attached it to fire on the #signup_link.

    Here’s the final completed code.

    $(document).ready(function()
    {
        var cbprops = {opacity: 0.5, href:"/signup", width:"660px", height:"680px", iframe:true};
        if($.cookie('viewed_signup')!='yes')
        {
            var timer = setTimeout(function(){
            $.fn.colorbox(cbprops); }, 7500);
        }
        $("#signup_link").colorbox(cbprops);
    }).bind('cbox_open', function(){
        $('#img_accordian').hide();
        $.cookie('viewed_signup','yes')
    }).bind('cbox_closed', function(){
        $('#img_accordian').show();
    });

    There you have it, folks. We’re using a Javascript timer to open a ColorBox that hides Flash content in the background and setting a cookie so it only happens once. I hope you enjoyed reading — happy programming! Feel free to steal this code. If stealing doesn’t sit right with you, feel free to donate to JQuery or buy a 2011 Funny Pug Calendar!

  • Kyl Blocks New START, But Just Long Enough To Actually Read It

    Posted on November 20th, 2010 phpguru No comments

    Liberals are notorious for reacting with emotion from the moral high ground. Conservatives, on the other hand, tend to be more logical in their approach. This is a frequent topic on talk radio. The onslaught of hatred and virility in the blogosphere directed at Jon Kyl (R-AZ) is a prime example. The Arizona Senator recently decided to withdraw his support for the START treaty Obama signed with Russia back in April, which means that it may not be ratified during the lame duck session. With a Republican congress heading to D.C. in January, it also means that there’s a chance New START might never be ratified. Editor: It most likely will, just not during the Lame Duck session.

    Now, I think we can all agree that the world has too many nuclear bombs. But contrary to an overwhelming amount of negative criticism from all the Left and even some of the right, if you dig deep enough into the story, you’ll find that Mr. Kyl is simply pointing out the lack of some wording in the documents, and recommending more time to discuss it. It’s not that he wants to play a game of global thermonuclear war. Nothing could be more preposterous, yet the hype from the left about it being `a threat to national security if we do not ratify START immediately` is just rubbish. Nobody’s going to press a button. At least, nobody who signed the START. Some whack-job in China, Iran, Saudi Arabia, Palestine, Pakistan… maybe, but not USA or Russia. START is just between USA & Russia. And who’s to say that we can’t make it even better by analyzing what its terms are for just a moment?

    If there’s one thing I wish for, it’s that the Democrats would start reading the legislation they’re so haste to sign, start thinking logically for a change. We don’t send you to Washington to pass as many laws as possible. It’s not a race, and it’s not about quantity. You don’t get more points for adding more laws, particularly ones you haven’t read, like the Obamacare bill, Ms. Pelosi.

    I just sent Mr. Kyl the following letter.

    Mr. Kyl,

    You have a fan in Tempe, AZ. It takes a huge amount of confidence to stand up to the President, everyone on the Left, many folks on the Right, and most of the world, to make the decision you did vis a vis ratifying the Start treaty.

    Even though at face value I can understand how a Democrat can read a headline like, `Kyl (R) blocks Russian Nuke Treaty` and gasp in horror, I commend you for forcing the document to be analyzed with more scrutiny.

    Contrary to Obama’s and Biden’s statements that not signing immediately would `jeopardize national security` [1] [2] I think anyone who is intellectually honest would agree that no red buttons are going to be pushed any time soon and it makes perfect sense to make sure all parts of the treaty make sense before ratifying it.

    It was very refreshing to hear that a Senator, one of our two great Arizona Senators, took a stand to pause long enough to simply read, analyze and discuss something that is so important to our National Security. Particularly, your actions are duly noted, given such behavior as the recent Democrat push to sign Obamacare into law without a shred of discussion. Didn’t Pelosi declare that “we have to sign this bill so we can find out what’s in it?” Thank you for not doing that with START!

    Furthermore, if Obama and Biden really cared about our national security, they wouldn’t be pulling national guard troops away from the Texas border, and they would’ve answered Arizona’s plea for more help on ours.

    I wanted to let you know that just now, even typically-left Arizona Republic is catching on to the bigger picture [3], is backing you up, and at least trying to set the record straight a little bit.

    Thank you, sir, for making a tough decision and sticking to it, even though a bunch of liberals are screaming at you. I’m proud to be represented in Washington D.C. by you.

    Sincerely,

    Salient Digital
    Web Developer, Photographer, Pug Owner
    Tempe, AZ

    blog.salientdigital.com
    funny-pugs.com

    [1] http://www.nytimes.com/2010/11/18/opinion/18thu1.html?scp=1&sq=national%20security%20start&st=cse

    [2] http://www.nytimes.com/2010/11/19/world/europe/19start.html

    [3] http://www.azcentral.com/arizonarepublic/opinions/articles/2010/11/21/20101121kyle-start-treaty-robb.html

  • Get MySQL Certified For Just Under Four Grand

    Posted on November 15th, 2010 phpguru No comments

    Oracle just sent me an email with a “soft offer” to get 20% off MySQL Certification. I’m using GMail in Safari. I click to see the pricing. The click-through sent me to this page.

    The page requires you to pick your country, and then breaks. Second time, I get an error message: The packages couldn’t be received. Third time it worked.

    Normally, $4,635 – act fast and get MySQL Certified for only $3,708.

    So let me see if I understand this correctly… in a down economy, when the average guy is just lucky to have food on the table… I can pay just under four thousand dollars to be certified to use a free database? Hmmm. I’ve never been asked by any employer for such a certification.

    I think I’d rather eat this month.

    Great email campaign though – generated three clicks. D’OH! Fail.

  • Twitter API Snowflake and MySQL

    Posted on November 13th, 2010 phpguru 2 comments

    I’ve been looking at APIs lately, and in particular, the Twitter API.

    I managed to stumble into an advanced discussion on the Twitter developer forums about Twitter’s “Snowflake” update. One of the primary changes of the Snowflake update is the use of 64-bit integers for their ID.

    As a PHP & MySQL developer interested in learning more about the Twitter API, I want my database schema to be optimized properly.

    On this page of the MySQL website, it says, in part:

    Some things you should be aware of with respect to BIGINT columns:

    • All arithmetic is done using signed BIGINT or DOUBLE values, so you should not use unsigned big integers larger than 9223372036854775807 (63 bits) except with bit functions! If you do that, some of the last digits in the result may be wrong because of rounding errors when converting a BIGINT value to a DOUBLE.

    Does that mean I cannot use a BIGINT to store a Tweet’s primary key?

    Surely VARCHAR(64) will be much slower…

  • How to embed Windows Media Files on your Website

    Posted on November 7th, 2010 phpguru No comments

    This article over at Microsoft explains how to embed .WMV (Windows Media Video) as well as .ASF files on the web.

    The thing is, their method seems crippled (even wrong) as it explains how to create an additional text file for every WMV video, and to save it with a .wvx or .asx extension… which is quite strange, in addition to being totally time consuming and redundant.

    While that may be the official method, I found this post at MediaCollege which has a simple object embed tag for WMV, but it doesn’t validate, since <embed> tags are deprecated.

    In the end, I went with this technique at A List Apart . You may want to try this one first, because it’s more effective in more browsers, and is the only way to do it if you want your document to validate under a strict XHTML doc type.

    Now you know how to embed .wmv — the right way. Enjoy!

  • Are Libelous Liberals at Google Slandering Michael Savage Trickle Up Poverty?

    Posted on November 1st, 2010 phpguru No comments

    I am a bit furious right now. We know Google has scammed Uncle Sam (and thus, every American) out of some $60 billion in taxes over the past few years. We, in the internet marketing business, are also quite familiar with the fact that Google routinely censors ads it doesn’t like, even threatening to cancel your Google account. This can effectively ruin, or at least greatly hinder, a company’s online marketing campaign.

    So, woe be unto you if Google doesn’t particularly care for your type of business. With their two-thirds marketshare, Google has a long list of vague things they don’t allow you to advertise, but inconsistent application of their policies often result in plenty of ads and sites (often your deep pocketed competitor’s) making it into the listings.

    Well, it appears that Google may be up to some more sinister tricks here.

    I just looked up Michael Savage’s new book, “Trickle Up Poverty,” on Google Books.

    I find not one, but two links for the book there. Neither of them contain a preview.

    To my horror, the top search result contains what appears to be a slanderously edited cover image including a hammer and sickle.

    Did an early or foreign release of Trickle Up Poverty contain a hammer & sickle on the cover? Or does Google want it to appear as though Michael Savage is a communist?

    I am extremely interested in knowing why an erroneous, inflamatory cover image of Trickle Up Poverty would be the number one link on Google Books when searching for the title. I just purchased Trickle Up Poverty at the San Jose airport Hudson News over the weekend. It was on the “Hudson News Recommends” table. Trickle Up Poverty is also #3 on the New York Times Bestseller List.

    But it has no communist symbolism on it anywhere. Quite the contrary. The second cover image is the actual design of the book that I am glad I bought. I am hopeful that someone from Europe or Asia will comment and confirm that the hammer and sickle design is, in fact, a legitimate or early release version in non-U.S. markets.

    How is the book? AXcess News rates it 5 out of 5 stars, and the Dakota Voice calls it “essential reading.” Another reviewer agrees,

    “If you buy ONE book this year, make it Trickle Up Poverty.”

    My own review is forthcoming. I’m only a few chapters into it and already feel like I’ve been asleep for the last two years. Most reviews award from one to five stars. To quote Spinal Tap,

    “This one goes to eleven!”

    On page after page, Savage gives us wake-up call after wake-up call, with more proof than a CSI murder trial. On average, Savage provides over 50 footnotes per chapter, giving avid fans and protesters alike, the research, articles, interviews and actual transcripts of Obama and his Czars from the past several years, on which the book is based.

    In case the rats over at Google Books change their results on link above, I’m attaching proof below. This is an un-altered screenshot taken Nov. 1, 2010 at 7:55pm MST.

  • LVS-TUN How To on RackSpace Cloud

    Posted on October 6th, 2010 phpguru No comments

    I have to hand it to the sales/techs over at RackSpaceCoud.com.

    After just a few minutes with their Online Chat Sales, I was intrigued enough to create an account. Heck, it was free, and would give me a chance to experiment with server configuration via one of the hot topics today – virtualization.

    One of the first things I mentioned to Zack (I think that was his name) was that I was interested in making a more fault-tolerant web server setup. My client at the time had a dedicated server, but was planning on a few different television appearances, and didn’t want his site to go down with the surge of traffic.

    Load Balancer How-To using Apache Mod_Proxy (Easy)

    The RackSpaceCloud tech linked me to this article by Brandon Woodward on how to set up a simple load balancer using Apache. I followed that article to the letter, using one CentOS VM for the load balancer, and two CentOS VMs for web heads.

    Well, I have to admit, it was not as difficult as I thought it would be. Now granted, it’s not super robust, but for a simple round-robin load balanced setup, it only took an hour or two to setup and configure, and it is still in place on the client’s domain. Not bad, considering it’s the equivalent of 3 servers for less than $50/mo.

    Load Balancer How-To using LVS-TUN (Intermediate-Advanced)

    Having found the RackSpaceCloud article on setting up a load balancer with Apache just a few months prior, I was interested in learning more when I saw this new article by the same author on installing and configuring LVS-TUN.

    I was intrigued, because even though I believe having a mod_proxy-based load balancer solution on 3 servers in the cloud is preferrable in many ways to a single server with no load balancer at all, I could still see some areas for improvement and wondered what else was out there.

    Woodward explains it like this:

    LVS-TUN is a tunneling load balancer solution that will take all incoming requests through the load balancer and forward the packet to the web nodes. The web nodes will then respond directly to the client without having to proxy through the Load Balancer. This type of solution can allow for geo-load balancing, but will more importantly allow a customer use the bandwidth pool available from all web nodes, instead of relying on the limited through put of the load balancer.

    In other words, whereas the mod_proxy-based load balancer is quick and easy to set up and manage, the load balancer itself is a single point of failure, since it is acting as a proxy for the two web heads behind it. LVS-TUN on the other hand, enables the load balancer itself to be distributed, and also takes advantage of the web heads serving content directly back to the client.

    Whether you’re looking at a load balanced setup for scalability or just your own hardware architecture experimentation, without a doubt, the cloud is the best playground.

  • Another Twitter Follower I am Proud Of

    Posted on October 2nd, 2010 phpguru No comments

    MancowMuller is now following me on Twitter. What a cool guy.

    Mancow, I really Miss you & Turd on the morning show in Chicago. I moved away over 8 years ago, and still have yet to find a better morning talk radio show. Laura Ingraham is my current pick. I guess she’s a great 2nd choice. I need to download your past shows and put it on my iPod.

    My wife and I still listen to White Cotton Panties. “Bread is not my friend!” ROFL.

    Also, I still use ” … sofa king good… ” all the time. It gets past every profanity filter there is.

    Mancow, for the month of October, Pick a Charity of your choice, and all the proceeds I get from my online T-Shirt Shop FeelGoodGear.com I’ll give to your favorite charity.


     DUH: Democrats for Understanding History

    Spreadshirt Market Place Design

    DUH: Democrats for Understanding History


     God Bless Our Boys Our Girls Our Country F14

    Spreadshirt Market Place Design

    God Bless Our Boys Our Girls Our Country F14


     Bovine Excrement Free - 2 Color Art

    Spreadshirt Market Place Design

    Bovine Excrement Free – 2 Color Art


     God Bless Our Boys - 1 Color Art

    Spreadshirt Market Place Design

    God Bless Our Boys – 1 Color Art


     Borders Language Culture - 3 Color Art

    Spreadshirt Market Place Design

    Borders Language Culture – 3 Color Art


     Republican Elephant - 2 Color Art

    Spreadshirt Market Place Design

    Republican Elephant – 2 Color Art

    MancowMuller is following me on Twitter

    MancowMuller is following me on Twitter

  • Why Twitter is Cool

    Posted on September 26th, 2010 phpguru No comments

    Check out this email I just received.

    Karl Rove is now following me on Twitter

    Karl Rove is now following me on Twitter

    It was funny – I saw this when I checked my email this morning and exclaimed,

    Hey, Karl Rove is following me on Twitter!

    My wife said,

    Who’s Karl Rove?

    We were just stepping into the local Starbucks. I glanced on the cover of the New York Times, and Karl Rove was featured in the first line of a front page story. I nudged my wife, pointed and said,

    See? Look, Karl Rove.

    The New York Times article summarizes Mr. Rove’s career, and also hints as to why he’s been more in the news lately:

    Already a prominent presence as an analyst on Fox News Channel and a columnist at The Wall Street Journal, Mr. Rove is also playing a leading role in building what amounts to a shadow Republican Party, a network of donors and operatives that is among the most aggressive in the Republican effort to capture control of the House and the Senate.

    Democrats were happy when Mr. Rove left the White House in 2007 and don’t appear to be too thrilled about his return to the public eye.

    Anytime Democrats are not happy about something… that’s good news for Republicans, business owners, everyday Americans and the middle class. Great news.

    Anyway, that’s why Twitter is cool. Instantly connect to the world… you care about. I’m directly connected to the the shapers of This Great Country we love so dearly. This got me thinking,

    I better step up my game, now that Karl Rove is watching me.

    Once someone I respect is paying attention, I want to straighten up, stand tall, and look and perform my best; live up to my ideal; project excellence with honor.

    Ironically, this is exactly what Karl Rove does (and a few others, Beck, Hannity, Ingraham, O’reilly, Broomhead) to the Liberal establishment. Once these guys aim their discerning eyes at you and speak the truth, the laser-focused exposure on the ridiculous behavior we are getting from these insane Dems in power makes them realize they have to clean up their act, stand up straight and improve their game. Bigtime.

    As more truth is revealed about ObamaCare, the Stimulus, and the Dems socialist globalist agenda, The People are wising up, and Dems are all realizing that their days are numbered. And no, they don’t like it one bit.

    Keep it up, Karl!

  • New Democratic Party Logo? How about a New Organization Instead

    Posted on September 22nd, 2010 phpguru No comments
    Democrat New Logo

    Democrats have a new logo. Like it?

    Funny T-Shirts from FeelGoodGear.com

    So there’s a new Democratic Party Logo. Some bloggers have poked fun at it. And why shouldn’t they? Our elected officials are mocking you every day with pure insanity. Guys, you don’t need a new image, a new branding. Trust me, the Ass fits you just perfectly. No, what you need is a new organization…

    Democrats for Understanding History.

    Instead of doing what you do now, you’d get together every day in Washington D.C. and study the constitution, the founding fathers, and the history of the greatest country on God’s Green Earth, the United States of America.

    Maybe a little history lesson every day will help you to stop screwing up our country by turning us into a 3rd world banana republic with your globalist socialist agenda that is killing the middle class.

    The poet and philosopher George Santayana said,

    “Those who cannot remember the past are condemned to repeat it.”

    For the love of God, people, socialism doesn’t work! Please stop taking our money to spend our great grandchildren into oblivion!

    New Democratic Party Logo? How about a new organization... DUH!

    New Democratic Party Logo? How about a new organization... Democrats for Understanding History


     DUH: Democrats for Understanding History

    Spreadshirt Market Place Design

    DUH: Democrats for Understanding History