OSX: Format an Encrypted Drive

If you need to format an encrypted disk on OSX, you'll need to use the command line diskutil as Disk Utility won't let you do anything with the device.

First, find the ID of the disk you wish to format, using:

diskutil list

Which will list your disks, for example I wish to format the 2TB drive, I'd use disk2

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            249.2 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Data                    477.0 GB   disk1s2
   3:                  Apple_HFS Scott                   522.8 GB   disk1s3
/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS Time Machine            2.0 TB     disk2s2

We can then go ahead and format the drive (remember this will format your drive and remove all data from the disk):

diskutil eraseDisk JHFS+ Test disk2

Replace the label Test with the name you wish to give the new partition. After you've done this, you can edit the disk normally with Disk Utility.

If you need to format an encrypted disk on OSX, you'll need to use the command line diskutil as Disk Utility won't let you do anything with the device. First, find the ID of the disk you wish to format, using: diskutil list Which will list your disks, for example…

Read More

Install Mailcatcher on Laravel Homestead

If you're looking to debug outbound email easily, then mailcatcher will be a life saver for you. It'll give you a nice interface to view outbound emails:

Mailcatcher

To install it, ssh to your box and follow these steps:

sudo apt-get install ruby-dev libsqlite3-dev

Once that's installed, you can install the gem with this command:

sudo gem install mailcatcher

After mailcatcher is installed, you can run the program with:

mailcatcher --http-ip 0.0.0.0

If you've using Vagrant then you'll need to forward port 1080 from the guest to the host machine as well.

If you're looking to debug outbound email easily, then mailcatcher will be a life saver for you. It'll give you a nice interface to view outbound emails: To install it, ssh to your box and follow these steps: sudo apt-get install ruby-dev libsqlite3-dev Once that's installed, you can install the…

Read More

Add Logfile to Memcache/Memcached Daemon on Linux

If you need to add a log file for memcache to help debug an issue, you can either use the following syntax:

memcached -d -m 3072 -l localhost -p 11211 -u nobody -v 2>>/tmp/memcached.log

or if you're on RHEL/CentOS, you can edit the file /etc/sysconfig/memcached like so:

PORT="11211"
USER="memcached"
MAXCONN="3048"
CACHESIZE="256"
OPTIONS="-vv >> /var/log/memcached 2>&1"

Save the file, restart memcache and you'll have a log file. This was taken from this StackOverflow question.

If you need to add a log file for memcache to help debug an issue, you can either use the following syntax: memcached -d -m 3072 -l localhost -p 11211 -u nobody -v 2>>/tmp/memcached.log or if you're on RHEL/CentOS, you can edit the file…

Read More

Windows: Add user to group via Command Line

I recently had to fix a Windows machine that had a broken user profile and needed to add the new user to the admin group.

A few Google searches later and this is the command to run in the command line prompt:

net localgroup group user /add

You can find this and more syntaxes at the helpful windows-commandline.com.

I recently had to fix a Windows machine that had a broken user profile and needed to add the new user to the admin group. A few Google searches later and this is the command to run in the command line prompt: net localgroup group user /add You can find…

Read More

Laracon EU 2014

[Header Image]

Intro

On August 25th, I headed over to Amsterdam to attend Laracon EU 2014. I wasn't too sure what to expect this year, I'd taken a lot away from last years event and was hoping this would be similar.

Community Day

The biggest difference from Laracon EU 2013 was that we had a community day to attend at De Nieuwe Liefde. This turned out to be an inspired choice of venue. Both the building and staff were pleasant.

The talks through the community day were great. I attended the following talks:

  • "Handling Highly Connected Data with Neo4j Graph Databases" by Michelle Sanver
  • "Getting Started with Package Development for PHP and Laravel" by Hannes van de Vreken
  • "Filesystem Abstraction with Flysystem" by Frank de Jonge
  • "TDD: The Good Parts" by Adam Wathan
  • "Coding Like a Girl" by Gabriela D'Ávila
  • "The use of multiple Laravel applications within a huge sports platform" by Dirk Jan Menkveld
  • "Q&A Panel" with Taylor Otwell

Day 1

Day 2

Evenings & Drinks

Photos

A few people other than me had taken photos, I've listed the ones I'm aware of below. If you have taken photos, leave them in the comments and I'll add them to this list.

Flickr - Gabriela D'Ávila

Flickr - Caryn Humphreys

[Header Image] Intro On August 25th, I headed over to Amsterdam to attend Laracon EU 2014. I wasn't too sure what to expect this year, I'd taken a lot away from last years event and was hoping this would be similar. Community Day The biggest difference from Laracon EU 2013…

Read More

Twitpic is Closing Down

I read this week about Twitpic closing down and it left me feeling disappointed. It's not the first time that Twitter have pulled a move like this. For me, the difference with Twitpic is that it was one of the first services that offered something Twitter didn't do at the time.

I believe they are making a mistake with the way in which they've treated the developer community in the past couple of years. The community building applications and consuming the platform is what fuelled their early growth.

It's a shame they seem to have forgotten that.

I read this week about Twitpic closing down and it left me feeling disappointed. It's not the first time that Twitter have pulled a move like this. For me, the difference with Twitpic is that it was one of the first services that offered something Twitter didn't do at the…

Read More

Slack Beta for Mac with Multiple Team Support

If you're a Slack user (and you should be) and wish to use the Mac app, it's a bit tedious for those of us who are in multiple teams. They've recently released a beta version that has support for multiple teams in a much better interface.

You can download it from HockeyApp at this URL:

https://rink.hockeyapp.net/apps/06bd6493684f65a3b8f47aca92c9006e

If you're a Slack user (and you should be) and wish to use the Mac app, it's a bit tedious for those of us who are in multiple teams. They've recently released a beta version that has support for multiple teams in a much better interface. You can download it…

Read More

Syncable Host File to Make the Internet Suck Less

We've all been there. A friend sends you a link to an internet shock site. If you're familiar with the hosts file on your machine, then you can use this large sync-able list to compliment your own rules. If you using a Mac, you can use the nifty Gas Mask program to edit your hosts file without having to jump into a shell.

URL for the hosts file is:

http://someonewhocares.org/hosts/hosts 

As well as IPv6 files, there are a few other formats available as well.

We've all been there. A friend sends you a link to an internet shock site. If you're familiar with the hosts file on your machine, then you can use this large sync-able list to compliment your own rules. If you using a Mac, you can use the nifty Gas Mask…

Read More

Virtualmin - FTP/SFTP File Writing Errors

If you're using Virtualmin on your servers and have a few odd FTP error messages (happened for me using SFTP too), then it's one of three things.

  • Disk quota for the hosting account has exceeded
  • Server has ran out of memory
  • The configuration options below need to be set in /etc/proftpd.conf

As mentioned above, I found that these two options added into /etc/proftpd.conf fixed the file write issue in some cases:

AllowRetrieveRestart on
AllowStoreRestart on

If you're using Virtualmin on your servers and have a few odd FTP error messages (happened for me using SFTP too), then it's one of three things. Disk quota for the hosting account has exceeded Server has ran out of memory The configuration options below need to be set in…

Read More

Useful Notes for phpinfo() & Capturing Output of phpinfo()

I recently needed to capture the output of phpinfo() for a to a log upon install. I'd been able to do this in the past but couldn't quite remember how I managed it. This is where ob_start() and ob_flush() come into their own.

To get the contents of phpinfo(); into a variable, you can use the following:

ob_start();
phpinfo();
$strPhpInfo = ob_get_contents();
ob_clean();

The variable $strPhpInfo will now contain the output from phpinfo().

A side note, if you only want the variables section of phpinfo(), then use:

phpinfo(32);

and it'll give you just that in the output. You can read more about the other values you can pass to phpinfo() at php.net/manual/en/function.phpinfo.php.

I recently needed to capture the output of phpinfo() for a to a log upon install. I'd been able to do this in the past but couldn't quite remember how I managed it. This is where ob_start() and ob_flush() come into their own. To get the contents of…

Read More

PHP ActiveRecord - Get Last Query

I recently had to do some work on an older site that used the PHP implementation of ActiveRecord. One of the issues I had was that the queries being ran weren't produced the expected result. I found two commands to help with this an issue the last run query:

If you're within a model, you can do:

echo self::connection()->last_query;

and if you're outside your model, you can use:

echo model::connection()->last_query; 

I recently had to do some work on an older site that used the PHP implementation of ActiveRecord. One of the issues I had was that the queries being ran weren't produced the expected result. I found two commands to help with this an issue the last run query: If…

Read More

Install Old Version of Laravel 4.1.X for PHP 5.3 Servers using Composer

If you need to install an older version of Laravel for use with a server that has PHP 5.3.X for example, you can do so using the following command:

composer create-project laravel/laravel project-directory 4.1.*

This is useful when you can't upgrade the version of PHP but still wish to use Laravel.

If you need to install an older version of Laravel for use with a server that has PHP 5.3.X for example, you can do so using the following command: composer create-project laravel/laravel project-directory 4.1.* This is useful when you can't upgrade the version of PHP but…

Read More

Almost Time for Amsterdam!

Preparing for Laracon EU 2013

It's a couple of weeks away until I head off for Amsterdam.

I'll arrive in Amsterdam on the 25th August of August and depart on the 31st. I'll be in Amsterdam to attend the fantastic Laracon EU conference along with a work colleague.

We're currently in the process of making plans of what to do while we're there, we got a lot of the common tourist things done last year, so this year it'll be good to see some new places.

If you have experience of renting a boat of in the 'dam too, I'd like a chat.

If you've got any suggestions, leave them in the comments below. If you know anyone in Amsterdam with good local knowledge, point them in the direction of this post too!

It's a couple of weeks away until I head off for Amsterdam. I'll arrive in Amsterdam on the 25th August of August and depart on the 31st. I'll be in Amsterdam to attend the fantastic Laracon EU conference along with a work colleague. We're currently in the process of making…

Read More

Interactivity for Payment Forms

Interactivity for Payment Forms

A short while ago now I read an article by Michael Villar of Stripe on using animations when users are completing payment forms.

Villar put forward the argument that this improves the user experience.

Below is a demonstration of doing that.

Interactivity for Payment Forms A short while ago now I read an article by Michael Villar of Stripe on using animations when users are completing payment forms. Villar put forward the argument that this improves the user experience. Below is a demonstration of doing that. …

Read More

Laravel: Filter Every Array Element with a Closure

I always forget about how awesome Laravel Collection's are. I came across this gem when needing to run a filter on every element of an array. I think it may of been Dayle's book that first informed me of them. For example, if you have an array of fruits that you want to filter down, you can do the following:

// Create an array of fruits
$array = ["banana", "apple", "orange"];

// Transform the array into a Collection object
$collection = new Illuminate\Support\Collection($array);

// We don't like banana's anymore, so we're going to filter them out
$no_bananas = $collection->filter(function($element) {
    if ($element != "banana") return true;
});

// Dump out our array now, and we'll see the banana's are gone
dd($no_bananas);

I always forget about how awesome Laravel Collection's are. I came across this gem when needing to run a filter on every element of an array. I think it may of been Dayle's book that first informed me of them. For example, if you have an array of fruits that…

Read More

Laracon US 2014

If you haven't noticed yet, the Laracon US 2014 videos have been posted online for a short while now, you can grab them over on Userscape's website at http://userscape.com/laracon/2014/.

One talk of note, which I've recommended to a lot of people is by Greg Baugues, titled "Devs and Depression".

If you haven't noticed yet, the Laracon US 2014 videos have been posted online for a short while now, you can grab them over on Userscape's website at http://userscape.com/laracon/2014/. One talk of note, which I've recommended to a lot of people is by Greg Baugues, titled…

Read More

Adding Google Sitemap's to Ghost Blogging Platform

I recently wanted to replace my statically generated sitemap.xml file with a dynamically one generated by ghost. It ended up being pretty trivial to do, but the following two links helped immensely. At present, it's a hack to the core which you'll have to repeat if you upgrade - but that's a small price to pay for having your sitemap generated dynamically.

For adding sitemap support:
http://tstrimple.com/hacking-ghost-adding-dynamic-sitemap-xml/

For updating the format/count:
http://www.mathachew.com/blog/customizing-your-dynamic-sitemap-in-ghost/

I recently wanted to replace my statically generated sitemap.xml file with a dynamically one generated by ghost. It ended up being pretty trivial to do, but the following two links helped immensely. At present, it's a hack to the core which you'll have to repeat if you upgrade -…

Read More

A Love of Brasil

I've seen a lot of people unhappy with Brasil and their football team the past few days. There is a piece of me that deals with that unhappiness and disappointment of events in a way that allows me to deal with things.

If you've met me in person, played football with me or spoken to me about sports then I've probably at some point mentioned Brasil. I'll be travelling over to Brasil later this year and I'm sure that I'll love it. I have an incredible amounts of friends and people close to me there, it'll be good to finally spend time learning about the country and life in it.

Both Brasil as a country and the friendly nature of Brazilians has been a part of my admiration since I was a kid and this was mainly influenced by one person, an idol of mine: Ronaldo Luís Nazário de Lima.

I had a childhood that wasn't like most kids. I spent most of it in a wheelchair, unable to walk and dealing with the effects of Legg–Calvé–Perthes Disease which prevented me from walking normal until I was about 12 years old. When I started high school at 11, I was on crutches and then a walking stick. I missed out on the whole childhood adventure of climbing trees, playing football and doing the usual things that children do.

For my life and career, this served me well. I learned to program basic at this time and started to learn a lot about computing which has done me well considering that I'm now a programmer as a professional.

Football seemed to touch something deep inside my soul. As soon as I was able to walk, then run - I began to play football. This is now one of the most important parts of my life, I have been told that I will be unable to walk by doctors three times in my life so far. I still prove them wrong and will continue to do so, until I actually can't. I have no idea if I'll be walking by the time I am 40, 50, 60 or older. I hope that it will be longer, of course. I have no control over that though, it all depends on how well my hip manages to deal with life. My doctor would prefer me to have a hip replacement now, to which I object completely. I prefer to deal with the pain of having my 'real' hip and being able to play the sport that has given me so much.

As a human, I think I've overcome quite a lot to get to where I am now. The inspiration for that and the never giving up came from years of watching and learning about Ronaldo. This is a professional sports player that has had career threatening injuries more times than people care to remember. There is an image that sticks into my mind of Ronaldo while he was playing for Inter Milan on 21 November 1999 against Lecce felt his knee buckle, he was out for a long period of time.

I sat watching the moment I'd waited for, on the 12th April 2000 Ronaldo was named a substitute for the game against Lazio in the Copa Italia final. Ronaldo played seven minutes in total. He took the ball on the edge of the D and collapsed. His knee had given way again. There is a now famous photo of Ronaldo laying on the pitch in anguish.

Ronaldo Injury

This image has stayed with me for life. I've had serious knee injuries myself and serious ankle injuries too. I never gave up hope that I would play again and always believe that I would be able to recover from them. In Ronaldo's case, he not only came back from these awful injuries, he resumed his career after them. The attitude and commitment to do that is amazing to me and part of the reason why he has remained my idol throughout life.

If you ever wondered how severe Ronaldo's knee injuries have been, look at the photo below.

Ronaldo's Knee

I read an interesting post a few days ago, which talks about what Ronaldo could have been which I'd recommend reading.

Always remember, that no matter how bad things may be at present, they can always get better.

I've seen a lot of people unhappy with Brasil and their football team the past few days. There is a piece of me that deals with that unhappiness and disappointment of events in a way that allows me to deal with things. If you've met me in person, played football…

Read More

MariaDB: Set Maximum Server Connections via Query

If you're a MariaDB user and need to set the max_connections variable a little higher while the server is running, you can use the following SQL query:

# This will give you the current mac_connections setting
select @@max_connections;

# Set the maximum connections allow for MariaDB
set global max_connections = 200;

# To see that the variable has been changed, run the following query again:  
select @@max_connections;

If you're a MariaDB user and need to set the max_connections variable a little higher while the server is running, you can use the following SQL query: # This will give you the current mac_connections setting select @@max_connections; # Set the maximum connections allow for MariaDB set global max…

Read More

ncftp: Recursive File Get

A while ago I wrote a post about using the basic ftp command to recursively fetch remote FTP files, it seems this doesn't completely fetch them recursively. A great little program called NCFTP will do this accurate and pretty quickly. Install NCFTP if you haven't already, then run the program:

ncftp

This will give you a prompt, at which type the following:

set save-passwords yes

Which will allow the program to save your password while its working and transferring files. Open a connection to your FTP server by using the following at the command prompt:

open -u ftp_username ftp_host

It'll ask for a password, enter it and then it'll go away and connect. To then download your files recursively, enter the command:

bgget -r file/path

and once you've finished queuing files, type:

bgstart

to begin the transfer and NCFTP will go ahead and download all your queued files.

A while ago I wrote a post about using the basic ftp command to recursively fetch remote FTP files, it seems this doesn't completely fetch them recursively. A great little program called NCFTP will do this accurate and pretty quickly. Install NCFTP if you haven't already, then run the program…

Read More