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()

Tuesday, October 19, 2010

Novell RBPM Logging

So the default logging for RBPM only shows the time and not the date. This I find very irritating as it makes debugging a pain.

So to get it to log the date as well do this:

Edit this file:

{RBPM Base}/jboss/server/IDMProv/conf/jboss-log4j.xml

and change the line:

<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>

to:

<param name="ConversionPattern" value="%d{dd/MM/yyyy HH:mm:ss} %-5p [%c{1}] %m%n"/>

No mess no fuss Jboss picks up the change on the fly :-)

Saturday, October 9, 2010

MySQL Query GROUP BY day / month / year

Wow I just found the most awesome thing with MySQL. I've always needed to group date data by month and year and never knew you could do it via SQL so easy.

Here's someones question:

"Heyall,
Is it possible I make a simple query to count how many records I have in a determined period of time like a Year, month or day, having a TIMESTAMP field, like:
SELECT COUNT(id)
FROM stats
WHERE record_date.YEAR = 2009
GROUP BY record_date.YEAR
Or even:
SELECT COUNT(id)
FROM stats
GROUP BY record_date.YEAR, record_date.MONTH
To have a monthly statistic.
Thanks!"

And the response:


GROUP BY YEAR(record_date), MONTH(record_date)
Check out the date and time functions in MySQL.


Ref: http://stackoverflow.com/questions/508791/mysql-query-group-by-day-month-year

Monday, October 4, 2010

PHP Variable Function Names

I always thought I'd never use this functionality of PHP due to getting lost in someone elses code trying to understand what they where doing with variable function names, but now it seems like I found a use for this:

   $this->$function();          

Basically I'm calling a function to generate a report and have an array of about 15 function names so I know which function to call for which report:



$this->report_list[2] = array(
        "report_name"     => "Agent Comm per Product Group",
        "report_function" => "agent_comm_per_product_group",
        "report_export_csv" => true,
        "report_select_dates" => false,
        "report_select_agent" => false
        );
      


Ref: http://php.net/manual/en/functions.variable-functions.php

Monday, September 27, 2010

HTML script tag

Someone once told me the only place you can have a script tag is in the section of the a html document. This is not true! You can also have a script tag anywhere in the body of the document too :-)

"The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document."

Source: http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.2.1

Wednesday, September 8, 2010

Novell Access Manager (NAM) in VMware

When running a NAM AG in a virtual environment make sure you add clock=pit to /boot/grub/menu.lst and reboot the AG

Sample:

title Novell Linux Access Gateway
    kernel (hd0,0)/vmlinuz root (hd0,2) splash=silent desktop resume (hd0,1) showopts clock=pit
    initrd (hd0,0)/initrd

JQuery check if checkbox checked

The reason I am posting this is because I stuggeld to find this solution. I guess Google did not like my English of 'check checkbox checked'. Well here is the solution:

$('#checkbox1').is(':checked')


Ref: http://jquery-howto.blogspot.com/2008/12/how-to-check-if-checkbox-is-checked.html

Friday, September 3, 2010

http_proxy Special chars

Ok so there seems to be a couple of solution here but this is the one I found.

I've got a @ in my password but if you put this in http_proxy it does not work.

Quick solution replace @ with %40

Basically this is the hex value for the char. Let of hex values here: http://www.robelle.com/smugbook/ascii.html

Quick command to rip audio from DVD

for((x=1; x<=41; x++)) do transcode -i /dev/dvd -x dvd -T 1,$x,1 -a 0 -y wav -m track$x.wav; lame -V2 track$x.wav track$x.mp3; rm track$x.wav; done;

Ref: http://www.ubuntugeek.com/how-to-rip-dvd-audio-to-mp3-or-ogg.html

Wednesday, August 18, 2010

How to update the Bios on a HP Desktop running Linux

Ok so I'm on some training where we have HP DX7400 PCs with 6GB Ram. Only problem is that the OS (SLES 11) only seems to see 3GB. First check was to make sure it was a 64bit OS which was fine. Then like I've found before the HP machine needed a BIOS update to see the 6GB at an OS level.

So here's what I did to get it sorted:

1) Download BIOS update from HP website.
2) Run BIOS update software on separate Windows PC to extract files. (You should also be able to do this under Wine)
3) Make as USB Boot disk as per (http://wiki.fdos.org/Installation/BootDiskCreateUSB) and also include the awdflash.exe and bios file when you do this by copying them into /tmp/fs-root
4) Then just boot of the USB and run awdflash with the bios file and your OS should now be able to see all 6GB ram.

No mess no fuss. This is the second HP PC type I've found that does this, I'm starting to wonder if HP don't want you upgrading these machines with so much memory. I'm sure they'd much prefer you to buy a server with 6GB Ram as opposed to upgrading your desktop PC.

Tuesday, August 17, 2010

CodeIgniter remove index.php from URL

Ok I needed to make a note of this cause there are hundreds of posts on this and this is my one to add to the mix on how I got it to work.
This was on my Ubuntu desktop where I'd setup CodeIgniter.

1)  Add .htaccess file to /var/www with the following content:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

2) Check ModRewriter is enabled:


cat /etc/apache2/mods-enabled/rewrite.load
LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so


3) Make sure AllowOverride is set to all

This file: /etc/apache2/sites-enabled/000-default
Should have section like:

       
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
       


4) Then restart apache if you made changes to apache config

And then you should be able to access site without the index.php in the URL.

NiCe :-)

Monday, August 16, 2010

Another Monday in Jozi

Well it was off to work again this morning. Lucky me I ride against the traffic most of the way. I saw two mini bus taxis heading into oncoming traffic to try and avoid the traffic on their side of the road. I guess you can say this is pretty normal for South Africa, but hey, always fun to see when they come head-to-head with a huge BMX 5 series and have no where to go.

I also glad to report that this past weekends round of 'knock-downs' was successful with a light pole in Randburg been completely taken down. Like always it did not look pretty and not anything like a little bumper bashing with the pole. I really should start collecting photos, maybe then people will think twice before drinking and driving. What can I say is drunk people love to knock down traffic lights, light poles and just about anything close to the road in Jozi. I've decide to call this weekend activity in Jozi 'knock-downs' because it seem to be as regular as clockwork, you can look out every Monday morning for the aftermath.

And wow as I read the news I hear about another Taxi accident:

37 hurt in mangled taxis


 "Johannesburg - Thirty-seven people were injured in two separate taxi accidents in Johannesburg on Monday morning, emergency services said.

Spokesperson Percy Morokane said the first accident occurred at 05:30 along the Golden Highway.

"The taxi was travelling from Orange Farm, to the Jo'burg CBD when the driver lost control of the vehicle, and it overturned," he said.

Eleven people were injured, five seriously.

The second accident occurred at the corner of Joubert and Empire roads, in Parktown.
Two taxis collided, leaving 26 people injured, 15 of them, seriously.

"The period between sunrise and sunset, is always a gap for accidents such as these to occur. Motorists must be extra aware during these hours," he said."

ref: http://www.news24.com/SouthAfrica/News/37-hurt-in-mangled-taxis-20100816

Monday, August 2, 2010

Ubuntu Problem with LG Flatron L222WS

Picked this one up a while ago, but thought I might just make a note of it now.

It also seems to have been logged as bug for Ubuntu: https://bugs.launchpad.net/ubuntu/+source/xorg-server/+bug/212018

This is what I did to resolve:

1st I need an xorg.cof file:

sudo service gdm stop
sudo Xorg -configure


Then we edit it and add the lines in bold:

Section "Monitor"
    #DisplaySize      470   300    # mm
    Identifier   "Monitor0"
    VendorName   "GSM"
    ModelName    "L222W"
    HorizSync    28.0 - 83.0
    VertRefresh  56.0 - 75.0
    Option        "DPMS"
    Modeline "1680x1050 at 60.0" 146.25 1680 1784 1960 2240 1050 1053 1059 1089 +hsync -vsync
    Option "PreferredMode" "1680x1050 at 60.0"

EndSection

Then start X again

sudo service gdm start


Update: 16/1/2011

This did work for my old Video card, now I've upgraded to ATI HD 5770 it did not seem to do the trick.

This line did however work:

Virtual    1680    1050
Modes        "1680x1050@60"    "1600x1024@60"    "1440x900@60"    "1280x800@60"    "1280x720@60"    "1280x768@60"    "800x600@60"    "800x600@56"

Source : http://ubuntuforums.org/showthread.php?t=696269

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?

Followers