Computing: page 5
Convert UTC/GMT or any time zone to local time in PHP
Wrangling dates and times can be a somewhat arduous task for all programmers. One very common requirement is to convert a time from one time zone to another. In PHP this is greatly simplified with the DateTime standard library classes and especially DateTimeZone. For this example let us assume we have a UTC date and time string (2011-04-27 02:45) that we would like to convert to ACST (Australian Central Standard Time). Read more โ
Conditionally loaded responsive content on the client side
Sometimes it is helpful to entirely change chunks of markup when a certain CSS media query is triggered. This could because a certain layout will not work on smaller screen sizes or because it refers to media that you would not want a mobile to download. Recently I had this exact problem when dealing with a site that included a grid based layout in a carousel/slider. When the browser was sized down from desktop it needed to change the number of columns in the grid. Read more โ
Idiorm and Paris 1.4.0 Released
After a lot of work and many contributions from valued community members Idiorm and Paris versions 1.4.0 have been released into the wild. You can download them now from their respective repositories or via Composer/Packagist. As you are probably aware from my previous posts Idiorm is a minimalist ORM that is targetted at PHP 5.2 and above. It combines a fluent query builder with a simple ORM interface to allow fast and easy access to databases over PDO. Read more โ
Improve PHP session cookie security
The security of session handling in PHP can easily be enhanced through the use of a few configuration settings and the addition of an SSL certificate. Whilst this topic has been covered numerous times before it still bears mentioning with a large number of PHP sites and servers having not implemented these features. To prevent session hijacking through cross site scripting (XSS) you should always filter and escape all user supplied values before printing them to screen. Read more โ
There are a number of things you can do to make a server more secure whilst protecting your hosted entities and their users. Here are just three of the many things I do on every new server I commission. I hasten to add that these are not necessarily the most effective or at the top of my list - they are just that: 3 things I set on new servers. Read more โ
Install Netbeans and Scala on Ubuntu
If you want to install and run the latest version of Scala and/or Netbeans then you cannot simply install it from your distributions repositories or pre-built packages. It may sound easy enough to just grab Netbeans from their site and install it, but most Linux distributions no longer have Sun Java packages in their repositories. So after a little bit of mucking about, reading manual pages and documentation I struck upon the following method of setting it all up. Read more โ
Create a Google Talk bot with Node.js Part Two
In part one of the tutorial you built a bot with Node.js that could connect to the Google Talk network and announce its presence to other users with a status message. The bot was also configured to listen for subscription requests from other users and automatically accept them. Now you are going to further enhance the bot with additional functionality and commands as you proceed through part two of the tutorial. Read more โ
Whilst Node.js is primarily aimed at creating non-blocking servers it can also be used to host simple web pages such as homepages and blogs. We are going to be using a simple web framework for Node.js called Express (http://expressjs.com), which can be installed via the Node Package Manager on the command line. npm install express Firstly, create a new file called server.js and begin by instantiating the express framework. var app = require("express"). Read more โ
With Node.js yet to reach a major release you may be wondering if it is mature enough for production environments and live projects. Whilst it is also true, in the past, that the Node.js creators have warned off people with mission critical objectives it is now in a much more stable state. Some well known companies including Plurk, LinkedIn and GitHub are using Node.js to deliver vital parts of their offerings everyday. Read more โ
Jabber was originally invented by Jeremie Miller in 1998 who was sick of using many different closed protocol instant messenger clients. To begin fixing this situation he created jabberd as an open source server in 1999 and by May of the next year version 1.0 was released. Over the course of the last twelve or so years Jabber has evolved into a standards organisation (XMPP Standards Foundation) and developed an open industry standard for instant messaging called the Extensible Messaging and Presence Protocol (XMPP). Read more โ