programming

SVN Ignore Folder

svn propset svn:ignore FOLDERNAME .

^^ Note the dot!

More info here

http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/

Mysql - dump and load

You can dump the database into a file using: 
 
  mysqldump -h hostname -u user --password=password databasename > filename 
 
you can restore the info to the database again using: 
 
  mysql -h hostname -u user --password=password databasename < filename

from: http://forums.mysql.com/read.php?10,195091,195097

Cakephp Object not found!

 If you are getting an Object not found! cakephp error check out your httpd.conf

<Directory />

Options FollowSymLinks

AllowOverride All

# Order deny,allow

# Deny from all

Logitech G15/Z-10 LCD Spotify status/currently playing script

Here is a quick script I put together to be able to see what song is currently playing from Spotify on my Z-10 speakers.

Download here : g15spotify.zip

Released under the GPL 2.0

Please note this is my first 'big' bash script so please let me know about any problems/improvements needed.

Loosely based on G15 Amarok Plugin Plus by Robert Riemann

http://www.kde-apps.org/content/show.php/G15+Amarok+Plugin+Plus?content=76743

 

Cakephp Session object destruction failed / session_regenerate_id() annoyance

While writing a webapp I suddenly started getting this error:

Session object destruction failed

Apparently it is related to session_regenerate_id(). For now I have solved it by setting security.level to medium in core.php.

On my todo list for a proper fix before release.

Print Arrays nicely using pr

I recently had to do some debugging of arrays. Print_r() is very, very ugly:
Array ( [0] => struct SidAndAttributesType { string SecurityIdentifier; unsignedInt Attributes; } [1] => struct NonEmptyArrayOfGroupIdentifiersType { SidAndAttributesType GroupIdentifier; } [2] => struct
I did some research and found a nice solution: use pr() instead of print_r.
Array
(
    [0] => struct SidAndAttributesType {
 string SecurityIdentifier;
 unsignedInt Attributes;
}
    [1] => struct NonEmptyArrayOfGroupIdentifiersType {
 SidAndAttributesType GroupIdentifier;
}
    [2] => struct NonEmptyArrayOfRestrictedGroupIdentifiersType {
 SidAndAttributesType RestrictedGroupIdentifier;
}
Shorter, simpler, sweeter!

already under version control svn aptana

Have you got the "already under version control" error message when commiting or trying to add to a repo from aptana? I found it was because I had copied folders from another part of my project that was already in SVN. It also copied the .svn folders so Aptana thought it was already in the SVN. The fix is to delete the .svn folders (don't forget they can also be in the sub folders).
find ./ -name ".svn" | xargs rm -Rf
Source: http://cephas.net/blog/2007/04/06/command-line-script-to-delete-svn-files-folders/

Cakephp set page title

To set the page title in cakephp, put this in your controller method:
$this->set('title', 'My Page Title');

Cakephp home.ctp/index controller and a controller without a model

1) Create a new controller (the one below has no model)
class DashboardsController extends AppController {
	var $name = 'Dashboards';
	var $uses = array();
		function index() {
 
	}
}
2) Reroute in routes.php in the app folder.
 
Router::connect('/', array('controller' => 'dashboards', 'action' => 'index'));

Just wasted 20 minutes looking for whitespace...

I just wasted 20 minutes going through files looking for a white space that was causing "headers already sent" error message on login. I finally found it BEFORE the <? (i was looking at the ?> end).

Grrr....

Syndicate content