Warning: mysql_real_escape_string() expects parameter 1 to be string, array given in /mounted-storage/home46b/sub003/sc12436-RBYT/archigos/wp-includes/wp-db.php on line 1173
Random Stuff, plus some updates to the custom protocols… – Archigos' Life

Random Stuff, plus some updates to the custom protocols…

Posted on by

*What I’m watching or Listening to Now*

Not much of anything since one of my 3TB drives died and took just over 2.5TB of video with it.

*Custom Protocols Update…*

First things first… (Using latest version of browser mentioned)
Firefox:
“Sublime Text” Protocol: Completely working
“Speak” Protocol: Does not encode/decode properly… (fine in Chrome) a.k.a. “This is only a test” whether urldecoded or not gets converted to “This%20is%20only%20a%20test” (since %20 equals a ‘space’) therefore NirCmd will actually say “This percent twenty is percent twenty only percent twenty….” etc.

Here’s the fix for ‘Speak’ in Firefox: (Will only work if you have PHP installed on your development system)

@ECHO OFF
TITLE Archigos NirSpeak
MODE CON COLS=50 LINES=3

ECHO.
ECHO                 Ignore this window

FOR /F "tokens=1,2,3* delims=/" %%a in ("%~1") DO (
  SET Protocol=%%a
  SET String=%%b
)
FOR /F "tokens=1* delims=" %%a in ('php -r "ECHO urldecode('%String%');";') DO SET Talk=%%a
nircmd speak text "%Talk%" && EXIT

Chrome:
I’m not sure when (too lazy to look it up), but with one of the updates to Google Chrome they essentially blocked the use of custom protocols (also called “Handlers”) to a certain extent. The new rules are something akin to your web application “must register the custom URI into Chrome and that it MUST be from the same domain”. This is mainly for security in Chrome Apps, but since we’re doing it for testing, I doubt any of you that are willing to write the C++/C# code required for URI Registration would bother with doing something like this… (however, if you’re interested, you can read about that here.)

Thankfully, getting around this limitation is rather easy for what we want to do, but be warned, make sure you fully trust whatever protocols you use with this method because it essentially turns off all of Chrome’s security for them. Both my Sublime Text and Speak Protocols are safe if you follow the directions, but you could essentially write one that could do harmful actions very easily.

Open up the command prompt and enter the correct location from below based on Operating System:
On Windows 7/8/8.1, the path is: %LOCALAPPDATA%\Google\Chrome\User Data
On Windows Vista: %USERPROFILE%\AppData\Local\Google\Chrome\User Data
On Windows XP: %USERPROFILE%\Local Settings\Application Data\Google\Chrome\User Data

Once the window opens, you have to make sure Chrome is CLOSED because it writes data to the “Local State” which you need to edit (preferably in Sublime Text). If you need to open the “Local State” file in a different editor, make sure that the application doesn’t append a file extension (ex. *.txt)

Inside the “Local State” file, which is in the JSON format, you’re looking for the section called “protocol_handler” which should already have a few entries in it and look similar to the following (line numbers are for demonstration here, the section should be kind of close to the bottom):

  "protocol_handler": {
    "excluded_schemes": {
      "afp": true,
      "data": true,
      "disk": true,
      "disks": true,
      "file": true,
      "hcp": true,
      "javascript": true,
     "mailto": false,
     "ms-help": true,
     "ms-windows-store": false,
     "news": false,
     "nntp": true,
     "shell": true,
     "snews": false,
     "vbscript": true,
     "view-source": true,
     "vnd": {
       "ms": {
         "radio": true
       }
     }
   }
 },

Once you find it, you’re going to want to add two lines to this file (I placed them so they stayed alphabetical like the rest)… setting the value to ‘false’ means that the protocol will be used, and ‘true’ means ignore it for security reasons.

  "protocol_handler": {
    "excluded_schemes": {
      "afp": true,
      "data": true,
      "disk": true,
      "disks": true,
      "file": true,
      "hcp": true,
      "javascript": true,
     "mailto": false,
     "ms-help": true,
     "ms-windows-store": false,
     "news": false,
     "nntp": true,
     "shell": true,
     "snews": false,
     "speak": false,
     "subl": false,
     "vbscript": true,
     "view-source": true,
     "vnd": {
       "ms": {
         "radio": true
       }
     }
   }
 },

As you can see on lines 17 and 18, I added both protocols that I created and made sure to match the names used. If you only created one of them, do NOT create an entry for the opposite one. Save the file, open Chrome, test your page with the protocol examples… if you don’t have one, create a new PHP file accessible from ‘localhost’ and paste the following code for a quick and dirty test:

<?php
  $filename = urlencode(__FILE__);
  $string   = "This is only a test...";
  echo "<a href='subl://$filename'>Sublime Test</a><br />";
  echo "<a href='speak://$string'>Speak Test</a>";
?>

*Testing Environment*

A few people have asked once or twice about possibly doing a full write-up of my main test environments (both Web Design and HTPC related) so if people post a response on Facebook if they are interested in either (or both) I’ll possibly create a new page on this site dedicated to it (because it’ll probably be multiple posts and pretty long).


*In regards to last post*
I left this to the end of the post so those looking for the technical stuff above could skip it.
The person I was talking about still wishes to stay anonymous for as long as possible, mainly due to the stigma I had previously mentioned, but stated that since I mentioned it already I could give a little update. Now, it’s not uncommon for people undergoing the initial changes from mental illness to think “No, I’m normal, if you don’t see/hear/etc. it the way I do, you’re the one that’s wrong” and I think the main problem with the first few sets of doctors were that they did NOT take this into account and observe the behaviors shown and it didn’t help, that he apparently withheld a lot of information for this same reason. I think it was around the third set of doctors we found that started to notice not everything was being said, or that some things being said weren’t necessarily the truth (not that he was intentionally lying, it was based on his ‘distorted’ point of view). This doctor narrowed things down to the point where they debated on if it was some form of extreme bi-polar disorder or (as I suspected) Schizophrenia, the latter ending up being the actual diagnosis.

I think when I was invited to see the doctor with him so the three of us could talk together and I could point out my observations or when details were misinterpreted helped him realize the extent of the paranoia and other symptoms were. The doctor gave him a different type of medication and although most of the symptoms seemed to lessen, you could tell he was still struggling with things. Thankfully, sticking with the current doctor, changing medications and/or dosages a few times, and other forms of support, he seems to have gotten most things under control and for the most part, none of what is going on is noticeable to those that weren’t told at least something prior.

Category: Misc. | Tags:
Comments are disabled