Text

A module to make IMCE match CKEditor in Drupal

Back in April, I wrote a post about theming IMCE to match CKEditor’s Kama skin. It involved copying and pasting stuff to the site theme. Meh.

To make things go a little more quickly, there’s now a module for it: IMCE Kama Style. To use it, just download and enable the module and you’re done.

There’s no UI or settings page for this little guy; it’s not that type of module. All it does is adds CSS and images. As for the question of whether or not this is kosher for a module to do (when it is really the theme’s job), I’m not sure of the answer. But I do know that copying and pasting all that was getting old fast.

So check it out and feel free to leave ideas for better styling in the issue queue.

Quote
A camel is a horse designed by a committee.

— unknown source

Text

Applying GitHub fork commits when the fork queue hates you

The GitHub fork queue rarely works like you’d like it to. If your project has a fork with commits that you’d like to apply, then about 80% of the time, the fork queue tells you that the changes will not apply cleanly. This means you’re stuck doing it yourself.

Here’s a way that saves the commit history so your contributors still get credit.

1) Grab the fork and stick it into your own project under a new branch.

git fetch THE-FORK-REPO-URL master:NEW-BRANCH-NAME

I usually just use “testing” or something like that for my branch name.

2) Make sure you’re currently on the “master” branch.

git checkout master

3) Merge the changes into master.

git merge NEW-BRANCH-NAME

4) You’ll no doubt have some conflicts, so read the output to see which files have conflicts, then open those up in your favorite text editor and remove the old stuff, leaving the new stuff (you’ll see markers telling you what’s old and what’s new).

5) Add the files and commit them, then push the changes.

git add .
git commit -m "merging from totally awesome contributor"
git push origin master

6) If you get git push rejected non-fast-forward errors, you’ll have to pull the current master:

git pull origin master

Then fix any conflicts, then you should be free to run your git push origin master again.

Tags: Programming
Quote
If there’s no solution, there’s no problem.

— unknown source

Text

How to Learn Drupal

People seem to ask this question a lot. When you’re learning something, it’s comforting to know that you’re doing it correctly and efficiently and that you’re not learning the wrong way or the long way.

Therefore, once and for all, here’s my official 1 minute guide to learning Drupal.

General Advice

As with most things programming related, the best way to get up and running is just to do it already. Download Drupal, install it somewhere, and build a blog just to learn the ropes. You’re going to see terms like “node”, “taxonomy”, “module”, all kinds of words you’re not familiar with. They key is to research stuff like this as you come across it, and make sense of it all as you go.

I’m completely against reading all about something and trying to learn it before actually doing anything with it yourself; it makes a lot more sense to start doing it yourself and use the resources to help you along the way.

If you’re still going to read something before you get started no matter what I say, then read What Is Drupal by Tim Millwood.

Recommended Steps

There are, in my opinion, four basic steps to becoming a Drupal expert. Those are:

  1. Learning to use Drupal core for content administration. To learn: build a multi-user blog using only Drupal core.
  2. Learning to use the big boy contributed modules (such as Views and CCK). To learn: build an image hosting site complete with image resizing, a lightbox, categories, etc.
  3. Learning theme development (including the cool stuff that goes on in template.php). To learn: Build a theme suitable for releasing on Drupal.org.
  4. Learning module development. To learn: Find something that no contrib modules handle (something really weird like a mortgage calculator for California residents), and make a module to handle it.

Once you have a good hang of those four, then you can start cranking out some truly awesome stuff with Drupal.

As for some resources to help you along the way…

Books

If you like books, there are two great ones to pick up.

  • Using Drupal - a really good intro to both Drupal site building and content administration with Drupal.
  • Pro Drupal Development - the big boy in coding Drupal sites, complete with loads of info on creating modules and themes.

Screencasts

If you’re like me, you’d much rather see something done than read about it. If that’s the case, then the following sites have some really good Drupal screencasts for you to get up and running with.

Getting Questions Answered

You’re no doubt going to have questions along the way. Whenever I have questions, here’s my typical process:

  1. Google it for at least 5 minutes, and if you can’t find anything…
  2. Ask in IRC. The #drupal channel at irc.freenode.net usually has about 500 people at any given time (although most of those people aren’t active at any given time), and that’s the hangout for core and contrib devs, so you’ll often get some really good help.
  3. If it’s related to a specific module, then ask your question as a “Support Request” in that module’s issue queue on Drupal.org.
  4. If all else fails, ask on Stack Overflow. There’s about 3 or 4 active contributors to SO that are more or less Drupal experts, so you’ve got a good shot at some help here.
  5. Post in the Forum on Drupal.org. I’ve never had good luck with this so I save this as a last resort.

If, at the end of this process, you still don’t have the answer, then my advice is to go back into IRC and ask your question every 3 or 4 hours until someone answers it or points you in the right direction.

Conclusion

Drupal is what some have called a “wall” project. That means, some projects have learning curves, and Drupal has a learning “wall” that seems impossible until you all of a sudden jump it (i.e., the lightbulb moment) and it all makes sense. Just stick with it until it starts to make sense and you’ll be just fine.

Tags: Drupal
Text

Coding Music

I’ve been steadily building up a collection of good background music for coding. If you’re interested, here are a few bands/artists I’d recommend:

  • This Will Destroy You
  • The American Dollar
  • The Album Leaf
  • Amiina
  • Eluvium
  • Philip Glass
  • Brian Eno
  • Harold Budd
  • Aphex Twin (the ambient stuff)
  • Boards Of Canada
  • Carbon Based Lifeforms
  • Explosions in the Sky
Quote
There’s a rotten banana somewhere in this room and I need to find it!

— Nancy

Tags: Quote Nancy Funny
Text

My top 10 Gedit plugins

Gedit can be a really awesome editor if you give it a few plugins and an open mind. Here are a few of my favorites.

  1. MultiEdit - This bad boy lets you edit in multiple locations by only typing once. You would be AMAZED at how useful this is.
  2. Snippets - One of the default plugins, this one is sort of hard to explain because it does so much. It lets you create shortcuts for code that are expanded when you hit tab, but it also includes support for placeholders, wrapping text in tags, and lots of other crazy stuff.
  3. Zen Coding - This one’s my own, but the magic really comes from the Zen Coding library. Zen Coding lets you write a sort of HTML and CSS shorthand which is evaluated and expanded. Here’s a video to explain.
  4. AutoTab - A really simple plugin that tries to figure out the tab width of the current document, and sets Gedit to use that.
  5. Line Tools - Gives you some shortcuts to do stuff like delete current line (CTRL+D), duplicate current line (CTRL+SHIFT+D), move selected lines up/down (ALT+UP/DOWN), etc. Really, really useful.
  6. Save Without Trailing Space - Automatically strips any whitespace from ends of lines when you save, and can also add a blank line at the end of the file upon saving. Really useful for patches to projects like Drupal which reject patches with extra whitespace.
  7. Tab Switch - Lets you switch between tabs using the commonly used CTRL+TAB and CTRL+SHIFT+TAB.
  8. Todo - Gives you a little window that displays any TODO items in your code comments, among other keywords. Really handy for catching up on what you were working on the day before or keeping track of places to improve.
  9. External Tools - Gives you the ability to execute any command on the current document or selected text. The possibilities are endless with this one. Perhaps you want to validate your PHP syntax or run your HTML through HTMLTidy or check your JS with JSLint, etc.
  10. Pastie for Gedit - Lets you create a pastie (see http://pastie.org) out of the currently selected text. Great for sending snippets to people quickly.
Quote
An expert is a man who has made all the mistakes which can be made, in a very narrow field.

— Niels Bohr

Tags: Quote