David Golding



Easy File Transfers Between Remote Hosts

By David Golding

I’ve just moved from one web hosting provider to another one. But getting large web sites from Host A to Host B can be challenging and time-consuming, especially if you have less than a T1 connection. Let me share with you how I was able to move a 1.3 GB backup file from one host to another using ssh.

First, I logged into the new hosting account via ssh:

ssh username@new-domain.com

Then, just a matter of using command-line FTP, I was able to move the file from the previous host:

ftp ftp.previous-domain.com
Name: [username]
Password: [password]
cd [to directory]
get [filename]

That’s it. What’s nice about this is that the file transfer occurs between the new hosting server and the old one, which undoubtedly have a better internet connection speed than my current one. Also, it removes the task of having to download the backup file to my local machine, and then upload it to the new host. As long as one of the hosts doesn’t impose a bandwidth cap, this should transfer the file much more quickly than if you were to add your local machine to the process.


CSS Frameworks

By David Golding

A handful of CSS frameworks exist, which aim to simplify laying out a web site’s design. I even tried my hand at building one, which was a fun project, but in the end, each project is so customized that I don’t know how much a CSS framework can really help. Personally, it’s only been in setting up a layout that CSS frameworks have helped me out. Getting a three-column layout by only calling out classes in a couple of divs is pretty sweet and saves a lot of time with cross-browser compatibility. However, once I get into using images, fonts, colors, and such, it just gets too customized and I feel like I end up building my own styles anyway.

One thing that I think CSS frameworks do to improve web design is encourage developers to separate out the several functions of their styles. For a framework to really be beneficial, it will use the inversion of control principle in its architecture, which I’m not sure can really be applied very well in the presentation layer. But splitting apart the styles based on their function can move in that direction and produce more of a framework that a series of CSS templates.

My Method

My method is to have a few standard CSS files: reset.css, layout.css, type.css, color.css, and styles.css.

The reset.css file contains some standard reset styles that help me start off with minimal problems for cross-browser compatibility. By using this reset stylesheet, I’ve noticed that I have less of a problem addressing inconsistencies between the browsers.

* { margin: 0; padding: 0; }

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-weight: inherit;
	font-style: inherit;
	font-size: 100%;
	font-family: sans-serif;
	vertical-align: baseline;
}

:focus {
	outline: 0;
}
body {
	line-height: 1;
	color: black;
	background-color: #fff;
}
ol, ul {
	list-style: none;
}

/* Tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: separate;
	border-spacing: 0;
}
caption, th, td {
	text-align: left;
	font-weight: normal;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: "";
}
blockquote, q {
	quotes: "" "";
}

Then, all of my layout styles are contained in layout.css. Things like positioning and general layout styles go here. I don’t try to include too much margin and padding properties in here, because these will usually show up in my general styles.css file; I find they’re more accessible in there than by splitting up these styles too much. I also have a couple of standard classes that I use throughout the HTML as auxiliary methods in the design:

.left {
	float: left;
}

.right {
	float: right;
}

.clear {
	clear: both;
	height: 1px;
	width: 100%;
}

Whenever I need to produce a break in the HTML between divs, I’ll use the .clear class. I find that this is generally more effective than using br tags.

<div class="left_column">...</div>
<div class="right_column">...</div>


<div class="clear"></div>

<div class="footer">...</div>

The only catch with separating out a colors stylesheet is that all the border styles have to go there as well, if you’re going to add color to borders. But other than this, all the other stylesheets are used to house their respective functions, meaning that I put all font styles like size and font families in the type.css file, and so forth.

The main file I include in the web page is the styles.css file. At the top, I use @import to bring all the scripts in:

@import url("reset.css"); //reset for browser compatibility
@import url("layout.css"); //layout styles
@import url("type.css"); //font styles
@import url("color.css"); //colors and borders

Then, down the road when the client wishes to make changes that can be solved by adjusting styles, I can more easily locate changes, especially with color palette changes. I still have all the custom styles in the generic styles.css file, which I’ve noticed encumbers me less than using other CSS frameworks.


Crunch Time and Updates

By David Golding

If you’ve seen the book on Amazon, you’d have seen that it’s publication date is set for early July. Well, I’m happy to say that the book is coming along nicely. And it is crunch time. Still some revisions to make and more editing, especially since Cake was updated to 1.2rc1 just last week. But I’m excited for the book’s release.

Folks have criticized the framework for its lack of documentation, though I think there’s plenty of good docs out there to get you started in Cake. What they’re really saying, I think, is that they expected more documentation than what they got. I know when I started working in Cake, the first thing I searched for was a book, even an e-book if there was such a thing. I have been quite surprised that something hasn’t been printed yet with regards to learning Cake. So I’m happy to offer something to the Cake community that should help boost participation in the framework. After all, my main goal in writing a book is to bring awareness to Cake and to help fellow developers avoid the mistakes I made when first learning the framework.

As the title suggests, the book is designed as a beginner’s tutorial through Cake. The original title was “The Newbie’s Guide to CakePHP” or something like that. You can still download those early chapters, if you’d like, though the book will be much more detailed than these early drafts.

The first part deals with the basics of running CakePHP. Once those routine tasks of getting an application running are discussed, I move on to a tutorial - yes, the classic “build a blog” tutorial - but at least this application takes on a bit more than the usual walkthrough. For instance, the blog I build uses Ajax comments with voting links, category trees for sorting blog posts, and other useful features.

Throughout the tutorial I take some detours to further explain concepts like working in MVC, using helper functions, and building custom resources. The last third of the book deals exclusively with building custom classes like DataSources, behaviors, helpers, plugins, vendors, and more. The book is also set to include a resource in one of the appendices that outlines most of the functions and properties in Cake.

In the end, I think it gives a necessary foundation for the reader to be able to explore the online documentation without any problems and misunderstandings. I think that this is the real benefit of the book, to help the reader get excited about Cake. Later, another book that deals with a more exhaustive approach, i.e., a full explanation of everything Cake can do, you know, like those 1000-page tomes, ought to be written. But I’ll leave that one to the Cake Foundation or another more ambitious developer :)

Anyhow, I’ll keep you posted on developments on the book as we get closer to the release. And thanks for all the support!


« Older Entries

Beginning CakePHP: From Novice to Professional by David Golding

David Golding

A blog about CakePHP, web design, and grad studies in religion. © 2008, D. Golding