OpenVPN connects to VPN but no internet

For those stumbling down a similar path…

tldr; Check that your Windows Firewall is turned off.

My setup

• OS: Windows 8.1 64-bit laptop
• OpenVPN: OpenVPN 2.3.4 x86_64-w64-mingw32

My OpenVPN has been working for at least 4 months without problem.

First thing to remind yourself is: When you get the VPN working – copy the OpenVPN log of a successful connection and the ipconfig /all to file so that you know what to compare when it breaks next time.

Notes

• The VPN connection stopped working yesterday 17/10/2014
• Not exactly sure when
• It had been working at my office
• My Windows 7 desktop has a working VPN setup so I can compare the settings
• The OpenVPN gui suggests a connection has been made but no sites can be pinged (see commands below)
• All attempts at inconfig /renew, ipconfig /flushdns nothing worked
• Only differences between Desktop/Laptop I could find in ipconfig /all and OpenVPN logs was that laptop had IPv6 for the WiFi connection turned off and the following extra fail message UDPv4: No Route to Host in the log
• I tried turning IPv6 back on but that didn’t change anything
• Now the UDPv4 message disappeared – but didn’t reappear when I turned off IPv6 again – so that was a red herring
• Possible suggestion from my history when first setting up my VPN (http://www.rickygao.com/troubleshooting-general-failure-in-ping-or-tracert/) was to turn off IPv6 which is what I’d probably done before – but IPv6 is no problem on my Windows 7 desktop
• Pinging even a specific IP address does not work – this confirms its not a DNS issue
• Pinging localhost 127.0.0.1 does work
• Pinging the IP Address of the connected VPN does work
C:\Users\Ian>tracert google.com
Unable to resolve target system name google.com.

Ping request could not find host google.com. Please check the name and try again.


Solution

Eventually found a solution that was to turn off the windows firewall, which came from this unbuntu forums post which eventually spotted that it was an iptables firewall issue.

Post mortem

• I thought I’d turned off my firewall and it doesn’t explain why the VPN stopped working
• Best guess is a Windows update changed something in the firewall the caused the problem
• A failed update for Windows Malicious Software Removal Tool for Windows 8, 8.1 and Windows Server 2012, 2012 R2 x64 Edition - October 2014 (KB890830) – this was successfully installed the next day but didn’t help
• A successful Definition Update for Windows Defender - KB2267602 (Definition 1.185.3528.0)

Google Docs to Markdown to WordPress

I’ve started a fairly standard process of writing a Google Doc when I’m trying to learn something technical that I don’t understand and then if its half useful posting it to WordPress.

I know I could then copy paste the code from there to WordPress – but I’m a fan of writing WordPress posts in Markdown. For one reason, I need to switch all the titles to be one level lower in WordPress than Google Docs and its simpler to do that in Markdown. Also and code I put into Courier font in Google docs gets converted to code in Markdown, but gets lost when copying and pasting.

So I’ve found that there’s a script to export Google Docs. There is an annoying issue in that you have to re-do the steps everytime you want to export a document to Markdown. Upon running the script from the Script Editor you get emailed a markdown version of your document.

Then copy & paste the markdown syntax into WordPress.

Windows Netbeans Composer notes

This is for installing the main packages that Netbeans suggests in the Tools > Options > PHP (tab)

I’m running the following setup currently:

• Windows 8.1 (64-bit)
• Netbeans 8.0.1
• The version of Composer doesn’t really matter

Global packages

running composer global installs the packages into %APPDATA%\Composer (or ~/.composer/ in Linux)

PHPUnit

From the installation instructions (https://phpunit.de/manual/current/en/installation.html) do:

composer global require "phpunit/phpunit=4.3.*"

This installs PHPUnit to C:\Users\[username]\AppData\Roaming\Composer\vendor\phpunit and puts the binary to use in Netbeans in C:\Users\[username]\AppData\Roaming\Composer\vendor\bin\phpunit.bat

Skeleton Generator

From the installation instructions (https://github.com/sebastianbergmann/phpunit-skeleton-generator) run:

composer global require 'phpunit/phpunit-skeleton-generator=*'

PHP_CodeSniffer

composer global require "squizlabs/php_codesniffer=*"

Then put C:\Users\[username]\AppData\Roaming\Composer\vendor\bin\phpcs.bat into Netbeans Tools > Options > PHP (tab) > Code Analysis (tab)

apigen

composer global require apigen/apigen:~2.8

Then put C:\Users\[username]\AppData\Roaming\Composer\vendor\bin\apigen.bat into Netbeans

Installing Node.js on Windows 8

Node comes with an installer, but I hit a couple of bugs that knackered my initial attempts to call either node or npm.

I followed the installation instructions trying to run a command for the first time and got 'node' is not recognized as an internal or external command. For anyone else with the same issue here’s what I stumbled through.

I’m running Windows 8.1 (64-bit) with Node v0.10.32.

1. Run the .msi installer
2. This installs it to C:\Program Files\nodejs

In that directory is node.exe for running node commands and npm.bat for installing node modules.

Environment variables

The simplest solution for this is just to do a restart, but for thos who don’t want to aka me…

The installer doesn’t seem to install the environment variables properly (at least it didn’t when I was using windows 8).

So although if you edit the Environment variables you will see that C:\Program Files\nodejs in the path, if you go into a command prompt and type echo %PATH% it doesn’t appear.

I’m not sure why – but I had to make a minor modification to the PATH, save it and then put the modification back for the nodejs to show up in the path.

Then you can run either node or npm from anywhere.

Here’s the code just in case something changes:

var http = require('http');
http.createServer(function (req, res) {
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');


For some reason even though C:\Program Files\nodejs had been added to the system PATH it wasn’t showing up in my path when running dos commands – it took editing the path and saving it to suddenly show up the nodejs in the path.

Once you’ve got the path set up properly then you just have to create the example.js file and run the following commands from a windows command prompt:

> cd C:\path\to\node\example
> node example.js


Getting npm working

1. There is a npm.bat command in C:\Program Files\nodejs
2. However there’s a known npm issue that requires that the %APPDATA%\npm directory has been created manually otherwise npm doesn’t work
3. You’ll get an error along the lines Error: ENOENT, stat 'C:\Users\[username]\AppData\Roaming\npm'
4. So you have to create your own %APPDATA%\npm

N.B. For “dummies”, aka me: where ever you run npm install in the windows command prompt it will create a node_modules directory and install the module under there
e.g.

C:\Users\[username]> npm install grunt


will install grunt into C:\Users\[username]\node_modules\grunt not into %APPDATA% or C:\Program Files\nodejs\node_modules

Aside

rebeccapurple

This site’s background is rebeccapurple, its based on the memory of Eric Meyer’s daughter. I have a daughter of two, so reading his tales of anguish are deeply moving.

Translating WordPress plugins

If you didn’t write the plugin – how do you translate it? I found lots of information for plugin developers to make their plugins translatable but not for people that just want to translate it.

Executive summary / tldr;

Install the Codestyling Localization plugin and it will solve your problems.

If you’re feeling brave try the ‘Blank WordPress POT’ and put that in the plugin’s languages directory.

You’ll lose your translations when the plugin gets updated – so keep backups.

For worker ants who want to know a bit more

1. The plugin must be translatable (It has been internationalized)
1. You can check this by looking through the plugin code
2. Otherwise just carry on and hope that the developer made it translatable
2. Then you need to create a translation file that converts the English words into your language (localize it)
1. A POT (.pot) file is a skeleton file that contains all the words and phrases in the plugin that can be translated
2. A .po file is a .pot file that has had the translated strings in your language added next to each of the translatable phrases
3. When you save a .po file it also generates a .mo file (where as you can read a .po file in notepad you can’t read a .mo file)
3. WordPress plugins rely on .mo files
4. You first need to find the .pot file
1. Typically this will be in the root of the plugin directory
2. Or it will be in a languages directory
3. If you find it, great. Open it in POEdit, do your stuff and save
4. If it hasn’t been created at all …
5. … Then you need to check in the code (look for load_plugin_textdomain in the main plugin file) to see where/if you should create one and create the .pot file yourself

If you don’t know about editing PO files I suggest following the WordPress instructions on using POEdit.

Translation fumbling

POEdit

Initially I tried the POEdit method recommended in WPMU DEV tutorial

However the POT files that I made never worked – they didn’t pick up the translated words. I think it was because of __() and _e() instead of __ and _e.

makepot.php

• WordPress
and Tom McFarlin talk about using makepot.php but its confusing if you’re not using Linux
• It requires using the wp-plugin as the project name which I assumed that you changed to the name of your plugin but you don’t – it has to stay wp-plugin
so the required command is (for windows):

• cd path\to\tools\i18n
• php makepot.php wp-plugin path\to\plugins\your-plugin-name
• However I got the following error when running it from windows
• Actually this had created the your-plugin-name.pot file in the plugin directory but I just didn t realise because of the error
• If you do want to use makepot.php use grapper’s Github i18n repo which includes all the correct WordPress files rather than the official WordPress subversion directories.

POEdit revisited

Hidden at the end of the WordPress localization document is the excellent ‘Blank WordPress POT’.

That can be put in the plugin’s languages directory and has instructions for creating the PO files from it:

The pot file include in this folder is ready to use.

1. Double click on it and open it with poedit
2. In poedit goto File → New Catalog from POT file…
3. Select and Open the pot file from the languages folder
4. Enter your name, email address, your language and country (i.e. french fr_FR, german de_DE) to the setting form
5. Click the update button in the main poedit ui.
6. Save the file :
7. For a plugin like filename-xx_XX.po with xx_XX for your language and country.
8. For a theme xx_XX.po
9. That’s it, go to your WordPress blog and see your translation in action. N’joy your blogging!!!

This actually worked first time that I tried it – i.e. it pulled in all the translated strings.

First off you can then save the file as a my-plugin-name.pot file in the languages directory. Then you can add in your translations and save it with the locale xx_XX.po file ending and that should generate the .mo file that you need too.

Plugins

The simplest route is via the Codestyling Localization plugin.

Once it is installed:

2. Select your locale and it generates an empty .po file
3. Click ‘Rescan’ to populate the .po file
4. Click ‘Edit’ and ‘generate mo file’ to get the .mo file out

None of this solves the problem that you will lose your translation files once when the plugin is updated.

Copy your .po files into the wp-content/languages/plugins directory – which might or might not work. If yes, great, if not raise a support query with the plugin developer (be nice and give details).

If developers follow this Geert DeDeckere’s excellent guide on loading WordPress language files the right way then there shouldn’t be a problem with using the wp-content/languages directory.

One woman can’t have a baby in nine months

Originally posted on A billion monkeys can't be wrong:

As all software developers know, nine women can’t have a baby in a month. Or in Fred Brooks’s more elegant phrasing: “The bearing of a child takes nine months, no matter how many women are assigned.” (The Mythical Man Month, p. 17) The point, of course, is that some tasks are, as Brooks would say, “sequentially constrained”. They’re going to take a certain amount of time no matter what — the time can’t be reduced by having more people work on them.

On the other hand, is it actually the case that one woman can have a baby in nine months? Suppose we have just been put in charge of Project New Baby that must produce a brand new baby in nine months. How should we staff the project. Easy enough — nine women can’t have a baby in a month, right? No point in overstaffing so we’ve…

View original 873 more words