Tuesday, June 1, 2010

JavaScript Association Array

In JS here's how you loop through association array.

    for (var j in params) {
        alert('key is: ' + j + ', value is: ' + params[j]);
    }


Warning: params.length will always be equal to 0

Monday, May 31, 2010

Escape Double Quotes in JS

Ok so it seems like I'm doing some coding again. Here's how to escape a double quote in JavaScript from PHP:


onclick=\"addParameter('fun\\x22 and \\x22 games');\"

Tuesday, March 23, 2010

Brainshare Post 1

Well its Tuesday morning and here we sit once again at BS Salt Lake City. Already sick of the food, lucky they have some healthy options for breakfast, but the english muffin may give you a heart attack with the amount of cheese on it.

Very sadly the registration PCs seem to all be running Windows XP. Last time I was here I remember something called SLED, but it seems the Novell M$ partnership is stronger than ever. The second biggest stand besides the Novell one is the interoperability stand, aka M$ stand.

Yesterdays sessions where nothing to shout about, was still feeling a bit jetlagged, but it seems no one was too excited about anything and the opening keynote seemed to drag on forever.

I'm really hoping today turns out better, changed my schedule to include more technical sessions and less sales fluff.

Also there's only about 2500 people attending this year, as opposed to about 6000 last time I was here (2006), which could account for the lack of a food court hall, them rather opting to have food stands. Also I must say they could have some more seating about the session areas, seems like every open place with a power outlet is always occupied.

Now onto the more geeking stuff, the Internet speeds seems to be OK, better than last time, but the wireless seems to intermittently disconnect you now and than, speeds range from about 50KB to about 400KB depending on time of day. I've already downloaded Novell Designer and Analyser which refused to come down through one of our clients proxies.

Anyway time to run, hopefully I can post some photos soon.

Wednesday, February 24, 2010

Novell eDirectory Group Membership with PHP

You can use the following PHP functions to manage group membership for eDirectory:

function AddUserToGroup($ldap,$userdn,$groupdn) {   
    $userInfo["groupMembership"]=$groupdn;
    $userInfo["securityEquals"]=$groupdn;
    if(ldap_mod_add($ldap,$userdn,$userInfo)===TRUE) {   
        $groupInfo["member"]=$userdn;
        $groupInfo["equivalentToMe"]=$userdn;
        return ldap_mod_add($ldap,$groupdn,$groupInfo);
    }
    return FALSE;
}

function RemoveUserFromGroup($ldap,$userdn,$groupdn) {   
    $groupInfo["member"]=$userdn;
    $groupInfo["equivalentToMe"]=$userdn;
    if(ldap_mod_del($ldap,$groupdn,$groupInfo)===TRUE) {   
        $userInfo["groupMembership"]=$groupdn;
        return ldap_mod_del($ldap,$userdn,$userInfo);
    }
    return FALSE;
}

Friday, February 12, 2010

Thanks Google for Blocking Emails like this

I really need to wonder what type of people fall for emails like this:

 

I guess people would not be doing this if they did not find people falling for these scam emails.

Wednesday, February 10, 2010

Firebug 1.5 and Ubuntu 64 bit

Note to self, don't install Firebug from Firefox, rather do:

sudo apt-get install firebug

Ref: https://bugs.launchpad.net/ubuntu/+source/firefox-3.5/+bug/449744

Tuesday, February 2, 2010

VirtualBox Slow Performance with Shared Folder

Wow, was really give frustruted with the slow reponse using shared folders in VirutalBox. VirutalBox is awesome, but this was really making me to start to long for VMware. Lucky there was a fix :-)

http://www.virtualbox.org/ticket/1728

Basically you just need to disable NetBios in your guest, and tada the shared folders work much better :-)

Some very old poetry of mine

Tears

waves with foam frothing tips of crispy dew wash the ocean floor,
with rainbow colour shells sparkling in the dwindling light of a gray moon.
the sky has a darkness that seems to swallow the light,
only a shimmering line of the moon can be seen, no joy
in this sky, it drips tears of blackness upon the land
spreading like disease it covers all.
pray that this darkness never comes because the coldness it brings has never been felt,
it will cut ever living being down one by one until there is no more,
    for tears of darkness are never wiped dry.


Green

if grass is green what can be greener?

the flowers in my garden speak of grass that is greener,
        but I say I know better…
the pine trees on the hill tops speak of grass that is greener,
        but I say I know better…
the sparkling streams filled with sunlight speak of grass that is greener,
        but I say I know better…
the grass on the road side says it’s greener,
        but is grass really green?

Friday, December 11, 2009

Some nice addons for Ubuntu

Get those codecs to play all media formats and dvds:

http://www.ubuntugeek.com/install-mplayer-and-multimedia-codecs-libdvdcss2w32codecsw64codecs-in-ubuntu-9-10-karmic.html

Get cntlm to get through those M$ ISA proxies:

sudo apt-get install cntlm

Then just edit the
/etc/cntlm.conf
and fill in the proxy details then restart it with
/etc/init.d/cntlm restart
Then export your proxy and your in business :-)
export http://localhost:3128/

How to Listen to Streaming Radio on Ubuntu

Ok so I wanted to listen to Highveld radio on Ubuntu. Only problem was their website only seemed to catered for Windows. So after some digging I found the mms stream URL and gave it a try with:
mplayer mms://196.35.64.36/highveld_22
but got this:
connect error: Connection refused
No stream found to handle url mms://196.35.64.36/highveld_22

So I just changed it to:
mplayer http://196.35.64.36/highveld_22

and we're in business :-)

Monday, November 30, 2009

Our New Anthem - Eish :-|

VPN Issues on Ubuntu

Well this one has been causing me to pull my hair out for a couple of weeks. I was using the Cisco VPN client for Linux put got really tried of having to recompile it every time I did a Kernel update. So I switched over to vpnc the VPN stuff which works under network manager in Ubuntu. At first it seemed to work nice, but I found the connection was 'freezing' after I sshed into a server over the VPN. An example of this would be ssh to server, then run ls which works fine, then run ls -l and the connection 'freezes'. If I open another terminal sesssion to the server it would open fine, but ls and then ls -l would 'freeze' the connection. So after some digging our found out it had have something to do with my MTU setting. I still have a Windows VM and tested out the VPN their and used putty to ssh to the server and had no issues. I tried setting the MTU on my eth0 or wlan0 but no joy. Finally I found I needed to set the MTU on the tun0 connection like this to get it to work:

sudo ifconfig tun0 mtu 576

This mtu is very small, but I think its a setting on their side that maybe someones forgot to update since the days of dail-up connections. I am also glad to report the VPN connection is now working 'sharp-sharp'. :-)

Thursday, November 26, 2009

How to rename file extentions in Linux

This is a nice command to basically rename all .csv files in a directory to .bak

for x in *.csv; do mv "$x" "${x%.dot}.bak"; done

Wednesday, November 11, 2009

Axis 2 get client's IP address

This seems to be the easiest way to do it:

MessageContext msgContext = MessageContext.getCurrentMessageContext();
String ip = (String) msgContext.getProperty(MessageContext.REMOTE_ADDR);


Also required:

import org.apache.axis2.context.MessageContext;

Followers