Category Archives: Programming

Learn HTML5 and JavaScript for iOS

Learn HTML5 and JavaScript for iOS

You have a great idea for a simple mobile web app. Or, you have a great idea for a complicated mobile web app. Either way, Learn HTML5 and JavaScript for iOS will help you build, fine-tune, and publish your app for iPhone, iPad, or iPod touch.

Pre-Order now available on Amazon.com.

I will walk you through building a mobile web app from scratch using real-world examples. You’ll learn about design considerations, mobile web frameworks, and HTML5 features like animation and graphics using Canvas. You’ll also learn how to customize your app for a variety of platforms, and you’ll explore testing and performance tips for your app.

PHP/JavaScript Empty String equals 0

Sometimes when you’re looking for something empty/null you might check for an empty string.

// php
$test = 0;
if ($test=="") {
echo 'true';
}
// javascript
var test = 0;
if (test == '') {
alert('true');
}

To avoid this you need to use the === operator. Which means exactly equal to (value & type).

Installing Twitter’s Bootstrap on OSX

I recently came across bootstrap, an HTML framework from Twitter. In the process, I cam across some more tools by twitter, less.js (which allows for dynamic creation of CSS), and Uglify (which allows for minifying js).

Here’s a short list to install these:

  1. Install Node Package Manager from http://nodejs.org/
  2. Install Less.js via ‘git clone git://github.com/cloudhead/less.js.git’
  3. Go to the less.js directory, type: ‘make’.
  4. Copy the install directory to /usr/local/less.js
  5. Add /usr/local/less.js/bin to $PATH
  6. Install uglify-js via ‘npm install uglify-js -g’
  7. Install Bootstrap ‘git clone git://github.com/twitter/bootstrap.git’
  8. Go to the bootstrap directory, type: ‘make’.

If I get a chance I’d like to talk more about Less.js, and Mustache.

Why I moved to Git from SVN.

I’ve resisted moving to Git for a year or so. Why? No compelling reason why. In fact all the reasons for using it were like:

  • it’s distributed
  • there’s GitHub
  • it’s the latest cool thing
  • all the cool kids are doing it

The last reason (cool kids) is probably the main reason for my resistance. I don’t like to follow the heard. I don’t like to do it just because everyone else is doing it. I especially don’t like to do things just for lame reasons or poorly supported reasons, or reasons without a compelling WHY?

Eventually I heard one compelling reason: It saves you time because you don’t need to switch context or have multiple workspaces copies in order to work on a branch or experiment with some code.

In all the talk about Git I’ve realized something very troubling in the software community, they are very bad at explaining WHY and have a tendency to always just explain WHAT.

Build Your Own PHP Framework – Book Announcement!

There’s almost a hundred different PHP frameworks out there. Some are big some, are small. All of them do about 80% of what you need the way you want it, but the 20% that’s not usually takes you the most time/effort/money.

This book shows you how to build your own PHP Framework using a PHP Framework template called GinPHP.

Visit the website to learn more http://www.phpframeworkbook.com.

 

Thinking Different

I was refreshing some of my terminology over the past week when I came upon a post by Martin Fowler about Dependency Injection. I was reading this and I understood the words, but it really made no sense to me.

Then I read another blog post by James Shore. It basically summed up dependency injection in a few words “giving an object it’s instance variables”. WOW. Something that made sense. Something I could immediately relate to and get, draw abstraction and application.

Why is it that essentially the same thing is explained two entirely different ways? Do some people get the former and have it make complete sense?

I’ve also noticed at conferences I go to a session and after about 5 or 10 minutes I am completely bored. It’s because they’ve said the main topic in the first few minutes, then spend the remaining 40 minutes giving pseudo examples about movie or car objects… Yawn…

Do other people think like this or are they just as bored as I am? Or are computer scientist just really poor story tellers?

The Perfect Programmer or Remarkable?

What’s a perfect programmer? Someone that writes perfect code, writes perfect test, uses a perfect language or framework or uses the perfect methodology?

I think there are plenty of good programmers, people that try to be perfect for their boss, or their peers, or because they might be a perfectionist. I think there are a lot of programmers that think other programmers are “bad” or not as perfect as them.

If your goal is to be perfect and strive for perfection, I don’t know how you’ll ever be happy because there’s always new technology or someone better at some aspect of programming than you. There’s always a better way to do something if given enough time and thought.

Is there something better than perfect? What about remarkable? What’s that like?

Well remarkable programmers are always learning, they are always innovating and they are not afraid to make mistakes. They are also not afraid of challenging the status quo and creating something new because what’s around is not good-enough. Remarkable programmers spend more of the day creating than they do anything else. Remarkable programmers also know there are many points of view and it’s not who’s point of view is most correct, it’s about getting something done. Remarkable programmers have a difficult time navigating though politics and agendas because those don’t contribute to what’s most important to them, shipping, creating something, and doing something new.

So if I had to choose between being perfect and remarkable, I’d choose the latter, what about you?