Pages

Thursday, December 27, 2012

Thing of the day : PHP.INI short_open_tag

Working on some Web Development in Wordpress / PHP, I made the following experience today: A file was being parsed and executed correctly on one server, but showed a parse error (unexpected T_ELSE, but this could have been anything related to placement of conditional and loop markers "}").

What do you do? You double check if the file is indeed the same file. Is there a problem with FTP, encoding, etc.? And then? You noticed that you were using <? instead of <?php Then you look in PHP.INI and you find this: short_open_tag.

The default is "On" and most web hosts use this, and I was so used to using it everywhere in my code, that I really didn't see it.

However, on some packages like Wampserver this is "Off". I figure this can save someone many hours, and I'm thinking of a more structured way to contribute these kind of quircks. Any idea, anyone?

Wednesday, December 26, 2012

Translating Wordpress: Poedit

I had a hard time during the last couple of days trying to get gettext translation work in a Wordpress installation. Eventually it turned out to be a bug (read: a missing slash) that went undetected and made me search for hours and hours. Not very cool with Christmas, but at least it's warm inside.

And I learned a lot about translating in Wordpress. If you google it, you'll probably find plugins like transposh, qtranslate (both free) or WPML (free for non-profits). There are also lots of tutorials about using gettext with Wordpress. You need a little program called poedit, that requires some configuration. The best tutorial I found (I read about six) is:

http://wp.smashingmagazine.com/2011/12/29/internationalizing-localizing-wordpress-theme/

Note that some other tutorials miss some of the relevant settings.

Happy translating!

Tuesday, December 18, 2012

Creativity and Computers?

Yesterday, I wrote about the creative juices that allegedly flow wildly when programming a computer, or generally working with digital devices. This is partly true, when you have to move swiftly between files and folders, tabs and temporary clipboards,when you have to program in various languages and just challenge your brain constantly to be precise enough. Every geek with a little bit of experience knows what I'm talking about here.

I once studied computer science because I thought it'd be the most creative thing in the world. Unfortunately, that turned out to be an illusion. Of course, there are the events like I described yesterday, and I enjoy programming the computer like playing chess or making an origami flamingo, things that also bolster our mental dexterity.

The thing is, 90% (or rather 99%) of the time, we are looking into things that others have done and decides for us. And there's nothing creative about that. We have to learn how to use libraries and APIs, and so on. And even our own code and ideas, they have to be debugged and checked, a weary, not at all creative process.

I estimate that when I write (for example this blog post), I am creative 20% of the time, and the rest is repetitive taks like filling in gaps, spell check, or sitting around waiting for inspiration. What I wanted to point out today is that this 20% is a lot higher than the 1% of creativity while I'm programming.

Sunday, December 16, 2012

Programming for the Brain

Brains ought to jump. Photo seen at Google.com
Do geeks have an obsession with brains or braininess? Perhaps. I just wanted to share a simple but authentic thought with you:
Programming a computer is good for the flexibility of your brain.
That statement isn't true. It should be refined, since many programming tasks are boring and don't challenge our gray matter. Think surrepetitiously programming an old VCR.

So what about
Performing certain non-trivial tasks on your computer is good for your brain.
What kind of tasks? Programming at CERN or hacking into NASA (which might not qualify here given the age of the individual who actually did that)? What about a variety of tasks that are not related? Multitasking. Here I can give a concrete example. I sometimes get behind my computer to multitasks. Work on various websites, create graphics, work on my novel, organize my files, set up an FTP account, manage a server, and so on. I - and my brain - have to switch back and forth between the different contexts of these tasks.
And I can actually feel how my brain is rejoicing! I am sure that it will help me remain versatile and open-minded until I'm very old. Meaning you don't need to remind me that I have to write another blog in 50 years following up on this one;-

So I go with
Rapidly performing tasks with a different context on a computer is good for your brain.
Now on to my other sites.

Geeky Christmas: Snow

In the Christmas season, website owners are looking for Santa and snow. Moving images of Santa abound on the Internet, and we're not going into that.

I have looked for a snow plugin for a website I work on, amaidi.org, and integrated the best I could find. Flakes are highly configurable, there are several modes and the coolest thing is that the snow can collect on a <DIV>.
It is really easy to integrate this plugin by simply adding this line to the <HEAD> of your file to load the latest Jquery and the plugin file:

<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript">

And then, just before the </BODY>:

<script 100="100" 5="5" :=":" code="code" document="document" flakecount="flakecount" function="function" gt="gt" maxsize:12="maxsize:12" minsize:="minsize:" ready="ready" round="round" snowfall="snowfall" true="true" type="text/javascript">

Where you can of course change the settings.

Learn more about the plugin on its github page, and I wish everyone a snowy Christmas!

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Lady Gaga, Salman Khan