Breakpoint will not be hit?

Visual Studio Community edition is great… except sometimes you get an error like “The breakpoint will not currently be hit. No symbols have been loaded for this document.

Whats’s going on? And how to solve? Google! and find this, except it sounds too complicated. Simply go into your menu:

- Debug
- Options
- General
AND: Remove the check-mark for "Enable Just My Code"

That’s all folks!
Have a nice day…

Data size troubles 1406

When the scripts start compaining, “[Native code: 1406] [Native message: Data too long for column …]”, check how much data you are actually trying to squeeze into a single field.
source: maximum length of data I can put in a BLOB column in MySQL?

BLOB ≈ 64KB,
MEDIUMBLOB ≈ 16MB and
LONGBLOB ≈ 4GB

Also: “The maximum size of a BLOB or TEXT object is determined by its type, but the largest value you actually can transmit between the client and server is determined by the amount of available memory and the size of the communications buffers.”
https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html

Row size too large (> 8126)

Error Code: 1118
Row size too large (> 8126). Changing some columns to TEXT or BLOB may help. In current row format, BLOB prefix of 0 bytes is stored inline.

See the possible solutions here:
https://mariadb.com/kb/en/troubleshooting-row-size-too-large-errors-with-innodb/

Get your ‘create table’ sql code and add:

SET GLOBAL innodb_default_row_format='dynamic';
SET SESSION innodb_strict_mode=OFF;
Continue reading Row size too large (> 8126)

jQuery set a radio input

I finally found the answer here:
https://stackoverflow.com/questions/9525128/jquery-set-radio-button
https://web.archive.org/web/20160421163524/http://vijayt.com/Post/Set-RadioButton-value-using-jQuery

Basically, if you want to check one radio button, you MUST pass the value as an array:

$('input:radio[name=cols]').val(['4']);
$('input:radio[name=rows]').val(['3']);

So no more of these pre/post v1.6 versions:

$("#radio_1").prop("checked", true);
$("#radio_1").attr('checked', 'checked');
$("input[name=background][value='some value']").prop("checked",true);
$("#radio_1").prop("checked", true).change();
$(this).attr({"checked":true}).prop({"checked":true});
$("[name='type']").click(function(){
  $("[name='type']").removeAttr("checked");
  $(this).attr({"checked":true}).prop({"checked":true});
});
// JQueryUI
$("#option2").prop("checked", true); // Check id option2
$("input[name='radio_options']").button("refresh"); // Refresh button set

Have a nice day!

MSXML2.ServerXMLHTTP and TLS1.2

Okay, so most webservers now have TLS 1.0 and 1.1 disabled, which of course causes code to fail. Also the case for a classic ASP script using MSXML2.ServerXMLHTTP, so Google to the rescue and found this:

It was, surprisingly, easy to convert my existing code in the actual application to use WinHTTP, which appears to work properly enforcing TLS 1.2 on all calls from XP POSReady and Windows 10 (the OS’s where this application will be deployed).

While this isn’t an answer as to why POSReady and XMLServerHTTP calls try to use TLS 1.0 on the first call (despite the registry stating that’s not desirable), it is an acceptable workaround.

For others who may stumble upon this and are hesitant, converting my code was as simple as this:

Set XMLReceive = CreateObject("Msxml2.DOMDocument.6.0")
Set XMLServer = CreateObject("Msxml2.ServerXMLHTTP.6.0")
XMLServer.setTimeouts ResolveTimeoutMs, ConnectTimeoutMs, SendTimeoutMs, ReceiveTimeoutMs

XMLServer.setRequestHeader "User-Agent", "My XML App V1.0"
XMLServer.setRequestHeader "Content-type", "text/xml"
XMLServer.Open "POST", Server_Address, False
XMLServer.send (My_XML_Request_String_or_XML_Document)
Failure = (XMLServer.Status <> 200)
If Not Failure Then XMLReceive.loadXML (XMLServer.ResponseXML.XML)

to:

Set XMLServer = CreateObject("WinHttp.WinHttpRequest.5.1")
Set XMLReceive = CreateObject("Msxml2.DOMDocument.6.0")
XMLServer.setTimeouts ResolveTimeoutMs, ConnectTimeoutMs, SendTimeoutMs, ReceiveTimeoutMs

'force TLS 1.2
XMLServer.Option(9) = 2048
XMLServer.Option(6) = True

XMLServer.Open "POST", Server_Address, False
XMLServer.setRequestHeader "User-Agent", "My XML App V1.0"
XMLServer.setRequestHeader "Content-type", "text/xml"
XMLServer.send (My_XML_Request_String_or_XML_Document)
Failure = (XMLServer.Status <> 200)
If Not Failure Then XMLReceive.loadXML (XMLServer.ResponseText)

Good luck!

PHP variables and strings

Sometimes you have to be reminded of the basics:

“How to use a dollar-sign $ in a string?”
In single quotes a dollar sign isn’t parsed as anything. Nothing is auto parsed in single quotes in php. If you use double quotes they are automatically parsed:

echo "$var"; // this will print the value of $var;
echo '$var'; // this will print $var;
echo "\$var";// this escapes the dollar sign so it will print $var;