问:
Running text2column for column A:A
I am quite new to VBA scripting, but I have to perform the following actions:

convert a csv file to xls one

in the saved xls file to perform the following actions:
         1. To run Text To Columns  for the data
         2. To define the type of each column ( amount , date, text).
         3. To make the first 0 in Amount&Date columns be visible ( e.g. "04521.6823" & for date "05/02/2020"). Here  I plan to use .NumberFormat option.

I succesfully converted the file, but cannot perform Text2Column part.
My data is only in column A, separator ";", only on sheet1.
Here is the latest code I ran:

```<code> Sub text2columns()
    Dim rg As Range

    Set rg = Range("A:A").CurrentRegion

    rg.TextToColumns Destination:=Range("A:A"), ConsecutiveDelimiter:=True, DataType:=xlDelimited, Space:=True

    End Sub
</code>```

Can anyone help me? I know questions are basic, but need some help to continue.
Thank you!

答:
You have mentioned Destination:=Range("A:A").
Also, your input and output range cannot be same.
I think, it shouldn't be a column, only a cell

Please check if Destination:=Range("B1") works.

Title: Running text2column for column A:A

Body:
I am quite new to VBA scripting, but I have to perform the following actions:

convert a csv file to xls one

in the saved xls file to perform the following actions:
         1. To run Text To Columns  for the data
         2. To define the type of each column ( amount , date, text).
         3. To make the first 0 in Amount&Date columns be visible ( e.g. "04521.6823" & for date "05/02/2020"). Here  I plan to use .NumberFormat option.

I succesfully converted the file, but cannot perform Text2Column part.
My data is only in column A, separator ";", only on sheet1.
Here is the latest code I ran:

 Sub text2columns()
    Dim rg As Range

    Set rg = Range("A:A").CurrentRegion

    rg.TextToColumns Destination:=Range("A:A"), ConsecutiveDelimiter:=True, DataType:=xlDelimited, Space:=True

    End Sub

Can anyone help me? I know questions are basic, but need some help to continue.
Thank you!


来源: stackexchange

问:
How to fix this error "Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >="
```<code>CREATE PROCEDURE Task2_Create1397_1396
AS
DECLARE @Check INT
DECLARE @Sal INT

--SET @Check = (SELECT COUNT(Title)FROM Buy)
SET @Sal = (
        SELECT YEAR(Tarikh)
        FROM Buy
        )

IF (@Sal = 1398)
    INSERT INTO Buy
    SELECT Title
        ,Type1
        ,Tedat
        ,DATEADD(DAY, - 2, DATEADD(YEAR, - 1, Tarikh))
        ,Descrip
    FROM Buy

IF (@Sal = 1397)
    INSERT INTO Buy
    SELECT Title
        ,Type1
        ,Tedat
        ,DATEADD(DAY, - 2, DATEADD(YEAR, - 1, Tarikh))
        ,Descrip
    FROM Buy
</code>```

答:
Just for your technical error - you need to change this

```<code>SET @Sal = (SELECT YEAR(Tarikh) FROM Buy)
</code>```

into

```<code>SET @Sal = (SELECT Top 1 YEAR(Tarikh) FROM Buy)
</code>```

You can use here order by clause also in the above select statement.

Apart from this you need to check why it is returning more than one value in select while assigning this returning value into a variable.

You can restructure your if statement twice into one as shown below.

```<code>IF (@Sal = 1398)
BEGIN
    INSERT INTO Buy
    SELECT Title
        ,Type1
        ,Tedat
        ,DATEADD(DAY, - 2, DATEADD(YEAR, - 1, Tarikh))
        ,Descrip
    FROM Buy -- <add where condition here for if block>
END
ELSE IF (@Sal = 1397)
BEGIN
    INSERT INTO Buy
    SELECT Title
        ,Type1
        ,Tedat
        ,DATEADD(DAY, - 2, DATEADD(YEAR, - 1, Tarikh))
        ,Descrip
    FROM Buy -- <add where condition here for another if block>
END
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Just for your technical error - you need to change this

SET @Sal = (SELECT YEAR(Tarikh) FROM Buy)

into

SET @Sal = (SELECT Top 1 YEAR(Tarikh) FROM Buy)

You can use here order by clause also in the above select statement.

Apart from this you need to check why it is returning more than one value in select while assigning this returning value into a variable.

You can restructure your if statement twice into one as shown below.

IF (@Sal = 1398)
BEGIN
    INSERT INTO Buy
    SELECT Title
        ,Type1
        ,Tedat
        ,DATEADD(DAY, - 2, DATEADD(YEAR, - 1, Tarikh))
        ,Descrip
    FROM Buy -- <add where condition here for if block>
END
ELSE IF (@Sal = 1397)
BEGIN
    INSERT INTO Buy
    SELECT Title
        ,Type1
        ,Tedat
        ,DATEADD(DAY, - 2, DATEADD(YEAR, - 1, Tarikh))
        ,Descrip
    FROM Buy -- <add where condition here for another if block>
END


问:
How to change other country if i select one country in Jquery
i have two select box. if i select Singapore in select box 1, i want to show Indonesia in select box 2 and singapore not display in select box 2. please see the picture
this is html code :

```<code><div class="input-group select2-bootstrap-prepend">
                <span class="btn" style="width:41px; border-radius: 0.25rem 0 0 0.25rem; background-color:#3b5998; color:white; border-right:none;"><i class="fas fa-ship fa-sm"></i></span>
                <select class="custom-select" id="asal">
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>
            </div>
            <label class="mt-4" for="Tujuan-keberangkatan">Tujuan Keberangkatan</label>
            <div class="input-group mb-4 select2-bootstrap-prepend">
                <span class="btn" style="width:41px; border-radius: 0.25rem 0 0 0.25rem; background-color:#3b5998; color:white; border-right:none;" class="input-group-addon"><i class="fas fa-ship fa-sm"></i></span>
                <select class="custom-select" id="tujuan">
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>
            </div>
</code>```

答:
Using jQuery onchange event, you can get the selected value and use it to get optgroup label, according to the label we can hide/show second select values, check the below example which uses jQuery and shows/hides the Singapore/Indonesia values according to the first selectbox value.

$(document).ready(function(){
  $("#asal").on("change", function(){
  var asallbl = $("#asal :selected").parent().attr("label");
  if(asallbl === "Singapore"){
    $("#tujuan").find("optgroup[label='Indonesia']").show();
    $("#tujuan").find("optgroup[label='Singapore']").hide();
    $("#tujuan").prop("selectedIndex", 0);
  }else{
    $("#tujuan").find("optgroup[label='Indonesia']").hide();
    $("#tujuan").find("optgroup[label='Singapore']").show();
    $("#tujuan").prop("selectedIndex", 0);
  }
  });
});```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="input-group select2-bootstrap-prepend">
                <span class="btn" style="width:41px; border-radius: 0.25rem 0 0 0.25rem; background-color:#3b5998; color:white; border-right:none;"><i class="fas fa-ship fa-sm"></i></span>
                            <label class="mt-4" for="Tujuan-keberangkatan">Asal Keberangkatan</label><br/>
                <select class="custom-select" id="asal">
                    <option value="0">Choose Asal</option>
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>
            </div>
            <label class="mt-4" for="Tujuan-keberangkatan">Tujuan Keberangkatan</label>
            <div class="input-group mb-4 select2-bootstrap-prepend">
                <span class="btn" style="width:41px; border-radius: 0.25rem 0 0 0.25rem; background-color:#3b5998; color:white; border-right:none;" class="input-group-addon"><i class="fas fa-ship fa-sm"></i></span>
                <select class="custom-select" id="tujuan">
                <option value="0">Choose Tujuan</option>
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>
            </div></code>```

Body:
i have two select box. if i select Singapore in select box 1, i want to show Indonesia in select box 2 and singapore not display in select box 2. please see the picture
this is html code :

                <select class="custom-select" id="asal">
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>

            Tujuan Keberangkatan

                <select class="custom-select" id="tujuan">
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>

Body:
Using jQuery onchange event, you can get the selected value and use it to get optgroup label, according to the label we can hide/show second select values, check the below example which uses jQuery and shows/hides the Singapore/Indonesia values according to the first selectbox value.

$(document).ready(function(){
  $("#asal").on("change", function(){
  var asallbl = $("#asal :selected").parent().attr("label");
  if(asallbl === "Singapore"){
    $("#tujuan").find("optgroup[label='Indonesia']").show();
    $("#tujuan").find("optgroup[label='Singapore']").hide();
    $("#tujuan").prop("selectedIndex", 0);
  }else{
    $("#tujuan").find("optgroup[label='Indonesia']").hide();
    $("#tujuan").find("optgroup[label='Singapore']").show();
    $("#tujuan").prop("selectedIndex", 0);
  }
  });
});

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="input-group select2-bootstrap-prepend">
                <span class="btn" style="width:41px; border-radius: 0.25rem 0 0 0.25rem; background-color:#3b5998; color:white; border-right:none;"><i class="fas fa-ship fa-sm"></i></span>
                            <label class="mt-4" for="Tujuan-keberangkatan">Asal Keberangkatan</label><br/>
                <select class="custom-select" id="asal">
                    <option value="0">Choose Asal</option>
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>
            </div>
            <label class="mt-4" for="Tujuan-keberangkatan">Tujuan Keberangkatan</label>
            <div class="input-group mb-4 select2-bootstrap-prepend">
                <span class="btn" style="width:41px; border-radius: 0.25rem 0 0 0.25rem; background-color:#3b5998; color:white; border-right:none;" class="input-group-addon"><i class="fas fa-ship fa-sm"></i></span>
                <select class="custom-select" id="tujuan">
                <option value="0">Choose Tujuan</option>
                    <optgroup label="Singapore">
                        <option value="1">HarbourFront</option>
                        <option value="2">Tanah Merah</option>
                    </optgroup>
                    <optgroup label="Indonesia">
                        <option value="1">Batam Center</option>
                        <option value="2">Harbour Bay</option>
                        <option value="3">Nongsa</option>
                        <option value="3">Sekupang</option>
                        <option value="3">Tanjung Balai</option>
                        <option value="3">Tanjung Pinang</option>
                    </optgroup>
                </select>
            </div>


问:
ADT plugin and Eclipse 3.5
I installed ADT plugin to Eclipse 3.5. But at Window → Preferences Android node is not shown.

答:
The best answer is so simple, we've overlooked what eclipse is doing when we click "finish" after adding the plugin.

If you take a look at what eclipse is doing in the background before you install the plugin, it's actually installing the program, you'll see the loading bar updating, where ever you have dragged the loading bar to.

So you have to wait for eclipse to install it, it's actually doing something, we just didn't realize it, instead, we quit while eclipse was installing, it never got installed,thus it 'android' doesn't appear in the preferences.

Give it a go!

ContentLicense: CC BY-SA 3.0

Title: ADT plugin and Eclipse 3.5


问:
Android gridview adjusting to screen size
The grid view of my application has 3 rows and 3 columns. I want this to fill the screen ,irrespective of the screen size of the device.

I tried getting window size and setting the layoutparams accordingly. But this is not giving a perfect alignment as it works with weightsum in linearlayout.

So can we use weightsum for gridview or is there any other android property that can be used.
Thanks a lot for time and response.

```<code><GridView
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/gridview"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_below="@+id/text1view"
                android:background="@drawable/home_bg"
                android:gravity="center"
                android:horizontalSpacing="10dip"
                android:numColumns="3"
                android:stretchMode="columnWidth" />
</code>```

each grid item is

```<code><?xml version="1.0" encoding="utf-8"?>
</code>```

```<code><ImageView
    android:id="@+id/grid_item_image"
    android:layout_width="wrap_content"
    android:layout_height="75dip"
    android:layout_margin="0dip"
    android:padding="0dip" >
</ImageView>

<TextView
    android:id="@+id/grid_item_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_below="@+id/grid_item_image"
    android:gravity="center_horizontal"
    android:padding="0dip"
    android:textColor="#000000"
    android:textSize="10sp" >
</TextView>
</code>```

code of the adapter :

```<code>    @Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
        LayoutInflater mInflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = mInflater.inflate(R.layout.griditems, null);
        holder = new ViewHolder();
        holder.text1 = (TextView) convertView
                .findViewById(R.id.grid_item_text);

        holder.image = (ImageView) convertView
                .findViewById(R.id.grid_item_image);

        // if it's not recycled, initialize some attributes
        holder.image.setImageResource(gridItemIds[position]);
        holder.text1.setText(gridTitles[position]);
        int h = mContext.getResources().getDisplayMetrics().densityDpi;

        // holder.image.setLayoutParams(new LayoutParams(h-50,h-50));
        convertView.setLayoutParams(new GridView.LayoutParams(h - 45,
                h - 39));
        // holder.image.setScaleType(ImageView.ScaleType.CENTER_CROP);
        // holder.image.setScaleType(ImageView.ScaleType.FIT_XY);
        // holder.image.setPadding(20, 20, 20, 20);

        // convertView.setLayoutParams(new GridView.LayoutParams(Utils
        // .getLayoutParameter(), Utils.getLayoutParameter()+50));

        holder.image.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                new ModuleManager().startModuleACtivity(position, mContext);
            }
        });
        convertView.setTag(holder);
    } else {

        holder = (ViewHolder) convertView.getTag();

    }

    return convertView;
}

static class ViewHolder {
    TextView text1;
    ImageView image;

}
</code>```

pls see the line

```<code>convertView.setLayoutParams(new GridView.LayoutParams(h-45, h-39));
</code>```

i arrived at this value with some trials on different size emulator.
But i dont think its a right way to define height and width.

答:
Here I only changed width and height as match parent and wrap content.

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:layout_gravity="center_horizontal"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView5"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:paddingTop="5dp"
            android:text="Category"
            android:textSize="20dp" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="170dp"
            android:layout_height="170dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="5dp"
            android:src="@drawable/iconclothcolor" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView3"
            android:layout_marginTop="2dp"
            android:textSize="16dp"
            android:textColor="#F37E98"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Shirt" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView4"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Gender - Male" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView8"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Quantity - 10" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView6"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Size - S" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:id="@+id/textView10"
            android:textSize="20dp"
            android:text="Offer" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView7"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:textSize="20dp"
            android:textColor="#F37E98"
            android:text="Price - 1500 Rs" />

    </LinearLayout>

</androidx.cardview.widget.CardView>
</code>```

And in the Mainclass add this -->

```<code>GridLayoutManager gridLayoutManager=new GridLayoutManager(this,2);
        recyclerView.setLayoutManager(gridLayoutManager);
</code>```

Body:
The grid view of my application has 3 rows and 3 columns. I want this to fill the screen ,irrespective of the screen size of the device.

I tried getting window size and setting the layoutparams accordingly. But this is not giving a perfect alignment as it works with weightsum in linearlayout.

So can we use weightsum for gridview or is there any other android property that can be used.
Thanks a lot for time and response.

<GridView
                xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/gridview"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_below="@+id/text1view"
                android:background="@drawable/home_bg"
                android:gravity="center"
                android:horizontalSpacing="10dip"
                android:numColumns="3"
                android:stretchMode="columnWidth" />

each grid item is

<?xml version="1.0" encoding="utf-8"?>

<ImageView
    android:id="@+id/grid_item_image"
    android:layout_width="wrap_content"
    android:layout_height="75dip"
    android:layout_margin="0dip"
    android:padding="0dip" >
</ImageView>

<TextView
    android:id="@+id/grid_item_text"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_below="@+id/grid_item_image"
    android:gravity="center_horizontal"
    android:padding="0dip"
    android:textColor="#000000"
    android:textSize="10sp" >
</TextView>

code of the adapter :

    @Override
public View getView(final int position, View convertView, ViewGroup parent) {
    ViewHolder holder;

    if (convertView == null) {
        LayoutInflater mInflater = (LayoutInflater) mContext
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        convertView = mInflater.inflate(R.layout.griditems, null);
        holder = new ViewHolder();
        holder.text1 = (TextView) convertView
                .findViewById(R.id.grid_item_text);

        holder.image = (ImageView) convertView
                .findViewById(R.id.grid_item_image);

        // if it's not recycled, initialize some attributes
        holder.image.setImageResource(gridItemIds[position]);
        holder.text1.setText(gridTitles[position]);
        int h = mContext.getResources().getDisplayMetrics().densityDpi;

        // holder.image.setLayoutParams(new LayoutParams(h-50,h-50));
        convertView.setLayoutParams(new GridView.LayoutParams(h - 45,
                h - 39));
        // holder.image.setScaleType(ImageView.ScaleType.CENTER_CROP);
        // holder.image.setScaleType(ImageView.ScaleType.FIT_XY);
        // holder.image.setPadding(20, 20, 20, 20);

        // convertView.setLayoutParams(new GridView.LayoutParams(Utils
        // .getLayoutParameter(), Utils.getLayoutParameter()+50));

        holder.image.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View view) {
                new ModuleManager().startModuleACtivity(position, mContext);
            }
        });
        convertView.setTag(holder);
    } else {

        holder = (ViewHolder) convertView.getTag();

    }

    return convertView;
}

static class ViewHolder {
    TextView text1;
    ImageView image;

}

pls see the line

convertView.setLayoutParams(new GridView.LayoutParams(h-45, h-39));

i arrived at this value with some trials on different size emulator.
But i dont think its a right way to define height and width.

Body:
Here I only changed width and height as match parent and wrap content.

<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    android:layout_gravity="center_horizontal"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView5"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:paddingTop="5dp"
            android:text="Category"
            android:textSize="20dp" />

        <ImageView
            android:id="@+id/imageView1"
            android:layout_width="170dp"
            android:layout_height="170dp"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="5dp"
            android:src="@drawable/iconclothcolor" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView3"
            android:layout_marginTop="2dp"
            android:textSize="16dp"
            android:textColor="#F37E98"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Shirt" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView4"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Gender - Male" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView8"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Quantity - 10" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView6"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:text="Size - S" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:id="@+id/textView10"
            android:textSize="20dp"
            android:text="Offer" />

        <TextView
            android:layout_width="wrap_content"
            android:id="@+id/textView7"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:textSize="20dp"
            android:textColor="#F37E98"
            android:text="Price - 1500 Rs" />

    </LinearLayout>

</androidx.cardview.widget.CardView>

And in the Mainclass add this -->

GridLayoutManager gridLayoutManager=new GridLayoutManager(this,2);
        recyclerView.setLayoutManager(gridLayoutManager);


问:
Jmeter JSR223 Groovy read file line by line and do http POST

I am trying to iterate files in the folder. each file has multiple json strings delimited by newline. Once the json is retrieved, will have to get the specific node of the json and POST it to http server.

Initially i thought will use the csv data set config, but i was able to get nested json from the files. After some of the reading tutorials of jmeter i finally went ahead with JSR223 to have a custom script which reads the file and puts in ctx, which will be used by sampler to send the data.

Here is what i have done till now.

```<code>Test plan
    -> Thread group
        -> JSR223 PreProcessor : This is where i am reading file and adding it to vars, its like "json_{number}" and "GETfileLength"
    -> ForEach Controller : This is sibling of Thread group
        -> HTTP Request : Inside for Each controller has a configuration of host, port and the path and in the body i have mentioned ${json_out}
        -> View Results Tree
        -> Summary Report
</code>```

Groovy script present in pre-processor

```<code>    log.info("------ start ----------");
    File file = new File("/data/sample1.json")
    def line;
    def noOfLines=0
    file.withReader { reader ->
        while ((line = reader.readLine()) != null) {
            noOfLines++
            vars.put("json_"+noOfLines, line)
        }
    }
    vars.put("GETfileLength",noOfLines.toString()) ;
    log.info("------ end ----------");
</code>```

In this above hierarchy of test plan i dont see the script is being called ( checked logs) . If i remove forEach controller the script gets called but i dont know how to give the variable name in the http POST body for dynamic variables.

答:
According to documentation

A Pre-Processor executes some action prior to a Sampler Request being made.

Check the Execution order

Please note that Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply. Logic Controllers and Samplers are processed in the order in which they appear in the tree. Other test elements are processed according to the scope in which they are found, and the type of test element. [Within a type, elements are processed in the order in which they appear in the tree]

This is the reason your script isn't working for the forEach controller.

Try using JSR223 Sampler instead of JSR223 pre-processor. You can ignore the sample result also.

Body:
I am trying to iterate files in the folder. each file has multiple json strings delimited by newline. Once the json is retrieved, will have to get the specific node of the json and POST it to http server.

Initially i thought will use the csv data set config, but i was able to get nested json from the files. After some of the reading tutorials of jmeter i finally went ahead with JSR223 to have a custom script which reads the file and puts in ctx, which will be used by sampler to send the data.

Here is what i have done till now.

Test plan
    -> Thread group
        -> JSR223 PreProcessor : This is where i am reading file and adding it to vars, its like "json_{number}" and "GETfileLength"
    -> ForEach Controller : This is sibling of Thread group
        -> HTTP Request : Inside for Each controller has a configuration of host, port and the path and in the body i have mentioned ${json_out}
        -> View Results Tree
        -> Summary Report

Groovy script present in pre-processor

    log.info("------ start ----------");
    File file = new File("/data/sample1.json")
    def line;
    def noOfLines=0
    file.withReader { reader ->
        while ((line = reader.readLine()) != null) {
            noOfLines++
            vars.put("json_"+noOfLines, line)
        }
    }
    vars.put("GETfileLength",noOfLines.toString()) ;
    log.info("------ end ----------");

In this above hierarchy of test plan i dont see the script is being called ( checked logs) . If i remove forEach controller the script gets called but i dont know how to give the variable name in the http POST body for dynamic variables.


问:
How can I access a other html file when the device width equals the width of a mobile?
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.

.fullscreen-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  z-index: -100;
}

.fullscreen-bg__video {
  position: absolute;
  top: 30%;
  left: center;
  width: 98%;
  height: 50%;
}

html {
  font-family: 'Montserrat', Arial, Helvetica, sans-serif;
  margin-top: 20px;
  margin: 1%;
  box-shadow: 0 1px 10px white, 0 0 40px black, 0 0 80px white;
  color: black;
  height: 96%;
  width: 98%;
}

body {
  background-color: white;
  float: center;
}

h1 {
  color: black;
  text-align: center;
  font-size: 25px;
  margin-bottom: 5px;
  text-shadow: 1px 1px 4px gray, 1px 1px 4px white;
}

p {
  color: black;
  text-align: center;
  margin-top: 0px;
  font-size: 15px;
}

header {
  padding: 1px;
  margin: auto;
  box-shadow: 0 0 10px white, 0 0 20px white;
}

nav {
  margin-left: auto;
  margin-top: 50px;
  margin-bottom: auto;
  float: left;
  background-color: white;
  height: auto;
  width: auto;
}

article {
  float: center;
  margin-top: 50px;
  margin-bottom: auto;
  width: auto;
  height: 100%;
}

/*NAV Menu*/

.overlay {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: white;
  overflow-x: hidden;
  transition: 0.5s;
}

.overlay-content {
  position: relative;
  top: 25%;
  width: 100%;
  text-align: center;
  margin-top: 30px;
  color: black;
}

.overlay a {
  padding: 8px;
  text-decoration: none;
  font-size: 36px;
  color: black;
  display: block;
  transition: 0.3s;
}

.overlay a:hover,
.overlay a:focus {
  color: rgb(0, 0, 0, 0.2);
}

.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
}

span {
  color: black;
  width: auto;
  height: auto;
  margin-top: 1%;
  float: right;
  margin-right: 1%;
}

/*Responsive*/

@media screen and (max-height: 450px) {
  .overlay a {
    font-size: 20px
  }
  .overlay .closebtn {
    font-size: 40px;
    top: 15px;
    right: 35px;
  }
}

footer {
  float: center;
  margin: auto;
  margin-top: 60%;
}

p1 {
  text-align: left;
}

.style {
  font-size: 30px;
  cursor: pointer;
  font-family: monospace, arial;
}

span {
  color: black;
  width: auto;
  height: auto;
  margin-top: 1%;
  float: right;
  margin-right: 1%;
}

/*LOGO*/

img.ri {
  position: absolute;
  max-width: 80%;
  top: 10%;
  left: 10%;
  border-radius: 3px;
  width: 100px;
  height: 100px;
}

img.ri:empty {
  top: 55%;
  left: 49%;
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  -o-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

@media only screen and (max-width: 500px) {
  html {
    background-image: url("C:/Users/Joalu/Desktop/WebApp/img/indexbackground.png");
    font-family: 'Lato';
    width: auto;
    height: 1908px;
    overflow-x: hidden;
    background-repeat: no-repeat;
  }
  body {
    margin: 0;
  }
  header {
    text-align: center;
  }
  h1 {
    font-size: 20px;
    color: white;
    margin-top: 3px;
    font-family: 'Lato';
  }
  h2 {
    display: block;
  }
  .btnheader {
    background-color: rgb(0, 0, 0, 0.5);
    border: 0;
    width: 485px;
    height: 87px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 0 30px white;
  }
  .overlay {
    background-color: rgb(0, 0, 0, 0.5);
    margin-top: 30px;
    text-align: center;
  }
  .btn-group button {
    background-color: rgb(0, 0, 0, 0.5);
    /* Green background */
    border: 0.5px solid rgb(0, 0, 0, 0.5);
    color: white;
    /* White text */
    padding: 20px 33px;
    /* Some padding */
    cursor: pointer;
    /* Pointer/hand icon */
    float: left;
    /* Float the buttons side by side */
    font-family: 'Lato', arial;
    width: 120.7px;
    text-align: center;
  }
  /* Clear floats (clearfix hack) */
  .btn-group:after {
    content: "";
    clear: both;
    display: table;
  }
  .btn-group button:not(:last-child) {
    border-right: none;
    /* Prevent double borders */
  }
  /* Add a background color on hover */
  .btn-group button:hover {
    background-color: rgb(0, 0, 0, 0.3);
    border: 0px;
    box-shadow: 0 0 40px black, 0 0 15px white;
  }
  .dot {
    height: 258px;
    width: 258px;
    background-color: rgb(0, 0, 0, 0);
    border-radius: 100%;
    display: inline-block;
    margin-top: 670px;
    cursor: pointer;
  }
  .dot:hover {
    box-shadow: 0 0 50px white;
  }
  img.ri {
    position: absolute;
    max-width: 80%;
    top: 20%;
    left: 10%;
    border-radius: 3px;
    width: 500px;
    height: 500px;
    margin-top: 140px;
  }
  img.ri:empty {
    top: 35%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
  }
  img.ri:hover {
    box-shadow: 0 0 10px gray, 0 0 40px black;
  }
  .footer {
    padding: 5%;
    height: 464px;
    width: 500px;
    background-color: rgb(0, 0, 0, 0.8);
    margin-top: 320px;
    color: white;
  }
  h3 {
    text-align: center;
    color: white;
    margin-top: 380px;
  }
  .bordr {
    border: 5px;
    height: auto;
    width: auto
  }
  p {
    text-align: center;
    color: white;
    font-family: 'Lato', arial;
  }
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <link rel="stylesheet" type="text/css" href="css/MainCSS.css">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/png" href="image/favicon.png" sizes="32x32">
  <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
  <title>
    scxry
  </title>
</head>

<body>
  <div class="fullscreen-bg">
    <video loop muted autoplay poster="img/videoframe.jpg" class="fullscreen-bg__video">
        <source src="video/12345.mp4" type="video/mp4">
    </video>
  </div>
  <header>
    <span class="style" onclick="openNav()">☰</span>

  </header>

  <script type="text/javascript">
    if (screen.width <= 500) {
      document.location = "webapp.html";
    }
  </script>

  <nav>
    <div id="myNav" class="overlay">
      ×
      <div class="overlay-content">
        Home
        Store
        Social Media
        Contact
        FAQ
        <p>scxry cmpny est. 2020
          <p>
      </div>
    </div>
  </nav>

  <img src="image/scxrylogo800back.png" class="ri" />

  <script>
    function openNav() {
      document.getElementById("myNav").style.width = "100%";
    }

    function closeNav() {
      document.getElementById("myNav").style.width = "0%";
    }
  </script>

</body>

</html></code>```

@media only screen and (max-width: 500px) {

    html{
        background-image: url("C:/Users/Joalu/Desktop/scxryshop.de/image/webappbackground.png");
        font-family:  'Lato';
        width: auto;
        height: 1908px;
        overflow-x: hidden;
        background-repeat: no-repeat;
    }

    body{
        margin: 0;
    }

    header{
        text-align: center;
    }

    h1 {
        font-size: 20px;
        color: white;
        margin-top: 3px;
        font-family:   'Lato';
    }

    h2 {
        display: block;

    }

    .btnheader {
        background-color: rgb(0, 0, 0,0.5);
        border: 0;
        width: 485px;
        height: 87px;
        text-align: center;
        cursor: pointer;
        box-shadow: 0 0 30px white;
    }

    .overlay {
        background-color: rgb(0, 0, 0,0.5);
        margin-top: 30px ;
        text-align: center;
    }

    .btn-group button {
        background-color: rgb(0, 0, 0,0.5); /* Green background */
        border: 0.5px solid rgb(0, 0, 0,0.5);
        color: white; /* White text */
        padding: 20px 33px; /* Some padding */
        cursor: pointer; /* Pointer/hand icon */
        float: left;/* Float the buttons side by side */
        font-family:  'Lato', arial;
        width: 120.7px;
        text-align: center;

      }

      /* Clear floats (clearfix hack) */
      .btn-group:after {
        content: "";
        clear: both;
        display: table;
      }

      .btn-group button:not(:last-child) {
        border-right: none; /* Prevent double borders */
      }

      /* Add a background color on hover */
      .btn-group button:hover {
        background-color: rgb(0, 0, 0,0.3);
        border: 0px;
        box-shadow: 0 0 40px black, 0 0 15px white;
      }

      .dot {
        height: 258px;
        width: 258px;
        background-color: rgb(0, 0, 0,0);
        border-radius: 100%;
        display: inline-block;
        margin-top: 670px;
        cursor: pointer;
      }

      .dot:hover {
          box-shadow: 0 0 50px white;
      }

      img.ri{
        position: absolute;
        max-width: 80%;
        top: 20%;
        left: 10%;
        border-radius: 3px;
        width: 500px;
        height: 500px;
        margin-top: 140px;
    }

    img.ri:empty{
        top: 35%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%);
        -moz-transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
    }

    img.ri:hover{
        box-shadow: 0 0 10px gray, 0 0 40px black;
    }

    .footer {
            padding: 5%;
            height: 464px;
            width: 500px;
            background-color: rgb(0, 0, 0,0.8);
            margin-top: 320px;
            color: white;
    }

    h3 {
        text-align: center;
        color: white;
        margin-top: 380px;
    }

    .bordr {
        border: 5px;
        height: auto;
        width: auto
    }

    p {
        text-align: center;
        color: white;
        font-family: 'Lato', arial;
    }

}

@media only screen and (max-width: 1920px) {

}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">
<head>
    <link href="css/webappcss.css" type="text/CSS" rel="stylesheet">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet">

</head>
<body>
    <header>

        <button class="btnheader">
                <h1>scxry</h1>
        </button>

    </header>
    <body>

      <div class="btn-group">

            <button class="btn1">Media</button>

            <button class="btn2">FAQ</button>

            <button class="btn3">Contact</button>

            <button class="btn4">About</button>
    </div>

               <img src="image/custom.png" class="ri" style="height: auto">

        <div style="text-align:center">

            <span class="dot"></span>

          </div>
          <h3>Blog</h3>
          <div class="bordr">
              <p>This new mobile update will provide you <br> with the
            best experience.<br> Be sure to explore the whole website,<br>
            some personal information about me:</p>
            <p>I'm 15 years old and I'm a student at JKR Wendlingen <br>
            I will finish my school soon and will then go <br>
        to the MES in Kirchheim.</p>
        <p>I was thinking of selling some 3D printed <br>
        products because you can almost make everything <br>
    therefor prototyping is no problem.</p>
    <p>Also I'm looking forward to study abroad <br> and go to the
        US. Thank you so much for visting <br>
        this website if you need any help <br>
        feel free to contact me.
    </p>
    <p><b>THANK YOU!</b></p>
          </div>
          <script type="text/javascript">
            if (screen.width >=  500) {
            document.location = "index.html";
            }
            </script>
</body>
</html></code>```

答:
Instead on the main page you can use javascript to redirect the user </p>

```<code>    <script type="text/javascript">
    if (screen.width <= 500) {
    document.location = "other.html";
    } else {
document.location = "index.html";
}
    </script>
</code>```

Body:
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.
So i have implemented you code with javascript but i still cant figure out how to do it. Ok Im noob in JS but yeah.
here my code:
First one is my index with CSS
second one is my "webapp" with CSS
And I just doesnt want to work for some reason.
If I try to resize my browser it stays on the indes file.

.fullscreen-bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  z-index: -100;
}

.fullscreen-bg__video {
  position: absolute;
  top: 30%;
  left: center;
  width: 98%;
  height: 50%;
}

html {
  font-family: 'Montserrat', Arial, Helvetica, sans-serif;
  margin-top: 20px;
  margin: 1%;
  box-shadow: 0 1px 10px white, 0 0 40px black, 0 0 80px white;
  color: black;
  height: 96%;
  width: 98%;
}

body {
  background-color: white;
  float: center;
}

h1 {
  color: black;
  text-align: center;
  font-size: 25px;
  margin-bottom: 5px;
  text-shadow: 1px 1px 4px gray, 1px 1px 4px white;
}

p {
  color: black;
  text-align: center;
  margin-top: 0px;
  font-size: 15px;
}

header {
  padding: 1px;
  margin: auto;
  box-shadow: 0 0 10px white, 0 0 20px white;
}

nav {
  margin-left: auto;
  margin-top: 50px;
  margin-bottom: auto;
  float: left;
  background-color: white;
  height: auto;
  width: auto;
}

article {
  float: center;
  margin-top: 50px;
  margin-bottom: auto;
  width: auto;
  height: 100%;
}

/*NAV Menu*/

.overlay {
  height: 100%;
  width: 0;
  position: fixed;
  z-index: 1;
  top: 0;
  left: 0;
  background-color: white;
  overflow-x: hidden;
  transition: 0.5s;
}

.overlay-content {
  position: relative;
  top: 25%;
  width: 100%;
  text-align: center;
  margin-top: 30px;
  color: black;
}

.overlay a {
  padding: 8px;
  text-decoration: none;
  font-size: 36px;
  color: black;
  display: block;
  transition: 0.3s;
}

.overlay a:hover,
.overlay a:focus {
  color: rgb(0, 0, 0, 0.2);
}

.overlay .closebtn {
  position: absolute;
  top: 20px;
  right: 45px;
  font-size: 60px;
}

span {
  color: black;
  width: auto;
  height: auto;
  margin-top: 1%;
  float: right;
  margin-right: 1%;
}

/*Responsive*/

@media screen and (max-height: 450px) {
  .overlay a {
    font-size: 20px
  }
  .overlay .closebtn {
    font-size: 40px;
    top: 15px;
    right: 35px;
  }
}

footer {
  float: center;
  margin: auto;
  margin-top: 60%;
}

p1 {
  text-align: left;
}

.style {
  font-size: 30px;
  cursor: pointer;
  font-family: monospace, arial;
}

span {
  color: black;
  width: auto;
  height: auto;
  margin-top: 1%;
  float: right;
  margin-right: 1%;
}

/*LOGO*/

img.ri {
  position: absolute;
  max-width: 80%;
  top: 10%;
  left: 10%;
  border-radius: 3px;
  width: 100px;
  height: 100px;
}

img.ri:empty {
  top: 55%;
  left: 49%;
  -webkit-transform: translate(-50%, -50%);
  -moz-transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);
  -o-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

@media only screen and (max-width: 500px) {
  html {
    background-image: url("C:/Users/Joalu/Desktop/WebApp/img/indexbackground.png");
    font-family: 'Lato';
    width: auto;
    height: 1908px;
    overflow-x: hidden;
    background-repeat: no-repeat;
  }
  body {
    margin: 0;
  }
  header {
    text-align: center;
  }
  h1 {
    font-size: 20px;
    color: white;
    margin-top: 3px;
    font-family: 'Lato';
  }
  h2 {
    display: block;
  }
  .btnheader {
    background-color: rgb(0, 0, 0, 0.5);
    border: 0;
    width: 485px;
    height: 87px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 0 30px white;
  }
  .overlay {
    background-color: rgb(0, 0, 0, 0.5);
    margin-top: 30px;
    text-align: center;
  }
  .btn-group button {
    background-color: rgb(0, 0, 0, 0.5);
    /* Green background */
    border: 0.5px solid rgb(0, 0, 0, 0.5);
    color: white;
    /* White text */
    padding: 20px 33px;
    /* Some padding */
    cursor: pointer;
    /* Pointer/hand icon */
    float: left;
    /* Float the buttons side by side */
    font-family: 'Lato', arial;
    width: 120.7px;
    text-align: center;
  }
  /* Clear floats (clearfix hack) */
  .btn-group:after {
    content: "";
    clear: both;
    display: table;
  }
  .btn-group button:not(:last-child) {
    border-right: none;
    /* Prevent double borders */
  }
  /* Add a background color on hover */
  .btn-group button:hover {
    background-color: rgb(0, 0, 0, 0.3);
    border: 0px;
    box-shadow: 0 0 40px black, 0 0 15px white;
  }
  .dot {
    height: 258px;
    width: 258px;
    background-color: rgb(0, 0, 0, 0);
    border-radius: 100%;
    display: inline-block;
    margin-top: 670px;
    cursor: pointer;
  }
  .dot:hover {
    box-shadow: 0 0 50px white;
  }
  img.ri {
    position: absolute;
    max-width: 80%;
    top: 20%;
    left: 10%;
    border-radius: 3px;
    width: 500px;
    height: 500px;
    margin-top: 140px;
  }
  img.ri:empty {
    top: 35%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
  }
  img.ri:hover {
    box-shadow: 0 0 10px gray, 0 0 40px black;
  }
  .footer {
    padding: 5%;
    height: 464px;
    width: 500px;
    background-color: rgb(0, 0, 0, 0.8);
    margin-top: 320px;
    color: white;
  }
  h3 {
    text-align: center;
    color: white;
    margin-top: 380px;
  }
  .bordr {
    border: 5px;
    height: auto;
    width: auto
  }
  p {
    text-align: center;
    color: white;
    font-family: 'Lato', arial;
  }
}

<!DOCTYPE html>

  <link rel="stylesheet" type="text/css" href="css/MainCSS.css">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/png" href="image/favicon.png" sizes="32x32">
  <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
  <title>
    scxry
  </title>

    <video loop muted autoplay poster="img/videoframe.jpg" class="fullscreen-bg__video">
        <source src="video/12345.mp4" type="video/mp4">
    </video>

    ☰

      ×

        Home
        Store
        Social Media
        Contact
        FAQ

scxry cmpny est. 2020

@media only screen and (max-width: 500px) {

    html{
        background-image: url("C:/Users/Joalu/Desktop/scxryshop.de/image/webappbackground.png");
        font-family:  'Lato';
        width: auto;
        height: 1908px;
        overflow-x: hidden;
        background-repeat: no-repeat;
    }

    body{
        margin: 0;
    }

    header{
        text-align: center;
    }

    h1 {
        font-size: 20px;
        color: white;
        margin-top: 3px;
        font-family:   'Lato';
    }

    h2 {
        display: block;

    }

    .btnheader {
        background-color: rgb(0, 0, 0,0.5);
        border: 0;
        width: 485px;
        height: 87px;
        text-align: center;
        cursor: pointer;
        box-shadow: 0 0 30px white;
    }

    .overlay {
        background-color: rgb(0, 0, 0,0.5);
        margin-top: 30px ;
        text-align: center;
    }

    .btn-group button {
        background-color: rgb(0, 0, 0,0.5); /* Green background */
        border: 0.5px solid rgb(0, 0, 0,0.5);
        color: white; /* White text */
        padding: 20px 33px; /* Some padding */
        cursor: pointer; /* Pointer/hand icon */
        float: left;/* Float the buttons side by side */
        font-family:  'Lato', arial;
        width: 120.7px;
        text-align: center;

      }

      /* Clear floats (clearfix hack) */
      .btn-group:after {
        content: "";
        clear: both;
        display: table;
      }

      .btn-group button:not(:last-child) {
        border-right: none; /* Prevent double borders */
      }

      /* Add a background color on hover */
      .btn-group button:hover {
        background-color: rgb(0, 0, 0,0.3);
        border: 0px;
        box-shadow: 0 0 40px black, 0 0 15px white;
      }

      .dot {
        height: 258px;
        width: 258px;
        background-color: rgb(0, 0, 0,0);
        border-radius: 100%;
        display: inline-block;
        margin-top: 670px;
        cursor: pointer;
      }

      .dot:hover {
          box-shadow: 0 0 50px white;
      }

      img.ri{
        position: absolute;
        max-width: 80%;
        top: 20%;
        left: 10%;
        border-radius: 3px;
        width: 500px;
        height: 500px;
        margin-top: 140px;
    }

    img.ri:empty{
        top: 35%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%);
        -moz-transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        -o-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%);
    }

    img.ri:hover{
        box-shadow: 0 0 10px gray, 0 0 40px black;
    }

    .footer {
            padding: 5%;
            height: 464px;
            width: 500px;
            background-color: rgb(0, 0, 0,0.8);
            margin-top: 320px;
            color: white;
    }

    h3 {
        text-align: center;
        color: white;
        margin-top: 380px;
    }

    .bordr {
        border: 5px;
        height: auto;
        width: auto
    }

    p {
        text-align: center;
        color: white;
        font-family: 'Lato', arial;
    }

}

@media only screen and (max-width: 1920px) {

}

<!DOCTYPE html>

    <link href="css/webappcss.css" type="text/CSS" rel="stylesheet">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="https://fonts.googleapis.com/css?family=Lato&display=swap" rel="stylesheet">

        <button class="btnheader">

scxry

        </button>

            <button class="btn1">Media</button>

            <button class="btn2">FAQ</button>

            <button class="btn3">Contact</button>

            <button class="btn4">About</button>

Blog

This new mobile update will provide you
 with the
            best experience.
 Be sure to explore the whole website,

            some personal information about me:

I'm 15 years old and I'm a student at JKR Wendlingen

            I will finish my school soon and will then go

        to the MES in Kirchheim.

I was thinking of selling some 3D printed

        products because you can almost make everything

    therefor prototyping is no problem.

Also I'm looking forward to study abroad
 and go to the
        US. Thank you so much for visting

        this website if you need any help

        feel free to contact me.

THANK YOU!

Body:
Instead on the main page you can use javascript to redirect the user

    <script type="text/javascript">
    if (screen.width <= 500) {
    document.location = "other.html";
    } else {
document.location = "index.html";
}
    </script>


问:
Construct GetMetricData API for AWS Cloudwatch in postman
I am trying to hit GetMetricData api in postman, i am facing issues (https://monitoring.us-east-1.amazonaws.com/?Action=GetMetricData&StartTime=2018-06-19T04:00:00Z &EndTime=2018-06-19T04:30:00Z).
can you please help me how i can call GetMetricData api in postman.</p>

答:
The easiest thing would be to POST it.

Here's the documentation on how to construct a POST request for CloudWatch: https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/making-api-requests.html#CloudWatch-API-requests-using-post-method

Below is an example request you can use. Save the JSON below to a file and import into postman. You will also need to create an Environment and provide ACCESS_KEY_ID, SECRET_ACCESS_KEY and REGION.

```<code>{
    "info": {
        "name": "CloudWatch",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
        {
            "name": "GetMetricData",
            "request": {
                "auth": {
                    "type": "awsv4",
                    "awsv4": [
                        {
                            "key": "service",
                            "value": "monitoring",
                            "type": "string"
                        },
                        {
                            "key": "region",
                            "value": "{{REGION}}",
                            "type": "string"
                        },
                        {
                            "key": "secretKey",
                            "value": "{{SECRET_ACCESS_KEY}}",
                            "type": "string"
                        },
                        {
                            "key": "accessKey",
                            "value": "{{ACCESS_KEY_ID}}",
                            "type": "string"
                        }
                    ]
                },
                "method": "POST",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json",
                        "type": "text"
                    },
                    {
                        "key": "X-Amz-Target",
                        "value": "GraniteServiceVersion20100801.GetMetricData",
                        "type": "text"
                    },
                    {
                        "key": "host",
                        "value": "monitoring.{{REGION}}.amazonaws.com",
                        "type": "text"
                    },
                    {
                        "key": "Accept",
                        "value": "application/json",
                        "type": "text"
                    },
                    {
                        "key": "Content-Encoding",
                        "value": "amz-1.0",
                        "type": "text"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\n\t\"MetricDataQueries\" : [\n        {\n            \"Id\": \"id\",\n            \"MetricStat\": {\n                \"Metric\": {\n                    \"Namespace\": \"AWS/DynamoDB\",\n                    \"MetricName\": \"ConsumedReadCapacityUnits\",\n                    \"Dimensions\": [\n                        {\n                            \"Name\": \"TableName\",\n                            \"Value\": \"test\"\n                        }\n                    ]\n                },\n                \"Period\": 60,\n                \"Stat\": \"Average\"\n            },\n            \"ReturnData\": true\n        }\n    ],\n    \"StartTime\": 1581719303,\n    \"EndTime\": 1581722903\n}"
                },
                "url": {
                    "raw": "https://monitoring.{{REGION}}.amazonaws.com",
                    "protocol": "https",
                    "host": [
                        "monitoring",
                        "{{REGION}}",
                        "amazonaws",
                        "com"
                    ]
                }
            },
            "response": []
        }
    ],
    "event": [
        {
            "listen": "prerequest",
            "script": {
                "type": "text/javascript",
                "exec": [
                    ""
                ]
            }
        },
        {
            "listen": "test",
            "script": {
                "type": "text/javascript",
                "exec": [
                    ""
                ]
            }
        }
    ]
}
</code>```

Body:
The easiest thing would be to POST it.

Here's the documentation on how to construct a POST request for CloudWatch: https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/making-api-requests.html#CloudWatch-API-requests-using-post-method

Below is an example request you can use. Save the JSON below to a file and import into postman. You will also need to create an Environment and provide ACCESS_KEY_ID, SECRET_ACCESS_KEY and REGION.

{
    "info": {
        "name": "CloudWatch",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
        {
            "name": "GetMetricData",
            "request": {
                "auth": {
                    "type": "awsv4",
                    "awsv4": [
                        {
                            "key": "service",
                            "value": "monitoring",
                            "type": "string"
                        },
                        {
                            "key": "region",
                            "value": "{{REGION}}",
                            "type": "string"
                        },
                        {
                            "key": "secretKey",
                            "value": "{{SECRET_ACCESS_KEY}}",
                            "type": "string"
                        },
                        {
                            "key": "accessKey",
                            "value": "{{ACCESS_KEY_ID}}",
                            "type": "string"
                        }
                    ]
                },
                "method": "POST",
                "header": [
                    {
                        "key": "Content-Type",
                        "value": "application/json",
                        "type": "text"
                    },
                    {
                        "key": "X-Amz-Target",
                        "value": "GraniteServiceVersion20100801.GetMetricData",
                        "type": "text"
                    },
                    {
                        "key": "host",
                        "value": "monitoring.{{REGION}}.amazonaws.com",
                        "type": "text"
                    },
                    {
                        "key": "Accept",
                        "value": "application/json",
                        "type": "text"
                    },
                    {
                        "key": "Content-Encoding",
                        "value": "amz-1.0",
                        "type": "text"
                    }
                ],
                "body": {
                    "mode": "raw",
                    "raw": "{\n\t\"MetricDataQueries\" : [\n        {\n            \"Id\": \"id\",\n            \"MetricStat\": {\n                \"Metric\": {\n                    \"Namespace\": \"AWS/DynamoDB\",\n                    \"MetricName\": \"ConsumedReadCapacityUnits\",\n                    \"Dimensions\": [\n                        {\n                            \"Name\": \"TableName\",\n                            \"Value\": \"test\"\n                        }\n                    ]\n                },\n                \"Period\": 60,\n                \"Stat\": \"Average\"\n            },\n            \"ReturnData\": true\n        }\n    ],\n    \"StartTime\": 1581719303,\n    \"EndTime\": 1581722903\n}"
                },
                "url": {
                    "raw": "https://monitoring.{{REGION}}.amazonaws.com",
                    "protocol": "https",
                    "host": [
                        "monitoring",
                        "{{REGION}}",
                        "amazonaws",
                        "com"
                    ]
                }
            },
            "response": []
        }
    ],
    "event": [
        {
            "listen": "prerequest",
            "script": {
                "type": "text/javascript",
                "exec": [
                    ""
                ]
            }
        },
        {
            "listen": "test",
            "script": {
                "type": "text/javascript",
                "exec": [
                    ""
                ]
            }
        }
    ]
}


问:
JQuery Toggle InputBox based on if another Inputbox has value
I have a page that contains two input boxes. I need one input box to disappear and then reappear depending on if there is a value in the other one. I've read that using JQuery is the easiest way to do this however I have limited experience with it and can't find documentation on how to implement this. Here is the page:

```<code><label asp-for="Subject" class="control-label"></label>
<input asp-for="Subject" class="form-control" id="Subject"/>

<label asp-for="Header" class="control-label"></label>
<input asp-for="Header" class="form-control" id="Header"/>
</code>```

Here is the JQuery I have so far from my limited knowledge. The input box is gone at the start.

```<code><script type="text/javascript">
$("#Subject").val(function () {
    $("#Header").toggle(this.length > 0);
});
</code>```

I am not sure how to implement this where writing text in one textbox will make the other one disappear. The debugger is not supplying any error messages about the code.

答:
If you want to show the "Header" when the user has typed something in the "Subject"-input:

```<code>$("#Subject").on("input", function () {
   $("#Header").toggle(!!$(this).val().length);
});
</code>```

You should also add style="display: none;" to the header to initially hide it.

Alternatively you could trigger the 'input' event manually once:

```<code>$("#Subject").on("input", function () {
   $("#Header").toggle(!!$(this).val().length);
}).trigger("input");
</code>```

Body:
I have a page that contains two input boxes. I need one input box to disappear and then reappear depending on if there is a value in the other one. I've read that using JQuery is the easiest way to do this however I have limited experience with it and can't find documentation on how to implement this. Here is the page:

<input asp-for="Subject" class="form-control" id="Subject"/>

<input asp-for="Header" class="form-control" id="Header"/>

Here is the JQuery I have so far from my limited knowledge. The input box is gone at the start.

Body:
If you want to show the "Header" when the user has typed something in the "Subject"-input:

$("#Subject").on("input", function () {
   $("#Header").toggle(!!$(this).val().length);
});

You should also add style="display: none;" to the header to initially hide it.

Alternatively you could trigger the 'input' event manually once:

$("#Subject").on("input", function () {
   $("#Header").toggle(!!$(this).val().length);
}).trigger("input");


问:
How to split table by row in Power BI
Simple question: I have a table that needs to be split into 2 tables via a row split and not the column split. How can I achieve this?

Thanks.

答:
Duplicate the table, then delete the columns that you do not need from each of the copies.

To duplicate the table, open Power Query Editor by clicking on Edit Queries, right click your table and select Duplicate:

Then in each of the copies, right click on the header of the columns that you don't want, and select Remove. Alternatively, you can select the columns that you want to keep, and select Remove other columns.

Title: How to split table by row in Power BI


问:
How to change fragment's text from Service class?
I have a fragment that contains a TextView. Also, I have a class that extends Service.

How can I change fragment's TextView text from this Service class?
I tried to create an instance from my fragment to use it for calling an update method inside the fragment, but I realized that I can't call getSupportFragmentManager() inside a Service class.

So, what should I do?

答:
For such purpose Android have broadcast receiver.
https://developer.android.com/reference/android/content/BroadcastReceiver</p>


问:
R Officer Update the text of a shape
I am using officer to generate a weekly PowerPoint deck for my management.
They have provided me with a template they wish to use.
I have automated the whole process apart from one part which is causing me some difficulty i was hoping someone could help with

The first slide in the template for them is a very nice cover slide but contains a text box with the Week number the report is to address so for example Report Week 5. I wish to change this every week i run the report. The next iteration would be Report Week 6. The name of the text box is called TextField 26 when i press ALT+F10 in windows

I have tried numerous solutions from here, here and here

I just cant seem to reference the slide itself within the template. I have seen the response on GITHUB related to a similar question where the advice was to remove the old shape and re-add it. I would be happy to do this but again I am unable to reference the title slide.

I would really appreciate anyone's insight to this

Thank you very much for your time

答:
I think you would have this placeholder in the template rather than in an existing slide would make things easier to manage. However, if you are using a powerpoint where the first slide contain an empty shape named "TextField 26", the officer code would be:

```<code>library(officer)
doc <- read_pptx("update_shape_text.pptx")
doc <- ph_add_text(doc, str = "Report Week 5", ph_label = "TextField 26")
print(doc, "result.pptx")
</code>```

Note I can't attach update_shape_text.pptx so I used a github issue so that you can get the files. https://github.com/davidgohel/flextable/issues/189

Title: R Officer Update the text of a shape

Body:
I think you would have this placeholder in the template rather than in an existing slide would make things easier to manage. However, if you are using a powerpoint where the first slide contain an empty shape named "TextField 26", the officer code would be:

library(officer)
doc <- read_pptx("update_shape_text.pptx")
doc <- ph_add_text(doc, str = "Report Week 5", ph_label = "TextField 26")
print(doc, "result.pptx")

Note I can't attach update_shape_text.pptx so I used a github issue so that you can get the files. https://github.com/davidgohel/flextable/issues/189


问:
PHP Constant Conventions
Greetings StackOverflow

I'm doing some house cleaning and thought I would ask for some suggested practices in PHP as I re-factor my classes.  In particular, I have some class constants which fall into categories and I would like to know some good ways to group the ones which share a common purpose.

An Example:

```<code>class MySquare {
  // Colors
  const COLOR_GREEN = "green";
  const COLOR_RED = "red";

  // Widths
  const WIDTH_SMALL = 100;
  const WIDTH_MEDIUM = 500;
  const WIDTH_BIG = 1000;

  // Heights
  const HEIGHT_SMALL = 100;
  const HEIGHT_MEDIUM = 300;
  const HEIGHT_BIG = 500;
}
</code>```

Obviously this works, but it seems like there are probably plenty of options when it comes to grouping related constants, and I bet this is inferior to most.  How would you do it?

答:
As variant, you can create some interfaces, where you can define constants. More code, but... grouped :)  </p>

```<code>interface IColorsConstants
{
    const COLOR_GREEN = "green";
    const COLOR_RED = "red";
}

interface IWidths
{
    const WIDTH_SMALL = 100;
    const WIDTH_MEDIUM = 500;
    const WIDTH_BIG = 1000;
}

interface IHeights
{
    const HEIGHT_SMALL = 100;
    const HEIGHT_MEDIUM = 300;
    const HEIGHT_BIG = 500;
}

class MySquare implements IColorsConstants, IHeights, IWidths
{

}
</code>```

Title: PHP Constant Conventions

Body:
Greetings StackOverflow

I'm doing some house cleaning and thought I would ask for some suggested practices in PHP as I re-factor my classes.  In particular, I have some class constants which fall into categories and I would like to know some good ways to group the ones which share a common purpose.

An Example:

class MySquare {
  // Colors
  const COLOR_GREEN = "green";
  const COLOR_RED = "red";

  // Widths
  const WIDTH_SMALL = 100;
  const WIDTH_MEDIUM = 500;
  const WIDTH_BIG = 1000;

  // Heights
  const HEIGHT_SMALL = 100;
  const HEIGHT_MEDIUM = 300;
  const HEIGHT_BIG = 500;
}

Obviously this works, but it seems like there are probably plenty of options when it comes to grouping related constants, and I bet this is inferior to most.  How would you do it?

Body:
As variant, you can create some interfaces, where you can define constants. More code, but... grouped :)

interface IColorsConstants
{
    const COLOR_GREEN = "green";
    const COLOR_RED = "red";
}

interface IWidths
{
    const WIDTH_SMALL = 100;
    const WIDTH_MEDIUM = 500;
    const WIDTH_BIG = 1000;
}

interface IHeights
{
    const HEIGHT_SMALL = 100;
    const HEIGHT_MEDIUM = 300;
    const HEIGHT_BIG = 500;
}

class MySquare implements IColorsConstants, IHeights, IWidths
{

}


问:
Blocked by CORS policy: Request header field access-control-allow-origin is not allowed
I have a Node JS app which acts as server and processes the data through POST request and running on other port.On the other part i have another jQuery web application which acts as client and sends the post request to Node JS app.

When i try to POST the data from jQuery client, it is throwing error as below

```<code>Access to XMLHttpRequest at 'http://localhost:3000/data' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response
</code>```

Below is my Node JS and i have added the any domain to access Node JS app

```<code>// Starting the App Server on Port 3000
app.listen(3000, function() {
console.log("Server running on port http://localhost:3000");
});

// set headers for allowing cross domain access
//Add headers
app.use(function (req, res, next) {

    // Website you wish to allow to connect
    res.setHeader('Access-Control-Allow-Origin', '*');

    // Request methods you wish to allow
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');

    // Request headers you wish to allow
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');

    // Set to true if you need the website to include cookies in the requests sent
    // to the API (e.g. in case you use sessions)
    res.setHeader('Access-Control-Allow-Credentials', true);

    // Pass to next layer of middleware
    next();
});
</code>```

My client jquery looks like below which post the data to Node JS

```<code>$(document).ready(function(){
      $("button").click(function(){
console.log(" Entered inside click ");

$.ajax({
    contentType: 'application/json',
    data: '{"data":"<div>Some raw data pushed to node url</div>"}',
    dataType: 'json',
    success: function(data){
        console.log(" Data Received ");
        $("#content").append("Data received");
    },
    error: function(){
        console.log(" Error while connecting for data");
    },
    processData: false,
    type: 'POST',
    url: 'http://localhost:3000/data',
    headers: {
        "accept": "application/json",
        "Access-Control-Allow-Origin":"*"
    }
});
</code>```

答: You need to remove the Access-Control-Allow-Origin header from the request. The header should only be included in the response. To me it seems like since it is not in the list of allowed headers and you don't specifically allow it in your Node app it causes the issue.</p>

Body:
I have a Node JS app which acts as server and processes the data through POST request and running on other port.On the other part i have another jQuery web application which acts as client and sends the post request to Node JS app.

When i try to POST the data from jQuery client, it is throwing error as below

Access to XMLHttpRequest at 'http://localhost:3000/data' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field access-control-allow-origin is not allowed by Access-Control-Allow-Headers in preflight response

Below is my Node JS and i have added the any domain to access Node JS app

// Starting the App Server on Port 3000
app.listen(3000, function() {
console.log("Server running on port http://localhost:3000");
});

// set headers for allowing cross domain access
//Add headers
app.use(function (req, res, next) {

    // Website you wish to allow to connect
    res.setHeader('Access-Control-Allow-Origin', '*');

    // Request methods you wish to allow
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');

    // Request headers you wish to allow
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');

    // Set to true if you need the website to include cookies in the requests sent
    // to the API (e.g. in case you use sessions)
    res.setHeader('Access-Control-Allow-Credentials', true);

    // Pass to next layer of middleware
    next();
});

My client jquery looks like below which post the data to Node JS

$(document).ready(function(){
      $("button").click(function(){
console.log(" Entered inside click ");

$.ajax({
    contentType: 'application/json',
    data: '{"data":"
Some raw data pushed to node url
"}',
    dataType: 'json',
    success: function(data){
        console.log(" Data Received ");
        $("#content").append("Data received");
    },
    error: function(){
        console.log(" Error while connecting for data");
    },
    processData: false,
    type: 'POST',
    url: 'http://localhost:3000/data',
    headers: {
        "accept": "application/json",
        "Access-Control-Allow-Origin":"*"
    }
});


问:
Why one more parameter is passed in a method in smali code
In a piece of smali code that I decoded via apktool, I found a method call passes one more argument than these are declared in then method definition. That extra argument is definitely not used at all. But if I remove it, Error occurs when run, saying "expected two, found three" from "verifier". What's going on here?</p>

```<code># method definition
.method public setLatitude(D)V
    .locals 1
    #(snipped)
.end method

# method call
# v3 is not defined actually
invoke-virtual {v1, v2, v3}, LFoo;->setLongitude(D)V

</code>```

答:
All non-static methods accept the object that the method is being called on as the first parameter.

In your example, the method accepts an argument of type D, which is a wide type that takes 2 registers.  In this case, v1 is the LFoo; instance that the method is being called on, and [v2, v3] is the register pair that contains the 64-bit wide argument to the method.

When you say that "v3 is not defined actually", it would be implicitly set when v2 is set, because all wide values are stored using consecutive register pairs.

Body:
In a piece of smali code that I decoded via apktool, I found a method call passes one more argument than these are declared in then method definition. That extra argument is definitely not used at all. But if I remove it, Error occurs when run, saying "expected two, found three" from "verifier". What's going on here?

# method definition
.method public setLatitude(D)V
    .locals 1
    #(snipped)
.end method

# method call
# v3 is not defined actually
invoke-virtual {v1, v2, v3}, LFoo;->setLongitude(D)V


问:
Taking the rows of a data.frame and transposing into one column vector
I would like to take each rows of a data.frame, a [45,6] data.frame and make one continuous column vector with out have to write each index, such as; data.frame1 <- t(data.frame[1,2:6]), I just want the last five columns, then combining with rbind. Is there an R function for this, or is a loop function capable? Note: my loop skills are not so good.

Thanks Kirk

Body:
Here's a solution that seems to work, using tto transpose columns into rows (and vice versa) and unlistto append multiple columns into a single vector:

DATA:

df <- mtcars[,1:6]

SOLUTION:

df_t <-t(df[,2:6])
as.numeric(unlist(df_t))

RESULT:

  [1]   6.000 160.000 110.000   3.900   2.620   6.000 160.000 110.000   3.900   2.875   4.000 108.000  93.000
 [14]   3.850   2.320   6.000 258.000 110.000   3.080   3.215   8.000 360.000 175.000   3.150   3.440   6.000
 [27] 225.000 105.000   2.760   3.460   8.000 360.000 245.000   3.210   3.570   4.000 146.700  62.000   3.690
 [40]   3.190   4.000 140.800  95.000   3.920   3.150   6.000 167.600 123.000   3.920   3.440   6.000 167.600
 [53] 123.000   3.920   3.440   8.000 275.800 180.000   3.070   4.070   8.000 275.800 180.000   3.070   3.730
 [66]   8.000 275.800 180.000   3.070   3.780   8.000 472.000 205.000   2.930   5.250   8.000 460.000 215.000
 [79]   3.000   5.424   8.000 440.000 230.000   3.230   5.345   4.000  78.700  66.000   4.080   2.200   4.000
 [92]  75.700  52.000   4.930   1.615   4.000  71.100  65.000   4.220   1.835   4.000 120.100  97.000   3.700
[105]   2.465   8.000 318.000 150.000   2.760   3.520   8.000 304.000 150.000   3.150   3.435   8.000 350.000
[118] 245.000   3.730   3.840   8.000 400.000 175.000   3.080   3.845   4.000  79.000  66.000   4.080   1.935
[131]   4.000 120.300  91.000   4.430   2.140   4.000  95.100 113.000   3.770   1.513   8.000 351.000 264.000
[144]   4.220   3.170   6.000 145.000 175.000   3.620   2.770   8.000 301.000 335.000   3.540   3.570   4.000
[157] 121.000 109.000   4.110   2.780


问:
Why RxSwift concat with multiple observables does not seem to work?
My RxSwift code is,

```<code>func testOperators(){

    let bag = DisposeBag()

    let observable1 = PublishSubject<String>()
    let observable2 = PublishSubject<String>()

    Observable.concat([observable1, observable2])
        .subscribe(onNext: { (value) in
            print(value)
        }).disposed(by: bag)

    observable1.on(.next("1"))
    observable1.on(.next("2"))

    observable2.on(.next("3"))
    observable2.on(.next("4"))

    observable1.on(.completed)
    observable2.on(.completed)
}
</code>```

Current output is,

```<code>1
2
</code>```

My expected output is,

```<code>1
2
3
4
</code>```

What am I missing & what I can add/edit to get the expected output?

答:
```<code>    let bag = DisposeBag()

    let observable1 = PublishSubject<String>()
    let observable2 = PublishSubject<String>()

    Observable.concat([observable1, observable2])
        .subscribe(onNext: { (value) in
            print(value)
        }).disposed(by: bag)

    observable1.on(.next("1"))
    observable1.on(.next("2"))
    observable1.on(.completed) //observable1 emission has been completed here.

    //so now observable2 emission will start here
    observable2.on(.next("3"))
    observable2.on(.next("4"))
    observable2.on(.completed) //observable2 emission has been completed here.
</code>```

This will give you your expected output, I hope this will help :)

Body:
My RxSwift code is,

func testOperators(){

    let bag = DisposeBag()

    let observable1 = PublishSubject<String>()
    let observable2 = PublishSubject<String>()

    Observable.concat([observable1, observable2])
        .subscribe(onNext: { (value) in
            print(value)
        }).disposed(by: bag)

    observable1.on(.next("1"))
    observable1.on(.next("2"))

    observable2.on(.next("3"))
    observable2.on(.next("4"))

    observable1.on(.completed)
    observable2.on(.completed)
}

Current output is,

1
2

My expected output is,

1
2
3
4

What am I missing & what I can add/edit to get the expected output?

Body:
    let bag = DisposeBag()

    let observable1 = PublishSubject<String>()
    let observable2 = PublishSubject<String>()

    Observable.concat([observable1, observable2])
        .subscribe(onNext: { (value) in
            print(value)
        }).disposed(by: bag)

    observable1.on(.next("1"))
    observable1.on(.next("2"))
    observable1.on(.completed) //observable1 emission has been completed here.

    //so now observable2 emission will start here
    observable2.on(.next("3"))
    observable2.on(.next("4"))
    observable2.on(.completed) //observable2 emission has been completed here.

This will give you your expected output, I hope this will help :)


问:
how to detect removable devices and assign it as the source it order to copy file from it using python?
I have a python script that first detect removable devices and then copy files from this removable device to a new destination.

I have created a function to detect removable devices and a second function to copy from files.

but the problem i do not know how to make the detected device as the source for the copy function.

For now i am hard coded the source but its not a good practice.

code:

```<code>import win32api
import win32file

import calendar
import os
import shutil
from os import path
from datetime import date

def main():
    detectUSB()
    copy()

def detectUSB():
    # Returns a list containing letters from removable drives
    drive_list = win32api.GetLogicalDriveStrings()
    drive_list = drive_list.split("\x00")[0:-1]  # the last element is ""
    list_removable_drives = []
    for letter in drive_list:
        if win32file.GetDriveType(letter) == win32file.DRIVE_REMOVABLE:# check if the drive is of type removable
            list_removable_drives.append(letter)
    print("list drives: {0}".format(letter))
    return list_removable_drives

src = "I:\\" ## this is where i hardcoded the source

def copy():

    try:
        for dirpath, dirnames, files in os.walk(src):

            print(f'Found directory: {dirpath}')
            # for file_name in files:
            if len(dirnames)==0 and len(files)==0:
                    print("this directory is empty")
            else:
                print(files)
    except Exception as e:
        print(e)
if os.path.exists(dst):
        shutil.rmtree(dst)
        print("the deleted folder is :{0}".format(dst))
        #copy the folder as it is (folder with the files)
        copieddst = shutil.copytree(src2,dst)
        print("copy of the folder is done :{0}".format(copieddst))
    else:
        #copy the folder as it is (folder with the files)
        copieddst = shutil.copytree(src2,dst)
        print("copy of the folder is done :{0}".format(copieddst))

if __name__=="__main__":
    main()
</code>```

so i want to make the return variable of the detectUSB() function as a argument the src for the copy() function.

答:
i fixed the problem by returning the variable of the detectUSB() function  and then assign it to the copy () function  with adding the argument to the copy() function as below:

in the main function

```<code>copy(detectUSB())
</code>```

in the copy function

```<code>def copy(src)
        for dirpath, dirnames, files in os.walk(src):
</code>```

Body:
I have a python script that first detect removable devices and then copy files from this removable device to a new destination.

I have created a function to detect removable devices and a second function to copy from files.

but the problem i do not know how to make the detected device as the source for the copy function.

For now i am hard coded the source but its not a good practice.

code:

import win32api
import win32file

import calendar
import os
import shutil
from os import path
from datetime import date

def main():
    detectUSB()
    copy()

def detectUSB():
    # Returns a list containing letters from removable drives
    drive_list = win32api.GetLogicalDriveStrings()
    drive_list = drive_list.split("\x00")[0:-1]  # the last element is ""
    list_removable_drives = []
    for letter in drive_list:
        if win32file.GetDriveType(letter) == win32file.DRIVE_REMOVABLE:# check if the drive is of type removable
            list_removable_drives.append(letter)
    print("list drives: {0}".format(letter))
    return list_removable_drives

src = "I:\\" ## this is where i hardcoded the source

def copy():

    try:
        for dirpath, dirnames, files in os.walk(src):

            print(f'Found directory: {dirpath}')
            # for file_name in files:
            if len(dirnames)==0 and len(files)==0:
                    print("this directory is empty")
            else:
                print(files)
    except Exception as e:
        print(e)
if os.path.exists(dst):
        shutil.rmtree(dst)
        print("the deleted folder is :{0}".format(dst))
        #copy the folder as it is (folder with the files)
        copieddst = shutil.copytree(src2,dst)
        print("copy of the folder is done :{0}".format(copieddst))
    else:
        #copy the folder as it is (folder with the files)
        copieddst = shutil.copytree(src2,dst)
        print("copy of the folder is done :{0}".format(copieddst))

if __name__=="__main__":
    main()

so i want to make the return variable of the detectUSB() function as a argument the src for the copy() function.

Body:
i fixed the problem by returning the variable of the detectUSB() function  and then assign it to the copy () function  with adding the argument to the copy() function as below:

in the main function

copy(detectUSB())

in the copy function

def copy(src)
        for dirpath, dirnames, files in os.walk(src):


问:
Loop through one table with another loop for each record
I have one table with categories and another table with linkrecords for each category and the table structure looks like this:

categories:

```<code>id (int)
name (varchar)
</code>```

links:

```<code>id (int)
link (varchar)
fk_cat_id (int)
</code>```

Here is how I do now, but know that it is a no go with a query within a query:

```<code>$query = "SELECT * FROM categories";
if ($result = $mysqli->query($query)) {
    while ($row = $result->fetch_assoc()) {
        $catid = $row['cat_id'];

        echo 'CatName: '.$row['name'];
        echo '<ul>';

        $query2 = "SELECT * FROM links WHERE fk_cat_id = $catid";
        if ($result2 = $mysqli->query($query2)) {
            while ($row2 = $result2->fetch_assoc()) {
                echo '<li>'.$row2['link'].'</li>';
            }
        }

        echo '</ul>';

    }
}
</code>```

I guess I have to go to some JOIN method, but not sure how!

答:
Following query will be used to retrieve links with relation to link categories.
Also, It is a good practice to specify fields name in query to retrieve specific columns only instead of *.

SELECT links.id AS link_id, links.link, links.fk_cat_id, categories.name
FROM links
JOIN categories ON categories.id = links.fk_cat_id;
```

Body:
I have one table with categories and another table with linkrecords for each category and the table structure looks like this:

categories:

id (int)
name (varchar)

links:

id (int)
link (varchar)
fk_cat_id (int)

Here is how I do now, but know that it is a no go with a query within a query:

$query = "SELECT * FROM categories";
if ($result = $mysqli->query($query)) {
    while ($row = $result->fetch_assoc()) {
        $catid = $row['cat_id'];

        echo 'CatName: '.$row['name'];
        echo '
';

        $query2 = "SELECT * FROM links WHERE fk_cat_id = $catid";
        if ($result2 = $mysqli->query($query2)) {
            while ($row2 = $result2->fetch_assoc()) {
                echo '
'.$row2['link'].'
';
            }
        }

        echo '
';

    }
}

I guess I have to go to some JOIN method, but not sure how!


问:
Console hangs on newline after getting user input
I need this program to ask the user to input a number to add to an array. After they input the number, the console goes to a newline until you press another key, at which point it will do the same thing over again. I'm new to C# and I assume this has something to do with the fact that it's reading the enter key after the user inputs the information, so I need to use something equivalent to cin.ignore(), but I haven't been able to find anything that solves the issue.

```<code>public void InputSet()
{
    int userInput;

    do
    {
        C.Write("Enter an element (Enter to end): ");
        userInput = Convert.ToInt32(C.ReadLine()); // Read user input

        if (userInput < 1 || userInput > 50) // Check if in bounds
            C.WriteLine("Input is invalid. Enter from 1 to 50."); // Error message if out of bounds
        else
        {
            Array.Resize(ref arr, arr.Length + 1); // Expand array and then add it in
            arr[arr.Length - 1] = userInput;
        }
    } while(Console.ReadKey (true).Key != ConsoleKey.Enter); // If enter key is pressed, exit loop
</code>```

Here is a video of the problem:
Hanging on newline

答:
The console is not hanging - it is expecting an input in order to continue the while loop:

```<code>while(Console.ReadKey (true).Key != ConsoleKey.Enter);
</code>```

I have tested the code and it works fine - Perhaps you might want to feedback the user in what action to take in order to finish or to continue.

```<code>        Console.WriteLine("Press enter to terminate or C to continue");
    } while (Console.ReadKey(true).Key != ConsoleKey.Enter); // If enter key is pressed, exit loop
</code>```

Any key will do really.

Body:
I need this program to ask the user to input a number to add to an array. After they input the number, the console goes to a newline until you press another key, at which point it will do the same thing over again. I'm new to C# and I assume this has something to do with the fact that it's reading the enter key after the user inputs the information, so I need to use something equivalent to cin.ignore(), but I haven't been able to find anything that solves the issue.

public void InputSet()
{
    int userInput;

    do
    {
        C.Write("Enter an element (Enter to end): ");
        userInput = Convert.ToInt32(C.ReadLine()); // Read user input

        if (userInput < 1 || userInput > 50) // Check if in bounds
            C.WriteLine("Input is invalid. Enter from 1 to 50."); // Error message if out of bounds
        else
        {
            Array.Resize(ref arr, arr.Length + 1); // Expand array and then add it in
            arr[arr.Length - 1] = userInput;
        }
    } while(Console.ReadKey (true).Key != ConsoleKey.Enter); // If enter key is pressed, exit loop

Here is a video of the problem:
Hanging on newline

Body:
The console is not hanging - it is expecting an input in order to continue the while loop:

while(Console.ReadKey (true).Key != ConsoleKey.Enter);

I have tested the code and it works fine - Perhaps you might want to feedback the user in what action to take in order to finish or to continue.

        Console.WriteLine("Press enter to terminate or C to continue");
    } while (Console.ReadKey(true).Key != ConsoleKey.Enter); // If enter key is pressed, exit loop

Any key will do really.