Just had to post this one :-)
Tuesday, December 14, 2010
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
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
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!
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
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
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()
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 :-)
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:
Ref: http://stackoverflow.com/questions/508791/mysql-query-group-by-day-month-year
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
Thanks!"
And the response:
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.YEAROr even:SELECT COUNT(id)
FROM stats
GROUP BY record_date.YEAR, record_date.MONTHTo have a monthly statistic. Thanks!"
And the response:
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:
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
$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 HEAD 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
"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
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
$('#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. List of hex values here: http://www.robelle.com/smugbook/ascii.html
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. List 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
Ref: http://www.ubuntugeek.com/how-to-rip-dvd-audio-to-mp3-or-ogg.html
Subscribe to:
Posts (Atom)
