Search results

Git will save you

Sep 20

We’re creeping into Week 4, a.k.a. Finals Week, for my first official pair of Advanced Server-Side Scripting and Advanced Database Structures classes—ASL and ADB, respectively. It turns out that one thing has made classes far easier than I would have ever hoped for:

Git

Git is revision/source control on speed. Git has vastly simplified how the class works together, and has been a major player in allowing us to move as far as we have as fast as we have.

To be fair, we’re not just using Git. The entire suite we’re using consists of:

  • Git: version control
  • gitosis: Git configuration made fast, easy, secure, and idiot-proof
  • GitX: pretty Mac GUI for Git
  • JGit/EGit: Eclipse integration for Git
  • cgit: Web front-end for Git repositories

We use Git extensively in both classes as our exclusive solution for moving files around—no FTP, no SSH, no WebDAV, nada. I even make my slides for each class available as a repository—when the students want the latest version they just git pull for them. Publishing content to the development website is similarly just a git push away.

Even the database class has benefited from the use of Git. When the students are working on a tricky series of queries, they can break it up into pieces, generate mySQL table dumps, and push the dumps into the repo to share them with the other students.

Another great thing about using Git is merge conflicts. No, really! The students will generate several each night, then have to figure out how to resolve them. This is great, because it makes them communicate about their work. If we were using a client-server source control solution, the students would be locking and unlocking files, ignoring each other’s work and focusing on the locks.

When I planned the curriculum, I included a few slides about Git command-line but focused on using Git from within CFEclipse. It turns out that the students are far more comfortable using Git from Terminal than CFEclipse. I don’t have a solid reason why, but if I had to guess I would assume because using Git in CFEclipse involves going through the Team interface, which puts a clunky layer on top of Git. The students continue to express how much they love Git and how much work it saves them, so I guess the Team interface just isn’t what they’re looking for.

One of the favorite student pastimes with Git is going in at the end of the night and looking at the twisty codeline graphics that GitX produces:

Twisty code paths in GitX

As a teacher, Git allows me to see who is doing what work on group projects, increasing visibility of where individual students might need help. It also provides a nice, clean way of submitting assignments: push to the repo, and any commits after the cutoff time are ignored. Distributing tests has been a breeze: prepare a repo with the test material, then commit, push, and have the students pull to start the test.

For the past couple of years, I’ve been the sole web guy at each company I’ve worked for. I’ve set up Subversion repos at each, trying to keep myself in the habit of using them, but it’s been a rough habit to keep up with. Now that I’m back in a team environment again, I can’t imagine trying to do all of this without Git. If your company has more than one coder and you aren’t using Git, you could stand to take a look at it.


(Those of you in the know about Git may notice that I’ve said “the repo”. We do use Git in a less distributed manner than it was intended, pushing to a central repo on a school server. This is primarily because I want an official place to turn in assignments without having to pull from each student’s laptop, but also because the dynamic-IP nature of the LAN would make this trickier than is worth it. Even with dynamic DNS services.)

Still using FTP? Why?

Oct 25

I’ve long since switched over to SSH and SFTP on all of my development servers. I don’t think much of it, since it’s really so easy to do even on Windows, but SSH and SFTP recently helped me solve a problem that was driving me up the wall. So, I figured, why not do a bit of advocacy?

For those of you living entirely in a third-world country, SSH is secure shell, and can be thought of as a cryptographically-secure form of telnet. SFTP is a file-transfer protocol built on top of SSH. There are several Windows installers for the daemon/service, but be wary that you are probably only going to be able to run one of them. The free ones are all built on cygwin, which is notoriously fascist about DLL versions. If you want to try more than one, you’ll need to un install each before moving on to the next. All of the packaged installers are dead simple.

There is one crucial thing I would recommend when you do your install: if your server faces the Internet, do not use the default port of 22. Bot networks, especially Chinese, now scan for SSH servers, just like they scan for FTP servers and SMTP servers and proxy servers, etc. Leaving SSH on the default port is just like asking to be hammered-on by zombies all day trying to get in. Trust me on this, I have personal experience with it. Pick some random high port and change the config file (normally {installdir}/etc/sshd_config) to use it instead. Yes, it’ll be a real pain when you can’t remember what port you chose, but it’ll save you hours of annoyance in the long run. Should you decide to go the high road and try to log and report all of the zombies that bang on your door, I wish you good luck. Nutjob.

Your next step would be to set up your editing software to use SFTP instead of regular FTP. Wayne Graham has a great tutorial on how to do this for CFEclipse. Adobe has official tech notes on how to do it for Dreamweaver. If you are using Homesite or something else that doesn’t support SFTP natively, you’ll have to come up with something more creative, like maybe SftpDrive. I don’t think there’s a way to mount an SSH server as a Mac drive, but do correct me if I’m wrong.

Now on to the interesting part of all of this. If you thought FXP was pretty cool, wait until I tell you about SSH tunneling. With every SSH server you run, you get a SOCKS5 proxy server for free! With the correct configuration in apps that support SOCKS5, you can connect to your SSH server and use it as your link to the outside world. If your app doesn’t support SOCKS5, you can still tunnel specific ports.

SSH tunneling recently solved a problem I was having with my (personal) web host. They have an over-aggressive firewall on their FTP service that occasionally blocks the sub net I come from when I’m at work. Thus, I can’t do things like upload photos from work. From home, however, everything is fine. Enter the SSH tunnel. I use the aptly titled SSH Tunnel from rs4u Consulting. Configuration is straightforward:

SSH Tunnel Connection Window

SSH Tunnel Configuration Window

I was able to set my FTP client to use the SOCKS5 proxy provided by SSH tunnel. From there on, everything just works.

SSH Tunnel across the intarnets

CFEclipse is slow, part 2: brackets

Sep 22

I think I’ve nailed down the bug:

Again, no full transcript, but it boils down to this: when editing large file in CFEclipse, there is a slowdown that occurs while typing where the next character (to the right of the cursor) is a left or right angle bracket. Insert any other character between the cursor and the bracket, even a space or a newline, and everything is back up to full speed. Since angle brackets are slightly pervasive in HTML and CF, this is more than a little annoying.

Update: And yes, before anyone asks, I have tried turning off the auto-complete. Even with it off, typing up against brackets is hella slow. (It is a slight speedup, though, as everything after the first word of a tag is thus fast, as long as you aren’t pushing up against another angle bracket to your right. Which, given HTML and CF, you probably are.)

Why is my CFEclipse unusably slow?

Sep 21

I’m having trouble with CFEclipse. Not to put too fine a point on it, but it is heinously slow for large files to the point of being unusable. But not all large files, and not all of the the time. I could really use some insight as to what I’ve screwed up or how to fix the slowness. It’s a fresh install of Eclipse 3.2 and CFEclipse 1.2.

Here’s a video explaining what I’m talking about:

I’m not going to provide a full transcript, but the gist is:

  1. When editing small files, everything is nice and zippy.
  2. When editing some parts of large files (the end), everything is nice and zippy.
  3. When editing some parts of large files (the middle), things bog down to the point where I have to wait to type each line so that CFEclipse will catch up with me.
  4. Typing inside of quotes (single or double) seems to alleviate the slowness, but as soon as you are outside of the quotes, you’re back into the mire

Thoughts? Ideas? Help?

Top 5 Reasons Why I Hate Fusebox

Mar 31

Okay, so it’s not that I hate Fusebox — I just wanted an inflammatory subject line because that’s the kind of mood that I’m in. What really annoys me is cleaning up after most Fusebox developers. For whatever reason, the mental processes of Fusebox developers are just not compatible with my own, which probably says more about me than it does about Fusebox or its developers, but there you go.

Anyway – on with the list.

  1. Badly Over-Engineered Designs

    Ever had to maintain a small Fusebox application that you didn’t write? It sucks. The same can be said for just about any code that you have to maintain that you didn’t write, but for me it seems that fixing broken Fusebox apps will forever be my lot in life.

    No matter what anyone tells you, even if it’s Hal Himself, Fusebox should not be used for small apps. The whole point of all those little act and qry and dsp files is that you are supposed to reuse them in multiple places. If your app is so small that you aren’t reusing any of them … why are you using Fusebox? And don’t try and give me the whole "so that my DBAs/HTML Designers don’t have to understand ColdFusion to change the queries/layouts" crap. When was the last time any programmer let a DBA or Designer touch a CFM file? I’d put dollars to doughnuts that any DBA or Designer bold enough to go in and do that sort of thing isn’t going to be bothered by a few extra lines of CF in the file.

    In most cases, especially for small shops and small apps, using Fusebox is like giving an organ grinder a silverback gorilla instead of a capuchin.

  2. The bad practices that go with it: cfsilent

    I hate hate hate the cfsilent tag. It’s an arrogant tag that goes hand-in-hand with Fusebox, and I have nothing but ire for it. For whatever reason, Fusebox developers seem to prefer the cfsilent tag to the enablecfoutputonly attribute of the cfsetting tag, mostly with the excuse that keeping track of the layers of cfsetting is too hard. Bogus. One each at the first and last lines of every CFM file — how hard is that to keep track of? Make it your default template in CFEclipse/Dreamweaver/Homesite.

    I say that cfsilent is arrogant because adding it to your code essentially proclaims that the code, and any code that page calls, is perfect and will never need to be debugged. How do CF developers do debugging? Lots of tracing with cfoutput tags, right? If some yahoo has put a cfsilent tag in their fbx files and you’re trying to figure out why the cfoutput in the qry file isn’t displaying anything … that’s a lot of time wasted until you figure it out. "But a qry file should never have output!" Yep. And your code is always perfect. Right. Sure.

  3. fbx files

    Do I even need to say anything here? Anyone who has ever had to maintain a Fusebox app with more than a dozen fuses will know what I mean.

  4. XFA hacks

    Exit Fuseactions, XFAs, are the devil. No. They are good in theory, but they are horrendous in practice.

    Look, the main argument for Fusebox is the switch file and that it is the spine of your application and that you can look at it and know exactly where the logic flow will take someone. Setting an XFA in your switch file is okay, because it helps keep your program flow on track. But ever seen an XFA set anywhere else? I have. All too often. Setting an XFA outside of the switch file destroys any sort of traceability that you thought you had.

  5. CF Server Mappings

    For whatever reason, Fusebox and CF Server Mappings seem to go hand-in-hand. A thousand tiny files in one directory, then one or two more in a directory on a completely different drive, mapped in with a server setting and called with cf_ syntax. WTF?!?!? I’m not saying it’s only Fusebox developers that do this, but in my personal experience I’ve never seen it done by anyone who wasn’t a Fusebox fanatic.

I don’t mean to dog on Fusebox. Actually, I should write a check to Hal, as the majority of my salary for the last few years has come from me fixing Fusebox apps that someone before me had written that then broke. But, seriously, it’s just as easy to write horrible non-Fusebox code as it is to write horrible Fusebox code. And I’m certainly not going to say that all the code I’ve written in my life has been perfect. But still. I can only clean up so many messes before I feel the need to advocate that people stop making the messes in the first place.