04.15
If you want to make sure that cache/log files won’t show up when you commit, execute the following command inside your app directory.
svn propset svn:ignore "*" tmp -R
This will ignore the tmp directory (recursively)!
Geek stuff
If you want to make sure that cache/log files won’t show up when you commit, execute the following command inside your app directory.
svn propset svn:ignore "*" tmp -R
This will ignore the tmp directory (recursively)!
Ubuntu 12.04 LTS will be released on April 26 and supported until April 2017.
Updates I am looking forward to include:
and of course the 3.2.0.x kernel!
References:
Sometimes you’ll have an error in your commit message or no message at all. If your repository is configured to accept changes to this log message after the commit is finished, you can “fix” your message remotely using svn propset. However, because of the potential to loose information, Subversion repositories are not, by default, configured to allow changes to unversioned properties—except by an administrator.
This is how your do it:
echo "Your corrected commit message" > message; svnadmin setlog /home/projman/svn/site/ -r 4658 --bypass-hooks message; rm message;
If your’re also using Trac your changes won’t show up in your “timeline“. To fix that make sure to resync your TracEnvironment:
trac-admin /home/projman/trac/site/; resync 4658 exit
Everything should by fine now!
References:
Here’s a little snippet that I use to remove all the unused kernels on my Ubuntu servers/desktops. Unused means all the kernel that are currently not in use. For servers that don’t reboot so often that could mean removing kernels that are newer than uname -r. So make sure to pay attention…
dpkg -l | egrep '^ii linux-(image|headers)-2' | awk '{print $2}' \ | grep -v $(uname -r | sed 's/-generic//' | sed 's/-server//') \ | xargs apt-get remove --purge -y \ ;
For a while I wanted to graph the HTTP response time of my server(s). I already had Nagios monitor it but now I wanted a nice Cacti image. Based on the check_http script I created (thanks to guy2006) a Perl wrapper to return the response time part:
# /usr/lib/nagios/plugins/check_http -H foo.bar.com -f follow -t 60 HTTP OK: HTTP/1.1 200 OK - 17235 bytes in 0.135 second response time |time=0.134897s;;;0.000000 size=17235B;;;0
The response time part is used as a “Data Input Method” for Cacti.
Implementation:
Create the file check_http.pl in /usr/share/cacti/site/scripts/.
#!/usr/bin/env perl $response = `/usr/lib/nagios/plugins/check_http -H $ARGV[0] -f follow -t 60`; chomp $response; ($load) = ($response =~ /time=(\d+\.\d+|\d+\.|\.\d+|\d+)/); print "$load\n";
Make sure you have the file check_http (it’s in the nagios-plugins-basic package) and it’s located in /usr/lib/nagios/plugins/.
# apt-file search check_http kannel-extras: /usr/lib/kannel/checks/check_http.sh kannel-extras: /usr/lib/kannel/checks/check_httpsmsc_kannel.sh nagios-plugins-basic: /usr/lib/nagios/plugins/check_http nagiosgrapher: /usr/share/nagiosgrapher/debian/cfg/ngraph.d/standard/check_http.ncfg
# locate check_http /usr/lib/nagios/plugins/check_http
Test the Perl wrapper, preferably as user cacti:
# perl check_http.pl foo.bar.com 0.425045
Import the XML Template into Cacti (it’s under Import/Export).
Make sure to change the “Consolidation Function” (of Item # 1) from LAST to Average (it’s under Templates -> Graph Templates). Also make sure to fill in an ip address or hostname. Otherwise your graph will be blank.
Your graph will look something like this:
References:
While installing RMySQL on OS X and Linux is really simple this is not the case for Windows. After trying several how to’s RMySQL still wasn’t working. Then I started experimenting my self… With success!
This is what I did:
MYSQL_HOME=C:/Program Files/MySQL/MySQL Server 5.5
C:\Program Files\MySQL\MySQL Server 5.5\lib to
C:\Program Files\MySQL\MySQL Server 5.5\lib\opt (must be created)
install.packages('RMySQL', type = 'source');
If everything went well you’ll now be able to load the RMySQL package by invoking:
library(RMySQL);
in R.
Resources:
For a long time I wanted Google Calendar to display the duration of events (in hours). Unfortunately this feature is not supported (as far as I know), not even by Labs. So I created a little piece of JavaScript which can be executed via a bookmark (at an event page with a start and end date).
This is how the snippet look like:
// select elements by classname var getElementsByClassName = function (classname, node) { if(!node) { node = document.getElementsByTagName("body")[0]; } var a = []; var re = new RegExp('\\b' + classname + '\\b'); var els = node.getElementsByTagName("*"); for(var i = 0, j = els.length; i < j; i++) { if(re.test(els[i].className)) { a.push(els[i]); } } return a; }; // parse a date based on a dateDay field (e.g. 2011-09-03) and a dateTime field (e.g. 09:30) var parseDate = function (dateDay, dateTime) { var dateDay = dateDay.split('-'); var dateTime = dateTime.split(':'); var fullDate = dateDay.concat(dateTime).map( function( num ) { return parseInt( num, 10 ) } ); return new Date(fullDate.shift(), fullDate.shift(), fullDate.shift(), fullDate.shift(), fullDate.shift()); }; // calculate the difference between two dates in hours var dateDiff = function (startDate, endDate) { var diff = endDate - startDate; return diff / ( 1000 * 60 * 60 ); }; var startDateDay = getElementsByClassName('dr-date')[0].value; // 2011-09-03 var startDateTime = getElementsByClassName('dr-time')[0].value; // 09:30 var endDateDay = getElementsByClassName('dr-date')[1].value; // 2011-09-03 var endDateTime = getElementsByClassName('dr-time')[1].value; // 17:45 alert(dateDiff(parseDate(startDateDay, startDateTime), parseDate(endDateDay, endDateTime)));
The compressed bookmark version looks like this:
javascript:var%20getElementsByClassName=function(h,g){if(!g){g=document.getElementsByTagName("body")[0]}var%20b=[];var%20f=new%20RegExp("\\b"+h+"\\b");var%20e=g.getElementsByTagName("*");for(var%20d=0,c=e.length;d<c ;d++){if(f.test(e[d].className)){b.push(e[d])}}return%20b};var%20parseDate=function(a,b){var%20a=a.split("-");var%20b=b.split(":");var%20c=a.concat(b).map(function(d){return%20parseInt(d,10)});return%20new%20Date(c.shift(),c.shift(),c.shift(),c.shift(),c.shift())};var%20dateDiff=function(a,c){var%20b=c-a;return%20b/(1000*60*60)};var%20startDateDay=getElementsByClassName("dr-date")[0].value;var%20startDateTime=getElementsByClassName("dr-time")[0].value;var%20endDateDay=getElementsByClassName("dr-date")[1].value;var%20endDateTime=getElementsByClassName("dr-time")[1].value;alert(dateDiff(parseDate(startDateDay,startDateTime),parseDate(endDateDay,endDateTime)));
When clicking the bookmark you'll see an alert box with the duration in hours:
In the future I will probably create something more fancy with the "Google Calendar APIs and Tools" but for now this is it. Have fun!
Since libreoffice is the default office suite in Ubuntu 11.04, which I use on my desktop, I also wanted to install that on my laptop (using Ubuntu 10.10). To do so we have to remove openoffice first.
sudo apt-get purge openoffice*.*
After that we can add the libreoffice ppa repository and install!
sudo add-apt-repository ppa:libreoffice/ppa sudo apt-get update sudo apt-get install libreoffice sudo apt-get install libreoffice-gnome
The default Ubuntu Flash Player was really unstable on my machine. That’s why I went searching for a more stable 64bit version. On Ubuntu 10.04 I used the file libflashplayer-10.0.45.2.linux-x86_64.so.tar.gz that circulated on the web. On 11.04 I found out there’s a nice repository with the latest x86_64 version. Thanks to SevenMachines it is really easy to install.
add-apt-repository ppa:sevenmachines/flash apt-get update apt-get install flashplugin64-installer
You might get this message when the virtual machine you’re opening is out of disk space or at least it thinks it is.
The file system upon which ‘~/VMware/Windows XP Professional – SP3′ resides is critically low on free space. Allowing this virtual machine to continue may cause it to fail unexpectedly. VMware Workstation has paused this virtual machine because the disk on which the virtual machine is stored is almost full. To continue, free up at least 495.2 MB of disk space.
When booting you’ll get stuck in an endless loop. To ignore the above warning and be able to start again add the line below to your (Windows XP Professional).vmx file.
mainMem.freeSpaceCheck = "FALSE"