Windows device error Code 52

After loosing my PC audio (the device just disappeared from the list of playback devices) I checked device manager to find the following error:

Windows cannot verify the digital signature for the drivers required for this device. A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source. (Code 52)

It turned out to be currpt system files, the fix for me was to run checkdisk on my local C drive. It found errors, fixed them and then my audio was working again.

Right click your main C drive and select properties, then the tools tab.

error-check

 

Click Check now and select both options.

error-check-options

 

A message will appear to say that it cannot run it now but can schedule it for boot, so go ahead with that and reboot your machine.

error-checking-schedule

 

Hopefully after the scan has finished things will be better.

 

Decent and cheap hosting & domains based in the UK

I’ve always had good experiences with TSO Host so I thought I’d suggest them as a good place to get started on your own web development.

They’re UK based (great for me) and all their tech support staff are as well, which is great. I’ve added a referral link above for anyone that wants to use them and possibly help me out too.

Hope that made someone’s hosting search a little easier ūüôā

Laravel routes not working

If your main Laravel page is working but no other routes are then this may be of use to you.

My doc root is here:

/var/www/html/quickstart/public

Firstly enable mod rewrite:

sudo a2enmod rewrite

Then check your routes that weren’t loading, if it works great! If not, then read on.

Edit your default apache site conf file:

sudo gedit /etc/apache2/sites-enabled/000-default.conf

Mine is below:

<VirtualHost *:80>
    ServerName localhost
    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/quickstart/public
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    <Directory "/var/www/html/quickstart/public">
        Allowoverride All
    </Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

That worked for me on Ubuntu, hope it helps someone.

I have been trying out laravel and intend to use it for some projects in the future but I’ve been finding it very frustrating to get it installed and running. The homstead vagrant setup they have just simply doesn’t work and this is the second time I’ve tried it over the past 3 months, so it wasn’t a passing bug. I’ve only ever got laravel up and running on Linux by¬†setting it up manually and never got it working on windows. Hopefully after a few fresh installs I’ll have it down to a few nice steps and I’ll write those up =)

How to link to a section of same webpage

If you need to click an item on your page and then have it automatically scroll you to the correct location on the page then this is how you could do it:

There are two things you need:

1. A link pointing to another section of the page. (where you click)

<A HREF="#mysection">Click me to jump to blah!</A>

2. The point where the reference points to. (the part of the page you get scrolled to)

<A NAME="mysection">

… and that’s it, nice and simple!

Watchdog Script

I was looking  for a script to monitor a process and restart it if it failed on Linux, so here is a watch dog script that I found on SO, here: http://stackoverflow.com/a/16787862/4028210

The script will watch a process and restart it if it is not running.

The script

#!/bin/sh

PROCESS="$1"
PROCANDARGS="<YOUR PROCESS AND ARGS>"

while :
do
    RESULT=`pgrep ${PROCESS}`
    if [ "${RESULT:-null}" = null ]; then
        echo "${PROCESS} not running, starting "$PROCANDARGS
        $PROCANDARGS &
    else
         echo "running"
    fi
    sleep 10
done

 

Usage

Let’s say the script is named “wdt.sh”

make sure it is executable:

chmod +x ./wdt.sh

As an example we’ll keep gedit running, run it as below:

./wdt/sh gedit

Installing Jira on AWS

Jira is a widely used issue tracker, among other things. Below is a set of steps to get it up and running on an AWS server (Amazon’s Web Services).

NB: Do not try to install Jira on the free tier AWS servers, they are simply not powerful enough and run out of memory during installation. I found out the slow and tedious way!

Continue reading Installing Jira on AWS

Setup git Repo

Some useful reference steps for setting up your git repo. Works on both Linux and Windows command line, just note that the¬†“touch README.md” won’t work on windows, just create a new txt file instead.

Setup your name and email

git config --global user.name "name"
git config --global user.email "blah@example.com"

Create a new repository

mkdir my-project
cd my-project
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@example.com:example/my-project.git
git push -u origin master

Push an existing Git repository

cd existing_git_repo
git remote add origin git@example.com:example/my-project.git
git push -u origin master

Arduino IsNumeric Function

I needed an “IsNumeric(string)” function for some Arduino code I’m writing and couldn’t find one in the libraries so I thought I’d share mine:

EDIT: updated version:

boolean isNumeric(String str) {
    unsigned int stringLength = str.length();
 
    if (stringLength == 0) {
        return false;
    }
 
    boolean seenDecimal = false;
 
    for(unsigned int i = 0; i < stringLength; ++i) {
        if (isDigit(str.charAt(i))) {
            continue;
        }
 
        if (str.charAt(i) == '.') {
            if (seenDecimal) {
                return false;
            }
            seenDecimal = true;
            continue;
        }
        return false;
    }
    return true;
}
boolean isNumeric(String str) {
    for(char i = 0; i < str.length(); i++) {
        if ( !(isDigit(str.charAt(i)) || str.charAt(i) == '.' )) {
            return false;
        }
    }
    return true;
}

There are a few tweaks that should be added (such as counting decimal points as this would currently except 12.34.56 which is clearly not a valid number), this is a good starting point however. Done.

Hope that’s useful for someone!