PHP Coding Academy: Build an online calendar

Code

In the last tutorial, we covered the basics of PHP, including how the language was created and subsequently grew. We were also introduced to various parts of the language, such as variables, strings, integers and PHP’s internal date() function. In this tutorial, we’ll expand on those parts, but we’ll also introduce the concept of arrays and functions to make a fully working calendar.

PHP Coding Academy: write your first script

Code

You might already know that TuxRadar hosts the Practical PHP Programming guide. But we wanted to do something for beginners. So here it is. The first part in a series that will take you from neophyte to professional in baby steps. Let us know what you think!

PHP dates back to 1995 when its creator, Rasmus Lerdorf, began work on a scripting toolset dubbed Personal Home Page (PHP). The sudden demand for the toolset spurred Rasmus to further develop the language and, in 1997, version 2.0 was released with a number of enhancements and improvements from programmers worldwide. The version 2.0 release was hugely popular and spurred a team of core developers to join Rasmus in developing the language even further.

Peg Solitaire

Code

Jon says:

This is the latest in my project to re-implement many of Simon Tatham's Portable Puzzle Collection in Javascript.

I've hopefully taken on board some of the comments made previously, particularly about not polluting the global namespace. I don't think it's particularly elegant code - far too many nested ifs - but it works.

Fifteen Puzzle

Code

Jon says:

I've been doing more programming, and wanted to share my latest project with TuxRadar readers (if only because everyone else is tired of listening!). It's a simple implementation of the 'Fifteen' puzzle in Javascript and HTML5 canvas. You can check it out here, so if you want to try it, go ahead. Feedback and comments are welcome, especially about the quality of my code (I expect it's low quality, so be constructive!).

Douglas Adams, Designing Programs and Scheme

Code

Jon says:

While procrastinating and looking in to some programming books, I came across this quote by Douglas Adams:

"I am rarely happier than when spending entire day programming my computer to perform automatically a task that it would otherwise take me a good ten seconds to do by hand."

I enjoyed it a lot and thought TuxRadar readers might enjoy it too.

Also, I wanted to share a link to the programming book that led me to this discovery: How To Design Programs. It's an excellent book that doesn't focus on the syntax of any one language (although it does intuitively teach you Scheme, a dialect of Lisp), but instead explores the process involved in actually beginning from scratch and designing a complete program. From analysing the problem statement, to defining the data involved, sketching out functions to deal with the data and on.

CakePHP Tutorial: Build a bookmark site

Code

If you've followed our last few tutorials, you'll be a CakePHP expert by now: you know how to navigate controllers, delve into the depths of models and create views that astound your viewers. But having a taste of the sweet rapid development that CakePHP offers you, you want more, and you want to do more in less time. Fair enough too, so in our last project for this series, we're going to take a look at using CakePHP plugins to extend the functionality of our app. This is the result of the DRY principle (Don't repeat yourself).

Project Euler

Code

Jon Roberts says:

I thought those who read TuxRadar might be interested in Project Euler. It's an old project, but a cool one for people like me - that is, those who dabble in programming and maths and are looking for a set of challenges to help them develop further.

From the website:

CakePHP Tutorial: Build a file sharing application

Code

The honeymoon is over baby. Now it’s time for the real work to begin. This iteration of our CakePHP tutorial series will result in your very own file-sharing tool. This is handy in the situation that you have a file you need to send to a business partner or client, or share with a friend, but you still want to retain control over who gets access to each specific file. For example, you may only want a client to access a file for a week, so we’ll build a system where you can remove that access at any time. What’s more, it’ll be quick, easy, and extensible once we’re done.

CakePHP Tutorial: Storage, Baking and Slugs

Code

In the previous article we built a movie database that enabled you to store all your movies in various formats, and showed the basics of getting a CakePHP project off the ground. This time around the block we’re going to use some of the same approaches to build a more complicated application that involves more models for data storage, and demonstrates the associations between models and just how darn easy it is.

CakePHP Tutorial: Build Web Apps Faster

Code

The pressure is on. You’ve got limited time, and you need a system to catalogue your extensive movie collection in 15 minutes. Who ya gonna call? CakePHP of course! CakePHP is a rapid application development framework that covers all the common tasks required to get a web application up and running. Handling all the repetitive tasks means you have more time for coffee, games, or whatever else you’d rather be doing. This introductory article will guide you through the creation of a media library application to record what movies you have.

Code Project: build a PyGTK language translator

Code

Once you understand the basics of PyGTK, you can make some neat apps just by drawing upon some of the incredible APIs that are available from well-known companies such as Facebook, Twitter and Yahoo. In this video tutorial you'll learn how to work with Google's Translate API, which can translate a huge range of languages on the fly, then back up your knowledge with a simple PyGTK user interface that puts a pretty face on it all.

Code Project: build a PyGTK RSS reader

Code

As we saw in part one of this video series, Python makes it easy to create GTK apps. Well, it turns out that Python also makes it easy to read XML from the web, which means we can make something like an RSS reader in no time at all. In this video tutorial you'll learn how to work with XML, using RSS as an example, while also learning how GTK handles data in multi-line text fields and combo boxes.

This tutorial is dedicated to Evan, who donated at least $50 to support free software - if you want to see more video tutorials like this one, all you have to do is donate to support the Libre Graphics Meeting. Easy!

Python + PyGTK + WebKit in 20 minutes

Code

In season 2 episode 7 of our podcast we laid down the simple challenge for each of the four podcasters - Andrew, Graham, Paul and Mike - to produce something original for the website. Paul - eager to show the world how much he, er, loves Python - has now finished his entry, and you'll find it below: a video talking you through how to get started with Python, PyGTK and WebKit. It's easier than you think!

Code Project: create an animated RSS reader with Clutter

Code

In a previous tutorial we had a look at the basics of Clutter as we used it to build a network speed monitor. This time we'll be looking at some of the very powerful animation techniques used in Clutter, how to group objects, and a little more about text actors. We will be doing this in the guise of implementing a feed reader. There isn't enough space for us to implement a complete multi-stream reader and explore the animations, but we will be covering enough ground to get you started on building such a beast, including fetching the data from the feed and applying it to the Clutter objects.

For those of you who haven't been tempted by one of these magnificent Python tutorials before, we usually try to do as much as possible in the interactive mode of Python first. It is a kinder, gentler environment than the normal mode in which programs are run, as you can type things in and experiment. The code listings in these cases include the Python prompt >>> at the beginning of the line when you have something to type in, and without it when the environment is giving you some feedback, just as it appears on screen.

(NB: don't miss our collection of free Python tutorials, and you can also try your hand at our Clutter beginners tutorial for C programmers if you're feeling adventurous!)

The newbie's guide to hacking the Linux kernel

Code

You don't need a PhD in computer science and years of experience to hack the kernel. Sure, they help, but the nature of Linux development means that it's open to all by default. All you have to do is get stuck in. You use the Linux kernel in whatever shape or form every day; wouldn't you feel just the tiniest swell of pride if you'd helped work on it, no matter in how small a way?

We asked prolific kernel hacker (and Linux Format reader!) Greg Kroah-Hartman to tell us what it takes for newbies to patch the Linux kernel - here's what he had to say...

(PS: you might find our earlier article, How the Linux kernel works, a helpful primer to this tutorial)

Code Project: monitor /proc with Python and Clutter

Code

If you already read our beginner's guide to the Clutter toolkit and wished it were available in something other than C, then good news: we're putting together a tutorial series covering PyClutter, the Python binding to Clutter, which merges all the power and beauty of the Clutter toolkit with the simplicity and brevity of Python.

So, let's start with a simple project to get things going: you're going to produce a network monitor that monitors data transfer and displays it all on the screen using Clutter. It's nice and easy, but we're going to be adding more involved PyClutter tutorials in the coming months, so you should get started while the learning curve is shallow!

Arduino hardware hacking: Part 3

Code

In our previous two tutorials (see here and here), we created a Simon-type game using the Arduino, a hardware platform for simple, and not so simple, electronics projects.

We placed three buttons and three LEDs on to something called a breadboard, and wrote a small program that would send a random sequence to the LEDs, which the player would then need to replicate by pressing the buttons in the same order. Each time you got the sequence correct, the sequence would be extended by one and repeated. The further into the random sequence you got, the higher you scored.

In this, part three, we're going to build on what we already created and add another important feature - sound! So, get the hardware out, make some coffee, and prepare for some hardware hacking fun...

Now available: Hudzilla Coding Academy in print!

Code

If you've been following the Hudzilla Coding Academy - our free Mono and C# tutorial series - you'll be pleased to know that it's now available as a special edition magazine, on-sale worldwide and available online.

The magazine version includes another six all-new projects (taking the total to 15), many corrections to the original online text, plus dozens of new tips that take your knowledge further. So, if you're looking to learn to program and aren't sure where to start, Paul Hudson's Coding Academy takes you from zero to hero with minimum theory with maximum fun.

On the included DVD you'll find all the software you need to get started, pre-configured with all the source code from the projects in the magazine. In short, it's all you need to get started and take control of your computer today.

Click the Buy Online button below to buy the magazine now wherever you are in the world, or click here to see what's inside the magazine.

 

Code Project: upload pictures to Flickr with Python

Code

Python is a great way to make apps quickly, and what better source of data is there than the world wide web? We've already shown you how to control Digg with Python and how to create a Twitter bot in Python, and now we turn our beady eyes towards Flickr, the home of more cat photos than I Can Haz Cheezburger knows what to do with. If you want to try your hand at uploading photos to Flickr, while learning just a smidge of PyGTK along the way, this project is for you.

If you're desperate for even more things to code, don't forget our complete code projects archive is waiting for you...

Username:   Password: