Configuring PhpStorm for use with CakePHP

Configuring PhpStorm for use with CakePHP

This article assumes the reader is using PhpStorm 6.0.3 and CakePHP 2.3.8.

My friend Joey has gotten me interested in PhpStorm and CakePHP. His company is in love with both, so I figure there must be some value there.

The latest production release of PhpStorm, out of the box, doesn’t do a stellar job of working with CakePHP. Some files aren’t syntax highlighted, it complains about non-existent problems, and auto-complete is imperfect. These issues are easy to fix with a tiny bit of work:

Syntax highlighting. To get syntax highlighting working properly, you need to add *.ctp to the PHP file extensions list. Open PhpStorm and go to File->Settings. Click File Types, then click PHP files (PHP) in the box of Recognized File Types. Click the green + to add an entry to the Registered Patterns. Type *.ctp then click OK. Click OK to close the settings dialog and to apply your changes.

Fix a few warnings. If you are in a controller, you may notice that PhpStorm complains that: Multiple definitions exist for class AppController. To fix this (and related warnings and some auto-complete issues), go to File->Settings. Click Directories. Select lib->Cake->Console and click Excluded. Select lib->Cake->Test and click Excluded. Click OK to close the settings dialog and to apply your changes. This fix has to be done to each project.

Improve auto-complete. Added a few comments to your various files will improve auto-complete.

Controllers and Models. Add a property to the top of each controller or model that references any models you want to use in that file. For example, if your model was named Post, you would add:

<?php

/**
 * @property Post $Post
 */

?>

Views. Add the following to the top of each .ctp file:

<?php

/**
 * @var $this view
 */

?>

Auto-upload files when they are saved. I like to develop on real servers, so I set my IDE to upload my files after each save. Go to File->Settings, then find Deployment->Options. Choose On explicit save action (Ctrl+S) for Upload changed files automatically to the default server, then click OK. This is another per-project setting.

Read More

Replacing the “permanent” filter on a Dyson DC18

Replacing the “permanent” filter on a Dyson DC18

2013-07-17 17.53.16 My Dyson DC18 vacuum is 5 years old and has started to stink up the house whenever I run it. After some research I discovered the cause: a filthy permanent filter. Turns out it isn’t as permanent as Dyson claims, and many people replace it every few years.

The first step is to buy a replacement filter. I got a genuine Dyson filter on Amazon for $34. Considering refurbished DC18s are $200+, I think $34 is pretty reasonable.

Next, get a T10 screwdriver and remove the bottom cord wrap bracket (see picture). Once this is removed it is very straightforward to rotate the filter’s casing slightly clockwise, then it just comes right off. Carefully remove the old filter and replace it with the new clean filter. Replace the filter and casing, rotate slightly counterclockwise, and replace the bracket. If the filter casing is in the right place then the bracket will easily go back on, so don’t force it.

Before and after

The before and after of the permanent filter is pretty disgusting. I hate to think what was being tossed into the air every time I vacuumed.

I also took apart the cyclone assembly (pretty straightforward.. if you can’t figure it out on your own, you probably shouldn’t be messing with your vacuum..) and blasted it clean with my hose. It was nasty. Took a few days to air dry because of all its nooks and crannies, but now it is shiny and just like new.

And the result? No more stinky vacuum! I’m in love with my Dyson again!

Read More

Move by Number

Move by Number

Boxes

For our recent move to Texas, I decided to try something a little different when packing our boxes. Instead of labeling them with the room they were from and scribbling a brief description of its contents, I simply labeled each box consecutively with a number. I.E., 1, 2, 3, 4… all the way up to 125. No marking for which room the contents were from. No labeling as to the boxes contents. Just a number, written on all four sides and the top.

The next step was to create a spreadsheet in Google Drive that listed each box number and its size (small, medium, large, wardrobe, etc..). As each box was packed I created a detailed list of its contents. A few examples:

  • BW printer. Toolbox. Dishes. Mom’s diary. Tupperware.
  • Dutch oven. Purses. Anna’s sheets. Our sheets. Anna’s blanket. Becca’s long sleeve shirts.
  • Living room computer. Long pillow. Plastic tub of clothes. Anna’s train from her birthday. Party hats. Boo flashlight. Jacob’s pullover. Anna’s heavy coat.

Becca was a bit skeptical at first, but in the end this made it extremely easy to pack and to unpack. We had the movers put all the boxes into our two extra bedrooms (they’ll eventually be an office/craft room and a guest bedroom). It made it faster and easier than trying to figure out which box went to which room, and kept the whole house from being flooded with boxes. Next, we figured out what we needed to unpack immediately. For example, I needed my toolbox. A quick search of my list showed that my toolbox was in a medium box labeled 100. Only took a moment to find it once I knew the size and number. We did the same thing with clothes and everyday cooking items (like pans, dishes, glasses..). We didn’t even begin opening the boxes that contained unimportant items (like books) until over a week after delivery.

It wasn’t a perfect system though. I didn’t think to label plastic tubs or mirror boxes. If I did it again I’d label absolutely everything. We also ran into a few snags where the movers (without our knowledge or permission) reboxed a few boxes. On the plus side we knew if something was missing because we had a detailed inventory, but on the downside it made it difficult to find a few boxes because they were no longer numbered. I think the solution to that is to hire better movers or move things on my own next time.

Read More

Using your web server as a proxy

Using your web server as a proxy

Tunnel!At Geekdom I’m stuck using a shared wifi connection. This exposes me to a slew of security issues. Eek! An easy way to resolve the security problems is to send all your traffic, encrypted, through another server. I already have a web server with plenty of processing and bandwidth capacity to handle my web browsing, so I decided to use it.

Getting things set up is extremely easy. I followed the instructions from a TechRepublic article to configure PuTTY (the “first” through “third” instructions) to make a secure tunnel to my server. Next, I used Proxy Switcher Lite (free) to make it easy to tell Windows (and any software you are running) to use the tunnel or connect directly to the internet without having to go into the Windows settings.

That’s it! I used my IP website, IP Addr.es, to make sure my server’s IP was showing up instead of Geekdom’s IP, so I can be confident that my traffic is making its way through the secure tunnel.

If you want to give this a shot but don’t have a server, you could always use a VPS. I’ve got several at Linode that I am very satisfied with. Super fast, super cheap, super reliable. You could also try using a commercial VPN service, but personally I feel this setup provides superior security and is easier to use.

Read More

First day at Geekdom

First day at Geekdom

View from my desk

Last week I visited Geekdom, a collaborative co-working place, to take a tour and see what they were all about. The website is a bit tedious to navigate, but the facility is awesome. It takes up 2 floors of the Weston Centre in downtown San Antonio, and includes a kitchen full of free goodies, recreation areas (gaming consoles, ping pong table, arcade games), community areas (desks, tables, chairs, bean bags), an electronics room (robotics, circuits..), a small computer book lending library, conference rooms, and offices. Members can check-in when they get there so you can easily see who is around, which makes it easy to network and meet new people.

I liked what I saw so I opted for a dedicated desk in an office. Each office hosts a few individual members, so I’ll have a couple office mates that may or may not be there at any given time. My desk is on the 11th floor and overlooks the famous River Walk. Some offices have fun names like Contra and Zelda, but my office is just named A. Kind of boring. Oh well.

Today has been my first day at Geekdom. I threw a monitor into my backpack and hauled my desktop computer up from the parking lot and got to work! Well, sort of. I checked my email, checked my RSS feeds, read some deal forums, had lunch, and THEN I got to work. Not much different than when I had a day job I suppose. :)

Anyways, if you are ever in San Antonio and want to work on some web stuff, let me know and we can hang out at Geekdom together.

Read More