How-to: Using WhatsApp on a Windows PC

TelegramUPDATE 2: WhatsApp has finally bowed to pressure and created a web interface for desktop usage.

UPDATE: We’ve been blown away recently by new-instant-messenger-on-the-block, Telegram. Unlike WhatsApp, it’s free forever. It’s more secure than WhatsApp, it has desktop apps, chats are synchronised across all devices (at least the normal chats not marked as “secret” anyway) and best of all, it’s not owned by Facebook. Find out more here.

WhatsApp logoWow, so this is a popular search on Google! And sadly, most of the results you find are riddled with either viruses, bad advice or broken English.

As you almost certainly know if you’ve found this page, WhatsApp is a massively popular (over 7 million downloads on Android alone) app for instant messaging. Its distinguishing feature is that it relies on a user’s mobile phone number, rather than any dedicated username/password combination. The idea is that you use it as a drop-in replacement for SMS and MMS messaging. You can also use it instead of your favourite instant messaging client, on the basis that almost everyone has a mobile phone number these days.

Linking the product to a mobile phone number is also one of this product’s weaknesses – you may want to use WhatsApp from your desktop PC or laptop, but WhatsApp doesn’t provide PC (or Mac) software. The good news is that it can be done! The bad news is this process depends on you having a Google account – sorry, Apple/iOS users. The REALLY bad news is that you can’t link a single mobile phone number on two different devices. Because WhatsApp associates to a mobile phone number, this means that you can’t synchronise your chats across more than one device. If you try to link two different devices to the same mobile number, one of the devices will disconnect and you’ll be greeted with the following message:

I don't want to reverify!
I don’t want to reverify!

So this piece of information can’t be stressed enough: you can’t run WhatsApp in two places simultaneously using the same mobile phone number. If you want the convenience of being able to input messages via your computer, you need to look at some form of remote control program for your mobile device (VNC, for example). That’s beyond the scope of this How-to.

The remainder of this guide assumes you’re going to be associating your mobile phone number to WhatsApp and using it only on your PC. If that’s what you want to do – good news! It’s entirely possible.

BlueStacks Android Emulator

The easiest way to get started is to install the BlueStacks Android emulator. BlueStacks is in beta at the moment and free to use. We imagine this will change at some point in the future. There will still be other possibilities, but one of the beauties of BlueStacks is its simplicity.

It’s worth mentioning at this point that whenever you’re going to emulate one operating system on another, you’re well advised to ensure your computer is up to the job. I’m using an Acer Veriton M6610G which is more than up to the job. (It has since been replaced with the M6630G series – very competent and expandable PCs.)

Visit the BlueStacks web site and download and install the emulator. We’re doing this on a Windows PC, but I suspect it would also work on a Mac. (Any Mac users out there that have an Android phone? I suppose it could happen…)

During the installation, you’ll be presented with a set of three options – App store access, App Notifications, and Spotlight. I’d suggest you only select the first of these. The installation can take a fair few minutes.

BlueStacks options

If you’re prompted to update your graphics drivers, you’ll need to allow this, for BlueStacks to run. As always, make sure System Restore is working, in case something goes wrong when installing the drivers.

Set up BlueStacks

When you first load BlueStacks, you’ll be taken though a setup wizard. Click “Continue”:

BlueStacks setup step 01

You need to connect BlueStacks to a Google Account for two reasons: first, to download the app from the Google Play Store. Secondly, so you have access to your address book. It’s best to link BlueStacks to an existing Google account, so you have the benefit of your Google address book. Choose “Existing”:

BlueStacks setup step 02

Enter your Google credentials and click “Sign in”:

BlueStacks setup step 03

If, like me, you use Google’s two-factor authentication, you’ll now be taken through a web-based login process (still within the BlueStacks emulator). Click “Next”:

BlueStacks setup step 04

Re-enter your credentials and click “Sign in”:

BlueStacks setup step 05

Again, this is only if you’ve enabled two-factor authentication (which you should, by the way). A code will be sent to your mobile phone number. Enter it here and click “Verify”:

BlueStacks setup step 06

The “Back up and restore” section – what you choose here is up to you. Click “Next”:

BlueStacks setup step 07

You’ll be taken back to the BlueStacks wizard. Click “Continue”:

BlueStacks setup step 08

Re-enter your Google account details (yawn):

BlueStacks setup step 09

Do you want your password to be remembered? Your choice:

BlueStacks setup step 10

Again, leap through the two-step verification hoop if it applies to you:

BlueStacks setup step 11

The Google Play store will now be available. Click “Let’s go!”:

BlueStacks setup step 12

Finally, accept the Terms of Service. I suggest leaving the “opt-in” unchecked:

BlueStacks setup step 13

Installing WhatsApp

Immediately after setting up BlueStacks, you’ll be taken to the Play Store:

Install WhatsApp step 01

From there, search for WhatsApp:

Install WhatsApp step 02

Click “Install”:

Install WhatsApp step 03

Accept the permissions:

Install WhatsApp step 04

WhatsApp will now install:

Install WhatsApp step 05

Once installed, click “Open”:

Install WhatsApp step 06

Agree to the WhatsApp terms:

Install WhatsApp step 07

Enter the mobile number that you’re going to link to this installation of WhatsApp (remember, one mobile phone number per device) and click “OK”:

Install WhatsApp step 08

Double-check and click “OK”:

Install WhatsApp step 09

WhatsApp tries to send and detect an SMS. The SMS message will go to your phone of course, not BlueStacks, so this detection will fail (you’ll need to wait for this):

Install WhatsApp step 10

Instead, click “Call me” and be ready to enter the verification code:

Install WhatsApp step 11

An automated message will tell you the code you need to enter into WhatsApp on BlueStacks:

Install WhatsApp step 12

Verify your profile:

Install WhatsApp step 13

WhatsApp will spend some time initialising:

Install WhatsApp step 14

Once it’s done, the “Continue” button appears. Click it:

Install WhatsApp step 15

That’s it; you’re in. From now on, you can run WhatsApp from the Home screen:

Run WhatsApp from Home screen

You should see your list of contacts from your Google address book:

Browse contacts

If you have any chat history from using WhatsApp on a different device, this will not be pulled across to BlueStacks – history is not saved on WhatsApps’ servers.

So there we are; it has its limitations, but if you’re happy to use WhatsApp on your computer instead of your phone or tablet, this is probably the easiest way to do it. Having said that, I will personally carry on using WhatsApp on my Galaxy Note phone or tablet, both of which I’m more likely to have with me than my computer!

Review: Geek’s top 5 Christmas tech gifts for 2013

As you know, Dummy and I are constantly on the lookout for good-value, great gadgets. Are you stuck for gift ideas for the tech-lover in your life? Look no further. Dummy has already offered you his “top five” list; here’s mine.

Network-enabled media streamer: Roku LT

Roku LTI’ve yet to review this device, but I bought one earlier this year, when Roku discounted them from £50 to £35. They’re not quite that cheap now (up to £45), but they’re still great value, very competent devices.

Roku’s set-top boxes appeal to me, because rather than buying one of those super-expensive “smart TVs” (like Dummy did), instead for a relatively trivial sum, you can upgrade virtually any television with this small, unimposing gizmo. There are a few different media streamers in the series, but this bottom-of-the-range LT was more than sufficient for my needs – to stream media (from a wireless network connection) to a 32 inch television. The LT offers 720p HD video and has a super-low power consumption profile.

The idea is that you add various different “channels” from Roku’s huge library, which includes iPlayer, Demand 5, 4oD, Plex, Netflix and a host of others. The LT’s big brother, the 3, has more tricks up its sleeve, like a wired ethernet port, USB in, headphone socket on the remote (genius!) and games. I needed none of those though and have been absolutely delighted with the LT.

If Roku doesn’t quite float your boat, you might want to consider an Apple TV. More expensive, feature-for-feature, but simple to use and well-appreciated by all its owners.

Low-cost hobby PC: Raspberry Pi

Raspberry Pi model B rev 1As you might have noticed, we’re real fans of this British innovation. You are more or less limited only by your imagination. People are using Pis to run media centres, provide home surveillance, as a web server, for time-lapse photography, as a custom games console, and on and on. Prices start from about £24 for the model A, but I recommend starting with the B for the best experience.

Great value tablet: Nexus 7

Google Nexus 7This is a close call. There are more and more tablets on the market these days and the quality is increasing as manufacturers weed out early production problems. You won’t get anything that I’d call “great value” from Apple or Microsoft, so that leaves us with the Android platform. And wow, there’s an awful lot of choice now.

I’m torn on this one. Amazon is pushing out better and better Kindles at keener and keener prices. The Kindle Fire HD is a serious contender for this top 5 list – £120 now; that’s a bargain. But ultimately, the fact that the Nexus 7 doesn’t need to be hacked (“rooted”) to get the best from it means that this tablet is the better choice in my opinion. You can pick one up for under £200 and I don’t think anyone could be disappointed to find one of these in his or her stocking.

Portable Bluetooth speaker: Soundwave SW100

Soundwave SW100I’ve had more than six months with this speaker that I reviewed back in May this year. I just can’t fault it. Great at what it does and a real steal at £20.

Budget Android phone: Huawei Ascend Y300

Huawei Ascend Y300In an extremely saturated market, it’s really hard for one phone to stand out from amongst the crowd. If we’re going to continue the theme of great value for money though, I think you can’t go wrong with the Ascend Y300 from rising star Huawei. Under a hundred quid. It’ll do the job. And if you’re buying for someone who’s a little accident prone, better this than a four hundred quid Galaxy S4 (which is a really great phone by the way, but expensive).

Review: Bluetooth OBDII OBD2 Diagnostic Scanner

DUMMY: I’d been excited about doing this review for quite some time but describing delivery of this item from China as “slow” and “a bit dodgy” is an understatement. Now it has at last arrived though, I can say it massively exceeded my expectations.P1010932

GEEK: It was one of those occasions where the seller pretends to have “UK stock”, but quotes a 30 day delivery time… And then the package turns up with a customs declaration, describing the item as a “gift”. Not to mention the hassle associated with returns, should the unit prove to be faulty. So it pretty much goes without saying that we would only advocate buying from abroad for low-cost, low-urgency items like this. All that said, Dummy is right: great piece of kit, for buttons.

DUMMY: Let’s wind this back a stage. Virtually every modern vehicle – even my Land Rover Defender – comes equipped with an OBD-II (On-Board Diagnostics) port. 2013-11-08 13.19.22Similarly these vehicles are fitted with an ECU (Electronic Control Unit) and this little computer will be monitoring hundreds, if not thousands of events that are going on in your vehicle every millisecond. The OBD port is like a network cable into that information and the OBD Bluetooth Diagnostic Scanner is the device that can take that information and send it to a program where it can be processed.

GEEK: He almost sounds like he knows what he’s talking about doesn’t he?

DUMMY: [ignores Geek] Sounding complicated? It really isn’t. You find an app that works with the scanner, you plug the scanner in, you start your engine and hey presto, an immediate window to the soul of your car.

GEEK: There are a few apps out there that will translate this information into a variety of user-friendly dials and displays. At the moment, for Bluetooth adapters like the one we’re reviewing, you’re basically restricted to Android or PC devices. Apple is extremely fussy about what it will allow to connect via Bluetooth. Yet another reason to see the light and throw your iDevices in the bin.

DUMMY: You just can’t pass up an opportunity can you?!
If I’m honest, my boy racer days are behind me. Although I was mildly interested in seeing live BHP calculations and how many G’s I was pulling, the main attraction of this device to me are the diagnostics. Select the right app and it is simplicity itself to interrogate the ECU to find out how your car is feeling. Not just viewing and interpreting fault codes, but also resetting those codes as required. Yes that’s right, that job for which your dealer or local garage charges you £40 a pop, you can now do for yourself and all your friends and family for £6 – for life.

GEEK: Ha – middle-aged much?! We’ve looked at some interesting devices this year, expensive and cheap. Of them all, without doubt this has to be the simplest and most cost effective purchase of the year.

DUMMY: Ha – skinflint much? It’s a real shame that this is no use for Apple devices, in its cheaper Bluetooth form. Looks like this Apple fanboy is going to have to hand the best bit of equipment we have bought this year straight to Geek.

GEEK: Rest assured, if we can work out an easy way of making it work with iOS, we’ll be all over that. Watch this space! In the meantime, the Android apps we used in our tests were aLapRecorder HD (which unfortunately appears to have been abandoned by its developer), Carista OBD2 (free) and Torque Pro (not free, but excellent).

DUMMY: Anyway, enough chat. Here is a little road test we did together of this brilliant little device. I apologise in advance for Geek’s driving!!

[easyreview title=”Consensus” icon=”collab” cat1title=”Ease of use” cat1detail=”Couldn’t be any easier, no really.” cat1rating=”4.5″ cat2title=”Features” cat2detail=”Its feature is communciating via Bluetooth which is does faultlessly. The clever stuff happens in the software it connects to.” cat2rating=”4″ cat3title=”Value for money” cat3detail=”Can’t be beaten. Full stop.” cat3rating=”5″ cat4title=”Build Quality” cat4detail=”Feels substantial. We certainly don’t pick it up and think it’s cheap.” cat4rating=”4.5″ summary=”We can’t tell you how delighted we are with this purchase – and the price delights most of all!”]

Review: JOYO JA-03 Guitar Headphone Amplifier

A couple of weeks ago, I picked up an ESP LTD F-155DX 5 string electric bass guitar. It was slightly bashed, but otherwise in great condition – in short, at only £200, a bargain. I love bargains.

There’s one small problem with electric instruments: they need amplification. And amplification can sometimes be a little… antisocial. In order to keep relations with Mrs Geek reasonably harmonious, I started looking around for a solution.

One of the problems was that I didn’t know exactly what I needed. In the past, I’ve come across micro amps, which have a built-in speaker but I wanted something even more compact, that could just drive a pair of headphones.

Eventually I stumbled across the well-reviewed Vox AmPlugs. Plug the device into the guitar, put your headphones into that, simple. At £32 though, I wondered if there might be something a bit cheaper. Since this was just going to be for quick practice sessions, I didn’t need the best that money can buy.

JOYO JA-03 guitar headphone ampCasting my net slightly wider, I came across the JOYO JA-03 series of headphone amps. They look suspiciously like a clone of the AmPlug, but who knows, perhaps they’re made under licence. Anyway, the important point: they’re just a tenner. Sold!

There are a few different amps in the range, with different sounds – tube, metal and so on (see the full range on JOYO’s website). I plumped for “Acoustic“. I’d read good things about the sound of the ESP bass, so I wanted to hear it as clean as possible – and this better suits the style of music I’m going to be playing, anyway (i.e. not heavy metal).

JOYO JA-03 Acoustic in blister packThe amp arrived very quickly, well packaged in its blister pack. Happily this was the type of blister pack that is not sealed shut, so you can open it without having to cut the pack. Fewer blister-pack-related injuries – yay!

The JA-03 is powered by a pair of AAA batteries. Happily, the amp came with fresh batteries in the pack, so you’re good to go straight away.

There’s not a lot to the device. The standard quarter inch jack is built in (no need for a separate lead – you plug it straight into your guitar). It has a 3.5mm socket for headphones and another 3.5mm socket for an auxiliary/line input. In this way, you can feed music through the amp and play along.

JOYO JA-03 controlsYou get four controls: gain, tone, volume and power. The volume control affects the level of the input from your instrument. I expected the gain control would alter the volume of the auxiliary input, but not so. It’s hard to describe what this does – it doesn’t change the overall volume of any input; instead it makes it sound more like you’re playing through an amplifier. If you crank the gain control all the way up, you hear that characteristic hiss and the sound from your instrument is more like it is being played through a compressor – a little “thin”. I found I had the cleanest sound with gain turned right down.

The volume of the auxiliary input is not controlled by the JA-03. I plugged in my phone using a 3.5mm cable and then set the volume of the music on my phone. Using my phone’s volume control and the the volume mixer on the amp, I was able to find a perfect balance between the music I was playing and the output of the bass, very easily.

Skipping over the power control (which I trust requires no further comment!) the remaining control is the tone dial. This is a pretty low grade adjustment. I didn’t like the effect it had on the sound of my bass, so I left it in the neutral centre position.

With the mix right and all the tone adjustment coming from the excellent active pickup set on the ESP bass, I was frankly blown away. Not by my playing, I hasten to add, but by the convenience of the set up and the great sound I achieved through some fairly cheap and nasty in-ear headphones. For practice purposes, this is all you need.

I went one step further though, and connected the output of the JA-03 to my humble home stereo. With tunes coming from my phone, it was a joy to play along in my living room and Mrs Geek didn’t seem to mind at all. In fact the 9 year old twin junior Geeks loved the show (I know, the “hero worship” bubble will burst soon enough – let me have my moment of glory).

If you’re very fussy about the quality of your audio, you might want to look for something built with more expensive circuitry, but honestly at this price, you cannot beat this. Highly recommended. Pick one up from Amazon (or somewhere else if you prefer), today!

At the time of writing, the JA-03 can be yours for just £9.49.

[easyreview title=”Geek rating” icon=”geek” cat1title=”Ease of use” cat1detail=”Very, very straightforward.” cat1rating=”5″ cat2title=”Features” cat2detail=”It’s hard to think of anything else I’d add – maybe a distortion effect? But that’s just me being greedy.” cat2rating=”4.5″ cat3title=”Value for money” cat3detail=”Can’t be beaten. Full stop.” cat3rating=”5″ cat4title=”Build Quality” cat4detail=”Feels like it’s made from slightly brittle plastic. Not sure how well it would survive a serious bash in a soft case. Made from cheap materials as you’d expect at this price point. Otherwise it’s assembled well enough and feels solid.” cat4rating=”3.5″ summary=”I can’t tell you how delighted I am with this purchase – and the price delights most of all!”]

How-to: Overcome “critical temperature” problem with CloneZilla

processor fireIn case you don’t know, Clonezilla is an excellent (and free) disk/partition imaging tool. It’s essentially a customised Linux distribution. You boot from a CD and then follow a text-mode wizard to backup or restore images of hard drives or other storage devices. You can see the process in action in my Raspberry Pi SD card backup/restore article.

The process can be quite intensive for hard drives and processors. One of the things Clonezilla does is compresses the image of the drive to save space wherever you’re storing the image. Compressing a 2GB file is a big job for an older processor. I was finding with one of my older laptops that the processor was working so hard, it caused the temperature to rise at a point where it triggered a Linux “panic”. The system immediately halted with an error message about “critical temperature”, half way through making an image. So of course that image is not usable.

What’s supposed to happen in normal usage is that when the temperature rises dangerously, the operating system slows down the processor. This allows the machine to cool down (at the obvious expense of a performance penalty). I’m not sure if this is fixed in later versions of Clonezilla – there’s some talk of it in the mailing lists. I’m indebted to those mailing lists for some parts of workaround that follows.

One thing you can try is using the i486 version of Clonezilla. This assumes older processor hardware and so (I suspect) doesn’t make full use of your processor’s theoretical potential. Just select i486 architecture from the download page for the latest stable version.

As a belt-and-braces approach (and this is the method I’ve adopted), you can also issue commands that tell the Linux kernel to run the processor at a particular frequency. In my case, I’m telling an Intel Core i3-330M to run at 1.6GHz instead of the usual 2.13GHz.

You can do this as follows:

  1. Once you’re in the Clonezilla wizard, press Alt-F2, to access a login shell.
  2. Issue the command cpufreq-info. In my case, I saw the following, as well as some other information:
    analyzing CPU 0:
      driver: acpi-cpufreq
      CPUs which run at the same hardware frequency: 0
      CPUs which need to have their frequency coordinated by software: 0
      maximum transition latency: 10.0 us.
      hardware limits: 933 MHz - 2.13 GHz
      available frequency steps: 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz, 1.47GHz, 1.33GHz, 1.20 GHz, 1.07 GHz, 933 MHz
    ...

    You may see more than one CPU listed – mine shows just the one (single CPU, dual core). Most importantly, this lists the frequencies to which you can set your processor clock.
  3. Pick a frequency from the list that’s lower than the maximum. E.g., if the list shows that the processor can run at a lower speed of 1.60 GHz, set the clock speed as follows:
    sudo cpufreq-set -c 0 -f 1.60GHz
    The -c 0 parameter refers to the CPU number, starting from 0. Repeat the command, changing this number, for each CPU.
  4. Press Alt-F1 to return to the Clonezilla wizard and continue with the cloning process.

This approach sets the clock speed just for this particular session, so normal service will be resumed upon reboot.

If this all sounds like too much hard work, you could try one of the good commercial solutions instead, such as Norton Ghost or Acronis True Image.

Burning processor image copyright © mhamzahkhan, licensed under Creative Commons. Used with permission.

How-to: Raspberry Pi tutorial part 3: Web & file hosting with Webmin & Virtualmin

[easyreview title=”Complexity rating” icon=”geek” cat1title=”Level of experience required, to follow this how-to.” cat1detail=”You’ll need to keep your wits about you!” cat1rating=”4″ overall=”false”]

Contents

Right, so our basic Raspberry Pi is set up and ready to go. You’ve got the Pi, you’ve got the case and you’ve got a decent SD card. What next? How about turning it into a low-powered file server and web host?

To do this, we’re going to install Webmin (a web-based server management application) and Virtualmin (a virtual hosting platform that sits on Webmin). This will leave us with a convenient graphical interface for managing the Pi and a full blown web hosting environment.

Prepare the Pi

I’ll assume for the purposes of this exercise, that we’re picking up from where we left off, from tutorials 1 and 2. That is, you have the Rasbian operating system installed on your Pi, and a backup to revert to if it all goes horribly wrong.

Next step: we need to install a few packages that Webmin and Virtualmin depend on, plus the services we’ll be managing. From a root SSH shell, issue the following commands:

apt-get update
apt-get -y upgrade
apt-get -y install apache2 apache2-suexec-custom libnet-ssleay-perl libauthen-pam-perl libio-pty-perl apt-show-versions samba bind9 webalizer locate mysql-server

Due to the Pi’s limited power, you may find these operations take a while. I’m installing locate for my own convenience – it’s handy for tracking down obscure files on your system. You can install PostgreSQL instead of MySQL if you prefer.

Install Webmin

Webmin-Logo-600

According to the official site:

Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely…

When I install packages that I’ve downloaded (rather than directly through a package manager), I like to keep them in one place, so I can keep track of what’s installed. I’ve formed the habit of keeping these packages in a directory belonging to root. So, to get Webmin, whilst logged in as root:

cd
mkdir installed-packages
cd installed-packages
wget http://prdownloads.sourceforge.net/webadmin/webmin_1.660_all.deb

That last command downloads Webmin’s package. The version number will inevitably change – you can make sure you have the latest version by browsing to the official Webmin website and looking for the “Debian Package” link on the left hand side of the page.

Install Webmin with:

dpkg -i webmin_1.660_all.deb

Again, this is fairly intense for the Pi, so be patient! Once complete, you should be rewarded with a response like:

Webmin install complete. You can now login to https://my-pi:10000/
as root with your root password, or as any user who can use sudo
to run commands as root.

Connect to the relevant page with a web browser, accept the SSL certificate warning and you should see something like the following:

Webmin-Pi

For some reason when I logged in, it wouldn’t accept the root password. Webmin actually tracks the root password separately from the Linux password database. If like me you find you can’t log on as root, you can fix this by running the following command:

/usr/share/webmin/changepass.pl /etc/webmin root [new password]

Configure Apache

Apache logo

Earlier, we installed the apache2-suexec-custom module. This allows us to run Apache websites securely for multiple users, under a directory other than /var/www. Using your favourite text editor, load up the file /etc/apache2/suexec/www-data. Change the first line from /var/www to /home.

Enable some modules that Virtualmin will need, and restart Apache:

a2enmod suexec
a2enmod actions
service apache2 restart

If you see an error message “Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName”, you can safely ignore this. It doesn’t matter, for the correct functioning of Virtualmin.

Install Virtualmin

Virtualmin-hosting-Logo

At the official site, you’ll read:

It is a Webmin module for managing multiple virtual hosts through a single interface, like Plesk or Cpanel. It supports the creation and management of Apache virtual hosts, BIND DNS domains, MySQL databases, and mailboxes and aliases with Sendmail or Postfix. It makes use of the existing Webmin modules for these servers, and so should work with any existing system configuration, rather than needing it’s [sic] own mail server, web server and so on.

You can install Virtualmin from within Webmin. Proceed like this:

  1. Log in to Webmin
  2. From the Virtualmin download page, find the link entitled “Virtualmin module in Webmin format”. Copy the link (it will end in “.wbm.gz”).
  3. In Webmin, go to Webmin–>Webmin Configuration–>Webmin Modules. Select the radio button next to “From ftp or http URL” and paste the link you copied into the field. Then click “Install Module”.
  4. Do the same for the link for the “Virtualmin theme in Webmin format”. You’ll find the necessary link on the Webmin site, called “Virtualmin theme in Webmin format (for FreeBSD, MacOS and Solaris)”. The link will end in “.wbt.gz”, this time.
  5. To activate this theme, go to Webmin–>Webmin Configuration–>Webmin Themes. From the drop-down box, choose “Virtualmin Framed Theme” and click “Change”. Ignore the “Post-Installation Wizard” for now, and hit F5 to refresh your browser and use the Virtualmin theme for Webmin. You should arrive at a screen like this:
    Virtualmin-PIW01
  6. Click Next, to arrive at the “Memory Use” screen. My guess is that for most cases, it would be best to answer “No” here (don’t pre-load Virtualmin). Click Next.
  7. The next choice is database servers. This is up to you, but I switch MySQL on and PostgreSQL off. Click Next.
  8. You’ll see a message “MySQL has been enabled, but cannot be used by Virtualmin. Use the MySQL Database module to fix the problem.”. Click the “MySQL Database” link.
  9. Enter your root username/password combination for MySQL (you will have been asked this when you installed MySQL via apt). After saving this, hit F5 to refresh and return to the Post Installation Wizard.
  10. Proceed through the wizard up to where we left off (just after database server selection).
  11. Leave the MySQL password unchanged and click Next.
  12. I would suggest setting MySQL memory usage to 256M and clicking Next.
  13. In the DNS config screen, check the box “Skip check for resolvability” and click Next.
  14. Set password storage mode to “Store plain-text passwords” and click Next.
  15. At the “All done” screen, click Next. We’re not all done, by the way!
  16. You’re now at the main Virtualmin screen. Click the “Re-check and refresh configuration” button.
    Virtualmin-PIW02
  17. You’ll see a complaint about DNS. Click the link “list of DNS servers”. Enter 127.0.0.1 as the first DNS server, make sure the hostname is a fully qualified domain name and click Save. Then hit F5 to go back to Virtualmin.
  18. Click the “Re-check and refresh configuration” button again.
  19. The next complaint is about email. I’m not planning to use the Pi as an email server, so we can just disable that Virtualmin module. Go to Virtualmin->Systems Settings->Features and Plugins. Uncheck the “Mail for domain” module, slick Save, then hit F5.
  20. If your screen now looks basically like this, you’re good to start hosting websites (using the “Create Virtual Server” link).
    Virtualmin-PIW03

Setting up virtual hosting is a big subject and beyond the scope of this tutorial, but that’s the basic platform in place. Have a read of the official Virtualmin documentation for pointers. If you happen to browse to your Raspberry Pi’s IP address or DNS name, you’ll be rewarded with a very simple test page:

Raspberry web server

Running a file server

With Webmin and Virtualmin up and running, you can now start creating file shares. How you approach this depends a bit on how you want to use the server. Probably (!) this will be a personal/hobby server. In that case, I would suggest creating a new virtual server for each user first. That creates all the initial Virtualmin linkage for hosting websites and databases. Then having done that, you can create a fileshare for the user(s) by browsing to Webmin->Servers->Samba Windows File Sharing.

Again, the specific details are best not discussed here, because there are so many possible different configurations. You are however ready to start customising your file/web server to your heart’s content. So now would be a perfect time to take a snapshot of your Pi, so you have a good restore point.

Happy hosting!

How-to: Raspberry Pi tutorial part 2: SD card backup/restore

[easyreview title=”Complexity rating” icon=”geek” cat1title=”Level of experience required, to follow this how-to.” cat1detail=”This is wizard-driven. Very simple. You’ll need to be able to burn a CD, nothing more taxing than that.” cat1rating=”1″ overall=”false”]

Contents

In my last Raspberry Pi tutorial (the first in this series), I mentioned that we can take a snapshot of the Raspberry Pi’s SD card at any time. This will give us a “restore point”, so we can skip a few installation steps if we want to wipe the Pi and start again. Quite a few Raspberry Pi projects will require that we start with a working installation of Raspbian so that’s the snapshot I’m going to take. You can of course take a snapshot whenever you like. If you’ve honed and polished your Rasbmc box, it would make sense to take a snapshot in case it becomes horribly corrupted at some point or melts.

There are many different ways of skinning this cat (or squashing this ‘berry), but my preferred method is the tried and tested customised Linux distribution, Clonezilla. I’ve been using CloneZilla personally and professionally for years and persuaded many colleagues of its merits (besides the obvious, that it’s free). It can be a bit intimidating with all the options it presents. If this is your first experience of CloneZilla, following this tutorial will also give you a gentle introduction to this powerful toolkit.

What you’ll need

  • A copy of Clonezilla, burned to disc.
  • A computer (desktop or laptop) configured to boot from CD.
  • An external hard drive, with enough space to store the image (you’ll only need a few gigabytes spare).
  • A USB reader for your SD card. You can buy one here.

Some of your Clonezilla kit

Take a snapshot

  1. Power down your Pi, with the command halt, shutdown or poweroff.
  2. Boot your PC from the Clonezilla disc. You will arrive at a simple menu/boot screen. It will boot automatically within 30 seconds – you can hit enter at any time, to proceed.
    Snapshot step 01
  3. You’ll be treated to rows and rows of gibberish while Clonezilla boots up.
    Snapshot step 02
  4. Choose your language and keyboard setting.
    Snapshot step 03
  5. Hit enter to start Clonezilla (yeah, you thought it had already started, didn’t you).
    Snapshot step 04
  6. Insert your Raspberry Pi’s card, in its reader.
    Snapshot step 05
  7. Choose “local_dev”.
    Snapshot step 06
  8. A screen prompt will tell you to insert your external hard drive.
    Snapshot step 07
  9. Insert the external drive and then wait for 5 seconds or so.
    Snapshot step 08
  10. A few lines will indicate that Clonezilla has registered the presence of the drive.
    Snapshot step 09
  11. Hit enter and Clonezilla will mount the various partitions now available to it.
    Snapshot step 10
  12. Select the external hard drive as the drive to which we’re copying the snapshot (in my case, the largest partition on the list).
    Snapshot step 11
  13. Hit enter. If the drive wasn’t cleanly dismounted before (oopsie), Clonezilla will check and fix as required.
    Snapshot step 12
  14. Choose a directory to store the SD card image and hit enter.
    Snapshot step 13
  15. Clonezilla will spit some more gibberish at you. Ignore it and hit enter.
    Snapshot step 14
  16. Though it makes me feel a little silly, choose Beginner mode.
    Snapshot step 15
  17. Choose “savedisk”.
    Snapshot step 16
  18. Give your disk image a meaningful name.
    Snapshot step 17
  19. Select the SD card, to save the image. You use cursor keys and the space bar here.
    Snapshot step 18
  20. Select Ok to continue.
    Snapshot step 19
  21. If you’re confident your SD card is in good shape, you can skip checking it.
    Snapshot step 20
  22. I’d recommend checking the saved image though. It doesn’t take long and gives you peace of mind that you should be able to restore from this image.
    Snapshot step 21
  23. Clonezilla will helpfully point out that you can do all this from the command line (yeah, right).
    Snapshot step 22
  24. Press Y and enter to continue.
    Snapshot step 23
  25. Shouldn’t take too long.
    Snapshot step 24
  26. When it’s all done, it’ll report progress. Press enter.
    Snapshot step 25
  27. Enter 0 to power off (or whatever you prefer) followed by enter.
    Snapshot step 26
  28. Clonezilla will eject the disc. Hit enter to carry on.
    Snapshot step 27

You should now have an image (consisting of several files) on your external hard drive, which you can later use for restoration. Job done.

Restore a snapshot

In this scenario, we’re starting with everything powered off, ready to begin.

  1. Boot your PC from the Clonezilla disc. You will arrive at a simple menu/boot screen. It will boot automatically within 30 seconds – you can hit enter at any time, to proceed.
    Restore step 01
  2. I’ve got to say, this screen full of strange foreign characters is pretty unnerving. But don’t worry. It’ll pass.
    Restore step 02
  3. Choose your language.
    Restore step 03
  4. I’ve never found I’ve had keyboard problems, even though I use a UK keyboard…
    Restore step 04
  5. Hit enter to begin.
    Restore step 05
  6. Insert the SD card/reader. Some nonsense will appear on screen. Don’t worry – just hit enter.
    Restore step 06
  7. Select “local_dev” and hit enter.
    Restore step 07
  8. Insert your external hard drive and wait 5 seconds or so for it to be recognised.
    Restore step 08
  9. It’ll detect the drive – hit enter.
    Restore step 09
  10. Next, it will mount your various partitions.
    Restore step 10
  11. You may have a few…
    Restore step 11
  12. Choose the external drive from the list then hit enter.
    Restore step 12
  13. Clonezilla will check the drive.
    Restore step 13
  14. Choose the directory where your saved image is stored and hit enter.
    Restore step 14
  15. Clonezilla will give you an overview of its file systems. You will be thrilled. Hit enter.
    Restore step 15
  16. Choose “Beginner”, no matter how patronised you may feel.
    Restore step 16
  17. Choose “restoredisk”.
    Restore step 17
  18. Select the previously saved image.
    Restore step 18
  19. Choose the SD card. Hit enter.
    Restore step 19
  20. Clonezilla reckons you really want to do this at the command line. Hit enter.
    Restore step 20
  21. This is a destructive operation and will wipe your SD card. Press Y then enter.
    Restore step 21
  22. Clonezilla doesn’t trust your judgment. Hit Y and enter again.
    Restore step 22
  23. There are two partitions to restore to this card. You’ll get a progress report for each restoration.
    Restore step 23
    Restore step 24
  24. Clonezilla will let you know once it’s done.
    Restore step 25
  25. Press enter to continue.
    Restore step 26
  26. Choose 1 to reboot (or whatever you prefer) then hit enter.
    Restore step 27
  27. Once the CD is ejected, you can also disconnect the SD card and hard drive. Hit enter.
    Restore step 28
  28. Witness the majesty of the Linux death rattle.
    Restore step 29

If all went well, you can now install this SD card back in your Pi, boot up and continue.

How-to: Raspberry Pi tutorial part 1: Getting started

[easyreview title=”Complexity rating” icon=”geek” cat1title=”Level of experience required, to follow this how-to.” cat1detail=”The geek factor is quite high here, but this process is not particularly taxing.” cat1rating=”2.5″ overall=”false”]

Contents

In the line of my work, I’ve recently had cause to become better acquainted with every geek’s favourite cheap computer, the Raspberry Pi. At the time of writing, you can pick up a Pi for an extremely reasonable £30, but the first thing I discovered was that this is only half the story. For a workable system, you need all the necessary cables, some storage and a case. Here’s my shopping list:

The Pi plus extra bits, in all their glory
The Pi plus extra bits, in all their glory

So my total is £69.95 – over twice the price of buying just the Pi. But still pretty cheap, considering. You’ll also need a USB mouse/keyboard for initial input. I’m going to run my Pi headless (no screen or input devices needed, just a network connection), so I’m borrowing my Microsoft Natural wireless desktop for this purpose, which the Pi detected without issue.

Hardware installation

This may well be the easiest hardware installation you ever perform. The case has a couple of punch outs that you need to remove for the model B Pi. I forgot to photograph them I’m afraid, but it will be obvious – when you try and put the Pi in the case, it won’t fit without these pieces removed (e.g. for the ethernet port).

Pi and case

Put the Pi in the case.

Pi case installation

Put the case together and fasten the screws. Make sure you put the VESA mount between the screws and the case, if you’re going to monitor-mount the Pi.

Pi case and VESA mount

That’s it.

What to do, what to do…

There are lots of potential uses for your Pi. It has limited processing power and memory but apart from that, the only real limit is your imagination. I have no imagination to speak of, so I’m going to do what I do with every other gadget: put Linux on it and set it up as a home web/file server. I’ll cover the web/file server setup in a subsequent tutorial.

Here’s the plan:

  • Install Rasbian (a Pi-centric version of the venerable Debian GNU/Linux distribution).
  • Set up Webmin/Virtualmin for management of the server/web sites.
  • Install OwnCloud and create my own Dropbox replacement.
  • Experiment with using the Pi as a remote desktop client or thin/fat terminal.

In the process, I’m looking for any major issues or gotchas – things you might want to be aware of if you’re thinking of getting into Pis in a big way.

Prepare the SD card

For this step, you’ll need an SD card reader. If you don’t have a laptop/computer with a built-in reader, you can buy an external reader here. Note: my laptop’s built-in card reader was not supported by the SD Formatter program (see below) so I used an external reader.

  1. From the SD Association’s official website, download and install the SD Formatter.
  2. Format the SD card using SD Formatter:
    SD Formatter
  3. Download NOOBS (“New Out of Box Software” – chortle) from the official Raspberry Pi website. This file is currently over 1GB. I tried the direct download and it was pretty slow, so I’d recommend using the torrent if you’re so equipped. NOOBS gives us a choice of different operating systems to install on the Pi.
    NOOBS
  4. Extract the contents of the NOOBS zip file onto the newly formatted SD card.
    NOOBS files

Whack the SD card into the Pi and connect everything up (power last of all, since there’s no power switch). If at this point you don’t see any output, the chances are that your SD card has not been recognised. I’m using a Class 10, but I’ve read that some people have had problems with Class 10 cards and better results with Class 6. If your card is recognised, you should be rewarded with a few pretty lights when powered up.

Pi plumbed in

Install and configure Raspbian

At the NOOBS screen, choose Rasbian and click Install OS, then Yes. Go grab yourself a quick coffee.

Raspbian installation

The install will take a few minutes (the speed of your SD card is a factor here). Once it’s done, you’ll see a message “Image applied successfully”. Click Okay to reboot the Pi with your new OS.

Raspbian installation progress

raspi-config will launch with some initial setup options. I’ll work through them one by one.

raspi-config

  1. Expand the filesystem: You can skip this, because this option isn’t needed for NOOBS-based installations. Otherwise, this ensures you’re using the whole of the SD card.
  2. Change the password for the “pi” user. The default password is “raspberry”. Improve on that.
  3. Enable/disable boot to desktop: I’m not planning to use a desktop system with this Pi. X Windows is such a resource hog that we definitely want to set this to “No”. Of course if you want to use the Pi as a desktop system, you’ll select “Yes” here.
  4. Internationalization options: I’m in the UK, with a UK keyboard layout. It’s not a huge problem since generally I’ll be accessing the Pi via a web interface or service, but I am fussy, so I set everything up to be UK-centric. My correct locale was already selected. In these dialogue boxes, use the spacebar to select/deselect options, tab to move between fields, up and down cursors keys to navigate and enter to select.
  5. Enable camera: do this if you’ve bought the optional camera module (I haven’t).
  6. Add to Rastrack: this puts you on the Rastrack map of Pi installations. Not for me, but you might be interested.
  7. Overclock: if you need to squeeze more juice out of your Raspberry, you can force it into a more frantic mode of operation. I’m not going to do this, at this stage.
  8. Advanced options: Here, I’m going to set the hostname of the Pi and reduce the Pi’s use of GPU memory to 16MB (since we’re not running a graphical desktop). I’m also going to ensure that SSH is enabled (for later remote logon purposes).
  9. Finish and reboot to an ordinary logon prompt.
  10. For demo/proof of concept servers where security is less of a concern, I like to be able to log on as root. You can give the root user a password by logging in, then entering sudo passwd root and following the prompts.

Configure networking

I need this Pi to have a static IP address. You can use a DHCP reservation for this purpose if you like, but I prefer to create a fixed IP address on boot. Like this:

  1. Log in.
  2. If you didn’t log on as root, give yourself an elevated shell: sudo su
  3. Install your favourite console-based text editor. For me this is vim: apt-get --force-yes -y install vim
  4. Use the editor to edit the /etc/network/interfaces file. Replace the line iface eth0 inet dhcp with iface eth0 inet static
    address 192.168.1.11
    netmask 255.255.255.0
    gateway 192.168.1.1

    adjusting the values to match your network as appropriate.
  5. My DNS was already correctly configured, but you may need to check the contents of your /etc/resolv.conf file to ensure DNS is set up. If in doubt, this configuration should work:
    nameserver 8.8.8.8
  6. Save the files then back at the command prompt, enter reboot to restart the Pi with the new network configuration.
Typical Raspbian bootup messages
Typical Raspbian bootup messages

Once the Pi is up and running you’ll be able to connect via SSH using your favourite terminal emulation program (mine’s PuTTY).

As you’ll see from the Contents section above, I have a few ideas for things to do next. It’s a good plan to take a snapshot of the Pi in its current state, so we can hit the ground running any time we want to try something different, with a Raspbian base, so this will be the subject of my next how-to. In the meantime, if you have any questions about what we’ve done so far, or if you have any ideas for later tutorials, let us know in the comments!

Until next time. 🙂

Review: Smartphone Camera Comparison – Samsung Galaxy Note II v Apple iPhone 5

DUMMY: So ever since I reviewed the Samsung Galaxy S4 Mini, Geek has been whinging that I’m an Apple fanboy. He’s also bleated that I’m not comparing like-for-like products. We took a walk in the local park on a nice sunny day, Geek with his tombstone-sized Galaxy Note II, me with my sleek and svelte iPhone 5 and decided to give the phones a head-to-head. The question: whose was the best smartphone/camera.

GEEK: You are a whiny Apple fanboy.

DUMMY: Whatever. So here are some of the shots we took. First, here’s the iPhone 5 in quite a shaded area:

GEEK: And then the Galaxy Note II:

DUMMY: Both cameras struggled with the transition from shade to bright sunlight but the stand-out winner in this first shot is the Note II. The level of clarity and detail is far superior and to be honest the iPhone 5 image is quite blurry in comparison.

GEEK: Oo, what a surprise.

DUMMY: On to the next picture. The same subject but in brighter sunlight. iPhone 5 first again:

GEEK: And then the Note II:

DUMMY: Curses. I can see the same kind of issues here. The Samsung camera gives greater levels of detail, certainly up close and in the foreground. As you move further back into the mid and background this difference is less pronounced and at a pinch I might argue the iPhone 5 deals slightly better with dark shaded areas.

GEEK: You’re just making this stuff up, aren’t you.

DUMMY: Shuttit! All in all, I’d say its pretty conclusive. The Samsung camera is without doubt superior to the camera in the iPhone 5. Come on Apple, sort your game out!

GEEK: Boohoo.

DUMMY: Git.

How-to: Laravel 4 tutorial; part 5 – using databases

[easyreview title=”Complexity rating” icon=”geek” cat1title=”Level of experience required, to follow this how-to.” cat1detail=”There are some difficult concepts here, but you’ll find this is pretty easy in practice.” cat1rating=”3″ overall=”false”]

Laravel Tutorials

layered database

Introduction

At first sight, Laravel offers a dizzying range of ways to interact with your databases. We’ve already seen Migrations and the Schema Builder. There’s also the DB Class with its Query Builder and the Eloquent ORM (Object Relational Mapper) plus no doubt plenty of database plugins for various enterprise and edge-use cases. So where to start?

I’d counsel you to give Eloquent serious consideration – especially if you’ve never previously encountered an ORM. Coming from CodeIgniter which certainly didn’t use to have a built-in ORM, I was amazed how much quicker the Doctrine ORM made it to code database manipulation. And the resulting code was easier to understand and more elegant. Laravel comes with its own built-in ORM, in Eloquent. For me, tight integration with a decent ORM is one of the reasons I turned to Laravel in the first place, so it would take a lot to tempt me away from it to a third-party plug-in. But the great thing about this framework is that it gives you choice – so feel free to disagree. In any event, in this tutorial, Eloquent will be our object of study.

Models

Laravel follows the MVC (Model View Controller) paradigm. If you’re frequently the sole developer on a project, you’ll find that this forces you into almost schizophrenic modes of development. “Today I am a user interface designer, working on views. I know nothing of business logic. Don’t come here with your fancy inheritance and uber_long_function_names().” This is honestly helpful; it forces you into a discipline that results in more easily maintainable code.

Models describe (mostly, but not exclusively) how you interact with your database(s). Really they deal with any data that might be consumed by your application, whether or not it resides in a traditional database. But one step at a time. Here we’ll be looking at Eloquent with a MySQL database. Eloquent is database agnostic though (to a point), so it doesn’t really matter what the underlying engine is.

Unless you have a really good reason not to, it’s best to place your model files under app/models. In the last tutorial, I created (through a migration) a “nodes” table. I mentioned that it was significant that we use a plural noun. Now I’m going to create the corresponding model, which uses the singular form of the noun. The table name should normally be lower case, but it’s preferred to use title case for the class name. My file is app/models/Node.php. Initially, it contains:


The closing "?>" tag is not needed.

Eloquent assumes your table has a primary key called "id". This assumption can be overridden, as can the assumed table name (see the docs).

Now that teeny weeny bit of code has caused all sorts of magic to happen. Head back to the ScrapeController.php file I created in tutorial 2, and look what we can do:

	public function getNode($node) {
		// Top 10 downloads that have at been downloaded at least 50 times
		$nodes = Node::where('downloads', '>', 50)
			->take(10)
			->orderBy('downloads', 'DESC')
			->get();
		$this_node = Node::find($node);
		if($this_node) $data['this_url'] = $this_node->public_url;
		$data['nodes'] = $nodes;
		return View::make('node', $data);
	}

Coming from CodeIgniter, where you had to load each model explicitly, that blew me away. The Eloquent ORM class causes your new Node model to inherit all sorts of useful methods and properties.

  • All rows: $nodes = Node::all();
  • One row (sorted): $top = Node::orderBy('downloads', 'DESC')->first();
  • Max: $max = Node::max('downloads');
  • Unique rows: $uniq = Node::distinct('public_url')->get();
  • Between: $between = Node::whereBetween('downloads', array(20, 50))->get();
  • Joins: $joined = Node::join('mp3metadata', 'mp3metadata.ng_url', '=', 'nodes.public_url')->get();

As you'd expect there are many more methods than I would want to describe here. Just something to bear in mind when reading the official documentation: not only can you use all the methods describe in the Eloquent docs, you can also use all the methods described in the Query Builder docs.

CRUD

At the very least, we need to know how to Create, Read, Update and Delete rows. All the following examples are of logic you'd typically use in a controller.

Create

$new_node = new Node;
$new_node->public_url = 'http://some.url/';
$new_node->blurb = 'blah blah blah';
$new_node->speaker = 'Fred Bloggs';
$new_node->title = 'Great Profundities';
$new_node->date = date('Y-m-d');
$new_node->save();

Note that the created_at and updated_at fields are automatically maintained when you use save().

Read

See the examples above to see how records can be retrieved. Eloquent returns a Collection object, for multi-record results. Collections have a few special methods. I confess I am not clear on their usage, due to lack of working examples. The methods that seems most helpful is each() for iteration. The official docs give a terse example:

$roles = $user->roles->each(function($role)
{

});

Update

// Retrieve and update
$node = Node::find(1);
$node->downloads = 64;
$node->save();

// Using a WHERE clause
$changes = Node::where('downloads', '<', 100)->update(array('downloads' => 100));

Delete

// Several options
$node = Node::find(1);
$node->delete();

Node::destroy(1, 2, 3);
		
$deleted = Node::where('downloads', '<', 100)->delete();

Relationships

There's every chance that you will be working with data where items in one table have a relationship with items in another table. The following relationships are possible:

  • One-to-one
  • One-to-many
  • Many-to-many
  • Polymorphic

I'm not going to dwell too much on the meaning of these, since my objective is not to offer a relational database primer. 😉

For convenience (and because they make sense!) I'm quoting the relationships referenced in the official documentation.

One-to-one
In the User.php model:

class User extends Eloquent {

    public function phone()
    {
        return $this->hasOne('Phone');
    }

}

Eloquent assumes that the foreign key in the phones table is user_id. You could then in a controller do: $phone = User::find(1)->phone;

Relationships can be defined in either direction for convenience, so you can go from the User to the Phone or from the Phone to the user. The reverse relationship here would be defined in Phone.php model file as follows:

class Phone extends Eloquent {

    public function user()
    {
        return $this->belongsTo('User');
    }

}

One-to-many

Forwards:

class Post extends Eloquent {

    public function comments()
    {
        return $this->hasMany('Comment');
    }

}

Reverse:

class Comment extends Eloquent {

    public function post()
    {
        return $this->belongsTo('Post');
    }

}

And in your controller: $comments = Post::find(1)->comments;

Many-to-many

Many-to-many relationships break down into two one-to-many relationships, with an intermediate table. For example, each person may drive multiple cars; conversely each one car may be driven by multiple people. You would define an intermediate people_cars table and set up one-to-many relationships between this table and the two other tables.

Polymorphic

Polymorphic relationships are a little odd. You could define a relationship between multiple tables, when a query to a single model will retrieve results from more than one related table based on similar one-to-many relationships. Maybe I'm not getting it, but personally I would use different types of join to achieve similar results - and I would find that easier to understand, document and maintain. But by all means, read the docs and see if this strategy works for you.

Conclusion

As you'd expect, you can dig a lot deeper with Eloquent. There's enough here to get you started though. If you want to soak up the full benefits of Eloquent, you may wish to consult the API documentation, or read the source code. I'll leave such fun activities for people with bigger brains than mine though. 😉

Layered Database image copyright © Barry Mieny, licensed under Creative Commons. Used with permission.