Benjamin de Jong

My name is Benjamin de Jong. I am working for a KPN and Doorbetalers.I have created this website to document my own technical adventures. I like to develop tools in PHP, C#, WordPress and Arduino/ESP8266/Wemos for Home automation, Financial usage and Life Hacking.

Zcash wallet backup addresses

I am busy mining Zcash. And of course, I want all this work to be safe and was thinking of a backup strategy. In my case I wanted not to export my complete wallet because some mining actions created a lot of t-addresses. So I chose to use the export of separate addresses. I have used this page with handy commands: https://github.com/zcash/zcash/blob/master/doc/payment-api.md

On the system with the original wallet I typed:

zcash-cli dumpprivkey t1dBkMCPvLKcQ3gDfG8MiZLvdQk4D9Z6pD

The return value is (fake of course): jKd9o4FY7mdgQ3gDfG8MiZLvdQga8JK3t58yjXGjQHzMzkGUxS

On the system I want to have this address in my new wallet I typed:

zcash-cli importaddress t1dBkMCPvLKcQ3gDfG8MiZLvdQk4D9Z6pD

zcash-cli importprivkey jKd9o4FY7mdgQ3gDfG8MiZLvdQga8JK3t58yjXGjQHzMzkGUxS

After a few hours, all transactions of this address were replicated to my new wallet. Tada!

Please note: You have to be sure that all funds are in this address. To make sure you have backupped the correct addresses, run:

zcash-cli listaddressgroupings

Your Tables

This plugins lets you define forms in the admin area for existing tables in your WordPress database.


Contributors: zerotop
Donate link: http://www.benjamindejong.com/your-tables
Tags: mysql, forms, table, crud
Requires at least: 3.1.0
Tested up to: 4.5.2
Stable tag: 1.0.0
License: GPLv2 or later (http://www.gnu.org/licenses/gpl-2.0.html)


Description

This plugins lets you define forms in the admin area for existing tables in your WordPress database.

The creation of forms to Create, Update and Delete records is a lot of work. This plugin lets you define the tables and its fields and generates the form for you. The definition of your tables and fields is done in the ‘Your Tables’ and ‘Your Table Fields’ items in the ‘Your Tables’ menu. This functionality is created using the Table definition functionality of this plugin itself. Drink your own Champagne!

These are its features:

  • Manage all tables in your WordPress database in the admin area
  • Create, Update and optionaly Delete records
  • Textbox, Dropdown, List, Radiobox, Checkbox, Date and Textarea support
  • Dropdown, List and Radioboxes can be filled with predefined values or with an SQL query that results in 2 columns (value,label)
  • Use one or more primary keys to select the correct record in your tables
  • Define what roles can use the tables
  • Optionaly change the functionality of the Table and Field definition forms
  • Language support (Currently English and Dutch language is available. We’re looking for translators!)

Request: Currently English and Dutch language is available. If you want to translate for us we will add your name here:

  • English translation: Benjamin de Jong
  • Dutch translation: Benjamin de Jong

Installation

This section describes how to install the plugin and get it working.

From your WordPress dashboard:

  • Visit ‘Plugins > Add New’
  • Search for ‘Your Tables’
  • Click ‘Install now’
  • Activate it after installation
  • Make the functionality available for other roles if needed using ‘Your Tables Settings’ under the WordPress Settings menu.

From WordPress.org:

  • Download ‘Your Tables’.
  • Upload the ‘your-tables’ directory to your ‘/wp-content/plugins/’ directory, using your favorite method (ftp, sftp, scp, etc…)
  • Activate Your Tables from your Plugins page
  • Make the functionality available for other roles if needed using ‘Your Tables Settings’ under the WordPress Settings menu.

Screenshots

  1. An example of the list of records you can edit in a table
    An example of the list of records you can edit in a table
  2. An example of an edit form your a record in your table
    An example of an edit form your a record in your table
  3. The definition form for one field of your table
    The definition form for one field of your table

Changelog

1.0.0

  • Created the initial version

Flashing an ESP8266 ESP-14

When I was ordering new ESP8266 modules, I ordered ESP8266 ESP-14 modules in a rush. When I received them, I saw the port layout was very different. After some research I found out that the ESP8266 ESP-14 is a STMicro STM8S003F3P6 combined with a Expressif ESP8266-EX WiSoC. At page 25 of the STM8S003F3P6 manual you can see that it designates port M_PD6 as RX and M_PD5 as TX. I also noticed that the ESP was controlled via the Serial interface and the ESP RX and TX ports have to be connected vise versa for that.

Schematic for connecting the ESP8266 ESP-14

To flash the ESP-14 just use M_PD5 as RX, M_PD6 as TX, connect ESP_GPIO0 with a 10K resistor to 3.3v, connect ESP_VDD to 3.3v and connect GND. In my experience you have to create a soldered programmer with an external power supply that delivers 1A.

ESP8266 ESP-14 Flashing Scheme

Software for flashing the ESP8266 ESP-14 – Arduino IDE

If you are using the Arduino IDE, make sure you are on version 1.6.5 and you have added http://arduino.esp8266.com/staging/package_esp8266com_index.json in the preferences at ‘Additional Boards Manager URLs’. You can use these settings for flashing:

ESP8266 Flash Settings

Example code for the the ESP8266 ESP-14

Then, you can use this code to test if its working

After flashing the ESP8266 ESP-14, disconnect the 3.3v from ESP_GPIO0 and reboot the module, while remain the Serial Connection connected to your computer. You will see the Tick-Tack now.

Errors

If you get errors or your module keeps rebooting, please check:

  • your power supply, does it really deliver enough current?
  • your wiring, are the cables tightly connected?
  • your breadboard, in my experience, breadboards do not work for flashing an ESP8266 because of its poor connection surface

More information

I have used these sources to write my article:

 

Pilot: Biblija Display Verse

This page contains the demo for a new plugin I am creating. Currently I have build a pilot version to get permission of Biblija.net to continue the development of this WordPress Plugin.

The aim of the plugin is to make it easy to display Bible verses in your blog. You don’t have to type them over, but you can add a shortcode to let it be displayed automatically. The bible verses will be downloaded from Biblija.net. A copyright notice and a link to the same piece on Biblija.net will be included also

Currenly I have built the following functions:

  1. Show maximum one chapter
  2. choose from all bible translations and languages available on Biblija.net
  3. a caching system. This make sure that the Biblija.net website will not be flooded with requests. The query outcome will be cached for one week

Examples

Shortcode: [Biblija_Display trans=”web” query=”gen 1″]:

Genesis 1
  In the beginning God created the heavens and the earth.   Now the earth was formless and empty. Darkness was on the surface of the deep. God’s Spirit was hovering over the surface of the waters.   God said, “Let there be light,” and there was light.   God saw the light, and saw that it was good. God divided the light from the darkness.   God called the light Day, and the darkness he called Night. There was evening and there was morning, one day.   God said, “Let there be an expanse in the midst of the waters, and let it divide the waters from the waters.”   God made the expanse, and divided the waters which were under the expanse from the waters which were above the expanse, and it was so.   God called the expanse sky. There was evening and there was morning, a second day.   God said, “Let the waters under the sky be gathered together to one place, and let the dry land appear,” and it was so. 10   God called the dry land Earth, and the gathering together of the waters he called Seas. God saw that it was good. 11   God said, “Let the earth put forth grass, herbs yielding seed, and fruit trees bearing fruit after their kind, with its seed in it, on the earth,” and it was so. 12   The earth brought forth grass, herbs yielding seed after their kind, and trees bearing fruit, with its seed in it, after their kind: and God saw that it was good. 13   There was evening and there was morning, a third day. 14   God said, “Let there be lights in the expanse of sky to divide the day from the night; and let them be for signs, and for seasons, and for days and years; 15   and let them be for lights in the expanse of sky to give light on the earth,” and it was so. 16   God made the two great lights: the greater light to rule the day, and the lesser light to rule the night. He also made the stars. 17   God set them in the expanse of sky to give light to the earth, 18   and to rule over the day and over the night, and to divide the light from the darkness. God saw that it was good. 19   There was evening and there was morning, a fourth day. 20   God said, “Let the waters swarm with swarms of living creatures, and let birds fly above the earth in the open expanse of sky.” 21   God created the large sea creatures, and every living creature that moves, with which the waters swarmed, after their kind, and every winged bird after its kind. God saw that it was good. 22   God blessed them, saying, “Be fruitful, and multiply, and fill the waters in the seas, and let birds multiply on the earth.” 23   There was evening and there was morning, a fifth day. 24   God said, “Let the earth bring forth living creatures after their kind, cattle, creeping things, and animals of the earth after their kind,” and it was so. 25   God made the animals of the earth after their kind, and the cattle after their kind, and everything that creeps on the ground after its kind. God saw that it was good. 26   God said, “Let us make man in our image, after our likeness: and let them have dominion over the fish of the sea, and over the birds of the sky, and over the cattle, and over all the earth, and over every creeping thing that creeps on the earth.” 27   God created man in his own image. In God’s image he created him; male and female he created them. 28   God blessed them. God said to them, “Be fruitful, multiply, fill the earth, and subdue it. Have dominion over the fish of the sea, over the birds of the sky, and over every living thing that moves on the earth.” 29   God said, “Behold, I have given you every herb yielding seed, which is on the surface of all the earth, and every tree, which bears fruit yielding seed. It will be your food. 30   To every animal of the earth, and to every bird of the sky, and to everything that creeps on the earth, in which there is life, I have given every green herb for food.” And it was so. 31   God saw everything that he had made, and, behold, it was very good. There was evening and there was morning, the sixth day. 
Distribution and updates: www.ebible.org - from Biblija.net

Shortcode: [Biblija_Display trans=”nbg” query=”joh 3:16-17″]:

- from Biblija.net

The future

When I get permission of Biblija.net I will make it available on WordPress.org as a free plugin and I will add the following functionality to it:

  1. More styling options for displaying the verses
  2. Documentation on how to use it
  3. default settings like translations and languages
  4. Configurable caching
  5. more tight restrictions on some translations (like Dutch translations, no more than 50 verses of max 50% of a chapter etc)

If it is a succes, maybe there are options to build a premium version also 🙂

Unexplainable redirect in WordPress

I manage more than 20 WordPress sites. At one of my sites, one of the pages was redirecting to the homepage. I couldn’t find out why and had to spend many hours to find it. I did the following:

  • I disabled all plugins and tried again. No success
  • I checked out the .htaccess file to find redirection rules. No success
  • I copied the site to a test location, and removed all the plugins. No Success
  • I removed all non WordPress-core tables. No Success
  • I opened up the wp-options table, and removed all non WordPress-core records. No Success
  • I banged by head against the wall, and teared out all my hair. No Success
  • I removed all pages and posts, except for my home page and the post that wouldn’t load. No Success
  • I downloaded a WordPress database cleaner and cleaned up all revisions and garbage. No Success.

Can you believe I was crying a 1000 tears?

Now my database was super clean. So I checked out the wp-posts tables. There is a field ‘post_name’. The post_name of my homepage had the same name as the post that wouldn’t load. After I changed that name, everything worked OK!

My lessons: When WordPress processes a URL, it loads all posts with the name in the URL and redirects to the first one. When there are more posts with that name, you can get undesired results 🙁

My questions: How can I see this in the WordPress Admin interface? I couldn’t find it and because of that, couldn’t change it. I’m I the only one?

Control Arduino ports via Serial communication

I need to control some wall outlets to turn them on or off at different moments in the day. I will use this to control the events in the fish tank of my wife. To tell the Arduino when to turn on or off ports, which are connected to relays, I have a PHP script that sends commands to the COM port which is connected to the Arduino.

The commands that I am sending are: 3:255&4:0&8:180. This puts the level on the analog port 3 (C02 gas) on the maximum, turns port 4 (bubbles) off and puts port 8 (Lights) at level 180. During the day, different values are sent.

This is the Arduino script that is behind this:

 

Howto replace the KPN Experia Box v8 with an Asus RT-AC66U

I am using a KPN 100Mb/100Mb fiber connection at home. I am very happy with it, except for the KPN Experia Box v8. I bought a Asus RT-AC66U Gigabit router to replace it. When I bought it, a year ago, it was in the top of all Gigabit router charts.

First I tried to replace the KPN Experia Box by using the pre installed firmware on the Asus RT-AC66U. That didn’t work. Then I tried to use DD-WRT, and after a lot of tweaking, it worked almost. My phone and TV worked OK, but my Internet connection didn’t. After rebooting, I lost a lot of settings.

Then I found the solution. I installed Tomato Version 1.28 by shibby, Tomato Firmware 1.28.0000 MIPSR2-121 K26AC USB AIO-64K to be exact. You can download it at Tomato.Groove.pl/download. This version does everything what is needed, and it is a lot faster than all other firmwares available (faster in saving and activating settings). Please note: Your KPN Experia Box will still be needed when you are using an analog phone line!

This is the install instruction you can follow. Connect your PC directly to one of the LAN ports of the Asus device.

1. First install the firmware. I assume that you can find out this yourself.

2. Write down the MAC address from your KPN router. You will need this here.

3. Login on the router, mostly on http://192.168.1.1/ with username root and password admin (my suggestion is that you change that password right away)

4. Change the basic network settings

  • Choose type “PPPoE”
  • Choose username “XX-XX-XX-XX-XX-XX@direct-adsl” where XX-XX-XX-XX-XX-XX is your Mac Address from your KPN Router
  • Choose password “KPN”
  • Fill in the settings at the LAN Settings (see the screenshot for a working suggestion). The “IP Address” you are using will be needed later. (I am using this IP settings because I can switch back to my old setup fast when needed)
  • Click “Save”

Wan-Internet

5. Clone your Mac Address

  • At “WAN Port”, fill in the MAC Address from your KPN Router, use this format: “XX:XX:XX:XX:XX:XX”, and click “Save”

MAC-Address

6. Reboot your router, wait for a minute or 3, and logon again, now using the IP Address you earlier added at the “LAN” section of the “WAN/Internet” screen. In my case: http://192.168.2.254

7. Setup your VLAN Settings, using the exact settings in the picture below, and click “Save” after adding the settings.

Vlan

8. Now you can shutdown your router, using the menu.

9. Connect your router, and please note that the ports displayed on the screen are in the opposite order (so 1=4, 2=3, 3=2 and 4=1)

  • The UTP cable from your Fiber Modem goes into the WAN port
  • On port 4 (port 1 in the picture above) you connect your TV device
  • On port 3 (port 2 in the picture above) you connect your KPN router (to the WAN connection on the KPN router)
  • On port 2 (port 3 in the picture above) you connect your Internal Network
  • On port 1 you can add an extra TV device if needed.

10. Now turn on your router and enjoy! You can change all other settings now, like Wireless, port forwards etc!