Line 1: |
Line 1: |
| This page aims to record the solutions to obscure problems. | | This page aims to record the solutions to obscure problems. |
| | |
| | See [[Installation]] for all MediaWiki related Troubleshooting |
|
| |
|
| === GitHub === | | === GitHub === |
| To delete a release, do not click on "Edit", instead click the release title name. Then the "Delete" button will be available. | | 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. |
|
| |
|
| === Citrix === | | === Citrix === |
| 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. | | 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. |
| | |
| | === Cryptography === |
| | 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 |
| | |
| | https://crypto.stackexchange.com/questions/3965/what-is-the-main-difference-between-a-key-an-iv-and-a-nonce |
| | |
| | https://www.titanwolf.org/Network/q/cc102a94-8ad9-4d8e-8da4-379b6fb92dad/y |
| | |
| | https://docs.microsoft.com/en-us/dotnet/api/system.security.cryptography.rijndaelmanaged?view=net-5.0 |
| | |
| | Simultaneously I'm learning how to use [https://www.w3schools.com/asp/ado_ref_stream.asp ADODB stream object] for the first time |
| | |
| | <syntaxhighlight lang="vbscript"> |
| | objStream.Type = 1 'adTypeBinary |
| | objStream.Open |
| | objStream.Write(mykey) |
| | objStream.savetofile "key" |
| | </syntaxhighlight> |
| | |
| | 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. |
|
| |
|
| === HTA === | | === HTA === |
Line 30: |
Line 59: |
|
| |
|
| Run vs Exec comparison [https://developpaper.com/the-difference-between-run-and-exec-in-vbs/] | | Run vs Exec comparison [https://developpaper.com/the-difference-between-run-and-exec-in-vbs/] |
| | |
| | Shell.run 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 https://www.freecodecamp.org/news/thrown-for-a-loop-understanding-for-loops-and-timeouts-in-javascript-558d8255d8a4/#:~:text=Every%20time%20we%20loop%2C%20setTimeout%20%28%29%20is%20passed,loop%2C%20followed%20by%20console.log%20%28%E2%80%98The%20loop%20is%20done%21%E2%80%99%29. |
| | |
| | === CScript === |
| | 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''' <pre> |
| | ADODB.Connection: Provider cannot be found. It may not be properly installed. |
| | </pre> |
| | |
| | === Bash Shell === |
| | Here's me trying to rename tv shows... |
| | |
| | https://wiki.bash-hackers.org/syntax/pattern |
| | |
| | <syntaxhighlight lang="bash"> |
| | 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 |
| | </syntaxhighlight> |
| | |
| | === .HTACCESS === |
| | https://httpd.apache.org/docs/current/mod/mod_rewrite.html |
| | |
| | not for redirecting, but for changing the appearance of URLs. My website has the format jjjp.ca/1/22/whatever, 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 jjjp.ca/single.php?post=22. 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 jjjp.ca/?p=blablah is received by index.php which performs the redirect to jjjp.ca/0/blablah. It's HTACCES's job to register that as a valid url and to translate it internally as jjjp.ca/single.php?oldwebsitepost=blablah. |
| | |
| | |
| | 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] |
| | |
| | === SQL === |
| | [[File:Joins sql.png|thumb|600x600px]] |
| | Joins are confusing. Examples needed.attempting to do math on a query, the DATEDIFF of the previous row |
| | |
| | use subquery and ROW_NUMBER() |
| | |
| | https://sqltheater.com/blog/cant-use-row-number-where/ |
| | |
| | https://www.sqlservertutorial.net/sql-server-window-functions/sql-server-row_number-function/ |
| | |
| | https://stackoverflow.com/questions/17587708/select-difference-between-two-dates-and-sum |
| | |
| | https://www.sqlservertutorial.net/sql-server-date-functions/sql-server-datediff-function/ |
| | |
| | https://www.py4u.net/discuss/843201<syntaxhighlight lang="sql"> |
| | --acc_amp_event |
| | SELECT event_date, acc_id |
| | DATEDIFF(second,) |
| | FROM |
| | acc_amp_event |
| | WHERE |
| | personnel_id=455 |
| | |
| | acc_amp_event_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 |
| | FROM |
| | (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 |
| | FROM |
| | (SELECT TOP 100 acc_amp_event_id, event_date, personnel_id FROM acc_amp_event WHERE personnel_id=455) |
| | </syntaxhighlight> |
| | '''Aggregate function''' |
| | |
| | "An aggregate function performs a calculation on a set of values, and returns a single value. Except for <code>COUNT(*)</code>, aggregate functions ignore null values. Aggregate functions are often used with the GROUP BY clause of the SELECT statement" [https://docs.microsoft.com/en-us/sql/t-sql/functions/aggregate-functions-transact-sql?view=sql-server-ver15 Aggregate Functions (Transact-SQL) - SQL Server | Microsoft Docs] |
| | <references />"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<syntaxhighlight lang="sql"> |
| | SELECT tmplt_profile_id, id, sql_operation |
| | FROM acc_specimen_audit |
| | GROUP BY tmplt_profile_id, sql_operation, id |
| | HAVING sql_operation='U' |
| | </syntaxhighlight> |
| | |
| | === Windows === |
| | |
| | ==== VPN connection ==== |
| | [[File:vpn connection settings fix.png|thumb]] |
| | - edit connections to match screenshot |
| | |
| | - add this to the registry<syntaxhighlight> |
| | REG ADD HKLM\SYSTEM\CurrentControlSet\Services\PolicyAgent /v AssumeUDPEncapsulationContextOnSendRule /t REG_DWORD /d 0x2 /f |
| | </syntaxhighlight>- reboot for changes to take effect |
| | |
| | https://superuser.com/questions/1298513/l2tp-ipsec-vpn-fails-to-connect-on-windows-10-works-fine-on-ios |