Browsing the Books category

Web Development for Intermediate Programmers – with PHP

I’ve written a ~300 page book on PHP!  While I do go over the basics, I go over “common” concepts of database manipulation and Ajax. I’ve also sprinkled in some User Interface and User Experience comments:

http://www.stevesohcot.com/php-book

Read the article

Book Review – “But What If We’re Wrong” – by Chuck Klosterman

(No, this doesn’t fit the usual theme of entrepreneria / technology, which is why this is also labeled as “Life”.)
I just read the book , “But What If We’re Wrong”  – by Chuck Klosterman. I liked it, and recommend it.  It gives an interesting point of view on things, and makes you question “truths” in your life.  I found the following quotes interesting:
On being remembered by future generations:
“To matter forever, you need to matter to those who don’t care.  And if that strikes you as sad, be sad.” – Page 94
On the idea of an unlimited number of universes:
“Somewhere, in an alternate universe – there is a planet exactly like Earth, which has existed for the same amount of time, and where every single event has happened exactly as it has on Earth that we know as our own …  except on that Christmas Eve of 1962, John F. Kennedy dropped a pen.  And there is another alternative universe with a planet exactly like Earth, surrounded by an exact replica of our moon, with all the same cities and all the same people, except that – in this reality – you read  this sentence yesterday instead of today.  And there is still another alternative universe where everything is the same, except you are slightly taller.  And there is still another alternate universe beyond that one where everything is the same, except you don’t exist.  And there is still another alternative reality beyond that were a version of Earth exists, but it’s ruled by robotic wolves with a hunger for liquid cobalt.  And so on and so on and so on. In an infinite multiverse…” – Page 104
On being able to prove a truth: “Discounting those events that occurred within your own lifetime, what do you know about human history that was not communicated to you by someone else?” – Page 137
On, what I feel, the author is referring to ask about risk mitigation: “It would be pretty idiotic if I never left my apartment building, based on the remote mathematical possibility that a Komodo dragon might be sitting in the lobby.  If my new postman tells me his name is Toby, I don’t ask for state-issued identification.” – Page 239
An interesting question:
“If a problem is irreversible, is there still an ethical obligation to try to reverse it?” – Page 241
An interesting observation:
“We spend our lives learning many things, only to discover (again and again) that most of what we’ve learned is either wrong or irrelevant.” – Page 248.

Read the article

Purple Cow – Review

I’ve been reading a lot of entrepreneurial books lately; figure I should post some book reviews / summaries.

I just read “Purple Cow: Transform Your Business by Being Remarkable” by Seth Godin.

I really liked it!  It cost $0.01 on Amazon (used), with $3.99 for shipping for a total of $4.

Key take-aways:

  • If you’re driving by a field of cows, they all look the same – and they’re all boring.  But if there was a “purple cow” then you’d notice it.  How can you, personally, stand-out among your peers like a “purple cow”?
  • Be “remarkable” – not “boring.”  If you’re selling a product – say, a pain reliever, how do you make it more noticeable than the other pain relievers (that people are already accustom to using, and they’re not going to switch)?
  • Find a niche market, and be the best at it.  You don’t have to be everything to everyone.

Read the article

jQuery Game Essentials – Sound example for HTML5

I’m reading the book “jQuery Game Essentials” to make my next web app (HTML5/jQuery).  The book is very helpful!  The last chapter focuses on adding “sound” to the game, but I had trouble implementing their solution.

I’m going with the “HTML5 Audio Element” route – where I would have both an .mp3 and .ogg format of my sounds.

The first problem was that, even though the book is excellent, there was a small typo: Under “Playing and Stopping Sounds”, there is a line: if (this.audio.lopp === undefined){

But it should read if (this.audio.loop === undefined){

(note, “loop” was spelled wrong). While I didn’t check, I bet it was probably fixed/noted in the book’s erratta .

But that was just the initial problem. I’m not too familiar with object oriented programming, so I didn’t know how to call it.
First, you have to preload the sounds already. Put this in your “game initialize,” or in my case, simply the document.ready() –

$( document ).ready(function() {

sound_explosion = new sound();
sound_explosion.preload(“sounds/explosion”);

});

Note that I’m not specifying the extension (.mp3 / .ogg), since that will be determined in the javascript code.

Anyways, the part where you actually want the sound to play, specify:
sound_explosion.play(false);

Note: you could put that right after preloading the sound if it was for background music. I specified “false” (and put the code somewhere else) since I wanted it to play once, for a sound effect.

See also my article on where you can download free game sound effects in mp3 format

The full javascript file I’m using is as follows:

 

// a sound object
sound = function(){

// Preloads the sound
this.preload = function(url){
this.audio = new Audio();
this.audio.preload = “auto”;
this.audio.src = url + sound.ext;
this.audio.load();
};

// Returns true if the sound is preloaded
this.isPreloaded = function(){
return (this.audio.readyState == 4)
}

// Starts to play the sound. If loop is true the
// sound will repeat until stopped
this.play = function(loop){
if (this.audio.loop === undefined){
this.audio.addEventListener(‘ended’, function() {
this.currentTime = 0;
this.play();
}, false);
} else {
this.audio.loop = loop;
}
this.audio.play();
};

// Stops the sound
this.stop = function(){
this.audio.pause();
this.audio.currentTime = 0;
};

// Pauses the sound
this.pause = function(loop){
this.audio.pause();
};

};
(function(){
var audio = new Audio();
var canPlayOggVorbis = audio.canPlayType(‘audio/ogg; codecs=”vorbis”‘);
var canPlayMP3 = audio.canPlayType(‘audio/mpeg; codecs=”mp3″‘);
if (canPlayOggVorbis == “probably” || (canPlayOggVorbis == “maybe” && canPlayMP3 != “probably”)) {
sound.ext = “.ogg”;
} else {
sound.ext = “.mp3”;
}
})();

 

Read the article

Listen to you customer, then ignore them

A non-technical lesson learned: figure out what the customer wants.  I remember reading that developers should listen to the customer, and then ignore them!  (Unfortunately I can’t remember where I read that  that – it was probably “Getting Real” or “Don’t Make Me Think” – I did a quick Google search for the quote but couldn’t find it.)

I had some rather complicated code that was used to generate graphs on the web (HighCharts.com – which I highly recommend).  After running the SQL through a recordset, I created a few (dynamic) arrays. (I was using ASP, but really it could be for PHP or any language).

I had to work on a brand new project for a customer, which involved graphs.  Of course I started from something I had already made.  But getting the graphs to work in my existing code was a bit tricky.  I would have to had get the data, transpose it, and then use that new data for the graph.  I was better off with a brand new SQL statement and getting a sample graph from the documentation to start from scratch.

Lesson learned: find out what the customer wants – if they only need something simple, then there’s no need to use complicated (but working) code to replicate it.

Read the article

Head First Ruby on Rails Chapter 3 form_for doesn’t work

I like the “Head First” series in learning new computer skills.  Right now I’m reading the “Head First Rails” book.

I couldn’t get some of the code to work in Chapter 3.  I found on the O’Reilly site a list of published errors (hey, no one’s perfect!).  On page 112 and 114

I couldn’t get the “form_for” code to work.  On the link above, they pointed out that you had to change “@” to “:” .  But what I didn’t see on the site was that you need to have “<%=” (and not just “<%” — note the “=”).  Also, there’s apparently no parenthesis around the “form_for”.

 

The line of code SHOULD be this:

<%=form_for :ad,:url=>{:action=>’create’} do |f| %>

Read the article

Visual QuickStart

One of my favorite series. They put in pictures of what the code you put in actually does, so you can really visualize it. I’ve read a few of their books, and they are all very well written. In particular, Larry Ullman’s PHP is great, and he has his own discussion board (which he participates in reguarly) related to PHP.

Read the article

PHP Pro Security

I’m read the book Pro PHP Security by Chris Snyder and Michael Southwell. The publisher is “Apress.” I recommend it. It covers both hardware and programming aspects. In particular, there are informative sections on validating user input, SQL Injection, and Cross Site Scripting.

Read the article

Head Rush Ajax

Awhile ago, I read an Ajax book in the “Head Rush” series. This is a unique series in that they put pictures (that may or may not be directly related to the topic you are learning) right in with the text. It’s their way of getting you to remember the content. I thought the book was very well written, and I would be included to look at other “Head Rush” books.

The site (with their code to download) can be found here: http://www.headfirstlabs.com/books/hrajax

Read the article

Excel and Access Integration

Re-posted from one of my older blog posts – I’ve since then learned Office 2007, but I thought this was a relevant link!

 

Did you know it is possible to combine the powers of Excel, Access, and pretty much all of the MS Office Applications together? Imagine being able to use an Access database that automatically creates and formats Excel and PowerPoint files, and then automatically e-mails them though Outlook.

This is done through VBA. I read through the book Excel & Access Integration with Office 2007 by Michael Alexander and Geoffrey Clark. I would recommend this book for beginners. I consider myself at the “intermediate” stage, and therefore only found 3 of the 11 chapters of interest. I don’t use Office 2007 (yet), but it was still helpful for 2003. Unfortunately, all of the sample code was for 2007, so I can’t view it.

The site for this book (and where you can download their source code) is www.wiley.com/go/excelandaccessintegration

Read the article