Query Strings

Drupal Themes in Relation to Templates and Engines

February 5th, 2011 · No Comments »

Drupal can use four different types of engines to render themes: PHP, PHPTAL, Smarty, and the default engine, PHPTemplate. Engines are interface libraries, like DLLs in Windows or other libraries you’ve seen used to prevent having to write the same code over and over. Themes are a folder made up of CSS style sheets, images, and so on, but they also contain the template file. The template file typically contains large portions of HTML with small snippets of PHP which get replaced by dynamic content. The syntax of the PHP in the template file depends on the engine being used.

You can tell which engine is being used by the extension of the template file:

Template File Extension

Theme Engine

.theme PHP
.tpl.php PHPTemplate
.tal PHPTAL
.tpl Smarty

“Not Equal” Comparison Operators Used in Different Programs and Languages

January 4th, 2011 · 2 Comments »

ASCII not equal comparison operators range from ~=, !=, /=, =/=, to <>. Here is a table of the various operators and their corresponding programs or languages.

Not Equal Comparison Operator Program or Programming Language
~= MATLAB
!= MySQL, C, C++, PHP, Perl, Java, Javascript, Python
=/= Erlang
!== in PHP it checks the type as well as the value
<> SQL, MySQL, ASP, Microsoft Excel, Visual Basic, and Visual Basic.Net
-ne Bash

How to Version CSS Files with a Query String to Prevent Cached CSS Use

December 4th, 2010 · No Comments »

How to force a browser cache refresh using a CSS query string

Have you ever seen a ‘d’ query string on a CSS link in HTML source code and wondered what it did? The ‘d’ is mostly just a semantic way of describing the parameter that follows it, which is the date. The web server will ignore the string because it isn’t programmed to understand it, but it allows an easy way to cause browsers to think that the CSS file has changed thereby forcing a cache replacement.

<link href="/style.css?d=20101204" rel="stylesheet" type="text/css" />

The only downside is that each time the CSS file is updated, the parameter, which in the above example is a date string, has to be updated. Depending on the software you are using you can use tags to automatically change the date.

How to automatically version the CSS file for cache refresh in WordPress

In WordPress you would use the ‘time’ template tag after the ‘d’ query string like this:

<link href="/style.css?d=" rel="stylesheet" type="text/css" />

Thanks to Stack Overflow for the tip. Some call this the “Expires or Cache-Control Header”.

7 Emergent Internet Technologies from 2002

December 3rd, 2010 · 1 Comment »

In April 2002, Tim O’Reilly wrote of “the emergent Internet operating system” as an open collection of Web services.  On December 2, 201o I wrote about how Chrome is an operating system in a browser, because, “Soon the largest operating system will be the Internet itself.”  (By the way, the Chrome Store may open December 7, 2010.) This is different than ChromeOS, which is an operating system that resides on your local workstation, but relies heavily on Web apps to get things done.  What we are talking about is that the Web apps and the structure that allows you to access them (The Internet) is the operating system.

In the 2002 article O’Reilly predicted the rise of the following seven technologies:

  • Wireless
  • Next generation search engines
  • Weblogs
  • Instant messaging
  • File sharing
  • Grid computing
  • Web spidering

Wireless

In 2002 802.11 B was the primary wireless protocol.  O’Reilly mentions only PCs and “computing devices”, but much of what we would consider ‘wireless’ today is smart phones which run on 3G and 4G networks, but at home, work, and around major municipalities  Wi-Fi has gone from B to G to N to WiMax and antenna design keeps getting more sophisticated in order to keep pace with all of the interference created by the ubiquitous-ness of the wireless world.

Search Engines

“Next generation search engines,” are really just search engines now.  We don’t put up with anything but Google and Bing anymore, which are now the next generation of O’Reilly’s 2002 ‘next generation’.  Search engines can now predict and suggest things to us, are used as spell checkers, but mostly as additional, exterior brains.  We don’t need to remember things, we just need to remember what to search for-let the search engines do the rest.

Blogs

“Weblogs” or blogs as they are now called have moved from being online journals to online platforms.  They’ve separated website setup from website content.  In the same way that XHTML separates content from structure (HTML, PHP, and CSS for example), blogging platforms like WordPress, Blogger, Typepad, and Tumblr allow people to hit the ground running.  However, content is still king and just because it is less work doesn’t mean that content is better.

IM

Instant messaging was the next big thing after web email (think Hotmail and Yahoo! Mail since Gmail hadn’t hit the market yet) and it was mostly used by adolescents.  But by the time corporations starting adding it to everything from Lotus Notes to Passageways instant messaging lost its cool and just became a tool.  Facebook and Gmail both have it, but only as part of a complete tool set of which not having instant messaging would seem incomplete.

File Sharing

Back then (in the Napster days) and still to this day file sharing services like Bittorrent allow an efficient way for files to be transferred across a network.  Instead of one server hosting all of the files, many workstations and/or servers host pieces or complete files that can be shared, thereby sharing resources and reducing hardware strain and bottlenecks.  Peer-to-peer (P2P) networks can even be used to redirect DNS traffic.

Cloud Computing

‘Grid computing’ or ‘distributed computing’ is now most often referred to as ‘cloud computing’ most likely because Microsoft Visio represents the Internet as a cloud in it’s network diagrams.  From Microsoft to Oracle to IBM to HP to Dell, all the big players want in on the future of computing.  It’s a hearkening back to the days of big iron mainframes and terminals with Amazon Elastic Compute (EC2) and Microsoft Azure ready to fuel your netbook running ChromeOS.

The Dark Web

‘Web spidering’ has now become a given.  It’s how search engines work, but what I think O’Reilly was hinting at was that there is much more to the Web (HTTP port 80) than we know about and much more to the Internet than the Web.  Some estimates say there is up to ten times more material on the web than is currently searchable (or public, which is essentially the same thing because if you can’t find it, it’s not public).  This is probably the least of O’Reilly’s predictions.

So what does the future hold?  Where do we go from here?  Cloud computing, increased wireless activities, and more mobile computing through slates, tablets, smart phones, and netbooks will fuel the always-connected society we have developed around the Internet and make us a smaller planet.  Maybe it will lead to less wars and more peace.  Maybe.

Google Chrome Now Grabbing Nearly 10% Browser Market Share

December 3rd, 2010 · 1 Comment »

While Internet Explorer (IE) still dominates with 59% of the market share, Chrome now accounts for the equivalent of nearly half of all Firefox market share at 23% and nearly double Safari’s market share of 6%. If you divide the marketplace into PC users who are never going to stop using Internet Explorer and Mac® users who are never going to stop using Safari, then that leaves a slice of pie at 36% which gets shared between Firefox, Chrome, and Opera. Despite many Opera upgrades it still lags the marketplace at nearly half Safari’s market share at 3%.

What does this mean to you?

While Firefox and Safari are not ‘operating systems in a browser’, Internet Explorer and Chrome either are or are going to be. If you write or use cloud computing applications, history says that the browser attached to the largest operating system (currently Windows for PCs) will win. Soon the largest operating system will be the Internet itself, the one running inside of the best browser capable of recognizing that—and right now that is Google’s Chrome.

Plug-In PHP: 100 Power Solutions

October 21st, 2010 · No Comments »


Simple Solutions to Practical PHP Problems

100 PHP power solutions in one handy guide

This practical resource contains 100 ready-to-run PHP plug-ins you can use to create dynamic Web content. The book begins by showing you how to install, configure, and use a powerful web development environment. Then, each chapter in Plug-In PHP offers complete, working examples for specific end results you can achieve right away. In this time-saving tool, all of the code is extensively documented along with tips for adapting it for your own requirements.

This book is great if you want quick apps for your website. It includes such examples as how to determine the number on users currently viewing the page and how to add bing maps to your pages. The author’s style of writing is good. His explanation of the code is great and easy to follow.

Get ready-made PHP plug-ins for:

  • Text processing
  • Image handling
  • Content management
  • Forms and user input
  • Internet integration
  • Chat and messaging
  • MySQL, sessions, and cookies
  • APIs, RSS, and XML
  • JavaScript and Ajax
  • Geo-location
  • Spelling and language translation
  • And much more

Google Chrome Store Opens New Possibilities for Programmers

August 18th, 2010 · No Comments »

The opening of Google’s Chrome store in October means new avenues for revenue

Etherfleet reports that Google is set to launch an online Chrome app store in October and that developers will be able to write and sell Chrome apps there ala Apple iTunes app store. Programmers will receive the bulk of the revenue, but Google will take their cut. Google needs entrepreneurial hackers to code apps to help build up the community and help make them money. You can view a demo of the Chrome Web Store on Youtube.

Programming Differences between Chrome Browser and Chrome OS

Because Google’s Chrome store will serve and sell both Chrome browser and Chrome OS apps, I thought I’d take a minute to discuss the differences in how each is coded, but for those who want to dive in, here is the link to the Chrome Developers Guide.
Read the rest of this entry »

Beginning Google Maps Mashups with Mapplets, KML, and GeoRSS

August 16th, 2010 · No Comments »


Beginning Google Maps Mashups with Mapplets, KML, and GeoRSS is a beginner’s guide to creating web mashups using Google mapping technology.

  • Serves as a single–source primer to displaying data on Google Maps
  • Covers both mapplets and the Google Maps API
  • Provides everything you need to start participating in the Geographic Web

What you’ll learn

  • “Mash up” GeoWeb services onto a Google map.
  • Package your mashup as a mapplet and publish it to maps.google.com.
  • Enhance your map with driving directions, local search, map advertising, and more.
  • Discover common Google–mapping mistakes to avoid.
  • Find out how and when to geocode existing data into mappable coordinates.
  • Deliver your own data as GeoXML.

Read the rest of this entry »

Beginning Google Maps API 3

August 16th, 2010 · No Comments »


This book is about the next generation of the Google Maps API. It will provide the reader with the skills and knowledge necessary to incorporate Google Maps v3 on web pages in both desktop and mobile browsers.

It also describes how to deal with common problems that most map developers encounter at some point, like performance and usability issues with having too many markers and possible solutions to that.

  • Introduction to the Google Maps API v3
  • Solutions to common problems most developers encounters (too many markers, common JavaScript pitfalls)
  • Best practices using HTML/CSS/JavaScript and Google Maps

What you’ll learn

  • Building reliable Google Maps web applications
  • How to transfer from version 2 to version 3 of the API
  • Best practices using HTML/CSS/JavaScript
  • Dealing with large amounts of map markers
  • How to look up addresses and coordinates using GeoCoding and reversed GeoCoding

Read the rest of this entry »

How to Make a Facebook Share Button

August 16th, 2010 · No Comments »

Facebook has a page that makes it easy to create a share button for your website, but if you know a little HTML and javascript you can edit it how you see fit.

As you can see above, you can choose between a button and a link, then edit or copy the code to place in your PHP or HTML files, depending on whether or not you are running a CMS.