Notes on Java, Solaris, PHP, LDAP…

July 20, 2009

Error blackhole in Adobe Flex or SWF player

Filed under: Uncategorized — negev @ 1:34 pm
Tags:

So you have an Adobe Flex application that uses GUI states. You get back to it after a longer period, and you need to fine-tune details. You need to set initial properties of some GUI controls for some situations. You already had an initialization function, so you just do it there. Then you run it, and the code just stops where you changed it. No error and no execution. You try the debug SWF player, same thing.

That’s when you access a GUI control, which wasn’t created yet. It happens if your control is added in a GUI state, but the component didn’t enter that state yet. Like if in the following you want to set contactMe.selected before you switch your component to “extendedForm“.

<mx:states>
<mx:State name=”extendedForm”>
<mx:AddChild position=”lastChild”>
<mx:CheckBox id=”contactMe” x=”10″ y=”216″ label=”Would you like us to contact you about our new products? Maximum 4 times a year.” />
</mx:AddChild>
</mx:State>
</mx:states>

Adobe Flex or SWF player should really report this as a null exception or some other meaningful error.

I reported it at Flex bugs site.

June 1, 2009

Using standard error output (stderr) in PHP

Filed under: Uncategorized — negev @ 10:51 am
Tags:
$STDERR= fopen("php://stderr","w");

February 12, 2009

Xdebug and NetBeans for PHP on Mac OS X

Filed under: Uncategorized — negev @ 1:08 pm
Tags:

I really used to like JEdit. It understands almost every shell/programming/database language and it colors source code accordingly. You can have 100+ files open, switch quickly between them and you can split the editor horizontally and vertically as you need.

But somehow JEdit on Mac OS didn’t like scrolling wheel recently – it jumped up and down, skipping many pages. So I’ve tried NetBeans 6.5. with PHP support. It looks beautiful. If you get PHP-only version of NetBeans rather than full version, it loads up quickly too.

While using NetBeans, I’ve noticed it can debug PHP via Xdebug. So I’ve installed Xdebug 2.0.4 on my Mac OS from sources – seemed easy. In Apache error log it just read: Failed loading /path/to/xdebug.so (null). But it didn’t load up in PHP. Then I’ve tried MacPorts Xdebug package, but still the same.

After I’ve tried several ways to resolve this, I’ve come across a solution at http://patrickgibson.com/news/andsuch/000198.php

Debugging PHP in NetBeans rocks! You can see variables, arrays, objects, set up breakpoints…. lovely!

December 22, 2008

Darcs – source code management

Filed under: Uncategorized — negev @ 1:55 pm
Tags:

When talking to to DokuWiki community, I’ve noticed that they use Darcs – http://darcs.net

December 19, 2008

DokuWiki fix

Filed under: Uncategorized — negev @ 6:39 pm
Tags: , ,

Some time ago I’ve customized DokuWiki for our purposes – extra integration with LDAP and Novell iChain, and making it all nicer. Today I’ve fixed two bad errors that appeared when I was updating it to version 2008-05-05.

DokuWiki is perfect for users and it has many plugins. But if you want to customize or fix anything in it, then you’ll find that it is really disorganised inside.

December 18, 2007

Google Pack

Filed under: Uncategorized — negev @ 9:38 pm
Tags:
  • google pages – hosted as *.googlepages.com
  • pack.google.com – it includes free antivirus for Windows

December 11, 2007

C-like shortcuts leading to errors in PHP

Filed under: Uncategorized — negev @ 6:06 pm
Tags:

Today I’ve come across yet another tricky error in PHP… I had the following code. $info in it is an LDAP result array. I wanted to extend the if(..) condition to check whether $info[‘count’] is exactly 1. So I took

  if( $info=$myObject->All($res) ) {
}

and changed it into

  if( $info=$myObject->All($res) && $info['count']==1 ) {
}

Suddenly it stopped working, even for the LDAP results about which I knew they had exactly one item. As usual, it was the programmer’s error – but supported by PHP as it doesn’t check types in compile time. What I should have done was

  if( ( $info=$myObject->All($res) ) && $info['count']==1 ) {
}

Yet another reason to use strong-typed languages like Java, rather than script lingos as PHP.

Conflicts between Flex properties and component ids

Filed under: Uncategorized — negev @ 12:45 pm
Tags:

Today I’ve been extending mx:TitleWindow component. And I wanted to have a TextInput called ‘name’. However, when I added

  <mx:TextInput id="name" ... />

then I was getting funny errors like

Attempting to initialize inherited property 'name' of type 'String'
with value of incompatible type 'mx.controls.TextInput'

You can define and access visual subcomponents in Flex MXML very easily. They are almost equivalent to properties and subcomponents defined via Action Script. Adobe standard components and classes have plenty of properties and methods. However, that is a double-sided sward – because you may want to use the same property name or subcomponent id for something else, and you just can’t.

Solution: You can put your properties into a separate object, or separate them in some other way. Or call your properties/subcomponents by some other name.

December 4, 2007

Single-user boot and fdisk in OpenBSD

Filed under: Uncategorized — negev @ 10:14 pm
Tags:

I needed to test something in OpenBSD. So I’ve installed it on a separate partition on my AMD-based laptop. What a surprise – when I wanted to boot up the other system (Solaris), it turned out to be quite difficult.

In OpenBSD, if you want to choose (switch) the active (bootable) partition, you can’t do it on a hard-drive you’ve normally mounted from (read/write mount). You need the hard-drive to be mounted read-only. For that you need to start in a single-user mode. Right after you turn on/reset your computer, when the OpenBSD boot screen shows up, type boot -s. Then it asks you for terminal type and it doesn’t give you any default or common choice(s). It looks that vt100 is a good one. Then you boot up in a single-user mode.

You can run fdisk and it just prints the partition table and exits. Now let’s go change things: run fdisk -e wd0 where -e stands for interactive mode. You can type manual to show the commands at any time. If you want to change the active partition, type flag numer-of-partition. To commit the changes type write.

Surprises of Flex operators

Filed under: Uncategorized — negev @ 7:17 pm
Tags:

Flex operator == is a funny one. You won’t get much info on its behaviour in Flex docs. But it turns out that

  • it compares Strings by value
  • but it compares arrays by reference
    • the same for ‘non-primitive objects’ (never mind the non-sense) – compared by reference
Next Page »

Create a free website or blog at WordPress.com.