PHP on IIS

re-installing things when your notes are lost

Oh, I had plenty of notes -- they were all stored in a local PmWiki instance, running on IIS!

Aaaaaand my hard-drive failed while I was on leave.

IT was able to recover some files, but I need to get an installation up-and-running so I can read them, can't I?

installing PHP on IIS

The first time I did it, The Web Platform Installer worked like a charm.
This time, it failed - document temporarily moved?

So I followed https://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php and it worked to get PHP running, anyway.

Now I'll have to see about PmWiki,

AND getting in-house backups of my files. 2 years of dev notes. UGH.

Other install shenanigans

Emacs

To do server-start however, the ~\.emacs.d\server folder needed to be twiddled.

THIS solved my problem - reset the ownership from Administrators to mine own self.

Also, location of folder is at C:\Users\<username>\AppData\Roaming\.emacs.d

ProcessExplorer

Was throwing the following error: Unable to open 64-bit image. Run Process from a writeable directory.

It's not the file itself, it's the auto-extracted 64-bit image opening in the Temp folder - C:\Users\<username>\AppData\Local\Temp
(I found this via SET TEMP on the command line - without params, it provides the current setting.)

I copied the file procexp64.exe to the main ProcessExplorer folder, and it worked like a charm when openend directly.
There's quite possibly a better solution somewhere.

Windows Subsystem for Linux (WSL)

notes on installation

This page helped me the most (August 2016); clear steps and screenshots.

Another installation guide went through the pre-requisites, and seems to have the same installation steps, but I did use the above for the final installation.

No matter which method you use, there will probably be at least 2 restarts once critical components are installed. I can't get Windows 10 to stop auto-updating and restarting whenever it wants, anyway....

I first read Scott Hanselman's post on the subject (March 2016), but it was extremely light on the installation details. He links to a 30-minute video he did on using the system, which I've yet to watch.

WSL FAQ

Installing nodejs

Notes @ https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

But the following is what I used for Node v6

curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo apt-get install -y build-essential
NOTE: due to naming conflicts, node is nodejs on Ubuntu.

Running

Needed a couple of pre-requisites

sudo apt-get install pkg-config
sudo apt-get install libcairo2-dev

I had already installed a package that used canvas (Darius Kazemi's Reverse OCR) and so I navigated to the directory, executed sudo npm i. I had to fake config.js and permissions.js for the app, as well as hard-code some words that were normally obtained from Wordnik (I could have used real keys, but that's outside the scope of this test). I then ran nodejs index.js .... and got an out.png file. I opened it up outside of the WSL BASH - and it was what I expected!

There are other projects I want to try - but this was the first I found back using canvas.
I've been working solely with generated text for the past couple of years due to nodejs image-library issues on windows.
Looks like the WSL may solve all of my problems!

Caveats

It was not as easy as the above - I've cut out all of the obviously embarrassing mistakes (and left only the non-obvious mistakes).

Misc

Files - C:\Users\<Windows-username>\AppData\Local\lxss\home\<WSL-username>

Wikipedia:Windows_Subsystem_for_Linux

https://blogs.windows.com/buildingapps/2016/07/22/fun-with-the-windows-subsystem-for-linux/ - including NetHack
(I've gotten NetHack running on windows in the past connected to windows Emacs. It's been at least 6 years, though....)

https://msdn.microsoft.com/en-us/commandline/wsl/about?f=255&MSPPError=-2147217396

NLG, NLP and tasks

Natural Language Generation (NLG)

If you squint your eyes and look at it in the right light, text-generation can be considered AI - for certain, limited definitions of the term AI that nobody but those who can already tell the innards from the dim outline would care about.

http://gamestudies.org/0101/bringsjord/

Selmar Bringsjord is one of the co-authors of Artificial Intelligence and Literary Creativity: Inside the mind of BRUTUS, a Storytelling Machine (Amazon link) - along with David A. Ferrucci. preface to Artificial Intelligence and Literary Creativity: Inside the mind of BRUTUS, a Storytelling Machine

Ferucci was the leader of IBM's Watson project that won on Jeapordy. Ferucci has since left academia and industry to work in finance, predicting market changes. Well well well.

http://www-03.ibm.com/innovation/us/watson/research-team/dr-david-ferrucci.html

http://bits.blogs.nytimes.com/2013/05/06/david-ferrucci-life-after-watson/

Wiki changes

TODO: Wiki needs to be updated to latest
TODO: Blogit needs to be updated to latest
TODO: Wiki/blog headers need to be updated to display only current month
TODO: General house-cleaning
TODO: explore integrating xradiograph.com and michaelpaulukonis.com with a single install (wiki-farm) ?
TODO: make the link on the main page that goes to source clickable to people that are not me
TODO: rework landing page

Chrome Debugging

Chrome blackboxing

Skip certain libraries - like jquery

https://developer.chrome.com/devtools/docs/blackboxing

    F8 -> Run
    F10 -> Step over
    F11 -> Step into

More notes on NodeJS debugging

New Laptop notes

So I got a new laptop

Because the old one kept overheating and dying.

TODO: notes about new laptop (and what I did on the old one)
Could not remove all the screws from the case to check interior -- two are stuck.
USed a head monitor -- which shows all the sudden shutdown were when temps got out of control.
Could not predict what would push it over the edge, however.
LE SIGH.

Touchpad issues

So easy to brush, it kept stealing focus when I typed. Because it's so much bigger? Because I should have everything at an angle? DUNNO.

But this helped me fixe it:

Surprised nobody mentioned this in the thread. Even in Windows 7 this is available under the Mouse icon in Control panel. Windows will automatically disable the touch pad if you connect a USB mouse to the system if you configure it to. No need for a hotkey.

    Click WINDOWS+R Keys at the same time.  (or right click on the windows icon on the taskbar and click Run.
    Type main.cpl and press enter
    The mouse menu will come up.
    Click on the ClickPad Settings tab
    Place a check in Disable internal pointing device when external USB pointing device is attached.
    Click OK.

Once this is done anytime you plug a mouse in the touchpad will be disabled automatically.

ProcessExplorer oddities, &c

Process Explorer

For whatever reason, my work copy of Process Explorer stopped working today (or probably yesterday, after a just-before-leaving-the-office reboot) with the following error:

Unable to open 64-bit image. Run Process from a writeable directory.

Turns out the default .exe is a 32-bit app that contains the 64-bit-app within it (source), which is then extracted to a TEMP directory.
If the TEMP directory cannot execute, app won't run.
Online searches indicate that Group Policy changes sometimes have this effect.

Now, the processexp64.exe was present in the TEMP folder, so I copied it to the main app folder -- and it worked just fine.

The solution I found for the same problem was:

  1. Click on Start, Run, and enter CMD to open a DOS command window.
  2. Type "SET" and hit enter to display your TEMP directory variable
    • It will be something like: TEMP=C:\Users\YOUR_USERNAME\AppData\Local\Temp
  3. Then look in that directory for a file it's created but can't run called PROCEXP64.EXE
  4. Copy it to just about anywhere else on your PC and try running it.

Sentiment

adding some unit-tests

https://github.com/thisandagain/sentiment
https://github.com/akumpf/sentiment/blob/patch-1/lib/index.js
https://github.com/akumpf/sentiment/commit/23407526a146efbfdd9929e9bd74462e65d52ada

https://github.com/thisandagain/sentiment/pull/16

And, of course, I discover that the implementation is.... sub-optimal.

But not non-existant.

git clone https://github.com/akumpf/sentiment
git checkout patch-1

then, once the below is added to sync_negative.js

node_modules\tap\bin\tap.js test\unit\*.js

or

node_modules\tap\bin\tap.js test\unit\sync_negative.js

test('synchronous negation', function (t) {
    var normalNegative = 'Cats are stupid.';
    var negationNegative = 'Cats are not stupid.'; // introduces negation keyword
    var normalResult = sentiment(normalNegative);
    var negationResult = sentiment(negationNegative);

    t.type(normalResult, 'object');
    t.equal(normalResult.score, -2);
    t.equal(normalResult.comparative,  -0.6666666666666666);
    t.equal(normalResult.tokens.length, 3);
    t.equal(normalResult.words.length, 1);

    t.type(negationResult, 'object');
    t.equal(negationResult.score, 2);
    t.equal(negationResult.comparative,  0.5);
    t.equal(negationResult.tokens.length, 4);
    t.equal(negationResult.words.length, 1);

    var dataset = 'Hey you non-worthless scumbag';
    var result = sentiment(dataset);

    t.type(result, 'object');
    t.equal(result.score, -4);
    t.equal(result.comparative, -1);
    t.equal(result.tokens.length, 4);
    t.equal(result.words.length, 1);
    t.equal(result.positive.length, 0);
    t.equal(result.negative.length, 1);

    dataset = 'Hey you non worthless scumbag';
    result = sentiment(dataset);

    t.type(result, 'object');
    t.equal(result.score, -2);
    t.equal(result.comparative, -0.4);
    t.equal(result.tokens.length, 5);
    t.equal(result.words.length, 2);
    t.equal(result.positive.length, 1);
    t.equal(result.negative.length, 1);

    t.end();

});

2015.12.17

So, I'm not blogging very often.

It's because I'm..... very very busy?!?!?

jingo

https://github.com/claudioc/jingo

I find the setup instructions to be... confusing.

But I'm getting closer.

  1. In an existing git(hub) repo
  2. npm i jingo
  3. node node_modules\jingo\jingo -s > config.yaml
  4. edit config.yaml
    1. set repository => @@'./'
  5. node node_modules\jingo\jingo -c config.yaml
    1. which responds with something like Thu Dec 17 2015 14:20:38 GMT-0500 (Eastern Standard Time) - Jingo server v1.5.3 listening on port 6067
    2. so browse to http://localhost:6067
    3. which then wants me to authenticate, which doesn't work.

If you follow the readme.md, it has you launch the application well before setting up authentication.

IMHO, if I'm running localonly per the instructions, I shouldn't have to authenticate. But that's just me.

If you keeeeep reading down, there is some more information on seting up authentication.
No examples, are shown, but this is what the applicable section in the default config.yaml file looks like:

authentication:
  google:
    enabled: true
    clientId: replace me with the real value
    clientSecret: replace me with the real value
    redirectURL: ''
  github:
    enabled: false
    clientId: replace me with the real value
    clientSecret: replace me with the real value
    redirectURL: ''
  local:
    enabled: false
    accounts:
      - username: ''
        passwordHash: ''
        email: ''

You cannot enter a password in plaintext, which is good security, I guess. But again -- if you're running locally, you still have to jump through this hoop.
Set authentication.local.enabled => true

In your shell, execute:

node node_modules\jingo\jingo --hash-string password

So then you can plop it in and see

authentication:
  google:
    enabled: true
    clientId: replace me with the real value
    clientSecret: replace me with the real value
    redirectURL: ''
  github:
    enabled: false
    clientId: replace me with the real value
    clientSecret: replace me with the real value
    redirectURL: ''
  local:
    enabled: true
    accounts:
      - username: 'username'
        passwordHash: '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8'
        email: ''

NaNoGenMo and Python on windows

If it's November, it must be NaNoGenMo

Which means it's NaNoGenMo - Nation Novel Generating Month.

For the 3rd year in a row I'm participating, although this might be the first time I've actually gotten around to writing it up?

Python on windows.

I run Windows at home, becuase I've always worked in a Windows shop.
I don't love Windows, but it works.

Now, Python I don't generally do. I've done some Python for classes and exploring other NaNoGenMo projects.
So, by no means an expert, much less even fluent.

I was trying to get this repo to work: https://github.com/mewo2/vocab-mashup

Aaaaand, I had a hard time doing so.

First, I removed my installation of Strawberry Perl, because it had an older copy of gcc that was causing issues.
Then I installed mingw via Xrad:Programming/Chocolatey.

I also needed Microsoft Visual C++ Compiler for Python 2.7 which I discovered at StackOverlflow.

Standard installs of scipy, numpy and gensim didn't work, and I apparently needed to get windows 64-bit binaries.
Which I snagged from www.lfd.uci.edu/~gohlke/pythonlibs/
They were downloaded locally, and then installed via something like the following:

pip install D:\downloads\scipy-0.16.1-cp27-none-win_amd64.whl

Now, I'm trying to figure out word2vec and the training data I need to run that application.

word2vec link-dump

https://code.google.com/p/word2vec/
http://alexminnaar.com/word2vec-tutorial-part-i-the-skip-gram-model.html
https://radimrehurek.com/gensim/models/word2vec.html

Discussed in here

Project Gutenberg for fun and profit

I downloaded the entire DVD .iso from the torrent.
I used the Deluge client.
Mounted the iso using WinCDEmu.
Once installed, double-click on .iso to mount.
I used all standard defaults, and --poof-- there it was.
Of course, there's an HTML browser and all of the texts are zipped.

Here are some (unevaluated) notes on extracting everything from the zips.

TODO: more notes on Gutenberg parsing. There are a number of utilities I want to play with. I've only worked with manually downloaded files in the past. Which hasn't been bad.

Loops and algorithms and Data Structures

Who needs arrays and linked lists, anyways!


var position1 = 'apple';
var position2 = 'banana';
var position3 = 'cat';
var position4 = 'dog';
var position5 = 'how d\'ya like THEM loops!!!';
var counter = 1;

while (counter < 6) {
  console.log(eval('position' + counter));
  counter = counter + 1;
}
 
UPDATE: this was not written as an example of good code, but something to avoid. I'm not really sure why I found it so funny at the time.