From Jesse's Wiki
Jump to navigation Jump to search

This page aims to record the solutions to obscure problems.

See Installation for all MediaWiki related Troubleshooting


To delete a release, do not click on "Edit", instead click the release title name. Then the "Delete" button will be available.

to ignore without using gitignore, open .git and edit the 'exclude' file.


Use the web version when possible. To download a file, use the "download" icon which should appear. It may not be possible to use the Windows Explorer interface anymore.


Windows has RijndaelManaged (AES) built in. For some reason I thought it would be my first attempt on learning encrypting/decrypting The method needs an Initial Vector (IV) and a random key. Both of these are generated and used to encrypt. They must be saved with the encrypted data or else it cannot be decrypted. The IV isn't important and can be public. The key should not be public. This is similar to Public-Key cryptography but not the same.

For my purposes I'm just encrypting a password on a local machine

Simultaneously I'm learning how to use ADODB stream object for the first time

objStream.Type = 1 'adTypeBinary
	objStream.savetofile "key"

Make sure the type is set to 1 and Write is used. Both are for binary which is what the AES IV and KEY are.

There is no equivalent function in javascript to find the length of a binary variable like vbscript's Lenb() but I can use ADODB stream to open and write binary and then use the Size method to get the size. The binary length is needed for the TransformFinalBlock method of AES.


When using HTA to open a vbscipt with cscript.exe, you can communicate directly with the script using the Stdout property. So long as the script was launched using shell.exec method. method is acceptable but it only returns an error level.

exec method to work needs to have the shell set to an object. blah = shell.exec ( blah blah). Then use blah.Stdout.ReadLine() or ReadAll().

This seems most useful for quick scripts where I want to return a single value. I can't seem to get live updates synchronously with the script as described here

It would be better to have live read outs update to the HTA so the console screen can be avoided entirely, giving the HTA a more "program" feel.

This explains when you want the window to stay open, e.g. use pause for the "press any key to continue" or just keep it alive until they click on the x.

Okay apparently using setInterval in the HTA will allow me to read the Stdout without locking the application...

       setInterval(function(){ document.getElementById(6).innerHTML = blah.StdOut.ReadLine(); }, 1000);


But now I can't run the shell minimized or stop it from taking focus.

Run vs Exec comparison [1] needs path in quotes for folders and file names with spaces. FSO requires the path to not have quotes at all.

javascript (and vbscript) is synchronous. Therefore I need to use a web api function to act asynchronously,loop%2C%20followed%20by%20console.log%20%28%E2%80%98The%20loop%20is%20done%21%E2%80%99%29.


Needs to run Win64 version to avoid the error. The wrong version will run if mshta.exe itself is also wrong. Investigate which one is running with task manager. Still cannot force either or to run by default, but a shortcut can be made which specifies the System32 path instead of syswow64

ADODB.Connection: Provider cannot be found. It may not be properly installed.

Bash Shell

Here's me trying to rename tv shows...

for file in *.mp4; do echo mv "$file" "${file//./ }"; done

for file in *.mp4; do echo mv "$file" "${file//.[!.mp4]/ }"; done

for file in *.mp4; do echo mv "$file" "${file[^.mp4]}"; done

for file in *.mp4; do echo mv "$file" "${file/*.S??E*/ }"; done

for file in *.mp4; do echo mv "$file" "${file/.S??E??*}"; done

for file in *.mp4; do echo mv "$file" "${file/.S??E??*/${file%S??E??}}"; done

for file in *.mp4; do echo mv "$file" "${file%%.S??E??*}"; done

for file in *.mp4; do echo mv "$file" "${file%%\?*}"; done


not for redirecting, but for changing the appearance of URLs. My website has the format, where the 1/22 is accepted as a valid URL by the HTACCESS RewriteRule. The actual redirect is done by the php file.

In reality my website's url is The RewriteRule translates it for the outside. Internally the php sees the real url.

So when trying to import my old website, I thought I could just use my index.php to send the old urls to the single.php. What I now have figured out is that it's index.php's job to do the entire redirect. So is received by index.php which performs the redirect to It's HTACCES's job to register that as a valid url and to translate it internally as

In order for that to work I had to adjust the RewriteRule to include any character between the two forward slashes, otherwise it wouldn't recognize a URL more than 4 characters between the slashes, like the RewriteRule for my current website's posts.

RewriteRule   "^0/(.*)(/.+)?$"   "/single.php?oldwebsitepost=$1" [NC,L]


Joins sql.png

Joins are confusing. Examples needed.attempting to do math on a query, the DATEDIFF of the previous row

use subquery and ROW_NUMBER()

SELECT event_date, acc_id


SELECT event_date, acc_id, 
       event_date - lag(event_date) over (order by date_time) as difference
FROM acc_amp_event
WHERE personnel_id=455

--works but because acc amp event id is not sequential the math is off
--attempt to make a subquery where my own id is sequency but got kicked off server
--realized my mistake of using the wrong personnel_id 445 instead of 455 (me)
SELECT TOP 100 t1.acc_amp_event_id, t1.acc_id, t1.event_date, DATEDIFF(minute,t1.event_date, t2.event_date)
FROM acc_amp_event AS t1
LEFT JOIN acc_amp_event AS t2 ON t1.acc_amp_event_id = t2.acc_amp_event_id - 1
WHERE t1.personnel_id=455
ORDER BY t1.event_date DESC

SELECT TOP 100 ROW_NUMBER() OVER (ORDER BY acc_amp_event_id)
, acc_id, event_date
FROM acc_amp_event
WHERE personnel_id=445

SELECT rn, acc_amp_event_id, event_date
(SELECT ROW_NUMBER() OVER(ORDER BY event_date) AS rn, acc_amp_event_id, event_date, personnel_id
FROM acc_amp_event
) AS t
WHERE personnel_id=445

SELECT ROW_NUMBER() OVER (ORDER BY event_date), acc_amp_event_id, event_date
(SELECT TOP 100 acc_amp_event_id, event_date, personnel_id FROM acc_amp_event WHERE personnel_id=455)

Aggregate function

"An aggregate function performs a calculation on a set of values, and returns a single value. Except for COUNT(*), aggregate functions ignore null values. Aggregate functions are often used with the GROUP BY clause of the SELECT statement" Aggregate Functions (Transact-SQL) - SQL Server | Microsoft Docs "column X is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause."

When using "GROUP BY" the columns need to be referenced in the SELECT clause and GROUP BY clause

SELECT tmplt_profile_id, id, sql_operation
FROM acc_specimen_audit
GROUP BY tmplt_profile_id, sql_operation, id
HAVING sql_operation='U'


VPN connection

vpn connection settings fix.png

- edit connections to match screenshot

- add this to the registry

REG ADD HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent /v AssumeUDPEncapsulationContextOnSendRule /t REG_DWORD /d 0x2 /f

- reboot for changes to take effect