Blog

  • Call a Woman a Dude

    This goes out to the Canuck last week, the cool mom in QA at BellSouth, and the cool mom in QA at Surgical Information Systems.

    SEE!? I was being politically correct!

    “Men report that they use dude with women with whom they are close friends, but not with women with whom they are intimate,” according to the study.

    CNN Article

    Via her majesty… who isn’t a dude.

  • Flash Remoting in AS2: RelayResponder2

    Flash MX 2004 with ActionScript v2.0 introduced enhanced syntax checking. For example, if you have a function in your class, and you mispell it, the compiler will throw an error, helping you easily find and correct the answer so your code will run as expected.

    The AS2 classes for Flash Remoting do not take advantage of this fact for RelayResponders. I fixed that. Instead of passing in strings for your result and fault functions, you can pass in the functions themselves, much like you do for the first format setInterval, or when utilizing the Delegate class.

    What’s different from the original (mx.rpc.RelayResponder)? Only that the __onResult and __onFault functions are now datatyped as Function vs. String, and called via Function.call(scope, param) vs. scope[string](param).

    import mx.rpc.Responder;

    class mx.rpc.RelayResponder2 extends Object implements Responder {

    private var __obj:Object;
    private var __onFault:Function; private var __onResult:Function;

    function RelayResponder2( resp:Object, resultFunc:Function, faultFunc:Function ) {
    super();
    __obj = resp;
    __onFault = faultFunc;
    __onResult = resultFunc;
    }

    function onFault( fault:mx.rpc.FaultEvent ):Void{
    __onFault.call(__obj, fault);
    }

    function onResult( result:mx.rpc.ResultEvent ):Void {
    __onResult.call(__obj, result);
    }
    }
  • Flash Date to MySQL Date String

    Was doing some AMFPHP work with Flash & MySQL Saturday, and doing your typical data massaging/conversion that one does in the imperfect world of webservices. I needed to have a Flash Date object stored in MySQL and have it come back out again to be usable for the DateField component in Flash. Since the MySQL Date colum type is easily created as a String, it was only a matter of going back to a Flash Date.

    Maybe if someone’s bored, they can add the mask required to have this functionality in Darron’s DateFormat class.

    GOTCHA: The Date object in Flash returns a 0 based month value. So, December is 11, not 12.

    Example:

    a = new Date();
    trace(a); // Tue Dec 7 07:33:08 GMT-0500 2004
    s = getFormatFromDate(a);
    trace(s); // 2004-11-07 07:33:08
    d = getDateFromFormat(s);
    trace(d); // Tue Dec 7 07:33:08 GMT-0500 2004
    
    function getFormatFromDate(d:Date):String
    {
    var year:Number = d.getFullYear();
    var month:Number = d.getMonth();
    var day:Number = d.getDate();
    var hour:Number = d.getHours();
    var minutes:Number = d.getMinutes();
    var seconds:Number = d.getSeconds();

    var s:String = "";
    if(year < 1000)
    {
    if(year < 100)
    {
    if(year < 10)
    {
    if(year < 1)
    {
    s += "0000-";
    }
    else
    {
    s += "000" + year.toString() + "-";
    }
    }
    else
    {
    s += "00" + year.toString() + "-";
    }
    }
    else
    {
    s += "0" + year.toString() + "-";
    }
    }
    else
    {
    s += year.toString() + "-";
    }

    if(month < 10)
    {
    s += "0" + month.toString() + "-";
    }
    else
    {
    s += month.toString() + "-";
    }

    if(day < 10)
    {
    s += "0" + day.toString() + " ";
    }
    else
    {
    s += day.toString() + " ";
    }

    if(hour < 10)
    {
    s += "0" + hour.toString() + ":";
    }
    else
    {
    s += hour.toString() + ":";
    }

    if(minutes < 10)
    {
    s += "0" + minutes.toString() + ":"
    }
    else
    {
    s += minutes.toString() + ":";
    }

    if(seconds < 10)
    {
    s += "0" + seconds.toString();
    }
    else
    {
    s += seconds.toString();
    }

    return s;
    }

    function getDateFromFormat(s:String):Date
    {
    var a:Array = s.split(" ");
    var theDate:String = a[0];
    var theTime:String = a[1];

    var dateArray:Array = theDate.split("-");
    var year:Number = parseInt(dateArray[0]);
    var month:Number = parseInt(dateArray[1]);
    var day:Number = parseInt(dateArray[2]);

    var timeArray:Array = theTime.split(":");
    var hour:Number = parseInt(timeArray[0]);
    var minutes:Number = parseInt(timeArray[1]);
    var seconds:Number = parseInt(timeArray[2]);

    var d:Date = new Date(year, month, day, hour, minutes, seconds);
    return d;
    }
  • Blogspam == DNS Attack

    I’m starting to think blogspam is the equivalent of a DNS attack. Currently, I’m effectively shut down. I cannot blog, because if I post an entry, I cannot allow feedback. My comments, if opened, will be open to predations by hundreds of blog spam comments a day. I don’t have time to sort through and delete 300+ comments a day whilst ensuring the real comments stay in and get approved.

    Now, this has been going on for the past 2 months. When I turned on MoveableType’s comment approval, it significantly helped my cleanup efforts because deleting un-approved comments was much faster than rebuilding the entry they had polluted, and no negative content was posted on the front of my site.

    Things got so bad, my web hosting provider, Mediatemple, called my cellphone to inform me my site was consuming a lot of bandwidth because blogspammings were hitting my mt-comments.cgi during their weekely cron-job weekend forays. I’ve been imitating the admins behavior of renaming the file to mt-comments.cgi.removed when I needed a break, and back again to enable comments.

    However, after my 2nd failed attempt to install a Captcha test, the best defense against scripts since scripts can’t “see” images, I had to re-install MoveableType since my pryings into Perl foobarred something. I chose to use the MySQL option instead of the Perl flat-file database since I know MySQL a little bit, and was pleased with the enormous speed improvements in site rebuilds. However, users started reporting they couldn’t comment. Whatever flag sets how many db connections at one time was being overwhelmed by the blogspam scripts.

    Now, if you haven’t successfully obtained a single blogspam comment on my site in 3 months, why would you continue? Only 1 reason: To shut me down.

    You want proof of their tenacity? Check the email address of this lastest blog spam comment (I renamed my mt-comments.cgi to mt-comments.cgi.remove):

    gocha9818@see.it

    Yep, blogspam; the poor man’s DNS attack.

    I can’t blog without comments because that defeats the purpose of getting feedback, positive or negative. However, I want to continue blogging, and will do so once I find a solution.

    A collegue and I are creating our own blogging solution with 2 goals being the driving forces behind it:
    – easy to use. installation should be painless.
    – built in blogspam protection

    There are more, but those are the main 2 that are extremely important to me, and seriously lacking in MoveableType. MT Blacklist doesn’t work in newer versions of MT, and installing Captcha assumes you know and can debug Perl, which I can’t. This stuff should just work.

    I’m tempted to download MT 2.66 and reinstall an older version of MT-Blacklist; when they actually worked. How can people screw up software this much?

    Just to counter, unless you can provide me with a solution that does the following, I’m continuing on my own endeavor like Oscar Trelles, and building my own:
    – allows comments anonymously
    – supports blacklisting of urls
    – supports captcha tests or other means of script prevention
    – generates static content that is easily indexed by search engines
    – is free, including the server-side portion that powers it

    My apologies to those who have commented in the past 2 weeks only to end up with error pages. I’m defeated, for now. JesterXL always wins the game, and I’ll take this round as a defeat knowing I’ll dominate the next one. I realize I’m merely feeding the spammer by acknowledging his victory, but as a man of honor, I understand the game, and give credit were credit is due. Dude, this is war!

    *** Update: I was told to go here, but my reservations are it is pretty much the same process that the Captcha test wants you to do with the same risk I’ll screw something up. Going to try to ease the pain…