Sunday, July 17, 2011

Learning Git

Scott Chacon: Getting GitImage by fraserspeirs via FlickrTo learn a challenging topic, first find someone who knows both the topic and how to teach.  For git, Scott Chacon is one of those guys.  Scott is a Rails developer working for github, THE place to host your open source git repository.  Here's Scott:

I recommend trying everything discussed yourself as the video progresses, stopping when you need more time or need to google what you don't understand.
Enhanced by Zemanta

Friday, July 8, 2011

Become a Learning Machine

BinaryImage by Xerones via FlickrIf you find your education lacking, its now easier than ever to learn your way out of it. Universities all over the world put their lectures online. You can find one that teaches the topic of interest in a way that works for you.

And if you don't understand something, you can STOP the lecture and google it until you do. Replay the few seconds of video to make sure you heard it right. Do whatever it takes. You're in control.

Become a learning machine. Then no one can stop you.

Case in point. I lack a computer science background and get stumped when asked about basic software engineering concepts like sorting algorithms.  And I'm a software engineering. Or at least I play one on TV. :-)

So I finally decided to do something about it. I've found several courses on the topic. Here's a great one from Australia:

http://www.youtube.com/watch?v=RpRRUQFbePU

All the world's knowledge is being made accessible to you. Seize the opportunity!
Enhanced by Zemanta

JavaScript Semicolon Insertion

Code reviewImage by richardmasoner via FlickrHere's a good discussion of when a Javascript developer should use semicolons.

Basically, semicolons are statement separators and there are situations where a line break won't be interpreted as the end of a statement.

Many Javascript developers put them at the end of every line, but this is unnecessary.  Its better to actually understand the cases where a line break won't end a statement.

If you use a minification tool that doesn't interpret line breaks correctly, bugs could be introduced.  But if you use semicolons only where you need to, a bad tool will probably break most things right away. And that will be obvious.  Use semicolons ALMOST everywhere and then you won't discover the problems until you test specific lines that don't have them.
Enhanced by Zemanta

Saturday, April 17, 2010

Color Tools That Will Make Your Web Shine

Creative Arts Matthew Boulton CollegeImage by jisc_infonet via Flickr

Haven't checked all of them out yet, but it looks like a very useful list of color tools.

I'm creating a new resume tool and looking for something that will let me find a professional color scheme.
Reblog this post [with Zemanta]

Wednesday, February 24, 2010

Intuit Ruby with Ruby Koans

SAN FRANCISCO - SEPTEMBER 25:  A zen garden cr...Image by Getty Images via Daylife

The ruby koans plugin promises to "walk you along the path to enlightenment" in your quest to understand the finer points of ruby.

A koan is a Zen Buddhist concept meaning "a story, dialogue, question, or statement; the meaning of which cannot be understood by rational thinking, yet it may be accessible by intuition."

Koans encourage test driven development by presenting you with tests of ruby code and challenges you to make the tests run successfully by fixing the code. Presumably, once you have acquired the intuition targeted, your test will run.

Ruby can be challenging but has a lot of power and flexibility. And some day, maybe even scalability :-)

Tuesday, January 13, 2009

Showing and Hiding Divs in Facebook FBML

By the way, Facebook provides a simple way to open and close divs on a page. Its fairly limited though. I couldn't figure out how to use it in response to selecting an option from a dropdown list.

But if you want to open or close a div whenever a particular link is clicked, all you need do is add a "clicktoshow" or "clicktoshow" attribute to the anchor tag for a ink.

This code presents the "link_only" div initially. Clicking the link it creates will hide this div and present the "link_and_about" div.

<div id="link_only">
<a href="#" clicktohide="link_only" clicktoshow="link_and_about">What is this?</a></div>
<div id="link_and_about" style="display: none;">
About text
<a href="#" clicktohide="link_and_about" clicktoshow="link_only">Ok</a></div>

The value for these attributes can be a single div id or a list of them separated by commas.

There's also a "clicktotoggle" attribute you can use for a link that will always be available.

It would be nice if you could call a javascript method from a form element that could open and close the same divs. Haven't found an easy way to do this myself, but this post has some code that could be called to simulate a click.

This code won't work as is on Facebook though, as the createEvent method is undefined. FBJS does have some event listener functionality; perhaps this code be used to make that happen. Of course, this complexity is probably more trouble than what I did above.


Reblog this post [with Zemanta]

Javascript for Facebook

Facebook, Inc.Image via WikipediaJust spent some time with Facebook's Javascript replacement, FBJS. Its a must if your Facebook app has complex things to do.

FBJS rewrites all of your method and variable names so your code is confined to a sandbox and cannot mess with any of Facebook's code.

This renaming confines your code to a document called "aXXXXX.document", where "XXXXX" has to be your Facebook app's numeric id. So if you have this code:

document.getElementById('choice2_info')

Facebook changes it to this:

a19756161464_document.getElementById('choice2_info')

You can see this if you look at the source for the page finally presented by Facebook.

You'll also see that the id attributes for HTML elements are also changed in the page source. The original attribute may have been:

id="choice1_option_id"

but is actually rendered as:

id="app19756161464_choice1_option_id"

When using making use of methods and id, your code should use the originals, not the replacements. The FBJS version of getElementById will add the appropriate prefix to whatever you pass it, so it will look for an element with the id "app19756161464_app19756161464_choice1_option_id" if you prepend the id first.

FBJS also requires that you use different method names than you would if you are writing straight Javascript. For example, instead of using ".target" to look at or change an element's target, you use ".getTarget" or ".setTarget".

You can see a list of the methods affected here. There is much more on FBJS on that page and I highly recommend reading and understanding the material there before beginning a project.

If you do anything complex, you'll probably want to use a tool like Firebug to set breakpoints and watch the values of key expressions. I had a lot of trouble with the newest version, but version 1.2.2 worked fine.


Reblog this post [with Zemanta]