Wednesday, March 23, 2011

Kanu Red Wine

Some good red wine ->

Samsung LCD Locked Settings

To unlock a locked Samsung LCD Monitor child lock hold the menu button for 5 seconds. :)

Tuesday, March 15, 2011

Oracle Insert Statement Containing & (Ampersand)

So I needed to insert some data into an Oracle DB and found it was having issues with the ampersand (&). So I did some digging and found that before my insert statement I just execute the statement:


set define off

This proved very handy :-)

Source: http://forums.oracle.com/forums/thread.jspa?threadID=466604

Tuesday, February 22, 2011

Novell RBPM Best Engine Settings

Ok so I've been trying some of the settings for the workflow engine and found that these seem to work the best for us:



What I have however found is with about 5000 workflow requests the system does seem to choke a bit. I would recommend giving some good spec server to the server where you are going to run the workflow engine and assign another server as the 'front-end' server. This way the user experience should not be affected.

Tuesday, February 1, 2011

Getting JSON and JQuery .getJSON to work in IE8

To no surprise my code that was working 100% in FF died a horrible death in IE8.

Here's what I had to do to get it to work.

1) Set Header to:
response.setContentType("text/javascript; charset=UTF-8");   
Source: http://stackoverflow.com/questions/3517608/why-isnt-this-simple-bit-of-jquery-getjson-working-in-ie8

2) Prevent I8 from caching my Ajax requests:
$.ajaxSetup({ cache: false });
$.getJSON("/MyQueryUrl",
   function(data) {
     // do stuff with callback data
     $.ajaxSetup({ cache: true });
   });
Source: http://stackoverflow.com/questions/264216/getjson-returning-cached-data-in-ie8
 
3) Add JSON support to IE8
Basically just include json2.js in my script. 
Source: http://www.json.org/ 
 
Don't we all just 'love' IE


Monday, January 31, 2011

Getting back into Java

What a day! I've been doing some Java dev again and its amazing to struggle with the differences between PHP and Java. Although I originally started with C/Java I've really become almost lazy in some of my PHP practices. PHP being a 'scripting' language makes life easy as you don't have to cast everything in a 'type'. You also don't need to use good OO, which I guess you could say is a down side.

During my exploration with Java over the last couple of days I've come across a couple of problems and solution that I thought I'd write about here.

First problem that cropped up was that Eclipse kept on crashing. Some really weird error but after a bit of Googling I found the solution. Basically the problem was causing by having two versions of xulrunner installed. A quick 'sudo dpkg --remove xulrunner-1.9.1' got the problem sorted. Here's a ref to some a posting about it: https://bugs.eclipse.org/bugs/show_bug.cgi?id=303372 and http://www.eclipse.org/forums/index.php?t=msg&goto=539642&

Second thing I decide to do was give Eclipse some more memory, by changing my run.sh to ./eclipse -vmargs -Xms1024m -Xmx1024m  -XX:PermSize=256m  -XX:MaxPermSize=512m

Next error I run into was Eclipse moaning about Jboss taking too long to start. So had to edit Jboss setting for this. Here's a screen shot on where to find the setting:

Basically you need to right click on the server in the button pane to bring up these properties. I also find it very difficult to find the correct settings for stuff in Eclipse.

Next thing I needed a bit of an update on was Vectors. Well I've been using Vectors for a while and they seem a bit clunky. So I decided to check out ArrayLists. The nice thing with ArrayLists is that they are quicker than Vectors and I found a really cool one liner to convert an ArrayList back to String array.

String[] yourArray = (String[])yourList.toArray(new String[yourList.size()]);

This also works for any other object type.

Ok, on to the next thing. JSON. So I've been playing with JSON and JQuery for awhile but never used it in Java. I first tried to use the standard JSON libraries but found them a bit of a pain. Then I found Gson (http://code.google.com/p/google-gson/). This worked much better and I was able to convert my Object array to JSON with two lines of code:

Gson gson = new Gson();       
String json = gson.toJson(resources);


Ok next thing I found out was really crazy. It took me about an hour to troubleshoot what the heck was going on here. So the reason I'm doing all this Java dev is so that I can plug a custom approval form into Novell's Roles Based Provisioning Module (RBPM). The only thing they don't tell you in this really cool article (http://www.novell.com/communities/node/9210/using-jquery-identity-manager-roles-based-provisioning-module-workflow-forms) is that if you use a HTML field type, the content of the HTML is obtained only after the page is loaded. Which results in alot of fun and games when using JQuery with dynamic content thats not on the page when .ready() function runs. So for now I would highly recommend make use of the TEXT field type in RBPM. This field is loaded already on the page and no .live() Jquery is required. I do however recommend using .live() when re-writing a page with Jquery and needed to keep track of changing items.

Any way think thats more than enough for one day.

Cheers.

Tuesday, January 25, 2011

Listen to Radio 702 on Ubuntu

Just use this one simple command:

mplayer mms://196.35.64.36/702_16

Wednesday, January 19, 2011

Oracle and PHP

Today seems to be the day the Oracle DB in Dev would start giving problems. I was running an SQL command from my PHP script, but it was never returning results. The SQL was an update command. I found this very strange as I could run the exact same command in Oracle SQL Developer. After alot of hair pulling I found that Oracle SQL Developer had a 'lock' on the table where I was trying to run the update SQL command. Once I closed // committed the outstanding transaction in SQL Developer my PHP script run fine. The problem I have however identified here is that there does not seem to be any may using the OCI library with PHP to put a time limit on the SQL query (more digging required). So I guess for now I may try putting a limit on the PHP script, but I'm really hoping there's some way to put a time limit on the SQL query to Oracle from PHP.

Tuesday, December 14, 2010

The Gloden Era

Just had to post this one :-)

Solaris and ldapclient with Active Directory (AD)

Been working on getting Solaris to auth to AD, not really out of choice, but hey I guess sometimes you got to do what you got to do.

Here is the ldapclient command that works with AD:

ldapclient  -v manual \
-a followReferrals=false \
-a "defaultServerList=10.12.28.5" \
-a credentialLevel=proxy \
-a authenticationMethod=simple \
-a proxyDN=cn=ldapproxyuser,cn=users,dc=voc,dc=iam \
-a proxyPassword=proxypassword  \
-a defaultSearchBase=dc=voc,dc=iam \
-a domainName=voc.iam \
-a attributeMap=group:userpassword=userPassword \
-a attributeMap=group:memberuid=memberUid \
-a attributeMap=group:gidnumber=gidNumber \
-a attributeMap=passwd:gecos=gecos \
-a attributeMap=passwd:gidnumber=gidNumber \
-a attributeMap=passwd:uidnumber=uidNumber \
-a attributeMap=passwd:homedirectory=unixHomeDirectory \
-a attributeMap=passwd:loginshell=loginShell \
-a attributeMap=shadow:shadowflag=shadowFlag \
-a attributeMap=shadow:userpassword=userPassword \
-a objectClassMap=group:posixGroup=group \
-a objectClassMap=passwd:posixAccount=user \
-a objectClassMap=shadow:shadowAccount=user \
-a serviceSearchDescriptor=passwd:dc=voc,dc=iam?sub \
-a serviceSearchDescriptor=group:dc=voc,dc=iam?sub

Ref: http://mail.opensolaris.org/pipermail/sysadmin-discuss/2008-February/001740.html

Wednesday, November 24, 2010

Oracle SQL to split field

Ok so I needed to split a field in an Oracle DB into two fields in a new view I was creating. This is the SQL I used:

select entitlement_data,
  substr(entitlement_data,0,instr(entitlement_data,':')-1) ENT_NAME,
  substr(entitlement_data,instr(entitlement_data,':')+1,length(entitlement_data)) ENT_VAL
from arm_user_entitlements

Codeigniter - How to invoke Controller from command line

So I was digging around for a way to invoke one of my Codeigniter(CI) controllers from the command line. This was the solution I liked the most.

Create the following file in the root CI folder of your web server e.g. /srv/www/htdocs/

I called mine test.php. Also make the file executable (chmod a+x).



#!/usr/bin/php
/* make sure this isn't called from a web browser */
if (isset($_SERVER['REMOTE_ADDR'])) die('Permission denied.');

/* set the controller/method path */
$_SERVER['PATH_INFO'] = $_SERVER['REQUEST_URI'] = '_PATH_TO_CONTROLLER_';

/* raise or eliminate limits we would otherwise put on http requests */
set_time_limit(0);
ini_set('memory_limit', '256M');

/* call up the framework */
include(dirname(__FILE__).'/index.php');
?>





Now just replace _PATH_TO_CONTROLLER_ with the path to the controller:

e.g. /armaudit/update_ad_names_res

Enjoy!

Monday, November 22, 2010

XGR Webcam Ubuntu Skype

So a while ago I bought this cheap Webcam. Here's how I got it working with Skype on Ubuntu:

1) sudo aptitude install v4l-conf
2) Run skype with export command:

export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so; skype

And that's it! No compiling required.


FYI lsusb output is as follows:

Bus 001 Device 003: ID 0ac8:0321 Z-Star Microelectronics Corp. Vimicro generic vc0321 Camera

This is almost unreal - 10Mb ADSL Line installed

Can't hardly believe my eyes:

Monday, November 8, 2010

Novell RBPM Log Date via ECMAScript

Here how to log the date from a Log event in the workflow:

var myDate = new Date();
myDate.toString()

Followers