Tips Easy Root Toolkit for OnePlus One

My OnePlus One is already a quite old mobile, but I am still using it at home to play music. I recently reinstall Cyanogen Mod 13 and wanted to root it as this is required to use AirAudio. To avoid doing many manual operations, I looked for a fully automated toolkit and found "Bacon Root Toolkit".

Click to Read More

Highly recommended, it works like a charm!

A demo video exists on YouTube.

Bacon Root Toolkit v1.0.3

TipsWordpress Display standard quotes in a WordPress post

Single and double quotes typed in a post are displayed by WordPress as directionnal quotes: 'blabla' or "blabla" (I.e.: left/right single/double quotes). This becomes an issue when publishing "shell scripts" samples to be copy/pasted. The solution is to type "encoded quotes". Ex.: & #39; for ' or & #34; for " (without the blanks between & and #).

Click to Read More

This is due to the WordPress converting Straight Quotes to Pretty Quotes... a feature also named Smart Quotes and due to a filter running in WordPress: the "wptexturize".

Here after, an example I used to post to illustrate how to send custom notifications from a script running on a Synology. The code was directly copy/pasted here from a shell script opened within Notepad++ (where the quotes appeared as &#39 and &#34).

/usr/syno/bin/synonotify Tag_Name '{"[%VAR1%]": "value1", "[%VAR2%]": "value2"}'

As you can see above, the single and double quotes are displayed by WordPress as symbols: '...' and "...".

The problem is that readers who copied/pasted as-is this sample in their script got execution errors. Indeed, a ' and a &#39 are not interpreted the same way within a shell.

To solve this issue, I did replace all ' and " respectively by & #39 and & #34 (without the blanks between & and #). I don't use the menu Insert > Special Character as

Another option would be to disable the "pretty-fication" feature... This can be done by opening up your theme's functions.php file and pasting the following code at the bottom right before the closing ?> PHP tag:

remove_filter('the_content', 'wptexturize');

Notice that Quotes in preformatted text (as here just above) are not replaced by Smart Quotes. But one one side, this can't be used on Quotes typed inline, and on the other side, I don't use preformatted text for my code samples...

Yet another option would be to use a plugin like the Smart Quote Fixer to remove the Smart Quotes.

But I prefer to use type the num codes as I don't want to disable Smart Quotes on the complete post...

Synology WordPress 404 on Synology after restarting NAS

Each time I restart my NAS (for update reasons), I have errors 404 when trying to reach any post of my WordPress blog, until I re-set permalinks' settings. I finally fixed it by updating my WordPress with latest Synology's package.

Click to Read More

A long time ago, rebooting my NAS started to result systematically in 404 in my WordPress blog. I found a manual fix here: simply resetting WordPress permalinks' settings was solving the problem... until the next reboot :(

But I never understood why rebooting my NAS was resulting in the lost of permalinks' settings. And could find a definitive solution.

I finally took today an hour to reproduce and further investigate the problem (motivated by the shiny sun outside :p). I found that restarting only the WordPress Package was also resulting in this issue. I noticed more precisely that the .htaccess file was deleted when starting the package (not when stopping). I am sure that removing access rights on the .htaccess file for WordPress, as described here for example, would be a solution. But the not best one.

I found the best solution by accident. A long time ago, as I was interested in a version of WordPress more recent than the one available via Synology's packages, I did a manual upgrade with the official WordPress setup. Since that time, I never did an update anymore with Synology's Package Manager, but used the native WordPress update via its own Dashboard:

WordPress-Update

Today, I did a backup of WordPress' installation folders and updated Synolgy's WordPress Package. Once the update accomplished, I noticed that the .htaccess was containing information specific to Synology:

# Synology PHP
AddHandler default-handler .htm .html .shtml
AddHandler php-fastcgi .php
AddType text/html .php
Action php-fastcgi /php56-fpm-handler.fcgi
# Synology PHP

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /wordpress/
RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /wordpress/index.php [L] </IfModule>

# END WordPress

And now, when restarting WordPress, the .htaccess is not deleted anymore (and permalink's settings are not lost). There is certainly a good explanation, that I ignore, but at least I won't suffer 404 anymore.

And next time I update manually WordPress, I will pay attention to backup the .htaccess as specially clearly recommended here, as well as merging that .htaccess with the updated one after the update of the Permalinks' structure:

  1. Backup your database. Read Backing Up Your Database for a detailed explanation.
  2. Backup ALL your WordPress files in your WordPress directory. Don't forget your .htaccess file.
  3. Verify the backups you created are there and usable. This is essential.
  4. Ensure first four steps are completed. Do not attempt the upgrade unless you have completed the first four steps.
  5. Delete the old WordPress files on your site, but DO NOT DELETE

    • wp-config.php file;
    • wp-content folder; Special Exception: the wp-content/cache and the wp-content/plugins/widgets folders should be deleted.
    • wp-images folder;
    • wp-includes/languages/ folder--if you are using a language file do not delete that folder;
    • .htaccess file--if you have added custom rules to your .htaccess, do not delete it;
    • robots.txt file--if your blog lives in the root of your site (ie. the blog is the site) and you have created such a file, do not delete it.
  6. Upload the new files from your computer's hard drive to the appropriate WordPress folder on your site.
  7. Run the WordPress upgrade program and follow the instructions on the screen.
  8. Update Permalinks and .htaccess. Update your Permalink Structure and merge the custom rules, if necessary, into your .htaccess file.
  9. Install updated Plugins and Themes. Please review the list of Plugins that work in Version 4.8. Check for Theme Compatibility with 4.8 and ask your Theme author for any new version.

Synology Synology: "DSM updating in process..." forever

I recenlty tried to update my DSM 6.1.1-15101 from pacth 3 to 4. For some unknown reasons, the update never ends which results in various "issues". The only solution I found to exit that situation was to kill the upgrade process.

Click to Read More

Once the update started, the progress eventually appeared stuck...

Updating Synology

After 2 hours, I decided to open the admin interface (http://<MySyno>:<adminPort>) and was able to log in. But back into the Control Panel, I saw the message "DSM updating is in process..."...

DSM Updating

It would not have been a big issue if it didn't prevent me to update any packages. Trying to do so was resulting in a popup blocking any automatique on manual installation/update. I was also unable to restart or shutdown properly the NAS for the same reason.

To solve this situation I had to kill the upgrade process:

  1. Open a SSH console using Putty to connect onto the NAS
  2. Login as administrator
  3. Enter the root mode using the command: sudo -i
  4. Kill the update processes typing the command: kill -9 $(ps aux | grep -e SYNO.Core.Ugrade |grep -v grep | awk '{ print $2 }')

I was next able to update other packages... I did next restart the NAS but for some reasons, it never rebooted completed (neither detected by the Synology Assistant nor accessible via the Admin webUI). I had therefore to do a hard reboot :(

Now, although I am still unable to reboot properly or upgrade DSM, I can at least install (or update) packages, possibly to help me in backuping everything before a complete reset.

NB.: I also tried to upgrade from SSH, without success.

Using the feature auto, I got an error message:

root@Hades:~# synoupgrade --check
UPGRADE_CHECKNEWDSM
Available update: DSM 6.1.2-15132, patch type: dsm, restart type: reboot, reboot type: now

root@Hades:~# synoupgrade --download
UPGRADE_DOWNLOADDSM
New update has been downloaded

root@Hades:~# ls -la /volume1/@autoupdate
total 223684
drwx------ 2 root root 4096 Jun 16 18:49 .
drwxr-xr-x 37 root root 4096 Jun 16 18:49 ..
-rw-r--r-- 1 root root 229038080 Jun 14 11:50 DSM_DS1815%2B_15132.pat

root@Hades:~# synoupgrade --check-pat ./DSM_DS1815+_15132.pat
UPGRADE_CHECK_PAT
Patch type is DSM
ErrSysAvailSize

root@Hades:~# synoupgrade --auto
UPGRADE_AUTO
New update has been downloaded
Start DSM update...
ServerUpgrade failed

Using an explicit download or the explicit path of the patch auto-downloaded, I get no error:

root@Hades:~# synoupgrade --patch /volume1/@autoupdate/DSM_DS1815%2B_15132.pat
UPGRADE_PATCH
Start DSM update...
root@Hades:~#

root@Hades:~# wget https://global.download.synology.com/download/DSM/release/6.1.2/15132/DSM_DS1815%2B_15132.pat
--2017-06-16 18:34:22-- https://global.download.synology.com/download/DSM/release/6.1.2/15132/DSM_DS1815%2B_15132.pat
Resolving global.download.synology.com... 52.222.227.46, 52.222.227.228, 52.222.227.163, ...
Connecting to global.download.synology.com|52.222.227.46|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 229038080 (218M) [binary/octet-stream] Saving to: 'DSM_DS1815+_15132.pat'

100%[==================================================================================================================>] 229,038,080 10.0MB/s in 30s

2017-06-16 18:34:53 (7.23 MB/s) - 'DSM_DS1815+_15132.pat' saved [229038080/229038080]

root@Hades:~# synoupgrade --check-pat /root/DSM_DS1815+_15132.pat
UPGRADE_CHECK_PAT
Patch type is DSM
Check patch successfully

root@Hades:~# synoupgrade --patch /root/DSM_DS1815+_15132.pat
UPGRADE_PATCH
Start DSM update...
root@Hades:~#

Fortunatelly, in all cases, the DSM is not suck in "updating in process"

Tips Can’t initialize disk (cyclic redundancy check)

I recently added an old 1TB disk in a tray of my PC and was prompted by Windows to initialize it. Proceeding with this initialization, I got an error message: Can’t initialize disk (cyclic redundancy check). The problem was that, in the past, this disk was part of a RAID array.

Click to Read More

The problem was not solved by using GPT versus MBR, or by installing HDSentinel, or using third party tools such as HDDScan, SeaTools, ...

I did first open the "Computer Management" interface ( :win: + E > This PC > Manage) and went into the "Disk Management" pane. But couldn't initialize the disk from there either, nor do anything else on it.

I did next start my SATA Controller management software: Intel Rapid Storage Technology. Once in there, I saw that the disk was recognized as the only available member of a Raid Array. I remember that it was indeed used in a physical RAID 1 array a long time ago. I should have guess it as the Disk Management interface was pretending that the disk was 2TB (recognized as an RAID 1 array of 2x 1TB) although it was a 1TB...

So, I simply deleted that array (still via Intel RST) and was finally able to initialize the disk.

Et voilà.

Tips Convert CodePlex's HTML Markup into GitHub's Markdown

As you probably know if using CodePlex, it will shutdown by the end of 2017. The option suggested by CodePlex is to move to GitHub.

Click to Read More

The move is facilitated by an automated "import" procedure. But HTML pages created on CodePlex are not automatically converted into Markdow.

This can fortunately be done using Pandoc.
For demo purpose, pick From = "HTML" and To = "Markdown (GitHub)".

Hardwares Rii mini i25: an Air Mouse/Wireless keyboard working with Windows, NVidia Shield TV, Plex...

I just bought an Rii min i25 (< 35€) as an alternative for the NVidia Remote Controle (~50€). I am not disappointed !

Rii Mini i25

Rii Mini i25

Click to Read More

Although mine is not a model with audio (microphone and headphone), it's clearly a great accessory to replace the native remote of the NVidia Shield TV. Notice that if it looks really nice, it's not heavy. As a consequence, it does not feel robust in hand.

Remote NVidia Shield TV

Remote NVidia Shield TV

I did test it with Plex, both on Windows 10 and on NVidia Shield TV. Everything is working out of the box, except the fast forward and fast rewind. Those two keys will probably need some remapping.

Both on Windows and NVidia, I did use the wireless keyboard successfully (including the FN keys: mute, Home, PgDn, PgUp, End, Del, Ctrl-Alt-Del), as well as the Air Mouse.

Regarding the Remote Control:

  • Volume + and  - worked both on Windows and NVidia.
  • Power off only worked on Windows not on NVidia.
    • But it was switching off Netflix.
  • Search and Home worked on NVidia
  • To do a selection in Netflix on NVidia, I had to lock the mouse before clicking on OK!
  • Fast Forward (+10 sec) and Fast Rewind (-10 sec) work fine within Netflix but not in Plex.
  • I noticed in Netflix that the arrows (left/right) which could be used to move forward or backward in the scenes was "sometimes" not working...
  • I noticed that sometimes, the axes up/down and left/right appeared to be inverted. I did fix that by keeping the remote on the table, parallel to the screen, keyboard up (i.e. just in front of me), for 10 long seconds.
  • To scroll the page in Chrome, take the remote (keyboard down), move the mouse onto the background of the page (where there is no field) and press the "turn back arrow". Move next the remote up and down.
  • To enter the search bar in Chrome, (keyboard down) simply press the "search key". To exit the search bar (keyboard up), press the "Esc" key.

From installation perspective, there is nothing to do: just plug the receiver in a USB port and switch on the remote (Button On/Off, on the side, next to the micro USB Charging Port).

Using the air mouse is very convenient. The experience is very similar to using the remote pointer of Smart Samsung TVs (a smart remote with a large trackpad). NB.: if the mouse pointer is out of alignment with your wrist, simply lock it using the 'Lock' button, the one with an arrow icon:

Lock Button Rii mini i25

As mentioned above, the keys can be reprogrammed by sending an IR signal from another remote whose the behavior must be copied.

If you want to use an AZERTY model you will need the "External keyboard Helper Pro".

Tips 'Add Mirror...' option is grayed out in Windows' Disk Management

How to 'Add Mirror' on a disk containing data when the option is grayed-out although you have another very similar disk available and empty? Check that your two disks are "Dynamic" and shrink the volume on the disk with data!

Click to Read More

I had a 2 TB disk with a unique volume (on one single partition), containing data.

I did add a new 2 TB disk to be used as a mirror of the existing one. I went into the Disk Management tool to "add Mirror" but found that this option was not available. The menu was disabled:

Add Mirror Grayed Out

Add Mirror Grayed Out

First thing to check: the two disks to be used must be "Dynamic". Right-click on "Disk x" to "Convert to Dynamic Disk ...".

Next, to be able to create a mirror, the system needs some free space to create its own reserved partition on the disk. So, right-click on the Volume of the disk with data to "Shrink Volume..." (Try first with 1 Mb). Once the disk has been shrunk, the menu "Add Mirror..." becomes accessible.

Add Mirror Enabled

Add Mirror Enabled

Et voilà.

NB.:

  • It does not matter if the disks are MBR or GPT.
  • Once the volume shrunk, you will possibly have to reboot.
  • If you encounter an issue while adding a mirror, do a "Check Disk" (Properties > Tools > Check).
  • If you can really not get rid of the error "DiskPart has referenced an object which is not up-to-date." although rebooting, do an "Extend Volume" of 1 MB! (Sound silly, I know...) and then "Add Mirror".
  • In my case, while the disks were re-syncing, I did remove the mirror, did an "Extend Volume" to reuse the whole free space, and was still able to do an "Add Mirror".
  • MS Partition & Volume Info here.

Mirror using DiskPart

  • Run DiskPart in a cmd prompt started as Administrator
  • list disk
  • select disk x [x=disk containing the volume to be mirrored]
  • list volume
  • select volume x [x=volume to be mirrored]
  • add disk x [x=disk to be used for mirroring]

Tips Check if Samsung Smart TV is alive with Php Server Monitor

Samsung Smart TVs have two http ports that can be queried from Php Server Monitor: 8000 and 8001.

Click to Read More

If the TV is on, querying on http://IP:8000, you get the response:

Server is running...

If the TV is on, querying on http://IP:8001/ms/1.0/, you get a response like:

{
  "DUID": "08f0d181-0096-1000-82d5-c4576e33a21d",
  "Model": "14_X14_BT",
  "ModelName": "UE48H6500",
  "ModelDescription": "Samsung TV RCR",
  "NetworkType": "wired",
  "SSID": "",
  "IP": "192.168.0.180",
  "FirmwareVersion": "Unknown",
  "DeviceName": "[TV]Samsung LED48",
  "DeviceID": "08f0d181-0096-1000-82d5-c4576e33a21d",
  "UDN": "08f0d181-0096-1000-82d5-c4576e33a21d",
  "Resolution": "1920x1080",
  "CountryCode": "BE",
  "SmartHubAgreement": "true",
  "ServiceURI": "http://192.168.0.180:8001/ms/1.0/",
  "DialURI": "http://192.168.0.180:8001/ws/apps/",
  "Capabilities": [
    {
      "name": "samsung:multiscreen:1",
      "port": "8001",
      "location": "/ms/1.0/"
    }
  ]
}

When the TV is Off (powered off or in standby mode), you won't get any response from those ports but:

ERR_CONNECTION_TIMED_OUT

Synology Synology Package Creator for shell scripts and php pages

I did upgrade "Mods", my Windows Tool used to create dummy packages adding shortcuts on DSM's desktop to open web pages.

Now, "Mods" is able to package shell scripts and php webpages...

Mods

Mods

Click to Read More

It is available here on GitHub.

For example, you could package apps like Chris Hager's Most Simple Ajax Chat Ever

Simple Chat on DSM

Simple Chat on DSM

Or package a more advanced tool like php Server Monitor

Server Monitor

Server Monitor

Server Monitor Running

Server Monitor Running

This Tool is available here on GitHub.