With a little side of applesauce...

Friday, November 28, 2008

Guitar Center's cool Black Friday shop online uses jQuery

I figured this was jQuery, and sure enough:
<script type="text/javascript"> 
var GB_ROOT_DIR = "/greybox/";
</script>
<script type="text/javascript" src="/greybox/AJS.js"></script>
<script type="text/javascript" src="/greybox/gb_scripts.js"></script>
<link href="/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/includes/header.js"></script>
<script src="/js/jquery-1.2.6.min.js" type="text/javascript"></script>


Wednesday, November 26, 2008

cygwin - show Windows processes with ps

I just found that:

ps -efW

will also show Windows processes. Very handy when trying to kill processes from the command-line :)

jQuery - tablesorter

Once again, I have found a really cool plugin for jQuery... tablesorter.

It makes table sorting simple. The following excerpt allows one to click table headers, and sorts the table by the second column in ascending order by default:

<script type="text/javascript" src="includes/jquery.tablesorter.min.js"></script> 
<script type="text/javascript">
// Your code goes here
$(document).ready(function()
{
$("table").tablesorter({
sortList: [[1,0]]
});
});
</script>


The following links helped me to get started:
http://www.packtpub.com/article/jquery-table-manipulation-part1
http://motherrussia.polyester.se/docs/tablesorter/

Tuesday, November 25, 2008

jQuery - dump plug-in

Ok, so I am loving jQuery even more now... Check out the dump plugin.

You load it into your header:
<CFIF Application.Environment EQ "Dev">
<script type="text/javascript" src="includes/public_templates/jquery.dump.js"></script>
</cfif>


Then, call it in the following manner:
alert( $.dump( $("[name='accept']") ) );


Way to speed up Javascript debugging!

Monday, November 17, 2008

Intro to DOM

Here is a nice Introduction to the Document Object Model. It gives simple examples and helps you to visualize manipulation of the document object itself. Thanks Mike!

openLDAP - BASH function causing screen window to crash on Cygwin

The following BASH function was crashing my screen window:

function ldapsearch() { /usr/local/bin/ldapsearch -D cn=admin,dc=example,dc=com -W -b 'dc=example,dc=com' ${1}; }


This was on Cygwin with openLDAP 2.4.12 and GNU screen 4.00.03. The workaround was to change the function name to something besides ldapsearch:

function lsearch() { /usr/local/bin/ldapsearch -D cn=admin,dc=example,dc=com -W -b 'dc=example,dc=com' ${1}; }

GNU Screen - execute .bashrc when starting screen

I created an alias to start up screen with my username, the TERM, and manually set the SHELL, so that it will read the .bashrc on screen start:

alias s='screen -S myuser -T linux -s /bin/bash'

The important switch here, is '-s', since screen doesn't read your .bash* files without it. I set the TERM variable to 'linux', so that arrow keys will work correctly in VIM, (on Cygwin).

Sunday, November 16, 2008

jQuery - Google Tech Talk with John Resig

This great video covers Best Practices in Javascript Library Design. I haven't made all my way through it, but it is a part of the greater topic that I am pursuing right now, API design.

Friday, November 14, 2008

Why Free Software is important...

I was searching for a download of JSEclipse, and found that it is no longer available except with a 60-day trial...

That has killed my interest in the tool.

openLDAP - compiling on Cygwin

This post has a great step-by-step for compiling and installing openLDAP on Cygwin. Thanks Shane!

Essentially:

Download openLDAP
./configure
make depends
make
make install

Make sure that you have gcc installed in Cygwin. Also, if you have only installed gcc4, you will need to create a symlink to /usr/bin/gcc for the configure script to find it.

ln -s /usr/bin/gcc-4 /usr/bin/gcc

openLDAP - remove system attributes from LDIF export

I needed to clean the system attributes from a LDIF dump from the old 2.4 server, and used the following line to remove them:
cat good.ldif | grep -v structuralObjectClass: | grep -v entryUUID: | grep -v creatorsName | grep -v createTimestamp: | grep -v entryCSN: | grep -v modifiersName: | grep -v modifyTimestamp: | grep -v entryDN: | grep -v subschemaSubentry: | grep -v hasSubordinates: > good2.ldif

PERL - fix LDAP exports with line breaks

Thanks to this posting, by Dan Norris, we now have an easy script to fix the line breaks which are inserted by phpLDAPAdmin exports. (Apparently, ldapsearch does the same thing).
$cnt=0;
while ($line = <>) {
chomp($line);
if ( $line =~ /^authpassword/ ) {
next;
} elsif ( $line =~ /^\S+/) { ### this line is a "normal" or starting line
$results[$cnt++] = $line;
} elsif ( $line =~ /^$/ ) { ### this line is blank
$results[$cnt++] = "";
} elsif ( $line =~ /^ \S+/ ) { ### this line is a continuation
$results[$cnt-1] = $results[$cnt-1] . substr($line,1);
}
}

for $i (0 .. $cnt) {
print "$results[$i]\n";
}

win32/Apache - not following Cygwin symlinks

I couldn't get Win32/Apache 2.2.10 to follow symlinks which were made in Cygwin, (with either CYGWIN=nowinsymlinks or not), and Options FollowSymLinks on Windows Vista. To get around it, I used the Junction tool from Microsoft, (Sysinternals). Just remember to reverse the order of the arguments, as compared to ln.

Doh! Just found mklink. It appears to be junction, no...?

Tuesday, November 11, 2008

CF8/JTOpen - connect to AS/400

Can't forget to grab the jt400.jar so that I can connect to that AS/400.

You put it in:
/path/to/coldfusion/runtime/servers/lib/

Vista/Cygwin - problems running ssh-host-config

I was unable to configure my Vista host sshd with the following error:

*** Warning: The permissions on the directory /var are not correct.
*** Warning: They must match the regexp d..x..x..[xt]
*** ERROR: Problem with /var directory. Exiting.

The fix is to do the following:

17. Within the shell, execute "chmod o+x /var"
18. Within the shell, execute "ssh-host-config".


This is stolen from the following post:
http://cygwin.com/ml/cygwin/2008-10/msg00128.html

Tuesday, November 4, 2008

Coldfusion - Adding form fields dynamically

I have to say, "Big Thanks!", to Ben Nadel at Kinky Solutions for his blog posting on adding form fields with jQuery. This example finally broke it free for me, _and_ introduced me to jQuery :)

jquery - Javascript library

I have just connected with the jquery library, and am finding it to be a great help in my projects.

"jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript."

Very cool!

Monday, November 3, 2008

Debian Unstable - (Oct. 31, 2008 upgrade) - pulseaudio problems

I'm not sure if this is a bug, or just a problem on my system, but the dist-upgrade last friday broke audio on everything except iceweasel. Apparently, pulseaudio is not starting or something, so was able to get audio working for rhythmbox by manually running:

pulseaudio -D

after logging into GNOME. I got this from the following thread:
http://www.opensubscriber.com/message/fedora-devel-list@redhat.com/8191700.html