问:
VSTS SDK retrieve projects in subfolders
I have the following code to retrieve all projects in TFS using the .net SDK for VSTS and using TFS2018. But I only get the top most project folders. How can I retrieve the subfolders of a certain project?

```<code>var uri = new Uri("https://devserver/tfs/DefaultCollection");
using (var projectHttpClient = new ProjectHttpClient(uri, cred))                    {
    var projects = projectHttpClient.GetProjects().Result;
}
</code>```

I also tried changing the uri to

```<code>var uri = new Uri("https://devserver/tfs/DefaultCollection/MyProject");
</code>```

But I get a Page not found error.

Here is a snapshot of the TFS structure. I would like to retrieve the projects on the sublevel. However I am only receiving the second level projects. The level with the user icons.

答:
Try the code below to get folders:</p>

```<code>using Microsoft.TeamFoundation.Client;
using System;
using Microsoft.TeamFoundation.VersionControl.Client;

namespace TestCaseProject
{
    class Program
    {
        static void Main(string[] args)
        {
            TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://tfsserver:8080/tfs/DefaultCollection"));
            var versioncontrols = tfs.GetService<VersionControlServer>();

            var workspace = versioncontrols.CreateWorkspace("workspaceName","workspaceOwner");

            String ServerFolder = @"$/TeamProject/Folder";
            String LocalFolder = @"C:\Folder";

            WorkingFolder workfolder = new WorkingFolder(ServerFolder, LocalFolder);
            workspace.CreateMapping(workfolder);

            workspace.Get();

        }
    }
}
</code>```

Body:
I have the following code to retrieve all projects in TFS using the .net SDK for VSTS and using TFS2018. But I only get the top most project folders. How can I retrieve the subfolders of a certain project?

var uri = new Uri("https://devserver/tfs/DefaultCollection");
using (var projectHttpClient = new ProjectHttpClient(uri, cred))                    {
    var projects = projectHttpClient.GetProjects().Result;
}

I also tried changing the uri to

var uri = new Uri("https://devserver/tfs/DefaultCollection/MyProject");

But I get a Page not found error.

Here is a snapshot of the TFS structure. I would like to retrieve the projects on the sublevel. However I am only receiving the second level projects. The level with the user icons.

Body:
Try the code below to get folders:

using Microsoft.TeamFoundation.Client;
using System;
using Microsoft.TeamFoundation.VersionControl.Client;

namespace TestCaseProject
{
    class Program
    {
        static void Main(string[] args)
        {
            TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("http://tfsserver:8080/tfs/DefaultCollection"));
            var versioncontrols = tfs.GetService<VersionControlServer>();

            var workspace = versioncontrols.CreateWorkspace("workspaceName","workspaceOwner");

            String ServerFolder = @"$/TeamProject/Folder";
            String LocalFolder = @"C:\Folder";

            WorkingFolder workfolder = new WorkingFolder(ServerFolder, LocalFolder);
            workspace.CreateMapping(workfolder);

            workspace.Get();

        }
    }
}


来源: stackexchange

问:
JavaScript Math Object: Negative , Zero and Positive Value
I want to random a numbers like this from -5....0....5.

```<code><!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Try it</button>
<p id="demo"></p>

<script>
function myFunction() {
document.getElementById("demo").innerHTML =
Math.floor(Math.random() * 7-1);
}
</script>

</body>
</html>
</code>```

In this case it returns only -1. It is possible to do in javascript math object?

答:
In this case it returns only -1. It is possible to do in javascript
  math object?

You need to use brackets (), in your case it resulted in Math.floor(Math.random() * 7-1 ) => Math.floor(0.xxx-1 ) => Math.floor(-0.xxx ) => -1

Make it

```<code>Math.floor(Math.random() * (7-1) );
</code>```

I want to random a numbers like this from -5....0....5.

First get a number between 0 and 5

```<code>Math.floor(Math.random() * (5-0) );
</code>```

Then multiply the same by either 1 or -1 randomly

```<code>var value = Math.floor(Math.random() * (5-0) );
var sign = window.performance.now() % 2 == 1 ? 1 : -1; //get the current timestamp of the system in nanoseconds (something like 1512635632715) and checking if that number is even or odd
value *= sign ;
</code>```

Added Demo with nano seconds instead of milliseconds

function generateRandom() {
  var value = Math.floor(Math.random() * (5 - 0));
  var sign = window.performance.now() % 2 == 1 ? 1 : -1;
  value *= sign;
  return value;
}

var arr = [];
for( var counter = 0; counter < 100; counter++)
{
   arr.push(generateRandom());
}
console.log(arr);```

ContentLicense: CC BY-SA 3.0

Body:
I want to random a numbers like this from -5....0....5.

<!DOCTYPE html>

<button onclick="myFunction()">Try it</button>

In this case it returns only -1. It is possible to do in javascript math object?

Body:
In this case it returns only -1. It is possible to do in javascript
  math object?

You need to use brackets (), in your case it resulted in Math.floor(Math.random() * 7-1 ) => Math.floor(0.xxx-1 ) => Math.floor(-0.xxx ) => -1

Make it

Math.floor(Math.random() * (7-1) );

I want to random a numbers like this from -5....0....5.

First get a number between 0 and 5

Math.floor(Math.random() * (5-0) );

Then multiply the same by either 1 or -1 randomly

var value = Math.floor(Math.random() * (5-0) );
var sign = window.performance.now() % 2 == 1 ? 1 : -1; //get the current timestamp of the system in nanoseconds (something like 1512635632715) and checking if that number is even or odd
value *= sign ;

Added Demo with nano seconds instead of milliseconds

function generateRandom() {
  var value = Math.floor(Math.random() * (5 - 0));
  var sign = window.performance.now() % 2 == 1 ? 1 : -1;
  value *= sign;
  return value;
}

var arr = [];
for( var counter = 0; counter < 100; counter++)
{
   arr.push(generateRandom());
}
console.log(arr);


问:
Does spring integration jpa:outbound-channel-adapter provide hooks/callbacks for successful write?
Requirement: Need a way to tell if a Message sent on the jpa:outbound-channel-adapter successfully made it to the DB or not? This is required, because as soon as we get the confirmation of successful write to DB a new pipeline has to be started.

The doc does not have any parameters related to callbacks/hooks.
One solution is to use synchronization-factory. However synchronization-factory requires that it should be inside a poller block. Then the question is does poller make sense in an outbound setting?

Any other design suggestions are also welcome.

答:
You can use ExpressionEvaluatingRequestHandlerAdvice to add into the jpa:request-handler-advice-chain of that jpa:outbound-channel-adapter. And start a new pipeline from the successChannel of that component.

However it isn't clear why you don't mention that you have an exception when your data can't make it into the DB. That's suspissions...


问:
JavaFX, Label only showing after resizing of the window
I new to working with JavaFX and the problem is, that after a change the scene, not all components are diplayed. For example I have a GridPane which will be added to a BorderPane center and a Label will be added to the bottom of the BorderPane. But after I change the scene this Label is not showing, only after a resize it works.

Following is a simple Minimal, Complete, and Verifiable example:

```<code>import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.Scene;

public class View extends Application implements EventHandler<ActionEvent> {
    private Scene scene1, scene2;
    private Button b1, b2;
    private Stage stage;

    public static void main(String... args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        this.stage = stage;

        this.createScene1();
        this.stage.setScene(this.scene1);

        this.stage.setWidth(200);
        this.stage.setHeight(200);
        this.stage.show();
    }

    public void createScene1() {
        BorderPane border = new BorderPane();
        GridPane root = new GridPane();

        root.add(new Label("Scene 1"), 0, 0);
        this.b1 = new Button("Change to Scene 2");
        this.b1.setOnAction(this);
        root.add(this.b1, 0, 1);

        border.setCenter(root);
        border.setBottom(new Label("Should be visible"));
        this.scene1 = new Scene(border);
    }

    public void createScene2() {
        BorderPane border = new BorderPane();
        GridPane root = new GridPane();

        root.add(new Label("Scene 2"), 0, 0);
        this.b2 = new Button("Change to Scene 1");
        this.b2.setOnAction(this);
        root.add(this.b2, 0, 1);

        border.setCenter(root);
        border.setBottom(new Label("Should be visible"));
        this.scene2 = new Scene(border);
    }

    @Override
    public void handle(ActionEvent e) {
        if (this.b1 != null) {
            if (this.b1 == e.getSource()) {
                this.createScene2();
                this.stage.setScene(this.scene2);
            }
        }
        if (this.b2 != null) {
            if (this.b2 == e.getSource()) {
                this.createScene1();
                this.stage.setScene(this.scene1);
            }
        }
    }
}
</code>```

答:
I can not reproduce your problem, since your code is working fine for me.
But your components might get scaled down so much, that they are not rendered. To avoid this, try using a prefixed min width and height. </p>

Body:
I new to working with JavaFX and the problem is, that after a change the scene, not all components are diplayed. For example I have a GridPane which will be added to a BorderPane center and a Label will be added to the bottom of the BorderPane. But after I change the scene this Label is not showing, only after a resize it works.

Following is a simple Minimal, Complete, and Verifiable example:

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.Scene;

public class View extends Application implements EventHandler<ActionEvent> {
    private Scene scene1, scene2;
    private Button b1, b2;
    private Stage stage;

    public static void main(String... args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        this.stage = stage;

        this.createScene1();
        this.stage.setScene(this.scene1);

        this.stage.setWidth(200);
        this.stage.setHeight(200);
        this.stage.show();
    }

    public void createScene1() {
        BorderPane border = new BorderPane();
        GridPane root = new GridPane();

        root.add(new Label("Scene 1"), 0, 0);
        this.b1 = new Button("Change to Scene 2");
        this.b1.setOnAction(this);
        root.add(this.b1, 0, 1);

        border.setCenter(root);
        border.setBottom(new Label("Should be visible"));
        this.scene1 = new Scene(border);
    }

    public void createScene2() {
        BorderPane border = new BorderPane();
        GridPane root = new GridPane();

        root.add(new Label("Scene 2"), 0, 0);
        this.b2 = new Button("Change to Scene 1");
        this.b2.setOnAction(this);
        root.add(this.b2, 0, 1);

        border.setCenter(root);
        border.setBottom(new Label("Should be visible"));
        this.scene2 = new Scene(border);
    }

    @Override
    public void handle(ActionEvent e) {
        if (this.b1 != null) {
            if (this.b1 == e.getSource()) {
                this.createScene2();
                this.stage.setScene(this.scene2);
            }
        }
        if (this.b2 != null) {
            if (this.b2 == e.getSource()) {
                this.createScene1();
                this.stage.setScene(this.scene1);
            }
        }
    }
}


问:
What units are available, world units, screen units?
I am trying to understand different types of units in unity. When I create a canvas (UI) then I believe these are set to world units meaning (I think) - 1 unit = 1 pixel?

I know by default my scene unit is 1 unit = 1 meter, what are these units called?

I suppose I am getting confused with all the different types of units around.

I know there are screen units, but how does this differ from world units ?

Does anyone know where I can find a good explanation?

答:
Units in unity world space are arbitrary, and it's subject to your interpretation.

In screen space however, it's obviously relative to the height and width of the screen, so it'd be apt to use a 1 unit to 1 pixel comparison.

It should be noted that, if you're importing sprites, there should be an import option to change the "pixel to unit" scale. For instance, by default (if i recall correctly), sprites have a 100 pixel to 1 unit scale.


问:
How to use template scope in vue jsx?
I define a simple child component(testSlot.vue) like this:

```<code><template>
    <section>
        <div>this is title</div>
        <slot text="hello from child slot"></slot>
    </section>
</template>
<script>
    export default {}
</script>
</code>```

and we can use it in html template like this

```<code><test-slot>
    <template scope="props">
        <div> {{props.text}}</div>
        <div> this is real body</div>
    </template>
</test-slot>
</code>```

but how can I use it in jsx ?

答:
now in babel-plugin-transform-vue-jsx 3.5, you need write in this way:

```<code> <el-table-column
  { ...{
    scopedSlots: {
      default: scope => {
        return (
          <div class='action-list'>

          </div>
        )
      }
    }
  } }>
  </el-table-column>
</code>```

Title: How to use template scope in vue jsx?

Body:
I define a simple child component(testSlot.vue) like this:

<template>

this is title

        <slot text="hello from child slot"></slot>

</template>

and we can use it in html template like this

<test-slot>
    <template scope="props">

 {{props.text}}

 this is real body

    </template>
</test-slot>

but how can I use it in jsx ?

Body:
now in babel-plugin-transform-vue-jsx 3.5, you need write in this way:

 <el-table-column
  { ...{
    scopedSlots: {
      default: scope => {
        return (
          <div class='action-list'>

          </div>
        )
      }
    }
  } }>
  </el-table-column>


问:
Spatial nearest neighbor assignment in R

I am working on a study that is trying to assign particulate matter exposure to specific individuals based on their addresses. I have two data sets with longitude and latitude coordinates. One if for individuals and one if for pm exposure blocks. I want to assign each subject with a pm exposure block based on the block that is closest.

```<code>library(sp)
library(raster)
library(tidyverse)

#subject level data
subjectID<-c("A1","A2","A3","A4")

subjects<-data.frame(tribble(
~lon,~lat,
-70.9821391,    42.3769511,
-61.8668537,    45.5267133,
-70.9344039,    41.6220337,
-70.7283830,    41.7123494
))

row.names(subjects)<-subjectID

#PM Block Locations
blockID<-c("B1","B2","B3","B4","B5")

blocks<-data.frame(tribble(
~lon,~lat,
-70.9824591,    42.3769451,
-61.8664537,    45.5267453,
-70.9344539,    41.6220457,
-70.7284530,    41.7123454,
-70.7284430,    41.7193454
))

row.names(blocks)<-blockID

#Creating distance matrix
dis_matrix<-pointDistance(blocks,subjects,lonlat = TRUE)

###The above code doesnt preserve the row names. Is there a way to to do
that?

###I'm unsure about the below code
colnames(dis_matrix)<-row.names(subjects)
row.names(dis_matrix)<-row.names(blocks)

dis_data<-data.frame(dis_matrix)

###Finding nearst neighbor and coercing to usable format
getname <-function(x) {
row.names(dis_data[which.min(x),])
}

nn<-data.frame(lapply(dis_data,getname)) %>%
gather(key=subject,value=neighbor)
</code>```

This code gives me output that makes sense but I'm unsure of the validity and efficiency. Any suggestion on how to improve and fix this code are appreciated. I also receive the error message:

```<code>Warning message:
attributes are not identical across measure variables;
they will be dropped
</code>```

Which I can't determine the origin of.

Thanks for taking a look!

答:
If you have a big dataset you might want to use the very efficient nabor package as explained by @user3507085 in this answer. Since the question is closed as off-topic I have copy-pasted the answer below, so it "stays alive" in this thread. I don't know if this is considered bad practice and I'm happy to delete/edit if requested (note the distances given by knn are not the geographical distances, but I guess they could be converted to spherical distances by a simple transformation including arcsin):

```<code>lonlat2xyz=function (lon, lat, r)
{
lon = lon * pi/180
lat = lat * pi/180
if (missing(r))
    r <- 6378.1
x <- r * cos(lat) * cos(lon)
y <- r * cos(lat) * sin(lon)
z <- r * sin(lat)
return(cbind(x, y, z))
}

lon1=runif(100,-180,180);lon2=runif(100,-180,180);lat1=runif(100,-90,90);lat2=runif(100,-90,90)

xyz1=lonlat2xyz(lon1,lat1)
xyz2=lonlat2xyz(lon2,lat2)

library(nabor)

out=knn(data=xyz1,query = xyz2,k=20)

library(maps)

map()
points(lon1,lat1,pch=16,col="black")
points(lon2[1],lat2[1],pch=16,col="red")
points(lon1[out$nn.idx[1,]],lat1[out$nn.idx[1,]],pch=16,col="blue")
</code>```

Body:
I am working on a study that is trying to assign particulate matter exposure to specific individuals based on their addresses. I have two data sets with longitude and latitude coordinates. One if for individuals and one if for pm exposure blocks. I want to assign each subject with a pm exposure block based on the block that is closest.

library(sp)
library(raster)
library(tidyverse)

#subject level data
subjectID<-c("A1","A2","A3","A4")

subjects<-data.frame(tribble(
~lon,~lat,
-70.9821391,    42.3769511,
-61.8668537,    45.5267133,
-70.9344039,    41.6220337,
-70.7283830,    41.7123494
))

row.names(subjects)<-subjectID

#PM Block Locations
blockID<-c("B1","B2","B3","B4","B5")

blocks<-data.frame(tribble(
~lon,~lat,
-70.9824591,    42.3769451,
-61.8664537,    45.5267453,
-70.9344539,    41.6220457,
-70.7284530,    41.7123454,
-70.7284430,    41.7193454
))

row.names(blocks)<-blockID

#Creating distance matrix
dis_matrix<-pointDistance(blocks,subjects,lonlat = TRUE)

###The above code doesnt preserve the row names. Is there a way to to do
that?

###I'm unsure about the below code
colnames(dis_matrix)<-row.names(subjects)
row.names(dis_matrix)<-row.names(blocks)

dis_data<-data.frame(dis_matrix)

###Finding nearst neighbor and coercing to usable format
getname <-function(x) {
row.names(dis_data[which.min(x),])
}

nn<-data.frame(lapply(dis_data,getname)) %>%
gather(key=subject,value=neighbor)

This code gives me output that makes sense but I'm unsure of the validity and efficiency. Any suggestion on how to improve and fix this code are appreciated. I also receive the error message:

Warning message:
attributes are not identical across measure variables;
they will be dropped

Which I can't determine the origin of.

Thanks for taking a look!

Body:
If you have a big dataset you might want to use the very efficient nabor package as explained by @user3507085 in this answer. Since the question is closed as off-topic I have copy-pasted the answer below, so it "stays alive" in this thread. I don't know if this is considered bad practice and I'm happy to delete/edit if requested (note the distances given by knn are not the geographical distances, but I guess they could be converted to spherical distances by a simple transformation including arcsin):

lonlat2xyz=function (lon, lat, r)
{
lon = lon * pi/180
lat = lat * pi/180
if (missing(r))
    r <- 6378.1
x <- r * cos(lat) * cos(lon)
y <- r * cos(lat) * sin(lon)
z <- r * sin(lat)
return(cbind(x, y, z))
}

lon1=runif(100,-180,180);lon2=runif(100,-180,180);lat1=runif(100,-90,90);lat2=runif(100,-90,90)

xyz1=lonlat2xyz(lon1,lat1)
xyz2=lonlat2xyz(lon2,lat2)

library(nabor)

out=knn(data=xyz1,query = xyz2,k=20)

library(maps)

map()
points(lon1,lat1,pch=16,col="black")
points(lon2[1],lat2[1],pch=16,col="red")
points(lon1[out$nn.idx[1,]],lat1[out$nn.idx[1,]],pch=16,col="blue")


问:
Unable to download .gz file with requests module
How do I properly download a .gz file? My code goes below:

```<code>import requests
response = requests.get('https://www.propertyshark.com/sitemap/CA-San-Bernardino-reports_1.xml.gz', headers=headers)
    print(response.status_code)
    if response.status_code == 200:
        print('Downloading...')
        file_name = 'file.xml.gz'
</code>```

It does download gz file but it's corrupted - only 1KB in size and when I try to unzip it adds .gz.cpgz in the file name.

答:
The URL you are using doesn't fetch you the right .gz file, because it is an HTML page in reality, which downloads the .gz file using JavaScript. Since it creates a blank page, it looks like its the raw file hosted there but doesn't isn't actually like it.

I verified this by opening the page and inspecting its elements. This could be easily the case if the site uses some middleware to generate the .gz file on frontend.

If you can reach the developer for the site, you can get a custom path opened for you. Else, you may have to look into opening the URL with selenium and then download automatically.

It gets saved as a .gz file in your code right now, only because you provide that name explicitly - file_name = 'file.xml.gz'. FWIW, on linux, you can easily rename files of one extension to another.

Body:
How do I properly download a .gz file? My code goes below:

import requests
response = requests.get('https://www.propertyshark.com/sitemap/CA-San-Bernardino-reports_1.xml.gz', headers=headers)
    print(response.status_code)
    if response.status_code == 200:
        print('Downloading...')
        file_name = 'file.xml.gz'

It does download gz file but it's corrupted - only 1KB in size and when I try to unzip it adds .gz.cpgz in the file name.


问:
What can't be done in CSS yet?
A while ago I was trying to figure out a way of doing this without using a table layout:

```<code><table>
  <tr><td rowspan="2">Left column</td></tr>
  <tr><td>Right Top</td><td>Right bottom</td></tr>
</table>
</code>```

Eventually I gave up and decided that it's impossible to do without tables (okay, CSS 3 might be able to, but waiting another 5-10 years isn't practical).

Has anyone got more examples like this? (Or even better, can you show me I was wrong?)

答:
There are lots of other ways to make a table-like layout. There are even CSS tables. Really, there's never a reason to use a table for layout. Ever.

Something which can't be done at the moment is proper text-align: justify; The hyphenation doesn't work properly, but with the use of soft-hyphens you can make it behave quite appropriately I expect.

ContentLicense: CC BY-SA 2.5

Title: What can't be done in CSS yet?

Body:
A while ago I was trying to figure out a way of doing this without using a table layout:

Left column

Right Top	Right bottom

Eventually I gave up and decided that it's impossible to do without tables (okay, CSS 3 might be able to, but waiting another 5-10 years isn't practical).

Has anyone got more examples like this? (Or even better, can you show me I was wrong?)

OwnerDisplayName: dylanfm


问:
How reliable is the netnamedpipebinding infinite receiveTimeout?
I have a duplex WCF service that relies on a consistent named pipe connection between the service and the client. It's sort of a publish/subscribe system where the client calls Subscribe on the service and gets put in a subscription list. Then, the service calls certain update methods of its own, which will push the update to the client(s) via callbacks.

I've set the recieveTimeout for the netnamedpipebinding to "infinite." Can I reasonably rely on this connection to be open forever? More importantly, are there situations where the channel will fault outside of timeouts?

Since a named pipe is just a shared memory location, I can't think of many reasons why it would fail consistently besides hardware problems. Furthermore, there isn't much of a way of guaranteeing the connection outside of pinging at a certain interval.

On a side note, my gut feel is to avoid also making the client a WCF service. I know it's not a real circular dependency, but it just feels icky. However, I'm open to people telling me I'm just being paranoid and that that kind of pattern is a-okay.

答:
You can never rely on the connection. Single unhandled exception / fault on the service will close the channel. I think you should handle Closed and Faulted events on client or implement pinging mechanism with proxy recreation and resubscribtion.

When using duplex communication you simply need the client to expose contract - it is not the same as exposing the service because client do not expose an endpoint. The communication is performed by single channel created from client to service because Named pipes are duplex by design. Every time you will want to have duplex communication over some transport you will need some handling code on the client.


问:
Particular layout above Soft Keyboard
I have a layout, code below

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

    <EditText
        android:id="@+id/et_question"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@color/white" />

    <LinearLayout
        android:id="@+id/ll_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <!--some stuff here-->

    </LineaLayout>

    <LinearLayout
        android:id="@+id/ll_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <!--some stuff here-->

    </LineaLayout>

</LinearLayout>
</code>```

In the above layout, when the keyboard gets visible, I want layout ll_1 to go above soft keyboard but layout ll_2 shouldn't.

答:
Can you try Relativelayout instead of Linearlayout?
Like this.

```<code><Relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--If it is at the top. If not, delete the alignParentTop feature.-->
    <EditText
        android:id="@+id/et_question"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@color/white" />

    <RelativeLayout
        android:id="@+id/ll_1"
        android:layout_width="match_parent"
        android:layout_below="@+id/et_question"
        android:layout_height="wrap_content">

        <!--some stuff here-->

    </RelativeLayout>

    <!--If it is at the top. If not,delete the alignParentBottom feature.-->
    <RelativeLayout
        android:id="@+id/ll_2"
        android:layout_width="match_parent"
        android:layout_below="@+id/ll_1"
        android:layout_alignParentBottom="true"
        android:layout_height="wrap_content">

        <!--some stuff here-->

    </RelativeLayout>

</Relativelayout>
</code>```

If you don't mind, firstly try using android:layout_alignParentBottom="true" on ll_2.

Title: Particular layout above Soft Keyboard

Body:
I have a layout, code below

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <EditText
        android:id="@+id/et_question"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@color/white" />

    <LinearLayout
        android:id="@+id/ll_1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

    </LineaLayout>

    <LinearLayout
        android:id="@+id/ll_2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

    </LineaLayout>

</LinearLayout>

In the above layout, when the keyboard gets visible, I want layout ll_1 to go above soft keyboard but layout ll_2 shouldn't.

Body:
Can you try Relativelayout instead of Linearlayout?
Like this.

<Relativelayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!--If it is at the top. If not, delete the alignParentTop feature.-->
    <EditText
        android:id="@+id/et_question"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="@color/white" />

    <RelativeLayout
        android:id="@+id/ll_1"
        android:layout_width="match_parent"
        android:layout_below="@+id/et_question"
        android:layout_height="wrap_content">

        <!--some stuff here-->

    </RelativeLayout>

    <!--If it is at the top. If not,delete the alignParentBottom feature.-->
    <RelativeLayout
        android:id="@+id/ll_2"
        android:layout_width="match_parent"
        android:layout_below="@+id/ll_1"
        android:layout_alignParentBottom="true"
        android:layout_height="wrap_content">

        <!--some stuff here-->

    </RelativeLayout>

</Relativelayout>

If you don't mind, firstly try using android:layout_alignParentBottom="true" on ll_2.


问:
How to change Value dynamically in @GET annotation?
I am using Retrofit for download APK file from the server.

Below is code snippet.

```<code>Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Util.APK_DOWNLOAD_URL)
                .build();

        RetrofitInterface retrofitInterface = retrofit.create(RetrofitInterface.class);

        Call<ResponseBody> request = retrofitInterface.downloadFile();
        try {

            downloadFile(request.execute().body());

        } catch (IOException e) {

            e.printStackTrace();
            Toast.makeText(getApplicationContext(),e.getMessage(), Toast.LENGTH_SHORT).show();

        }
</code>```

And

```<code>public interface RetrofitInterface {

    @GET("development/filename.apk")
    @Streaming
    Call<ResponseBody> downloadFile();
}
</code>```

But there is problem.

Download APK is always different.
So

How can I set Some public static String in

```<code>@GET(Utils.APK_FILE_NAME)
</code>```

And in my Utils class

```<code>public static String APK_FILE_NAME = ""
</code>```

Currently I am getting

Attribute Value Must be Constant

答:
you can use @Path annotation for example:

```<code>@GET("development/{filename}")
@Streaming
Call<ResponseBody> downloadFile(@Path("filename") String filename;
</code>```

and

```<code>String filename;
Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Util.APK_DOWNLOAD_URL)
                .build();

        RetrofitInterface retrofitInterface = retrofit.create(RetrofitInterface.class);

        Call<ResponseBody> request = retrofitInterface.downloadFile(filename);
        try {

            downloadFile(request.execute().body());

        } catch (IOException e) {

            e.printStackTrace();
            Toast.makeText(getApplicationContext(),e.getMessage(), Toast.LENGTH_SHORT).show();

        }
</code>```

Body:
I am using Retrofit for download APK file from the server.

Below is code snippet.

Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Util.APK_DOWNLOAD_URL)
                .build();

        RetrofitInterface retrofitInterface = retrofit.create(RetrofitInterface.class);

        Call<ResponseBody> request = retrofitInterface.downloadFile();
        try {

            downloadFile(request.execute().body());

        } catch (IOException e) {

            e.printStackTrace();
            Toast.makeText(getApplicationContext(),e.getMessage(), Toast.LENGTH_SHORT).show();

        }

And

public interface RetrofitInterface {

    @GET("development/filename.apk")
    @Streaming
    Call<ResponseBody> downloadFile();
}

But there is problem.

Download APK is always different.
So

How can I set Some public static String in

@GET(Utils.APK_FILE_NAME)

And in my Utils class

public static String APK_FILE_NAME = ""

Currently I am getting

Attribute Value Must be Constant

Body:
you can use @Path annotation for example:

@GET("development/{filename}")
@Streaming
Call<ResponseBody> downloadFile(@Path("filename") String filename;

and

String filename;
Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(Util.APK_DOWNLOAD_URL)
                .build();

        RetrofitInterface retrofitInterface = retrofit.create(RetrofitInterface.class);

        Call<ResponseBody> request = retrofitInterface.downloadFile(filename);
        try {

            downloadFile(request.execute().body());

        } catch (IOException e) {

            e.printStackTrace();
            Toast.makeText(getApplicationContext(),e.getMessage(), Toast.LENGTH_SHORT).show();

        }


问:
How to restore own nuget package in another solution
I have C# solution called commons where I have my Model and some common stuff that will be used by other solutions.

As a Post Build Event I create a nuget package and copy it to my local Nuget folder ("C:\packages")

Post Build Event:

"$(ProjectDir)nuget.exe" pack "$(ProjectDir)Commons.csproj" -
IncludeReferencedProjects

xcopy Commons.1.0.0.nupkg c:\packages /Y

Note: Version never changes.

That creates successfully my new nuget package.

Then on the other solution I reference that package and I can see everything ok.
I can access all my models and everything.

The problem I have is

if I make any change to my Common projects (e.g add a new field to my model) this will not appear on my solution.

What am I missing??

答:
if I make any change to my Common projects (e.g add a new field to my model) this will not appear on my solution.

Long story.

To resolve this issue, you should make sure two points, re-pack the package and re-install the re-packed to the solution after change your Commons project.

1. Re-pack the package:

After make some change to the Commons projects, you should re-pack the nuget package. For your situation, you should rebuild the Commons project to generate the new nuget package.

Besides, whether you need to change the version number depends on your own requirement, we recommend to change the version number before you want to publish a new nuget package.

To accomplish this, modify the AssemblyVersion in the AssemblyInfo.cs file before you publish the new version nuget package. For example,

```<code>[assembly: AssemblyVersion("1.0.0.1")]
</code>```

After build, you will get the nuget package Commons.1.0.0.1.nupkg in the bin folder, you can use wildcard * in your copy command to copy package to c:\packages:

```<code>xcopy.exe /y "$(ProjectDir)$(OutDir)Commons.*.nupkg" "c:\packages"
</code>```

If you do not want to change the version, you do not need to do more things in the point.

2. Re-install the re-packed to the solution:

After re-pack the nuget package, you need to replace the old nuget package with the new one in the packages source.

Need to point out that the command Update-Package Commons -reinstall will NOT re-install the new version package.

Because when you use this command to re-install nuget package, nuget will check the packages folder if exists that package Commons.1.0.0.nupkg, if it exists, nuget will not restore the nuget package, so nuget will not to re-download the new version package in the package source. So Nuget still re-install the old package. That is the reason why you got the problem.

To resolve this issue, you need to delete the package in the packages folder, then execute the re-install command to re-install the package. Or you can uninstall the package first, then re-install it.

One more things, if you then use a different version of the package, you can use update package directly to install the new version package, not need to pay attention to delete package/uninstall first.

Hope this is clear.

Body:
if I make any change to my Common projects (e.g add a new field to my model) this will not appear on my solution.

Long story.

To resolve this issue, you should make sure two points, re-pack the package and re-install the re-packed to the solution after change your Commons project.

1. Re-pack the package:

After make some change to the Commons projects, you should re-pack the nuget package. For your situation, you should rebuild the Commons project to generate the new nuget package.

Besides, whether you need to change the version number depends on your own requirement, we recommend to change the version number before you want to publish a new nuget package.

To accomplish this, modify the AssemblyVersion in the AssemblyInfo.cs file before you publish the new version nuget package. For example,

[assembly: AssemblyVersion("1.0.0.1")]

After build, you will get the nuget package Commons.1.0.0.1.nupkg in the bin folder, you can use wildcard * in your copy command to copy package to c:\packages:

xcopy.exe /y "$(ProjectDir)$(OutDir)Commons.*.nupkg" "c:\packages"

If you do not want to change the version, you do not need to do more things in the point.

2. Re-install the re-packed to the solution:

After re-pack the nuget package, you need to replace the old nuget package with the new one in the packages source.

Need to point out that the command Update-Package Commons -reinstall will NOT re-install the new version package.

Because when you use this command to re-install nuget package, nuget will check the packages folder if exists that package Commons.1.0.0.nupkg, if it exists, nuget will not restore the nuget package, so nuget will not to re-download the new version package in the package source. So Nuget still re-install the old package. That is the reason why you got the problem.

To resolve this issue, you need to delete the package in the packages folder, then execute the re-install command to re-install the package. Or you can uninstall the package first, then re-install it.

One more things, if you then use a different version of the package, you can use update package directly to install the new version package, not need to pay attention to delete package/uninstall first.

Hope this is clear.


问:
AngularJS, need help creating a simple function
I would like to understand how to do the following, they asked me to try and create a function in the controller instead of writing the code in the view.

The code is:

```<code> <div class="row">
                <div class="col-xs-12 max300"
                     uib-dropdown is-open="vm.descriptionDropdownOpen">
                    <textarea name="description" class="form-control"
                              ng-model="vm.presence.description"
                              ng-click="vm.toggleDescriptionDropdown()"
                              autofocus>
                    </textarea>
                    <ul id="descriptionDropdown" uib-dropdown-menu>
                        <li ng-repeat="descr in vm.loadedDescriptions"
                            ng-click="vm.presence.description = descr.text;
                                      vm.descriptionDropdownOpen = false;">
                            {{descr.text}}
                        </li>
                    </ul>
                </div>
            </div>
</code>```

so basically this creates a text box, and when you click on it, a dropdown menu will appear, and if you click on a string of the dropdown menu, that string will be put in the text box.

What I need to do is to create a function that will be put in the controller, so we can just call that function in the view and keep the code nicer.

This function just needs to do the last part of the code I posted above, take the string I click on from the dropdown menu and put it in the text box!

It's really simple but as I'm learning I'm not that sure on how I should write it

```<code>setDescription(text: string) {
        // code should go here.
}
</code>```

Sorry for this stupid question, just wanna be sure to understand correctly what I am doing! thank you

答:
resolved like this: </p>

```<code>setDescription(text: string) {
       return this.presence.description = text;
}
</code>```

Body:
I would like to understand how to do the following, they asked me to try and create a function in the controller instead of writing the code in the view.

The code is:

                    <textarea name="description" class="form-control"
                              ng-model="vm.presence.description"
                              ng-click="vm.toggleDescriptionDropdown()"
                              autofocus>
                    </textarea>

                            {{descr.text}}

so basically this creates a text box, and when you click on it, a dropdown menu will appear, and if you click on a string of the dropdown menu, that string will be put in the text box.

What I need to do is to create a function that will be put in the controller, so we can just call that function in the view and keep the code nicer.

This function just needs to do the last part of the code I posted above, take the string I click on from the dropdown menu and put it in the text box!

It's really simple but as I'm learning I'm not that sure on how I should write it

setDescription(text: string) {
        // code should go here.
}

Sorry for this stupid question, just wanna be sure to understand correctly what I am doing! thank you

Body:
resolved like this:

setDescription(text: string) {
       return this.presence.description = text;
}


问:
LoadError for dotenv/load while Dotenv.load works
I want to use dotenv in pure ruby environments. I mean I'm not using Rails.

The github instruction says there are two ways for loading the variables.

```<code>require 'dotenv/load'

# or
require 'dotenv'
Dotenv.load
</code>```

In my environments the latter way works, but `require 'dotenv/load' raises the this error:

```<code>LoadError: cannot load such file -- dotenv/load
</code>```

I gonna use Dotenv.load if former way doesn't work, but I want to know the reason of the error.

I'm using ruby 2.3.3p222 and dotenv (2.1.1).
What am I doing wrong?

Additional Info

I'm using bundle exec pry and `load 'myapp.rb'.
When I load the script I get the error.

答:
'dotenv/load' is implemented from 2.1.2 or 2.2.0.

To upgrade the dotenv gem is needed.

Body:
I want to use dotenv in pure ruby environments. I mean I'm not using Rails.

The github instruction says there are two ways for loading the variables.

require 'dotenv/load'

# or
require 'dotenv'
Dotenv.load

In my environments the latter way works, but `require 'dotenv/load' raises the this error:

LoadError: cannot load such file -- dotenv/load

I gonna use Dotenv.load if former way doesn't work, but I want to know the reason of the error.

I'm using ruby 2.3.3p222 and dotenv (2.1.1).
What am I doing wrong?

Additional Info

I'm using bundle exec pry and `load 'myapp.rb'.
When I load the script I get the error.


问:
Attempting to append two Pandas DataFrames within a loop causes the first to be overwritten
I have this function that (among other things) is supposed to read a baseball matches csv file create a list of all the teams (this part works). The file has away match data and home match data, the idea is to split the data change the columns and lastly append the matches data regardless of location (this last part does not work). Instead of appending my away and home games into one dataframe the code overwrites the home games entirely.

I have attached my code along with the question.

Thank you so much for all your help.

```<code>df = pd.read_csv('C:\\Users\\data.csv', index_col=0)

unique = df['Team Home'].unique()
inplace = ['H', 'A']
myway = pd.DataFrame()
for i in range(len(unique)):
    for inp in inplace:
        if inp == 'H':    #loop to find column names with 'Home' and 'Away' Labels
            located = 'Home'
            character = 'H'
        else:
            located = 'Away'
            character = 'A'
        noseclean_h = df[df['Team {}'.format(located)].isin([unique[i]])]
        noseclean_h = noseclean_h.sort_values('Date')
        home = [rr for rr in rolling_haiting if character in rr]
        new_home = [rr.replace('{}'.format(located), '').strip() if character in rr and len(rr) > 2
                    else rr.replace(character, '') for rr in home]
        new_home.append('Date')
        new_home.append('Team')
        home.append('Date')
        home.append('Team {}'.format(located))
        ncleaned = ncleaned[home]
        d = dict(zip(home, new_home))
        ncleaned .rename(columns=d, inplace=True)
        nosecleaned_h['Date'] = pd.to_datetime(ncleaned ['Date'])
        nosecleaned_h.set_index('Date', inplace=True) # set index to date to prevent overlapping
        nosecleaned_h = nosecleaned_h.append(nosecleaned_h, ignore_index=False)
    print(nosecleaned_h)
....etc
</code>```

答:
On each loop, you are reassigning the variable noseclean_h:

```<code>noseclean_h = df[df['Team {}'.format(located)].isin([unique[i]])]
</code>```

Then, on each loop the nosecleaned_h = nosecleaned_h.append(nosecleaned_h, ignore_index=False) is replaced.

Body:
I have this function that (among other things) is supposed to read a baseball matches csv file create a list of all the teams (this part works). The file has away match data and home match data, the idea is to split the data change the columns and lastly append the matches data regardless of location (this last part does not work). Instead of appending my away and home games into one dataframe the code overwrites the home games entirely.

I have attached my code along with the question.

Thank you so much for all your help.

df = pd.read_csv('C:\\Users\\data.csv', index_col=0)

unique = df['Team Home'].unique()
inplace = ['H', 'A']
myway = pd.DataFrame()
for i in range(len(unique)):
    for inp in inplace:
        if inp == 'H':    #loop to find column names with 'Home' and 'Away' Labels
            located = 'Home'
            character = 'H'
        else:
            located = 'Away'
            character = 'A'
        noseclean_h = df[df['Team {}'.format(located)].isin([unique[i]])]
        noseclean_h = noseclean_h.sort_values('Date')
        home = [rr for rr in rolling_haiting if character in rr]
        new_home = [rr.replace('{}'.format(located), '').strip() if character in rr and len(rr) > 2
                    else rr.replace(character, '') for rr in home]
        new_home.append('Date')
        new_home.append('Team')
        home.append('Date')
        home.append('Team {}'.format(located))
        ncleaned = ncleaned[home]
        d = dict(zip(home, new_home))
        ncleaned .rename(columns=d, inplace=True)
        nosecleaned_h['Date'] = pd.to_datetime(ncleaned ['Date'])
        nosecleaned_h.set_index('Date', inplace=True) # set index to date to prevent overlapping
        nosecleaned_h = nosecleaned_h.append(nosecleaned_h, ignore_index=False)
    print(nosecleaned_h)
....etc

Body:
On each loop, you are reassigning the variable noseclean_h:

noseclean_h = df[df['Team {}'.format(located)].isin([unique[i]])]

Then, on each loop the nosecleaned_h = nosecleaned_h.append(nosecleaned_h, ignore_index=False) is replaced.


问:
Call php file with js script with ajax
I have working code but my code doesn't include with ajax js code from php file. Problem is that javascript from second script is not working. Ajax call can't enable to execute js script from second file Here is ajax code. My question is this good call for php file with working js functions because those working js functions does't work if I call them with this ajax code?</p>

```<code><script>$.ajax({
                                url: "getSubcategorieFormUpdate.php?id=" + activeSubcategorie + "&sifra_novogradnja=<?php echo $sifra_novogradnja ?>",
                                method: "GET",
                                dataType: 'text',
                                success: function (result) {                                     document.getElementById("advertForm").innerHTML = result;
                                }
                            });</script>
</code>```

答:
I'm not sure if I understood your question properly, but if I did, then no. You shouldn't insert javascript code to php file which you are calling through javascript.

If you want to call ajax twice just do it in javascript file.

```<code>$.ajax({
    url: "yourUrl.php",
    method: "GET",
    data: {id: 'id'},
    success: function(data) {
        $.ajax({
            url: "getSubcategorieFormUpdate.php?id=" + activeSubcategorie + "&sifra_novogradnja=" + data.sifra_novogradnja,
            method: "GET",
            dataType: 'text',
            success: function(result) {
                document.getElementById("advertForm").innerHTML = result;
            }
        });
    }
});
</code>```

If it's not what you wanted then please specify what did I misunderstand :)

Regards, KJ

Title: Call php file with js script with ajax

Body:
I'm not sure if I understood your question properly, but if I did, then no. You shouldn't insert javascript code to php file which you are calling through javascript.

If you want to call ajax twice just do it in javascript file.

$.ajax({
    url: "yourUrl.php",
    method: "GET",
    data: {id: 'id'},
    success: function(data) {
        $.ajax({
            url: "getSubcategorieFormUpdate.php?id=" + activeSubcategorie + "&sifra_novogradnja=" + data.sifra_novogradnja,
            method: "GET",
            dataType: 'text',
            success: function(result) {
                document.getElementById("advertForm").innerHTML = result;
            }
        });
    }
});

If it's not what you wanted then please specify what did I misunderstand :)

Regards, KJ


问:
Use program parameters for graph drawing - TI92+
I have a problem with a program on my TI92+.
It does work without a problem on a TI92, though.

I want to draw a graph, that I enter as a program argument, e.g. test(x^2)

Program goes like this:

```<code>test(var1)
Prgm
var1->k
k->y1(x)
ZoomStd
setMode("split 1 app","graph"):Pause
EndPrgm
</code>```

On the TI92 it shows me a simple x^2 function, on the TI92+ I get "Undefined Variable" as an error message. Interestingly enough, when I enter "k" on the home screen, I get x^2 as an output. So the variable is there.

I am in the main folder and this happens with a reset calculator as well.

I understand that TI changed something about the variables between TI92 and TI92+, you can have local variables, but this is no local variable.

And finally: this is just a test program I am using to demonstrate my problem, of course I know I could just type x^2 into the y= editor and hey presto. But a program I have written years ago doesn't work and I would like to know, why and where I have to change something.

答: If you look at the Y= Editor, does it display y1=k? On my TI-89 Titanium (which I understand uses similar software), k→y1(x) literally stores k to y1. This is a problem since it tries to substitute all instances of x in y1 (of which there are none) with the value passed to y1. Then, since k is an expression type, not a number, the calculator refuses to graph it. I'm still trying to find a work around for this.

Body:
I have a problem with a program on my TI92+.
It does work without a problem on a TI92, though.

I want to draw a graph, that I enter as a program argument, e.g. test(x^2)

Program goes like this:

test(var1)
Prgm
var1->k
k->y1(x)
ZoomStd
setMode("split 1 app","graph"):Pause
EndPrgm

On the TI92 it shows me a simple x^2 function, on the TI92+ I get "Undefined Variable" as an error message. Interestingly enough, when I enter "k" on the home screen, I get x^2 as an output. So the variable is there.

I am in the main folder and this happens with a reset calculator as well.

I understand that TI changed something about the variables between TI92 and TI92+, you can have local variables, but this is no local variable.

And finally: this is just a test program I am using to demonstrate my problem, of course I know I could just type x^2 into the y= editor and hey presto. But a program I have written years ago doesn't work and I would like to know, why and where I have to change something.


问:
introduction to latex
what's a good website that has an introduction to latex for window users? I will be using it mainly to write math homework problems and probably then converting it to a PDF to print out. I'm hoping somebody has bookmarked a good link already so I don't have to search. Thanks!</p>

答:
The LaTeX Community site doesn't seem to have any beginner tutorials, but it does have a number of articles that go into specific uses. If one of those articles covers what you're trying to do, then it may give you a headstart.

Outside tutorials, as a beginner getting into LaTeX, I found the TeXnicCenter Open Source IDE to be very useful. It makes life a lot easier when you get some syntax colouring and templates to help with common structures like tables.

Title: introduction to latex


答:
one way to pass string is using @Path annotation:

```<code>public interface RetrofitInterface {
  @GET("{APK_FILE_NAME}")
  Call<Users> getUsers(@Path(value = "APK_FILE_NAME", encoded = true) String apk_file_name);
}
</code>```

For more detail use following link,
https://square.github.io/retrofit/2.x/retrofit/index.html?retrofit2/http/Path.html

Title: How to change Value dynamically in @GET annotation?

Body:
one way to pass string is using @Path annotation:

public interface RetrofitInterface {
  @GET("{APK_FILE_NAME}")
  Call<Users> getUsers(@Path(value = "APK_FILE_NAME", encoded = true) String apk_file_name);
}

For more detail use following link,
https://square.github.io/retrofit/2.x/retrofit/index.html?retrofit2/http/Path.html


问:
Running K8s cluster from Gitlab-runner on Openshift
Currently I have a Kubernetes cluster prepared for using it with Gitlab-runner and its kubernetes executor and I want to use it from a different Openshift cluster, so I have two different and separated clusters.

I am currently running the Gitlab-runner image on an Openshift pod with a config.toml like this, following the docs in https://docs.gitlab.com/runner/executors/kubernetes.html#connecting-to-the-kubernetes-api:

```<code>concurrent = 1
check_interval = 10
[[runners]]
  name = "size-XL"
  url = "https://blablabla/ci"
  token = "blablabla"
  executor = "kubernetes"
  [runners.kubernetes]
    namespace = "gitlab"
    privileged = false
    host= "https://blablabla:6443"
    cert_file= "/etc/ssl/certs/cert.pem"
    key_file= "/etc/ssl/certs/key.pem"
    ca_keyfile= "/etc/ssl/certs/ca.pem"
    cpu_limit = "4"
    memory_limit = "6Gi"
    service_cpu_limit = "1"
    service_memory_limit = "2Gi"
    helper_cpu_limit = "2"
    helper_memory_limit = "2Gi"
    cpu_request = "1"
    memory_request = "2Gi"
    service_cpu_request = "250Mi"
    service_memory_request = "512Mi"
    helper_cpu_request = "250Mi"
    helper_memory_request = "512Mi"
    service-account = "test"
    service_account_overwrite_allowed = ".*"
    image = "blablabla"
</code>```

My problem is that even if it is able to connect to the K8s cluster and start picking jobs, any time it does, I get this:

```<code>Checking for jobs... received                       job=17311 repo_url=https://blablabla.git runner=c36ccf98
WARNING: Preparation failed: error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth  job=17311 project=3128 runner=c36ccf98
Will be retried in 3s ...                           job=17311 project=3128 runner=c36ccf98
WARNING: Preparation failed: error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth  job=17311 project=3128 runner=c36ccf98
Will be retried in 3s ...                           job=17311 project=3128 runner=c36ccf98
WARNING: Preparation failed: error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth  job=17311 project=3128 runner=c36ccf98
Will be retried in 3s ...                           job=17311 project=3128 runner=c36ccf98
ERROR: Job failed (system failure): error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth job=17311 project=3128 runner=c36ccf98
</code>```

I had no luck, any idea?

答:
```<code>ca_keyfile= "/etc/ssl/certs/ca.pem"
</code>```

was in fact the problem. because it is just ca_file instead of ca_keyfile

Body:
Currently I have a Kubernetes cluster prepared for using it with Gitlab-runner and its kubernetes executor and I want to use it from a different Openshift cluster, so I have two different and separated clusters.

I am currently running the Gitlab-runner image on an Openshift pod with a config.toml like this, following the docs in https://docs.gitlab.com/runner/executors/kubernetes.html#connecting-to-the-kubernetes-api:

concurrent = 1
check_interval = 10
[[runners]]
  name = "size-XL"
  url = "https://blablabla/ci"
  token = "blablabla"
  executor = "kubernetes"
  [runners.kubernetes]
    namespace = "gitlab"
    privileged = false
    host= "https://blablabla:6443"
    cert_file= "/etc/ssl/certs/cert.pem"
    key_file= "/etc/ssl/certs/key.pem"
    ca_keyfile= "/etc/ssl/certs/ca.pem"
    cpu_limit = "4"
    memory_limit = "6Gi"
    service_cpu_limit = "1"
    service_memory_limit = "2Gi"
    helper_cpu_limit = "2"
    helper_memory_limit = "2Gi"
    cpu_request = "1"
    memory_request = "2Gi"
    service_cpu_request = "250Mi"
    service_memory_request = "512Mi"
    helper_cpu_request = "250Mi"
    helper_memory_request = "512Mi"
    service-account = "test"
    service_account_overwrite_allowed = ".*"
    image = "blablabla"

My problem is that even if it is able to connect to the K8s cluster and start picking jobs, any time it does, I get this:

Checking for jobs... received                       job=17311 repo_url=https://blablabla.git runner=c36ccf98
WARNING: Preparation failed: error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth  job=17311 project=3128 runner=c36ccf98
Will be retried in 3s ...                           job=17311 project=3128 runner=c36ccf98
WARNING: Preparation failed: error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth  job=17311 project=3128 runner=c36ccf98
Will be retried in 3s ...                           job=17311 project=3128 runner=c36ccf98
WARNING: Preparation failed: error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth  job=17311 project=3128 runner=c36ccf98
Will be retried in 3s ...                           job=17311 project=3128 runner=c36ccf98
ERROR: Job failed (system failure): error connecting to Kubernetes: ca file, cert file and key file must be specified when using file based auth job=17311 project=3128 runner=c36ccf98

I had no luck, any idea?

Body:
ca_keyfile= "/etc/ssl/certs/ca.pem"

was in fact the problem. because it is just ca_file instead of ca_keyfile


问:
Unity: How to replace placeholder game objects with real artwork?
I have created temporary primitives while I wait for art and animation to be completed.

I was wondering what the best way of achieving this?

I presume I create a primitive, should I child it in an empty game object? Or create a prefab.?

Does anyone use placeholder animation that would be replaced later?

I tried searching for some recommendations or tutorials but couldn't find any.

答:
Yes just create a prefab. then update it once you have the right asset. please see the link below.

URL:
https://docs.unity3d.com/400/Documentation/Manual/Prefabs.html
https://www.youtube.com/watch?v=vzjWzUENGzQ

ContentLicense: CC BY-SA 4.0


问:
./bin/istioctl context-create segmentation fault
I'm following this guide of installing istio https://istio.io/docs/setup/consul/quick-start.html

At step 7, I noticed that pilot terminates after I run  docker-compose -f install/consul/istio.yaml up -d

So I ran istioctl context-create.
And I got a seg fault:

./bin/istioctl context-create
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x1debb79]

goroutine 1 [running]:
main.getDefaultNamespace(0xc42021c620, 0x20, 0x0, 0x0)
    /home/sebastienvas/go/src/istio.io/pilot/cmd/istioctl/main.go:700 +0x99
main.glob..func4(0x2892960, 0x28be4b8, 0x0, 0x0)
    /home/sebastienvas/go/src/istio.io/pilot/cmd/istioctl/main.go:86 +0x39
istio.io/pilot/vendor/github.com/spf13/cobra.(*Command).execute(0x2892960, 0x28be4b8, 0x0, 0x0, 0x2892960, 0x28be4b8)
    /home/sebastienvas/go/src/istio.io/pilot/vendor/github.com/spf13/cobra/command.go:637 +0x549
istio.io/pilot/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x2891760, 0x1df15f3, 0x0, 0x0)
    /home/sebastienvas/go/src/istio.io/pilot/vendor/github.com/spf13/cobra/command.go:729 +0x339
istio.io/pilot/vendor/github.com/spf13/cobra.(*Command).Execute(0x2891760, 0x0, 0x154)
    /home/sebastienvas/go/src/istio.io/pilot/vendor/github.com/spf13/cobra/command.go:688 +0x2b
main.main()
    /home/sebastienvas/go/src/istio.io/pilot/cmd/istioctl/main.go:531 +0xc0

I upgraded to the latest go version:
go version
go version go1.9.2 darwin/amd64
And still the same issue

I would really appreciate if anyone could help me with this.

答: The fix to the problem appear in the release of 0.3.1. Meanwhile, you can just copy https://github.com/istio/istio/tree/master/install/consul/kubeconfig into your install/consul directory.</p>


问:
How to preview PDF file in internet explorer in MVC Web Application
I require to preview PDF file stored in database. In Chrome its working fine but when i do it in IE it gets downloaded. Reason may be due to below code:

Javascript Method:

```<code>if (navigator.appVersion.toString().indexOf('.NET') > 0) {
    console.log(response._body);
    window.navigator.msSaveBlob(response._body, obj.documentName);
}
</code>```

Controller Method:

```<code>[HttpGet]
public FileResult DownLoadFile(int id)
{
    List<FileDetailsModel> ObjFiles = GetFileList();
    var FileById = (from FC in ObjFiles
                    where FC.Id.Equals(id)
                    select new { FC.FileName, FC.FileContent }).ToList().FirstOrDefault();
     return File(FileById.FileContent, "application/pdf", FileById.FileName);
}
</code>```

So is there way by which we can preview PDF file as all files are in PDF format in database.

答:
A solution (that is surely not the best because iframe are deprecated) would be make an intermediate page framed to occupy 100% of parent page like :</p>

```<code><html>
    <body>
        <iframe src="@Url.Action("DownLoadFile", new {id = 1})" width="100%" height="100%" />
    </body>
</html>
</code>```

Body:
I require to preview PDF file stored in database. In Chrome its working fine but when i do it in IE it gets downloaded. Reason may be due to below code:

Javascript Method:

if (navigator.appVersion.toString().indexOf('.NET') > 0) {
    console.log(response._body);
    window.navigator.msSaveBlob(response._body, obj.documentName);
}

Controller Method:

[HttpGet]
public FileResult DownLoadFile(int id)
{
    List<FileDetailsModel> ObjFiles = GetFileList();
    var FileById = (from FC in ObjFiles
                    where FC.Id.Equals(id)
                    select new { FC.FileName, FC.FileContent }).ToList().FirstOrDefault();
     return File(FileById.FileContent, "application/pdf", FileById.FileName);
}

So is there way by which we can preview PDF file as all files are in PDF format in database.

Body:
A solution (that is surely not the best because iframe are deprecated) would be make an intermediate page framed to occupy 100% of parent page like :

<html>
    <body>
        <iframe src="@Url.Action("DownLoadFile", new {id = 1})" width="100%" height="100%" />
    </body>
</html>


问:
Prolog - Find path and its distance between nodes in a graph with passing through all the nodes
I am kind of new to prolog and I quite don't understand why this code doesn't work, so I want to find a path and its distance with passing through all the nodes just one time and then returning to the first node here is what I did:

```<code>distance(a,b,5).
distance(b,a,5).
distance(a,c,3).
distance(c,a,3).
distance(c,b,2).
distance(b,c,2).

head([H|List],H).
tail([H|List],List).
%Finding the Cycle
  cycle(Node,Cycle) :-
      distance(Node,Next,D),
      cycle(Node,Next,[Node],Cycle).

  cycle(Curr,Curr,Visited,Cycle) :-
      reverse([Curr|Visited],Cycle).
  cycle(Node,Curr,Visited,Cycle) :-
      \+ member(Curr,Visited),
      distance(Curr,Next,D),
      cycle(Node,Next,[Curr|Visited],Cycle).

    %Finding all the possible paths
    find(Start,Cycle):-findall(Z,cycle(Start,Z),Cycle).

    %Selecting only the cycles that contains all the nodes
    path(Start,Cycle,DT):-find(Start,List),
                        path(Start,Cycle,DT,List).
    path(Start,Cycle,DT,List):-head(List,Cycle),
                            tail(List,T),
                            distanceC(Cycle,DT),
                            pathL(Cycle),
                            path(Start,Cycle,DT,T).
%Calculating the distance of a path
distanceC([_],0).
distanceC([X,Y|Rest],DT):-distance(X,Y,D1),distanceC([Y|Rest],DT1), DT is D1 + DT1.
pathL(H):-      length(H,Z),
                Z==3.
</code>```

path(Start,Cycle,DT,List) doesn't work when I start the Recursion

答:
One way to do that :

```<code>% We need to know all the nodes to visit
% For our purpose the first node is known
% So we remove it
all_the_nodes_but_Start(Nodes, Start) :-
    setof(A, B^C^distance(A,B,C), Nodes_h),
    select(Start, Nodes_h, Nodes).

% the predicate
circuit(Start, Distance, Path) :-
    % we fetch the nodes
    all_the_nodes_but_Start(Nodes, Start),
    % the working predicate
    circuit(Start, Nodes, Start, 0, Distance, [Start], Path).

% @Start : the first and last node to visit
% @Cur_Nodes : the rest of the nodes to visit
% @Current_Node : the node where we are at present
% @Cur_Dist : ... I think that the rest is clear
circuit(Start, Cur_Nodes, Current_Node, Cur_Dist, Distance, Cur_Path, Path) :-
    % we get a link
    distance(Current_Node, Next_Node, Len),
    % verify that it is not yet visited, getting the rest of nodes to visit
    select(Next_Node, Cur_Nodes, Rest_Nodes),
    % compute the distance
    Next_Dist is Len + Cur_Dist,
    %  compute the next step with a neq node in the current path
    circuit(Start, Rest_Nodes, Next_Node, Next_Dist, Distance, [Next_Node | Cur_Path], Path).

% When all the nodes are visited
circuit(Start, [], Current_Node, Cur_Dist, Distance, Cur_Path, Path) :-
    % get back home
    distance(Current_Node, Start, Len),
    Distance is Cur_Dist + Len,
    % getting the path
    reverse([Start | Cur_Path], Path).
</code>```

Now, we get :

```<code>?- circuit(a, Len, Path).
Len = 10,
Path = [a, b, c, a] ;
Len = 10,
Path = [a, c, b, a] ;
false.
</code>```

Body:
I am kind of new to prolog and I quite don't understand why this code doesn't work, so I want to find a path and its distance with passing through all the nodes just one time and then returning to the first node here is what I did:

distance(a,b,5).
distance(b,a,5).
distance(a,c,3).
distance(c,a,3).
distance(c,b,2).
distance(b,c,2).

head([H|List],H).
tail([H|List],List).
%Finding the Cycle
  cycle(Node,Cycle) :-
      distance(Node,Next,D),
      cycle(Node,Next,[Node],Cycle).

  cycle(Curr,Curr,Visited,Cycle) :-
      reverse([Curr|Visited],Cycle).
  cycle(Node,Curr,Visited,Cycle) :-
      \+ member(Curr,Visited),
      distance(Curr,Next,D),
      cycle(Node,Next,[Curr|Visited],Cycle).

    %Finding all the possible paths
    find(Start,Cycle):-findall(Z,cycle(Start,Z),Cycle).

    %Selecting only the cycles that contains all the nodes
    path(Start,Cycle,DT):-find(Start,List),
                        path(Start,Cycle,DT,List).
    path(Start,Cycle,DT,List):-head(List,Cycle),
                            tail(List,T),
                            distanceC(Cycle,DT),
                            pathL(Cycle),
                            path(Start,Cycle,DT,T).
%Calculating the distance of a path
distanceC([_],0).
distanceC([X,Y|Rest],DT):-distance(X,Y,D1),distanceC([Y|Rest],DT1), DT is D1 + DT1.
pathL(H):-      length(H,Z),
                Z==3.

path(Start,Cycle,DT,List) doesn't work when I start the Recursion

Body:
One way to do that :

% We need to know all the nodes to visit
% For our purpose the first node is known
% So we remove it
all_the_nodes_but_Start(Nodes, Start) :-
    setof(A, B^C^distance(A,B,C), Nodes_h),
    select(Start, Nodes_h, Nodes).

% the predicate
circuit(Start, Distance, Path) :-
    % we fetch the nodes
    all_the_nodes_but_Start(Nodes, Start),
    % the working predicate
    circuit(Start, Nodes, Start, 0, Distance, [Start], Path).

% @Start : the first and last node to visit
% @Cur_Nodes : the rest of the nodes to visit
% @Current_Node : the node where we are at present
% @Cur_Dist : ... I think that the rest is clear
circuit(Start, Cur_Nodes, Current_Node, Cur_Dist, Distance, Cur_Path, Path) :-
    % we get a link
    distance(Current_Node, Next_Node, Len),
    % verify that it is not yet visited, getting the rest of nodes to visit
    select(Next_Node, Cur_Nodes, Rest_Nodes),
    % compute the distance
    Next_Dist is Len + Cur_Dist,
    %  compute the next step with a neq node in the current path
    circuit(Start, Rest_Nodes, Next_Node, Next_Dist, Distance, [Next_Node | Cur_Path], Path).

% When all the nodes are visited
circuit(Start, [], Current_Node, Cur_Dist, Distance, Cur_Path, Path) :-
    % get back home
    distance(Current_Node, Start, Len),
    Distance is Cur_Dist + Len,
    % getting the path
    reverse([Start | Cur_Path], Path).

Now, we get :

?- circuit(a, Len, Path).
Len = 10,
Path = [a, b, c, a] ;
Len = 10,
Path = [a, c, b, a] ;
false.


问:
Setting a particular cell with a color (red/green /yellow) on Qtableview
I been searching for how to set a color on a specific cell on a qtableview.
Currently ,I am using the qt example frozen column to see how to set a color on a particular cell.

I search on the forums about how to tell to use qitemdelegate or qstyleitemdelegate to paint the background or foreground cells but no valid.

Could someone enlighten me or show an example on the code how I should go about it.

答:
The fastest way I can think about is using the setData method of a standard item:

```<code>QStandardItemModel model;
QStandardItem item;
item.setData(QBrush(Qt::gray), Qt::BackgroundColorRole); //background color
model.setItem(x, y, &item);
</code>```

In this example you set the background color. Different roles (to pass as the second argument) are described here

Body:
The fastest way I can think about is using the setData method of a standard item:

QStandardItemModel model;
QStandardItem item;
item.setData(QBrush(Qt::gray), Qt::BackgroundColorRole); //background color
model.setItem(x, y, &item);

In this example you set the background color. Different roles (to pass as the second argument) are described here


问:
How to get current page number and total pages as variables on each page?
I need to generate OMR code on a report. I think about calling some service method on each page that get page number and total pages as parameters. Problem is: How to get that values (page number, total pages) as variables on each page ?</p>

```<code><background>
    <band height="797">
        <textField>
            <reportElement x="30" y="684" width="100" height="97"/>
            <textFieldExpression><![CDATA[OMRService.generateCode($V{totalPages},$V{pageNumber})]]></textFieldExpression>
        </textField>
    </band>
</background>
</code>```

答:
Select the text field.

Set Expression to: msg("Page {0} of {1}", $V{V_CURRENT_PAGE_NUMBER}, $V{PAGE_NUMBER})

Set Evalutation Time to: Auto

Body:
I need to generate OMR code on a report. I think about calling some service method on each page that get page number and total pages as parameters. Problem is: How to get that values (page number, total pages) as variables on each page ?

<background>
    <band height="797">
        <textField>
            <reportElement x="30" y="684" width="100" height="97"/>
            <textFieldExpression><![CDATA[OMRService.generateCode($V{totalPages},$V{pageNumber})]]></textFieldExpression>
        </textField>
    </band>
</background>


问:
Flink readCsvFile method with pojoTypes
I have the following code in my flink project:

public class Test {

    public static void main(String[] args) throws Exception {

        // set up the execution environment
        final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

        DataSet<Event> events =
            env.readCsvFile(args[0]).pojoType(
               Event.class,
               "time",
               "vid",
               "speed",
               "xWay",
               "lane",
               "dir",
               "seg",
               "pos"
            );

        System.out.println("----> " + events.count());
    }
}
```

<p>And this is the class <code>Event</code>:</p>

<pre class="lang-java prettyprint-override"><code>class Event {
    public int time;
    public int vid;
    public int speed;
    public int xWay;
    public int lane;
    public int dir;
    public int seg;
    public int pos;

    public Event() { }

    public Event(int time_in, int vid_in, int speed_in, int xWay_in, int lane_in, int dir_in, int seg_in, int pos_in) {
        this.time = time_in;
        this.vid = vid_in;
        this.speed = speed_in;
        this.xWay = xWay_in;
        this.lane = lane_in;
        this.dir = dir_in;
        this.seg = seg_in;
        this.pos = pos_in;
    }
}
</code>```

The project compiles but when I run it, there is an error:

```<code>java.lang.ClassCastException: org.apache.flink.api.java.typeutils.GenericTypeInfo cannot be cast to org.apache.flink.api.java.typeutils.PojoTypeInfo
</code>```

The CSV file has 8 integer values separated by a comma in each line.

The documentation has the following example:

```<code>DataSet<Person>> csvInput = env.readCsvFile("hdfs:///the/CSV/file")
                     .pojoType(Person.class, "name", "age", "zipcode");
</code>```

I don't know if the POJO definition is wrong, surely it is. I achieved what I wanted using map and readTextFile but this could be more expensive.

答: The ClassCastException is a bug that will be fixed soon and replaced by a more meaningful exception. Event is a GenericType instead of a PojoType. I think the reason might be that Event is member class instead of a global accessible class. Adding the static modifier should solve the problem.

Title: Flink readCsvFile method with pojoTypes

Body:
I have the following code in my flink project:

public class Test {

    public static void main(String[] args) throws Exception {

        // set up the execution environment
        final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

        DataSet<Event> events =
            env.readCsvFile(args[0]).pojoType(
               Event.class,
               "time",
               "vid",
               "speed",
               "xWay",
               "lane",
               "dir",
               "seg",
               "pos"
            );

        System.out.println("----> " + events.count());
    }
}

And this is the class Event:

class Event {
    public int time;
    public int vid;
    public int speed;
    public int xWay;
    public int lane;
    public int dir;
    public int seg;
    public int pos;

    public Event() { }

    public Event(int time_in, int vid_in, int speed_in, int xWay_in, int lane_in, int dir_in, int seg_in, int pos_in) {
        this.time = time_in;
        this.vid = vid_in;
        this.speed = speed_in;
        this.xWay = xWay_in;
        this.lane = lane_in;
        this.dir = dir_in;
        this.seg = seg_in;
        this.pos = pos_in;
    }
}

The project compiles but when I run it, there is an error:

java.lang.ClassCastException: org.apache.flink.api.java.typeutils.GenericTypeInfo cannot be cast to org.apache.flink.api.java.typeutils.PojoTypeInfo

The CSV file has 8 integer values separated by a comma in each line.

The documentation has the following example:

DataSet<Person>> csvInput = env.readCsvFile("hdfs:///the/CSV/file")
                     .pojoType(Person.class, "name", "age", "zipcode");

I don't know if the POJO definition is wrong, surely it is. I achieved what I wanted using map and readTextFile but this could be more expensive.


问:
What is the structure of IQueryable?
```<code>using (var nosql = new DbHelper("Feed"))
{
    var watch = Stopwatch.StartNew();
    nosql.CollectionName = "rawhi";
    var x = nosql.GetRecords<Event>(p => true, 0, 1000000);
    //GridView1.DataSource = x;
    //GridView1.DataBind();
    watch.Stop();
    long milliseconds = watch.ElapsedMilliseconds;
    Response.Write(milliseconds);
}
</code>```

x is a variable of type IQueryable.

When I run this code the result is: 0

So I'm wondering if the data is stored in the x var or not?

答:
You only set up the piping so to speak - you now will be able to retrieve the results through x but they are lazily retrieved only when you do it.

You could retrieve them one by one:

```<code>foreach(var item in x)
{
  //do something
}
</code>```

Sometimes its advantageous to eagerly retrieve data, in that case you can use ToList() which enumerates all the results internally and puts the result set in x - then you can measure how long it would take:

```<code>  var x = nosql.GetRecords<Event>(p => true, 0, 1000000).ToList();
</code>```

Title: What is the structure of IQueryable?

Body:
using (var nosql = new DbHelper("Feed"))
{
    var watch = Stopwatch.StartNew();
    nosql.CollectionName = "rawhi";
    var x = nosql.GetRecords<Event>(p => true, 0, 1000000);
    //GridView1.DataSource = x;
    //GridView1.DataBind();
    watch.Stop();
    long milliseconds = watch.ElapsedMilliseconds;
    Response.Write(milliseconds);
}

x is a variable of type IQueryable.

When I run this code the result is: 0

So I'm wondering if the data is stored in the x var or not?

Body:
You only set up the piping so to speak - you now will be able to retrieve the results through x but they are lazily retrieved only when you do it.

You could retrieve them one by one:

foreach(var item in x)
{
  //do something
}

Sometimes its advantageous to eagerly retrieve data, in that case you can use ToList() which enumerates all the results internally and puts the result set in x - then you can measure how long it would take:

  var x = nosql.GetRecords<Event>(p => true, 0, 1000000).ToList();


问:
Pointer to std::vector, pointer declaration
Are there any differences between these two pointer declarations to pass a std::vector to a function that has a special signature that I don't really understand?

```<code>libraryFunction (int numSamples, double* const* arrayOfChannels) {
  //things
}

std::vector<double> theVectorA = {11, 22, 33, 44};
double * p_VecA[1];
p_VecA[0] = theVectorA.data();
libraryFunction(theVectorA.size(), p_VecA);

std::vector<double> theVectorB = {55, 66, 77};
double * p_VecB = theVectorB.data();
libraryFunction(theVectorB.size(), p_VecB);
</code>```

What are the differences between p_VecA and p_VecB?

Can you explain the function signature? I don't understand the last part.

答:
double * p_VecA[1]; creates an array of 1 pointer element, which points to a double (in this case, the first double in theVectorA). Therefore p_VecA is an array of pointers to doubles, in this context if you use the name without index it decays to a pointer to its first element (think of it as double**) and p_VecA[0] is of type double* (like p_VecB is).

double * p_VecB creates a pointer to a double (in this case, the first double in theVectorB).

Update:

Maybe this can help you to understand the signature of libraryFunction():

What is the difference between const int*, const int * const, and int const *?

Like Jack wrote: arrayOfChannels is a pointer to a const pointer to double

Body:
Are there any differences between these two pointer declarations to pass a std::vector to a function that has a special signature that I don't really understand?

libraryFunction (int numSamples, double* const* arrayOfChannels) {
  //things
}

std::vector<double> theVectorA = {11, 22, 33, 44};
double * p_VecA[1];
p_VecA[0] = theVectorA.data();
libraryFunction(theVectorA.size(), p_VecA);

std::vector<double> theVectorB = {55, 66, 77};
double * p_VecB = theVectorB.data();
libraryFunction(theVectorB.size(), p_VecB);

What are the differences between p_VecA and p_VecB?

Can you explain the function signature? I don't understand the last part.


问:
Tabstrip freezes
I set up a Tabstrip on a Dynpro. Ive got 2 Tabs.
On each Tab I set a Subscreen.

0100 - Main Screen

0110 - Subscreen One

0120 - Subscreen Two

The tabstrip is defined with these attributes.

Tabs:

```<code>Title strip    Reference subscreen  Function code  Function type
Subscreen One  SUB1                 STP_CTGRY_TAB  P
Subscreen Two  SUB1                 TRAN_TAB       P
</code>```

Subscreens (subscreen areas) :

```<code>SUB1
</code>```

The dynpro 0100 flow logic is :

```<code> PROCESS BEFORE OUTPUT.
   MODULE pbo.
   CALL SUBSCREEN sub1 INCLUDING sy-repid dynnr.
 PROCESS AFTER INPUT.
   CALL SUBSCREEN sub1.
   MODULE pai.
</code>```

On program level I declare.

```<code>CONTROLS mytabstrip TYPE TABSTRIP.
DATA: ok_code          LIKE sy-ucomm,
  dynnr            TYPE sy-dynnr.
</code>```

At Main Screen 0100 PBO:

```<code>IF mytabstrip-activetab IS INITIAL OR dynnr IS INITIAL.
  mytabstrip-activetab = 'STP_CTGRY_TAB'.
  dynnr = '0110'.
ENDIF.
</code>```

At Main Screen 0100 PAI:

```<code>CASE ok_code.
 WHEN 'STP_CTGRY_TAB'.
  dynnr = '0110'.
  mytabstrip-activetab = ok_code.
 WHEN 'TRAN_TAB'.
  dynnr = '0120'.
  mytabstrip-activetab = ok_code.
ENDCASE.
</code>```

If I debug my program and set breakpoints the tabstrip works. Bur if I run the program and change the tab of the tabstrip it seems that the subscreen freezes and overlaps the subscreen which should be displayed. All in all the changes on the tab doesn't work.

Did I forget any code? Can anyone help me what I possibly missed?

答:
REASON:

The function types of the 2 tabs are defined with the value "P", meaning that the tabstrip works using "local paging", so it needs to work with 2 subscreen areas referring each to one distinct subscreen, so that the actions on the tabs work as expected.

There are two types of usage of a tabstrip.

Use one subscreen for all tabs ("server paging")
So you have to load each data new if the users clicks on a tab.

Use one subscreen for each tab  ("local paging")
The whole data will be loaded at the beginning of the program.

NOTE: In the screen layout editor you have to set the parameter FctType to P - local GUI func.

RESOLUTION:

If you want to use the server paging (1), let the function type empty like this :

```<code>Title strip    Reference subscreen  Function code  Function type
Subscreen One  SUB1                 STP_CTGRY_TAB
Subscreen Two  SUB1                 TRAN_TAB
</code>```

The dynpro 0100 flow logic is :

```<code>PROCESS BEFORE OUTPUT.
  MODULE pbo.
  CALL SUBSCREEN sub1 INCLUDING sy-repid dynnr.
PROCESS AFTER INPUT.
  CALL SUBSCREEN sub1.
  MODULE pai.
</code>```

In the PBO and PAI modules, define ABAP code to initialize the DYNNR and MYTABSTRIP-ACTIVETAB variables to the right values, as shown in the initial question.

If you want to use the local paging (2), do as follows :

Tabs:

```<code>Title strip    Reference subscreen  Function code  Function type
Subscreen One  SUB1                 STP_CTGRY_TAB  P
Subscreen Two  SUB2                 TRAN_TAB       P
</code>```

Subscreens (subscreen areas) :

```<code>SUB1
SUB2
</code>```

The dynpro 0100 flow logic is :

```<code>PROCESS BEFORE OUTPUT.
  MODULE pbo.
  CALL SUBSCREEN sub1 INCLUDING sy-repid '0110'.
  CALL SUBSCREEN sub2 INCLUDING sy-repid '0120'.
PROCESS AFTER INPUT.
  CALL SUBSCREEN sub1.
  CALL SUBSCREEN sub2.
  MODULE pai.
</code>```

In the local paging scenario, no ABAP code is needed in the PBO and PAI modules to switch between tabs because it's handled locally on the SAP GUI.

More information here : https://help.sap.com/saphelp_nw70/helpdata/en/17/5bf1b52ba211d2954f0000e8353423/frameset.htm

Title: Tabstrip freezes

Body:
I set up a Tabstrip on a Dynpro. Ive got 2 Tabs.
On each Tab I set a Subscreen.

0100 - Main Screen

0110 - Subscreen One

0120 - Subscreen Two

The tabstrip is defined with these attributes.

Tabs:

Title strip    Reference subscreen  Function code  Function type
Subscreen One  SUB1                 STP_CTGRY_TAB  P
Subscreen Two  SUB1                 TRAN_TAB       P

Subscreens (subscreen areas) :

SUB1

The dynpro 0100 flow logic is :

 PROCESS BEFORE OUTPUT.
   MODULE pbo.
   CALL SUBSCREEN sub1 INCLUDING sy-repid dynnr.
 PROCESS AFTER INPUT.
   CALL SUBSCREEN sub1.
   MODULE pai.

On program level I declare.

CONTROLS mytabstrip TYPE TABSTRIP.
DATA: ok_code          LIKE sy-ucomm,
  dynnr            TYPE sy-dynnr.

At Main Screen 0100 PBO:

IF mytabstrip-activetab IS INITIAL OR dynnr IS INITIAL.
  mytabstrip-activetab = 'STP_CTGRY_TAB'.
  dynnr = '0110'.
ENDIF.

At Main Screen 0100 PAI:

CASE ok_code.
 WHEN 'STP_CTGRY_TAB'.
  dynnr = '0110'.
  mytabstrip-activetab = ok_code.
 WHEN 'TRAN_TAB'.
  dynnr = '0120'.
  mytabstrip-activetab = ok_code.
ENDCASE.

If I debug my program and set breakpoints the tabstrip works. Bur if I run the program and change the tab of the tabstrip it seems that the subscreen freezes and overlaps the subscreen which should be displayed. All in all the changes on the tab doesn't work.

Did I forget any code? Can anyone help me what I possibly missed?

Body:
REASON:

The function types of the 2 tabs are defined with the value "P", meaning that the tabstrip works using "local paging", so it needs to work with 2 subscreen areas referring each to one distinct subscreen, so that the actions on the tabs work as expected.

There are two types of usage of a tabstrip.

Use one subscreen for all tabs ("server paging")
So you have to load each data new if the users clicks on a tab.

Use one subscreen for each tab  ("local paging")
The whole data will be loaded at the beginning of the program.

NOTE: In the screen layout editor you have to set the parameter FctType to P - local GUI func.

RESOLUTION:

If you want to use the server paging (1), let the function type empty like this :

Title strip    Reference subscreen  Function code  Function type
Subscreen One  SUB1                 STP_CTGRY_TAB
Subscreen Two  SUB1                 TRAN_TAB

The dynpro 0100 flow logic is :

PROCESS BEFORE OUTPUT.
  MODULE pbo.
  CALL SUBSCREEN sub1 INCLUDING sy-repid dynnr.
PROCESS AFTER INPUT.
  CALL SUBSCREEN sub1.
  MODULE pai.

In the PBO and PAI modules, define ABAP code to initialize the DYNNR and MYTABSTRIP-ACTIVETAB variables to the right values, as shown in the initial question.

If you want to use the local paging (2), do as follows :

Tabs:

Title strip    Reference subscreen  Function code  Function type
Subscreen One  SUB1                 STP_CTGRY_TAB  P
Subscreen Two  SUB2                 TRAN_TAB       P

Subscreens (subscreen areas) :

SUB1
SUB2

The dynpro 0100 flow logic is :

PROCESS BEFORE OUTPUT.
  MODULE pbo.
  CALL SUBSCREEN sub1 INCLUDING sy-repid '0110'.
  CALL SUBSCREEN sub2 INCLUDING sy-repid '0120'.
PROCESS AFTER INPUT.
  CALL SUBSCREEN sub1.
  CALL SUBSCREEN sub2.
  MODULE pai.

In the local paging scenario, no ABAP code is needed in the PBO and PAI modules to switch between tabs because it's handled locally on the SAP GUI.

More information here : https://help.sap.com/saphelp_nw70/helpdata/en/17/5bf1b52ba211d2954f0000e8353423/frameset.htm


问:
Copy and paste a file through access vba
I need to check a folder for a file, if it exists delete it an replace it with an updated version, or if the file doesn't delete then it will copy the file from a path into the individuals personal drive

My Code:

```<code>Dim FileExistsbol As Boolean
Dim stFileName As String
Dim CopyFrom As String
Dim CopyTo As String

stFileName = "H:\Test File.txt"
stFileName = Trim(stFileName)
FileExistsbol = dir(stFileName) <> vbNullString

If FileExistsbol Then
 Kill stFileName
 CopyFrom = "J:\Test File.txt"
 CopyTo = "H:\"
 FileSystemObject.CopyFile CopyFrom, CopyTo
Else
 CopyFrom = "J:\Test File.txt"
 CopyTo = "H:\"
 FileSystemObject.CopyFile CopyFrom, CopyTo
End If
</code>```

What Happens:

The code executes and deletes the existing file as expected, but it appears to be failing on the copy and paste part.

Error:

The debug that comes up is:

Object Required

答:
You haven't said which line is throwing the error, but I noticed that you don't seem to have instantiated a new FileSystemObject:

```<code>dim fso as Object
set fso=CreateObject("Scripting.FileSystemObject")
</code>```

then use the fso reference to copy your file

```<code>fso.CopyFile CopyFrom, CopyTo
</code>```

The method above used "Late binding" to interrogate the registry for Scripting.FileSystemObject

You can also use early binding and reference the Microsoft Scripting Runtime directly and avoid the use of CreateObject

This is detailed in this Stack Overflow answer:
https://stackoverflow.com/a/3236348/491557

Body:
I need to check a folder for a file, if it exists delete it an replace it with an updated version, or if the file doesn't delete then it will copy the file from a path into the individuals personal drive

My Code:

Dim FileExistsbol As Boolean
Dim stFileName As String
Dim CopyFrom As String
Dim CopyTo As String

stFileName = "H:\Test File.txt"
stFileName = Trim(stFileName)
FileExistsbol = dir(stFileName) <> vbNullString

If FileExistsbol Then
 Kill stFileName
 CopyFrom = "J:\Test File.txt"
 CopyTo = "H:\"
 FileSystemObject.CopyFile CopyFrom, CopyTo
Else
 CopyFrom = "J:\Test File.txt"
 CopyTo = "H:\"
 FileSystemObject.CopyFile CopyFrom, CopyTo
End If

What Happens:

The code executes and deletes the existing file as expected, but it appears to be failing on the copy and paste part.

Error:

The debug that comes up is:

Object Required

Body:
You haven't said which line is throwing the error, but I noticed that you don't seem to have instantiated a new FileSystemObject:

dim fso as Object
set fso=CreateObject("Scripting.FileSystemObject")

then use the fso reference to copy your file

fso.CopyFile CopyFrom, CopyTo

The method above used "Late binding" to interrogate the registry for Scripting.FileSystemObject

You can also use early binding and reference the Microsoft Scripting Runtime directly and avoid the use of CreateObject

This is detailed in this Stack Overflow answer:
https://stackoverflow.com/a/3236348/491557