Wednesday, 25 May 2016

Android Pay NFC - Please present one card only - Samsung Galaxy S5 with wireless charging

I recently got Android Pay for on my S5 Galaxy and have had a lot of problems trying to make payments with it.

It had only just rolled out int he UK, and I thought that the problem was that it was just to new however after a while I decided that something more must be going on as the payments kept failing witht he same rror:

"Please present one card only"

After thinking it over, I realised that I had custom fitted a wireless charger to the inside of my S5 and decided to remove it and try again.

And that fixed it - the wireless charging unit in the phone must have been interfering with the NFC chip and making the terminal unable to read it

I hope it helps someone :)

Tuesday, 29 March 2016

Wordpress All Import (WP All Import) WooCommerce - 403 Forbidden when importing

Continuing my Wordpress work, I needed to import a large amount of data into a Woo Commerce based store so decided to use WP All Import with the Woo Commerce add on to do this.

However, when I tried to import from my first CSV I kept getting a 403 Forbidden error. Naturally, I assumed that i'd done something wrong with the .htaccess access file but all seemed OK.

I decided to check the settings, and made a minor change of no consequence but when I tried to save it I again received the 403 Forbidden error.

Now realizing that it wasn't something to do with the import itself, but rather the plugin I turned to the support forums and setup guides for help - but nothing seemed to mention this.

Looking around the settings page, I this time noticed a box  called "Add port to URL" which allows you to change port that your webserver uses. I do all of my development work on a server running Apache on port 8080 and suddenly my problem was clear - the plugin wasn't capable of changing ports, it had to be informed of the port the web-server was using.

After enter 8080 in the box and saving the settings (which actually saved this time!) everything started to work as expected.

Wednesday, 23 March 2016

WordPress, Contact Form 7 and recpatcha causing "failed to send your message" when submitting forms

I've recently started using the recaptcha plugin for contact form 7 in my WordPress sites. When I made a recent site live, none of the forms were sending.

Upon investigation, the issue was related to having the recaptcha present on the form as if I removed it they would send straight away.

When I originally added it I remember setting up the API key and yet it still wasn't working. On closer examination, the secret key was wrong and resetting the API keys solved the issue.

The reason the key was wrong is because when you highlight the secret key on Googles API page and copy and paste it, it doesn't just select the key - it takes the text description of it too! So you end up pasting the key with extra text at the end which I never noticed when originally adding it.

Bottom line - if the form won't submit and you've got recaptcha running I would double check your API keys as you may have made the same mistake as me :)

One more thing to remember (although not directly related to the above) is that the codes for the contact form objects, such as  [your-name] are case sensitive! So [your-name] is not the same as [Your-Name]


Wednesday, 30 September 2015

Sage Payroll Trying to Update instead of Install - Looking for Payroll Module - Updated for v29 2023

I recently had a PC which had Sage Payroll installed but then removed. A new copy had been downloaded and whenever it was ran it tried to update instead of install.

It seems that the payroll installer seems to think that its still present, so instead of starting the installer it starts the update and eventually crashes out.

to sort this, you need to remove a few left over files/folders from when the software was uninstalled.

Firstly, go to the program files and program files (x86) folders on your main drive (if present) and look for the sage payroll folder - if you find it, remove it.

Secondly, do the same in your program data folder - find and remove the sage payroll folder (not accounts!)

Finally, look in c:\windows\ for a payroll.ini file - also remove ths

And that's it, the installer will now run instead of the updates.

Thursday, 13 August 2015

Windows 10 Wireless missing 5GHZ networks (TL-WDN3200 N600 TP-LINK)

After upgrading to Windows 10 on my home PC, I realised that it was no longer able to connect to my 5ghz network using my TL-WDN3200 dongle. The wireless network list didn't even display it.

On further investigation i decided it must be a driver issue, so i went over to the TP-LINK website and downloaded the latest driver set (for Windows 8.1 x64 as at the time of writing there were no Windows 10 drivers available). I installed the drivers, but the network still didn't appear.

Upon closer inspection I identified that the USB dongles chipset maker was Mediatek, so I headed off to their website and downloaded their drivers.

Straight after installing, I had access to my 5ghz network again. Must be a bug or inconsistency with the tp-link/builtin/windows 10 drivers

The URL for the mediatek drivers is: http://www.mediatek.com/en/downloads1/downloads/usb/

-- Update April 2016 --

TP-Link still haven't got this sorted yet and there are lots of complaints about it on their forums. They have released a Windows 10 compatibility list here: http://www.tp-link.com/en/article-15587.html but it doesn't look like the WDN3200 is going to get a new driver in the near future!

Tuesday, 4 August 2015

Windows 10 upgrade - setup has failed to initialize the working directory

I recently updated a ASUS Transformer tab to Windows 10 but during the update process recieved the following message:

setup has failed to initialize the working directory

After looking into the problem, I was able to determine that it was related to the amount of free space on the drive (the Transformer only has a 32gb SSD and I had less than 7GB free)

I cleared some space (just over 10GB) and re-ran the update without issue

Hope it helps someone

Update: 
When you do finally get past this error, if you don't have over 10GB free the update will ask you to either free up more space or plug in an external USB HDD - which is what I did to get around this. Once the update was complete and you definitely didn't need to rollback you can wipe the external.

Friday, 3 July 2015

Error with PHP mail(): Multiple or malformed newlines found in additional_header

A new update for PHP has broken a few mailing scripts that a few of our clients use (https://bugs.php.net/bug.php?id=68776)

More specifically, the script sends an email with an attachment - I wrote these using some guides from other sites however it now appears that i've been ill advised as its not technically the correct way to do it.

Original (now broken code) below:

function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
    $file = $path.$filename;
    $file_size = filesize($file);
    $handle = fopen($file, "r");
    $content = fread($handle, $file_size);
    fclose($handle);
    $content = chunk_split(base64_encode($content));
    $uid = md5(uniqid(time()));
    $name = basename($file);
    $header = "From: ".$from_name." <".$from_mail.">\r\n";
    $header .= "Reply-To: ".$replyto."\r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
    $header .= "This is a multi-part message in MIME format.\r\n";
    $header .= "--".$uid."\r\n";
    $header .= "Content-type:text/plain; charset=iso-8859-1\r\n";
    $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
    $header .= $message."\r\n\r\n";
    $header .= "--".$uid."\r\n";
    $header .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n";
    $header .= "Content-Transfer-Encoding: base64\r\n";
    $header .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
    $header .= $content."\r\n\r\n";
    $header .= "--".$uid."--";
error_reporting(E_ALL);
    if (mail($mailto, $subject, "", $header)) {
        echo "Mail Sent Successfully to " . $mailto ."<br/>"; // or use booleans here
    } else {
        echo "Mail NOT Sent to " .$mailto ."<br/>";
    }

There are now more checks on the header field, which means data which was being stuffed into the header should now really be in the message. See the changes I made to get this working with our webservers (highlighted in yellow):

function mail_attachment($filename, $path, $mailto, $from_mail, $from_name, $replyto, $subject, $message) {
    $file = $path.$filename;
    $file_size = filesize($file);
    $handle = fopen($file, "r");
    $content = fread($handle, $file_size);
    fclose($handle);
    $content = chunk_split(base64_encode($content));
    $uid = md5(uniqid(time()));
    $name = basename($file);
    $header = "From: ".$from_name." <".$from_mail.">\r\n";
    $header .= "Reply-To: ".$replyto."\r\n";
    $header .= "MIME-Version: 1.0\r\n";
    $header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
(THIS ENTIRE LINE HAS BEEN REMOVED)
    $nmessage = "--".$uid."\r\n";
    $nmessage .= "Content-type:text/plain; charset=iso-8859-1\r\n";
    $nmessage .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
    $nmessage .= $message."\r\n\r\n";
    $nmessage .= "--".$uid."\r\n";
    $nmessage .= "Content-Type: application/octet-stream; name=\"".$filename."\"\r\n"; 
    $nmessage .= "Content-Transfer-Encoding: base64\r\n";
    $nmessage .= "Content-Disposition: attachment; filename=\"".$filename."\"\r\n\r\n";
    $nmessage .= $content."\r\n\r\n";
    $nmessage .= "--".$uid."--";
error_reporting(E_ALL);
    if (mail($mailto, $subject, $nmessage, $header)) {
        echo "Mail Sent Successfully to " . $mailto ."<br/>"; // or use booleans here
    } else {
        echo "Mail NOT Sent to " .$mailto ."<br/>";
    }

}

And that sorted it out - I hope this helps someone as I had a hell of a time trying to work out what the error message meant and its been pretty vague. Add to this the comments on the PHP bug fix page which aren't that helpful and its quite difficult to sort out. Please +1/share this if it helps you so it can help others