text:
Q: How to edit MANIFEST file to run JAR as administrator? (Windows) I need to make one operation in my Java app, that requires Administrator privileges (on Windows 7/8).
From all I've read there are just three options:
1) Run a cmd as admin, and there do java -jar myapp.jar (or make a .bat file to do same thing)
2) Make a launcher JAR that will run my main JAR through Elevate.exe to give it admin access.
3) Edit MANIFEST.MF file to tell Windows that my app needs admin access.
First two approaches sound like a hack to me.
I like the idea to edit MANIFEST.mf file, BUT it looks like it only works when I convert my JAR to EXE (at least from what I found).
Anyway, my question is - what's the BEST way to run JAVA GUI program with Administrator privileges? And if you think best way is to edit MANIFEST file - then HOW to do it in NetBeans? (assuming that all I have now is a program in NetBeans, and it's compiled JAR).

A: I'm currently using launch4j to turn my jar into an exe. This tool allows you an option to include a manifest file, so I created a manifest file per this article.
<requestedExecutionLevel
level="asInvoker|highestAvailable|requireAdministrator"
uiAccess="true|false"/>


text:
Q: Can someone help me better understand Cross Site Scripting Policy I'm trying to better understand Cross Site Scripting and lets use:
http://api.beatport.com/crossdomain.xml as the example.
The XML lists that all domains are allowed access. However when I make the request from within my HTML page (or from within the console) it will fail with an error similar to:
XMLHttpRequest cannot load http://api.beatport.com/catalog/tracks. Origin <mydomain> is not allowed by Access-Control-Allow-Origin.

What I find weird though, is if I put the request in the address bar of my browser, the request goes through.
Can someone please explain what is going on and what I need to do to fix this because clearly the API allows access from any domain.

A: XMLHttpRequest doesn't look at crossdomain.xml, it looks at Access-Control-Allow-Origin header as mentioned in the error message.
So the server needs to send a header like this:
Access-Control-Allow-Origin: *
If they don't send that header (http://api.beatport.com/catalog/tracks doesn't), it will be denied.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Getting number of parameters in FUNCNAME Why does Snippet A
echo "params are ${FUNCNAME[@]}; param count is ${#FUNCNAME[@]}"

return
params are main; param count is 0

But Snippet B
_foo(){
    echo "params are ${FUNCNAME[@]}; param count is ${#FUNCNAME[@]}"
}

echo $(_foo)

return
params are _foo main; param count is 2

For Snippet A, shouldn't param count be 1, instead of 0?

A: This is a bug. According to bash manual:

This  variable  exists  only when  a  shell function is executing.

And see Chet's comment regarding this in "bug-bash" mailing list.


text:
Q: Generate publish.htm when publishing clickonce app using msbuild If you publish a Clickonce application from within visual studio, it will generate publish.htm .This seems to be Visual Studio generated, and not part of the publish target if the app is built with msbuild from a command line.
How do people handle automatic(e.g. as part of a build server) clickonce publishing, including a publish.htm ?

A: I just wrote a target that escaped the characters for msbuild, and generates the publish.htm file on the fly.  No need to setup external dependencies on 3rd party build task assemblies :D  The only thing to consider is which frameworks your application is truly dependent upon.  If you force a targeted version of something higher than 3.5, you will need to update this task accordingly.  This structure also assumes you are using msbuild version 4.0 (aka ToolsVersion="4.0").

<PropertyGroup>

  <Title>YourTitle</Title>

  <PublisherName>YourPublisherName</PublisherName>

  <Company>YourCompanyName</Company>

  <ApplicationName>YourAppName</ApplicationName>

  <VersionNumber>YourVersionNumber</VersionNumber>

</PropertyGroup>

<ItemGroup>

  <PublishHtmFileContents Include="%3CHTML%3E"/>

  <PublishHtmFileContents Include="%3CHEAD%3E"/>

  <PublishHtmFileContents Include="%3CTITLE%3E$(Title)%3C%2FTITLE%3E"/>

  <PublishHtmFileContents Include="%3CMETA HTTP-EQUIV%3D%22Content-Type%22 CONTENT%3D%22text%2Fhtml%3B charset%3Dutf-8%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3CSTYLE TYPE%3D%22text%2Fcss%22%3E"/>

  <PublishHtmFileContents Include="%3C%21--"/>

  <PublishHtmFileContents Include="BODY%7Bmargin-top%3A20px%3B margin-left%3A20px%3B margin-right%3A20px%3B color%3A%23000000%3B font-family%3ATahoma%3B background-color%3Awhite%7D"/>

  <PublishHtmFileContents Include="A%3Alink %7Bfont-weight%3Anormal%3B color%3A%23000066%3B text-decoration%3Anone%7D"/>

  <PublishHtmFileContents Include="A%3Avisited %7Bfont-weight%3Anormal%3B color%3A%23000066%3B text-decoration%3Anone%7D"/>

  <PublishHtmFileContents Include="A%3Aactive %7Bfont-weight%3Anormal%3B text-decoration%3Anone%7D"/>

  <PublishHtmFileContents Include="A%3Ahover %7Bfont-weight%3Anormal%3B color%3A%23FF6600%3B text-decoration%3Anone%7D"/>

  <PublishHtmFileContents Include="P %7Bmargin-top%3A0px%3B margin-bottom%3A12px%3B color%3A%23000000%3B font-family%3ATahoma%7D"/>

  <PublishHtmFileContents Include="PRE %7Bborder-right%3A%23f0f0e0 1px solid%3B padding-right%3A5px%3B border-top%3A%23f0f0e0 1px solid%3B margin-top%3A-5px%3B padding-left%3A5px%3B font-size%3Ax-small%3B padding-bottom%3A5px%3B border-left%3A%23f0f0e0 1px solid%3B padding-top%3A5px%3B border-bottom%3A%23f0f0e0 1px solid%3B font-family%3ACourier New%3B background-color%3A%23e5e5cc%7D"/>

  <PublishHtmFileContents Include="TD %7Bfont-size%3A12px%3B color%3A%23000000%3B font-family%3ATahoma%7D"/>

  <PublishHtmFileContents Include="H2 %7Bborder-top%3A %23003366 1px solid%3B margin-top%3A25px%3B font-weight%3Abold%3B font-size%3A1.5em%3B margin-bottom%3A10px%3B margin-left%3A-15px%3B color%3A%23003366%7D"/>

  <PublishHtmFileContents Include="H3 %7Bmargin-top%3A10px%3B font-size%3A 1.1em%3B margin-bottom%3A 10px%3B margin-left%3A -15px%3B color%3A %23000000%7D"/>

  <PublishHtmFileContents Include="UL %7Bmargin-top%3A10px%3B margin-left%3A20px%7D"/>

  <PublishHtmFileContents Include="OL %7Bmargin-top%3A10px%3B margin-left%3A20px%7D"/>

  <PublishHtmFileContents Include="LI %7Bmargin-top%3A10px%3B color%3A %23000000%7D"/>

  <PublishHtmFileContents Include="FONT.value %7Bfont-weight%3Abold%3B color%3Adarkblue%7D"/>

  <PublishHtmFileContents Include="FONT.key %7Bfont-weight%3A bold%3B color%3A darkgreen%7D"/>

  <PublishHtmFileContents Include=".divTag %7Bborder%3A1px%3B border-style%3Asolid%3B background-color%3A%23FFFFFF%3B text-decoration%3Anone%3B height%3Aauto%3B width%3Aauto%3B background-color%3A%23cecece%7D"/>

  <PublishHtmFileContents Include=".BannerColumn %7Bbackground-color%3A%23000000%7D"/>

  <PublishHtmFileContents Include=".Banner %7Bborder%3A0%3B padding%3A0%3B height%3A8px%3B margin-top%3A0px%3B color%3A%23ffffff%3B filter%3Aprogid%3ADXImageTransform.Microsoft.Gradient(GradientType%3D1,StartColorStr%3D'%231c5280',EndColorStr%3D'%23FFFFFF')%3B%7D"/>

  <PublishHtmFileContents Include=".BannerTextCompany %7Bfont%3Abold%3B font-size%3A18pt%3B color%3A%23cecece%3B font-family%3ATahoma%3B height%3A0px%3B margin-top%3A0%3B margin-left%3A8px%3B margin-bottom%3A0%3B padding%3A0px%3B white-space%3Anowrap%3B filter%3Aprogid%3ADXImageTransform.Microsoft.dropshadow(OffX%3D2,OffY%3D2,Color%3D'black',Positive%3D'true')%3B%7D"/>

  <PublishHtmFileContents Include=".BannerTextApplication %7Bfont%3Abold%3B font-size%3A18pt%3B font-family%3ATahoma%3B height%3A0px%3B margin-top%3A0%3B margin-left%3A8px%3B margin-bottom%3A0%3B padding%3A0px%3B white-space%3Anowrap%3B filter%3Aprogid%3ADXImageTransform.Microsoft.dropshadow(OffX%3D2,OffY%3D2,Color%3D'black',Positive%3D'true')%3B%7D"/>

  <PublishHtmFileContents Include=".BannerText %7Bfont%3Abold%3B font-size%3A18pt%3B font-family%3ATahoma%3B height%3A0px%3B margin-top%3A0%3B margin-left%3A8px%3B margin-bottom%3A0%3B padding%3A0px%3B filter%3Aprogid%3ADXImageTransform.Microsoft.dropshadow(OffX%3D2,OffY%3D2,Color%3D'black',Positive%3D'true')%3B%7D"/>

  <PublishHtmFileContents Include=".BannerSubhead %7Bborder%3A0%3B padding%3A0%3B height%3A16px%3B margin-top%3A0px%3B margin-left%3A10px%3B color%3A%23ffffff%3B filter%3Aprogid%3ADXImageTransform.Microsoft.Gradient(GradientType%3D1,StartColorStr%3D'%234B3E1A',EndColorStr%3D'%23FFFFFF')%3B%7D"/>

  <PublishHtmFileContents Include=".BannerSubheadText %7Bfont%3Abold%3B height%3A11px%3B font-size%3A11px%3B font-family%3ATahoma%3B margin-top%3A1%3B margin-left%3A10%3B filter%3Aprogid%3ADXImageTransform.Microsoft.dropshadow(OffX%3D2,OffY%3D2,Color%3D'black',Positive%3D'true')%3B%7D"/>

  <PublishHtmFileContents Include=".FooterRule %7Bborder%3A0%3B padding%3A0%3B height%3A1px%3B margin%3A0px%3B color%3A%23ffffff%3B filter%3Aprogid%3ADXImageTransform.Microsoft.Gradient(GradientType%3D1,StartColorStr%3D'%234B3E1A',EndColorStr%3D'%23FFFFFF')%3B%7D"/>

  <PublishHtmFileContents Include=".FooterText %7Bfont-size%3A11px%3B font-weight%3Anormal%3B text-decoration%3Anone%3B font-family%3ATahoma%3B margin-top%3A10%3B margin-left%3A0px%3B margin-bottom%3A2%3B padding%3A0px%3B color%3A%23999999%3B white-space%3Anowrap%7D"/>

  <PublishHtmFileContents Include=".FooterText A%3Alink %7Bfont-weight%3Anormal%3B color%3A%23999999%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include=".FooterText A%3Avisited %7Bfont-weight%3Anormal%3B color%3A%23999999%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include=".FooterText A%3Aactive %7Bfont-weight%3Anormal%3B color%3A%23999999%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include=".FooterText A%3Ahover %7Bfont-weight%3Anormal%3B color%3A%23FF6600%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include=".ClickOnceInfoText %7Bfont-size%3A11px%3B font-weight%3Anormal%3B text-decoration%3Anone%3B font-family%3ATahoma%3B margin-top%3A0%3B margin-right%3A2px%3B margin-bottom%3A0%3B padding%3A0px%3B color%3A%23000000%7D"/>

  <PublishHtmFileContents Include=".InstallTextStyle %7Bfont%3Abold%3B font-size%3A14pt%3B font-family%3ATahoma%3B a%3A%23FF0000%3B text-decoration%3ANone%7D"/>

  <PublishHtmFileContents Include=".DetailsStyle %7Bmargin-left%3A30px%7D"/>

  <PublishHtmFileContents Include=".ItemStyle %7Bmargin-left%3A-15px%3B font-weight%3Abold%7D"/>

  <PublishHtmFileContents Include=".StartColorStr %7Bbackground-color%3A%234B3E1A%7D"/>

  <PublishHtmFileContents Include=".JustThisApp A%3Alink %7Bfont-weight%3Anormal%3B color%3A%23000066%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include=".JustThisApp A%3Avisited %7Bfont-weight%3Anormal%3B color%3A%23000066%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include=".JustThisApp A%3Aactive %7Bfont-weight%3Anormal%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include=".JustThisApp A%3Ahover %7Bfont-weight%3Anormal%3B color%3A%23FF6600%3B text-decoration%3Aunderline%7D"/>

  <PublishHtmFileContents Include="--%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%2FSTYLE%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%2FHEAD%3E"/>

  <PublishHtmFileContents Include="%3CBODY%3E"/>

  <PublishHtmFileContents Include="%3CTABLE WIDTH%3D%22100%%22 CELLPADDING%3D%220%22 CELLSPACING%3D%222%22 BORDER%3D%220%22%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%21-- Begin Banner --%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CTABLE CELLPADDING%3D%222%22 CELLSPACING%3D%220%22 BORDER%3D%220%22 BGCOLOR%3D%22%23cecece%22 WIDTH%3D%22100%%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CTABLE BGCOLOR%3D%22%231c5280%22 WIDTH%3D%22100%%22 CELLPADDING%3D%220%22 CELLSPACING%3D%220%22 BORDER%3D%220%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD CLASS%3D%22Banner%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD CLASS%3D%22Banner%22%3E"/>

  <PublishHtmFileContents Include="%3CSPAN CLASS%3D%22BannerTextCompany%22%3E$(Company)%3C%2FSPAN%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD CLASS%3D%22Banner%22%3E"/>

  <PublishHtmFileContents Include="%3CSPAN CLASS%3D%22BannerTextApplication%22%3E$(ApplicationName)%3C%2FSPAN%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD CLASS%3D%22Banner%22 ALIGN%3D%22RIGHT%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%21-- End Banner --%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%21-- Begin Dialog --%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD ALIGN%3D%22LEFT%22%3E"/>

  <PublishHtmFileContents Include="%3CTABLE CELLPADDING%3D%222%22 CELLSPACING%3D%220%22 BORDER%3D%220%22 WIDTH%3D%22540%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD WIDTH%3D%22496%22%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%21-- Begin AppInfo --%3E"/>

  <PublishHtmFileContents Include="%3CTABLE%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD COLSPAN%3D%223%22%3E%26nbsp%3B%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CB%3EName%3A%3C%2FB%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD WIDTH%3D%225%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 WIDTH%3D%2210%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E$(ApplicationName)%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD COLSPAN%3D%223%22%3E%26nbsp%3B%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CB%3EVersion%3A%3C%2FB%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD WIDTH%3D%225%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 WIDTH%3D%2210%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E$(VersionNumber)%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD COLSPAN%3D%223%22%3E%26nbsp%3B%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CB%3EPublisher%3A%3C%2FB%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD WIDTH%3D%225%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 WIDTH%3D%2210%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E$(Publisher)%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3Ctr%3E"/>

  <PublishHtmFileContents Include="%3Ctd colspan%3D%223%22%3E%26nbsp%3B%3C%2Ftd%3E"/>

  <PublishHtmFileContents Include="%3C%2Ftr%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%21-- End AppInfo --%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%21-- Begin Prerequisites --%3E"/>

  <PublishHtmFileContents Include="%3CTABLE ID%3D%22BootstrapperSection%22 BORDER%3D%220%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD COLSPAN%3D%222%22%3EThe following prerequisites are required%3A%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD WIDTH%3D%2210%22%3E%26nbsp%3B%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CUL%3E"/>

  <PublishHtmFileContents Include="%3CLI%3EWindows Installer 3.1%3C%2FLI%3E"/>

  <PublishHtmFileContents Include="%3CLI%3E.NET Framework 3.5 SP1%3C%2FLI%3E"/>

  <PublishHtmFileContents Include="%3CLI%3E.NET Framework 3.0 (x86)%3C%2FLI%3E"/>

  <PublishHtmFileContents Include="%3CLI%3E.NET Framework 3.5%3C%2FLI%3E"/>

  <PublishHtmFileContents Include="%3C%2FUL%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD COLSPAN%3D%222%22%3E"/>

  <PublishHtmFileContents Include="If these components are already installed, you can %3CSPAN CLASS%3D%22JustThisApp%22%3E"/>

  <PublishHtmFileContents Include="%3CA HREF%3D%22CsodOfflinePlayer.application%22%3Elaunch%3C%2FA%3E"/>

  <PublishHtmFileContents Include="%3C%2FSPAN%3E the application now. Otherwise, click the button below to install the prerequisites and run the application."/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD COLSPAN%3D%222%22%3E%26nbsp%3B%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%21-- End Prerequisites --%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%21-- Begin Buttons --%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD ALIGN%3D%22LEFT%22%3E"/>

  <PublishHtmFileContents Include="%3CTABLE CELLPADDING%3D%222%22 CELLSPACING%3D%220%22 BORDER%3D%220%22 WIDTH%3D%22540%22 STYLE%3D%22cursor%3Ahand%22 ONCLICK%3D%22window.navigate(InstallButton.href)%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD ALIGN%3D%22LEFT%22%3E"/>

  <PublishHtmFileContents Include="%3CTABLE CELLPADDING%3D%221%22 BGCOLOR%3D%22%23333333%22 CELLSPACING%3D%220%22 BORDER%3D%220%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CTABLE CELLPADDING%3D%221%22 BGCOLOR%3D%22%23cecece%22 CELLSPACING%3D%220%22 BORDER%3D%220%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CTABLE CELLPADDING%3D%221%22 BGCOLOR%3D%22%23efefef%22 CELLSPACING%3D%220%22 BORDER%3D%220%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD WIDTH%3D%2220%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 WIDTH%3D%2220%22 HEIGHT%3D%221%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3CA ID%3D%22InstallButton%22 HREF%3D%22setup.exe%22%3EInstall%3C%2FA%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD width%3D%2220%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 WIDTH%3D%2220%22 HEIGHT%3D%221%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3CTD WIDTH%3D%2215%%22 ALIGN%3D%22right%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%21-- End Buttons --%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%21-- End Dialog --%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%21-- Spacer Row --%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E%26nbsp%3B%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD%3E"/>

  <PublishHtmFileContents Include="%3C%21-- Begin Footer --%3E"/>

  <PublishHtmFileContents Include="%3CTABLE WIDTH%3D%22100%%22 CELLPADDING%3D%220%22 CELLSPACING%3D%220%22 BORDER%3D%220%22 BGCOLOR%3D%22%23ffffff%22%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD HEIGHT%3D%225%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 HEIGHT%3D%225%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD CLASS%3D%22FooterText%22 ALIGN%3D%22center%22%3E"/>

  <PublishHtmFileContents Include="%3CA HREF%3D%22http%3A%2F%2Fgo.microsoft.com%2Ffwlink%2F%3FLinkId%3D154571%22%3EClickOnce and .NET Framework Resources%3C%2FA%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD HEIGHT%3D%225%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 HEIGHT%3D%225%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3CTR%3E"/>

  <PublishHtmFileContents Include="%3CTD HEIGHT%3D%221%22 bgcolor%3D%22%23cecece%22%3E"/>

  <PublishHtmFileContents Include="%3CSPACER TYPE%3D%22block%22 HEIGHT%3D%221%22 %2F%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%21-- End Footer --%3E"/>

  <PublishHtmFileContents Include="%3C%2FTD%3E"/>

  <PublishHtmFileContents Include="%3C%2FTR%3E"/>

  <PublishHtmFileContents Include="%20"/>

  <PublishHtmFileContents Include="%3C%2FTABLE%3E"/>

  <PublishHtmFileContents Include="%3C%2FBODY%3E"/>

  <PublishHtmFileContents Include="%3C%2FHTML%3E"/>

</ItemGroup>

<WriteLinesToFile Lines="@(PublishHtmFileContents)" File="publish.htm" Overwrite="true"/>

A: I use batch scripts with mage.exe to create my manifests and publish page.  Updating the publish.htm page is trivial.  There's a section in the HTML file that looks like this:
<!-- Begin AppInfo -->
<TABLE>
<TR>
<TD COLSPAN="3"> </TD></TR><TR><TD><B>Name:</B></TD>
<TD WIDTH="5"><SPACER TYPE="block" WIDTH="10" /></TD><TD>AppName</TD>
</TR>
<TR>
<TD COLSPAN="3"> </TD></TR><TR><TD><B>Version:</B></TD>
<TD WIDTH="5"><SPACER TYPE="block" WIDTH="10" /></TD><TD>1.0.0.0</TD>
</TR>
<TR>
<TD COLSPAN="3"> </TD></TR><TR><TD><B>Publisher:</B></TD>
<TD WIDTH="5"><SPACER TYPE="block" WIDTH="10" /></TD>
<TD>AppPublisher</TD>
</TR>
<tr><td colspan="3"> </td></tr>
</TABLE>
<!-- End AppInfo -->

In my scripts, I just have that "basic" publish.htm file as a template, and I do string search/replacement for AppName, 1.0.0.0, and AppPublisher with whatever values I want to plug in.
Also, if you're not familiar with mage.exe, I'd check out MageUI first, then get your mage.exe scripts written (if you're going to be doing this more than once or twice).


text:
Q: How to measure scalability in a distributed system Are there in the literature some standard scalability measures for distributed systems? I'm searching in google (and also google scholar) but I came up with only few papers (e.g., https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=862209).
In particular, I was wondering if there are some scalability measures for the three axes of the AKF cube or cube of the scalability (http://microservices.io/articles/scalecube.html), which is described in the book The Art of Scalability, by Abbott and Fischer.

A: There is no such unit for scalability. However, it is often illustrated by chart having the amount of resources in X-axis and throughput or latency in the Y-axis.


text:
Q: "Class not registered" SQL Server 2005 error in SQL Server 2016? IT recently installed SQL Server 2016 SP2 Standard Edition (64-bit) on our new Windows server. This is the only SQL Server version that has been installed.
Today I'm trying to connect to Integration Services via SSMS, and I'm getting this error that references SQL Server 2005 Integration Services service:

Connecting to the Integration Services service on the computer "OUR_SERVER" failed with the following error: "Class not registered".
This error can occur when you try to connect to a SQL Server 2005 Integration Services service from the current version of the SQL Server tools. Instead, add folders to the service configuration file to let the local Integration Services service manage packages on the SQL Server 2005 instance.

Why is the error referencing SQL Server 2005 when I try to connect to Integration Services? I can connect to Analysis Services, Reporting Services, and Database Engine with no issue.
Regarding the SSMS version, the "About" dialog says I'm using v18.4, although it also says I'm using v15.0.18206.0. I guess one's the version and the other's the file version.


text:
Q: laravel help. Eloquent. Items that have comments > 2 im new to laravel.
I have got a problem with getting the objects of:
Items that have comments > 2.
Just to be clear. one item have many comments.

A: $items = $items->filter(function($item)
{
    return $item->comments()->count() > 2;
});


text:
Q: Is it safe to rename extern method parameters in C#? I am currently cleaning up some of our legacy code base in which we make use of extern methods. The parameter names are all over the place in terms of naming conventions. I'd like to consolidate them.
Example
[DllImport("customdll", CallingConvention = CallingConvention.Cdecl)]
public static extern void SetStatus(int new_status);

Can I safely rename new_status to newStatus or will that break the contract?
ReSharper suggests it as a change, but I'd like to verify it. I was not able to find documentation on it (for or against it).
I am not asking if renaming the method name itself is possible, just the parameter definitions.
References

*

*Alias for function

A: Yes, it is safe to change the name of the parameters (but not the method itself) as long as you keep them in the same order with the proper data types. Parameters in traditional DLLs are populated by ordinal, not by name.
You can also change the name of the method itself if you use the EntryPoint parameter in the DllImport constructor.


text:
Q: Finding Tables from existing MS-Word File using MATLAB (ActiveX) (Hello, this is a similar question to I've made but that was working with an embedded word doc within another word doc. Hopefully this is an easier alternative as it is directly accessing a table within a word doc)
I am currently trying to access information on an existing Word document through MATLAB. I've found ActiveX capability through MATLAB to access a Word document, but I'm not well versed in MATLAB or VBA.
Specifically, this project hopes to take in a Word document, look through its contents, extract information from a table, and then be able to modify, parse, compare, etc. the data within MATLAB.
I've found resources that show how to initiate activex through MATLAB and open a Word Document but, I'm not sure how to go about finding the tables within the Word doc and then extract the table information to store in MATLAB.
Any help or advice would much appreciated!
I've used the following links for my initial attempts
Connecting to Word through ActiveX, opening the document, and then finding a keyword: https://www.mathworks.com/matlabcentral/answers/344080-how-to-use-activex-to-search-word-documents-for-a-phrase-and-delete-the-document
Word VBA Reference Points: https://learn.microsoft.com/en-us/office/vba/api/overview/Word/object-model
Exploring COM Objects through ActiveX: https://www.mathworks.com/help/matlab/matlab_external/exploring-your-object.html#f90970
% Connect to Word
Word = actxserver('Word.application');
Word.Visible = 0;

% Open Doc
WDoc = Word.Document.Open('filename');

% Find the Keyword
select = Word.Selection;
...


text:
Q: Can python output multiple random numbers? How can they be uniformly distributed and also be random? I have started to learn python. I am using the book "Python scripting for computational science." I am trying to write a program for
"Write a script that prints a uniformly distributed random number between
−1 and 1. The number should be written with four decimals as implied by
the %.4f format."

I am using random.uniform to get the random number. But I can't find a function to get more than one random number. For example my code is
print random.uniform(-1, 1)

It gives the output 0.238638833859. But I want more than one uniform random number. Can any body tell me a function?
One more thing, I want to learn python for scripting purpose. So can anybody suggest a good book? I want to use python for web automation. The book I am using is not ideal for that. Kindly suggest me good book.

A: Try that:
for x in range(4):
    print '%.4f' % random.uniform(1,-1)

Maybe you'll enjoy the book:
Learning Python - 4th Edition by Mark Lutz

A: Could you be looking for something like this:
[random.uniform(-1+x, 1+x) for x in range(10)]


text:
Q: How can i add items to java text file through GUI combo box(netbeans) I have already defined the items in the combo box inside gui. What happens is that im trying to add an entry to the program text file and it says: incompatible types int cannot be converted to string.
I am having problems with setLocation and setSkills.
private void buttonAddActionPerformed(java.awt.event.ActionEvent evt)
{

   Resort p = new Resort();
   p.setName(nameTextField.getText().replaceAll("[^a-z.]", ""));
   p.setLocation(comboResortLocation.getSelectedIndex());
   p.setSkillsByIndex(comboResortSkill.getSelectedIndex());
   txtfile.addResort(p);

   AddedConfirm confirmed = new AddedConfirm();
   confirmed.setVisible(true);
   this.setVisible(false);
}

And the part of the code from the other file.
public void setSkillsByIndex (String skills)
{
    this.skills = skills;
}

A: Got it fixed already.
I just had to change them to Strings and use getSelectedItem instead:
   p.setLocationByIndex((String) comboResortLocation.getSelectedItem());

   p.setSkillsByIndex((String) comboResortSkill.getSelectedItem());

and the other file:
public void setLocationByIndex (String location)
        {
            this.location = location;
    }

public void setSkillsByIndex (String skills) {
            this.skills = skills;
    }


text:
Q: How to preserve formats when generating a CSV file from DataGridView? I have the below code to generate a CSV file from DataGridView and working fine. But it is not preserving the exact formats. For example, I have 125600.00 in one cell and 08 in another cell in the DataGridView. When I opened the CSV file using Excel, it is showing them as 125600 and 8. And when I opened the CSV file using a notepad, it shows them correct 125600.00 and 08. Is there something that I can do to see the same formats in the excel?
Thanks for any suggestions.
private void btnPrint_Click(object sender, EventArgs e)
    {
        sbMainFile = new StringBuilder();
        int dgcolcount = this.dataGridView1.Columns.Count;

        for (int i = 0; i < dgcolcount; i++)
        {
            sbMainFile.Append(this.dataGridView1.Columns[i].Name);
            if (i < dgcolcount - 1)
            {
                sbMainFile.Append(",");
            }
        }
        sbMainFile.Append("\r\n");

        StringBuilder sbRow = null;

        foreach (DataGridViewRow row in this.dataGridView1.Rows)
        {
            sbRow = new StringBuilder();
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                sbRow.Append(row.Cells[i].Value.ToString());
                if (i < dgcolcount - 1)
                {
                    sbRow.Append(",");
                }
            }
            sbMainFile.AppendLine(sbRow.ToString());
        }

        SaveFileDialog savefile = new SaveFileDialog();
        savefile.FileName = "default";
        savefile.Filter = "CSV Files | *.csv";
        savefile.DefaultExt = "csv";

        if (savefile.ShowDialog() == DialogResult.OK)
        {
            using (System.IO.StreamWriter sw = new System.IO.StreamWriter(savefile.FileName))
                sw.Write(sbMainFile.ToString());
        }

    }

A: You could save the "column values" as a string; e.g. 08 as ="08"
change
sbRow.Append(row.Cells[i].Value.ToString());

to
sbRow.AppendFormat("=\"{0}\"", row.Cells[i].Value.ToString());

A: There is nothing wrong with your code. That is actually a problem with Excel formatting your data for you. You don't actually lose any data. You simply have to specify the format in Excel. (If you click on one of your cells where the format is mangled you can actually see the "raw" value in the f(x) editor.)


text:
Q: Automatically add method at the end of method chain I'm building a JavaScript class and I would like to return a result at the end of a method chain without calling a specific method.
Example 1: myDate('01/01/2000').add(1, 'day') should return 01/02/2000.
Example 2: myDate('01/01/2000').add(1, 'day').format('MMMM D YYYY') should return January 2 2000.
I know that this is possible using a JS class because saw it working in DayJs, I just don't understand how: https://github.com/iamkun/dayjs/blob/dev/src/index.js#L77
For now, what I have looks like this:
class MyDate {
  constructor(date) {
    this.date = date;
  }

  add(count, unit) {
    this.date = // function
    return this; // to enable method chaining
  }

  format() {
    this.date = // function
    return this.date; // to return the desired result
  }

  get() {
    return this.date;
  }
}

// wrapper function to instantiate class on function call
const myDate = date => new MyDate(date);

With this setup, I get the following behavior:
Example 3: myDate('01/01/2000').add(1, 'day') returns { date: 01/02/2000} instead of 01/02/2000.
Example 4: myDate('01/01/2000').add(1, 'day').format('MMMM D YYYY') returns January 2 2000 as expected.
Example 5: myDate('01/01/2000').add(1, 'day').get() returns 01/02/2000 but there is that nagging get() that I would like to eliminate...
I googled the issue, "js detect end of method chain" and such, but I couldn't find any results that would explain how this works.
Thanks for your help!

A: Logically speaking add method on a class should return the object instance instead of a particular member variable.
What you have as of now is perfect and that's how any user would expect it to work.
Imagine a case where you had to add another member variable, say time to your class and you want to chain something like object.add(1, 'day').add(5, 'hour'). You can achieve this only if your add function returns an instance of your class.
It is also perfectly fine to have to attach a get() method at the end. Consider the famous moment.js package. Even they have a format() method to get the actual date object.
Hope this clarifies your confusion.

A: Looking back at it, what I wanted to do was a class that had the following features:

*

*import myDate from "./myDate.js"

*import { isMyDate } from "./myDate.js"

*No need to use the new keyword to instantiate

*Can pass an unlimited number of arguments

*With function chaining

*console.log(myDate(params)) outputs a custom string MyDate<date_in_ms)>

*${myDate(params)} outputs a custom string date_in_ms
Here is a possible implementation of it:
// Custom console.log
// Deno: https://doc.deno.land/builtin/stable#Deno.inspect
const inspect = Symbol.for("Deno.customInspect")
// Node: https://nodejs.org/api/util.html#util_util_inspect_custom
// const inspect = Symbol.for('nodejs.util.inspect.custom');

class MyDate {
  constructor(date = new Date(), options) {
    // Set the class's properties
    this._date = date;
    this._options = options;

    // Run initialization tasks
    this.initialize();
  }

  initialize() {
    // if Date, convert time to milliseconds
    if (this._date instanceof Date) {
      this._date = this._date.getTime();
    }
  }

  // Output the result
  format() {
    return this._date;
  }

  // Chainable function
  add(amount) {
    this._date += amount;
    return this;
  }

  // Output all the parameters past after the first one
  options() {
    return this._options;
  }

  // Custom console.log
  [inspect]() {
    return `MyDate<${this._date}>`;
  }

  // Custom String output
  toString() {
    return `${this._date}`;
  }
}

// Automatically instantiate class
const myDate = (date, ...options) => {
  return new MyDate(date, options);
}

// Stand-alone function
const isMyDate = date => date instanceof MyDate;
// Access the stand-alone funtion from the MyDate instance
myDate.isMyDate = date => isMyDate(date);

export default myDate;
export { isMyDate };

Link to Dev.to article: https://dev.to/rildev/modern-es6-class-48pb
Link to live proof-of-concept: https://replit.com/@RilDev/ModernES6Class


text:
Q: Index column not resetting after I apply filter in Dax? I have table which shows time difference between different types of ID's for when an alert is given. The time since prev will say when the next alert is on the device ID.
my table looks like this:
Time                 Device ID      Type           TimeSincePrev(seconds)        index
22.1.21 04:02:04         12         None                 0                         1
22.1.21 04:24:07         13         low                 1320                       2
22.1.21 04:26:04         14          medium            120                        3
......

...
......
...
...

However When I filter by deviceID, the indexes will not reset to 1,2,3...., instead, it will go to a random number, causing the timesinceprev alert to be wrong. How do I correct so that index is correct, hopefully correcting the TimeSincePrev column. Also if there is a way to get TimeSincePrev to show seconds via the the seconds and not just via the minute like it is now
This is what the query for the index column looks like:
index= COUNTROWS(FILTER(VALUES('Table'[Time]),
                        'Table'[Time]<EARLIER('Table'[Time])
    ))+1

Here is how TimeSincePrev:
TimeSincePrev= IF(DATEDIFF(LOOKUPVALUE('Table'[Time],'Table'[index],

'Table'[index]-1),MINUTE)>720,BLANK(),DATEDIFF(LOOKUPVALUE('Table'[Time],

'Table'[index],'Table'[index]-1),'Table'[Time],MINUTE))*60

How do I get it so when I filter by device ID the indexes don't mess up like this:
Time                 Device ID      Type           TimeSincePrev(seconds)        index
22.1.21 04:02:04         12         None                 0                         6
22.1.21 04:24:07         12         low                 1320                       3
22.1.21 04:26:04         12         medium            120                          1
22.1.21 04:02:04         12         None                 0                         2
22.1.21 04:24:07         12         low                 1320                       4
22.1.21 04:26:04         12          medium            120                         5
......

...
......
...
...

A: Are you using a column for this? If so, you need to create a measure that handles the indexing instead.
Columns are re-calculated only at refresh time (when you refresh the dataset), NOT at query time (when you click on slicers). The column cannot respond to your selected slicer value and calculate on the fly.


text:
Q: How do I read extra lines of a text file in addition to my DataGridView? private void open(object sender, EventArgs e)
{
    // only works for opening the table
    dataGridView1.Rows.Clear();
    OpenFileDialog openDialog = new OpenFileDialog();

    if (openDialog.ShowDialog() == DialogResult.OK)
    {
        fileLabel.Text = openDialog.FileName;

        // Use File.ReadAllLines, it's easier
        string[] lines = File.ReadAllLines(openDialog.FileName);

        foreach (string line in lines)
        {
            var text = line.Split(',', '\n');
            dataGridView1.Rows.Add(text);
        }

        for (int i = 0; i < dataGridView1.Rows.Count; i++)
        {
            dataGridView1.Rows[i].HeaderCell.Value = (i + 1).ToString();
        }

    }
}

This is currently my code for opening and reading. So I also have the writing code (actually I wrote a text file already) and I want to add in a few more pieces of information somewhere on the form but not on the dataGridView1
Now in my previous version I had the following code added for reading the extra lines of a text file.
int k = 0;
while (k < lines.Length)
{
    for (int j = 0; j < twoDTextBox.GetLength(0); j++)
    {
        for (int i = 0; i < twoDTextBox.GetLength(1); i++)
        {
            statsBonus[j, i].Text = lines[k];
            k++;
        }
    }

    // these lines I would like to add to read in my new file
    textBox1.Text = lines[k];
    k++;
    comboBox1.SelectedItem = lines[k];
    k++;
    checkBox1.Checked = Convert.ToBoolean(lines[k]);
    k++;
}

Before I used to use textboxes but later found out it wasn't really efficient and dynamic.
So now how do I add the bottom lines to my form after reading the DataGridView lines?


text:
Q: Meaning of free variables Consider the statement:
$$\forall x [x=x] \tag1$$
And the statement:
$$x=x \tag2$$
Statement $(1)$ is easily understood: for every $x$ in the universe, $x=x$ is true.
However, what does statement $(2)$ mean? What even is $x$? What is the statement claiming? How does one decide is truth? I have seen theorem-proving machines remove and adjoin $\forall x$ at will; how is this justified?

A:
what does the statement $x=x$ mean?

The details of the semantics of the language dictate "how to read" a formula with free variables.
Usually, we use a "context" [technically called: variable assignment function], i.e. a way to assign a "temporary meaning" to the free variables.
We can compare a free variable to a pronoun of natural language.
To assert "$x$ is red" is the same as "it is red": its meaning depends on what the context assigns to "it".
In the same way, we can read $x=x$ as follows: "it is equal to itself", that is true for whatever "object" we will assign to "it" as reference.

Proof systems for first-order logic have rules for adding and removing the quantifiers.
The first one:

$\forall x \varphi \vdash \varphi[x/a]$,

corresponds to the specialization principle : "what holds for all, holds for any".
And the same intuition supports the corresponding introduction rule (aka: generalization rule):

if $Γ ⊢ \varphi[x/a]$, then $Γ ⊢ ∀x \varphi$, provided that $x$ is not free in $\Gamma$;

"if something holds for an arbitrary object, then it holds for all objects".

But the example can be a little bit misleading: the fact that $x=x$ and $\forall x (x=x)$ are "equivalent", does not mean that this is so in general.
Compare $x=0$ and $\forall x (x=0)$ in $\mathbb N$. The first one is sometime true (if we assign to $x$ the "temporary meaning" $0$) and sometime false (for $x$ meaning $1$) while the second is plainly false.

A: In "Understanding Identity Statements" by Thomas Morris you will find a discussion of "$x = x$" in the context of the famous examples,

Hesperus is Phosphorus
Phosphorus is Phosphorus

Initially, the first example does not seem problematic since it seems to be conveying the information that two names denote a single object.  The truth of the statement seemingly resides with an answer to the question of whether or not it is indeed the case that the two names denote a single object.  But, the second example introduces a problem.
Presumably, one needs no account of truth beyond the form of the statement to claim that the statement is true.  This is referred to as an analytical conception of truth, and is said to be based upon the meaning of words.  Unfortunately, a semantic conception of truth is presumably based upon denotations given through a satisfaction mapping.  And, while one can no more demonstrate the existence of zero than one can demonstrate a completed infinity, the received view of semantics in mathematics is Tarski's semantic conception of truth.
This means that "$x = x$" actually presents a problem in the foundation of mathematics that is masked by the first-order schema asserting the truth of every instance through the reflexive axiom.  The truth being asserted here is through an analytical conception and not a semantic conception.
In Frege's original formulation of mathematical logic, any statement containing a non-denoting term was simply false.  Hence, "$t = t$" could be a false statement if the term $t$ does not denote.  The modern logic with this semantics is called negative free logic.  One of the characteristics of negative free logic is the "identity of non-existents".  If you read Frege's first paper on arithmetic, you will find that he invokes this property to define the number $0$.  Using "$\neg ( x = x )$" as a concept with a vacuous extension, he had an "extension of a concept" that could be proven to be unique.  From this as a base case, he developed his definition of cardinal numbers.
In free logic, one speaks of "existential import".  The axioms of first order logic impose existential import in the quantifier rules.  So, there is no explicit relationship between identity statements and the semantic interpretation of an existential quantifier (think about Henkin arguments and models built from constants).  However, this relationship is restored by an axiom used by Tarski in his algebraization of first-order logic via cylindric algebras.
The axiom
$$
\forall x \forall y( x = y \leftrightarrow \exists z ( x = z \wedge z = y ) )
$$
serves to ensure that the correlate to identity for the algebraic presentation is transitive.  As can be seen from the syntax, the truth of an identity statement is now bound to an existential quantifier.  But, since cylindric algebras are motivated by first-order logic, an axiom corresponding to $\forall x ( x = x )$ will also be present.


text:
Q: JavaScript "Module A" is imported by "Module B". B executes an A method A executes a call back to B and errors I have code in module A (Ajax Call) to do a Generic Ajax Call based on properties passed on Call.
Module B (Calling Ajax to get codes from database) imports the Ajax Module and calls the Module A Ajax with a property of B.CallBack to execute on success.
Issue is that Module A doesn't import Module B (an all others that may use it) and so when eval(B.CallBack(data)) B is not defined.
I want to do this as my Ajax function has a few standard function I would like to run for collection of statistics and handling major failures on network or database
Here is example code Module A (Ajax Call)
 export class Ajax {
    constructor() {
        this.url = "https://localhost:44381";
        this.id = 1;
    }
    static url;
    static id;
     call(properties) {

        let id = 1;

        $.ajax({
            type: properties.type ?? "Get",
            crossDomain: true,
            url: this.url + properties.url.trim(),
            data: properties.data != null ? properties.data(): {},
            contentType: "application/json; charset=utf-8",
            dataType: properties.dataType ?? "json",
            xhrFields:
            {
                withCredentials: true,
                crossDomain: true
            },
                beforeSend: function () {
                    if (properties.beforeSend) {
                        properties.beforeSend()
                    }
                    Stats.start(id, properties.url)
                    $("navbar-icon").addClass('csa-icon-rotate').removeClass('csa-icon');

                },
                success: function (response) {
                    eval(properties.callBack + `(${JSON.stringify(response)})`);
                },
            failure: function (response) {
                    if (properties.failure) {
                        eval(properties.failure + `(${JSON.stringify(response)})`);
                    }
                },
            error: function (response) {
                    if (properties.error) {
                        eval(properties.error + `(${JSON.stringify(response)})`);
                     }

                },
                complete:function (){
                    Stats.end(id)
                    $("navbar-icon").addClass('csa-icon').removeClass('csa-icon-rotate');
                }

        });
    }

}

(Module B) Calling module call ajax to get codes from database

import { Ajax } from "../../../helpers/dist/js/ajax.js";
    export class Code {

        constructor() {

        }

        static messages = function () {
            return {
                "allCode": {
                    "url": "/code/v1/all",
                    "callBack": "Code.populate",
                    "error": "Code.error",
                    "type": "Post",
                    "dataType": "json"
                }
            }
        }

        static get = function() {
            let ajax = new Ajax();
            try {
                ajax.call(this.messages().allCode);
            } catch (e) {
                alert(e)
            }
        }
    static populate = function (data) {
            alert('Called back');
        }
        static error = function (data) {
            alert("Error in Code");
        }

    }


text:
Q: jQuery: wait for function to complete to continue processing? Hey all.  I have, what appears to be, a trivial problem.  I have the following JavaScript:
$(function() {
    var r = GetResults();

    for(var i = 0; i < r.length; i++) {
        // Do stuff with r
    }
});

function GetResults() {
   $.getJSON("/controller/method/", null, function(data) {
       return data;
   });
}

Due to the fact that I'm calling a method asynchronously, the script continues executing and when it encounters the for loop, r obviously isn't going to have a value yet.  My question is: when I have a method that is doing an asynchronous operation, and I'm dependent on the data it returns back in the main block, how do I halt execution until the data is returned?  Something like:
var r = GetResults(param, function() {

});

where the function is a callback function.  I cannot move the for loop processing into the callback function of the JSON request because I am reusing the functionality of GetResults several time throughout the page, unless I want to duplicate the code. Any ideas?

A: I've run into something similar before. You'll have to run the ajax call synchronously.
Here is my working example:
$.ajax({
    type: "POST",
    url: "/services/GetResources",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    data: '{resourceFileName:"mapedit",culture:"' + $("#lang-name").val() + '"}',
    cache: true,
    async: false, // to set local variable
    success: function(data) {
        localizations = data.d;
    }
});

A: Ajax already gives you a callback, you are supposed to use it:
function dostuff( data ) {
    for(var i = 0; i < data.length; i++) {
        // Do stuff with data
    }
};
$(document).ready( function() {
    $.getJSON( "/controller/method/", null, dostuff );
});

A: You could do this:
$(function() {
    PerformCall();
});

function PerformCall() {
   $.getJSON("/controller/method/", null, function(data) {
       for(var i = 0; i < data.length; i++) {
        // Do stuff with data
       }
   });
}

A: The short answer is that you can't block on an asynchronous operation...which is of course, the meaning of "asynchronous".
Instead, you need to change your code to use a callback to trigger the action based on the data returned from the $.getJSON(...) call. Something like the following should work:
$(function() {
  GetResults();
});

function GetResults() {
  $.getJSON("/controller/method/", null, function(data) {
    for(var i = 0; i < data.length; i++) {
      // Do stuff with data
    }
  });
}

A: Given your updated requirements ...

I cannot move the for loop processing
  into the callback function of the JSON
  request because I am reusing the
  functionality of GetResults several
  time throughout the page, unless I
  want to duplicate the code. Any ideas?

... you could modify GetResults() to accept a function as a parameter, which you would then execute as your $.getJSON callback (air code warning):
$(function() {
    GetResults(function(data) {
        for(var i = 0; i < data.length; i++) {
            // Do stuff with data
        }
    });
});

function GetResults(callback) {
   $.getJSON("/controller/method/", null, callback);
}

As you can see from the general tide of answers, you're best off not trying to fight the asynchronous jQuery programming model. :)

A: move your "do stuff with r" block into your $.getJSON callback.  you can't do stuff with r until it has been delivered, and the first opportunity you'll have to use r is in the callback... so do it then.
$(function() {
    var r = GetResults();
});

function GetResults() {
   $.getJSON("/controller/method/", null, function(data) {
       for(var i = 0; i < data.length; i++) {
           // Do stuff with data
       }
       return data;
   });
}

A: This is not possible.
Either you make your function synchronous or you change the design of your code to support the asynchronous operation.

A: Move the data processing into the callback:
$(function() {
    GetResults();
});

function GetResults() {
   $.getJSON("/controller/method/", null, function(data) {

       for(var i = 0; i < data.length; i++) {
           // Do stuff with data
       }
   });
}

A: You can have a callback with parameters that should work nicely...
$(function() {
    GetResults(function(data) {
      for(var i = 0; i < data.length; i++) {
        // Do stuff with data
      }
    });

});

function GetResults(func) {
   $.getJSON("/controller/method/", null, func);
}


text:
Q: ActiveMQ Artemis Producer performance issue with 30k address/queues I have an application that needs to send messages to ~30k address. I used to have OpenMQ as my broker and use JMS. The JMS client code that I have was capable of sending ~30k messages to the broker within few seconds. Then I switched to Artemis and the send performance degraded drastically. Now it takes up to 10 minutes to send all the messages to Artemis broker.
I played with different configuration settings both on the server (broker.xml) and also via connection URL.
Address setting on broker.xml
<address-setting match="#">
   <!-- <dead-letter-address>DLQ</dead-letter-address> -->
   <!-- <expiry-address>ExpiryQueue</expiry-address> -->
   <redelivery-delay>0</redelivery-delay>
   <!-- with -1 only the global-max-size is in use for limiting -->
   <max-size-bytes>-1</max-size-bytes>
   <message-counter-history-day-limit>10</message-counter-history-day-limit>
   <address-full-policy>DROP</address-full-policy>
   <auto-create-queues>true</auto-create-queues>
   <auto-create-addresses>true</auto-create-addresses>
   <auto-create-jms-queues>true</auto-create-jms-queues>
   <auto-create-jms-topics>true</auto-create-jms-topics>
</address-setting>

Sending
private static final String BROKER_URL = "tcp://localhost:61616?minLargeMessageSize=10485760;compressLargeMessages=true;producerWindowSize=-1";

ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(BROKER_URL);
factory.setDupsOKBatchSize(50 * 1024 * 1024);
factory.setProducerWindowSize(-1);
factory.setBlockOnDurableSend(false);
factory.setBlockOnNonDurableSend(false);
factory.setCacheDestinations(true);
System.out.println("Connection factory " + factory.toString());

Connection connection = factory.createConnection();
Session producerSession = connection.createSession(false, ActiveMQJMSConstants.PRE_ACKNOWLEDGE);
MessageProducer producer = producerSession.createProducer(null);
producer.setDisableMessageID(true);
producer.setDisableMessageTimestamp(true);

// Create a JMS message of type ByteMessage, and send

producer.send(destination, jmsMessage, DeliveryMode.NON_PERSISTENT, JMS_MESSAGE_PRIORITY, DEFAULT_TTL);

With above code (simplified for readability) I only get 20 to 40 messages per second.
Am I missing something? Or is it some performance penalty introduced by JMS to Core conversion from Artemis client library?
Is there anything I can do to improve the message rate?


text:
Q: Add all features to a popup using in Leaflet using WMS GetFeatureInfo I'm using the function below to successfully add data to a popup in Leaflet.
Unfortunately, only the data from the last feature found is added. Is there any way to add the data from all features found to the popup.
function identify (e) {

var BBOX = map.getBounds().toBBoxString();
var WIDTH = map.getSize().x;
var HEIGHT = map.getSize().y;
var X = map.layerPointToContainerPoint(e.layerPoint).x;
var Y = map.layerPointToContainerPoint(e.layerPoint).y;
var url = 'http://maps.dartmoor.gov.uk/geoserver/wms/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetFeatureInfo&layers=general:dnpa_planapps&BBOX='+BBOX+'&FEATURE_COUNT=5&info_format=application/json&propertyName=appcode,url&HEIGHT='+HEIGHT+'&WIDTH='+WIDTH+'&query_layers=general:dnpa_planapps&SRS=EPSG:4326&buffer=15&X='+X+'&Y='+Y;

$.ajax({
    url:url,
    datatype: "json",
    type: "GET",
    success:handleJson
    });
    function handleJson(data) {
    for (var i = 0; i < data.features.length; i++) {
    var feature = data.features[i];
    console.log(feature)
        L.popup()
        .setLatLng(e.latlng)
        .setContent(L.Util.template("
{appcode}

{url}
", feature.properties))
        .openOn(map);
        }
    }
}

A: I think your loop needs to be something like:
var txt="";
for (var i = 0; i < data.features.length; i++) {
    var feature = data.features[i];
    console.log(feature);
    txt = txt.concat( L.Util.template("
{appcode}

{url}
", feature.properties));
 }
 L.popup()
   .setLatLng(e.latlng)
   .setContent(txt)
   .openOn(map);


text:
Q: Can not install vue-cli, no matching version found I can not install vue-cli, it asks me to install specific express-serve-static package, however i could not install that package as well. How can i solve this issue?
When I am trying to install vue-cli,
sudo npm install -g @vue/cli

gives me the error:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @types/express-serve-static-core@4.17.13.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'apollo-server-express'

*

*Then I just tried to install express-serve-static

$ npm install -g @types/express-serve-static-core
+ @types/express-serve-static-core@4.17.12
updated 1 package in 4.536s

*

*As you can see, npm did not install the 4.17.13, then i just change the command:

$ npm install -g @types/express-serve-static-core@4.17.13
npm ERR! code ETARGET
npm ERR! notarget No matching version found for @types/express-serve-static-core@4.17.13.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

Node and npm version:
$ node -v
v14.15.1

$ which node
.../Desktop/node_and_npm/node-v14.15.1-darwin-x64/bin/node

$ npm -v
6.14.8

$ which npm
.../Desktop/node_and_npm/node-v14.15.1-darwin-x64/bin/npm


text:
Q: JSTree and IE(7/8): all non-leaf nodes open after tree loading i have some issues with JSTree IE(7 and 8): after tree loading, all the non-leaf nodes are open (the tree is loaded from a json data structure, with only one non-leaf node with the "state" object setted to "open" and all the other to "closed"). the same code work properly on ff, opera and safari.
here is the js code: http://jsfiddle.net/yuXxx/
and here is the json generated code (validated): http://pastebin.com/Zw1KYEK5
anybody could help me?
tnx

A: The above issue happening in chrome also.


text:
Q: Debugging HTTP POST I'm trying to execute a PHP script using a HTTP POST request. Here's my Android code that I use
in order to execute the POST.
        String url = "xxx";
        HttpClient client = new DefaultHttpClient();
        HttpPost post = new HttpPost(url);

        // set params
        List<NameValuePair> pairs = new ArrayList<NameValuePair>();
        pairs.add(new BasicNameValuePair("toEmail", toEmail));
        pairs.add(new BasicNameValuePair("toName", toName));
        pairs.add(new BasicNameValuePair("fromEmail", email));
        pairs.add(new BasicNameValuePair("fromName", achternaam));
        pairs.add(new BasicNameValuePair("type", "Manual"));
        pairs.add(new BasicNameValuePair("job", jobId));
        pairs.add(new BasicNameValuePair("firstname", voornaam));
        pairs.add(new BasicNameValuePair("lastname", achternaam));
        pairs.add(new BasicNameValuePair("phone", tel));
        pairs.add(new BasicNameValuePair("email", email));
        pairs.add(new BasicNameValuePair("comment", opmerkingen));

        HttpResponse response;
        post.setEntity(new UrlEncodedFormEntity(pairs));
        response = client.execute(post);

When I debug this code and go into the response itself the BasicStatusLine is: HTTP/1.1 200 OK. Which should
indicate that the PHP script was executed correctly right? Well, the script is supposed to do a mailto. This is the PHP script:
  <?php
    require_once('mail.php');
    require_once('Job.php');

  if (isset($_POST['toEmail'])) {
     sql_insert(array('content' => var_export($_POST, true), 'email' =>
     $_POST['toEmail'], 'type' => $_POST['type']), 'Apply');
     } else {
     sql_insert(array('content' => var_export($_POST, true), 'email' => 'no email',
     'type' => $_POST['type']), 'Apply');
    }

    if (isset($_POST['type']) && $_POST['type'] == 'LinkedIn' && isset($_POST['job'])) {
            $to = 'HARDCODEDEMAIL'
            $from = array('email' => '', 'name' => '');
            $firstname = '';
            $lastname = '';
            $profile = '';
            $img = '';
            $headline = '';
            $location = '';
            $industry = '';
            $current = array();
            $past = array();
            $education = array();
            $recommendations = 0;
            $phone = '';
            $address = '';
            $twitter = array();

            if (isset($_POST['toEmail'])) {
                    $to['email'] = $_POST['toEmail'];
            }
            if (isset($_POST['toName'])) {
                    $to['name'] = $_POST['toName'];
            }

            if (isset($_POST['fromEmail'])) {
                    $from['email'] = $_POST['fromEmail'];
            }
            if (isset($_POST['fromName'])) {
                    $from['name'] = $_POST['fromName'];
            }

            $job = new Job();
            $job->init($_POST['job']);

            if (isset($_POST['firstname'])) {
                    $firstname = $_POST['firstname'];
            }

            if (isset($_POST['lastname'])) {
                    $lastname = $_POST['lastname'];
            }

            if (isset($_POST['profile'])) {
                    $profile = $_POST['profile'];
            }

            if (isset($_POST['img'])) {
                    $img = $_POST['img'];
            }

            if (isset($_POST['headline'])) {
                    $headline = $_POST['headline'];
            }

            if (isset($_POST['location'])) {
                    $location = $_POST['location'];
            }

            if (isset($_POST['industry'])) {
                    $industry = $_POST['industry'];
            }

            if (isset($_POST['current'])) {
                    $currentString = $_POST['current'];
                    $positions = explode("*_*", $currentString);
                    foreach ($positions as $positionString) {
                            $items = explode("**", $positionString);
                            if (count($items) > 0) {
                                    $position = array('title' => '', 'url' => '', 'company' => '');
                                    $position['title'] = $items[0];

                                    if (count($items) > 1) {
                                            $position['company'] = $items[1];

                                            if (count($items) > 2) {
                                                    $position['url'] = 'http://www.linkedin.com/company/' .  $items[2];
                                            }
                                    }

                                    $current[] = $position;
                            }
                    }
            }

            if (isset($_POST['past'])) {
                    $pastString = $_POST['past'];
                    $positions = explode("*_*", $pastString);
                    foreach ($positions as $positionString) {
                            $items = explode("**", $positionString);
                            if (count($items) > 0) {
                                    $position = array('title' => '', 'url' => '', 'company' => '');
                                    $position['title'] = $items[0];

                                    if (count($items) > 1) {
                                            $position['company'] = $items[1];

                                            if (count($items) > 2) {
                                                    $position['url'] = 'http://www.linkedin.com/company/' . $items[2];
                                            }
                                    }

                                    $past[] = $position;
                            }
                    }
            }

            if (isset($_POST['education'])) {
                    $educationsString = $_POST['education'];
                    $educations = explode("*_*", $educationsString);
                    foreach ($educations as $edu) {
                            $education[] = $edu;
                    }
            }

            if (isset($_POST['recommendations'])) {
                    $recommendations = $_POST['recommendations'];
            }

            if (isset($_POST['phone'])) {
                    $phone = $_POST['phone'];
            }

            if (isset($_POST['address'])) {
                    $address = $_POST['address'];
            }

            if (isset($_POST['twitter'])) {
                    $twitterString = $_POST['twitter'];
                    $accounts = explode("*_*", $twitterString);
                    foreach ($accounts as $account) {
                            $twitter[] = $account;
                    }
            }

            $mail = new Email();
            $mail->linkedIn($to, $from, $job, $firstname, $lastname, $profile, $img,
    $headline, $location, $industry, $current, $past, $education, $recommendations,
    $phone, $address, $twitter);
    } else if (isset($_POST['type']) && $_POST['type'] == 'Manual' &&
    isset($_POST['job'])) {

            $to = array('email' => '', 'name' => '');
            $from = array('email' => '', 'name' => '');
            $firstname = '';
            $lastname = '';
            $phone = '';
            $email = '';
            $comment = '';

            if (isset($_POST['toEmail'])) {
                    $to['email'] = $_POST['toEmail'];
            }

            if (isset($_POST['toName'])) {
                    $to['name'] = $_POST['toName'];
            }

            if (isset($_POST['fromEmail'])) {
                    $from['email'] = $_POST['fromEmail'];
            }

            if (isset($_POST['fromName'])) {
                    $from['name'] = $_POST['fromName'];
            }

            $job = new Job();

            $job->init($_POST['job']);

            if (isset($_POST['firstname'])) {
                    $firstname = $_POST['firstname'];
            }

            if (isset($_POST['lastname'])) {
                    $lastname = $_POST['lastname'];
            }

            if (isset($_POST['phone'])) {
                    $phone = $_POST['phone'];
            }

            if (isset($_POST['email'])) {
                    $email = $_POST['email'];
            }

            if (isset($_POST['comment'])) {
                    $comment = $_POST['comment'];
            }

            $mail = new Email();
        var_dump($to);
            $mail->normal('HARDCODEDEMAIL', $from, $job, $firstname, $lastname, $phone, $email,     $comment);

For testing purposes I've hardcoded an email adress into the PHP code. Is anyone able to spot my mistake here? If not: Are there techniques to test the php script with this specific HTTP post?


text:
Q: Analytic maps $\varphi: \mathbb C^n\to \mathbb C^n$ with degenerate differentials Let $B^n\subset \mathbb C^n$ be a unit ball with center $p$ . Let $\varphi: B^n\to \mathbb C^n$ be a complex analytic map such that $d\varphi$ has rank at most $n-1$ at $p$. I would like to know if there exist two distinct paths in $B^n$ starting at $p$ that are mapped to the same path in $\mathbb C^n$.
More formally, I would like to know if the following is always true.
Question. Is it correct that there exists two smooth paths $\gamma_1, \gamma_2: [0,1]\to B^n$ such that
1) $\gamma_1(0)=\gamma_2(0)=p$.
2) $\varphi(\gamma_1(t))=\varphi(\gamma_2(t))$ for all $t\in [0,1]$.
3) $\gamma_1(t)\ne \gamma_2(t)$ for $t>0$.


text:
Q: Regex Comment Conflicts I'm having an issue with my regex. There is a "//" within the regex which has obviously broken the rest of my code...
It's a website verifier and this is by far the best regex I've found for it but MVC is being a pain!
function CheckWeb() {
    if ($("#Company_ContactType").val() == 'WEB') {
        if (/_^(?:(?:https?|ftp):/ / )( ? : \S + ( ? ::\S * ) ? @ @) ? ( ? : ( ? !10( ? : \.\d { 1, 3 }) { 3 })( ? !127( ? : \.\d { 1, 3 }) { 3 })( ? !169\ .254( ? : \.\d { 1, 3 }) { 2 })( ? !192\ .168( ? : \.\d { 1, 3 }) { 2 })( ? !172\.( ? : 1[6 - 9] | 2\ d | 3[0 - 1])( ? : \.\d { 1, 3 }) { 2 })( ? : [1 - 9]\ d ? | 1\ d\ d | 2[01]\ d | 22[0 - 3])( ? : \.( ? : 1 ? \d { 1, 2 } | 2[0 - 4]\ d | 25[0 - 5])) { 2 }( ? : \.( ? : [1 - 9]\ d ? | 1\ d\ d | 2[0 - 4]\ d | 25[0 - 4])) | ( ? : ( ? : [a - z\ x { 00 a1 } - \x { ffff } 0 - 9] + - ? ) * [a - z\ x { 00 a1 } - \x { ffff } 0 - 9] + )( ? : \.( ? : [a - z\ x { 00 a1 } - \x { ffff } 0 - 9] + - ? ) * [a - z\ x { 00 a1 } - \x { ffff } 0 - 9] + ) * ( ? : \.( ? : [a - z\ x { 00 a1 } - \x { ffff }] { 2, })))( ? ::\d { 2, 5 }) ? ( ? : /[^\s]*)?$_iuS/.test) {
            var resultDiv = $("#IsValid");
            resultDiv.text("");
        }
    });
}

is there any way for me to ensure that it doesn't comment out beyond the "test?

A: (?:(?:https?|ftp):/ / )

Should look like:
(?:(?:https?|ftp):\/\/ )

You also have another forward slash toward the end that needs escaped:
( ? : /[^\s]*)?$_iuS

Should be:
( ? : \/[^\s]*)?$_iuS

This results in no pattern errors on regex101


text:
Q: Using libcurl to send an email in C++ I'm following a libcurl sample code and trying to use it to send an email to myself, but there's a few things I'm not quite understanding...
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>

/*
 * For an SMTP example using the multi interface please see smtp-multi.c.
 */

/* The libcurl options want plain addresses, the viewable headers in the mail
 * can very well get a full name as well.
 */
#define FROM_ADDR    "<sender@example.org>"
#define TO_ADDR      "<addressee@example.net>"
#define CC_ADDR      "<info@example.org>"

#define FROM_MAIL "Sender Person " FROM_ADDR
#define TO_MAIL   "A Receiver " TO_ADDR
#define CC_MAIL   "John CC Smith " CC_ADDR

static const char *payload_text[] = {
  "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
  "To: " TO_MAIL "\r\n",
  "From: " FROM_MAIL "\r\n",
  "Cc: " CC_MAIL "\r\n",
  "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@"
  "rfcpedant.example.org>\r\n",
  "Subject: SMTP example message\r\n",
  "\r\n", /* empty line to divide headers from body, see RFC5322 */
  "The body of the message starts here.\r\n",
  "\r\n",
  "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
  "Check RFC5322.\r\n",
  NULL
};

struct upload_status {
  int lines_read;
};

static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
{
  struct upload_status *upload_ctx = (struct upload_status *)userp;
  const char *data;

  if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
    return 0;
  }

  data = payload_text[upload_ctx->lines_read];

  if(data) {
    size_t len = strlen(data);
    memcpy(ptr, data, len);
    upload_ctx->lines_read++;

    return len;
  }

  return 0;
}

int main(void)
{
  CURL *curl;
  CURLcode res = CURLE_OK;
  struct curl_slist *recipients = NULL;
  struct upload_status upload_ctx;

  upload_ctx.lines_read = 0;

  curl = curl_easy_init();
  if(curl) {
    /* This is the URL for your mailserver */
    curl_easy_setopt(curl, CURLOPT_URL, "smtp://mail.example.com");

    /* Note that this option isn't strictly required, omitting it will result
     * in libcurl sending the MAIL FROM command with empty sender data. All
     * autoresponses should have an empty reverse-path, and should be directed
     * to the address in the reverse-path which triggered them. Otherwise,
     * they could cause an endless loop. See RFC 5321 Section 4.5.5 for more
     * details.
     */
    curl_easy_setopt(curl, CURLOPT_MAIL_FROM, FROM_ADDR);

    /* Add two recipients, in this particular case they correspond to the
     * To: and Cc: addressees in the header, but they could be any kind of
     * recipient. */
    recipients = curl_slist_append(recipients, TO_ADDR);
    recipients = curl_slist_append(recipients, CC_ADDR);
    curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);

    /* We're using a callback function to specify the payload (the headers and
     * body of the message). You could just use the CURLOPT_READDATA option to
     * specify a FILE pointer to read from. */
    curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
    curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

    /* Send the message */
    res = curl_easy_perform(curl);

    /* Check for errors */
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));

    /* Free the list of recipients */
    curl_slist_free_all(recipients);

    /* curl won't send the QUIT command until you call cleanup, so you should
     * be able to re-use this connection for additional messages (setting
     * CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling
     * curl_easy_perform() again. It may not be a good idea to keep the
     * connection open for a very long time though (more than a few minutes
     * may result in the server timing out the connection), and you do want to
     * clean up in the end.
     */
    curl_easy_cleanup(curl);
  }

  return (int)res;
}

Now it looks like for the first curl_easy line, I'd need to change it to
curl_easy_setopt(curl, CURLOPT_URL, "smtp.gmail.com");

If I was using gmail, right? And since this is for outgoing mail, I don't need to worry about what the user is using as long as my outgoing mail address is a gmail address?
Going a little out of order...
recipients = curl_slist_append(recipients, useremail);

In this case, it would be my email. All I need to do is replace this with the receiving email correct? Well what about the sender?
curl_easy_setopt(curl, CURLOPT_MAIL_FROM, myemail);

I'm guessing that likewise, I would need to change this to my email. But it feels like it's missing something. Surely I can't just tell this program to send an email with my address without some sort of authorization, right? But I don't see anywhere on the code where I would need to supply my password (obviously I wouldn't want it hard coded, but that's an issue for later), so how would this work?
For the time being, these are the only lines I would need to change (besides a specific message), right? Am I going about this the right way? Is there more I would need to do for this to work? And how does the authorization work?
EDIT: I have made updates based on what I think would work, as well as the suggestion given for a username and password. I currently have this error:
curl_easy_perform() failed: Failed sending data to the peer

Unfortunately, it's not too specific on what went wrong. This is the new version:
#include <stdio.h>
#include <string.h>
#include <curl/curl.h>

/*
 * For an SMTP example using the multi interface please see smtp-multi.c.
 */

/* The libcurl options want plain addresses, the viewable headers in the mail
 * can very well get a full name as well.
 */
#define FROM_ADDR    "<sender@example.org>"
#define TO_ADDR      "<addressee@example.net>"
#define CC_ADDR      "<info@example.org>"

#define FROM_MAIL "Sender Person " FROM_ADDR
#define TO_MAIL   "A Receiver " TO_ADDR
#define CC_MAIL   "John CC Smith " CC_ADDR

static const char *payload_text[] = {
  "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
  "To: " TO_MAIL "\r\n",
  "From: " FROM_MAIL "\r\n",
  "Cc: " CC_MAIL "\r\n",
  "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@"
  "rfcpedant.example.org>\r\n",
  "Subject: SMTP example message\r\n",
  "\r\n", /* empty line to divide headers from body, see RFC5322 */
  "The body of the message starts here.\r\n",
  "\r\n",
  "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
  "Check RFC5322.\r\n",
  NULL
};

struct upload_status {
  int lines_read;
};

static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
{
  struct upload_status *upload_ctx = (struct upload_status *)userp;
  const char *data;

  if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
    return 0;
  }

  data = payload_text[upload_ctx->lines_read];

  if(data) {
    size_t len = strlen(data);
    memcpy(ptr, data, len);
    upload_ctx->lines_read++;

    return len;
  }

  return 0;
}

int main(void)
{
  CURL *curl;
  CURLcode res = CURLE_OK;
  struct curl_slist *recipients = NULL;
  struct upload_status upload_ctx;

  upload_ctx.lines_read = 0;

  curl = curl_easy_init();
  if(curl) {
    /* This is the URL for your mailserver */
    curl_easy_setopt(curl, CURLOPT_URL, "smtp.gmail.com");

    /* Note that this option isn't strictly required, omitting it will result
     * in libcurl sending the MAIL FROM command with empty sender data. All
     * autoresponses should have an empty reverse-path, and should be directed
     * to the address in the reverse-path which triggered them. Otherwise,
     * they could cause an endless loop. See RFC 5321 Section 4.5.5 for more
     * details.
     */
    curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "myemail@gmail.com");

    /* Add two recipients, in this particular case they correspond to the
     * To: and Cc: addressees in the header, but they could be any kind of
     * recipient. */
    recipients = curl_slist_append(recipients, "myemail@gmail.com");
    recipients = curl_slist_append(recipients, CC_ADDR);
    curl_easy_setopt(curl, CURLOPT_USERNAME, "myemail@gmail.com");
    curl_easy_setopt(curl, CURLOPT_PASSWORD, "mypassword");
    curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);

    /* We're using a callback function to specify the payload (the headers and
     * body of the message). You could just use the CURLOPT_READDATA option to
     * specify a FILE pointer to read from. */
    curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
    curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);

    /* Send the message */
    res = curl_easy_perform(curl);

    /* Check for errors */
    if(res != CURLE_OK)
      fprintf(stderr, "curl_easy_perform() failed: %s\n",
              curl_easy_strerror(res));

    /* Free the list of recipients */
    curl_slist_free_all(recipients);

    /* curl won't send the QUIT command until you call cleanup, so you should
     * be able to re-use this connection for additional messages (setting
     * CURLOPT_MAIL_FROM and CURLOPT_MAIL_RCPT as required, and calling
     * curl_easy_perform() again. It may not be a good idea to keep the
     * connection open for a very long time though (more than a few minutes
     * may result in the server timing out the connection), and you do want to
     * clean up in the end.
     */
    curl_easy_cleanup(curl);
  }

  return (int)res;
}

I haven't filled in CC_MAIL, but is this truly necessary? The actual name of the personal is generally automatically filled out by Google when you send an email.

A: You can set it below
curl_easy_setopt(curl, CURLOPT_USERNAME, USERNAME);
curl_easy_setopt(curl, CURLOPT_PASSWORD, PASSWORD);

Please refer to the example on curl (tag: curl-7_34_0)
https://github.com/curl/curl/blob/curl-7_34_0/docs/examples/smtp-multi.c
Recommended reference smtp-tls.c, using TLS
https://github.com/curl/curl/blob/master/docs/examples/smtp-tls.c

A: I am also confused whether we have to use that "<" sign or not while defining that
#define CC_ADDR "<info@example.org>"
section for eg.
Do I have to use #define CC_ADDR "anything" or I have to use #define CC_ADDR "<anything>"
I have one information regarding writing the server mail, we can use smtp.gmail.com:587 and it will work. Note that : used here is used to specify the specific port address to the mail server.


text:
Q: How to Count Total records before Fetching records in sql server i am working on windows Form application and wanted to perform Paging in DataGridView
so i wrote a query for that
Select  DISTINCT  TOP(1000)
        TblStudentBioData.RegNo
    , Coalesce(TblStudentBioData.First_NameUr + SPACE(1) +
      TblStudentBioData.Middle_NameUr + SPACE(1),TblStudentBioData.First_NameUr)
    + TblStudentBioData.Last_NameUr AS Name
    , TblStudentBioData.Father_NameUr
    , Coalesce(Ay.AcademicYearName,N'+@InCaseNull+') As AcademicYearName
    , Coalesce(Smst.SemName,N'+@InCaseNull+') As SemName
    , Coalesce(Colg.CollegeName,N'+@InCaseNull+') As CollegeName
    , Coalesce(CID.ClassName,N'+@InCaseNull+') As ClassName
    , TblImages.Images
    , TblStudentBioData.Student_ID
    , TblImages.ImageId
    , Ay.AcademicYearId
    , Smst.SemesterId
    , TblClassSchedule.ClassSchId

FROM TblStudentBioData
        INNER JOIN TBLCFGSEX AS sex
                    ON TblStudentBioData.CfgSexId = sex.CfgSexId
        LEFT JOIN TBLMARITALSTATUS ms
                    ON TblStudentBioData.MaritalStatusId = ms.MaritalStatusId
        INNER JOIN TblImages
                    ON TblStudentBioData.ImageId = TblImages.ImageId
        LEFT JOIN TBLBLOODGROUP BG
                    ON TblStudentBioData.BloodID = BG.BloodId

        LEFT JOIN TblStudentDetail
                    ON (TblStudentBioData.Student_ID = TblStudentDetail.Student_ID)
        LEFT JOIN TblStudentSubAss
                    ON TblStudentDetail.StudentDetailID = TblStudentSubAss.StudentDetailID
        LEFT JOIN TblClassSchedule
                    ON TblStudentDetail.CLassSchID = TblClassSchedule.ClassSchID

        LEFT JOIN TblSubAss
                    ON TblSubAss.SubAssId = TblStudentSubAss.SubAssId
        LEFT JOIN TblClass AS CID
                    ON TblClassSchedule.ClassID = CID.ClassID
        LEFT JOIN TBLCOLLEGE Colg
                    ON CID.CollegeId = Colg.CollegeID
        LEFT JOIN TblSemAssigning SA
                    ON TblClassSchedule.SemAssId = SA.SemAssId
        LEFT JOIN TblAcademicYear AY
                    ON SA.AcademicYearId = AY.AcademicYearId
        LEFT JOIN TblSemester Smst
                    ON Smst.SemesterId = SA.SemesterId

This Query Return me more than 28K rows but for paging i want only 1000 rows and total records which is 28K i will be fetching records 1000 wise.
Any Idea how can i do this ?
Note:

This query takes more then 20 seconds to execute and i wanted a solution which does not increase executing time.

A: If you only hava 1:1 detail-Tables in your query you could first do a selec count() on your primary key-field of your primary table. that should only last very few milliseconds


text:
Q: Apple push notification or firebase push notifications? I just want to know that i used fireabase in my project. Can anyone please guide me which is good for push notifications? Firebase or  Apple Push notification. and I also want some genuine reasons which one is better for User.

A: Firebase Cloud Messaging is originally a platform to send notification for Android. They added an iOS SDK, but using their SDK on iOS means that you are using both FCM and Apple Push notification service:
Push for iOS device => Firebase Cloud Messaging => Apple APNS => Device
If you are only developing an iOS app, it is best to use APNS directly. If you already have all your infrastructure set up for FCM, then you may save you a bit of code by supporting only FCM to address both iOS and Android.
However there is no specific technical benefit doing so.

A: Some of FCM advantages are

*

*Even if user disallow notification you can have notification for your app, if app is running in foreground (using shouldEstablishDirectChannel).

*Don't need to create dashboard to send notification on device.

*Notification analytics on FCM Dashboard.

*Easy to create notification payload structure.

*App Server side handling is easy, Only one key is required for multiple apps and platform (iOS,Android,Web)

A: The maximum notification payload allowed through APNs is 4 KB in iOS 8 and above. It was only 256 bytes operating systems prior to iOS 8. Keep in mind that the notification payload is the sum of notification size and device token.
Through FCM, it is also possible to send messages apart from notifications. FCM describes two different payload sizes for different functions. The maximum notification payload size allowed is 2 KB which is lowest when comparing FCM with APNs and WNS. The maximum message payload size is 4 KB.
WNS is the one that allows highest notification payload among the three, and that is 5 KB.

A: APNS is much more better in my experience.
They have much more success and it's easier.
I guess it works better as it's Apple's service.


text:
Q: Проблема с кодировкой имени файла при записи файла на сервер При сохранении файла на сервер, в его имени содержатся символы(см. на изображениях ниже). Имя же файла отправленное в бд отображается правильными символами.
$date = date("Y-m-d H:i:s");
$filedate = date("Y\_m\_d\_H\_i\_s", strtotime($date));
$filename = $_POST['name'].'_'.$filedate.'';
move_uploaded_file($_FILES['img']['tmp_name'], $Dir.'/'.$filename.'.jpg');
/имя файла будет будет искажено, а именно часть имени $_POST['name']
mysqli_query($CONNECT, "INSERT INTO `load` VALUES ('', '$_POST[name]', '$_POST[category]', 0, 0, '$_SESSION[USER_NAME]', '$_POST[text]', '$date', '$Active', '$num_img', '$num_file', '$filename')");
/в бд запишется имя, то которое мы и ожидали

Имена файлов в базе данных:

Имена файлов на сервере:

Менял кодировку страницы на на UTF-8 — не помогло

A: Зависит от сервера. Если это windows то скорее всего для названия файла в системе нужно использовать win1251. Но я бы рекомендовал добавить доп поле в базу для фактического названия файла в системе и в системе называл файлы к примеру так md5(uniqid(null, true)) это позволило бы каждому файлу иметь уникальное имя, а выводил название файла из базы.

A: Попробуй принудительно указать кодировку utf8 следующим образом (после установки соединеня)
mysqli_set_charset($CONNECT, "utf8")


text:
Q: what does the common difference of a sequence describe I am given the sequence 1, 7, 21, 43, 73, ... and can derive without any assumption about the nature of the sequence that the ultimate difference is 8, I'm interested in understanding what this difference allows you to deduce about the original polynomial which generates this sequence; and whether it is possible to find this polynomial?
I can see that 1, 7, 21, 43, 73, ... has a difference of 6, 14, 22, 30, ... which is generated by the arithmetic sequence 6 + 8(n-1), but trying to rationalize how the difference of a sequence can then be non-constant (1, 7, 21, 43, 73) it doesn't really make sense.
Can anyone shed some light on how to go about solving this intuitively?

A: In order to find the polynomial that generated the sequence, you need to look at differences between individual terms inside the sequence. You are given that the first few terms of the sequence are
$$(1, 7, 21, 43, 73, \dots)$$
Therefore, you need to start computing differences between terms. First, observe that the difference between the initial terms isn't constant. Although, if we take the second difference between these terms then we form the constant value of $8$.
$$\text{Second Difference:} ~~~~~~~~~8 ~~~~ 8 ~~~~8 \dots~~~~~~$$
$$\text{First Difference:}~~~~~~~~6 ~~ 14 ~~ 22 ~~ 30 \dots$$
$$\text{Original Sequence:}~~~~1 ~~7 ~~21 ~~43 ~~73 \dots$$
As the second difference is constant, we have a quadratic sequence. The general form of a quadratic is
$$y = ax^2 + bx+c$$
The first five terms produce
$$1 = a + b + c\tag{1}$$
$$7 = 4a + 2b + c\tag{2}$$
$$21= 9a + 3b + c\tag{3}$$
$$43= 16a + 4b + c\tag{4}$$
$$73= 25a + 5b + c\tag{5}$$
Taking $(1)-(2)$ forms
$$-6 = -3a -b\tag{6}$$
and $(3)-(2)$ forms
$$14 = 5a + b\tag{7}$$
so that $(6)+(7)$ forms $a=4$. By $(7)$, we see that $14 = 20 + b$ and so $b=-6$. Another substitution back into $(1)$ will form $c=3$. Hence, the equation of the polynomial is
$$y = 4x^2 - 6x + 3$$
In general, you shouldn't try to find the generating polynomial unless you have more terms and can see a consistent pattern between the differences between terms.

A: The difference sequence is $6, 14, 22, 30,$ etc.,  for which, as you noted, the $n^{th}$ term is $6+8(n-1)$.
When you evaluate the sum for the $m^{th}$ term of the sequence, $1+\sum\limits_{n=1}^{m-1}[6+8(n-1)], $
the answer is $1+8\sum\limits_{n=1}^{m-1}n-\sum\limits_{n=1}^{m-1}2=1+8 \dfrac{(m-1)m}2-2(m-1)=4m^2-6m+3. $
Just as when you integrate a $k^{th}$ degree polynomial, the answer is a polynomial of degree $k+1$,
when you repeatedly sum a $k^{th}$ degree (in this case, linear) polynomial in $n$ from $1$ to $m-1$,
the answer is a ${k+1}^{th}$ degree (in this case, quadratic) polynomial in $m$.

A: You have to go through $2$ levels of differences to get to the ultimate difference, so your polynomial will be of degree $2$. (If you know some calculus, this corresponds to taking $2$ derivatives to reach a constant function.)
Because the ultimate difference is $8$ and it appears at degree $2$, the first coefficient is $\frac8{2!}=4$ (the $2!$ is again a factor that appears if you differentiate; if you don't know any calculus, I'm not sure if there's an intuitive explanation for it, but you can derive it by a method similar to Axion004's answer), so the first term of the polynomial is $4x^2$.
The first term of the polynomial will get in the way of determining the other terms intuitively, so at this point it's easiest to just subtract it out. Subtracting $4x^2$ from each term (and assuming the terms are indexed starting at $x=0$) gives
$$1,3,5,7,9,\dots$$
Now we go through the same process again. We know the degree will now go down one level to $1$, and we can find that the new ultimate difference is $2$, so the next coefficient is $\frac2{1!}=2$, and so far our polynomial is $4x^2+2x$. Subtracting the $2x$ from our last sequence gives
$$1,1,1,1,1,\dots$$
so we have reached the constant sequence. Our generating polynomial is $4x^2+2x+1$.


text:
Q: Field information not updating? I want to update a custom field using Apex triggers. However, after "updating" it doesn't seem like it actually changes the value of the fields.
Here is my code (in Apex Execute):
for(Contact c:[SELECT Name, of_Loans__c, (SELECT id FROM Opportunities) FROM Contact]){
    System.debug(c.Name + ' number of loans ' + c.of_Loans__c);
if (c.Opportunities.size() == 0){
c.of_Loans__c = '0';
}
else {
    c.of_Loans__c = String.valueOf(c.Opportunities.size());
}
    System.debug(c.Name + ' number of loans after: ' + c.of_Loans__c);
}

for(Contact c:[SELECT of_Loans__c FROM Contact]){
System.debug(c.of_Loans__c);
}

I have the second for loop to show that the updating doesnt actually happen.
Here is the debug log showing that the field isnt actually update
11:02:48.16 (16333372)|USER_INFO|[EXTERNAL]|0054P000009JSio|encompassit@resourceful-bear-gcntzz.com|(GMT-07:00) Pacific Daylight Time (America/Los_Angeles)|GMT-07:00
11:02:48.16 (16360839)|EXECUTION_STARTED
11:02:48.16 (16368186)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
11:02:48.16 (24387599)|USER_DEBUG|[2]|DEBUG|Rose Gonzalez number of loans null
11:02:48.16 (24625896)|USER_DEBUG|[9]|DEBUG|Rose Gonzalez number of loans after: 0
11:02:48.16 (24670096)|USER_DEBUG|[2]|DEBUG|Sean Forbes number of loans null
11:02:48.16 (24738286)|USER_DEBUG|[9]|DEBUG|Sean Forbes number of loans after: 0
11:02:48.16 (24762354)|USER_DEBUG|[2]|DEBUG|Jack Rogers number of loans null
11:02:48.16 (24812488)|USER_DEBUG|[9]|DEBUG|Jack Rogers number of loans after: 0
11:02:48.16 (24834158)|USER_DEBUG|[2]|DEBUG|Pat Stumuller number of loans null
11:02:48.16 (24878724)|USER_DEBUG|[9]|DEBUG|Pat Stumuller number of loans after: 0
11:02:48.16 (24899126)|USER_DEBUG|[2]|DEBUG|Andy Young number of loans null
11:02:48.16 (25051744)|USER_DEBUG|[9]|DEBUG|Andy Young number of loans after: 5
11:02:48.16 (25092822)|USER_DEBUG|[2]|DEBUG|Tim Barr number of loans null
11:02:48.16 (25150207)|USER_DEBUG|[9]|DEBUG|Tim Barr number of loans after: 0
11:02:48.16 (25172294)|USER_DEBUG|[2]|DEBUG|John Bond number of loans null
11:02:48.16 (25215812)|USER_DEBUG|[9]|DEBUG|John Bond number of loans after: 0
11:02:48.16 (25236720)|USER_DEBUG|[2]|DEBUG|Stella Pavlova number of loans null
11:02:48.16 (25277692)|USER_DEBUG|[9]|DEBUG|Stella Pavlova number of loans after: 0
11:02:48.16 (25297247)|USER_DEBUG|[2]|DEBUG|Lauren Boyle number of loans null
11:02:48.16 (25337711)|USER_DEBUG|[9]|DEBUG|Lauren Boyle number of loans after: 0
11:02:48.16 (25356834)|USER_DEBUG|[2]|DEBUG|Babara Levy number of loans null
11:02:48.16 (25430754)|USER_DEBUG|[9]|DEBUG|Babara Levy number of loans after: 0
11:02:48.16 (25460543)|USER_DEBUG|[2]|DEBUG|Josh Davis number of loans null
11:02:48.16 (25521350)|USER_DEBUG|[9]|DEBUG|Josh Davis number of loans after: 0
11:02:48.16 (25565957)|USER_DEBUG|[2]|DEBUG|Jane Grey number of loans null
11:02:48.16 (25673866)|USER_DEBUG|[9]|DEBUG|Jane Grey number of loans after: 0
11:02:48.16 (25724485)|USER_DEBUG|[2]|DEBUG|Arthur Song number of loans null
11:02:48.16 (25797292)|USER_DEBUG|[9]|DEBUG|Arthur Song number of loans after: 0
11:02:48.16 (25824968)|USER_DEBUG|[2]|DEBUG|Ashley James number of loans null
11:02:48.16 (25878919)|USER_DEBUG|[9]|DEBUG|Ashley James number of loans after: 0
11:02:48.16 (25904436)|USER_DEBUG|[2]|DEBUG|Tom Ripley number of loans null
11:02:48.16 (25960172)|USER_DEBUG|[9]|DEBUG|Tom Ripley number of loans after: 0
11:02:48.16 (25983949)|USER_DEBUG|[2]|DEBUG|Liz D'Cruz number of loans null
11:02:48.16 (26033658)|USER_DEBUG|[9]|DEBUG|Liz D'Cruz number of loans after: 0
11:02:48.16 (26057138)|USER_DEBUG|[2]|DEBUG|Edna Frank number of loans null
11:02:48.16 (26106722)|USER_DEBUG|[9]|DEBUG|Edna Frank number of loans after: 0
11:02:48.16 (26129665)|USER_DEBUG|[2]|DEBUG|Avi Green number of loans null
11:02:48.16 (26199571)|USER_DEBUG|[9]|DEBUG|Avi Green number of loans after: 0
11:02:48.16 (26224759)|USER_DEBUG|[2]|DEBUG|Siddartha Nedaerk number of loans null
11:02:48.16 (26288134)|USER_DEBUG|[9]|DEBUG|Siddartha Nedaerk number of loans after: 0
11:02:48.16 (26312978)|USER_DEBUG|[2]|DEBUG|Jake Llorrac number of loans null
11:02:48.16 (26363661)|USER_DEBUG|[9]|DEBUG|Jake Llorrac number of loans after: 0
11:02:48.16 (29880489)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (29912131)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (29927576)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (29941188)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (29954685)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (29968112)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (29981454)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (29995181)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30008378)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30021756)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30035073)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30047966)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30060967)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30073983)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30087086)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30099913)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30112893)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30125862)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30138790)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30152026)|USER_DEBUG|[14]|DEBUG|null
11:02:48.16 (30220326)|CODE_UNIT_FINISHED|execute_anonymous_apex
11:02:48.16 (31377361)|EXECUTION_FINISHED

A: You need to perform a DML operation for the changes to stick. That means that your code needs to keep track of the records in order to update them:
Contact[] contacts = [SELECT Name, (SELECT id FROM Opportunities) FROM Contact];
for(Contact c: contacts) {
  c.of_Loans__c = c.Opportunities.size()+'';
  System.debug(c.Name + ' number of loans after: ' + c.of_Loans__c);
}
// Save our changes back to the database
update contacts;