Zydecode Studio

getVersion() weirdness

February 13th, 2006

to generate a result for getVersion() in a swf loaded into a parent swf via loadclip(), use getVersion() in the parent and set a variable there, then call this var from your child swf if you need it.

Couldn’t get this to work any other way; tried calling the function directly from the child, but couldn’t make it happen…

Ports to Install…

January 15th, 2006
  • cvsup-without-gui
  • freebsd-update
  • /misc/porteasy
  • /misc/mc
  • /editors/emacs
  • /security/sudo
  • /databases/mysql50-server
  • /www/apache22
  • /lang/php5
  • /ftp/pure-ftpd
  • /dns/bind90
  • /security/nmap
  • /security/nessus
  • /mail/postfix
  • /mail/dovecot
  • /mail/roundcube

tools:

  • sockstat : find all open ports

local modification time

January 14th, 2006

local modification time does not match remote

Do a “make distclean” and try again.

Nortel “Reporting for Call Center” bugs

November 14th, 2005

okay, this one’s bitten my ass twice now, so it gets documented. Default install of RFCC - ASP, with mySQL, Crystal Reports, Java, yadda yadda.

Here’s what you’ll have to deal with.

1. when you try to run reports you’ll get an ASP error on the client - seems to be because of the Response.Expires = 0 in AlwaysRequiredSteps.asp. You will need to turn on Buffering in IIS to avoid having this error hang the reports.
2. ActiveX won’t install on clients if you have any sort of half-decent security set up for IE. If so, get the file directly from the server and install on client system manually (npviewer.exe).
3. If you’re not using IE, the reports page will be pretty much blank (just a little red X). There is an ASP file that detects non-IE browsers (SmartViewerActiveX.asp) and so will use the Java viewer instead of ActiveX; Crystal Reports is looking for ReportViewer.jar. However, the default install of RFCC doesn’t install the Java viewer, you’ll need to go out on the web and track one down. Brilliant. :o(

After you’ve jumped through these hoops, it seems to work okay.

[edit 2005-11-22] one other little thing - the ipView app seems to be playing up. WallboardDriver.exe loads with RFCC, and if I subscribe any clients via their IP address in the admin - I get DrWatson errors on the RFCC server as frequently as ONCE EVERY 5 SECONDS! On top of that, WallboardDriver.exe will consume memory until eventually the server locks up - in as little as 5 hours. Unsubscribing all listeners from Wallboard fixed the issue - but that means that it’s useless! Sigh. Also - it seems pretty much impossible to turn off WallboardDriver.exe - it’s not started via startup items, it’s not listed as a service, and it won’t shut down via Task Manager. So - the only way I can keep my RPCC server running is to have no-one use Wallboard. Again.. Brilliant.

removeEventListener with Delegate & multiple callers..

November 2nd, 2005

painful stuff… trying to create a row of buttons, add eventListeners to them all, and pass the ‘release’ event to a single function (rather than one function per button). Because I have to use Delegate.create, it’s difficult to add arguments - and then also make sure that the removeEventListener also works. :oP

I’m SURE there are more efficient ways to do all this - and I don’t enjoy this MVC stuff at all when it results in this level of convolution. Makes me want to get back into the Flash IDE and stay on _root…

My starting point for this code came from paulspitzer.com. His suggestion of using arguments.caller as a ’shortcut’ in the removeEventListener works well - but only for the button that actually called the function… however, using this idea, I did find a way to pass button movieclip variables into the function. This means I can now add listeners to multiple buttons, pass arguments, and remove the listeners, with a fairly small amount of code.

Still seems like spaghetti though.

import mx.utils.Delegate

class Test_DelegateRemoval {

private var btn_frame:MovieClip;
private var releaseDelegate;

public function Test_DelegateRemoval() {

btn_frame = base.createEmptyMovieClip('btn_frame', 201);

releaseDelegate = Delegate.create(this, this.load_main);

for (var i:Number=0; i< =5; ++i) {
var btn_start = btn_frame.attachMovie('CW_button', 'btn_'+i, i);
btn_start.label = 'button '+i;
btn_start._x = i*100;
btn_start.btnID = i;
btn_start.addEventListener('release', this.releaseDelegate);
}
}

private function load_main(event:Object):Void {

for (var i:Number=0; i<=5; ++i) {
btn_frame['btn_'+i].removeEventListener('release', this.releaseDelegate);
}

var btnID:Number = event.target.btnID;
Init.load_data(fbtnID);
}
}

slice up images into squares in Photoshop

October 29th, 2005

var srcDoc = app.activeDocument;

app.preferences.rulerUnits = Units.PIXELS;

var sq = 100;
var widthParam = app.activeDocument.width/sq;
var heightParam = app.activeDocument.height/sq;
var pI = 0;
var pJ = 0;

for (var j = 0; j < heightParam; ++j) {

pJ = j*sq;

for (var i = 0; i < widthParam; ++i) {

pI = i*sq;

srcDoc.selection.select(Array (Array(pI, pJ), Array(pI+sq, pJ), Array(pI+sq, pJ+sq), Array(pI, pJ+sq)), SelectionType.REPLACE, 0, false);

srcDoc.selection.copy();

var img = 'img_'+i+'_'+j;

var pasteDoc = app.documents.add(Number(sq), Number(sq), srcDoc.resolution, img);
pasteDoc.paste();

jpgFile = new File( 'D:/projects/zydecode/jpg/' + img + '.jpg');
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 8;
app.activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);

pasteDoc.close(SaveOptions.DONOTSAVECHANGES);

}
}

Open Windows Explorer in non-default drive

October 23rd, 2005

How to stop Windows opening Windows Explorer in the default “My Documents” folder, which is bloody annoying if you don’t use My Documents..

C:\WINNT\explorer.exe /e,E:\

SQL for analysing screen dimensions from CW stats

October 16th, 2005

SELECT cDesignDate, CONVERT(SUBSTRING_INDEX(cScreen, ‘ ‘, 1), UNSIGNED) AS cScreen FROM tbl_cd_05 WHERE cDesignDate > ‘2005-05-13 00:00:00′ AND cScreen > 800 ORDER BY cScreen;

popup window from JavaScript

October 16th, 2005

onclick="window.open(this.href, 'popupwindow',
'width=400,height=300,scrollbars,resizable');
return false;">

remove certain HTML tags

October 16th, 2005

tppabs=”[^ ]* gets rid of tppabs=”http://www.somesite.com/images/heads/wedding.jpg” etc

looks for first white-space after tppabs and stops