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!

Thursday, November 8, 2012

Cross posting

The amount of services, plugins and methods to syndicate your blog to many different platforms has grown steadily over the last few years, and it is easy to lose track of it. I had a look at some convenient solutions yesterday, that are suited to regular bloggers. Majors blogging platforms like wordpress, blogger, tumblr allow for posting per email. This is still one of the easiest and most rubust ways to set up your cross-posting empire, as there is no need to re-approve applications or update when services update their API. I use Wordpress multisite as a backbone, with a simple plugin called crosspress to autopost stuff to blogger and tumblr sites. There are a number of automated syndication plugins, but I couldn't get them working. Another out-of-the-box solution is to use posterous.com, which let you post to all major blog platforms simultaneously. I'm sure there are and will be many other such site. So, why would you want to autopost?
  1. It can be more convenient to use one back-end to write all your blogs;
  2. It is good SEO practice to have dedicated domains per blog topic;
  3. Your followers might have bookmarked your old blogs, and you want to hold on to their domain names but move your main blog elsewhere.
Happy cross-posting;-  

Sunday, September 9, 2012

Bulk file rename utility

not-so-scary screen of this utility
Sometimes you want to rename a series of files in one go. Windows has very limited functionality for this. Although it can rename files generating automatic postfixes like (1), (2) etc, it doesn't have the flexibility you need when your file names are important for you. In most cases you would like to have control over the file names of your photos, and manually changing "DCR000346" into "holiday photo 346" isn't much fun if you have to go through 100s of photos.

I use file names as important tags on the content. I add the following prefixes when working with files that are assignments that have to be sent in for payment:

  • + done
  • # billed
  • $ paid
  • ! error

Now it'd be nice to add and remove these prefixes with a simple utility. And we can do that using a tool simply called "Bulk Rename Utility". You can find it here: http://www.bulkrenameutility.co.uk/Download.php

It offers a lot more possibilities than this, like regular expressions, automatic numbering, insertion of folder names, date conversion and more.
And it has a preview-option so you can see the result before applying. Recommended!


Friday, August 17, 2012

Sign A PDF Without Printing

One of these little tasks we all need to do every once in a while is signing documents. As usual, many traditional institutions don't (yet) support digital fingerprint signing, so they require a "real" handwritten signature. Filling in the form can be done online, everybody has the Acrobat plugin to make that happen, but attaching a signature?

There are a few quick and free ways to accomplish this, without printing out your document, signing it with a pen, and rescanning it. Of course you just attach an image of sufficient quality. One PDF-reader that does this is NitroPDF. It is free to try, and you can actually sign your documents with the free version by inserting a scanned (or photographed) image of your signature. The pro version offers batch processing, word integration and full control.

If you prefer just working in the cloud (because your computer is too slow for the heavy NitroPDF or you are in a cyber) and you prefer signing PDFs online, that this website is for you.

There are also plenty of free fax utilities, so that you don't need to touch a printer or fax machine to send it to whatever prehistoric institution it is that demands your paperwork...

Wednesday, August 15, 2012

Wordpress vs. Drupal


Two of the most prominent tools to create websites are Wordpress and Drupal. Both of them are well developed PHP-based open source content management systems. When people start websites these days, they need to pick an appropriate framework first. I'll try to explain when Wordpress is more suitable, and when Drupal would be advisible.

The common preconception can be summarized in two prejudices:
(1) Wordpress is just for blogging
(2) Drupal is a complicated CMS with a very steep learning curve
This is not true. Wordpress can be, and has been, used for full-blown websites, and vice-versa, you can do amazing things drupal without in-depth knowledge.

Wordpress might be slightly easier to set up with its famous 1 minute install, but once you've installed the database and start creating your site, your main limitation is how well you know the respective universe. Yes, the wordpress community and the drupal community are that big.

There is a large amounts of themes to choose from, so you're likely to find what you're looking for.

Practically, what really matters is the availability of plugins, because you don't want to program every extension by yourself. Let's list a number of common tasks you want to perform using plugins that are available for both platforms. Just go to their plugin directory and download it directly from there. In most cases, there are several plugins available, free or premium, and you pick what fits your needs.

  1. Facebook integration
  2. Social bookmarking
  3. Most popular posts
  4. Google Maps integration
  5. SEO
  6. Form creation
  7. Custom data types
  8. Slideshows
  9. Lightbox
  10. Email newsletters
  11. Chat clients
  12. Translation interface
  13. Picture galleries
  14. custom taxonomy (here, drupal is clearly better designed)
  15. Flickr, Youtube, Pinterest etc. integration
  16. Database backup
  17. Import of blogs / CSV
  18. RSS readers
  19. Powerful editors like TinyMCE
  20. Performance optimization (compression of .JS / .CSS files, minify, caching)

Only when it comes to very advanced search functionality or API-integration, the drupal-community might be ahead of Wordpress. Of course, these plugins should be convertible in some ideal world, but as for now, you have to throw hours of research and coding at it if you want to add truly new functionality to any CMS.

I run several Drupal-sites as well as Wordpress-sites. For anything resembling a blog, portfolio presentation, or a simple online community, I'd recommend Wordpress / Buddypress. For larger websites with critical bandwidth usage, security issues or e-commerce applications, I'd go for a Drupal installation, and take advantage of some of the latest plugins.

Enjoy your new site!

Tuesday, August 7, 2012

Dlvr.it

Most of us have used some platforms built on top of social networks like facebook and twitter. Services like Hootsuite, Tweetdeck, and Socialoomph come to mind (they are actually the top three). I've used them for a bit, but found them too bulky, especially if you are not working in a fixed office, but often on the road, relying on the small screen of a netbook or even more portable device. What I wanted was a service that simply published my content to a selection of targets.

I recently discovered such a service: dlvr.it. This is indeed very simple to use and manageable on a portable device. I've set up several "routes", which connect sources to targets.
Sources are (reusable) collections of feeds from a blogger, wordpress or tumblr blog, a joomla or drupal or any other CMS site, or a spiced-up feedburner feed, and link these sources to "targets", which can be facebook pages or groups, twitter accounts, tumblr sites, and a number of other possibilities.

It also offers a nice widget to place on your website, a decent stats page, and the possibility to send direct messages to one of your target streams.

Their way to monetize is called "promoted stories". While I haven't tried I the service, I can imagine it might be a fair deal for a company building up audience. It promises to boost your search and social network visibility. Their pricing is on a per-story basis.

The service hasn't been down since I've started using it a few months ago, and I can recommend this to all bloggers out there.


Thursday, August 2, 2012

Scripting with autohotkey





Here's a tool that is easy to use yet extremely powerful. If you're an average computer user who just reads emails and edits an occasional word document, you can benefit from autohotkey. If you're a heavy user and it's not uncommon that you've more than 20 windows open, you can benefit even more from this scripting program.

Experts agree that Autohotkey is one of the best automation tools around. Perhaps you haven't heard of it before, because you've never seen any ads? Well, that's because it is open-source freeware! The benevolent geek who created this over the course of many years has made the source code as well as installer packages available on his site.

Functionality
Autohotkey is a powerful scripting language, really. With some patience, you can achieve everything from adjusting the volume of your computer's speakers to manipulating the registry and .INI-files. If you don't think that is very useful in daily computer chores, you're right. But here are a few things I actually do with autohotkey that save me a lot of time.

  1. keyboard abbreviations. I could have written that word by just typing "abbr" and the script would have expanded the text automatically. I use such keyboard shortcodes, that are recorded by autohotkey in a straightforward way, to quickly write my greetings under an email. "bye" turns into "warm regards, {name}" and so on. There is a short and very useful script to automatically add such shortcodes by hitting any chosen key combination (a real boon of autohotkey is its flexibility in using all kind of key combinations). That script then asks which shortcode you want to assign to the text you just typed. That rule is then appended to your script (which can grow to contain thousands of words, really) and the next time you type it the script will replace your shortcode with the wanted text. Brilliant.
  2. I have a few scripts laying on my desktop, waiting for me to drag a .zip file onto them. They then unzip it to a standard location, open an explorer window or some other programs depending on the contents on the zip, and show me a small message box cheering me up working on these files. You get the idea.
  3. Autohotkey can be used for autocorrecting common misspellings. There's a script available that checks for the 4,700 most common mistakes in the English langauge. Wonder if they'd have gotten this one.
  4. Mouseclicks and other interface actions. They can be recorded (remember the old macro-recorder for windows) or hand-written in the .ahk scripting language that really is easy to learn. I use it to perform certain mouseclicks in file dialog boxes, so that I sort my files in the right way. Of course, there are more invasive ways of doing this, such as a hack in the registry or the installation of countless windows tools. But this gentle recording of user interface actions is kinda neat.
  5. Autohotkey allows you to compile your scripts to .exe programs, so that they are portable and can be used on a computer without autohotkey installed. They can also be decompiled.
In conclusion, this is one of the best freeware tools of its kind, and I recommend it to everyone.











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