PHP4 & XML Generation

Posted by Quinn Madson | Posted in | Posted on 8:31 AM

0

<?php
// generate xml mime type
header ("content-type: text/xml");

// create xml document
$doc = domxml_new_doc('1.0');

// create xml root
$root = $doc->create_element("xml_root");
$root = $doc->append_child($root);

// create xml node
$item = $doc->create_element("xml_item");
$item = $root->append_child($item);

// add some text to the node
$item_text = $doc->create_text_node("yo yo");
$item = $item->append_child($item_text);

// generate xml output
$xml_string = $doc->dump_mem(true);
echo $xml_string;
?>
would generate:

<?xml version="1.0"?>
<xml_root>
<xml_item>yo yo</xml_item>
</xml_root>

PHP & LDAP

Posted by Quinn Madson | Posted in | Posted on 8:24 AM

0

// get username and password via form scope
$user = $_POST["username"];
$pass = $_POST["password"];

// format username for uwm ldap auth
$basedn = "ou=people,o=somewhere.edu";
$ldap_user = "uid=" . $user . "," . $basedn;

// connect to uwm ldap server
$ds=ldap_connect("ldap://ldap.uwm.edu");

if ($ds) {
// bind to uwm ldap server
$r=ldap_bind($ds, $ldap_user, $pass);
}

// close out ldap connection
ldap_close($ds);
Your basedn may vary. Also, the protocol, ldaps://. supposedly works but so far, I have had no luck. I have a sneaking suspicion that it has something to do with self-signed certificates.

HOW TO: Install Flex Builder 3 Alpha on Hardy Heron 64-bit

Posted by Quinn Madson | Posted in | Posted on 12:56 PM

0

32-bit Java Runtime Environment needs to be installed (which can be done through synpatic/apt-get).

Run the following at the command line:

export PATH=/usr/lib/jvm/ia32-java-6-sun/bin/:$PATH
Install the firefox-2 package from synaptic/apt-get.

Start the Flex installer:
chmod a+x flexbuilder_linux_install_a3_033108.bin
./flexbuilder_linux_install_a3_033108.bin
At the end of the install process, it may explain that you need to manually copy a file to the Firefox 2 plugins directory:
sudo cp Adobe_Flex_Builder_Linux/Player/linux/install_flash_player_9_linux/libflashplayer.so /usr/lib/firefox/plugins/
Start Eclipse and the Flex Builder 3 Plugin should be available.

HOW TO: Run 32-bit Eclipse on a 64-bit Hardy Heron platform

Posted by Quinn Madson | Posted in , , , | Posted on 12:28 PM

0

At a command prompt run:

sudo apt-get install ia32-sun-java6-bin
... or get it from Synaptic.

Download a 32-bit version of Eclipse from: eclipse.org. Extract the package to your home directory.

Right click on the Gnome panel and select "Add to Panel..."

Select "Custom Application Launcher" and click "Add"
Name: Eclipse IDE
Command: /home/qk/eclipse/eclipse -vm /usr/lib/jvm/ia32-java-6-sun/bin/java
Comment:qk is the coolest :)
(You can also set the icon by clicking on the default icon and navigating to your eclipse install directory. Replace qk with your username and/or eclipse with where you put eclipse.)
Click "OK"

Click the Eclipse launcher and you should be all set.

HOW TO: Dual Monitors Hardy Heron 64-bit nVidia NV44 [Quadro NVS 285]

Posted by Quinn Madson | Posted in , , , | Posted on 10:28 AM

0

System>>Administration>>Hardware Drivers

Check "Enabled" for: NVIDIA accelerated graphics driver

After you hit "OK" a bunch of times a few drivers will be installed and you will be told to reboot.

After reboot, I still only had one screen come up. Edit /etc/X11/xorg.conf (back it up first) to look like this:

# If you have edited this file but would like it to be automatically updated
# again, run the following command:
# sudo dpkg-reconfigure -phigh xserver-xorg

Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen" 0 0
InputDevice "Generic Keyboard" "CoreKeyboard"
InputDevice "Configured Mouse"
EndSection

Section "Module"
Load "glx"
EndSection

Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
EndSection

Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
EndSection

Section "Monitor"
Identifier "Configured Monitor"
EndSection

Section "Device"
Identifier "Configured Video Device"
Driver "nvidia"
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Configured Video Device"
Monitor "Configured Monitor"
DefaultDepth 24
Option "NoLogo" "False"
Option "RenderAccel" "True"
Option "TwinView"
Option "MetaModes" "1280x1024 1280x1024"
SubSection "Display"
Depth 24
Modes "nvidia-auto-select"
EndSubSection
EndSection

new machine; new os; new architecture;

Posted by Quinn Madson | Posted in , | Posted on 7:28 PM

1

I've been looking forward to getting the latest Ubuntu release 8.04 - Hardy Heron and at first glance, I'm a little disappointed.

Right out the gate, I wanted to connect to a secure webdav server (UWM PantherFile/Xythos) to get some back-up files. In Ubuntu 7.10 this was pretty easy: Places>>Connect to Server>>Secure WebDAV (HTTPS). This option was removed in 8.04 for some reason. It looks like I need to get some third party software like: cadaver to get it to work or wait for an update. Oddly enough, I heard that Mac's Leopard OS is also having network mounting issues.

The other thing I do on a fresh install at work is to bind the machine to my Synergy environment. Synergy client/server software allows me to use both Windows and Linux machines and use a single keyboard and mouse to use all the machines like a giant virtual desktop. According to the Ubuntu Forums and from my own experience, Synergy client pauses and dies 3 - 10 seconds into switching to the Ubuntu 8.04 machine unless the Synergy client is run as root. When it's run as root, everything works fine but, running an app like this as root does not seem like a good idea. Synergy is inherently insecure because all traffic is transmitted plain-text. For this reason, I run everything through SSH tunnels but even still running an app like this as root makes me feel a little exposed.

In all, it's worth the trouble as this machine is ridiculously over powered:
That's right -- the machine has 8 processors (dual quad-core Xeons) and 6 gigabytes of memory.

...which is where the next problem comes in. The machine has 64-bit architecture which I've never used before. I installed the Eclipse IDE 3.3.2, the CFEclipse plugin, and Sun Java 6.0 JDK with no issues. When I tried to install the Adobe Flex Builder 3 Alpha plugin, I got an error explaining that Flex 3 requires 32-bit architecture and Java JRE compiled for 32-bit. The error also states that this is possible but, I remain skeptical -- yet I will give it a shot tomorrow.

HOW TO: Set Flex MenuBar Currently Selected Item Text Color

Posted by Quinn Madson | Posted in , , | Posted on 7:34 AM

2

Seems like it should be fairly easy to let a user visually know which top level option they are currently under. ...like should be an option or options in Flex CSS.

Here's the best way I found to do it:

 <mx:Script>
<![CDATA[
private function menuHandler(event:MenuEvent):void {

var mb:MenuBar=event.target as MenuBar;
var selectedIndex:int=mb.selectedIndex;

for (var i:int=0;i<mb.menuBarItems.length;i++){
if(i==selectedIndex){
(mb.menuBarItems[i] as MenuBarItem).setStyle("color", "0xff7009");
}
else{
(mb.menuBarItems[i] as MenuBarItem).setStyle("color", "0xffffff");
}
}

if (event.item.@data != "top") {
logicHandler(event.item.@label, event.item.@data);
}
}
]]>
</mx:Script>
<mx:MenuBar id="appMenu"
x="0" y="114" width="100%" height="31"
labelField="@label"
dataProvider="{menuBarCollection}"
itemClick="menuHandler(event);" />

On the currently selected item, the text is set to orange. Everything else is reset to white. Example application.