Archive

Archive for the ‘programming’ Category

Disabling TextMate’s auto-open of previous projects

March 26th, 2011 Richard Pistole No comments

defaults write -app TextMate OakDisableSessionRestore 1

Categories: programming Tags:

Quickie: Running a Controller action from a script in LightVC

September 29th, 2010 Richard Pistole No comments

Create scripts/test_action.php in your LVC app:
http://pastie.org/1190014

Excitin’.

Just be aware you’re running things from the command line, and the usual caveats with respect to running PHP CLI apply (superglobals, etc).

Categories: programming, shell scripts Tags:

Mass-op plugin for Colloquy

August 29th, 2010 Richard Pistole 2 comments

There’s no massop command in Colloquy, so here’s a javascript plugin that does it.

Copy/paste the following as whatever.js in your ~/Application Support/Colloquy/PlugIns/ directory:

function opNick(nick, connection, view)
{
	connection.sendRawMessage("MODE " + view.target() + " +o " + nick);
}
 
function massOp(connection, view)
{
	var members = view.chatMembers();
	var len = members.length;
 
	for (var i = 0; i < len; i++)
	{
		if (!members[i].operator())
		{
			opNick(members[i].nickname(), connection, view);
		}
	}
	return false;
 
}
 
// process the command and return true if you handle it or false to pass on to another plugin
function processUserCommand( command, arguments, connection, view ) {
	// return true if the command was handled or to prevent other plugins or Colloquy from handling it
	if (command == 'mop')
	{
		massOp(connection, view);
		return true;
	}
	return false;
}
Categories: programming Tags:

mysqli driver, prepared statements and geometry types

August 23rd, 2010 Richard Pistole No comments

FYI:

PHP Warning: mysqli_stmt_bind_result(): Server returned unknown type 255. Probably your client library is incompatible with the server version you use!



Probably means you’re selecting a geometry type without calling AsText on it.
Instead of

SELECT
	place.location_point
FROM
	place
WHERE
	place.place_id = ?

do:

SELECT
	AsText(place.location_point)
FROM
	place
WHERE
	place.place_id

Supposedly this is fixed in PHP 5.3. That isn’t really useful information, nor is the snotty svn commit message to use mysqlnd.

See: http://www.mail-archive.com/php-bugs@lists.php.net/msg127837.html

Categories: programming Tags:

A little TextMate black magic

August 19th, 2010 Richard Pistole No comments

I do most of my code editing in TextMate in OSX.

However my current code environment consists of a CentOS VM running under parallels.

I have my linux home directory mounted via SMB in OSX, but I like to do a lot of poking around on the files from the shell on the VM.

So, here’s a shell script to let me open files in TextMate from the VM:

#!/bin/tcsh
set f="`pwd`/$*"
set f="$f:s./home/pistole./Volumes/pistole/."
ssh wrath open -a /Applications/TextMate.app "$f"
Categories: programming, shell scripts Tags:

Tutorial: Controllers and Actions in LightVC

August 25th, 2009 Richard Pistole 5 comments

In this tutorial, we continue to create an MVC application using the bare LightVC and CoughPHP distributions, focusing on Controllers and Views in LighVC.

For this tutorial, you will need to have the skeleton application created in the previous article on combining CoughPHP and LightVC, as well as our database table and generated CoughPHP code.
Read more…

Categories: programming, tutorial Tags: ,

Hashing Axapta 3 compatible passwords from PHP

August 21st, 2009 Richard Pistole No comments

As an interlude from the CoughPHP, I present the following:

The downside of working with legacy systems is that sometimes you find it necessary to work with existing data in ways that are completely arbitrary. The worst of all of these is password hashing.

Read more…

Categories: programming Tags: ,

Creating Cough models for our CoughPHP/LightVC application

April 10th, 2009 Richard Pistole 10 comments

In this tutorial, we continue to create an MVC application using the bare LightVC and CoughPHP distributions, focusing on creating working cough model classes and using them in the application, as well as best practices for different deployment environment files for LightVC applications, CoughPHP generation config, and suggested db schema patterns.

For this tutorial, you will need to have the skeleton application created in the previous article on combining CoughPHP and LightVC, as well as a working installation of MySQL. Installing and configuring MySQL is outside the scope of this tutorial, but there are many pre-packaged versions available.
Read more…

Categories: programming, tutorial Tags: ,

Combining CoughPHP and LightVC

February 16th, 2009 Richard Pistole 6 comments

In this tutorial, we will be creating an MVC application using the bare LightVC and CoughPHP distributions.
Read more…

Categories: programming, tutorial Tags: ,

Welcome to blog.rhp.org

February 15th, 2009 Richard Pistole No comments

Welcome to my personal blog, blog.rhp.org. This blog will be kept updated with my musings on technology, programming tutorials and other randomness.

First up will be a series of articles detailing how to make a simple content management system in PHP using LightVC and CoughPHP, lightweight VC and ORM frameworks the combine to create a simple and powerful MVC solution.

Categories: programming Tags: ,