Svn toolkit

This is a quick SVN reference I update regularly, with the commands I use more. I hope you’ll find it useful.

Task: Browse a remote repository

  1.  svn ls svn+ssh://[alias]/[path]

Task: create a directory on a remote repository

  1.  svn mkdir -m "[message]" svn+ssh://[alias]/[path_to_new_dir]

Task: import a directory

  1. svn import -m "[message]" [path_to_be_imported] [repository_url]

Task: check out

  1. svn checkout [repository url]

Assert statement in Objective C

Hi,
if you like to use assertions in your source code, but you miss this feature in ObjectiveC, give a look to this small class.
Assert.h

  1. #import <Foundation/Foundation.h>
  2. @interface Assert : NSObject {
  3. }
  4. +(void)that:(BOOL)expr;
  5. @end

Assert.m

  1. #import "Assert.h"
  2. @implementation Assert
  3. +(void)that:(BOOL)expr{
  4.  if (!expr) {
  5.   [NSException raise:@"Failed assertion." format:@"Failed assertion", nil];
  6.  }
  7. }
  8. @end

As you can see, there’s only one static method that you can use wherever you want.
In this snippet here’s an example how to use it.

  1. #import "Assert.h"
  2. -(void)doSomething{
  3.  [Assert that:(<your_assertion>)];
  4. }

Get rid of MantisBT date_default_timezone_get() warning

If you installed a MantisBT instance on a system with a recent PHP version, there’s the chance you get a warning saying:

SYSTEM WARNING: date_default_timezone_get(): It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘Europe/Berlin’ for ‘CET/1.0/no DST’ instead

A quick way to get rid of this is to set an explicit time zone.

Just open the config_inc.php file and add the date_default_timezone_set() line.

  1. <?php
  2. date_default_timezone_set("Europe/Rome");
  3. $g_hostname = 'localhost';
  4. $g_db_type = 'mysql';
  5. $g_database_name = 'db_name';
  6. $g_db_username = 'user';
  7. $g_db_password = 'secret';
  8. ?>

Please refer to this list to discover the available time zones.

Linux Shell Survival Toolkit

Hi, having a strong Windows background, I hardly remember all options of the huge set of commands available in the Linux shell… so, I’m slowly but steadily building up this Survival Toolkit. Hope it helps.

File and directory management

Symbolic link

Sometimes it is useful to hide the real location of a directory. For instance you could have various folders containing different versions of the same software. So, for instance you got /opt/package-1.2, /opt/package-1.3, /opt/package/1.4beta. But maybe you like to have an /opt/package folder that should contain the version that should be currently used, so, you can use a symbolic link:

  1. ln -s <existing_directory> <path_of_the_link_to_be_created>

In our case

  1. ln -s /opt/package-1.3 /opt/package

Compressed files

Often one downloads an open source project as a bundle which extension is .tar.gz. Here’s how to inflate it.

  1. tar xvf [filename.tar]