Build a real-time SMS call center with Data McFly and Twilio

Do you want to know one of the beautiful things about Data McFly? It integrates really easily with other services.

In this article, we are going to walk through using Data McFly and Twilio together to build a real-time SMS call center.

This could be used as a customer help desk where customers send a text message for help and an agent sends a reply back from their web browser.

The actual phone work will be handled by Twilio, and Data McFly will store the data and display the chats in real-time. We’ll use node.js to send and receive the text messages and an HTML frontend to handle the actual chatting.

I decided this week to give myself the task of building a real-time SMS call center that used Data McFly for the data handling and real-time communication, and Twilio for the phone work.

The end result turned out pretty well.

Source: http://blog.flybase.io/2015/01/29/sms-contact-twilio

Continue readingBuild a real-time SMS call center with Data McFly and Twilio

Cheesy Baked Spaghetti Squash

Cheesy Baked Spaghetti Squash

Chili-lime chicken, beans, spaghetti squash and cheese… This is a tasty combination that we love to make.

What you need

  • 1 (3-ounce) cooked Chicken Breast, cut into chunks
  • 1 medium Spaghetti Squash (about 4 cups cooked)
  • 1 tablespoon Olive Oil
  • 1 cup Kidney Beans, drained and rinsed
  • 1 cup fresh Salsa
  • 3 tablespoons fresh Coriander, chopped
  • 1/2 cup Shredded Cheddar Cheese
  • Sea Salt & Pepper
  • 1 tablespoon Chili Flakes, optional

How you make it

  1. Preheat your oven to 425°F and line your baking sheet with parchment.
  2. Cut the squash in half, rub with inside with olive oil and sprinkle sea salt & pepper. Place face down on the baking sheet & bake for about 25-30 minutes. The edges on the inside should be a bit browned and shreds should form easily with a fork.
  3. Meanwhile, toss the chili flakes with the cheeses and stir the fresh coriander into the salsa.
  4. When the squash is ready, take it out and let it stand for 5 minutes. Turn the oven to the broiler setting. Fully shred the squash, leaving the shell intact. You will be stuffing it!
  5. Transfer the spaghetti squash to a mixing bowl. Stir in the salsa, followed by the beans and chicken. Split the mixture in half and stuff each squash shell. Top with the shredded cheese.
  6. Place them back on the same baking sheet & broil until bubbly and browned. About 3-4 minutes.
Continue readingCheesy Baked Spaghetti Squash
Posted inFood

Fish Cakes

I’m originally from Newfoundland, and fish cakes are a staple we grew up with alongside another traditional dish called fish and brews.

You can actually make this with just about any type of fish, but I prefer to use Cod, or Sole, as white fish tends to take on the flavours you cook it with.

What you need

  • 1 ½ pounds salt dried cod
  • ¼ cup butter
  • 1 small chopped onion
  • 6 cups mashed potato
  • 1 beaten egg
  • 2 tbsp dried savoury (optional)
  • 1/2 tsp black pepper
  • 1/2 tsp paprika
  • 1/2 tsp garlic powder

How to make it

  1. Simmer the cod in boiling water for about 15 minutes.
  2. Drain the water off the fish and allow the fish to cool to almost room temperature.
  3. When the fish is cool, flake it apart with a fork into small pieces.
  4. In a sauté pan, melt the butter over medium heat.
  5. Add the onions and cook until they are softened.
  6. Add the flaked fish along with the mashed potato, egg, pepper, paprika, garlic and savoury.
  7. Mix together until well combined, then form into small cakes and roll in flour.
  8. Fry the fish cakes in canola oil over medium heat until golden brown on both sides.

This is a traditional way to make it, you can also add a little hot sauce into the mixture for flavour if you wanted to.

Continue readingFish Cakes
Posted inFood

Generate UUIDs in PHP

I’m working on a project currently where I am using UUIDs as unique identifiers. PHP doesn’t have a good UUID function for this, so I wrote one that let me generate one.

<?php
function generate_uuid() {
	return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
		mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
		mt_rand( 0, 0xffff ),
		mt_rand( 0, 0x0fff ) | 0x4000,
		mt_rand( 0, 0x3fff ) | 0x8000,
		mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
	);
}
?>

For anyone who doesn’t know, a UUID, or a Universally Unique Identifier is an identifier standard used in software construction, standardized by the Open Software Foundation (OSF) as part of the Distributed Computing Environment (DCE).

UUIDs are meant to enable distributed systems to uniquely identify information without significant central coordination. In this context the word unique should be taken to mean “practically unique” rather than “guaranteed unique”. Since the identifiers have a finite size, it is possible for two differing items to share the same identifier. The identifier size and generation process need to be selected so as to make this sufficiently improbable in practice. Anyone can create a UUID and use it to identify something with reasonable confidence that the same identifier will never be unintentionally created by anyone to identify something else. Information labeled with UUIDs can therefore be later combined into a single database without needing to resolve identifier (ID) conflicts.

A UUID is a 16-octet (128-bit) number. In its canonical form, a UUID is represented by 32 hexadecimal digits, displayed in five groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (32 alphanumeric characters and four hyphens). For example:

a8d5c97d-9978-4b0b-9947-7a95dcb31d0f

There are several versions of UUIDs, in this case the function uses version 4, which is the random UUID generation. This is generally defined as follows

Version 4 UUIDs use a scheme relying only on random numbers. This algorithm sets the version number as well as two reserved bits. All other bits are set using a random or pseudorandom data source. Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal digit and y is one of 8, 9, A, or B (e.g., f47ac10b-58cc-4372-a567-0e02b2c3d479).

Continue readingGenerate UUIDs in PHP
Posted inCode

What can I do with a Raspberry Pi?

So you just got a new Raspberry Pi, maybe it was a christmas present.. Or maybe you decided to buy one for yourself and now you want to know what you can do with this little computer?

There’s a lot you can do with it, you can use it for home automation, a file server, a web server, a media streamer running XMBC, a retro gaming console or just a tiny desktop device.

I’ll get into more detail on some of what you can do in a later post (or a couple), but for now, this post is meant to give you ideas.

First, I definitely recommend having the model with 512 megabytes of RAM, as the more memory you have, the better performance you get.

One thing I like about Raspberry Pi is that the hard drive is an SD card, so essentially, you can have multiple computers on one device, so you could have a card with raspbian on it, another card for raspbmc (the XMBC system), etc.

In terms of cases, I’ve used several cases from a case built with a simply project box, to a case built with LEGO, but my favorite is the blue Raspberry Pi SAFE case from solarbotics which also can be purchased with a mount to attach to the back of a TV.

Now, some uses for the Pi:

  1. There’s a nice getting started post over at Engadget for getting your Pi up and running
  2. Retro Gaming Console:Engadget also has a nice starting point for setting up a retro gaming rig using your Raspberry Pi and some emulators
  3. Media Streaming: Raspbmc or OpenElec both work nicely for XMBC / media streaming, and can plug into any TV. Most TVs also have USB ports which can power the little computer as well. I’ve personally been preferring Raspbmc lately as it seems faster and more stable.
  4. Install the Chromium browser for better web browsing: Since your Raspberry Pi is already hooked up to your TV, why not enjoy some big screen surfing? You’ll need a better browser than Midori for this though, so try Chromium. Just drop into a Terminal and type: sudo apt-get install chromium-browser then hit Enter.
  5. Write Games: Scratch is a programming language that’s easy to get to grips with and easy to use, which makes it good for children to start learning with and for creating rich programming projects. Check out this tutorial, featuring a bonus cat.
  6. Run Firefox OS: Although still in the developmental stages, Oleg Romashin an engineer at Nokia, has managed to get Firefox OS running on the Raspberry Pi. FFOS isn’t out until next year, but check out what’s been achieved so far.
  7. BitTorrent Server: If you frequent the various Torrent sites, then why not create a dedicated lean Torrent machine? Just hook it up to your router and leave it to do its business. Full instructions, scripts and downloads come courtesy of the snapdragon:IT blog.
  8. Pi-powered Cloud Server:  Fancy building your very own cloud server? By using OwnCloud you can. Follow the instructions, and the customised script from petRockBlog and you’ll become your own cloud provider in no time.
  9. Home Automation: There’s a new product called PiFace that’s perfect for home automation. It hooks up to the RPi and allows it to detect switch states from a door sensor, a pressure pad or any number of other switch types.
  10. Raspberry Pi Cluster: Many Pi’s make light work. Check out these instructions from the University of Southampton to make a RPi Supercomputer.
  11. Make a wearable computer:  Interesting article on building a wearable Raspberry Pi, with the display on a pair of glasses and a keyboard on his arm.

As you can see, there’s a lot you can do with your Raspberry Pi, I’m just giving some examples to get started. I’ll post some more on here later as I get more ideas for the Raspberry Pi, but the 10 or s0 examples above should be enough to get your started.

Continue readingWhat can I do with a Raspberry Pi?