Blog

  • 2014 Resolutions Review 01: So Far, So Good

    March 3, 2014

    It’s MARCH 3RD, the first of 10 monthly reviews of my yearly “Groundhog Day Resolutions”. Groundhog Day Resolutions (GHDRs) are about picking a goal and moving toward it, reviewing it on 3/3, 4/4, 5/5, and so on until December 12. It’s been a pretty good February, thanks to a change in my attitude. (more…)

    Read more
    DSri Seah
  • Migrating from ActionScript 2 to ActionScript 3 Notes

    March 2, 2014

    I have been attempting to updated an old Flash CS4 project written in AS2 to the current version of Flash Pro CC, and discovered that it no longer supports AS2. So, you are forced to update your project.

    Conversion Strips Scripts

    The update process strips out any scripts attached to the instances, which I guess is good. I don’t think I was using any. You don’t get any kind of list telling you that there’s a problem.

    New Package Usage Syntax

    All my scripts are organized by folder in the dseah package hierarchy, and there are subpackages like dseah.ett and dseah.io. I’m working through compiler errors about packages; notably:

    5007: An ActionsScript file must have at least one externally visible definition.

    Googling this error brings up advice in wrapping this in a package so you can declare the constructor of your class public. Here’s an example of an old AS2 class:

    import mx.services.*;
    import dseah.io.Debugger;
    
    class dseah.io.DSWebService {
        [...]   
        function DSWebService(wsdl:String, listener:Object, func:Function) {
            [...]
        }
    }
    

    Most of the blathering on StackExchange suggests wrapping everything in a the global package, as in:

    package {
        import mx.services.*;
        import dseah.io.Debugger;
    
        class dseah.io.DSWebService {
            [...]   
        }
    }
    

    You will, however, get a NEW error:

    1037: Packages cannot be nested.

    It took me a while to figure out what this meant, because there is a lot of blather on StackExchange about “autogenerated package namespaces” and “try purging your project cache in FlexBuilder” and even “It works for me.” It actually is another change in AS3 from AS2, and it’s a big DUH: when using the package keyword, you must match the hierarchy and the class names no longer have the path. This is the way other languages work, and it makes sense. It should look like this:

    package dseah.io {
        import mx.services.*;
        import dseah.io.Debugger;
    
        class DSWebService {
            [...]   
        }
    }
    

    Then, the error goes away.

    Need to explicitly include packages

    The built-in Flash classes now have to be explicitly imported.

    Changes in Focus and Events

    Selection goes away, and is accessible now as the stage.focus property of a DisplayObject (movieclip, textfield).

    TextField.onKillFocus and onSetFocus are replaced with general event listener syntax: addEventListener(FocusEvent.FOCUS_OUT, function (e:Event) { ... });

    Changes to SOAP

    It’s gone, and has been replaced with something new.

    setInterval() and getTimer() changes

    The callback works differently, accepting now a function reference instead of a closure object + function name string.

    Loss of _root

    There’s no easy way to grab _root. Working on fix.

    Loss of TextFormat.getTextExtents()

    Workaround is to make a new TextField, set its text format and text, and pull its textWidth and textHeight properties afterwards. This is possible now that the TextField isn’t a weird Flash object.

    WORK ONGOING

    … work ongoing to get to an error-free compile, then to see what else has broken. Sigh.

    Read more
    DSri Seah
  • Foggy Friday Final (Day 5)

    March 1, 2014

    Friday ETP This is the last day I’m going to publicly monitor the day’s activities for brain fog and its possible causes. Friday was largely a social day, followed by a huge tech binge that surprisingly didn’t wipe out my energy.

    (more…)

    Read more
    DSri Seah
  • Cloning/Migrating WordPress Multisite/Network Site to a New Domain

    March 1, 2014

    I’ve been wanting to try out a new theme for davidseah.com, so I needed to create a duplicate installation. Ordinarily, a plugin like BackupBuddy would help migrate the site with relatively little pain, but it turns out that the ones I tried are not able to handle a WordPress Network. This is the case when a single installation of WordPress is used to manage more than one blog; usually it’s one installation per blog. This site, davidseah.com, is a WP Network with each process blog (e.g. this InfoTech process blog) can have its own theme and set of features. There really is no reason for it other than I thought it might be useful for creating more focused subblogs, but in practice it probably hurts more than it helps.

    Anyway, since none of the commercial plugins I tried (BackupBuddy and WPMUDEV Snapshot) worked for me, I needed to perform the migration manually. I wasn’t sure if it could be easily done, but there were two helpful posts that got me through it: Moving WordPress Multisite on the WordPress Codex (which I stupidly read last) and Moving WordPress multisite to a new domain/server. You’ll also want to read Changing the Site URL if the domain name is changing.

    Basically you do this:

    1. Make a sqldump of the original database with mysqldump, using the WordPress db credentials in wp-config.php
    2. Archive the wp-content folder with tar, along with anything else you might need in the filesystem
    3. Ftp/sftp from the OLD server to the NEW server, and put the sqldump and tar archive
    4. Install WordPress on the new server, setting up the new WordPress db credentials
    5. Make sure you have some way of accessing the new WordPress database with a tool like PhpMyAdmin, because you will need to change some values if the domain is different!
    6. Make sure you have some way of seeing PHP errors.
    7. Use the mysql command to import the sqldump, using the new db credentials. Optionally use PhpMyAdmin.
    8. Untar the wp-content archive in a _tarballs folder to keep things tidy, and then cp -R (recursive copy) the contents of the themes and plugins folder over to the WordPress install.
    9. Make sure the wp-config.php file has the Multisite enabling commands, otherwise nothing will happen.

    Read on for example. (more…)

    Read more
    DSri Seah
  • Foggy Thursday (Day 4)

    February 28, 2014

    I got off to a late start, having let the morning dissolve into a blur of blog updates, email checking, and social media socializing. I don’t feel bad about that (at least, not TOO bad) because I had a breakthrough insight about the nature of the resistance that comes when I do a certain kind of work: I get a literal headache, and its cause may be due to a lack of closure. Now that I’m mindful of it, I can start to deal with it.

    Thursday's ETP (more…)
    Read more
    DSri Seah