Nando @ Aria Media

( learning Clojure ColdFusion Lucee Javascript jQuery Angular CSS Linux Apache HTML5 & etc )

Documentation for CFScript

| Comments

Adam Cameron posted an excellent resource yesterday that has been lacking until now, Documentation for CFScript. A few minor areas could be enhanced, but it is, in all, quite comprehensive. Update: He’s moved the CFScript documentation to GitHub, so we can all have a go at improving it. That said, it is still quite comprensive and very helpful indeed. Thanks very much Adam.

Disabling Browser Back Button

| Comments

I’m working on a particular process in a web application where the user could unintentionally create duplicate content using the browser back button. Here’s a handy way I ran across to disable the back button, or indeed handle it in any way needed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
window.onload = function () {
    if (typeof history.pushState === "function") {
        history.pushState("jibberish", null, null);
        window.onpopstate = function () {
            history.pushState('newjibberish', null, null);
            // Handle the back (or forward) buttons here
            // Will NOT handle refresh, use onbeforeunload for this.
            alert('Back button disabled. Please use navigation links instead.');
        };
    }
    else {
        var ignoreHashChange = true;
        window.onhashchange = function () {
            if (!ignoreHashChange) {
                ignoreHashChange = true;
                window.location.hash = Math.random();
                // Detect and redirect change here
                // Works in older FF and IE9
                // * it does mess with your hash symbol (anchor?) pound sign
                // delimiter on the end of the URL
                alert('Back button disabled. Please use navigation links instead.');
            }
            else {
                ignoreHashChange = false;
            }
        };
    }
}

Apparently, this works with older browsers that do not support HTML5.

Source: http://stackoverflow.com/questions/6359327/detect-back-button-click-in-browser

Octopress Cheat Sheet

| Comments

Here’s my quick and dirty cheat sheet for using the Octopress blogging framework.

Command Line

1
2
3
4
rake new_post["Post title here"]
rake preview ( http://localhost:4000 )
rake generate
rake deploy

Markdown Syntax

Headers

1
2
3
# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag

Emphasis

1
2
3
4
5
6
7
*This text will be italic*
_This will also be italic_

**This text will be bold**
__This will also be bold__

*You **can** combine them*

Unordered Lists

1
2
3
4
* Item 1
* Item 2
  * Item 2a
  * Item 2b

Ordered Lists

1
2
3
4
5
1. Item 1
2. Item 2
3. Item 3
   * Item 3a
   * Item 3b

Images

1
2
![GitHub Logo](/images/logo.png)
Format: ![Alt Text](url)

Links

1
2
http://github.com - automatic!
[GitHub](http://github.com)

Inline code

1
2
I think you should use an
`<addr>` element here instead.

Reference Octopress Cheat Sheet

I’m in the Dark Here

| Comments

I was watching a video of Richard Feynman some time back that inspired me in a very specific way. In it, he talks about his attitude toward not knowing things. Here’s a quote from it:

“You see, one thing is, I can live with doubt, and uncertainty, and not knowing. I think it’s much more interesting to live not knowing than to have answers which might be wrong. I have approximate answers and possible beliefs and different degrees of certainty about different things, but I’m not absolutely sure about anything, and there are many things I don’t know anything about … But I don’t have to know an answer. I’m not frightened by not knowing things.”

As a programmer, I’m constantly confronted by a cascading, bubbling vortex of all kinds of things I don’t know. I don’t remember a syntax; my “Google Foo” is failing me and I can’t find an answer; I’m not sure of the best way to architect a given process; I’m not really clear how a particular business process I’m trying to model actually works in the real world; I’m only familiar with certain aspects of a language or framework, and the rest lurks in the shadows of what I don’t know. In the words of one of my favorite movie scenes “I’m in the dark here.”

Being in the dark all the time, confronting that ever changing vortex of things I don’t know, affects me in various ways. It’s an ongoing source of stress. One of my coping mechanisms is to shut down, distract myself, and that leaves me less productive than I could be. It also seems to impact my ability to learn. What impressed me about Feynman is that he seems both enthusiastic, and very clear-headed, about what he does not know. He seems to genuinely enjoy not knowing things, to embrace the state of not knowing. To me, that’s a wonderful perspective to cultivate, both as a human being, but particularly as a programmer. It’s an inner gestalt that I want to develop.

Redefining How I Learn New Technologies

| Comments

I’m a programmer. Learning new technologies and techniques is essential to what I do. However, I have noticed lately that learning has become burdened - burdened with time pressure, lots of time pressure; burdened with the sheer volume, diversity and complexity of all the things it seems I must learn to keep up, burdened with the feeling that I am falling ever further behind the hundreds of thousands of brilliant programmers that are constantly pushing our field forward, in every direction, a constantly expanding universe that includes everything from server administration to user interface design to unit / integration testing and a plethora of languages and frameworks that are used to develop web applications. Sum all that up, and to me, learning has become burdened with a fear that I simply won’t be able to keep up.

The truth is that I really enjoy learning new things. I feel that’s one of the reasons I like programming, why I was attracted to it in the first place. And you know, looking at it clearly, my fear is entirely justified. There is no way in the world for a working programming to keep up with the whole field. It’s just too bloody big. And complex. So how can I deal with this situation?

Here is my proposal, to myself. What about taking one small bite at a time? What about simply enjoying the flavor, the taste of learning something new, as it is happening? On a practical basis, I don’t have a choice. The field is waayy too big to consume in one go. But on a personal level, I do have a choice.

So this blog is my space for learning new stuff. I’ve decided that I’m going to redefine my attitude toward learning. Until now, it has seemed that if I’m going to keep up, I have to gulp everything down as quickly as possible. Well, that doesn’t work. I’m left somewhat confused and overwhelmed, and I don’t really learn anything, not in a way that I can practically use.

This blog is for taking small bites, chewing things over, and enjoying what I’m learning.

Or at least when I must gulp, writing it down here may help me digest it better!