Process PayPal Express Checkout for third parties

Today I needed to find out how to process PayPal Express Checkout transactions for third parties. PayPal allows merchants to give permissions to other merchants to perform transactions on their behalf, without having to hand over their private API username, password and signature. While we have implemented Express Checkout for ourselves, I couldn’t find out how to perform the transaction on behalf of another merchant until I found this useful post.

To quote from the link above:

Yes, you specify an alternate “SUBJECT” of the transaction.

Normally your SetExpressCheckout request looks something like:

METHOD=&VERSION=&PWD=&USER=&SIGNATURE=&...

Now it will look like this:

METHOD=&VERSION=&PWD=&USER=&SIGNATURE=&SUBJECT=...

Payee_PayPal_Account is the email address/username the user uses to log in.

(Note that email address/username is NOT the API username of the account.)

Thanks Jeremy!

Edge on Windows 10 opens and closes immediately

I had a problem with the Edge browser only a day after doing a clean install of Windows 10. When I tried to open it it would open, sit on the screen with the big blue background and the “e” logo, and then disappear about 4 second later. I was able to fix it by following the below steps:

First delete the Edge folder. The path:
C:\Users\%username%\AppData\Local\Packages\Microsoft.MicrosoftEdge_8wekyb3d8bbwe

Then Launch Powershell as and run the following command:
Get-AppXPackage -Name Microsoft.MicrosoftEdge | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml" -Verbose}

Hit enter and once the command is executed try opening Edge again.

For me it worked without having to restart, but the place where I found these instructions suggested restarting a couple of times. Here is original article I found.

Also, I ran the command without the -AllUsers parameter, not sure if that was why I didn’t have to restart.

Hope that helps someone!

Allowing Apache to listen on a different port with SELinux

I wanted to set up a virtual host in Apache today using a different port than the standard but kept getting a permissions error when I tried to start Apache. The problem turned out to be SELinux not allowing the port to be used. In order to fi it I just needed to add the port as one of the allowed ports for Apache.

For example, to allow Apache (httpd) to listen on port 12345 the command is

# semanage port -a -t http_port_t -p tcp 12345

How to enable the Active Directory Schema Snap-in

When installing a Windows Server 2012 server to replace an old Server 2008 I needed to access the Active Directory Schema Snap-in but it didn’t appear in the Microsoft Management Console list. It seems that the DLL for it isn’t registered with Windows so you need to do that first. You simply need to do Start > Run > regsvr32 schmmgmt.dll > and then click OK.

After you do that the option should appear in the Add or Remove Snap-ins list withing Microsoft Management Console.

Find files modified between two dates on Linux

Older versions of find don’t support the -newermt predicate, so you cannot use it. As a workaround, you could use the -newer predicate. That predicate needs a file as a reference: instead of an absolute modification date, it will use the modification date of the file. You can create appropriate “marker files” for this purpose, for example:

touch /tmp/mark.start -d "2013-12-19 00:00"
touch /tmp/mark.end -d "2013-12-16 00:00"

And then rewrite using -newer predicate:

find /some/path -newer /tmp/mark.start

To find between dates the exclamation is the equivalent of “not” so do this:

find /some/path -newer /tmp/mark.start ! -newer /tmp/mark.end

MySQL Workbench SSH private key connection error

I had a problem getting connections to MySQL using TCP/IP over SSH working. I wanted to use a private key instead of saving a password for the SSH connection, but I kept getting an error message:

Authentication error. Please check that your username and password are correct and try again.
Details (Original exception message): Authentication failed, please check credentials.
Please refer to logs for details

The problem was that I was using a PPK file instead of an OpenSSH file. The solution is to open PuttyGen, load your PPK file and convert it to an OpenSSH key.

Problem solved!

Tuning Apache

I was updating the Apache configuration on a new CentOS Linux server today and trying to update the tuning parameters such as MinSpareServers. No matter how many times I changed them and did apachectl restart I couldn’t get them to take affect.

Eventually I remembered that changing these settings requires a stop & start, rather than just a restart!

apachectl stop; apachectl start

Clear scrollback in Putty

When I’m running commands with a lot of output via an SSH shell (I use Putty) I like to have a long buffer and scroll back through the output. However, if I’ve already run a lot of other commands then it’s difficult to see when the output of the last command started. I found a useful printf sequence that can be used to clear the buffer in Putty (can’t remember where I found it I’m afraid…).

vi ~/bin/clearandrun

Enter the script below:

#!/bin/bash
clear && printf '\033[3J';
$*

Then chmod +x ~/bin/clearandrun and you can now precede any command with clearandrun to clear the screen and scrollback before running the command.

Percona Toolkit on CentOS

I wanted to install Percona Toolkit on a CentOS machine today but the download comes as an RPM. Percona make it easy to install it with Yum however by adding their repo. To do it do:

64 bit:
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.x86_64.rpm

32 bit:
# rpm -Uhv http://www.percona.com/redir/downloads/percona-release/percona-release-0.0-1.i386.rpm

and then you can simply do

# yum install percona-toolkit

Thanks Percona!

Unable to access DFS redirection shares

We had a problem today on our Windows 2008 Server installation where most shares under a DFS namespace were accessible correctly, but all shares which were hosted on a physically different server, using DFS redirection, were unaccessible.

The message the client received was the typical message about being unable to access the share, please check with your system admin, etc., and then at the end said:
“The file cannot be accessed by the system.”

It turned out the solution was simply a case of restarting the DFS Namespace service on the server hosting the namespace. I don’t know why this happened but we had restarted the Windows server hosting DFS a few times recently due to hardware problems so I presume it somehow lost contact with the other server.