Archive for July, 2013

31 July, 2013 — Development

Bootstrap 3 – Release Candidate 1

For all you developers out there – you might want to head over to the new Bootstrap website. Where they have just realised Bootstrap 3 Release Candidate 1! There seems to be some significant changed to the new Bootstrap 3 these are outlined below.

New Domain

Bootstrap 3 see’s a new domain name. The old http://twitter.github.io/bootstrap/‎ has been removed and now replaced with an easier and simple domain http://getbootstrap.com

New UI

Looking through the Bootstrap 3 RC1 it would appear the there has been some major overhaul’s in the UI front – gone are the 3D drop shadow UI elements. Instead been replaced with a newer more modern flat UI with clean pastel colours.

In a blog post, posted by Bootstrap they said the following

With over ~1,600 commits, ~72,000 additions/deletions, and ~300 files changed, everything has changed. We’ve added features, removed features, and cleaned up a lot more. The v3 pull request on GitHub has all the details you’ll need for a complete list of changes and some helpful migration tips.

Download & Test

Why not head over to the new Bootstrap website and download RC1 and give it a go.

24 July, 2013 — Development, Snippets

Simple PHP MySQL Database Class

Update: Now available on GitHub here. Please commit improvements.

A while back now I decided to dive into OOP (Object-oriented programming) in PHP. Until then I had not really had any experience with OOP as functional PHP did the job just fine for me at the time. Now I have had some time getting to know OOP I realised why so many people now use it!

The first thing I wanted to learn was the basics and like with 90% of my projects this would involve a mySQL database connection and queries. That was where I began. Reading about the PDO class (a database package included in PHP) I quickly understood that using the class command “extends” I could write my own class to simplify my database interaction process.

Download

Click here to download my mySQL database class. (Note: this class can be adjusted for other database types)

The Usage

Like with any class we need to initialize the class and assign it to a variable.

$database = new Database();

Then we can do any of the following…

Simple Insert Query
Simply insert records to a table.

// Simple Insert Query
$database->query('INSERT INTO mytable (FName, LName, Age, Gender) VALUES (:fname, :lname, :age, :gender)');

// Bind the data
$database->bind(':fname', 'John');
$database->bind(':lname', 'Smith');
$database->bind(':age', '24');
$database->bind(':gender', 'male');

$database->execute();

Insert Multiple Records using a Transaction
You can insert multiple records using the transaction function. This allows you to run 1 query and multiple binds to insert a lot of rows at once.

// Begin the Transaction.
$database->beginTransaction();

// Query
$database->query('INSERT INTO mytable (FName, LName, Age, Gender) VALUES (:fname, :lname, :age, :gender)');

// Bind the Data
$database->bind(':fname', 'Jenny');
$database->bind(':lname', 'Smith');
$database->bind(':age', '23');
$database->bind(':gender', 'female');

// Execute that data
$database->execute();

// Bind the next set of data
$database->bind(':fname', 'Jilly');
$database->bind(':lname', 'Smith');
$database->bind(':age', '25');
$database->bind(':gender', 'female');

// Execute that data
$database->execute();

// End the transaction
$database->endTransaction();

Get Last Insert ID
Simple – Get the ID of the last record inserted.

echo $database->lastInsertId();

Select a Single Row
Select just a single row of data from a table.

// Query
$database->query('SELECT FName, LName, Age, Gender FROM mytable WHERE FName = :fname');

// Bind data
$database->bind(':fname', 'Jenny');

// Next we run the single method and save it into the variable $row.
$row = $database->single();

echo "
";
print_r($row);
echo "
";

Select Multiple Rows
Get a selection of rows from a table and add them to an array ready to be processed using foreach().

// Query
$database->query('SELECT FName, LName, Age, Gender FROM mytable WHERE LName = :lname');

// Bind data
$database->bind(':lname', 'Smith');

// Run the resultSet method and save it into the $rows variable.
$rows = $database->resultset();

echo "
";
print_r($rows);
echo "
";

Count Rows

// Display the number of records returned
echo $database->rowCount();

I hope you find this script useful. Please comment if you have any questions or found this useful.

Photo by: Chris Hsia

12 July, 2013 — Life

Scuba Diving Adventure

For people who don’t know, I am into scuba diving in quite a big way. So much so a few weeks ago I decided it was time for a change. A big step in the diving adventure is the adventure into a pro diver. After researching around the internet and finding 2 countries that fell into my budget I forced myself to pick one of the 2 countries.

After looking around the internet for other people who had done the same. I just couldn’t find anything with the information about what it was like to actually do a divemaster course abroad. So this is where I thought – well if no one else has done it, I will.

That was when Dive Adventures was born. This blog is where I will be documenting my course from start to finish. Planning, travelling, doing the course, and after the course. Obviously while I am away this blog will not be getting much attention so why not follow me on my adventure across at Dive Adventures until I return!

By the way! I am not going for another month yet! I will still be posting until then – when I finally go I will make sure to put a post on here to make sure you all know.

Keep Blogging!

12 July, 2013 — Life

WordPress 2013 Survey

The WordPress 2013 survey is now available. If you use WordPress for anything, from development to blogging go do it.

The yearly survey is extremely helpful the future of WordPress, it helps the WordPress developers know what the users want, how they feel and how WordPress is been used in different parts of life.

So, what are you waiting for it only takes less than 5 minutes! Go do it!

12 July, 2013 — WordPress

WP Daily – Back Online! Well For Now

Say what? Are you confused? I am.

It would appear WP Daily is back online – well for now anyway. The website appeared back online a few hours ago and John Saddington, WP Dailys editor posted the following:

There has been much thought and feedback over the last day about what will happen to WP Daily. Please know that we have a plan in place! We are going to put the site back online for archiving purposes for the community.

Please know that there will be other announcements in the very near future about the long-term plan for WP Daily, but until then all editorial will be halted and no new posts shall be published.

Thank you for your patience and we’re very excited about the future of not only this site but the great content and legacy that’s been created. Again, we couldn’t have done it without your help.

Stay tuned!

Who know’s that they have planned for the website now? Maybe a sale? I guess we just have to wait and see.

11 July, 2013 — Tech, WordPress

WP Daily – Says Goodbye

Today is a sad day for many WordPress fans – as quickly as it came it was gone. WP Daily yesterday evening closed its doors displaying this message to its users.

  • COLLABORATION, NOT COMPETITION
  • COMMUNITY, NOT AGENDAS
  • FRIENDSHIP, NOT FORMALITY
  • PEOPLE, NOT PERSONALITIES
  • PARTICIPATION, NOT OBSERVATION

This sure is a sad day for everyone who loved and used WP Daily – well daily! A press relese on there company blog stated:

It was a great run, to be sure.

We achieved every single goal and metric that we had set out to accomplish (and then some) in this glorious experiment and so we consider it a “success.” But, it did not achieve the much larger global goals and strategy of our organization at this present time.

Consequently, we’ve pulled the plug. A huge-mega-super shoutout to all of our supporters, readers, and financial partners who made it a success – we could not have done it without you!

Let us know if you have any questions.

What will be the next project for 8bit? Who knows…