30 Nov 2010

Mac OSX VPN to Windows 7

Forced home by snow and impending more snow I had to set up VPN access from my Hac to my Windows 7 workstation. Fortunately the VPN server end is already set up.

Doing the Mac setup was pretty trivial. Go to network settings in system preferences. Add a new connection using the + sign at the bottom left. Then just follow through the settings. It's really not that difficult. If you're a bit dim, there's a picture guide here: http://bit.ly/do_vpn_on_mac

Of course, you also need some sort of remote desktop app. The first one I found was CoRD (http://cord.sourceforge.net/) which seemed a bit tricky to set up, and says it doesn't use Mac VPN, but it doesn't work without a VPN connection. Anyway, it's pretty slick and FREE. The second one was Microsoft Remote Desktop Connection for Mac 2, which is included with every edition of Office for Mac 2011 (if you're fool enough to buy it or use it). Well, it's also a FREE download (http://www.microsoft.com/mac/remote-desktop-client) and, surprisingly, it works.

They both work well but, politics aside, I don't know which one I'll use. I've only had half a day to try them out.

Coldfusion

It's been a while since I wrote anything, but that doesn't mean I haven't done anything. I've been head down wrapping up a CakePHP CMS before I changed jobs. Now I'm a Coldfusion developer. WTF? I've never used it but working through the tutorials it seems really straightforward. I guess the hard part will be letting go of MVC. Of course, someone has cooked up an MVC framework for CF, but there's too much legacy in my new job to even think about it.

I'll still be doing the CakePHP stuff as well as I have one or two personal projects and, for a smalltimer, hosting Coldfusion is just too expensive.

30 Jul 2010

Basic .htaccess Modifications

This is a useful .htaccess for a basic CakePhp website. It enables
compression, normalises URLs by removing 'www' and then moves on to the
standard CakePhp redirection:
# compress all text & html:
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css 
text/javascript
<IfModule mod_rewrite.c>
RewriteEngine on
# Convert all http://www.example.com style URLs to http://example.com
RewriteCond %{HTTP_HOST} ^www\.(.+)$
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule    ^$ app/webroot/    [L]
RewriteRule    (.*) app/webroot/$1 [L]
</IfModule>
In certain situations - in this case our CMS - this substitution might 
be useful:
#RewriteRule    ^$ app/webroot/    [L]
RewriteRule    ^$ my-anchor-page    [L]

29 Jul 2010

INSERT rows with SELECT & mixed data

To extract values from one table, to update another where you also need
to supplement the data - in this case
(`module_type_id`,`module_id`,`zone_id`,`position`) are static
(12,42,12,1) - include the supplementary values in the SELECT statement:

INSERT page_items 
(`node_descriptor_id`,`module_type_id`,`module_id`,`zone_id`,`position`)
SELECT id ,12,42,12,1 FROM node_descriptors

20 Jul 2010

CakePHP offline manual

There used to be an offline manual - I don't remember whether it was official -  but there no longer seem to be any direct links. A little digging around revealed some answers which I thought it would be useful to share.

These are links to the manual in one page - useful for creating a PDF using Dardo Sordi Bogado's build script: http://rapidshare.com/files/218826372/manual-builder.zip. It is also very useful for searching quickly using ctrl-f in your browser.

Also see this thread: http://groups.google.com/group/cake-php/browse_thread/thread/5f45c1d0

17 Jun 2010

template woes

Yeah, okay, the template is a bit raw, but not as bad as the old one. When I get some time I'll neaten things up a bit.