Salient Digital Techno Blog

Ramblings on technology with a dash of social commentary
RSS icon Email icon Home icon
  • Wolfram|Alpha Implemented My Suggestion

    Posted on March 15th, 2011 phpguru No comments

    We have received your feedback regarding Wolfram|Alpha.

    The issue you reported has been fixed on the site. See http://www.wolframalpha.com/input/?i=%24250+is+75%25+of+what%3F

    Thank you for helping us improve Wolfram|Alpha.

    Best wishes,

    Delores
    The Wolfram|Alpha Team
    www.wolframalpha.com

    Input: 50 is 75% of what?
    Name: Salient Digital
    Country: United States
    Occupation: Web Developer
    Organization:
    Id: 109996
    Date Received: 2010-08-03 22:07:45
    Message: Can you make it solve this input?

    `50 is 75% of what?`

    ‘what’ = var x;
    ‘of’ = operation ‘*’; // times
    50 = x * 0.75
    50/.75 = 33.33

  • Recursively Delete Dreamweaver _notes Terminal Mac OS X

    Posted on January 21st, 2011 phpguru 2 comments

    Check this out. Launch terminal and CD to your Sites directory.

    cd ~/Sites
    find website.com/* -name _notes -print0 | xargs -0 rmdir

    Gotta love LinuxForums.org.

  • Adobe Excuse the Interruption, but…

    Posted on January 20th, 2011 phpguru No comments

    Okay, Officially I hate Adobe worse than Microsoft now. Get ready for this, guys…

    I just got my computer back from being repaired (1), during which time I had a loaner computer from Fry’s Electronics. I’ve been working from a Time Machine backup on the loaner computer (2) and now have my original restored laptop with a fresh motherboard back again (3).

    I launch Photoshop to edit some vacation photos, since I haven’t seen the computer they were on for the last 20 days, and I’m greeted with this:

    Excuse the Interruption from Adobe

    Excuse the Interruption from Adobe


    Bullsh!t. Two other computers? How about my old one, a loaner and my repaired one (new motherboard surely generates a new Gestalt value which Creative Suite thinks is a new computer, which technically it is.) Okay well, I’ll try the “I already have deactivated the other computers” option and see what it does.

    Excuse the Interruption from Adobe

    Excuse the Interruption from Adobe


    Oh come on! What’s ridiculous is that I’ve only ever used this serial number on two computers. I formatted the loaner before returning it and now don’t have possession of it. Oh is some offshore call center person going to get an earful from me.

    Welcome to 2011.

  • MySQL won’t start on Snow Leopard

    Posted on December 31st, 2010 phpguru 5 comments

    I recently spent a lot of time scratching my head over this. Partial solution only at this point, any additional ideas would be most welcome.

    I restored a Time Machine backup from an older 32-bit MacBook Pro onto a new 64-bit MacBook Pro. Apache & PHP worked fine, but I had compiled the 32-bit version of 5.1 on the 32-bit box. I had problems with MySQL starting after the restore, which led me to rm -rf everything related to MySQL including the /Library/StartupItems/LaunchDaemon, reboot, and install the 5.1.54 from the 64-bit dmg download installer.

    After this, I figured I’d be fine, The MySQL preference pane in System Prefs shows “stopped”. Clicking start has no effect.

    ps aux | grep mysql

    shows only my grep command.

    I had to do a few things to get MySQL partially working.

    1) I had to

    chown -R mysql:wheel mysql-install-dir/bin
    chown -R mysql:wheel mysql-install-dir/data

    2) I discovered I can only start MySQL if, from terminal, I do:

    sudo /usr/local/mysql/bin/mysqld_safe --user=root

    I can’t connect to mysql from the command line with the dreaded

    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    I do another

    ps aux | grep mysql

    and see it’s starting with

    /usr/local/mysql/bin/mysqld 
      --basedir=/usr/local/mysql
      --datadir=/usr/local/mysql/data
      --user=root
      --log-error=/usr/local/mysql/data/MacbookPro.local.err
      --pid-file=/usr/local/mysql/data/MacbookPro.local.pid
      --socket=/var/mysql/mysql.sock

    So I make a symlink

    ln -s /var/mysql/mysql.sock /tmp/mysql.sock

    and try again

    mysql -u root -p

    Yes! Now I can use MySQL from the command line. After Googling for hours, I’ve seen others with similar install/starting problems on the latest Snow Leopard. I think it all has to do with file permissions on the /bin and /data directories.

  • New Kohana 3 Resources

    Posted on November 29th, 2010 phpguru No comments

    Kohana 3 is getting new fixes and upgrades every day. Here’s the latest batch of helpful new Kohana 3 resources on various topics.

    From Mixu.net…

    Kohana 3 Form Validation – validating form input (here’s another post on user input in Kohana 3)

    Kohana 3 i18n – localization/internationalization

    From Kerkness.ca…

    Kohana 3 ORM – Object Relational Mapping

    From DealTaker.com – now a 9 part Kohana 3 tutorial series

    Kohana 3 Routing – Choosing the right action based on the request

    From o1iver.net…

    Kohana 3 Introduction – 3 part series

    From elsewhere…

    Kohana 3 resized image urls

    Migrating to Kohana 3 from Dupal in 2 weeks

    Custom 404 page in Kohana 3

    Awesome explanation with diagram of (H)MVC

    Seems more are coming out every day. Kohana 3 rocks.

  • 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!