Shafe Shifter Just another guy on the internet.

9Nov/110

Time Tracking

A number of times clients ask how I track my time.  And each time I have to explain that I built some software specifically to meet my needs.    The software is a continual work in progress, the codebase is ancient and I hate working with it, although I still actively use it to track my time.   But, for those who are wondering here is a quick demo of what we use here at TNL Total Solutions.

I'm also going to make it available for download.  Just keep in mind, this was never intended for public consumption, some buttons don't do anything, there are annoying bugs that no one has gotten around to fixing and there is no documentation.  The demo above does explain how everything works (mostly).   Nonetheless, here is a copy of the current build for you to check out.

Download Link: Download TimeTrac v1.6

Cheers!
Brian

14Sep/110

Displaying a subversion commit log with PHP

php

I was recently tasked with a small project that had to pull commit logs from various subversion servers and repositorys and display them on a web page.

The process was a lot simplier than I first anticipated.  Hopefully someone else will find this useful.   This php code snippet requires that the server have SHELL_EXEC() enabled and subversion must be installed.   We'll use the SHELL_EXEC() function to actually use the subversion cli to grab the commit log from a remote server and store it in an xml file.

I'll break down the code a bit. This first bit, is a simple helper function that will help us read the XML file itself. We call the function xml_atrribute().

function xml_attribute($object, $attribute)
{
    if(isset($object[$attribute]))
        return (string) $object[$attribute];
}

Next up is to actually run the subversion CLI client with all of the correct parameters to generate an xml file of the commit log. You will want to adjust the server, username, password, repository name and output path to meet your needs.

$test = shell_exec("svn log --xml --verbose svn://svn.mydomain.com/reponame --username USERNAME --password PASSWORD > /home/html/svnlog/reponame.xml ") ;

Alright, at this point we should have a nicely formatted XML file that we can read, loop through and display information from. Here is a simple bit that loops through the various XML elements and displays them. As commented we go one step further than just reading the commit comments, we actually display the files and what action was performed on them.

foreach ($xml->logentry as $logentry)
{
  $date = date('m/d/Y', strtotime((string) $logentry->date));
  foreach ($logentry->paths as $paths)
  {

	echo ' <BR><B>Revision: ' . xml_attribute($logentry, 'revision') . '</B>';
	echo ' <BR>Date: ' . $date;
	echo ' <BR>Message: ' . $logentry->msg;
	echo ' <BR>Commited By: ' . $logentry->author;
	echo ' <BR> ' ;

		/* 	Now lets loop through and get a
			list of files that have changed
			in this commit */
		echo '<UL>';
		foreach ($paths->path as $path)
		{
			echo "
<li>" . $path['action'] . "  " . $path . "</l1>";
		}
		echo '</UL>';		

	}

  }

Here is the entire script all put together and commented:

<?php

/* 	This is a helper function
	to aid in reading our XML
	file we are going to create */
function xml_attribute($object, $attribute)
{
    if(isset($object[$attribute]))
        return (string) $object[$attribute];
}

/* 	Run SVN to get an xml file
	of the commit log.
	SHELL_EXEC() must be enabled
	on the server.
*/
$test = shell_exec("svn log --xml --verbose svn://svn.mydomain.com/reponame --username USERNAME --password PASSWORD > /home/html/svnlog/reponame.xml ") ;

/* Pull the XML file in */
$xml = simplexml_load_file(dirname(__FILE__).'/reponame.xml');

/* now lets roll through the XML and display the results */
foreach ($xml->logentry as $logentry)
{
  $date = date('m/d/Y', strtotime((string) $logentry->date)); // format the date
  foreach ($logentry->paths as $paths)
  {

	echo ' <BR><B>Revision: ' . xml_attribute($logentry, 'revision') . '</B>';
	echo ' <BR>Date: ' . $date;
	echo ' <BR>Message: ' . $logentry->msg;
	echo ' <BR>Commited By: ' . $logentry->author;
	echo ' <BR> ' ;

		/* 	Now lets loop through and get a
			list of files that have changed
			in this commit */
		echo '<UL>';
		foreach ($paths->path as $path)
		{
			echo "
<li>" . $path['action'] . "  " . $path . "</l1>";
		}
		echo '</UL>';		

	}

  }

?>

It's worth noting that when we read in the XML file we assume it lives in the same directory as the script reading it does. You can adjust this as needed. I Hope this is helpful to anyone out there needing to do something similar. The full source is here: svnsample.zip.

28Feb/115

Compiling Darwin Streaming Server 6.0.3 Under Debian.

I was recently tasked with a Linux install of Darwin Streaming Server on a Debian server. Unfortunately for me Apple stopped making Windows and Linux builds of DSS when version 6.0 was released.

After a lot of failed attempts at compiling from source on Linux I came across a wonderful post that had a shell script that would install all dependencies, download the source plus a handful of patches, compile and install v6.0.3 on Ubuntu 10.x. A few tweaks and I was able to get it to work for my install of Debian.

For the life of me I can't find the page again where that script was located, and apparently I'm not the only one. A google search brings up a whole lot of dated material mostly for DSS 5.x.

You shouldn't run into problems with these, I've used them several times now and they work pretty well. Be sure to run them as root though.

Debian 5.0 & 6.0 DSS Compile Script:

#!/bin/bash
apt-get install build-essential wget
addgroup --system qtss
adduser --system --no-create-home --ingroup qtss qtss

wget http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar
tar -xvf DarwinStreamingSrvr6.0.3-Source.tar
mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch
patch -p0 < dss-6.0.3.patch
mv DarwinStreamingSrvr6.0.3-Source.orig DarwinStreamingSrvr6.0.3-Source
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch
patch -p0 < dss-hh-20080728-1.patch

#need to answer n then y
cd DarwinStreamingSrvr6.0.3-Source
mv Install Install.orig
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install
chmod +x Install
./Buildit
./Install

Download debian-dss.sh

 

Ubuntu 10.x DSS Compile Script

#!/bin/bash
sudo apt-get install build-essential wget
sudo addgroup --system qtss
sudo adduser --system --no-create-home --ingroup qtss qtss

wget http://static.macosforge.org/dss/downloads/DarwinStreamingSrvr6.0.3-Source.tar
tar -xvf DarwinStreamingSrvr6.0.3-Source.tar
sudo mv DarwinStreamingSrvr6.0.3-Source DarwinStreamingSrvr6.0.3-Source.orig
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-6.0.3.patch
sudo patch -p0 < dss-6.0.3.patch
sudo mv DarwinStreamingSrvr6.0.3-Source.orig DarwinStreamingSrvr6.0.3-Source
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/dss-hh-20080728-1.patch
sudo patch -p0 < dss-hh-20080728-1.patch

#need to answer n then y
cd DarwinStreamingSrvr6.0.3-Source
sudo mv Install Install.orig
wget http://dss.macosforge.org/trac/raw-attachment/ticket/6/Install
chmod +x Install
sudo ./Buildit
sudo ./Install

Download ubuntu-dss.sh

 


If you run into problems or are just plain lazy, here is Darwin Streaming Server 6.0.3 compiled for Linux. Simply unpack the archive and run ./Install :

 

Download: Darwin Streaming Server 6.0.3 Linux Binaries

21May/101

TNL-FTP A Free FTP Client for Windows

I just uploaded some minor updates to my free FTP client for windows.   Back in the 90s I fell in love with WS-FTP, over time their UI changed a lot and I hated it, and didn't see a reason to continue paying for it.   So I wrote my own clone that had a UI that was very close to what I preferred working with.  Eventually some colleagues convinced me to release it for free... so here it is:

"This new version has many fixes geared towards Windows 7 and Windows Vista users. This FTP Client is included with Perl Scripting Tool as a FREE stand alone application. This feature-rich FTP Client makes FTP a snap. TNL-FTP is a feature-rich drag-and-drop FTP client. With a look and feel that is comfortable and straight forward to use.

What’s New in 1.9?

• Now Supports Resume on Uploads and Downloads
• Send Raw FTP commands directly to the ftp server.
• Open Local Files (instead of just VIEW).
• Optional Gridlines on Directory Listings.
• Several Bugs Corrected.
• Minor Cosmetic Changes.

Features Include:

• Multiple Profiles
• Advanced Connection Settings
• Automatic Transfer Mode Detection (I.e. Binary, ASCII)
• Full SOCKS4 and SOCKS5 Proxy Server Support.
• Full Drag and Drop File Transfers.
• Advanced functions such as CHMOD, Passive Transfers and Resumes.

TNL-FTP’s UI is styled after classic versions of WS-FTP to give you a familiar look and feel.

TNL-FTP is free and can be downloaded here:  DOWNLOAD TNL-FTP

TNL-FTP Homeage:: http://tnlftp.tnlsoft.com

   
Stop SOPA