text:
Q: Which is the default TCP connect timeout in Windows? Which is the default TCP connect timeout in Windows? There is a registry key to configure it or it's set dynamically?

A: In Windows the value is dynamic for established conections, though the default for initial connections is 72 seconds. The Registry settings are defined in this article:
http://technet.microsoft.com/en-us/library/cc739819(WS.10).aspx
HKEY_LOCAL_MACHINE
\SYSTEM
\CurrentControlSet
\Services:
\Tcpip
\Parameters
TcpInitialRTT: Defines what the initial time-out settings are for new connections. This number in seconds is doubled each time it retransmits before timing a connection out. Defaults to 3.
TcpMaxConnectRetransmissions: Defines the number of retransmissions while establishing the connection before timing a connection out. Defaults to 2.

A: TcpInitialRTT and TcpMaxConnectRetransmissions may not be present in Vista and Windows 2008.  This Microsoft document does not include them.
http://download.microsoft.com/download/c/2/6/c26893a6-46c7-4b5c-b287-830216597340/TCPIP_Reg.doc
And this says at least TcpInitialRTT is gone, although I don't know how reliable it is.
http://pul.se/Blog-Post-TCP-IP-Stack-hardening-in-Operating-Systems-starting-with-Windows-Vista_SharePoint-kHPTTCP0WJ5,7zq00hH0wINE

A: Usually "connect timeout" refers to the timeout for creating the initial connection to a host.  In many systems (Windows 7 included), this value is configured using separate settings from timeouts for ongoing communications after a connection has been established.  This answer addresses the "initial connect" scenario for Windows 7, which is different from XP.
For Windows 7, two hotfixes are required to support adjusting connect timeout settings.  The new settings can be configured with the 'netsh' command.

*

*Hotfix #2786464: Hotfix enables the configuration of the TCP maximum SYN retransmission amount in Windows 7 or Windows Server 2008 R2

*Hotfix #2472264: You cannot customize some TCP configurations by using the netsh command in Windows Server 2008 R2
From the 2786464 hotfix article:

Note In Windows 7 and Windows Server 2008 R2, the TCP maximum SYN retransmission (JH: MaxSynRetransmissions) value is set to 2, and is not configurable. Because of the 3-second limit of the initial time-out value (JH: InitialRTO), the TCP three-way handshake is limited to a 21-second timeframe (3 seconds + 2*3 seconds + 4*3 seconds = 21 seconds).

The first hotfix adds a 'MaxSynRetransmissions' setting which allows changing the retry setting from the default value of 2.  The second adds 'InitialRto' setting which allows changing the Initial RTO value from the default of 3000ms (yes, milliseconds), but only to something shorter than 3000ms; it cannot be increased.  Depending on your situation, you may only need the 'MaxSynRetransmissions' hotfix.
Install both hotfixes, reboot, then open a command window as Administrator.  Further reboots are not required for subsequent netsh command invocations.
C:\Windows\system32>NET SESSION >nul 2>&1

C:\Windows\system32>IF %ERRORLEVEL% EQU 0 (ECHO Administrator PRIVILEGES Detected!) ELSE ( ECHO NOT AN ADMIN! )
Administrator PRIVILEGES Detected!

C:\Windows\system32>netsh interface tcp show global
Querying active state...

TCP Global Parameters
----------------------------------------------
Receive-Side Scaling State          : enabled
Chimney Offload State               : automatic
NetDMA State                        : enabled
Direct Cache Acess (DCA)            : disabled
Receive Window Auto-Tuning Level    : normal
Add-On Congestion Control Provider  : none
ECN Capability                      : disabled
RFC 1323 Timestamps                 : disabled
Initial RTO                         : 3000
Non Sack Rtt Resiliency             : disabled
Max SYN Retransmissions             : 2
** The above autotuninglevel setting is the result of Windows Scaling heuristics

overriding any local/policy configuration on at least one profile.

C:\Windows\system32>cmd /v:on /c "echo !TIME! & telnet 192.168.1.254 & echo !TIME!"
14:10:30.53
Connecting To 192.168.1.254...Could not open connection to the host, on port 23: Connect failed
14:10:51.60

C:\Windows\system32>netsh interface tcp set global MaxSynRetransmissions=3
Ok.

C:\Windows\system32>netsh interface tcp show global
Querying active state...

TCP Global Parameters
----------------------------------------------
Receive-Side Scaling State          : enabled
Chimney Offload State               : automatic
NetDMA State                        : enabled
Direct Cache Acess (DCA)            : disabled
Receive Window Auto-Tuning Level    : normal
Add-On Congestion Control Provider  : none
ECN Capability                      : disabled
RFC 1323 Timestamps                 : disabled
Initial RTO                         : 3000
Non Sack Rtt Resiliency             : disabled
Max SYN Retransmissions             : 3
** The above autotuninglevel setting is the result of Windows Scaling heuristics

overriding any local/policy configuration on at least one profile.

C:\Windows\system32>cmd /v:on /c "echo !TIME! & telnet 192.168.1.254 & echo !TIME!"
14:27:02.33
Connecting To 192.168.1.254...Could not open connection to the host, on port 23:
 Connect failed
14:27:47.41

C:\Windows\system32>netsh interface tcp set global MaxSynRetransmissions=2
Ok.

C:\Windows\system32>netsh interface tcp set global InitialRto=1000
Ok.

C:\Windows\system32>netsh interface tcp show global
Querying active state...

TCP Global Parameters
----------------------------------------------
Receive-Side Scaling State          : enabled
Chimney Offload State               : automatic
NetDMA State                        : enabled
Direct Cache Acess (DCA)            : disabled
Receive Window Auto-Tuning Level    : normal
Add-On Congestion Control Provider  : none
ECN Capability                      : disabled
RFC 1323 Timestamps                 : disabled
Initial RTO                         : 1000
Non Sack Rtt Resiliency             : disabled
Max SYN Retransmissions             : 2
** The above autotuninglevel setting is the result of Windows Scaling heuristics

overriding any local/policy configuration on at least one profile.

C:\Windows\system32>cmd /v:on /c "echo !TIME! & telnet 192.168.1.254 & echo !TIME!"
14:29:06.13
Connecting To 192.168.1.254...Could not open connection to the host, on port 23:
 Connect failed
14:29:13.20

Note: Windows telnet is used for the reference for actual connection timeout.    It needs to be installed separately, but is easy to do.
Additional links / kudos:

*

*Windows 7: Enabling Telnet Client

*How to measure execution time of command in windows command line?

*Batch script: how to check for admin rights

A: If I understand your question correctly, you are referring to:
TcpTimedWaitDelay
This key determines the time that must elapse before TCP/IP can release a closed connection and reuse its resources. This interval between closure and release is known as the TIME_WAIT state or twice the maximum segment lifetime (2MSL) state. During this time, reopening the connection to the client and server costs less than establishing a new connection. By reducing the value of this entry, TCP/IP can release closed connections faster and provide more resources for new connections. Adjust this parameter if the running application requires rapid release, the creation of new connections, or an adjustment because of a low throughput caused by multiple connections in the TIME_WAIT state.
The exact key is:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Tcpip\Parameters\TcpTimedWaitDelay
You may not have it set if you are using Win2008 or later, but the default is 240 decimal (240 seconds or 4 minutes that is). You can add the key to the registry with a different value and it will take effect after a reboot (tested on Windows Server 2008R2 in a production environment).
This is an absurdly high value given the quality of modern networks.
I had an application literally less than a month ago running on a server that exhausted the maximum number of connections Windows can support and killed every network service on that server regularly. 16,000+ connections in netstat -a when you even manage to RDP to the server.
We set the value to 30 decimal (30 seconds) and voila, the issue was solved - less than 10,000 simultaneous connections (since the app was rapidly opening and closing them) and no throughput issues.


text:
Q: Individual axes labels in facet_wrap without scales="free" My data looks like this:
df <- data.frame(Year = as.factor(c(rep(2015, 3), rep(2016, 3), rep(2017,3))),
                 Tax = as.factor(c(rep(c("A", "B", "C"), 3))),
                 Depth = as.factor(c(10, 30, 50, 20,30,50,10,30,40)),
                 values= c(0.5, 0.25, 0.25, 0.1, 0.4, 0.5, 0.2, 0.6, 0.2))

I want to plot it with gaps for missing data and individual axis labels.
library(ggplot2)

The scale argument of facet_wrap gives individual axes, but is not performing as desired, as missing data is not reflected.:
ggplot(df, aes(Depth, values, fill=Tax)) + geom_bar(stat="identity")+
  facet_wrap(~Year, scale="free") +
  coord_flip()

Without scales:
ggplot(df, aes(Depth, values, fill=Tax)) + geom_bar(stat="identity")+
  facet_wrap(~Year) +
  coord_flip()

The missing data is represented (which i want!), but it lacks axis labels (which i need).
is there anything i can do?

A: It looks like this can be done using the lemon package:
library(tidyverse)
library(lemon)

df <- data.frame(Year = as.factor(c(rep(2015, 3), rep(2016, 3), rep(2017,3))),
                 Tax = as.factor(c(rep(c("A", "B", "C"), 3))),
                 Depth = as.factor(c(10, 30, 50, 20,30,50,10,30,40)),
                 values= c(0.5, 0.25, 0.25, 0.1, 0.4, 0.5, 0.2, 0.6, 0.2))

ggplot(df, aes(Depth, values, fill=Tax)) + geom_bar(stat="identity")+
   facet_rep_wrap(~Year,repeat.tick.labels = T) +
   coord_flip()

redpajama_set_name: RedPajamaStackExchange


text:
Q: Custom Content Type on Documents SharePoint 2010 I'm trying to attach a custom content type to Document Library so that it's available to users whenever they upload a new document, they'll have the necessary columns visible. I'm struggling to staple this onto SharePoint 2010 and cannot really find a solution to this online.

A: You can attach a contenttype to a list in a feature:

*

*Get a reference to the list

*Check if the list accepts contenttypes

*Add the contenttype

And in code:
SPList list = web.Lists["your list"];
list.AllowContentTypes = true;
SPContentType ct = web.AvailableContentTypes["your contenttype"];
list.ContentTypes.Add(ct);

This isn't production code, please add some checks and exception handling.


text:
Q: Sharing a variable among 2 c++ file not located in the same directory I have two c++ files.
One (AudioSystem.cpp) located at ./framework/av/media/libmedia
The other (AudioFlinger.cpp) locatet at ./framework/av/services/audioflinger
Both they share an header file
#include <system/audio.h>

I would like to create a var that is shared among the AudioFlinger.cpp and the AudioSystem.cpp.
They both should be able to modify the var value and they should see the same value.
Thanks

A: Global variable can be defined in any of your AudioFlinger.cpp or AudioSystem.cpp, but you should ensure that in other cpp file the statement declaring this variable as extern in placed e.g. with h-file and #include.
Also, you can make separate cpp-file with variable definition and appropriate h-file with extarn variable declaration, e.g.:
   // var.cpp
   int sharedVariable;

and
   // var.h
   extern int sharedVariable;

And now any cpp module, where #include "var.h" is, can use sharedVariable


text:
Q: Cleanmgr with command or batch I am trying to build a maintenance script for Windows 10. This shell or command line should operate multiple maintenance operations at a time.
I cannot find any batch demo of this type on StackOverflow so I share it here.

A: It uses Windows 10 Clean Manager cleanmgr.exe
It creates a cleaning profile, number 777, that is registered and can be called with cleanmgr /sagerun:777
You must launch this batch with Administrator privileges to modify registry.
:: Disk cleanup
echo 1/10 ^| Windows is cleaning his mess ...

REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active Setup Temp Folders" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Content Indexer Cleaner" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Memory Dump Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Microsoft_Event_Reporting_2.0_Temp_Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Pages Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Old ChkDsk Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
::REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Remote Desktop Cache Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\ServicePack Cleanup" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Setup Log Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error memory dump files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error minidump files" /v StateFlags0777  /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Setup Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Sync Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Update Cleanup" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Upgrade Discarded Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\WebClient and WebPublisher Cache" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Defender" /v StateFlags0777 /d 2 /t REG_DWORD /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Archive Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Queue Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Archive Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Queue Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows ESD installation files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
REG ADD "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Upgrade Log Files" /v StateFlags0777 /t REG_DWORD /d 00000002 /f
cleanmgr /sagerun:777
echo OK
echo:

As I cannot find any help on StackOverflow to build this script, I share what I acheived to do.
You can then chain other system maintenance operations, like System file check sfc.exe.
To start using, copy-paste this script in a blank notepad and save as scriptName.cmd
:: System integrity
echo 2/10 ^| Windows file checking starting ...
%SystemRoot%\System32\sfc.exe /scannow
if not %ERRORLEVEL%==0 (
   echo Erreurs détectées sur le disque !
   echo Démarrage de la réparation du système ...
   Dism /Online /Cleanup-Image /RestoreHealth
) else (
  echo OK
)
echo:

A: I've added to your idea here, including some loops that use 'arrays' (variable containing multiple strings separated with quotes and commas).
The first 'array' called "VOLUME_LOCATIONS" contains what you shared above (w/o "Recycle Bin") as an example.
Though the script is setup to capture all the subkeys that exists here:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
This 'array' called "DYNAMIC_ARRAY_VOLUMES" can be reduced by a predefined 'array' called "OMITTED_LOCATIONS".
This dynamic approach accounts for new volumes/locations that may be added  in the future.
@echo off
REM This script loops through an array of volume cache locations in the registry and sets a flag
REM This replicates what is done via GUI by the command [ cleanmgr /sageset ] and then executes via [ cleanmgr /sagerun:# ]
REM This script requires to be run as an administrator - for Windows > Server 2008 (Or have cleanmgr added)
cls
setlocal EnableDelayedExpansion
SET FLAG=StateFlags0777 && SET REG_VALUE=00000002
SET REG_LOC=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
Set "NUM_ENTRIES=0" && Set "LAST_ENTRY=0"
SET VOLUME_LOCATIONS=("Active Setup Temp Folders", "Content Indexer Cleaner", "Downloaded Program Files", "Internet Cache Files", "Memory Dump Files", "Microsoft_Event_Reporting_2.0_Temp_Files", "Offline Pages Files", "Old ChkDsk Files", "Previous Installations", "Remote Desktop Cache Files", "ServicePack Cleanup", "Setup Log Files", "System error memory dump files", "System error minidump files", "Temporary Files", "Temporary Setup Files", "Temporary Sync Files", "Update Cleanup", "Upgrade Discarded Files", "WebClient and WebPublisher Cache", "Windows Defender", "Windows Error Reporting Archive Files", "Windows Error Reporting Queue Files", "Windows Error Reporting System Archive Files", "Windows Error Reporting System Queue Files", "Windows ESD installation files", "Windows Upgrade Log Files")
REM To dynamically create an array of ALL entries, then presumably omitting those undesired:
for /F "delims=" %%i IN ('reg query "%REG_LOC%"') do set /a "NUM_ENTRIES+=1"
echo There are %NUM_ENTRIES% entries in the registry.
FOR /F "delims=" %%G IN ('reg query "%REG_LOC%"') do (
set /a "LAST_ENTRY+=1"
Set DYNAMIC_ARRAY_VOLUMES=!DYNAMIC_ARRAY_VOLUMES!, "%%~nxG"
Set DYNAMIC_ARRAY_VOLUMES[%%~nxG]=!LAST_ENTRY!
if !LAST_ENTRY! == 1 Set DYNAMIC_ARRAY_VOLUMES="%%~nxG"
if !LAST_ENTRY! == %NUM_ENTRIES% GOTO :ARRAY_BUILT
)
:ARRAY_BUILT
echo The following would be an all inclusive list of locations:
echo. && echo (%DYNAMIC_ARRAY_VOLUMES%) && echo.
REM The following array and 'for loop' sets and removes entries wished to omitted from cleanmanager cleanup
REM SET OMITTED_LOCATIONS=("Recycle Bin", "Windows Upgrade Log Files")
SET OMITTED_LOCATIONS=("")
REM For loop repeated to handle the last entry, if applicable, as it should only have a preceeding comma and space
for %%q in %OMITTED_LOCATIONS% do SET DYNAMIC_ARRAY_VOLUMES=!DYNAMIC_ARRAY_VOLUMES:%%q, =!
for %%q in %OMITTED_LOCATIONS% do SET DYNAMIC_ARRAY_VOLUMES=!DYNAMIC_ARRAY_VOLUMES:, %%q=!
echo The following would be a reduced list of locations: && echo (%DYNAMIC_ARRAY_VOLUMES%) && echo.

echo Adding registry values via array and loop, use the following line instead of the one after - if attempting dynamically
for %%i in (%DYNAMIC_ARRAY_VOLUMES%) do (
REM for %%i in %VOLUME_LOCATIONS% do (
ECHO REG ADD "%REG_LOC%\%%~i" /v %FLAG% /t REG_DWORD /d %REG_VALUE% /f
REG ADD "%REG_LOC%\%%~i" /v %FLAG% /t REG_DWORD /d %REG_VALUE% /f
)
echo. && echo The disk space for C: BEFORE running: && echo.  && fsutil volume diskfree c: && echo.
ECHO Running cleanmgr against the specified volume locations
ECHO "cleanmgr /sagerun:777"
cleanmgr /sagerun:777
echo. && echo The disk space for C: AFTER running: && echo.  && fsutil volume diskfree c: && echo.
REM To verify what exists for VolumeCaches in the registry, or to see changes before/after, run:
REM reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
REM To return all the subkey values, add the '/s' argument, as seen below:
REM reg query HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches /s
echo
REM pause
exit /b
REM exit

The most challenging part here was accounting for the quotes and delimitation in to create and use the 'arrays'.  I'm guessing there's a better way, but this seems to work.
Also, on older servers, you may need to jump through a hoop by enabling 'Desktop Experience' to get cleanmgr.exe back in the Windows\System32 folder...
Why batch, why cleanmgr.exe?

*

*My company doesn't typically enable Powershell on our servers.

*Cleanmgr incorporates Microsoft's way of cleaning the disk and
there are significant differences rather than simply deleting
temp/cache locations.  Specifically, I understand that current/recent
data is omitted during deletion, possibly ~7+days old?


text:
Q: when i try to save this file it creates and folder for the entire path ZipFileToCreate = "c:\user\desktop\webservice\file.zip";

So, when i try to save this file it creates the folder for the path like user\desktop\webservice\file\
Why is it so?
FileStream fs = new FileStream(ZipFileToCreate, FileMode.Open);
byte[] data = new Byte[fs.Length];
BinaryReader br = new BinaryReader(fs);
br.Read(data, 0, data.Length);
br.Close();
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.AppendHeader("Content-Disposition", "filename=" + Parameter + ".zip");
DeleteOldFiles();
Response.BinaryWrite(data);

A: I think you need to be using the Environment.GetFolderPath method to find the current users' Desktop folder rather than hard-coding "c:\user\desktop\webservice\file.zip". Also using Path.Combine to build a path is more reliable than string concatenation. Try
Parameter = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "file.zip");


text:
Q: Internal Server Error Node js I am currently setting up a Heroku deployment. Everything works fine when it is run locally but I get the following error from Heroku.
at=info method=GET path="/" host=pure-cliffs-68507.herokuapp.com
request_id=66cd6aa8-209d-4065-88ce-ad201ce6e713 fwd="210.86.90.97"
dyno=web.1 connect=0ms service=24ms status=500 bytes=524 protocol=https
2017-07-03T15:05:22.180020+00:00 app[web.1]: GET / 500 19ms - 148b
2017-07-03T15:05:22.181519+00:00 app[web.1]: Error: Failed to lookup view " index.html" in views directory "/app"
2017-07-03T15:05:22.181520+00:00 app[web.1]:     at EventEmitter.render (/app/node_modules/express/lib/application.js:580:17)
2017-07-03T15:05:22.181521+00:00 app[web.1]:     at ServerResponse.render  (/app/node_modules/express/lib/response.js:971:7)
2017-07-03T15:05:22.181521+00:00 app[web.1]:     at /app/routes.js:8:7
2017-07-03T15:05:22.181522+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-07-03T15:05:22.181522+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/route.js:137:13)
2017-07-03T15:05:22.181523+00:00 app[web.1]:     at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3)
2017-07-03T15:05:22.181523+00:00 app[web.1]:     at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5)
2017-07-03T15:05:22.181524+00:00 app[web.1]:     at /app/node_modules/express/lib/router/index.js:281:22
2017-07-03T15:05:22.181525+00:00 app[web.1]:     at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12)
2017-07-03T15:05:22.181525+00:00 app[web.1]:     at next (/app/node_modules/express/lib/router/index.js:275:10)

I beleive it is something to do with the file paths. I currently have everything in the base directory (ie project/) and therefore am using the following.
app.use(express.static(path.join(__dirname, '/')));
app.set('views', __dirname);

Here are some of my get requests
app.get('/', function(req, res) {
    res.render('index.html');
});

app.get('/browsePage', function(req, res) {
    res.render('browsePage.html');

});

Thank you for your help in advance.

A: You can't render html pages in node.js. You can try sending html files:
app.get('/', function(req, res) {
   res.sendFile('index.html');
});

app.get('/browsePage', function(req, res) {
   res.sendFile('browsePage.html');
});

A:
Failed to lookup view " index.html" in views directory "/app"

If your code working on local, Do you can check your path again?
And it's should be:
app.use(express.static(__dirname + '../public'));

btw, you should use any template to render view(jade,..) https://pugjs.org/api/getting-started.html


text:
Q: Csv Reader expected a character buffer object I have DNS record as csv format and it has  HostName and IPAdress Label.
İt's include public and private ("192.168", "172.16" and "10.0")IP address and ı want to separate each other. When ı running my code ı took "expected a character buffer object " error code. How can solve this issue
import csv
with open('Dns.csv', 'rb') as csvfile:
 reader = csv.DictReader(csvfile)
 for row in reader:
  if "10.205" in row['IPAddress']:
  file10=open("Zone10.txt","a")
  a=(row['hostname'], row['IPAddress'])
  file10.write(a)

A: The reason is you are trying to write tuple to file10. So next lines should be modified
a=(row['hostname'], row['IPAddress'])
file10.write(a)

For example, If you're going to write it as a string you can do:
file10.write(' '.join(a))  # it will work

or
a='{}{}'.format(row['hostname'], row['IPAddress'])
file10.write(a)

Btw it also would be better to use context manager to open file10.
Regarding to comment about CSV output:
output = []
for row in reader:
    if "10.205" in row['IPAddress']:
        output.append(row)
if output:
    with open('Zone.csv', 'wb') as zonefile:
        writer = csv.DictWriter(zonefile, fieldnames=output[0].keys())
        writer.writeheader()
        writer.writerows([row for row in output])

It is very quick-written code, but I hope it will help


text:
Q: Gantt chart with nanoseconds I need to create a Gantt chart for data from a microprocessor that has nanosecond precision and total duration of one second. Gantt chart in JFreeChart seems to fit my needs except that it uses java.util.Date which has only milliseconds precision (as mentioned here: JFree TimeSeries Chart Spanning Nanoseconds).
Date4j can be used instead but a lot of internal code needs to be changed so that is not really feasible Link.
A work-around is to create a ValueAxis Subclass to handle the nanoseconds. There are couple of examples  that deal with custom labelling with ValueAxis here and here, unfortunately I could not find a way to create a nanoseconds timescale.
I ll be grateful if anyone can show me how to replace the existing Date Axis of the Gantt chart with nanosecond labelling.

A: I managed to solve my problem by overwriting the date axis with custom number format axis that is used to place the clock cycles in the x axis.
CategoryPlot plot = (CategoryPlot) chart.getPlot();
CategoryItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(0, Color.blue);

NumberAxis xAxis = new NumberAxis();
DecimalFormat format = (DecimalFormat)DecimalFormat.getNumberInstance(Locale.ENGLISH);
format.applyPattern("#");
xAxis.setNumberFormatOverride(format);

xAxis.setLabel("Cycles");
plot.setRangeAxis(xAxis);

renderer.setBaseToolTipGenerator(new IntervalCategoryToolTipGenerator("{3} - {4}", format));


text:
Q: What is the difference between conditional probability and a stochastic kernel? I have visited various sites which claim a difference between stochastic kernels and conditional probability. However, I have read a paper which treats them the same, and the Wikipedia page on transition matrices actually lists a matrix full of conditional probabilities. The page linking to it claims that a Markov-kernel (stochastic-kernel, or probability-kernel) is simply an element of this transition matrix.

This is a contradiction in literature, and I would like some clarity on
  the issue. What is the difference between a stochastic kernel and a
  conditional probability statement?

It's possible they differ in generality alone, where the stochastic kernel is a specific case of conditional probability, but I haven't found any references on this.

A: The term conditional probability, is free of context, while stochastic kernel is used only when discussing stochastic processes.
A stochastic kernel is a specific type of probability density statement, while a conditional probability can be a statement which has nothing to do with stochastic processes.
The answer is curtsy of a comment by @Lee David Chung Lin.


text:
Q: Assembly of Powerpc encountered Program received signal SIGSEGV Segmentation fault When I try to store something from register to memory, I received Segmentation fault error. As I used gdb to debug line by line, it shows up Program received signal SIGSEGV when comes to the line of stb.
What I tried to do is to implement the standard C strcat function in PowerPC Assembly.
Here's the main C program, pretty simple.
#include<stdio.h>
extern char *mystrcat(char *first, char *second);
int main(){
  char *first, *second, *third;
  first = "ab";
  second = "cd";
  third = mystrcat(first, second);
  printf("%s\n", third);
  return 0;
}

And this is my mystrcat.s powerpc assembly file.
.text
    .align 2
    .globl mystrcat
mystrcat:
    mr %r5, %r3
.L1:
    lbz %r6, 0(%r5)
    cmpdi %r6, 0
    beq .L2
    addi %r5, %r5, 1
    b .L1
.L2:
    lbz %r6, 0(%r4)
    stb %r6, 0(%r5)
    addi %r4, %r4, 1
    addi %r5, %r5, 1
    cmpdi %r6, 0
    beq .L3
    b .L2
.L3:
    blr

Before the L2 label is the process finding the end of the first string.
Gdb showed up "Program received signal SIGSEGV" at the second line after L2 label.
The stb %r6, 0(%r5) command seems raised the error.
But I just don't get it why it cannot figure out address by 0(%r5).
I've tried other command seems like stbx or stbu but no one works.
Thank you for everyone can give me even just little piece of advice.
Update:
I realized this has something to do with memory.
Since the memory for string is readonly, is there a way that I can allocate new memory inside assembly code? I tried "bl malloc" and "nop" and the behavior beyonds my understanding.

A: In your main function, you try to concatenate 2 strings with the destination one having no room enough to copy the source one at the end.
Trying to add a (kind of implicit) memory allocation in your function mystrcat will introduce confusion.
Note that the segmentation fault also appears using the standard strcat that you want to mimic.
You should fix you main function, writing something like that:
#include <stdio.h>

extern char *mystrcat(char *first, char *second);

int main(){
  char first[8] = "ab";
  char *second, *third;

  second = "cd";
  third = mystrcat(first, second);
  printf("%s\n", third);

  return 0;
}

A: String literals are stored in read only section of memory. Any attempt to modify string literals results in undefined behavior.


text:
Q: How could i use css to make my Grid template fit to column This is my css code and this is how my images show up
This is my html code and it shows all of the  but theres also a Car component that has more code in it

        {cars.map(item => {
          return <Car key={item.id} car={item} />;
        })}

.Carslist {
  padding: 5rem 0;
}
.Carslist-center {
  width: 100vw;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  grid-row-gap: 2rem;
  grid-column-gap: 30px;
}

@media screen and (min-width: 776px) {
  .Carslist-center {
    width: 90vw;
  }
}
@media screen and (min-width: 992px) {
  .Carslist-center {
    width: 95vw;
    max-width: 1170px;
  }
}

I would like to make each picture fit fully to the grid

A: Please show us your HTML code, but this CSS code should work
img {
    object-fit: cover;
    width: 100%;
    height: 100%;
}


text:
Q: Why do we need $\sup$ and $\inf$ when we have $\max$ and $\min$. In my analysis text, it seems that $\max$ and $\min$ are replaced by $\sup$ and $\inf$ for 1D single variable function, why is this the case?

A: Because $\max$ only exists if the set contains its $\sup$. The set $\{0.9, 0.99, 0.999, 0.9999, 0.99999,...\}$ has sup 1 but no max.

A: Well there isn't always a maximum.  Consider $S=\{r\in\Bbb Q:r<2\}$.  This is a bounded set with no maximum element.  But we can say that $2$ is the smallest number which is an upper bound of $S$.

A: They're different things.  Intuitively, supremum and infimum mean least upper bound and greatest lower bound, respectively, which are different concepts from maximum and minimum.  Thus, for example, $(-\infty, 0)$, the set of all negative reals, has a sup of $0$, but no maximum value: whatever negative value $x$ you come up with, $x/2$ is greater but still negative.

A: A maximum and a minimum are attained at some value of the variable (by definition), while the supremum and the infimum (least upper bound and greatest lowerbound) are values which can be approached as close as we wish, but are not necessarily attained.
Example: on $\mathbf R$, the function $\arctan$ has a $\sup$ and an $\inf\,$ ($\frac\pi2$ and $-\frac\pi2$), but there is no $x$ such that $\,\arctan x=\frac\pi2$.


text:
Q: Contest problem on the divisibility of an integer by $n!$ This question is the $4$th question in part A of the Simon Marais Math Competition, $2022$ (held about $2$ weeks back).

Let $n$ be a positive integer, and $q \geq 3$ an odd integer such that every prime factor of $q$ is larger than $n$. Then $$
\frac{1}{n!} \prod_{i=1}^n \frac{q^i-1}{q-1}
$$
is an integer that has no prime factor in common with $\frac{q-1}{2}$.

This is a competition for undergraduate students, therefore I expected a typical olympiad technique to be used here. That $q-1$ divides $q^i-1$ is obvious. We want to show that $n!$ divides this quotient.
Let $p \leq n$ be odd, and $p | q-1$. By Lifting the Exponent, $\nu_p(\frac{q^i-1}{q-1}) = \nu_p(q^i-1)-\nu_p(q-1) = \nu_p(i)$. Thus, $\nu_p(\prod_{i=1}^n \frac{q^i-1}{q-1}) = \sum_{i=1}^n \nu_p(i) = \nu_p(n!)$. If $p=2$ then $p$ divides $q-1$, and LTE for $p=2$ does the trick again.
However, if $p \nmid q-1$ then as $p \nmid q$, $q^{k(p-1)} \equiv 1 \mod p$ for all $k$... and I'm not sure what to do. It is not clear to me that $\nu_p(\prod_{i=1}^n(q^i-1)) \geq \nu_p(n!)$. Certainly it is true that the number of $i$ such that $q^i-1$ is a multiple of $p$ is bigger than the number of multiples of $p$ less than $n$. However, accounting for $p^2,p^3$ etc. is the problem. I'd want to know if someone can continue and finish this approach.
I assume that it's enough to show that it is an integer. Once that occurs, it should not be difficult to show that $\nu_{p}((q-1)/2)>0$ implies that $p$ doesn't divide that fraction, using LTE and breaking into cases $p=2,p \neq 2$.

A: Let $d = \text{ord}_p(q)$ be the smallest positive integer $d$ such that $q^d \equiv 1 \bmod p$, so that $q^i \equiv 1 \bmod p$ iff $d \mid i$. By Fermat's little theorem, $d \mid p-1$, so in particular $d \le p-1$. This gives, without even using LTE, that
$$\nu_p \left( \prod_{i=1}^n \frac{q^i - 1}{q - 1} \right) \ge \left\lfloor \frac{n}{d} \right\rfloor \ge \left\lfloor \frac{n}{p-1} \right\rfloor \ge \nu_p(n!).$$
I haven't thought about the second part of the problem. I can't resist mentioning that if $q$ is a prime power there is a much more direct proof of this divisibility: in this case it follows by Lagrange's theorem applied to the fact that the general linear group $GL_n(\mathbb{F}_q)$, which has order $q^{{n \choose 2}} \prod_{i=1}^n (q^i - 1)$, has a subgroup of order $(q - 1)^n n!$, namely the generalized permutation matrices or monomial matrices, which abstractly are the wreath product $\mathbb{F}_q^{\times} \wr S_n$. If every prime factor of $q$ is larger than $n$ then $(q - 1)^n n!$ is relatively prime to $q^{ {n \choose 2} }$ so that factor can be ignored.
I also can't resist mentioning some more interesting facts. The polynomial $[n]_q! = \prod_{i=1}^n \frac{q^i - 1}{q - 1}$ is known as the $q$-factorial and many fun things are known about it. Its coefficients have a combinatorial interpretation in terms of permutations, and also as the Betti numbers of a manifold called a flag variety. If $q$ is a prime power it counts the number of complete flags in the vector space $\mathbb{F}_q^n$, and the relationship between this count and the fact about Betti numbers comes from the Weil conjectures.


text:
Q: Filter and pagination on CodeIgniter I'm new at CodeIgniter, but I want to ask about pagination and filtering.
I did them and they works great aside from each other, but I have two pages with filters and pagination too. They gives me some errors.
-When I click Filter, the url is like this: company/components/all/names_of_filters
so the filters works at uri segment(4).
=========================================================================But when I load pagination it shows me
company/components/all/pagination so the filters crashes with pagination. I declared uri segment(5) for loaded the pagination but the same thing. The idea is that the filter is changing from database and it is an dynamic part. How can I declare it on
$conf[base_url]=(company/components/all/...../) and put in those dashes an function that is concatenate an function that changes names filter?!                                ---------------------------------------------------------------------------------------------------------
*Has any method or not? *
Best :)

A: Put this file
myhelper_helper.php in helpers folder
function configPagination($url,$total_rows,$segment,$per_page=10)
    {

        $CI = get_instance();
        $CI->load->library('pagination');
        $config['base_url']         = site_url($url);
        $config['total_rows']       = $total_rows;
        $config['per_page']         = $per_page;
        $config['uri_segment']      = $segment;
        $config['num_tag_open']     = '
';
        $config['num_tag_close']    = '
';
        $config['cur_tag_open']     = '
';
        $config['cur_tag_close']    = '
';
        $config['num_links']        = 3;
        $config['next_tag_open']    = "
";
        $config['next_tag_close']   = "
";
        $config['prev_tag_open']    = "
";
        $config['prev_tag_close']   = "
";

        $config['first_link']   = FALSE;
        $config['last_link']    = FALSE;
        $CI->pagination->initialize($config);

        return $CI->pagination->create_links();
    }

Example of pagination using session library...
Controller:
Users.php
public function __construct()

    {

        parent::__construct();

        $this->per_page = 20; // How many records per page...

        $this->load->helper('myhelper');
        $this->load->library('session');
        $this->load->model('users_model');

    }

function list($start=0)
{
if(isset($_POST['filter_status']))

{

$this->session->set_userdata('filter_status',$this->input->post('filter_status'));

}

$data['users'] =  $this->users_model->get_all($start,$this->per_page);
$total          = $this->users_model->count_all();
$data['pages']  = configPagination('users/list',$total,5,$this->per_page);
$data['start']    = $start;

$this->load->view('users_view',$data);

}

And Finally in your model Users_model.php
function __construct()
    {
        parent::__construct();
        $this->load->database();
        }

    function get_all($start,$limit) {

            if($this->session->userdata('filter_status')!='')
            {
                $this->db->where('status',$this->session->userdata('filter_status'));
            }

    $query = $this->db->get('users', $limit, $start);

            return $query;

function count_all()

        {
                if($this->session->userdata('filter_status')!='')
        {
            $this->db->where('status',$this->session->userdata('filter_status'));
        }

        $query = $this->db->get('users');
        return $query->num_rows();
        }

In your view, something like this
    <form action="" method="post" id="filter_form">

     Status:

    <?php $status = array(0=>"Inactive", 1=>"Inactive",-1=>"Banned");?>
    <select id="status-select" name="filter_status" class="form-contro">
    <option value="">All</option>
            <?php foreach ($status as $key=>$value) {
            $sel = ($key==$this->session->userdata('filter_status'))?'selected="selected"':'';
                      ?>
          <option value="<?php echo $key;?>" <?php echo $sel;?>><?php echo $value ?></option>
                    <?php } ?>
                </select>
<input type="submit" Value="Filter" />

</form>

A: Controller
    $this->load->library('pagination');
    $pagination_config['base_url'] = base_url('/webs/webs1/all/');
    $pagination_config['total_rows'] = $this->model_m->count_all();
    $pagination_config['per_page'] = 2;
    $pagination_offset = $this->uri->segment(5);
    $this->pagination->initialize($pagination_config);
    $data['pagination_links'] = $this->pagination->create_links();
    //end

    //fetch categories from the database
    $data['categories'] = $this->model_m->get_categories();
    $categoryID = $this->uri->segment(4);
    if($categoryID == null){
        redirect('backend/subcategories/all/filterAll');
    }
    if(!isset($categoryID) || ( $categoryID == "filterAll" )) {
        $data['subcategories'] = $this->model_m->get_all_subcategories();
    } else {
        $data['subcategories'] = $this->model_m->get_by_category($categoryID);
    }
    $data['selected_category'] = $categoryID;

    $data['view'] = $this->load->view($view,$data,true);
    $this->load->view($viewlayout,$data);

MODEL
public function get_by_category($id){
    $query = $this->db->get_where('items', array('prod_id' => $id));
    if ($query->num_rows() > 0) { return $query->result(); }
    return false;
}

public function get_all_subcategories($catID = NULL,$limit = NULL ,$offset = NULL ) {
    if(isset($catID) && is_int($catID)) {
        if(isset($limit) && isset($offset)){
            $result = $this->db->get_where('items',array('prod_id' => $catID),$limit,$offset);
            return $result->result();
        }
        $result = $this->db->get_where('items',array('prod_id' => $catID));
        return $result->result();
    }

    if(isset($limit) && isset($offset)){
        $result = $this->db->get('items',$limit,$offset);
        return $result->result();
    }
    $result = $this->db->get('items');
    return $result->result();
}

public function count_all() {
    return $this->db->get('items')->num_rows();
}


text:
Q: Angular js watchexpression cacth new element my question is really simple but after a lot of searching I couldn't find an answer.  Is there any way to watch an array for changes and fire a function when a new element is added, where the element is consoled for example.
$watchExpression works fine when a new element is pushed in an array but it doesn't provide any info about the element that is added. I was thinking of implementing a function that has two variables, one that contains the array before adding the new element and another variable that holds the new state of the array and compare them ,so I could find the element added but this solution seems very unclean and inefficient. Is there any better solution?
Thx in advance
I tried this:
$scope.names = ['igor', 'matias', 'misko', 'james'];

$scope.$watchCollection('names', function(newNames, old) {
  console.log(newNames);
  console.log(old);
});

$scope.names.push("john");

but the output is this:

["igor", "matias", "misko", "james", "john"]
["igor", "matias", "misko", "james", "john"]

A: You can use lodash's _.difference.
https://github.com/rockabox/ng-lodash
$scope.$watch('scopeToWatch', function(newVal, oldVal){
var changed;
changed = lodash.difference(oldVal, newVal);
console.log(changed);
})

If you want to see if an item was added or removed, do this:
        $scope.$watch('scopeToWatch', function(newVal, oldVal){
    var change;
    if(newVal.length>oldVal.length){
    change = 'added';
    } else if(newVal.length<oldVal.length) {
    change = 'removed';
    } else {
    change = 'none'
    }

        var changed;
        changed = lodash.difference(oldVal, newVal);
if(change !== 'none'){
        console.log(changed+ 'was '+ change);
} else {
        console.log('no change');

}
    })

A: The only efficient solution i can come up with is to overwrite the push function for the given array. Of course you can apply this as well to things like .concat etc depending on what you need.
Of course you can also refactor this overwriting process into a function/service for a better code style. This is just for demonstration purposes:
var x = [1,2,3];  // define the initial array
x._push = x.push; // "backup" the normal push function
x.push = function () {
    x._push(a);   // do the normal push
    console.log ('added: ' + a); // do your magic here...
};

x.push (4);

I hope this helps

A: The problem with your output is that the browser console doesn't log a copy of your array but just the reference of the array asynchronously.
When you open the array in the console afterwards (assuming the developer console of Google-Chrome for example) it will show the elements which it contains at the point of inspecting it instead of the elements it had when it was officially logged.
What you can do to avoid this is to log a copy of the arrays instead.
So the problem is actually the console.log function itself, not your code.
Try
console.log (old.slice());

instead of
console.log (old);

This makes a copy of your array hence the array should be logged as-is since it won't be changed afterwards.


text:
Q: How do I get the hash name and key in TCL? I'm trying to figure out how to get the hash name and key in the following situation. Say I have the following hash value:
set CLIENT(CAR) "Koenigsegg"

If I pass $CLIENT(CAR) into a proc, the value that is passed is "Koenigsegg". Is there a way to also capture the fact that the hash and key storing that value is 'CLIENT' and 'CAR', respectively?
For example:
proc foobar {item} {
  set the_item $item
}

foobar $CLIENT(CAR)

In this example, the proc only receives the value of $CLIENT(CAR), which is "koenigsegg". The $item is "koenigsegg", but I don't know what kind of item it is. I'd like to get the hash name "CLIENT" and key "CAR" to know that "koenigsegg" it is a "client car".

A: You can pass the name of the array into a proc, then use upvar to access it:
proc process_array {arrayName} {
    upvar 1 $arrayName myArray
    puts "Car is $myArray(CAR)"
}

set CLIENT(CAR) "Koenigsegg"
process_array CLIENT ;# Pass the name of the array, note: no dollar sign

Output:
Car is Koenigsegg

I hope this is what you are looking for.
Update
So, you want to pass two things into the proc: the hash name (Tcl refers to it as "array") and the index name (CAR):
proc process_array {arrayName index} {
    upvar 1 $arrayName myArray
    puts "My array is $arrayName"
    puts "List of indices: [array names myArray]"
    puts "Car is $myArray($index)"
}

set CLIENT(CAR) "Koenigsegg"
process_array CLIENT CAR;# Pass the name of the array, note: no dollar sign

Output:
My array is CLIENT
List of indices: CAR
Car is Koenigsegg

Update 2
It seems that the original poster (OP) is asking for something like this:
process_array $CLIENT(CAR)

and expect the proc process_array to figure out the name of the array (CLIENT) and the index (CAR). This is not possible in my knowledge. When Tcl interpreter encounters the line above, it evaluates the $CLIENT(CAR) expression and the line becomes:
process_array Koenigsegg

That means within process_array, the proc has no idea about any array. All it knows is someone has passed to it a string "Koenigsegg".
Now, if you pass into the proc the name of the array, then it can figure out the array's name, any any indices the array has. Please see my previous code.


text:
Q: Calling Oracle Stored Procedure from ASP.NET I'm trying to update a table via a stored procedure from asp.net.  I get the following error message: "wrong number or types of arguments in call to 'UPDATE_DIRECT_BILL_DETL_SP'"
I just can't seem to figure out what is wrong.  I believe I may not be using the correct Oracle variable types in my Cmd.Parameter.Add statements.
I appreciate any help that can be provided!
Thank you.
Here are the details:
I'm using Oracle.DataAccess.dll  (ODP.NET)
Here is my function:
Public Function UpdateDirectBill(ByVal invDetID As Int32, ByVal appNum As String, _
             ByVal lastUpdtByNm As String) As Int32

    Dim numRecUpdated As Int32 = 0

    Cmd.CommandType = CommandType.StoredProcedure
    Cmd.CommandText = "UPDATE_DIRECT_BILL_DETL_SP"

    'These are the values I'm using for the params
    invDetID = 1
    appNum = "3333"
    lastUpdtByNm = "N015058"

    Cmd.Parameters.Add("invDetID", OracleDbType.Int32,    invDetID,   ParameterDirection.Input)
    Cmd.Parameters.Add("appNum",   OracleDbType.Varchar2, appNum,        ParameterDirection.Input)
    Cmd.Parameters.Add("lastUpdtByNm",  OracleDbType.Varchar2, lastUpdtByNm,  ParameterDirection.Input)
    Cmd.Parameters.Add("numRecUpdated", OracleDbType.Int32,    numRecUpdated, ParameterDirection.Output)

    Conn.Open()
    Cmd.ExecuteNonQuery()
    Conn.Close()

    Dim recsUpdated As Int32 = Convert.ToInt32(Me.Cmd.Parameters("numRecUpdated").Value.ToString())

    Return recsUpdated
End Function

My Stored Procedure:
  PROCEDURE UPDATE_DIRECT_BILL_DETL_SP
  (invDetID     IN invoice_detail.invoice_detail_id%TYPE,
   appNum       IN invoice_detail.application_num%TYPE,
   lastUpdateNm IN invoice_detail.last_update_by_nm%TYPE,
   rowCnt       OUT number)
  IS
  BEGIN
    UPDATE INVOICE_DETAIL A
    SET
    A.APPLICATION_NUM=appNum,
    A.LAST_UPDATE_BY_NM = lastUpdateNm,
    A.LAST_UPDATE_BY_DT=SYSDATE
    WHERE A.INVOICE_DETAIL_ID=invDetID;

    rowCnt := SQL%ROWCOUNT;
    if rowCnt = 1 then
      COMMIT;
    ELSE
      ROLLBACK;
    END IF;
  END UPDATE_DIRECT_BILL_DETL_SP;

The columns I'm updating are of the following types:
   invDetID IN invoice_detail.invoice_detail_id%TYPE        of type Number
   appNum in invoice_detail.application_num%TYPE            of type Varchar2(10 byte)
   lastUpdateNm IN invoice_detail.last_update_by_nm%TYPE    of type Varchar2(50 byte)

A: you define rowCnt in the sproc but use numRecUpdated  in your function..
Try
Cmd.Parameters.Add("rowCnt", OracleDbType.Int32,    numRecUpdated, _
    ParameterDirection.Output)

And
Dim recsUpdated As Int32 = _
    Convert.ToInt32(Me.Cmd.Parameters("rowCnt").Value.ToString())

A: Your parameter names don't match up 'rowCnt' and 'numRecUpdated'. Also you're specifying the type as Int in your call, but the stored proc specifies it as a Number which maps to a Decimal. So you would need to specify it either as a OracleDbType.Decimal type rather than an int. Or change your stored proc parameter to an INTEGER  http://download.oracle.com/docs/cd/B19306_01/win.102/b14307/OracleDbTypeEnumerationType.htm
Cmd.Parameters.Add("rowCnt", OracleDbType.Decimal,    numRecUpdated, ParameterDirection.Output)


text:
Q: How to understand 'means of...' in this sentence Today I read a sentence in an answer choice of a GRE Reading passage:

(E) The structure of male cycad cones is consistent with a certain
means of cycad pollination, but that means is inconsistent with the
structure of most female cycad cones.

I am confused to understand the meaning of ...means of,I checked the Merriam-Webster online dictionary and found no clue. Please help. Thank you!


text:
Q: New to git.. Do I always have to do a "git fetch" everything my notebook gets on network I am new to git and I would like to know if I have to do a "git fetch" everytime my netbook gets on a network so I have the most updated version of the code from the repository.

A: Yes, in the sense that git will not grab changes from the remote repository unless you explicitly tell it to. No, in the sense that you don't have to grab those changes if you don't want to; you can run git fetch and merge any changes it finds at your leisure.

A: You don't have to, that's why it is DVCS. But if you want to get the most updated version, yes you should pull it from remote.
Git for beginners: The definitive practical guide


text:
Q: What is this error given by RS485 Modbus-RTU Device I am using minimalmodbus to communicate with a PID controller (Love 16C-3) via RS485 using a USB-RS485 adapter cable.
However when trying to read the register, the following error is shown. What does this error mean?
raise ValueError('The slave is indicating an error. The response is: {!r}'.format(response))
ValueError: The slave is indicating an error. The response is: '\x01\x83\x02\xc0\xf1'

From Hardware's Manual

Python Code
instrument = minimalmodbus.Instrument(port, 1, 'rtu')
instrument.serial.baudrate = 9600
instrument.serial.bytesize=8
instrument.serial.parity='E'
instrument.serial.stopbits=1
instrument.read_register(4096,1)

A: If you reference the modbus spec, you find that an exception to a function is made by setting the MSB in the function byte... effectively adding 0x80 to the function number in the reply.
In your example, you attempted to read Holding register. Your request used a function number of 0x03. The exception you received is that function 0x03 with the MSB set high, resulting in a reply function of 0x83. The exception code is the number that follows the function number, in your case it is 0x02.
In the Modbus Spec, an exception code of 2 is used when the register address is not supported.
BTW, modbus is an exceedingly simply protocol, and the original spec itself is quite small and easily available. If you plan on working with modbus at any depth, I would highly recommend at least having it at hand: Modbus Application Protocol v1.1


text:
Q: Reload page dynamically I create a dashboard to which I added a modal box which proposes to save or to go back. To go back, I need to reload the page (so that the data will return to the initial state). I used javascript and this script works but the problem is that the browser shows that the page is reloaded (I would like to reload the page dynamically). Do you have an idea to reload the page dynamically?
current code:
function cancel() {
close();
document.location.reload();
}

A: To my knowledge there is no way to do this automatically. You will have to fetch all your values asynchronous and repopulate your Html.
Or perhaps put your entire dashboard inside an iframe and call document.location.reload(); inside that.
That should stop the browser showing the reload animation. I have not tried it  though.


text:
Q: Python - iterating over nested loop First off i am certain that such a basic thing has been asked before, but i could not find a post about it.
I have this piece of example data:
'192.168.244.213': ['8', '4', '3', '1', '6', '5', '3', '2', '6', '5'],
'192.168.244.214': ['6', '8', '7', '6', '5', '4', '2', '7', '5', '5'],
'192.168.244.215': ['4', '10', '0', '8', '7', '0', '4', '3', '2', '6'],
'192.168.244.230': ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0']

And i want to print out every line (each line is one dictionary key-value pair) that has a list-value whose list contains any amount of items that is not 0 (in this case, every line except the 4th)
I just cant seem to figure out this seemingly simple thing - what i tried before was those two things:
for i in d.keys():
    if "0" not in d[i]:
        print(i, d[i])

This one shows only lists that do not contain 0 AT ALL - so the third line would not be shown, even though it contains non-0 values
for i in d.keys():
    for j in d[i]:
        if j is not "0":
            print(i, d[i])

This one DOES show me what i want, but as you can tell, it prints every result way too often - one print for every list value that is not 0.

A: Use a dictionary-comprehension:
d = {'192.168.244.213': ['8', '4', '3', '1', '6', '5', '3', '2', '6', '5'],
     '192.168.244.214': ['6', '8', '7', '6', '5', '4', '2', '7', '5', '5'],
     '192.168.244.215': ['4', '10', '0', '8', '7', '0', '4', '3', '2', '6'],
     '192.168.244.230': ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0']}

result = {k: v for k, v in d.items() if not all(x == '0' for x in v)}

# {'192.168.244.213': ['8', '4', '3', '1', '6', '5', '3', '2', '6', '5'],
#  '192.168.244.214': ['6', '8', '7', '6', '5', '4', '2', '7', '5', '5'],
#  '192.168.244.215': ['4', '10', '0', '8', '7', '0', '4', '3', '2', '6']}

The above code generates a new dictionary which omits all items where values are all zeros.
Now that you have a dictionary, you can easily do an iteration like so:
for k, v in result.items():
    print(k, v)

A: You can simply iterate over like
def all_zero(arr):
    for i in arr:
        if i != 0:
            return False
    else:
        return True

You can call it on all the lists one by one.

A: for i in d.keys():
    all_zero = True
    for j in d[i]:
        if j is not "0":
            all_zero = False
            break
    if not all_zero:
        print(i, d[i])

This may work for almost every language :)

A: Your bug is basically just a missing break:
for i in d.keys():
    for j in d[i]:
        if j != "0":
            print(i, d[i])
            break

However, for conciseness I would recommend you check out the any() function, which does exactly what you want: Return true if any of the elements of the iterable are true (when cast to booleans).
Eg:
for i in d.keys():
    if any(j != "0" for j in d[i]):
        print(i, d[i])

(The j is not "0" generator is only necessary because you have string values. For an int array, any(d[i]) would work.)
Even more "Pythonic" would be removing the need for a dictionary lookup:
for i, d_i in d.items():
    if any(j != "0" for j in d_i):
        print(i, d_i)

A: I like the other answers but I feel like you can get away with something like this as well:
for i in d.keys():
    #If there are as many zeroes as there are elements in the list...
    if d[i].count(0) == len(d[i]):
        #...You might as well skip it :)
        continue
    print(d[i])

A: Have a look at how I could accomplish this.
d = {
    '192.168.244.213': ['8', '4', '3', '1', '6', '5', '3', '2', '6', '5'],
    '192.168.244.214': ['6', '8', '7', '6', '5', '4', '2', '7', '5', '5'],
    '192.168.244.215': ['4', '10', '0', '8', '7', '0', '4', '3', '2', '6'],
    '192.168.244.230': ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
}

for key in d.keys():
    if all( item == '0' for item in d[key]):
        pass
    else:
        print(key, d[key])

A: You should use all in this case, consider following example:
digits = ['0', '2', '0', '4', '7', '5', '0', '3', '2', '6']
zeros = ['0', '0', '0', '0', '0', '0', '0', '0', '0', '0']
print(all([k=='0' for k in digits])) #gives False
print(all([k=='0' for k in zeros])) #gives True

Please remember to deliver [k=='0' for k in ...] to all, as delivering list directly would give True for both digits and zeros, as both contain at least one non-empty str (str of length 1 or greater).


text:
Q: How do I receive a push notification to one app from another? I have followed the Quick Start Guide for parse:
https://parse.com/apps/quickstart#parse_data/mobile/ios/native/existing
I'm using this code to save a PFObject:
PFObject *testObject = [PFObject objectWithClassName:@"TestObject"];
testObject[@"Bookmarks"] = @"Restore Successful";
[testObject saveInBackground];

Below is what it looks like when my PFObject is saved to my Parse backend:

So it's safe to say that saving the object is good to go but I need this process:

*

*App A saves PFObject to Parse backend (i'm already doing this)

*Parse backend sends push notification to App B (how do i automatically do this?)

*App B receives push notification saying what was saved(how do i do this?)

Is there any way to do this? I've tried Cloud Code but it's really confusing. I've literally tried setting it up, like, 6 times :( I know how to setup push notifications but I don't know how to get parse to automatically send a push notification when App A saves a new PFObject.
I just need to be notified when my Parse backend receives a new PFObject,

A: You shouldn't look at it like "one app to another" instead, you should focus on, from one circumstance to another, because this can limit your future implementations, unless you are strictly coding for admin or simplistic purposes, just do what's best for your project. Parse pushes currently support up to 6 different push certificates using the same Parse.com applicationId & clientKey. Essentially, all you need to do is create an individual push certificate for each app, just like you did the for the first one, and upload it to your Push Certificates in your Parse.com settings. This is not device/OS specific, and will not work until you add these to your backend console. After that is complete, enable the Client Push Enabled setting and then you simply just need to target your push notifications. Since you haven't included 'User' as a priority in your question, simply take advantage of a parameter for targeting application names/ids. See here. In other words, target your push notification to use the applicationId column or appName column in your Installation class

A: Sending a push to a user:
PFQuery * pushQuery = [PFInstallation query];
PFUser * userReceivingPush;
[pushQuery whereKey:@"owner" equalTo:userReceivingPush];

NSString * alert = [NSString stringWithFormat:@"MESSAGE_FROM %@", [PFUser currentUser].username];
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys: alert, @"alert", @"default", @"sound",  @"Increment", @"badge", nil];
[PFPush sendPushDataToQueryInBackground:pushQuery withData:data block:^(BOOL succeeded, NSError *error) {
    if (!error) {
    } else {

    }
}];

Responding if app isn't running:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  . . .
  // Extract the notification data
  NSDictionary *notificationPayload = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];

  // Create a pointer to the Photo object
  NSString *photoId = [notificationPayload objectForKey:@"p"];
  PFObject *targetPhoto = [PFObject objectWithoutDataWithClassName:@"Photo"   objectId:photoId];

  // Fetch photo object
  [targetPhoto fetchIfNeededInBackgroundWithBlock:^(PFObject *object, NSError *error) {
    // Show photo view controller
    if (!error) {
      PhotoVC *viewController = [[PhotoVC alloc] initWithPhoto:object];
      [self.navController pushViewController:viewController animated:YES];
    }
  }];
}

If your app is already running when the notification is received, the data is made available in the application:didReceiveRemoteNotification:fetchCompletionHandler: method through the userInfo dictionary:
- (void)application:(UIApplication *)application
  didReceiveRemoteNotification:(NSDictionary *)userInfo  fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))handler {
  // Create empty photo object
  NSString *photoId = [userInfo objectForKey:@"p"];
  PFObject *targetPhoto = [PFObject objectWithoutDataWithClassName:@"Photo"   objectId:photoId];

  // Fetch photo object
  [targetPhoto fetchIfNeededInBackgroundWithBlock:^(PFObject *object, NSError *error) {
    // Show photo view controller
    if (error) {
      handler(UIBackgroundFetchResultFailed);
    } else if ([PFUser currentUser]) {
      PhotoVC *viewController = [[PhotoVC alloc] initWithPhoto:object];
      [self.navController pushViewController:viewController animated:YES];
      handler(UIBackgroundFetchResultNewData);
    } else {
      handler(UIBackgroundModeNoData);
    }
  }];
}

read more here: https://parse.com/docs/ios/guide
another push:
NSDictionary *data = @{
  @"alert" : @"The Mets scored! The game is now tied 1-1!",
  @"badge" : @"Increment",
  @"sounds" : @"cheering.caf"
};
PFPush *push = [[PFPush alloc] init];
[push setChannels:@[ @"Mets" ]];
[push setData:data];
[push sendPushInBackground];

Push Options:
Customizing your Notifications
If you want to send more than just a message, you will need to use an NSDictionary to package all of the data. There are some reserved fields that have a special meaning.
**alert**: the notification's message.
**badge**: (iOS/OS X only) the value indicated in the top right corner of the app icon. This can be set to a value or to Increment in order to increment the current value by 1.
**sound**: (iOS/OS X only) the name of a sound file in the application bundle.
content-available: (iOS only) If you are a writing a Newsstand app, or an app using the Remote Notification Background Mode introduced in iOS7 (a.k.a. "Background Push"), set this value to 1 to trigger a background download.
**category**: (iOS only) the identifier of th UIUserNotificationCategory for this push notification.
**uri**: (Android only) an optional field that contains a URI. When the notification is opened, an Activity associate with opening the URI is launched.
**title**: (Android, Windows 8, and Windows Phone 8 only) the value displayed in the Android system tray or Windows toast notification.


text:
Q: permanent terminal with root Is it bad to have at all times (one) terminal logged in as root? If so, why?
(I leave the window with root terminal usually opened because it's much more comfortable than writing sudo before everything what needs root.)
Just to clarify that this isn't a duplicate question as suggested by system, I'm not talking about running the whole account as root, just one terminal window.
Thank you.
P.S.: sorry for the non-descriptive heading, I for love nor money couldn't think off sth that made more sense.
P.P.S.: This does not mean I'm performing the usual tasks (copying, running normal programs...) as root.
Ok, the main question came up later after posting this - what is the technical difference between executing command as $ sudo command and executing it as # command ?
To clarify:
I wanted to write into file /sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight/brightness directly. It containes only a number with level of KB backlight.
This failes:
edison23@edison23-N56VM:/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight$ sudo echo 3 > brightness
bash: brightness: Permission denied

This succeeds
root@edison23-N56VM:/sys/devices/platform/asus-nb-wmi/leds/asus::kbd_backlight# echo 3 > brightness

Why?
Thanks

A:
Is it bad to have at all times (one) terminal logged in as root? If so, why?

Yes. Well. The idea of logging out your root terminal is due to the fact that Linux is a multi-user system. So other users could walk to your terminal and issue commands you do not want them to issue. With the introduction of desktops (that are often single user) this is less of an issue.
The 2nd issue is that some files depend on the user being the owner of files. If you touch those as root they will be saved for the user root and you can lock yourself out of the desktop.  We have several questions about that on Ask Ubuntu.
But besides that: Ubuntu does not use root. We use "sudo" and (by default) you have to supply the "sudo" password every 15 minutes. So there is no need for "root". No need at all. Learn to live with the way Ubuntu does it. It has proven it works over the past decade or so.
But... It is your system. It is your data. If you believe you need "root" go for it. Most of us will not. When you mess up it is  on your head (but that is also doable using "sudo" ;) ).
Make regular backups. Check that you can restore backups. And you should always be able to restore your system.

A:
Is it bad to have at all times (one) terminal logged in as root? If so, why?

I can only say that I worked the same way as you, until I made a huge mistake... most of the time I forgot to add sudo in front of my commands to get the privilege for systemuser.
Then on one day I executed as root the command
rm -rf / var/www/filenotneeded.html

... as you may see there is a space after the / which means it deletes / and all subfolders until rm itself is removed.
If I had used sudo maybe I had checked it twice because I still forget sudo today. Since I use sudo the error rate was getting down and and I feel a bit more secure then before. I dont say you will do the same error... I just want to warn that with root you destroy the system in microseconds and sudo tells me that I should check the command before I execute it.


text:
Q: How to find error in php I'm beginner for php and I'm coding on Notepad_++.  an error creating in my programming while updating/editing  any row from the table. When I changed something from the row and click on submit button then page return on  main page and nothing changed with without error shown, show I can't guess where is error.
suppose..- I have a table which name is Customer Details_tbl and I click on a row edit button, after click a page opening which name is add_customer_tbl and I trying to change some information of customer, after some changing,' I clicking on submit button and page return on Customer_detail_tbl page but no changing and no any error showing .. so my question is how to fix it..
$error="Failed to Update.". mysqli_error($db); //this code I already putted

A: If you want to view Error then you can do many ways:
1.) You can do it from PHP.INI
display_errors = on

2.) You can do it from error_reporting(1);
<?php
// Turn off error reporting
error_reporting(1);

// Report runtime errors
error_reporting(E_ERROR | E_WARNING | E_PARSE);

// Report all errors
error_reporting(E_ALL);

// Same as error_reporting(E_ALL);
ini_set("error_reporting", E_ALL);

// Report all errors except E_NOTICE
error_reporting(E_ALL & ~E_NOTICE);
?

3.) You can do it from ini_set('display_errors', 1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Set this in index.php

A: first You should modify your php.ini with this line:
display_errors = on

and you can also Dumping Variables Before Send to db For debug
var_dump($yourvar);
die();

A: Use it after declare php tag or show me your full code for clarification :
ini_set('display_errors', 1);


text:
Q: Change assigned style I'd like change assigned style display of ctl00_PlaceHolderLeftNavBar_ctl01_WebTreeViewn1Nodes from "none" to "block"
and style height of ctl00_PlaceHolderLeftNavBar_ctl01_TreeViewRememberScroll.
Is it possible? It is in Metadata navigation on the left site of a window.
I tried this:

A: Should you try this :
<style>

#ctl00_PlaceHolderLeftNavBar_ctl01_TreeViewRememberScroll
{
height : 150px ! important;
}

#ctl00_PlaceHolderLeftNavBar_ctl01_WebTreeViewn1Nodes
{
display : block ! important;
}

</style>


text:
Q: Impact of web platform on GUI Web based systems (Client Side GUI only) are known to be platform independent, But, are they development-platform independent too??
To the best i know, Client Side GUI will always be built using HTML and JavaScript/VBScript or Java or etc which are supported by all OSs and Browsers to make it independent. I am concerned about the change in GUI-code if the server side platform is switched e.g. from ASP.NET to PHP or Java or from x to y?
If it depends upon the way the GUI is designed/developed then What should not be used to make this impact as minimal as possible?
Regards
Atti

A: You would need to use frameworks that are platform agnostic or write your views in plain html + javascript + css yourself.
Platform agnostic frameworks would help to seamlessy deploy your UI layer, or views, onto different operating systems.
If you also plan to change the development language, you will probably have to write the html, javascript and css for your views yourself because to my knowledge there are no popular frameworks that can be used on different languages.
Most frameworks are designed to work with a specific language/runtime and provide you with a level of abstraction that hides the gory html, javascript, ... details for you for a more natural development experience.
The code is then transformed by the framework into pure html, javascript, css, ...
But in case you want truly agnostic views, you will have to give up that abstraction and write the html yourself.
Not an easy task, not because of the fact that html and javascript are difficult per se, but cross browser compatibility is a bitch, plus you lose the benefit of well tested components.
The end product, on the client side, is always platform independent because it is nothing more then html, javascript and css, which is supported by all operating systems

A: If the client GUI is written in JavaScript and does all communication with ajax and json, you can swap out whatever back end you want as long as it provides the same api.
It also depends on how you build the site. If you are using, for example, java based html widgets, it will be harder to replace with the equivalent in say cold fusion.
But changing the back end is usually an exercise in futility since you aren't really giving the end users anything different. Often it's overzealous programmers that want to rewrite the back-end for no good reason. Don't do that.

A: I thought it worthy
The Web is Not Platform Independent

A: Typically the server side of an HTML application should not impact the client side. Meaning that if you stick to JavaScript only components on the client, you will be able to change the server side any time you want.
The problem with JS programming is however deeper than just browsers compatibility (which is already a huge problem). The following are not well considered problems:

*

*Performance - JS is the slowest language on earth.

*Inside the box - JS offers interop only with the browser DOM, and a few other things. This means that any application that wants to be "native" for a specific OS must not be implemented in JS.

So maybe you need to investigate approaches that have a "native" client UI. Such as Java for example.


text:
Q: Using Arrays in email template in Magento I am passing an array in template parameters in Magento's sendNewOrderEmail function as:
$mailer->setTemplateParams(array(
                'order'        => $this,
                'billing'      => $this->getBillingAddress(),
                'payment_html' => $paymentBlockHtml,
                'sa'           => $someArray  // This is an array
            )
        );

But I am not able to use the variable sa in the magento email template. I tried using it like {{var sa}} But in the email i get Array instead of the contents.
How can I display contents of the array in the email.

A: You can try sa.key where key is key in array.
Or you can merge this array with base params array


text:
Q: How should I create a Tree structure in Rally of defects with respect to user story I am able to get tree structure for the user stories but want it same for defects also which are related to particular user story so that at a singe screen I can see both user stories and the related defects.

A: You may use features: [{ftype:'groupingsummary'}] of ExtJS to group defects by user stories and even summarize by some other field, in the code below by PlanEstimate. To group defects by user story Requirement attribute on defect is used, which points to the related story. In this example defects are filtered by Iteration.
Ext.define('CustomApp', {
    extend: 'Rally.app.TimeboxScopedApp',
    componentCls: 'app',
    scopeType: 'iteration',
    comboboxConfig: {
        fieldLabel: 'Select Iteration:',
        labelWidth: 100
    },
    onScopeChange: function() {
        this.makeStore();
    },
    makeStore: function() {
        var filter = Ext.create('Rally.data.wsapi.Filter', {
            property: 'Requirement',
            operator: '!=',
            value: null
        });

        filter= filter.and(this.getContext().getTimeboxScope().getQueryFilter());
        filter.toString();

        Ext.create('Rally.data.wsapi.Store', {
                model: 'Defect',
                fetch: ['ObjectID', 'FormattedID', 'Name', 'State', 'Requirement', 'PlanEstimate'],
                autoLoad: true,
                filters: [filter],
                listeners: {
                    load: this.onDataLoaded,
                    scope: this
                }
                });
    },
    onDataLoaded: function(store, records){
        if (records.length === 0) {
            this.notifyNoDefects();
        }

        else{
            if (this.notifier) {
                this.notifier.destroy();
            }
            var that = this;
            var promises = [];
            _.each(records, function(defect) {
                promises.push(this.getStory(defect, this));
            },this);

            Deft.Promise.all(promises).then({
                success: function(results) {
                    that.defects = results;
                    that.makeGrid();
                }
            });
        }

    },

    getStory: function(defect, scope) {
        var deferred = Ext.create('Deft.Deferred');
        var that = scope;
            var storyOid = defect.get('Requirement').ObjectID;
            Rally.data.ModelFactory.getModel({
            type: 'HierarchicalRequirement',
            scope: this,
            success: function(model, operation) {
                fetch: ['FormattedID','ScheduleState'],
                model.load(storyOid, {
                    scope: this,
                    success: function(record, operation) {
                        var storyScheduleState = record.get('ScheduleState');
                        var storyFid = record.get('FormattedID');
                        var defectRef = defect.get('_ref');
                        var defectOid  = defect.get('ObjectID');
                        var defectFid = defect.get('FormattedID');
                        var defectPlanEstimate = defect.get('PlanEstimate');
                        var defectName  = defect.get('Name');
                        var defectState = defect.get('State');
                        var story = defect.get('Requirement');

                        result = {
                                    "_ref"          : defectRef,
                                    "ObjectID"      : defectOid,
                                    "FormattedID"   : defectFid,
                                    "Name"          : defectName,
                                    "PlanEstimate"  : defectPlanEstimate,
                                    "State"         : defectState,
                                    "Requirement"   : story,
                                    "StoryState"    : storyScheduleState,
                                    "StoryID"       : storyFid
                                };
                        deferred.resolve(result);
                    }
                });
            }
        });
        return deferred;
    },

    makeGrid: function() {
        var that = this;
        if (this.grid) {
            this.grid.destroy();
        }

        var gridStore = Ext.create('Rally.data.custom.Store', {
            data: that.defects,
            groupField: 'StoryID',
            pageSize: 1000,
        });

        this.grid = Ext.create('Rally.ui.grid.Grid', {
            itemId: 'defectGrid',
            store: gridStore,
            features: [{ftype:'groupingsummary'}],
            minHeight: 500,
            columnCfgs: [
                {
                    text: 'Formatted ID', dataIndex: 'FormattedID', xtype: 'templatecolumn',
                    tpl: Ext.create('Rally.ui.renderer.template.FormattedIDTemplate')
                },

                {
                    text: 'Name', dataIndex: 'Name',
                },
                {
                    text: 'State', dataIndex: 'State',
                        summaryRenderer: function() {
                            return "PlanEstimate Total";
                        }
                },
                {
                    text: 'PlanEstimate', dataIndex: 'PlanEstimate',
                    summaryType: 'sum'
                },
                {
                    text: 'Story', dataIndex: 'Story',
                    renderer: function(val, meta, record) {
                        return '' + record.get('Requirement').FormattedID + '';
                    }
                },
                {
                    text: 'Story Schedule State', dataIndex: 'StoryState',
                }
            ]
        });

        this.add(this.grid);
        this.grid.reconfigure(gridStore);
    },
    notifyNoDefects: function() {
        if (this.grid) {
            this.grid.destroy();
        }
        if (this.notifier) {
            this.notifier.destroy();
        }
        this.notifier =  Ext.create('Ext.Container',{
                xtype: 'container',
                itemId: 'notifyContainer',
                html: "No Defects found matching selection."
            });
        this.add( this.notifier);

    }
});


text:
Q: Route to new component with props on button click React When the Button is clicked I need to pass new props the UnitOverview an go to the link "OeeUnitOverview". When I Go the link "OeeUnitOverview to component will load automatically.
I want to print the ID and name in the OeeUnitOverview class
<Button
  component={Link}
  to="OoeUnitOverview"
  // render={(props) => <UnitOverview id={5} name={"test"} {...props} />}
  // ///  <== not working
  variant="contained"
  style={{ width: "100%" }}
>
  Detailscode
</Button>

class UnitOverview extends React.Component<IUnitProps> {
  constructor(props: IUnitProps) {
    super(props);
  }

  componentDidMount() {
    // console.log("UnitOverview id " + this.state.name);
    console.log("id = " + this.props.id);
    console.log("name = " + this.props.name);
  }
  render() {
    return
test
;
  }
}
interface IUnitProps {
  id: number;
  name: string;
  history?: any;
  location?: any;
  match?: any;
}

export default UnitOverview;

A: I'm guessing you are using react-router-dom. With the Link component you can pass route state. Link: to object.
<Button
  component={Link}
  to={{
    pathname: "OoeUnitOverview",
    state: {
      id: 5,
      name: 'test',
    },
  }}
  variant="contained"
  style={{ width: "100%" }}
>
  Detailscode
</Button>

Then on the receiving route (the one rendering UnitOverview), ensure it has access to route props or router context. The route state will be on the location prop/object.
this.props.location.state
// or props.location.state
// or const { state } = useLocation();

Based on the interface
interface IUnitProps {
  id: number;
  name: string;
  history?: any;
  location?: any;
  match?: any;
}

I will assume it is correctly receiving the route props. Use the componentDidMount lifecycle method to access the passed route state and handle any logic that depends on them.
class UnitOverview extends React.Component<IUnitProps> {
  constructor(props: IUnitProps) {
    super(props);
  }

  componentDidMount() {
    const {
      location: {
        state,
      },
    } = this.props;

    console.log("id = " + state.id);
    console.log("name = " + state.name);
  }

  render() {
    return
test
;
  }
}

If you see error that props.location is undefined and you can't get to the state, then you can wrap the UnitOverview export with the withRouter Higher Order Component.
export default withRouter(UnitOverview);


text:
Q: Can I make cloud build run all triggered builds seriallly? We are using cloud build but unlike circle CI, we have not found a way to make sure if trigger is called twice to make sure one build is run AFTER the other so they are not all run at the same time.  Is there a way to do this in google cloud build?
I don't see this config in cloudbuild.yaml or in the GUI...
https://cloud.google.com/cloud-build/docs/build-config

A: Official documentation:
Each Google Cloud project is granted quota to run ten builds at a time. When this quota is filled, requests for additional builds are queued and processed serially after the running build completes. An infinite number of builds can be queued.
Simply decrease the quota to 1 and the builds will be executed one at a time, while the other builds will wait in the queue.
https://console.cloud.google.com/iam-admin/quotas

This is a fast workaround. Here is an answer with some references on custom builders usage. You may need to create your own queuing logic if you have for example 3 different builds and you don't want them to block each other, while each one of them has no more than one ongoing instance.


text:
Q: iOS, APNS, Push Notification, DeviceToken,iPhone We are registerting our iOS application for APNS. After that APNS provide a deviceToken. Is there any process to get the iOS device registration URL on APNS.

A: I think No. You need your own server where you will put notification logic.


text:
Q: dplyr::mutate unquote RHS I am wondering how to properly UQ string created variable names on the RHS in dplyr methods like mutate. See the error messages I got in comments in the wilcox.test part of this MWE:
require(dplyr)

dfMain <- data.frame(
    base = c(rep('A', 5), rep('B', 5)),
    id   = letters[1:10],
    q0   = rnorm(10)
)

backgs <- list(
    A = rnorm(13),
    B = rnorm(11)
)

fun <- function(dfMain, i = 0){

    pcol <- sprintf('p%i', i)
    qcol <- sprintf('q%i', i)

    (
        dfMain %>%
        group_by(id) %>%
        mutate(
            !!pcol := ifelse(
                !is.nan(!!qcol) &
                length(backgs[[base]]),
                wilcox.test(
                    # !!(qcol) - backgs[[base]]
                    # object 'base' not found
                    # (!!qcol) - backgs[[base]]
                    #  non-numeric argument to binary operator
                    (!!qcol) - backgs[[base]]
                )$p.value,
                NaN
            )
        )
    )

}

dfMain <- dfMain %>% fun()

I guess at !!(qcol) ... it is interpreted as I would like to unquote the whole expression not only the variable name that's why it does not find base? I also found out that (!!qcol) returns the string itself so no surprise the - operator is unable to handle it.

A: Your code should work as you expect by changing the line where you define qcol to:
qcol <- as.symbol(sprintf('q%i', i))

That is, since qcol was a string, you needed to turn it into a symbol before unquoting for it to be evaluated correctly in your mutate. Also I presume the column you wanted to refer to was the q0 column you defined in your data, not a non-existent column named qval0.


text:
Q: Prediction of group of values I want to predict belonging to the range of values (e.g. age group) based on numerical labels (e.g. exact age). Is, in general, regression or classification more accurate to this problem?

A: Standard classification models will disregard the ordered nature of your target variable, which loses information.
My first approach would be an ordered logit model, which is an extension of ordinary logistic regression to multiple ordered categories, like your age buckets. I didn't find a straight duplicate, but previous threads with the "ordered-logit" tag may be helpful, and of course, there is much more material on these models out there.


text:
Q: React-FontAwesome unicode values in svg circle I am trying to embed a font awesome icon inside svg circles via unicode values from the font awesome website inside <text>, but they fail to appear:

for some reason which I don't understand, when I am using this unicode value(&#x2713) it does appear(but it's not the icon I need):

Some code:
from the react component:
       <g>
            <circle className="circle test-circle"
                key={index}
                cx={xScale(node.x)}
                cy={yScale(node.y)}
                r={node.r}
                fill={node.done === true ? colour : "grey"}
            />
            {node.done === true ?
                <text id="chk" style={{fontFamily:'Font Awesome'}} x={xScale(node.x)-10} y={yScale(node.y)+10}></text>
                :
                <text id="chk" style={{fontFamily:'Font Awesome'}} x={xScale(node.x)-10} y={yScale(node.y)+10}></text>
            }

        </g>

from the scss:
text#chk {
    font-family: 'Font Awesome';
    content: "\f00c";
    font-size: 30px;
}

What can cause this?

A: I found out the problem, font family is font-family='fontawesome' and not 'Font Awesome'


text:
Q: Denied root access to user mounted FUSE file system Let me start with giving you the details of my setup:
I am running Fedora 13 on an x86_64 arch. I have mounted a remote directory using sshfs:
jim@localsite $ sshfs jim@remotesite:/home/jim /home/jim/remotemount

Now if su to root and try to read the content under the mount point, I get:
root@localsite $ ls -l /home/jim/remotemount
ls: cannot access remotemount: Permission denied
root@localsite $ ls -l /home/jim
total 0
drwxrwx---. 1 jim jim      90 Oct 1 12:00 bin
drwxrwx---. 1 jim jim      90 Oct 1 12:00 dev
d?????????? ? ?   ?         ?           ? remotemount
drwxrwx---. 1 jim jim      90 Oct 1 12:00 tmp

Seeing that root cannot access the remotemount directory is rather odd. Is this expected behavior? If so, why? If not, any lead on how to go about fixing it will be helpful. Thanks.

A: This is by design in fuse as a security measure.  Pass the -o allow_root or -o allow_other option when mounting the filesystem with sshfs.
It is in place to prevent from root from being nosy on shared systems.

A: found ls: cannot access system: Permission denied after sshfs on mint/ubuntu.
sudo adduser <username> fuse

remove from comment user_allow_other in file /etc/fuse.conf.
Change permission of fuse.conf sudo chmod a+r /etc/fuse.conf
reboot now and do
sshfs <login>@<ip_of_machine>:<path_to_mount> <mountpoint> -o allow_other


text:
Q: sudo: setrlimit(RLIMIT_CORE): Operation not permitted seeing this when executing sudo from inside a docker container (ubuntu 18.04) when parent host is ubuntu 20.04
sudo -i
sudo: setrlimit(RLIMIT_CORE): Operation not permitted
root@devops:~#

A: a fix has been applied to sudo 1.8.31p1 and is already in 1.9 however this warning has a work around ... just issue
echo "Set disable_coredump false" >> /etc/sudo.conf

for details see https://github.com/sudo-project/sudo/issues/42


text:
Q: Delay modal from loading for 5 seconds I am trying to delay the modal from loading for 5 seconds. My code is below
<script type='text/javascript'>//<![CDATA[
$(window).load(function(){
$('#overlay').modal('show');

setTimeout(function() {

}, 50000);
});//]]>

</script>

At the moment the modal is loading when the page is loaded. Thanks in advance for any help

A: Look at your code.  You do this right away:
$('#overlay').modal('show');

Then you set a delay to perform... an empty function:
setTimeout(function() {

}, 50000);

So after 50 seconds (you have an extra zero), your code will execute that empty function.  Which does nothing.  Instead of doing nothing, you can move your code which does something into that function:
setTimeout(function() {
    $('#overlay').modal('show');
}, 5000);

That way (after fixing the extra zero), rather than do something right away the code will wait for 5 seconds and then do something.


text:
Q: inputs rederizados por un map, como guardar los datos de cada uno de los inputs en un state diferente? estoy haciendo una practica en react soy principiante y tengo esta incógnita, en esta practica tengo unos inputs que se renderizan de manera dinamica por un map, como haría para que cada dato de cada uno de los inputs renderizados se guarde en un state diferente. este es mi código hasta los momentos, gracias de antemano.

export class RenderizadoPrueba extends Component{

  constructor(props){
    super(props);
    this.state ={
      values: '',
      nroRenderElemento: 3,
      inputs: []
    }
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(e){
    this.setState({
        value: e.target.value
    });
  }

  handleSubmit(e){
    console.log('Este es el nombre introducido:', this.state.value);
    e.preventDefault();
  }

  componentDidMount(){
    this.setState({
      inputs: [... Array(this.state.nroRenderElemento)].map((input, i) =>
        <label key={input}>
          Introduzca su Nombre:
          <input type="text" name={i} onChange={this.handleChange}/>
        </label>
      )
    })
  }

  render(){
    return(
      <div>
        <form onSubmit={this.handleSubmit}>
          {this.state.inputs}
          <input type="submit" value="Submit"/>
        </form>
      </div>
    )
  }
}

A: Acá te dejo como quedaría, algunas cosas a tener en cuenta

*

*Los valores los estoy guardando en un array, con el mismo index que
el del input.

*Usé el metodo slice en el array de values para hacer
un shallow copy del array y para no mutarlo. Lo modifico y luego lo
reemplazo por el anterior.

*También cambié la llamada del callback
onChange creando una funcion anonima para poder pasarle un
parametro extra que es el index.

class RenderizadoPrueba extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      values: [],
      nroRenderElemento: 3,
      inputs: []
    };
    this.handleChange = this.handleChange.bind(this);
    this.handleSubmit = this.handleSubmit.bind(this);
  }

  handleChange(e, index) {
    const values = this.state.values.slice();
    values[index] = e.target.value;
    this.setState({values});
    console.log(this.state);
  }

  handleSubmit(e) {
    console.log("Este es el nombre introducido:", this.state.value);
    e.preventDefault();
  }

  componentDidMount() {
    this.setState({
      inputs: [...Array(this.state.nroRenderElemento)].map((input, i) => (
        <label key={input}>
          Introduzca su Nombre:
          <input type="text" name={i} onChange={e => this.handleChange(e, i)} />
        </label>
      ))
    });
  }

  render() {
    return (
      <div>
        <form onSubmit={this.handleSubmit}>
          {this.state.inputs}
          <input type="submit" value="Submit" />
        </form>
      </div>
    );
  }
}

ReactDOM.render(<RenderizadoPrueba />, document.body);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>


text:
Q: ¿ Cómo recordar contraseña de un edittext? Tengo un editText y cada vez que pongo contraseña y salgo de la App tengo que escribirla, había algún método para dar algún click y que se recuerde?

A: Utilizando SharedPreferences podrás guardar tu contraseña, una vez el usuario la escriba correctamente una vez.
Puedes usar SharedPreferences de la siguiente manera para insertar los datos:
SharedPreferences prefs = getSharedPreferences("MisPreferencias",Context.MODE_PRIVATE);

SharedPreferences.Editor editor = prefs.edit();
editor.putString("password", "holamundo");
editor.commit();

Para recuperar los datos puedes hacerlo así:
String password = prefs.getString("password", "valorpordefecto");

El segundo parámetro de getString es un valor por defecto por si el valor de la password es vacío.

A: Puedes usar SharedPreferences en modo privado para guardarla, y que se recupere cada vez que vuelvas a esa vista, pero ten en cuenta que de esta forma y con el teléfono rooteado, se podría ver la contraseña.
Para hacerla más segura puedes aplicar un cifrado a tu contraseña y guardarla cifrada, o mejor usar OAUTH en tu servidor.


text:
Q: What is a strict schedule? Say n transactions follow a strict serializable schedule i.e. serialize themselves using strict2PL or the like. Now say a (n+1)th transaction comes in to run concurrently with the others and does not follow strict2PL. Can we still safely say that it will read data only commited data from others.
Thanks

A: A schedule in which a transaction can neither read or write an item X until the last transaction that wrote X has committed.

A: Here strictness means that if you have two transactions Trans1 and Trans2, if a write operation of Trans1 comes before a conflicting operation of Trans2(read or write), then the commit event of Trans1 will also come before that conflicting operation of Trans2. Strictness is just to allow efficient recover of databases from failure.
for more see this page- http://en.wikipedia.org/wiki/Two-phase_locking