Tag Archives: featured

Couchbase php stub file

I have been working with Couchbase for a while and was constantly referring to the Couchbase SDK PHP Documentation for the usage of functions. There was no class definition available in my Zend Studio IDE for auto-completion. Which kinda annoyed me.

Since i have been using composer for all my libraries at tried looking on Packagist for a Couchbase stub file. Unfortunately i could not find one. Then i remembered seeing one in the PECL Couchbase package. I could of course put this into my project so that my IDE would pick it up for auto-completion, but that would not be very social of me. Of course ‘Sharing is Caring’.

I added a github repository, created a composer.json file and added it to packagist. To include it in your project just add the following line to your composer.json file require section.

"danielkraaij/couchbase-php-stub": "dev-master"

Then run composer update, refresh your project in your IDE and your good to go.

 

 

Subversion Progressbar in bash

For a project i am doing i needed to checkout a subversion repo from within an installer. This ofcourse is not that hard, but i wanted something extra.
I was searching for a way to show a progressbar when doing a svn checkout (svn co) and could not find a sollution for it. So i came up with the following sollution.

First, i needed to know how many files i was going to checkout of the subversion repository. To get this number i’m going to use the following bash statement.

n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)

Great, ‘$n’ now contains a number of files in my project, we can use that number to calculate the percentage. But to do that i needed to know how far the checkout is.

Subversion will output each file on a new line. We could pipe that into a while loop and keep track of the progress.

n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)
i=1
while read line filename
    do
    counter=$(( 100*(++i)/n))
    echo -e "($counter %)\n"
    echo -e "filename: $filename \n"
done < <(svn co svn://svn/project/trunk /var/www/project)

The script above prints a percentage for each line.

Now let’s put all this into a dialog.

dialog --backtitle "Subversion Installer" --title "SVN Checkout" --gauge "Getting total file count" 7 120 < <(
	n=$(svn info -R svn://svn/project/trunk | grep "URL: " | uniq | wc -l)
	i=1
	while read line filename
		do
		counter=$(( 100*(++i)/n))
		echo "XXX"
		echo "$counter"
		echo "filename: $filename"
		echo "XXX"

	done < <(svn co svn://svn/project/trunk /var/www/project)
)

if you run this you’ll get a nice process indicator. Yay!

 

Facebook Group for ‘Kraaij’

A while ago i created a facebook group for my lastname ‘Kraaij’. Since then the group gained 19 members. That may not be much, but then again, there are not many people with that exact last name.

There are however some interesting posts. like our family weapon for example.

https://www.facebook.com/photo.php?fbid=2266987443483&set=gm.261600023859495&type=1&theater

And this post revealed some nice and old images.

467262_10150751683547137_329061196_o

We also learned that overtime our last name changed from Kraai to Kraaij or other variations like Kraay.

Interested? just take a look on our Facebook Group page.