A place to invest time in technology.

MySQL tips

Here is how to create a MySQL database with out having to remember the syntax:

#!/bin/bash
EXPECTED_ARGS=3
E_BADARGS=65
MYSQL=`which mysql`


Q1="CREATE DATABASE IF NOT EXISTS $1;"
Q2="GRANT INSERT, SELECT, UPDATE, DELETE, CREATE, DROP, ALTER ON '$1'.* TO '$2'@'localhost' IDENTIFIED BY '$3';"
Q3="FLUSH PRIVILEGES;"
SQL="${Q1}${Q2}${Q3}"

if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: $0 dbname dbuser dbpass"
exit $E_BADARGS
fi
$MYSQL -uroot -p -e "$SQL"

Just put that into a file, change the permissions and you should be able to create a user and database. You might have to change the "-uroot" if you are on a shared host.

What does 3PAR do? Why is HP taking it over

As they wait for these virtualization industry growing pains to subside, Mercury and other companies continue to pine for a utility future. "For Mercury to consider storage a utility, we'd have to have an environment that is fully integrated between the operating system, the file system and the block level. That way, when an application needs more storage, the virtualized environment would automatically increase the resources and send a message back to the server," Kreisa says. "That's the endgame, and it's still a ways out."

from: http://www.networkworld.com/supp/2008/ndc3/051908-storage-virtualization... is the conclusion of a good article on what "Utility storage" the main product that 3PAR sells.

How to develop for Drupal

A new developer often find setup issues starting Drupal development. I'm trying to make it easier for people.

http://drupal.org/node/147789

Overview: (click read more)

  1. Install Mysql, Apache, PHP. Versions should be MySQL 5.x, Apache 2.x, and PHP 5.x. This is harder than it should be. One OK solution is to install XAMPP on Windows. MacPorts has a nice system to install everything one needs.
    1. Often, you will find issues with PHP modules not being installed. One should learn how to add PHP modules in Windows and Unix.
    2. MySQL connection issues through Apache will also be a configuration issue.

Jar listing utility--Java archive file tool. Handling import errors easily in 4 steps.

Here is a quick example on how to get a database of what is contained in jars:
Step
1 of 4) Create a file containing:
#!/bin/bash
jarfolder=/usr/share
jarlist=/tmp/jarlist.txt
declare -a jarclass
find $jarfolder -name "*.jar" > $jarlist
for jarfile in `cat $jarlist`;
do
jarname=`basename $jarfile`;
jarfolder=`dirname $jarfile`;

jarclass=( $( jar -tvf $jarfile | awk '{ print $8 }' ) )
for aclass in "${jarclass[@]}"
do
echo $jarname $jarfolder $aclass;
done
done

2 of 4) Edit top 2 lines if needed/wanted.

3 of 4) Run the script and capture the output. You will get output like this:
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/events/SessionEvent.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/events/TransferEventSupport.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/events/SessionEventSupport.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/resource/Resource.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/Wagon$1.class
maven-core-2.0.6-uber.jar /usr/share/maven/lib org/apache/maven/wagon/Wagon.class

Note: The list has 3 fields: Jar file name, Jar path, Class name.

Pete Hecht's resume on Google Docs

My resume is on google docs. If you need a word or other format, please contact me.

http://docs.google.com/View?id=dgn77fbs_7ckhbkvc8

Getting newlines

defaults domains | sed 's/, /\'$'\n/g'

Will change all ", " to a real new line. Notice the use of a single quote.

Microsoft Office 2008 options

While open office is the way to go, or neooffice for the Mac. Microsoft 2008 Office users should look at: http://www.maclife.com/article/tip_day/office_2008_filecompatibility_tro...

That might save your form data.

Developer Support Team Foundation Server Blog

Developer Support Team Foundation Server http://blogs.msdn.com/dstfs/ has good inks. For example: Testing Email flow from your Team Foundation Server.

Checking disk space

Here is a quick and dirty diskspace script:

#!/bin/bash
ALERT=70
#ssh 10.61.37.176 df -H > /tmp/df.out
df -Hl > /tmp/df.out
cat /tmp/df.out | grep -vE 'Filesystem|tmpfs|cdrom' \
   | awk '{ print $5 " " $1 " " $6 }' | \
while read output ;
do
    usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
    partition=$(echo $output | awk '{ print $3 }' )
    if [ $usep -ge $ALERT ]
    then
       printf "Running out of space on partition %s \t %g \t %s %s\n" \
          $partition $usep $(hostname) $(date)
    fi
done

Notice the hard coded ALERT level as well as the commented out ssh command.

It needs work, but should show you how little space one has on all mounted drives.

Syndicate content