Thursday, March 10, 2005

PHP error...

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /dirname/filename.php(000) : eval()'d code on line 3

put {} around the $_SERVER['VARIABLE'] like this: ${_SERVER['VARIABLE']}

Wednesday, March 09, 2005

awk bits...

# List of logins


who | awk '{name[n++]=$1};END{for(i=1;i<=n;i++){printf name[i]" "}; print ""}'


# List of unique logged in users


who|awk '{w[$1]=$1};END{for(n in w)printf" "n}'

Tuesday, March 08, 2005

10 years and still counting...

Crazy... 10 years at this now, and I'm still learning the basics...

Take a break ... command :o) ...


DATE=$(date +'%y%m%d')
for VER in $(seq -f %02g 99)
do
    if [ -f file_${DATE}-${VER}.tar -o -f file_${DATE}-${VER}.tar.gz ]
    then
        echo "file_${DATE}-${VER}.tar already exists..."
    else
        tar cvf file_${DATE}-${VER}.tar clean
        gzip -9 file_${DATE}-${VER}.tar
        break
    fi
done


Never needed it till now... but I was thinking... .o0(I need to break out... what would the command be?)

Or driving sed... instead of:


    sed 's/^ *//g' | grep .


how about:


    sed -n 's/^ *//g;/./p'


:o)

Monday, March 07, 2005

Very cute...

I was wondering last night .oO(has anyone written a text editor in Perl?) - not an x app like ptked, but a console app... and yes of course they have...

http://ped.sourceforge.net/

- one of the monks has even done vi :o)
https://sourceforge.net/projects/vip
http://perlmonks.thepen.com/41736.html

Oh, and... http://ppt.perl.org/commands/ed/index.html

Sunday, March 06, 2005

Babygimp Homepage

Babygimp Homepage

Yeah! - Just what I needed... the tool that's under Gimp...

I used to use Windows paintbrush, but more often than not I needed to save it to xpm and take it back to Linux and tweak it... now I can save it as xpm native :o) perfect... it's the tool for pixel tweaking.

Friday, March 04, 2005

De Morgan's Theorem...

Does logic do your head in?


if(!condition1 | !condition2) equals if(!(condition1 & condition2))

And

if(!condition1 & !condition2) equals if(!(condition1 | condition2))

Perl multi-line match...

davis gave me the answer nicely...


#!/usr/bin/perl

use warnings;
use strict;

local $/;
$_ = <DATA>;

$_ =~ s/<table>\n<tr>/<!-- TABLE START -->/i;

print;

__DATA__

<TABLE>
<TR>
<TD>



And also added:

you can ignore leading spaces with:


$_ =~ s/\s*]*>\n\s*/\n/ig

Wednesday, March 02, 2005

Missing header files...


$ make hello
cc hello.c -o hello
hello.c:1:19: stdio.h: No such file or directory
hello.c:2:20: unistd.h: No such file or directory
hello.c: In function `main':
hello.c:89: error: `stdout' undeclared (first use in this function)
hello.c:89: error: (Each undeclared identifier is reported only once
hello.c:89: error: for each function it appears in.)
make: *** [hello] Error 1

# apt-get install libc6-dev

Hello, world!

:o)
(humming "the stripper"):

#!/bin/bash
/usr/bin/strip --remove-section=.comment --remove-section=.note --strip-all $@