问:
SQL Server Silent installation get error during installation
I want to install SQL Server Express (preferably 2008 or 2014) silently using Advanced Installer. I followed the instructions in two document created by advanced installer online:

How to Install SQL Server Express and here is a sample *.aip file to show what the settings need to install SQL server Express silently.

My scenarios:

Get error during simple installing:

However, I get this error:

I already test manually SQL Server Express setup.exe on the target system. So the file and target system doesn't have any problems.

I'm trying to setup.exe using ConfigurationFile.ini as following in command line:

This is my ConfigurationFile.ini code:

```<code>    ;SQLSERVER2008 Configuration File
[OPTIONS]

; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.

INSTANCEID="BNSDEV"

; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.

ACTION="Install"

; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.

FEATURES=SQLENGINE,REPLICATION

; Displays the command line parameters usage

HELP="False"

; Specifies that the detailed Setup log should be piped to the console.

INDICATEPROGRESS="False"

; Setup will not display any user interface.

QUIET="False"

; Setup will display progress only without any user interaction.

QUIETSIMPLE="False"

; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.

X86="False"

; Detailed help for command line argument ROLE has not been defined yet.

ROLE="AllFeatures_WithDefaults"

; Detailed help for command line argument ENU has not been defined yet.

ENU="True"

; Parameter that controls the user interface behavior. Valid values are Normal for the full UI, and AutoAdvance for a simplied UI.

UIMODE="Normal"

; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.

ERRORREPORTING="True"

; Specify the root installation directory for native shared components.

INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"

; Specify the installation directory.

INSTANCEDIR="C:\Program Files\Microsoft SQL Server"

; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.

SQMREPORTING="False"

; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).

INSTANCENAME="BNSDEV"

; Agent account name

AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Auto-start service after installation.

AGTSVCSTARTUPTYPE="Disabled"

; Startup type for Integration Services.

ISSVCSTARTUPTYPE="Automatic"

; Account for Integration Services: Domain\User or system account.

ISSVCACCOUNT="NT AUTHORITY\NetworkService"

; Controls the service startup type setting after the service has been created.

ASSVCSTARTUPTYPE="Automatic"

; The collation to be used by Analysis Services.

ASCOLLATION="Latin1_General_CI_AS"

; The location for the Analysis Services data files.

ASDATADIR="Data"

; The location for the Analysis Services log files.

ASLOGDIR="Log"

; The location for the Analysis Services backup files.

ASBACKUPDIR="Backup"

; The location for the Analysis Services temporary files.

ASTEMPDIR="Temp"

; The location for the Analysis Services configuration files.

ASCONFIGDIR="Config"

; Specifies whether or not the MSOLAP provider is allowed to run in process.

ASPROVIDERMSOLAP="1"

; A port number used to connect to the SharePoint Central Administration web application.

FARMADMINPORT="0"

; Startup type for the SQL Server service.

SQLSVCSTARTUPTYPE="Automatic"

; Level to enable FILESTREAM feature at (0, 1, 2 or 3).

FILESTREAMLEVEL="0"

; Set to "1" to enable RANU for SQL Server Express.

ENABLERANU="True"

; Specifies a Windows collation or an SQL collation to use for the Database Engine.

SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"

; Account for SQL Server service: Domain\User or system account.

SQLSVCACCOUNT="NT AUTHORITY\SYSTEM"

; Windows account(s) to provision as SQL Server system administrators.

SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS"

; Provision current user as a Database Engine system administrator for SQL Server 2008 R2 Express.

ADDCURRENTUSERASSQLADMIN="True"

; Specify 0 to disable or 1 to enable the TCP/IP protocol.

TCPENABLED="1"

; Specify 0 to disable or 1 to enable the Named Pipes protocol.

NPENABLED="0"

; Startup type for Browser Service.

BROWSERSVCSTARTUPTYPE="Disabled"

; Specifies which account the report server NT service should execute under.  When omitted or when the value is empty string, the default built-in account for the current operating system.
; The username part of RSSVCACCOUNT is a maximum of 20 characters long and
; The domain part of RSSVCACCOUNT is a maximum of 254 characters long.

RSSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Specifies how the startup mode of the report server NT service.  When
; Manual - Service startup is manual mode (default).
; Automatic - Service startup is automatic mode.
; Disabled - Service is disabled

RSSVCSTARTUPTYPE="Automatic"

; Specifies which mode report server is installed in.
; Default value: “FilesOnly”

RSINSTALLMODE="FilesOnlyMode"
</code>```

I think there must be a problem with PCUSOURCE. because as fig1 I getting an error as The system can not find the file specified and system looking the sqlSupport.msi.
can anyone help me to solve this problem?

Edited

Here is the last summery.txt for installation:

```<code>Overall summary:
  Final result:                  User cancelled
  Exit code (Decimal):           -2068380094
  Exit facility code:            1207
  Exit error code:               1602
  Exit message:                  User has cancelled.
  Start time:                    2017-10-30 13:27:09
  End time:                      2017-10-30 13:43:48
  Requested action:              Install

Machine Properties:
  Machine name:                  WINDOWS7-PC
  Machine processor count:       2
  OS version:                    Windows 7
  OS service pack:               Service Pack 1
  OS region:                     United States
  OS language:                   English (United States)
  OS architecture:               x86
  Process architecture:          32 Bit
  OS clustered:                  No

Product features discovered:
  Product              Instance             Instance ID                    Feature                                  Language             Edition              Version         Clustered

Package properties:
  Description:                   SQL Server Database Services 2008 R2
  ProductName:                   SQL Server 2008 R2
  Type:                          RTM
  Version:                       10
  Installation location:         c:\3366571280411213122d3a8c\x86\setup\
  Installation edition:          EXPRESS

  Slipstream:                    True
  SP Level                       2

User Input Settings:
  ACTION:                        Install
  ADDCURRENTUSERASSQLADMIN:      True
  AGTSVCACCOUNT:                 NT AUTHORITY\NETWORK SERVICE
  AGTSVCPASSWORD:                *****
  AGTSVCSTARTUPTYPE:             Disabled
  ASBACKUPDIR:                   Backup
  ASCOLLATION:                   Latin1_General_CI_AS
  ASCONFIGDIR:                   Config
  ASDATADIR:                     Data
  ASDOMAINGROUP:                 <empty>
  ASLOGDIR:                      Log
  ASPROVIDERMSOLAP:              1
  ASSVCACCOUNT:                  <empty>
  ASSVCPASSWORD:                 *****
  ASSVCSTARTUPTYPE:              Automatic
  ASSYSADMINACCOUNTS:            <empty>
  ASTEMPDIR:                     Temp
  BROWSERSVCSTARTUPTYPE:         Disabled
  CONFIGURATIONFILE:             C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20171030_132528\ConfigurationFile.ini
  CUSOURCE:
  ENABLERANU:                    True
  ENU:                           True
  ERRORREPORTING:                False
  FARMACCOUNT:                   <empty>
  FARMADMINPORT:                 0
  FARMPASSWORD:                  *****
  FEATURES:                      SQLENGINE,REPLICATION
  FILESTREAMLEVEL:               0
  FILESTREAMSHARENAME:           <empty>
  FTSVCACCOUNT:                  <empty>
  FTSVCPASSWORD:                 *****
  HELP:                          False
  INDICATEPROGRESS:              False
  INSTALLSHAREDDIR:              C:\Program Files\Microsoft SQL Server\
  INSTALLSHAREDWOWDIR:           C:\Program Files\Microsoft SQL Server\
  INSTALLSQLDATADIR:             <empty>
  INSTANCEDIR:                   C:\Program Files\Microsoft SQL Server\
  INSTANCEID:                    BNSDEV
  INSTANCENAME:                  BNSDEV
  ISSVCACCOUNT:                  NT AUTHORITY\NetworkService
  ISSVCPASSWORD:                 *****
  ISSVCSTARTUPTYPE:              Automatic
  NPENABLED:                     0
  PASSPHRASE:                    *****
  PCUSOURCE:                     c:\3366571280411213122d3a8c\PCUSOURCE
  PID:                           *****
  QUIET:                         False
  QUIETSIMPLE:                   False
  ROLE:                          AllFeatures_WithDefaults
  RSINSTALLMODE:                 FilesOnlyMode
  RSSVCACCOUNT:                  NT AUTHORITY\NETWORK SERVICE
  RSSVCPASSWORD:                 *****
  RSSVCSTARTUPTYPE:              Automatic
  SAPWD:                         *****
  SECURITYMODE:                  <empty>
  SQLBACKUPDIR:                  <empty>
  SQLCOLLATION:                  SQL_Latin1_General_CP1_CI_AS
  SQLSVCACCOUNT:                 NT AUTHORITY\SYSTEM
  SQLSVCPASSWORD:                *****
  SQLSVCSTARTUPTYPE:             Automatic
  SQLSYSADMINACCOUNTS:           windows7-PC\windows7
  SQLTEMPDBDIR:                  <empty>
  SQLTEMPDBLOGDIR:               <empty>
  SQLUSERDBDIR:                  <empty>
  SQLUSERDBLOGDIR:               <empty>
  SQMREPORTING:                  False
  TCPENABLED:                    0
  UIMODE:                        Normal
  X86:                           False

  Configuration file:            C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20171030_132528\ConfigurationFile.ini

Detailed results:
  Feature:                       Database Engine Services
  Status:                        Failed: see logs for details
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Server Replication
  Status:                        Failed: see logs for details
  MSI status:                    Passed
  Configuration status:          Passed

Rules with failures:

Global rules:

Scenario specific rules:

Rules report file:               C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20171030_132528\SystemConfigurationCheck_Report.htm

Exception summary:
The following is an exception stack listing the exceptions in outermost to innermost order
Inner exceptions are being indented

Exception type: Microsoft.SqlServer.Chainer.Infrastructure.CancelException
    Message:
        User has cancelled.
    Stack:
        at Microsoft.SqlServer.Configuration.UIExtension.Request.Wait()
        at Microsoft.SqlServer.Configuration.UIExtension.UserInterfaceProxy.SubmitAndWait(Request request)
        at Microsoft.SqlServer.Configuration.UIExtension.UserInterfaceProxy.NavigateToWaypoint(String moniker)
        at Microsoft.SqlServer.Configuration.UIExtension.UserInterfaceService.Waypoint(String moniker)
        at Microsoft.SqlServer.Configuration.UIExtension.WaypointAction.ExecuteAction(String actionId)
        at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
        at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter statusStream, ISequencedAction actionToRun)
</code>```

Edited After @herman asnswer

as @herman answer, I deleted sqlserverExpr.exe from file and folder then deleted action command from Action too. after that, I add sqlserverExpr.exe from prerequisites, then on setup File Tabs configured values as @herman said. But I get Error like this:

this is my configuration on setup file:

答:
Here are the EXE setups you added in << files and folders >>.

To add your config file just add the prereq as a file from disk and add the config file as additional file to the prereq.

Hope this helped.

Body:
I want to install SQL Server Express (preferably 2008 or 2014) silently using Advanced Installer. I followed the instructions in two document created by advanced installer online:

How to Install SQL Server Express and here is a sample *.aip file to show what the settings need to install SQL server Express silently.

My scenarios:

Get error during simple installing:

However, I get this error:

I already test manually SQL Server Express setup.exe on the target system. So the file and target system doesn't have any problems.

I'm trying to setup.exe using ConfigurationFile.ini as following in command line:

This is my ConfigurationFile.ini code:

    ;SQLSERVER2008 Configuration File
[OPTIONS]

; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.

INSTANCEID="BNSDEV"

; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.

ACTION="Install"

; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.

FEATURES=SQLENGINE,REPLICATION

; Displays the command line parameters usage

HELP="False"

; Specifies that the detailed Setup log should be piped to the console.

INDICATEPROGRESS="False"

; Setup will not display any user interface.

QUIET="False"

; Setup will display progress only without any user interaction.

QUIETSIMPLE="False"

; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.

X86="False"

; Detailed help for command line argument ROLE has not been defined yet.

ROLE="AllFeatures_WithDefaults"

; Detailed help for command line argument ENU has not been defined yet.

ENU="True"

; Parameter that controls the user interface behavior. Valid values are Normal for the full UI, and AutoAdvance for a simplied UI.

UIMODE="Normal"

; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.

ERRORREPORTING="True"

; Specify the root installation directory for native shared components.

INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"

; Specify the installation directory.

INSTANCEDIR="C:\Program Files\Microsoft SQL Server"

; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.

SQMREPORTING="False"

; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).

INSTANCENAME="BNSDEV"

; Agent account name

AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Auto-start service after installation.

AGTSVCSTARTUPTYPE="Disabled"

; Startup type for Integration Services.

ISSVCSTARTUPTYPE="Automatic"

; Account for Integration Services: Domain\User or system account.

ISSVCACCOUNT="NT AUTHORITY\NetworkService"

; Controls the service startup type setting after the service has been created.

ASSVCSTARTUPTYPE="Automatic"

; The collation to be used by Analysis Services.

ASCOLLATION="Latin1_General_CI_AS"

; The location for the Analysis Services data files.

ASDATADIR="Data"

; The location for the Analysis Services log files.

ASLOGDIR="Log"

; The location for the Analysis Services backup files.

ASBACKUPDIR="Backup"

; The location for the Analysis Services temporary files.

ASTEMPDIR="Temp"

; The location for the Analysis Services configuration files.

ASCONFIGDIR="Config"

; Specifies whether or not the MSOLAP provider is allowed to run in process.

ASPROVIDERMSOLAP="1"

; A port number used to connect to the SharePoint Central Administration web application.

FARMADMINPORT="0"

; Startup type for the SQL Server service.

SQLSVCSTARTUPTYPE="Automatic"

; Level to enable FILESTREAM feature at (0, 1, 2 or 3).

FILESTREAMLEVEL="0"

; Set to "1" to enable RANU for SQL Server Express.

ENABLERANU="True"

; Specifies a Windows collation or an SQL collation to use for the Database Engine.

SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"

; Account for SQL Server service: Domain\User or system account.

SQLSVCACCOUNT="NT AUTHORITY\SYSTEM"

; Windows account(s) to provision as SQL Server system administrators.

SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS"

; Provision current user as a Database Engine system administrator for SQL Server 2008 R2 Express.

ADDCURRENTUSERASSQLADMIN="True"

; Specify 0 to disable or 1 to enable the TCP/IP protocol.

TCPENABLED="1"

; Specify 0 to disable or 1 to enable the Named Pipes protocol.

NPENABLED="0"

; Startup type for Browser Service.

BROWSERSVCSTARTUPTYPE="Disabled"

; Specifies which account the report server NT service should execute under.  When omitted or when the value is empty string, the default built-in account for the current operating system.
; The username part of RSSVCACCOUNT is a maximum of 20 characters long and
; The domain part of RSSVCACCOUNT is a maximum of 254 characters long.

RSSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"

; Specifies how the startup mode of the report server NT service.  When
; Manual - Service startup is manual mode (default).
; Automatic - Service startup is automatic mode.
; Disabled - Service is disabled

RSSVCSTARTUPTYPE="Automatic"

; Specifies which mode report server is installed in.
; Default value: “FilesOnly”

RSINSTALLMODE="FilesOnlyMode"

I think there must be a problem with PCUSOURCE. because as fig1 I getting an error as The system can not find the file specified and system looking the sqlSupport.msi.
can anyone help me to solve this problem?

Edited

Here is the last summery.txt for installation:

Overall summary:
  Final result:                  User cancelled
  Exit code (Decimal):           -2068380094
  Exit facility code:            1207
  Exit error code:               1602
  Exit message:                  User has cancelled.
  Start time:                    2017-10-30 13:27:09
  End time:                      2017-10-30 13:43:48
  Requested action:              Install

Machine Properties:
  Machine name:                  WINDOWS7-PC
  Machine processor count:       2
  OS version:                    Windows 7
  OS service pack:               Service Pack 1
  OS region:                     United States
  OS language:                   English (United States)
  OS architecture:               x86
  Process architecture:          32 Bit
  OS clustered:                  No

Product features discovered:
  Product              Instance             Instance ID                    Feature                                  Language             Edition              Version         Clustered

Package properties:
  Description:                   SQL Server Database Services 2008 R2
  ProductName:                   SQL Server 2008 R2
  Type:                          RTM
  Version:                       10
  Installation location:         c:\3366571280411213122d3a8c\x86\setup\
  Installation edition:          EXPRESS

  Slipstream:                    True
  SP Level                       2

User Input Settings:
  ACTION:                        Install
  ADDCURRENTUSERASSQLADMIN:      True
  AGTSVCACCOUNT:                 NT AUTHORITY\NETWORK SERVICE
  AGTSVCPASSWORD:                *****
  AGTSVCSTARTUPTYPE:             Disabled
  ASBACKUPDIR:                   Backup
  ASCOLLATION:                   Latin1_General_CI_AS
  ASCONFIGDIR:                   Config
  ASDATADIR:                     Data
  ASDOMAINGROUP:                 <empty>
  ASLOGDIR:                      Log
  ASPROVIDERMSOLAP:              1
  ASSVCACCOUNT:                  <empty>
  ASSVCPASSWORD:                 *****
  ASSVCSTARTUPTYPE:              Automatic
  ASSYSADMINACCOUNTS:            <empty>
  ASTEMPDIR:                     Temp
  BROWSERSVCSTARTUPTYPE:         Disabled
  CONFIGURATIONFILE:             C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20171030_132528\ConfigurationFile.ini
  CUSOURCE:
  ENABLERANU:                    True
  ENU:                           True
  ERRORREPORTING:                False
  FARMACCOUNT:                   <empty>
  FARMADMINPORT:                 0
  FARMPASSWORD:                  *****
  FEATURES:                      SQLENGINE,REPLICATION
  FILESTREAMLEVEL:               0
  FILESTREAMSHARENAME:           <empty>
  FTSVCACCOUNT:                  <empty>
  FTSVCPASSWORD:                 *****
  HELP:                          False
  INDICATEPROGRESS:              False
  INSTALLSHAREDDIR:              C:\Program Files\Microsoft SQL Server\
  INSTALLSHAREDWOWDIR:           C:\Program Files\Microsoft SQL Server\
  INSTALLSQLDATADIR:             <empty>
  INSTANCEDIR:                   C:\Program Files\Microsoft SQL Server\
  INSTANCEID:                    BNSDEV
  INSTANCENAME:                  BNSDEV
  ISSVCACCOUNT:                  NT AUTHORITY\NetworkService
  ISSVCPASSWORD:                 *****
  ISSVCSTARTUPTYPE:              Automatic
  NPENABLED:                     0
  PASSPHRASE:                    *****
  PCUSOURCE:                     c:\3366571280411213122d3a8c\PCUSOURCE
  PID:                           *****
  QUIET:                         False
  QUIETSIMPLE:                   False
  ROLE:                          AllFeatures_WithDefaults
  RSINSTALLMODE:                 FilesOnlyMode
  RSSVCACCOUNT:                  NT AUTHORITY\NETWORK SERVICE
  RSSVCPASSWORD:                 *****
  RSSVCSTARTUPTYPE:              Automatic
  SAPWD:                         *****
  SECURITYMODE:                  <empty>
  SQLBACKUPDIR:                  <empty>
  SQLCOLLATION:                  SQL_Latin1_General_CP1_CI_AS
  SQLSVCACCOUNT:                 NT AUTHORITY\SYSTEM
  SQLSVCPASSWORD:                *****
  SQLSVCSTARTUPTYPE:             Automatic
  SQLSYSADMINACCOUNTS:           windows7-PC\windows7
  SQLTEMPDBDIR:                  <empty>
  SQLTEMPDBLOGDIR:               <empty>
  SQLUSERDBDIR:                  <empty>
  SQLUSERDBLOGDIR:               <empty>
  SQMREPORTING:                  False
  TCPENABLED:                    0
  UIMODE:                        Normal
  X86:                           False

  Configuration file:            C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20171030_132528\ConfigurationFile.ini

Detailed results:
  Feature:                       Database Engine Services
  Status:                        Failed: see logs for details
  MSI status:                    Passed
  Configuration status:          Passed

  Feature:                       SQL Server Replication
  Status:                        Failed: see logs for details
  MSI status:                    Passed
  Configuration status:          Passed

Rules with failures:

Global rules:

Scenario specific rules:

Rules report file:               C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20171030_132528\SystemConfigurationCheck_Report.htm

Exception summary:
The following is an exception stack listing the exceptions in outermost to innermost order
Inner exceptions are being indented

Exception type: Microsoft.SqlServer.Chainer.Infrastructure.CancelException
    Message:
        User has cancelled.
    Stack:
        at Microsoft.SqlServer.Configuration.UIExtension.Request.Wait()
        at Microsoft.SqlServer.Configuration.UIExtension.UserInterfaceProxy.SubmitAndWait(Request request)
        at Microsoft.SqlServer.Configuration.UIExtension.UserInterfaceProxy.NavigateToWaypoint(String moniker)
        at Microsoft.SqlServer.Configuration.UIExtension.UserInterfaceService.Waypoint(String moniker)
        at Microsoft.SqlServer.Configuration.UIExtension.WaypointAction.ExecuteAction(String actionId)
        at Microsoft.SqlServer.Chainer.Infrastructure.Action.Execute(String actionId, TextWriter errorStream)
        at Microsoft.SqlServer.Setup.Chainer.Workflow.ActionInvocation.ExecuteActionHelper(TextWriter statusStream, ISequencedAction actionToRun)

Edited After @herman asnswer

as @herman answer, I deleted sqlserverExpr.exe from file and folder then deleted action command from Action too. after that, I add sqlserverExpr.exe from prerequisites, then on setup File Tabs configured values as @herman said. But I get Error like this:

this is my configuration on setup file:


来源: stackexchange

问:
jquery dropdown div not quite working
i'm trying to make a div drop down when someone hovers over a link. Inside the div is a login form. The following code works only in that if i hover over the link the div does appear. However when i move the mouse from the link down over the div, the div immediately retracts. Please see:

```jQuery(document).ready(function() {
    jQuery('.slidedown').hide();
    jQuery('a.top-link-cart').hover( function(){ // enter animation

    jQuery('.slidedown').stop(true,true).animate({
        height: ['toggle', 'swing'],
        }, 600, function() { /* animation done */ });

    }, function(){ // leave animation

jQuery('.slidedown').mouseout( function() {
   setTimeout( function(){
      jQuery('.slidedown').stop(true,true).animate( {
          height: '0px'}, 600, function(){});}, 200 ); // setTimeout ends here
}); // mouseout ends here
    });
});```

All i'm trying to achieve is have the div a) stay open if the user mouses from the link to the div b)close if the user moves mouse away from link but not into div and c) close if user moves mouse out of div. I thought the .mouseout function would keep the div open so that i can at least move my mouse over it but it isn't working. Any ideas? I'd be very grateful this has been a headache to me for a week now. Thanks.

答:
You could wrap your link and the div that does the animation in another div and then apply the hover to the parent div instead of the link. This way you will still validate. For example:

```<code><div class="whatever">
    <a class="top-link-cart">Show login form</a>
    <div class="slidedown">form html goes here</div>
</div>
</code>```

and the javascript would be:

```<code>jQuery(document).ready(function(){
    jQuery('.slidedown').hide();
    jQuery('.whatever').hover(function(){//to show
        jQuery('.slidedown').show('effect', duration in millisecs);
    }, function(){//to hide
        jQuery('.slidedown').hide('effect', duration in millisecs);
    });
});
</code>```

this uses the jQueryUI for the animation effects, but you could use the .slideDown() and .slideUp() methods as well if all you need is the div to slide up or down

ContentLicense: CC BY-SA 2.5

Title: jquery dropdown div not quite working

Body:
i'm trying to make a div drop down when someone hovers over a link. Inside the div is a login form. The following code works only in that if i hover over the link the div does appear. However when i move the mouse from the link down over the div, the div immediately retracts. Please see:

jQuery(document).ready(function() {
    jQuery('.slidedown').hide();
    jQuery('a.top-link-cart').hover( function(){ // enter animation

    jQuery('.slidedown').stop(true,true).animate({
        height: ['toggle', 'swing'],
        }, 600, function() { /* animation done */ });

    }, function(){ // leave animation

jQuery('.slidedown').mouseout( function() {
   setTimeout( function(){
      jQuery('.slidedown').stop(true,true).animate( {
          height: '0px'}, 600, function(){});}, 200 ); // setTimeout ends here
}); // mouseout ends here
    });
});

All i'm trying to achieve is have the div a) stay open if the user mouses from the link to the div b)close if the user moves mouse away from link but not into div and c) close if user moves mouse out of div. I thought the .mouseout function would keep the div open so that i can at least move my mouse over it but it isn't working. Any ideas? I'd be very grateful this has been a headache to me for a week now. Thanks.

Body:
You could wrap your link and the div that does the animation in another div and then apply the hover to the parent div instead of the link. This way you will still validate. For example:

<div class="whatever">
    <a class="top-link-cart">Show login form</a>
    <div class="slidedown">form html goes here</div>
</div>

and the javascript would be:

jQuery(document).ready(function(){
    jQuery('.slidedown').hide();
    jQuery('.whatever').hover(function(){//to show
        jQuery('.slidedown').show('effect', duration in millisecs);
    }, function(){//to hide
        jQuery('.slidedown').hide('effect', duration in millisecs);
    });
});

this uses the jQueryUI for the animation effects, but you could use the .slideDown() and .slideUp() methods as well if all you need is the div to slide up or down


问:
Excel formulas Timestamp
Guys I'm having a problem.
In the current sheet.
In F1 i'm using the follow formula for date the current date.

```<code>=TEXT(NOW(), "dd-mm-yyyy")
</code>```

Sheet will auto refresh every 1 min.

Dates in each cell (A4:A53)13-11-2017,14-11-2017 date going down.
Using and if statement to see if current date is true then insert (B1) if false then write nothing. Current formula i am using.

=IF(F1=A4:A53,"B1,"")

It is always saying dates are not true, always false. Even if they are true.
Any advise please

答:
I suspect that the dates in the column are actual date values while the one you are creating from the formula is a text value. As such, they will never be equal.

To have them equal, you should change your formula become =INT(NOW()) (to remove the time from the date and time value) or use =TODAY() (which only gives the date and not the time).

Either that, or change your comparison formula to:

```<code>=IF(F1*1=A4*1,"true","false")
</code>```

In most cases, excel will be able to convert a 'text-ified' date when an arithmetic operation is applied on it. If you get errors, then it means excel was not able to convert the date and you should use a format that your excel understands.

ContentLicense: CC BY-SA 3.0

Title: Excel formulas Timestamp

Body:
Guys I'm having a problem.
In the current sheet.
In F1 i'm using the follow formula for date the current date.

=TEXT(NOW(), "dd-mm-yyyy")

Sheet will auto refresh every 1 min.

Dates in each cell (A4:A53)13-11-2017,14-11-2017 date going down.
Using and if statement to see if current date is true then insert (B1) if false then write nothing. Current formula i am using.

=IF(F1=A4:A53,"B1,"")

It is always saying dates are not true, always false. Even if they are true.
Any advise please

Body:
I suspect that the dates in the column are actual date values while the one you are creating from the formula is a text value. As such, they will never be equal.

To have them equal, you should change your formula become =INT(NOW()) (to remove the time from the date and time value) or use =TODAY() (which only gives the date and not the time).

Either that, or change your comparison formula to:

=IF(F1*1=A4*1,"true","false")

In most cases, excel will be able to convert a 'text-ified' date when an arithmetic operation is applied on it. If you get errors, then it means excel was not able to convert the date and you should use a format that your excel understands.


问:
React:Do I make one line html as component or not?
Suppose I have one p tag which is used(with different class) so many times in web pages. So should I make it component or not?

If I make it component, then in future if I have to wrapped it inside suppose div tag then I only have to make changes as one place, otherwise I have to change it at every place.

Suppose I have 50 p tag in my parent component and if I make p tag component and use at wherever needed, then for all 50 time it will call that component(p tag component) which can be avoid if directly use p tag(which is I guess good for performance compare to former one).

答: I guess you should create the component, so you can change it without going through the whole project. You can also wrap the logic for that piece of code, furthermore, you can test it.</p>


问:
Can't extract data from Json
I can't extract data from json that I got from an api.
I tried for hours, tried all kinds of formats. Read Stackoverflow threads like How do I extract data from JSON with PHP?, but I can't see what I am doing wrong.

This is the code so far:

```<code>$api_results = '{"status":"0000","data":{"opening_price":"6998000","closing_price":"7270000","min_price":"6750000","max_price":"7997000","average_price":"7188302.5804","units_traded":"78484.9241002","volume_1day":"78484.9241002","volume_7day":"335611.84181738","buy_price":"7268000","sell_price":"7274000","date":"1510563513031"}}';

$results = json_decode($api_results, true);

// Some variations I tried:
var_dump($results->status[1]);
var_dump($results->data[1]->opening_price);
var_dump($results["data"][1]["opening_price"]);
</code>```

End result: NULL NULL NULL

What am I doing wrong?

Thanks for the answers! I will upvote the working ones. Seems I got confused in the formating!

答:
Remove true from json_decode so you will have object result like Demo

```<code>$results = json_decode($api_results);
var_dump($results->status);
var_dump($results->data->opening_price);
</code>```

When you use json_decode with true the returned objects will be converted into associative arrays.

Title: Can't extract data from Json

Body:
I can't extract data from json that I got from an api.
I tried for hours, tried all kinds of formats. Read Stackoverflow threads like How do I extract data from JSON with PHP?, but I can't see what I am doing wrong.

This is the code so far:

$api_results = '{"status":"0000","data":{"opening_price":"6998000","closing_price":"7270000","min_price":"6750000","max_price":"7997000","average_price":"7188302.5804","units_traded":"78484.9241002","volume_1day":"78484.9241002","volume_7day":"335611.84181738","buy_price":"7268000","sell_price":"7274000","date":"1510563513031"}}';

$results = json_decode($api_results, true);

// Some variations I tried:
var_dump($results->status[1]);
var_dump($results->data[1]->opening_price);
var_dump($results["data"][1]["opening_price"]);

End result: NULL NULL NULL

What am I doing wrong?

Thanks for the answers! I will upvote the working ones. Seems I got confused in the formating!

Body:
Remove true from json_decode so you will have object result like Demo

$results = json_decode($api_results);
var_dump($results->status);
var_dump($results->data->opening_price);

When you use json_decode with true the returned objects will be converted into associative arrays.


问:
How to call the same API for N number of times using Retrofit and RXJava.I am using the following approach as of now
Ok. So the API documentation says :

Get up to 100 restaurants by changing the 'start' and 'count' parameters with the maximum value of count being
20.
API LINK : https://developers.zomato.com/documentation#!/restaurant/search

This is the sample code :

```<code>restaurantList = new ArrayList<>();
    restaurantFinderAPI = RetrofitClient.getRetrofitClientAPI();
    restaurantScheduler = Schedulers.newThread();

    for (int i = 0; i <= 80; i += 20) {
        restaurantModelObservable = restaurantFinderAPI.getRestaraunts(city, entitytype, searchString, i, 20);

        restaurantModelObservable.subscribeOn(restaurantScheduler);
        restaurantModelObservable.observeOn(AndroidSchedulers.mainThread());
        restaurantModelObservable.subscribe(new Observer<RestaurantModel>() {
            @Override
            public void onSubscribe(Disposable d) {
                COUNT++;
                restaurantDisposable = d;
            }

            @Override
            public void onNext(RestaurantModel value) {
                restaurantList.addAll(value.getRestaurants());
            }

            @Override
            public void onError(Throwable e) {
                restaurantDisposable.dispose();
                onRestaurantSync.onRestaurantSyncFail();
            }

            @Override
            public void onComplete() {
                if (COUNT == 5) {
                    new ModifyTask().execute(restaurantList);
                    COUNT = 0;
                }
            }
        });
</code>```

This is the Retrofit interface :

```<code>    String ZOMATO_ROOT_URL = "https://developers.zomato.com/api/v2.1/";

@GET("search")
@Headers({"Accept: application/json","user-key: 258f3e496748d15cb792bc554000d6b6"})
Observable<RestaurantModel> getRestaraunts(@Query("entity_id") int entityID,
                                           @Query("entity_type") String entity_type,
                                           @Query("q")String searchFor,
                                           @Query("start") int start,
                                           @Query("count") int count);
</code>```

I making the call 5 times which is counted by the COUNT field, so it would give 100 results , by changing 'i'. Once I get 100 results, I start an asynctask for some processing on the dat. Is this a good way to call the same API multiple times. I am new to RXJava and I could not find a nice answer. Please help. Thanks

答: I did this with the help of concat operator of RX. I simply made an observable from an array of offsets like {20,40,60,80} and made the call for each emission to the rest Api, and for each result, i added it to an arraylist. </p>

Body:
Ok. So the API documentation says :

Get up to 100 restaurants by changing the 'start' and 'count' parameters with the maximum value of count being
20.
API LINK : https://developers.zomato.com/documentation#!/restaurant/search

This is the sample code :

restaurantList = new ArrayList<>();
    restaurantFinderAPI = RetrofitClient.getRetrofitClientAPI();
    restaurantScheduler = Schedulers.newThread();

    for (int i = 0; i <= 80; i += 20) {
        restaurantModelObservable = restaurantFinderAPI.getRestaraunts(city, entitytype, searchString, i, 20);

        restaurantModelObservable.subscribeOn(restaurantScheduler);
        restaurantModelObservable.observeOn(AndroidSchedulers.mainThread());
        restaurantModelObservable.subscribe(new Observer<RestaurantModel>() {
            @Override
            public void onSubscribe(Disposable d) {
                COUNT++;
                restaurantDisposable = d;
            }

            @Override
            public void onNext(RestaurantModel value) {
                restaurantList.addAll(value.getRestaurants());
            }

            @Override
            public void onError(Throwable e) {
                restaurantDisposable.dispose();
                onRestaurantSync.onRestaurantSyncFail();
            }

            @Override
            public void onComplete() {
                if (COUNT == 5) {
                    new ModifyTask().execute(restaurantList);
                    COUNT = 0;
                }
            }
        });

This is the Retrofit interface :

    String ZOMATO_ROOT_URL = "https://developers.zomato.com/api/v2.1/";

@GET("search")
@Headers({"Accept: application/json","user-key: 258f3e496748d15cb792bc554000d6b6"})
Observable<RestaurantModel> getRestaraunts(@Query("entity_id") int entityID,
                                           @Query("entity_type") String entity_type,
                                           @Query("q")String searchFor,
                                           @Query("start") int start,
                                           @Query("count") int count);

I making the call 5 times which is counted by the COUNT field, so it would give 100 results , by changing 'i'. Once I get 100 results, I start an asynctask for some processing on the dat. Is this a good way to call the same API multiple times. I am new to RXJava and I could not find a nice answer. Please help. Thanks


问:
Redirect https to http without SSL - IIS 7
I recently moved my website from Wix.com to one that I created on GoDaddy (Windows server).  Wix.com version used https, and the latter doesn't.  Searching for the website on Google still lists the "https://*" version (which doesn't exist anymore) instead of listing the "http://" version.

Question 1:
How should I redirect visitors from https to http version without having to set up SSL on the new website? Adding this to web.config didn't help:

```<code><rewrite>
    <rules>
        <rule name="Redirect to HTTP" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTPS}" pattern="^ON$" />
            </conditions>
            <action type="Redirect" url="http://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
        </rule>
     </rules>
 </rewrite>
</code>```

Question 2:
What should I do to make sure Google search shows the http version and not the https version?

Thanks!

答:
1) It is not possible without SSL certificate. You can generate valid free certificate here: https://www.sslforfree.com/, add https into your IIS bindings and then your rule will work

2) In Google webmaster tools they have the option to change the address: https://support.google.com/webmasters/answer/83106?hl=en

Body:
I recently moved my website from Wix.com to one that I created on GoDaddy (Windows server).  Wix.com version used https, and the latter doesn't.  Searching for the website on Google still lists the "https://*" version (which doesn't exist anymore) instead of listing the "http://" version.

Question 1:
How should I redirect visitors from https to http version without having to set up SSL on the new website? Adding this to web.config didn't help:

<rewrite>
    <rules>
        <rule name="Redirect to HTTP" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTPS}" pattern="^ON$" />
            </conditions>
            <action type="Redirect" url="http://{HTTP_HOST}/{R:1}" redirectType="Permanent" />
        </rule>
     </rules>
 </rewrite>

Question 2:
What should I do to make sure Google search shows the http version and not the https version?

Thanks!


答:
Remove true from json_decode and try something like this:

```<code>var_dump($results->status);
var_dump($results->data->opening_price);
</code>```

If you see {} it is refering to objects and [] indicates that it is an array. You're trying to show everything as if they were arrays

Title: Can't extract data from Json

Body:
Remove true from json_decode and try something like this:

var_dump($results->status);
var_dump($results->data->opening_price);

If you see {} it is refering to objects and [] indicates that it is an array. You're trying to show everything as if they were arrays


问:
Placing the mdTooltip above and left
Could anyone help me out about mdTooltipPosition?

Is it possible to put the mdTooltip above and also left?

want to place it right above the placeholder....

here is the source.

```<code>      <div>
    <md-input-container class="full-width">
      <input mdInput required placeholder="商品コード" [(ngModel)]="itemCd" mdTooltip="Tooltip!" mdTooltipPosition="above" />
    </md-input-container>
  </div>
</code>```

Thank you so much.....

答:
Override the properties of .mat-tooltip css class in your style file and adjust the top and left position accordingly.

CSS:

```<code>::ng-deep .mat-tooltip {
    position: relative;
    left: -30px;
    top:8px;
}
</code>```

Html would be same -

```<code>  <div>
    <md-input-container class="full-width">
      <input mdInput required placeholder="商品コード" [(ngModel)]="itemCd" mdTooltip="Tooltip!" mdTooltipPosition="above" />
    </md-input-container>
  </div>
</code>```

For demo: https://plnkr.co/edit/ZTRkej6nlxHayEboIVsi?p=preview

Title: Placing the mdTooltip above and left

Body:
Could anyone help me out about mdTooltipPosition?

Is it possible to put the mdTooltip above and also left?

want to place it right above the placeholder....

here is the source.

    <md-input-container class="full-width">
      <input mdInput required placeholder="商品コード" [(ngModel)]="itemCd" mdTooltip="Tooltip!" mdTooltipPosition="above" />
    </md-input-container>

Thank you so much.....

Body:
Override the properties of .mat-tooltip css class in your style file and adjust the top and left position accordingly.

CSS:

::ng-deep .mat-tooltip {
    position: relative;
    left: -30px;
    top:8px;
}

Html would be same -

  <div>
    <md-input-container class="full-width">
      <input mdInput required placeholder="商品コード" [(ngModel)]="itemCd" mdTooltip="Tooltip!" mdTooltipPosition="above" />
    </md-input-container>
  </div>

For demo: https://plnkr.co/edit/ZTRkej6nlxHayEboIVsi?p=preview


问:
What is the best practice to store a "saved search" in a database
I am working an a search page that allows users to search for houses for sale. Typical search criteria include price/zip code/# bedrooms/etc.

I would like to allow the user to save this criteria in a database and email new homes daily.

I could either:

1) Serialize a "SavedSearch" object into a string and save that to the database, then deserialize as needed.

2) Have a list of columns in a tblSavedSearch corresponding to the search criteria - price/zip/# bedrooms/etc.

I am concerned that if I choose option 1, my saved search criteria will change and leave the searialized objects in the database invalid, but option 2 doesn't feel like an optimal solution either.

How have others solved this problem?

答:
The best way to accomplish this is by storing your search criteria as XML. This will enable you to refer your search criteria easily and provide ability for user to change it if needed.

XML should be the most scalable solution and I will steer away from passing in URL parameters to action. It might be a simple solution but will have the following problems.

If user wants to edit a new search criteria then we have to do a large scale string manipulation.

Storing complex search criteria will be a issue. What if I want to save a complex and or condition. (In XML, since its already hierarchical, I could just store all the information I need).

The Solution could be scalable and will also sanitize your application from Sql injection attacks.

Since XML is a  matured technology, you could use it to even perform validation before passing in it on to the back-end.


问:
How to calculate the total number of passengers
I want to code to calculate the total number of adult, child and baby passengers. I tried with jquery but did not count the total number of all the passengers.

Thanks in advance

https://jsfiddle.net/devefrontend/21036h5c/12/

$("select").on('change', function() {
    var str = "";
    $(".passenger option:selected").each(function() {
        str += $(this).text() + " ";
    });
     $("#count").text(str);
}).change();```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

<div class="form-group">
    <label>Dewasa <span id="count">0</span></label>
    <select name="adult" class="form-control passenger">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
    </select>
    <select name="child" class="form-control passenger">
        <option>0</option>
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
    </select>
    <select name="infant" class="form-control passenger">
        <option>0</option>
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
    </select>
</div></code>```

答: When working with values, make sure to use parseInt(), otherwise Javascript might see it as a string and act accordingly.</p>

Body:
I want to code to calculate the total number of adult, child and baby passengers. I tried with jquery but did not count the total number of all the passengers.

Thanks in advance

https://jsfiddle.net/devefrontend/21036h5c/12/

$("select").on('change', function() {
    var str = "";
    $(".passenger option:selected").each(function() {
        str += $(this).text() + " ";
    });
     $("#count").text(str);
}).change();

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

    Dewasa 0
    <select name="adult" class="form-control passenger">
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
    </select>
    <select name="child" class="form-control passenger">
        <option>0</option>
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
    </select>
    <select name="infant" class="form-control passenger">
        <option>0</option>
        <option>1</option>
        <option>2</option>
        <option>3</option>
        <option>4</option>
        <option>5</option>
        <option>6</option>
    </select>


问:
How to set momentLocalizer (moment.js) for react-big-calendar (fullcalendar.js)?
I'm using react-big-calendar
And need help to implement localization which is required
The example from git

```<code>import BigCalendar from 'react-big-calendar';
import moment from 'moment';

BigCalendar.setLocalizer(
  BigCalendar.momentLocalizer(moment)
);
</code>```

My code

```<code>var moment = require('moment');
var momentLocalizer = require('react-widgets/lib/localizers/moment');
import BigCalendar from 'react-big-calendar';

BigCalendar.setLocalizer(
    BigCalendar.momentLocalizer(moment.locale('en'))
);

let MyCalendar = props => (
    <div>
        <BigCalendar

        />
    </div>
);
</code>```

Whatever I tried it doesn't work

Uncaught TypeError: moment is not a function

答:
I had to import the locale I wanted to get the calendar in the correct locale.

Notice the import 'moment/locale/nb';.

```<code>import React, { Component } from 'react';
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
import 'moment/locale/nb';
import 'react-big-calendar/lib/css/react-big-calendar.css';

BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment));

class Calendar extends Component {
  constructor() {
    super();
    this.state = {
      events: [],
    };
  }

  render() {
    return (
      <div className="Calendar">
        <BigCalendar
          events={this.state.events}
        />
      </div>
    );
  }
}
</code>```

This is for version 0.17.0 of react-big-calendar.

Body:
I'm using react-big-calendar
And need help to implement localization which is required
The example from git

import BigCalendar from 'react-big-calendar';
import moment from 'moment';

BigCalendar.setLocalizer(
  BigCalendar.momentLocalizer(moment)
);

My code

var moment = require('moment');
var momentLocalizer = require('react-widgets/lib/localizers/moment');
import BigCalendar from 'react-big-calendar';

BigCalendar.setLocalizer(
    BigCalendar.momentLocalizer(moment.locale('en'))
);

let MyCalendar = props => (

        <BigCalendar

        />

);

Whatever I tried it doesn't work

Uncaught TypeError: moment is not a function

Body:
I had to import the locale I wanted to get the calendar in the correct locale.

Notice the import 'moment/locale/nb';.

import React, { Component } from 'react';
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
import 'moment/locale/nb';
import 'react-big-calendar/lib/css/react-big-calendar.css';

BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment));

class Calendar extends Component {
  constructor() {
    super();
    this.state = {
      events: [],
    };
  }

  render() {
    return (
      <div className="Calendar">
        <BigCalendar
          events={this.state.events}
        />
      </div>
    );
  }
}

This is for version 0.17.0 of react-big-calendar.


问:
RecyclerView scroll to position when a new item is added
I want my RecyclerView to scroll to the bottom when a new item is added to the list. Below is my code:

```<code>RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);

adapter = new RecyclerViewAdapter(data, recyclerView);
recyclerView.setAdapter(adapter);
</code>```

And when I click a button which is below the RecyclerView, data is added to the list:

```<code>public void addNewCard() {
    data.add("New");
    adapter.notifyItemInserted(data.size() - 1);
    recyclerView.scrollToPosition(data.size() - 1);
}
</code>```

Whenever I add an item, it always gets scrolled up to the topmost position. I tried using smoothScrollToPosition() and tried using scrollToPosition() on LinearLayoutManager too. I even tried using ViewTreeObserver. Tried changing the version of RecyclerView in dependencies too. I searched thoroughly on Stack Overflow and none of the solutions work for me.

Any ideas on what could be the problem? I'm using RecyclerView inside a fragment. Could that be a cause of the problem?

My .xml file for the RecyclerView

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_view_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout
    android:id="@+id/rel_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="6dp" />

    <Button
        android:id="@+id/button_add_new_card"
        style="@style/Widget.AppCompat.Button.Borderless"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/listView"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="8dp"
        android:padding="20dp"
        android:text="+ Add new Item" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</code>```

答:
ישו אוהב אותך's solution worked on other projects. But setting recyclerView.scrollToPosition() didn't work for me. This is what finally did the job:

```<code>public void addNewCard() {
    data.add("New");
    adapter.notifyItemInserted(data.size());

    scrollView.post(new Runnable() {
        @Override
        public void run() {
            scrollView.scrollTo(0,buttonAddNewItem.getTop());
        }
    });
}
</code>```

Body:
I want my RecyclerView to scroll to the bottom when a new item is added to the list. Below is my code:

RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity());
recyclerView.setLayoutManager(layoutManager);

adapter = new RecyclerViewAdapter(data, recyclerView);
recyclerView.setAdapter(adapter);

And when I click a button which is below the RecyclerView, data is added to the list:

public void addNewCard() {
    data.add("New");
    adapter.notifyItemInserted(data.size() - 1);
    recyclerView.scrollToPosition(data.size() - 1);
}

Whenever I add an item, it always gets scrolled up to the topmost position. I tried using smoothScrollToPosition() and tried using scrollToPosition() on LinearLayoutManager too. I even tried using ViewTreeObserver. Tried changing the version of RecyclerView in dependencies too. I searched thoroughly on Stack Overflow and none of the solutions work for me.

Any ideas on what could be the problem? I'm using RecyclerView inside a fragment. Could that be a cause of the problem?

My .xml file for the RecyclerView

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scroll_view_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout
    android:id="@+id/rel_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.RecyclerView
        android:id="@+id/listView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="6dp" />

    <Button
        android:id="@+id/button_add_new_card"
        style="@style/Widget.AppCompat.Button.Borderless"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/listView"
        android:layout_marginBottom="16dp"
        android:layout_marginTop="8dp"
        android:padding="20dp"
        android:text="+ Add new Item" />
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>

Body:
ישו אוהב אותך's solution worked on other projects. But setting recyclerView.scrollToPosition() didn't work for me. This is what finally did the job:

public void addNewCard() {
    data.add("New");
    adapter.notifyItemInserted(data.size());

    scrollView.post(new Runnable() {
        @Override
        public void run() {
            scrollView.scrollTo(0,buttonAddNewItem.getTop());
        }
    });
}


问:
Read doesn't work with Wordpress.com pages
This is not the same question as  Read https://google.com doesn't work anymore in Red?

Even with the fix above, it doesn't work:

```<code>convert-invalid: function [page] [
    collect/into [foreach c page [keep to-char c]]  clear ""
]

convert-invalid read/binary https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-visual-editor-and-more/

  02/26/wordpress-for-ios-new-visual-editor-and-more/
  *** Access Error: cannot connect: https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-visual-editor-and-more/ reason: timeout
  *** Where: read
  *** Stack: print convert-invalid
</code>```

I check with Rebol, it works:

```<code>    >> read https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-vi
    sual-editor-and-more/
    connecting to: en.blog.wordpress.com
    == {<!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" data-placeholder-foc
    us="false"><head profile="http://gmpg....
    >>
</code>```

答:
That URL can be read from Red without any trouble:

```<code>--== Red 0.6.3 ==--
Type HELP for starting information.

>> read https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-visual-editor-and-more/
== {<!DOCTYPE html>^/<html xmlns="http://www.w3.org/1999/xhtml" lang="en" data-placeho
</code>```

Red relies on the operating system networking layer for HTTPS, so it does not have the obsolescence issues of Rebol2.

My guess about your issue is that you are using a proxy to access the Internet, and Red does not support proxies yet (while Rebol does), so that would explain the timeout you get on connecting.

Body:
This is not the same question as  Read https://google.com doesn't work anymore in Red?

Even with the fix above, it doesn't work:

convert-invalid: function [page] [
    collect/into [foreach c page [keep to-char c]]  clear ""
]

convert-invalid read/binary https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-visual-editor-and-more/

  02/26/wordpress-for-ios-new-visual-editor-and-more/
  *** Access Error: cannot connect: https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-visual-editor-and-more/ reason: timeout
  *** Where: read
  *** Stack: print convert-invalid

I check with Rebol, it works:

    >> read https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-vi
    sual-editor-and-more/
    connecting to: en.blog.wordpress.com
    == {<!DOCTYPE html>
    >

Body:
That URL can be read from Red without any trouble:

--== Red 0.6.3 ==--
Type HELP for starting information.

>> read https://en.blog.wordpress.com/2015/02/26/wordpress-for-ios-new-visual-editor-and-more/
== {<!DOCTYPE html>^/<html xmlns="http://www.w3.org/1999/xhtml" lang="en" data-placeho

Red relies on the operating system networking layer for HTTPS, so it does not have the obsolescence issues of Rebol2.

My guess about your issue is that you are using a proxy to access the Internet, and Red does not support proxies yet (while Rebol does), so that would explain the timeout you get on connecting.


问:
Jenkins error: TF30063: You are not authorized to access
I am trying to check in files into Microsoft Visual Studio TFS from jenkins using the tf.exe check in command. The command works fine when executed from a command prompt in windows but when i incorporate the commands in a .bat file and invoke through ANT scripts in Jenkins i am getting the below error. Could you please let us know what probably might be the issue?

On another note the same credentials are being used in the jenkins job to get files from TFS successfully.

Error:

TF30063: You are not authorized to access http://<>:8080/tfs/<>

Bat file:

cd %1
tf workspaces /collection:http://<>:8080/tfs/<> login:<>,<>
tf add %2
tf checkin /noprompt

答:
First make sure you have created the authentication link between the TFS instance and the system profile. Jenkins, running in that user profile context, should then be able to issue TF commands and create workspaces, check in codes.

You could follow below tutorial to generate Credentials, create build item. How to setup automated builds using Jenkins and Visual Studio Team Foundation Server  Suggest you to create Global configuration, after configuring  your team project collection, this will use automatic credentials configuration with the TFVC SCM. If you configure Jenkins use the alternate credentials, then every command that you pass must include the same creds.


问:
How to convert Pandas Index to month name
I am trying to change my Date index in the following time series to the month name.

```<code>website = dfFinal.groupby(['Date','Website'])

websiteGroup = website['Visits'].aggregate(np.sum).unstack()

Website              A        B          C
Date
2015-01-01       18185   805769        NaN
2015-02-01       73236   944458        NaN
2015-03-01      101737  1003966        NaN
2015-04-01      101018   861229        NaN
2015-05-01       77724   845223        NaN
2015-06-01      111503   966043        NaN
2015-07-01      115413   937184        NaN
2015-08-01      115215   890457       1649
</code>```

for example I want it to look like this:

```<code>    Website           A        B          C
    Date
    January       18185   805769        NaN
    February      73236   944458        NaN
    March        101737  1003966        NaN
    April        101018   861229        NaN
    May           77724   845223        NaN
    June         111503   966043        NaN
    July         115413   937184        NaN
    August       115215   890457       1649
</code>```

I want to be able to this so my plot ticks will be the month name instead of the datetime.

Thanks

edit//

same scenario but solution does not work on it:

```<code>systemType = dfFinal.groupby(['Date','Website','Type'])
systemGroup = systemType['Visits'].aggregate(np.sum)
systemGroup = systemGroup.groupby(level=[0,1]).apply(lambda x: 100*x/float(x.sum())).unstack()

Type                      Other  Windows Mobile  Windows PC
Date       Website
2015-01-01 A           0.637888        0.005499   48.814957
           B           0.686549        0.016506   54.176073
2015-02-01 A           0.742804        0.020482   49.811568
           B           0.651802        0.014506   57.014288
2015-03-01 A           0.668390        0.014744   50.087972
           B           0.573924        0.015937   59.906013
2015-04-01 A           0.662258        0.015839   49.310024
           B           0.583933        0.013469   59.490449
2015-05-01 A           0.666461        0.020586   48.522979
           B           0.577954        0.017983   58.838200

systemGroup = systemGroup.rename(index=lambda x: x.strftime('%B'))
</code>```

gives me an error

```<code>AttributeError: 'str' object has no attribute 'strftime'
</code>```

答:
Use DatetimeIndex.strftime:

```<code>websiteGroup.index = websiteGroup.index.strftime('%B')
print (websiteGroup)
               A        B       C
January    18185   805769     NaN
February   73236   944458     NaN
March     101737  1003966     NaN
April     101018   861229     NaN
May        77724   845223     NaN
June      111503   966043     NaN
July      115413   937184     NaN
August    115215   890457  1649.0
</code>```

```<code>df = websiteGroup.set_index(websiteGroup.index.strftime('%b'))
print (df)
          A        B       C
Jan   18185   805769     NaN
Feb   73236   944458     NaN
Mar  101737  1003966     NaN
Apr  101018   861229     NaN
May   77724   845223     NaN
Jun  111503   966043     NaN
Jul  115413   937184     NaN
Aug  115215   890457  1649.0
</code>```

Also for assign new values in index is possible use set_index:

```<code>df = websiteGroup.set_index(websiteGroup.index.strftime('%B'))
print (df)
               A        B       C
January    18185   805769     NaN
February   73236   944458     NaN
March     101737  1003966     NaN
April     101018   861229     NaN
May        77724   845223     NaN
June      111503   966043     NaN
July      115413   937184     NaN
August    115215   890457  1649.0
</code>```

EDIT:

For versions pandas 0.23.0 is possible use DatetimeIndex.month_name:

```<code>websiteGroup.index = websiteGroup.index.month_name()
print (websiteGroup)
               A        B       C
Website
January    18185   805769     NaN
February   73236   944458     NaN
March     101737  1003966     NaN
April     101018   861229     NaN
May        77724   845223     NaN
June      111503   966043     NaN
July      115413   937184     NaN
August    115215   890457  1649.0
</code>```

Body:
I am trying to change my Date index in the following time series to the month name.

website = dfFinal.groupby(['Date','Website'])

websiteGroup = website['Visits'].aggregate(np.sum).unstack()

Website              A        B          C
Date
2015-01-01       18185   805769        NaN
2015-02-01       73236   944458        NaN
2015-03-01      101737  1003966        NaN
2015-04-01      101018   861229        NaN
2015-05-01       77724   845223        NaN
2015-06-01      111503   966043        NaN
2015-07-01      115413   937184        NaN
2015-08-01      115215   890457       1649

for example I want it to look like this:

    Website           A        B          C
    Date
    January       18185   805769        NaN
    February      73236   944458        NaN
    March        101737  1003966        NaN
    April        101018   861229        NaN
    May           77724   845223        NaN
    June         111503   966043        NaN
    July         115413   937184        NaN
    August       115215   890457       1649

I want to be able to this so my plot ticks will be the month name instead of the datetime.

Thanks

edit//

same scenario but solution does not work on it:

systemType = dfFinal.groupby(['Date','Website','Type'])
systemGroup = systemType['Visits'].aggregate(np.sum)
systemGroup = systemGroup.groupby(level=[0,1]).apply(lambda x: 100*x/float(x.sum())).unstack()

Type                      Other  Windows Mobile  Windows PC
Date       Website
2015-01-01 A           0.637888        0.005499   48.814957
           B           0.686549        0.016506   54.176073
2015-02-01 A           0.742804        0.020482   49.811568
           B           0.651802        0.014506   57.014288
2015-03-01 A           0.668390        0.014744   50.087972
           B           0.573924        0.015937   59.906013
2015-04-01 A           0.662258        0.015839   49.310024
           B           0.583933        0.013469   59.490449
2015-05-01 A           0.666461        0.020586   48.522979
           B           0.577954        0.017983   58.838200

systemGroup = systemGroup.rename(index=lambda x: x.strftime('%B'))

gives me an error

AttributeError: 'str' object has no attribute 'strftime'

Body:
Use DatetimeIndex.strftime:

websiteGroup.index = websiteGroup.index.strftime('%B')
print (websiteGroup)
               A        B       C
January    18185   805769     NaN
February   73236   944458     NaN
March     101737  1003966     NaN
April     101018   861229     NaN
May        77724   845223     NaN
June      111503   966043     NaN
July      115413   937184     NaN
August    115215   890457  1649.0

df = websiteGroup.set_index(websiteGroup.index.strftime('%b'))
print (df)
          A        B       C
Jan   18185   805769     NaN
Feb   73236   944458     NaN
Mar  101737  1003966     NaN
Apr  101018   861229     NaN
May   77724   845223     NaN
Jun  111503   966043     NaN
Jul  115413   937184     NaN
Aug  115215   890457  1649.0

Also for assign new values in index is possible use set_index:

df = websiteGroup.set_index(websiteGroup.index.strftime('%B'))
print (df)
               A        B       C
January    18185   805769     NaN
February   73236   944458     NaN
March     101737  1003966     NaN
April     101018   861229     NaN
May        77724   845223     NaN
June      111503   966043     NaN
July      115413   937184     NaN
August    115215   890457  1649.0

EDIT:

For versions pandas 0.23.0 is possible use DatetimeIndex.month_name:

websiteGroup.index = websiteGroup.index.month_name()
print (websiteGroup)
               A        B       C
Website
January    18185   805769     NaN
February   73236   944458     NaN
March     101737  1003966     NaN
April     101018   861229     NaN
May        77724   845223     NaN
June      111503   966043     NaN
July      115413   937184     NaN
August    115215   890457  1649.0

ContentLicense: CC BY-SA 4.0


问:
How to get magento API call response in browser
I gave up after 2 days. I want to get list of all products from magento2 api in browser. First I tried "http://mydomain.con/index.php/rest/V1/products?Authorization=Bearer_TOKENHERE?searchCriteria=" but it didn’t work (still not authenticated). The next thing I’ve tried was to call api with php curl:

<?php
//test for 1 product
//API URL for authentication
$apiURL="http://mydomain.con/index.php/rest/V1/integration/admin/token";

//parameters passing with URL
$data = array("username" => "test", "password" => "123456qwe");
$data_string = json_encode($data);

$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Content-Length: ".strlen($data_string)));
$token = curl_exec($ch);

//decoding generated token and saving it in a variable
$token=json_decode($token);

//******************************************//

//Using above token into header
$headers = array("Authorization: Bearer ".$token);

//API URL to get all Magento 2 modules
$requestUrl='http://mydomain.con/index.php/rest/V1/products/24-MB01';

$ch = curl_init($requestUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);

//decoding result
$result=json_decode($result);

//printing result

print_r($requestUrl);

print_r($result);

?>```

Unfortunately, this call get me a perfect answer in terminal in php storm (id, name, sku, price, etc in json) but if I want to get answer by browser it shows me Error 404 Request URL not found in server (when file is actually uploaded).

答: Sounds like a problem somewhere in web server. Check .htaccess in document root and host config in apache.</p>

Body:
I gave up after 2 days. I want to get list of all products from magento2 api in browser. First I tried "http://mydomain.con/index.php/rest/V1/products?Authorization=Bearer_TOKENHERE?searchCriteria=" but it didn’t work (still not authenticated). The next thing I’ve tried was to call api with php curl:

<?php
//test for 1 product
//API URL for authentication
$apiURL="http://mydomain.con/index.php/rest/V1/integration/admin/token";

//parameters passing with URL
$data = array("username" => "test", "password" => "123456qwe");
$data_string = json_encode($data);

$ch = curl_init($apiURL);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json","Content-Length: ".strlen($data_string)));
$token = curl_exec($ch);

//decoding generated token and saving it in a variable
$token=json_decode($token);

//******************************************//

//Using above token into header
$headers = array("Authorization: Bearer ".$token);

//API URL to get all Magento 2 modules
$requestUrl='http://mydomain.con/index.php/rest/V1/products/24-MB01';

$ch = curl_init($requestUrl);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);

//decoding result
$result=json_decode($result);

//printing result

print_r($requestUrl);

print_r($result);

?>

Unfortunately, this call get me a perfect answer in terminal in php storm (id, name, sku, price, etc in json) but if I want to get answer by browser it shows me Error 404 Request URL not found in server (when file is actually uploaded).


问:
Showing part of the ImageView which is cover by another ImageView
I have a Framelayout, where the first element is an ImageView which height and width is match parent and let the id is A. Second element is also an ImageView which height and width also match parent and let the id is B. Third element is a View which height and width is 100 dp and can be move to the whole screen and let the id is C. I am using transparent color in background C, so inside C we should see B, because B is above A. But I want to show A in inside C , how can I do that?</p>

答:
This will help.

```<code><FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
    android:id="@+id/a"
    android:src="@drawable/ic_networking"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<ImageView
    android:id="@+id/b"
    android:visibility="gone"
    android:src="@drawable/dailymetricsin"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<View
    android:background="#90606060"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
</code>```

You can hide and show the ImageView based on the which one should show in the background either A (or) B.

Body:
This will help.

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<ImageView
    android:id="@+id/a"
    android:src="@drawable/ic_networking"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<ImageView
    android:id="@+id/b"
    android:visibility="gone"
    android:src="@drawable/dailymetricsin"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<View
    android:background="#90606060"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

You can hide and show the ImageView based on the which one should show in the background either A (or) B.


问:
Check attribute value by schema XSD
I need to check the attribute value "id" of "book" (root) element.

If "id" value ends with three zeros(id="******-000") then the another attribute "book-type" should be "book" otherwise it should be "chapter".

Here is my xml looks like:

```<code><book id="201019894-000" book-type="book" xsi:noNamespaceSchemaLocation="schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<book-meta>
<title-group>...
</code>```

Is there any possibilities to check the above conditions in Schema(xsd).

Please guide me..

Thanks

答:
Can't be done in XSD 1.0.

In XSD 1.1 you can do this with an assertion such as

```<code><xs:assert test="if (ends-with(@id, '-000') then @book-type='book' else @book-type='chapter'"/>
</code>```

Title: Check attribute value by schema XSD

Body:
I need to check the attribute value "id" of "book" (root) element.

If "id" value ends with three zeros(id="******-000") then the another attribute "book-type" should be "book" otherwise it should be "chapter".

Here is my xml looks like:

<book id="201019894-000" book-type="book" xsi:noNamespaceSchemaLocation="schema.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<book-meta>
<title-group>...

Is there any possibilities to check the above conditions in Schema(xsd).

Please guide me..

Thanks

Body:
Can't be done in XSD 1.0.

In XSD 1.1 you can do this with an assertion such as

<xs:assert test="if (ends-with(@id, '-000') then @book-type='book' else @book-type='chapter'"/>


问:
python json.dumps()’s data is contain \, how to clean it
```<code>def getJson(filmList):
film_json = FilmJson()
for video in filmList:
    videoName = video.videoName
    videoUrl = video.videoUrl
    videoTime = video.videoTime
    dic = {}
    if videoName is None:
        break

    if videoUrl is None:
        dic['videourl'] = ""
    else:
        dic['videourl'] = videoUrl

    if videoTime is None:
        dic['videotime'] = ""
    else:
        dic['videotime'] = videoTime
    dic['videoname'] = videoName

    film_json.videolist.append(dic)

dict__ = film_json.__dict__
print(dict__)

return dict__
</code>```

The browser send get request

the backend print

```<code>{'filmid': '', 'videolist': [{'videourl': '', 'videotime': '', 'videoname': 'Lifeline'}, {'videourl': '', 'videotime': '', 'videoname': 'Ex Static'}, {'videourl': '', 'videotime': '', 'videoname': 'test'}]}
</code>```

.

```<code>@api_view(http_method_names=['GET'])
@permission_classes((permissions.AllowAny,))
def sendFilm(request):
   ....
    myjson = jsonbean.getJson(filmList)

    return Response(json.dumps(myjson,ensure_ascii=False))
</code>```

The postman test get result

```<code>"{\"filmid\": \"\", \"videolist\": [{\"videourl\": \"\", \"videotime\": \"\", \"videoname\": \"Lifeline\"}, {\"videourl\": \"\", \"videotime\": \"\", \"videoname\": \"Ex Static\"}, {\"videourl\": \"\", \"videotime\": \"\", \"videoname\": \"test\"}]}"
</code>```

how to resolve the  problem

答:
You are encoding a JSON object again to JSON using json.dumps(). If you use json.loads() again then the \'s will go away. </p>

```<code>return Response(json.loads(json.dumps(myjson,ensure_ascii=False)))
#OR
return Response(myjson)
</code>```

Body:
def getJson(filmList):
film_json = FilmJson()
for video in filmList:
    videoName = video.videoName
    videoUrl = video.videoUrl
    videoTime = video.videoTime
    dic = {}
    if videoName is None:
        break

    if videoUrl is None:
        dic['videourl'] = ""
    else:
        dic['videourl'] = videoUrl

    if videoTime is None:
        dic['videotime'] = ""
    else:
        dic['videotime'] = videoTime
    dic['videoname'] = videoName

    film_json.videolist.append(dic)

dict__ = film_json.__dict__
print(dict__)

return dict__

The browser send get request

the backend print

{'filmid': '', 'videolist': [{'videourl': '', 'videotime': '', 'videoname': 'Lifeline'}, {'videourl': '', 'videotime': '', 'videoname': 'Ex Static'}, {'videourl': '', 'videotime': '', 'videoname': 'test'}]}

.

@api_view(http_method_names=['GET'])
@permission_classes((permissions.AllowAny,))
def sendFilm(request):
   ....
    myjson = jsonbean.getJson(filmList)

    return Response(json.dumps(myjson,ensure_ascii=False))

The postman test get result

"{\"filmid\": \"\", \"videolist\": [{\"videourl\": \"\", \"videotime\": \"\", \"videoname\": \"Lifeline\"}, {\"videourl\": \"\", \"videotime\": \"\", \"videoname\": \"Ex Static\"}, {\"videourl\": \"\", \"videotime\": \"\", \"videoname\": \"test\"}]}"

how to resolve the  problem

Body:
You are encoding a JSON object again to JSON using json.dumps(). If you use json.loads() again then the \'s will go away.

return Response(json.loads(json.dumps(myjson,ensure_ascii=False)))
#OR
return Response(myjson)


问:
In place insertion into list (or array)
I'm running a script in Python, where I need to insert new numbers into an array  (or list) at certain index locations. The problem is that obviously as I insert new numbers, the index locations are invalidated. Is there a clever way to insert the new values at the index locations all at once? Or is the only solution to increment the index number (first value of the pair) as I add?

Sample test code snippets:

```<code>original_list = [0, 1, 2, 3, 4, 5, 6, 7]
insertion_indices = [1, 4, 5]
new_numbers = [8, 9, 10]
pairs = [(insertion_indices[i], new_numbers[i]) for i in range(len(insertion_indices))]

for pair in pairs:
    original_list.insert(pair[0], pair[1])
</code>```

Results in:

```<code>[0, 8, 1, 2, 9, 10, 3, 4, 5, 6, 7]
</code>```

whereas I want:

```<code>[0, 8, 1, 2, 3, 9, 4, 10, 5, 6, 7]
</code>```

答:
Insert those values in backwards order. Like so:

```<code>original_list = [0, 1, 2, 3, 4, 5, 6, 7]
insertion_indices = [1, 4, 5]
new_numbers = [8, 9, 10]

new = zip(insertion_indices, new_numbers)
new.sort(reverse=True)

for i, x in new:
    original_list.insert(i, x)
</code>```

The reason this works is based on the following observation:

Inserting a value at the beginning of the list offsets the indexes of all other values by 1. Inserting a value at the end though, and the indexes remain unchanged. As a consequence, if you start by inserting the value with the largest index (10) and continue "backwards" you would not have to update any indexes.

Title: In place insertion into list (or array)

Body:
I'm running a script in Python, where I need to insert new numbers into an array  (or list) at certain index locations. The problem is that obviously as I insert new numbers, the index locations are invalidated. Is there a clever way to insert the new values at the index locations all at once? Or is the only solution to increment the index number (first value of the pair) as I add?

Sample test code snippets:

original_list = [0, 1, 2, 3, 4, 5, 6, 7]
insertion_indices = [1, 4, 5]
new_numbers = [8, 9, 10]
pairs = [(insertion_indices[i], new_numbers[i]) for i in range(len(insertion_indices))]

for pair in pairs:
    original_list.insert(pair[0], pair[1])

Results in:

[0, 8, 1, 2, 9, 10, 3, 4, 5, 6, 7]

whereas I want:

[0, 8, 1, 2, 3, 9, 4, 10, 5, 6, 7]

Body:
Insert those values in backwards order. Like so:

original_list = [0, 1, 2, 3, 4, 5, 6, 7]
insertion_indices = [1, 4, 5]
new_numbers = [8, 9, 10]

new = zip(insertion_indices, new_numbers)
new.sort(reverse=True)

for i, x in new:
    original_list.insert(i, x)

The reason this works is based on the following observation:

Inserting a value at the beginning of the list offsets the indexes of all other values by 1. Inserting a value at the end though, and the indexes remain unchanged. As a consequence, if you start by inserting the value with the largest index (10) and continue "backwards" you would not have to update any indexes.


问:
How to stress test my page
I would like to test my web app under high load.

What I'd need to do is.
Load the page => click the button => fill the form => click the button.

I'd need to do this to simulate 5-10k page requests, which is expected to happen after we launch one service (based on previous years data as there's going to be some big pre-sale discount for only a couple of items)

What service or approach would be the most suitable to do this?

答: You can use services such as SoapUI or Loader.IO. Both are supposed to be free if I am not mistaken.</p>

Title: How to stress test my page


问:
LibGDX Tiled get object property on collision
I'm working on a game in LibGDX, and have a map set up with Tiled. I added a custom String property to objects in a specific layer to get further information, what object it represents.

I have a ContactListener set up, that calls a method in the abstract class of the map object. The listener looks like this:

```<code>@Override
public void beginContact(Contact contact) {

    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    if (fixtureA.getUserData() == "player" || fixtureB.getUserData() == "player") {
        // Get either fixture A or B, depending on which of them is the player fixture
        Fixture player = fixtureA.getUserData() == "player" ? fixtureA : fixtureB;
        // Get the colliding object, depending on which of them is the player fixture
        Fixture collidedObject = player == fixtureA ? fixtureB : fixtureA;

        // Determine what kind of object the player collided with and trigger the respectable method
        if (collidedObject.getUserData() instanceof InteractiveMapTileObject) {
            ((InteractiveMapTileObject) collidedObject.getUserData()).onPlayerBeginContact();
        } else if (collidedObject.getUserData() instanceof Enemy) {
            ((Enemy) collidedObject.getUserData()).onPlayerBeginContact();
        }
    }
}
</code>```

When the player hits an object of an instance of InteractiveMapTileObject, the onPlayerBeginContact() method gets called, which looks like this:

```<code>@Override
public void onPlayerBeginContact() {
    MapObjects objects = playScreen.getMap().getLayers().get("weapon").getObjects();
    for (MapObject object : objects) {
        if (object.getProperties().containsKey("weapon_name")) {
            String weaponName = object.getProperties().get("weapon_name", String.class);
            Gdx.app.log("Picked up weapon", weaponName);
        }
    }
}
</code>```

Here, I am getting the objects of the "weapon" layer in the map, and then iterate through it to find the correct property and it's value. This works fine as it is.

The problem now is, that I obviously have multiple objects in the layer, and therefore multiple MapObjects. I need a way to identify the object, that the player collided with and then get it's property.

Is it possible to do that with the ContactListener, or do I need to implement something else? I already searched through a ton of posts, but didn't get lucky.

答:
I solved my problem by writing a custom method in my abstract class to check for an intersection of each object in a specific object layer.

```<code>protected MapObject getCellProperties(int layerIndex) {
    MapObjects mapObjects = map.getLayers().get(layerIndex).getObjects();

    for (MapObject mapObject : mapObjects) {
        MapProperties mapProperties = mapObject.getProperties();

        float width, height, x, y;
        Rectangle objectRectangle = new Rectangle();
        Rectangle playerRectangle = new Rectangle();

        if (mapProperties.containsKey("width") && mapProperties.containsKey("height") && mapProperties.containsKey("x") && mapProperties.containsKey("y")) {
            width = (float) mapProperties.get("width");
            height = (float) mapProperties.get("height");
            x = (float) mapProperties.get("x");
            y = (float) mapProperties.get("y");
            objectRectangle.set(x, y, width, height);
        }

        playerRectangle.set(
                playScreen.getPlayer().getX() * MainGameClass.PPM,
                playScreen.getPlayer().getY() * MainGameClass.PPM,
                playScreen.getPlayer().getWidth() * MainGameClass.PPM,
                playScreen.getPlayer().getHeight() * MainGameClass.PPM
        );

        // If the player rectangle and the object rectangle is colliding, return the object
        if (Intersector.overlaps(objectRectangle, playerRectangle)) {
            return mapObject;
        }
    }

    // If no colliding object was found in that layer
    return null;
}
</code>```

This is probably not the best solution, but it works wonderfully.

Body:
I'm working on a game in LibGDX, and have a map set up with Tiled. I added a custom String property to objects in a specific layer to get further information, what object it represents.

I have a ContactListener set up, that calls a method in the abstract class of the map object. The listener looks like this:

@Override
public void beginContact(Contact contact) {

    Fixture fixtureA = contact.getFixtureA();
    Fixture fixtureB = contact.getFixtureB();

    if (fixtureA.getUserData() == "player" || fixtureB.getUserData() == "player") {
        // Get either fixture A or B, depending on which of them is the player fixture
        Fixture player = fixtureA.getUserData() == "player" ? fixtureA : fixtureB;
        // Get the colliding object, depending on which of them is the player fixture
        Fixture collidedObject = player == fixtureA ? fixtureB : fixtureA;

        // Determine what kind of object the player collided with and trigger the respectable method
        if (collidedObject.getUserData() instanceof InteractiveMapTileObject) {
            ((InteractiveMapTileObject) collidedObject.getUserData()).onPlayerBeginContact();
        } else if (collidedObject.getUserData() instanceof Enemy) {
            ((Enemy) collidedObject.getUserData()).onPlayerBeginContact();
        }
    }
}

When the player hits an object of an instance of InteractiveMapTileObject, the onPlayerBeginContact() method gets called, which looks like this:

@Override
public void onPlayerBeginContact() {
    MapObjects objects = playScreen.getMap().getLayers().get("weapon").getObjects();
    for (MapObject object : objects) {
        if (object.getProperties().containsKey("weapon_name")) {
            String weaponName = object.getProperties().get("weapon_name", String.class);
            Gdx.app.log("Picked up weapon", weaponName);
        }
    }
}

Here, I am getting the objects of the "weapon" layer in the map, and then iterate through it to find the correct property and it's value. This works fine as it is.

The problem now is, that I obviously have multiple objects in the layer, and therefore multiple MapObjects. I need a way to identify the object, that the player collided with and then get it's property.

Is it possible to do that with the ContactListener, or do I need to implement something else? I already searched through a ton of posts, but didn't get lucky.

Body:
I solved my problem by writing a custom method in my abstract class to check for an intersection of each object in a specific object layer.

protected MapObject getCellProperties(int layerIndex) {
    MapObjects mapObjects = map.getLayers().get(layerIndex).getObjects();

    for (MapObject mapObject : mapObjects) {
        MapProperties mapProperties = mapObject.getProperties();

        float width, height, x, y;
        Rectangle objectRectangle = new Rectangle();
        Rectangle playerRectangle = new Rectangle();

        if (mapProperties.containsKey("width") && mapProperties.containsKey("height") && mapProperties.containsKey("x") && mapProperties.containsKey("y")) {
            width = (float) mapProperties.get("width");
            height = (float) mapProperties.get("height");
            x = (float) mapProperties.get("x");
            y = (float) mapProperties.get("y");
            objectRectangle.set(x, y, width, height);
        }

        playerRectangle.set(
                playScreen.getPlayer().getX() * MainGameClass.PPM,
                playScreen.getPlayer().getY() * MainGameClass.PPM,
                playScreen.getPlayer().getWidth() * MainGameClass.PPM,
                playScreen.getPlayer().getHeight() * MainGameClass.PPM
        );

        // If the player rectangle and the object rectangle is colliding, return the object
        if (Intersector.overlaps(objectRectangle, playerRectangle)) {
            return mapObject;
        }
    }

    // If no colliding object was found in that layer
    return null;
}

This is probably not the best solution, but it works wonderfully.


问:
MPI matrix output by blocks
I've divided matrix by blocks and multiplied it using Fox's algorithm.

How can I print the result matrix to screen, when that is stored by blocks in different processes, without sending these blocks back to the process with rank 0?

For example.

After multiplication I've got:

```<code>Block A:
83  64
112 76

Block B:
118 44
152 34

Block C:
54 68
67 56

Block D:
89  85
114 68

Entire matrix should look like:
83  64 118 44
112 76 152 34
54  68 89  85
67  56 114 68
</code>```

So far I've made:

Send two blocks that contain one row and print it to screen. But is it possible to print entire result matrix without sending more than one block to process 0?

```<code>// Function for gathering the result matrix
// pCBlock - one block containing part of entire result matrix
// Size - matrix dimension
// BlockSize - block dimension
void ResultCollection(double* pCblock, int Size,
                  int BlockSize) {
double * pResultRow = new double[Size*BlockSize];
for (int i = 0; i<BlockSize; i++) {
    MPI_Gather(&pCblock[i*BlockSize], BlockSize, MPI_DOUBLE,
               &pResultRow[i*Size], BlockSize, MPI_DOUBLE, 0, RowComm);
}
//print two matrix rows from two blocks
delete[] pResultRow;
}
</code>```

This can't help

( Ordering Output in MPI )

because for the matrix output I need to print not the entire block A, than B, than C, than D,

but rather

one line from A ( in process 0 ), one line from B ( from process 1 ),

one line from A ( in process 0 ), one line from B ( from process 1 ),

one line from C ( from process 2 ), one line from D ( from process 3 )

and etc.

Example matrix and blocks

答:
How can I print ...
 without sending these blocks back to the process with rank 0?

Well, it is time to realise,

that unless the process with rank 0 was equipped with some sort of clairvoyance, it will never be able to pretty-print any results, that were remotely computed in a herd of decentralised, distributed-processes.

Similarly, it is easy to test,

if you still do not believe what has been published on this, that MPI-distributed code was never promised to have any weak/strong warranty of how the principally uncoordinated delivery of any asynchronously remote-printed character-streams will centrally got ad-hoc ordered into one common serial output -- the system stdout -- and finally put onto the screen.

Even if you would play a lot with "addressable-ANSI-coded-screen", such design-efforts will not yield any universally working code and the tricks to inject an "absolute"-addressing into the ANSI-coded output would be obsessively awfull both to implement and to operate so as to paint a result on screen correctly.

No. Better do not try neither of these ideas.

Your actual MPI-infrastructure advisors / admins will for sure help you and show you appropriate tools for smart-collecting the results and post-process 'em accordingly.

Title: MPI matrix output by blocks

Body:
I've divided matrix by blocks and multiplied it using Fox's algorithm.

How can I print the result matrix to screen, when that is stored by blocks in different processes, without sending these blocks back to the process with rank 0?

For example.

After multiplication I've got:

Block A:
83  64
112 76

Block B:
118 44
152 34

Block C:
54 68
67 56

Block D:
89  85
114 68

Entire matrix should look like:
83  64 118 44
112 76 152 34
54  68 89  85
67  56 114 68

So far I've made:

Send two blocks that contain one row and print it to screen. But is it possible to print entire result matrix without sending more than one block to process 0?

// Function for gathering the result matrix
// pCBlock - one block containing part of entire result matrix
// Size - matrix dimension
// BlockSize - block dimension
void ResultCollection(double* pCblock, int Size,
                  int BlockSize) {
double * pResultRow = new double[Size*BlockSize];
for (int i = 0; i<BlockSize; i++) {
    MPI_Gather(&pCblock[i*BlockSize], BlockSize, MPI_DOUBLE,
               &pResultRow[i*Size], BlockSize, MPI_DOUBLE, 0, RowComm);
}
//print two matrix rows from two blocks
delete[] pResultRow;
}

This can't help

( Ordering Output in MPI )

because for the matrix output I need to print not the entire block A, than B, than C, than D,

but rather

one line from A ( in process 0 ), one line from B ( from process 1 ),

one line from A ( in process 0 ), one line from B ( from process 1 ),

one line from C ( from process 2 ), one line from D ( from process 3 )

and etc.

Example matrix and blocks