Skip to content
December 24, 2011

Mirror website with wget

wget -mk -w 20 <em>http://www.example.com/</em>

-m mirror flag
-k adjusts the absolute urls to relative urls
-w x is a delay between requests (in seconds)
December 14, 2011

Flex: ReferenceError: Error #1065: Variable X is not defined.

I was loading an SWF externally in flex and being a flex noob, got bitten by this error. The loaded SWF was not able to find the definition of a class using function getDefinitionByName(). This function wasn’t actually called by my code but indirectly by the XMLDecoder I was using.

After a few hours of pain I found the solution so hope it helps:

Problem:

After you load an swf, you get this error:

ReferenceError: Error #1065: Variable <class name in the loaded swf> is not defined.
at global/flash.utils::getDefinitionByName()
at…

Example of loading an swf (the button changes the source property to load an swf):


protected function launchBtn_clickHandler(event:MouseEvent):void {
loader.source = "Child.swf";
}

<mx:SWFLoader id="loader"  complete="loader_completeHandler(event)" />

<s:Button id="launchBtn" label="go" click="launchBtn_clickHandler(event)"/>

You get that error.

From what I’ve gathered, this is caused because the flex runtime loads applications into LoaderContext’s. A loaderContext defines both a SecurityContext and an ApplicationDomain. The app domain defines how the runtime finds and loads classes and packages.

You can get around this error if you set the loaded application domain to be the same as the parent.  However if you do this and there is a name collision on some class, the loaded class will be ignored.

Solution :

protected function launchBtn_clickHandler(event:MouseEvent):void {
//set the same app domain on the child and parent swf's
 loader.loaderContext = new LoaderContext(false,ApplicationDomain.currentDomain);
 loader.source = "Child.swf";
}

Better and longer explanations:
flex documentation
Hope it helps,

August 25, 2011

Dynamically determining the fields of an Abap structure

This example is taken from the sap help. Took me a while to investigate how this could be done, so here it is.

REPORT typedescr_test.

TYPES:
  BEGIN OF my_struct,
    comp_a type i,
    comp_b type f,
  END OF my_struct.

DATA:
  my_data   TYPE my_struct,
  descr_ref TYPE ref to cl_abap_structdescr.

FIELD-SYMBOLS:
  <comp_wa> TYPE abap_compdescr.

START-OF-SELECTION.
  descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).

  WRITE: / 'Typename     :', descr_ref->absolute_name.
  WRITE: / 'Kind         :', descr_ref->type_kind.
  WRITE: / 'Length       :', descr_ref->length.
  WRITE: / 'Decimals     :', descr_ref->decimals.
  WRITE: / 'Struct Kind  :', descr_ref->struct_kind.
  WRITE: / 'Components'.
  WRITE: / 'Name              Kind   Length   Decimals'.
  LOOP AT descr_ref->components ASSIGNING <comp_wa>.
    WRITE: / <comp_wa>-name, <comp_wa>-type_kind,
             <comp_wa>-length, <comp_wa>-decimals.
  ENDLOOP.

September 15, 2010

Web Dev Tip: Prevent ie8 from sharing sessions across windows

If you’re stuck with ie8, you’ll soon realize that ie8 has the “awesome” habit of sharing your sessions across all windows. This means that if you’re logged on a site and open another window to the same site, it will use the same session. This is a PITA if you want to test you portal with different users.
To disable this behaviour, add the the following flag to your ie shortcut: “-nomerge”
And you’re done. Now you can safely launch a new ie and it will not share a session with any other window.

September 3, 2010

Ubuntu-Server bash colors not appearing on login

Ubuntu-Server bash colors not appearing on login

August 23, 2010

Get the path to python’s site-packages

The following command gives you the absolute path to python’s site-packages directory:

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

August 3, 2010

Loop over internal table using field symbol

 


FIELD-SYMBOLS: <fs_my_table> LIKE LINE OF my_table.
LOOP AT my_table ASSIGNING <fs_my_table>.
    <fs_my_table>-my_field = '23'.
ENDLOOP.


Loop over a table modifying a column.

Follow

Get every new post delivered to your Inbox.