问:
Android.Views.InflateException: <Timeout exceeded getting exception details>
I'm testing a sample app and I get the runtime exception: Android.Views.InflateException: <Timeout exceeded getting exception details> on line

SetContentView(Resource.Layout.Main);

The problem is the button in Main.axml:

```<code><ImageButton
    android:id="@+id/playButton"
    android:layout_height="@dimen/playButton_size"
    android:layout_width="@dimen/playButton_size"
    android:src="@drawable/ic_play_circle_outline_dark_blue_48dp"
    android:layout_alignParentBottom="true"
    android:layout_centerInParent="true"
    android:background="@android:color/transparent"
    android:adjustViewBounds="true"
    android:scaleType="fitXY" />
</code>```

If I replace @dimen/playButton_size above with 64dp from Resources\values-sw320dp\dimens.xml the error is resolved. Why? here is the full dimens.xml:

```<code><?xml version="1.0" encoding="utf-8" ?>
<resources>
  <dimen name="playButton_size">64dp</dimen>
</resources>
</code>```

答:
The most common reason for the error message:

Android.Views.InflateException: Timeout exceeded getting exception details

Is that it's trying to render something too large, or alternatively a parameter that it's trying to apply can't be compiled from resources which is a little harder to spot.

Delete obj, bin folders, perform a clean, and rebuild and attempt it again. That's usually the best option for a problem that seems a little transient.

also bear in mind that android does not perform any kind of optimization of images, it expects you to do this, so you'll also get inflate exceptions if it's trying to load an image that exceeds the available heap size assigned to the the application by the OS.

Body:
I'm testing a sample app and I get the runtime exception: Android.Views.InflateException: <Timeout exceeded getting exception details> on line

SetContentView(Resource.Layout.Main);

The problem is the button in Main.axml:

<ImageButton
    android:id="@+id/playButton"
    android:layout_height="@dimen/playButton_size"
    android:layout_width="@dimen/playButton_size"
    android:src="@drawable/ic_play_circle_outline_dark_blue_48dp"
    android:layout_alignParentBottom="true"
    android:layout_centerInParent="true"
    android:background="@android:color/transparent"
    android:adjustViewBounds="true"
    android:scaleType="fitXY" />

If I replace @dimen/playButton_size above with 64dp from Resources\values-sw320dp\dimens.xml the error is resolved. Why? here is the full dimens.xml:

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <dimen name="playButton_size">64dp</dimen>
</resources>


来源: stackexchange

问:
how to copy values from one sheet where the values are starting from a specific row
I want to copy values from sheet named "Price Schedule" where the values which I want to start copying from "Row 10" and ONLY "Column D" and "Column F" should be copied. And paste it into another sheet named "Sheet1". It should start pasting values from "row 25" and paste under "Column H" and "Column I".

I want to put a condition statement where I want to copy only the rows which have the value grater than "zero" in "Column D" in sheet "Price Schedule" and paste it in "sheet1" under Column"H" and Column "I" starting from "row 25".

```<code>Private Sub CommandButton1_Click()

a = Worksheets("PRICE SCHEDULE").Cells(Rows.Count, 1).End(xlUp).Row

For I = 2 To a
    If Worksheets("PRICE SCHEDULE").Cells(I, 4).Value = ">0" Then
        Worksheets("PRICE SCHEDULE").Rows(I).Copy
        Worksheets("Sheet1").Activate

        b = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
        ActiveSheet.Paste

        Worksheets("PRICE SCHEDULE").Activate
    End If
Next

End Sub
</code>```

I tried doing this and passed a msgbox to see the results but it shows no results of the copied data.

Please see the images for better understanding.

答:
Try something like the code below:</p>

```<code>Option Explicit

Private Sub CommandButton1_Click()

Dim LastRow As Long, i As Long, b As Long

With Worksheets("PRICE SCHEDULE")
    LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row

    For i = 10 To LastRow ' loop from row 10 and forward
        If .Range("D" & i).Value >= 0 Then
            ' first get the next empty row to paste
            b = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row + 1

            ' copy column "D" to column "H"
            .Range("D" & i).Copy Destination:=Worksheets("Sheet1").Range("H" & b)
            ' copy column "F" to column "I"
            .Range("F" & i).Copy Destination:=Worksheets("Sheet1").Range("I" & b)
        End If
    Next
End With

End Sub
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I want to copy values from sheet named "Price Schedule" where the values which I want to start copying from "Row 10" and ONLY "Column D" and "Column F" should be copied. And paste it into another sheet named "Sheet1". It should start pasting values from "row 25" and paste under "Column H" and "Column I".

I want to put a condition statement where I want to copy only the rows which have the value grater than "zero" in "Column D" in sheet "Price Schedule" and paste it in "sheet1" under Column"H" and Column "I" starting from "row 25".

Private Sub CommandButton1_Click()

a = Worksheets("PRICE SCHEDULE").Cells(Rows.Count, 1).End(xlUp).Row

For I = 2 To a
    If Worksheets("PRICE SCHEDULE").Cells(I, 4).Value = ">0" Then
        Worksheets("PRICE SCHEDULE").Rows(I).Copy
        Worksheets("Sheet1").Activate

        b = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
        ActiveSheet.Paste

        Worksheets("PRICE SCHEDULE").Activate
    End If
Next

End Sub

I tried doing this and passed a msgbox to see the results but it shows no results of the copied data.

Please see the images for better understanding.

Body:
Try something like the code below:

Option Explicit

Private Sub CommandButton1_Click()

Dim LastRow As Long, i As Long, b As Long

With Worksheets("PRICE SCHEDULE")
    LastRow = .Cells(.Rows.Count, 1).End(xlUp).Row

    For i = 10 To LastRow ' loop from row 10 and forward
        If .Range("D" & i).Value >= 0 Then
            ' first get the next empty row to paste
            b = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row + 1

            ' copy column "D" to column "H"
            .Range("D" & i).Copy Destination:=Worksheets("Sheet1").Range("H" & b)
            ' copy column "F" to column "I"
            .Range("F" & i).Copy Destination:=Worksheets("Sheet1").Range("I" & b)
        End If
    Next
End With

End Sub


问:
jquery select table columns
I am working on selecting a specific table's cells.

Some cells have a class of "testOff", and I'm attempting to change the table row to a different color, if the class exists.

here's what I have so far:

```<code>$("table#customersTable td.testOff").each(function(){

    $(this).closest("tr").css("background-color","#F6CCDA");

});
</code>```

I must be missing something, since it's not showing the background color for any of the cells.
Does anyone see an error with how I'm selecting?

答:
You could use something like:

```<code>$('td.testOff').closest('tr').addClass('highlightColour');
</code>```

CSS:

```<code>.highlight,
.highlight td /* this part's important, and ensures that the 'highlight' colour is seen in the td elements */
{
    background-color: #ffa;
}
</code>```

JS Fiddle demo.

Incidentally: you don't need the each(), as the selector will return, and work with, an array of elements already.

References:

each().

closest().

addClass().

ContentLicense: CC BY-SA 3.0

Title: jquery select table columns

Body:
I am working on selecting a specific table's cells.

Some cells have a class of "testOff", and I'm attempting to change the table row to a different color, if the class exists.

here's what I have so far:

$("table#customersTable td.testOff").each(function(){

    $(this).closest("tr").css("background-color","#F6CCDA");

});

I must be missing something, since it's not showing the background color for any of the cells.
Does anyone see an error with how I'm selecting?

Body:
You could use something like:

$('td.testOff').closest('tr').addClass('highlightColour');

CSS:

.highlight,
.highlight td /* this part's important, and ensures that the 'highlight' colour is seen in the td elements */
{
    background-color: #ffa;
}

JS Fiddle demo.

Incidentally: you don't need the each(), as the selector will return, and work with, an array of elements already.

References:

each().

closest().

addClass().


问:
Get Rid of the Black border in CSS
I tried using all the solutions listed here How remove border around image in css? but they doesnt, work. I am trying to get rid of the black border from the image, I tried the following but it doesn't work. the border is part of the image

    ```

答: Since you've mentioned in the comments that the border is part of the image, CSS isn't really the place to fix it.  You could try to put the image inside of a div that is smaller than the image and then set overflow to hidden.  But that would be a hacky workaround.  The proper way to handle it would be to fix the image itself, using gimp or some other image manipulation tool.</p>

Title: Get Rid of the Black border in CSS


问:
Angular 7 Service providedIn: 'root'
I'm very new to angular development so please forgive me if this is a very basic question

But I have a cart service which I have at the moment simply has a simple console log function

import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class CartService {

  constructor( ) {}

  public addItem() {
    console.log('Hello');
  }
}```

and basically I cannot figure out how to use this service within a NG Module that I have installed, I have successfully used it in other components via the constructor but the ngmodule doesn't have this?

I get the fact that it's a singleton at the app-module level by using the providedIn: 'root' tag added in angular 6

but just can't figure out how to call cartService.addItem()?

Thanks if anyone can help!

答:
If you created a new module, you need to introduce the service to your module, by going to the .module.ts file and adding your service to the providers array. It will be something like:

```<code>providers: [
    CartService
  ],
</code>```

Title: Angular 7 Service providedIn: 'root'

Body:
I'm very new to angular development so please forgive me if this is a very basic question

But I have a cart service which I have at the moment simply has a simple console log function

import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class CartService {

  constructor( ) {}

  public addItem() {
    console.log('Hello');
  }
}

and basically I cannot figure out how to use this service within a NG Module that I have installed, I have successfully used it in other components via the constructor but the ngmodule doesn't have this?

I get the fact that it's a singleton at the app-module level by using the providedIn: 'root' tag added in angular 6

but just can't figure out how to call cartService.addItem()?

Thanks if anyone can help!

Body:
If you created a new module, you need to introduce the service to your module, by going to the .module.ts file and adding your service to the providers array. It will be something like:

providers: [
    CartService
  ],


问:
My function returns None even when I print on above line, what I am missing?
My recrusive function returns None even when I print the variable on the above line

When I call the function it prints exactly what I want, but returns None!

```<code>def nRound(vector, root):
    tempRoot = root
    a = vector.pop()
    b = vector.pop()
    if  a+b < 1.0:
        vector.append(a+b)
        rootn = Node(a+b)
        rootn.right = tempRoot
        rootn.left = Node(b)
        nRound(vector, rootn)

    else:
        rootn = Node(a+b)
        rootn.right = tempRoot
        rootn.left = Node(b)
        print(rootn)
        return rootn
</code>```

I don't understand why it returns None instead rootn. Thanks in advance.

答:
Your function is recursive, and only the base case returns a value. Values from the recursive call are not passed upward:

```<code>    nRound(vector, rootn)
</code>```

That means an external caller will only get a value if the function immediately reaches the base case. The above line should be

```<code>    return nRound(vector, rootn)
</code>```

Body:
My recrusive function returns None even when I print the variable on the above line

When I call the function it prints exactly what I want, but returns None!

def nRound(vector, root):
    tempRoot = root
    a = vector.pop()
    b = vector.pop()
    if  a+b < 1.0:
        vector.append(a+b)
        rootn = Node(a+b)
        rootn.right = tempRoot
        rootn.left = Node(b)
        nRound(vector, rootn)

    else:
        rootn = Node(a+b)
        rootn.right = tempRoot
        rootn.left = Node(b)
        print(rootn)
        return rootn

I don't understand why it returns None instead rootn. Thanks in advance.

Body:
Your function is recursive, and only the base case returns a value. Values from the recursive call are not passed upward:

    nRound(vector, rootn)

That means an external caller will only get a value if the function immediately reaches the base case. The above line should be

    return nRound(vector, rootn)


问:
I have 2 loops and results is not good
I have 2 loops, but unfortunately it does not work as it should. I want to take the first specific cells every 50 rows and paste them into another tab every 31 rows. Unfortunately, as it is now, I copy only one data range and paste it into the second tab repeating 332 times. I know what it results from, but I have no idea how to write it differently.</p>

```<code>Sub makro3()

    Dim X As Integer, X_max As Integer

    X_max = 332

    Y_max = 10292

    For X = 0 To X_max Step 50

        Sheets("Arkusz1").Select
        Cells(14 + X, 3).Select
        ActiveCell.Range("A1:T31").Select
        Selection.Copy
        Sheets("dane").Select

        For Y = 0 To Y_max Step 31
            Cells(2 + Y, 7).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
        Next Y

    Next X

End Sub
</code>```

答:
```<code>Sub makro3()
Dim X As Integer, X_max As Integer
Dim Y As Integer, Y_max As Integer
Dim Z_max As Double

X_max = 16564
Y_max = 10292
Z_max = X_max / 50

For Z = 0 To Z_max
    X = Z * 50
    Y = Z * 31
    Sheets("Arkusz1").Select
    Cells(14 + X, 3).Select
    ActiveCell.Range("A1:T31").Select
    Selection.Copy
    Sheets("dane").Select

    Cells(2 + Y, 7).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
Next Z

End Sub
</code>```

Title: I have 2 loops and results is not good

Body:
I have 2 loops, but unfortunately it does not work as it should. I want to take the first specific cells every 50 rows and paste them into another tab every 31 rows. Unfortunately, as it is now, I copy only one data range and paste it into the second tab repeating 332 times. I know what it results from, but I have no idea how to write it differently.

Sub makro3()

    Dim X As Integer, X_max As Integer

    X_max = 332

    Y_max = 10292

    For X = 0 To X_max Step 50

        Sheets("Arkusz1").Select
        Cells(14 + X, 3).Select
        ActiveCell.Range("A1:T31").Select
        Selection.Copy
        Sheets("dane").Select

        For Y = 0 To Y_max Step 31
            Cells(2 + Y, 7).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
        Next Y

    Next X

End Sub


问:
Expressjs: How to catch form data using POST method?
Guys.

I'm currently building a rather large project and I want to know which the best tool that I can use to catch form data using the POST method. The form is a 'sigin' and 'login' form

I read about 'body-parser' and 'busboy', but I'm a noob and I don't know which is the best choice

答:
A good one is formidable, and it has an Express version: [express-formidable](https://www.npmjs.com/package/express-formidable. Very handy for multipart form data.

That said, a "best choice" would be hard to come by. Likely the first one you get working will be the best! ; )


问:
Prevent malicious input to execute when script called
I need to call a Unix script in my Java code, wait for it to execute, and get the output. The script will do a 'find', and user will  provide the directory he wants the 'find' to look in

```<code>String[] cmd = new String[] { "/bin/sh", "-c",
                              runnerScript.getAbsolutePath() + " " + Param1 };
Process p = Runtime.getRuntime().exec(cmd);
</code>```

Problem is : How can I prevent one to type ' && rm -rf *' or ' / -exec rm..' ?

I have an idea like check if the directory exist on the server, or use a method like isLetterOrDigit(), but I want to know if a safer way exists.
I know for Sql Query I can use PreparedStatement to work around this problem. Is there something similar when calling a script?

答:
If your script is executable, I believe you should be able to construct your command like this:

```<code>String[] cmd = new String[] { runnerScript.getAbsolutePath(), Param1 };
</code>```

This way, you are calling your script, and just passing it the parameter; rather than calling bash -c and passing it a string to execute, which is inherently unsafe.

To specify which shell your script should run in, you can put #!/bin/sh at the top of the script.

Body:
I need to call a Unix script in my Java code, wait for it to execute, and get the output. The script will do a 'find', and user will  provide the directory he wants the 'find' to look in

String[] cmd = new String[] { "/bin/sh", "-c",
                              runnerScript.getAbsolutePath() + " " + Param1 };
Process p = Runtime.getRuntime().exec(cmd);

Problem is : How can I prevent one to type ' && rm -rf *' or ' / -exec rm..' ?

I have an idea like check if the directory exist on the server, or use a method like isLetterOrDigit(), but I want to know if a safer way exists.
I know for Sql Query I can use PreparedStatement to work around this problem. Is there something similar when calling a script?

Body:
If your script is executable, I believe you should be able to construct your command like this:

String[] cmd = new String[] { runnerScript.getAbsolutePath(), Param1 };

This way, you are calling your script, and just passing it the parameter; rather than calling bash -c and passing it a string to execute, which is inherently unsafe.

To specify which shell your script should run in, you can put #!/bin/sh at the top of the script.


问:
Error in ruby script while running meterpreter
I love this website, it has helped me a lot through other people's questions, now I have joined so I can help each others if I can.

I have an issue here.
While running meterpreter (from metasploit suite) in a VM, I have tried a script that relays all the ports in the compromised machine and creates a virtual interface in your local machine. But I'm getting the error

Undefined method: each.

While going to the code:

```<code>def discovery()
  ip_port = []
  # Alive hosts discovery
  temphosts = []
  hosts = []
  ## oldstdout = $stdout ## Trick for capturing stdout
  $stdout = StringIO.new
  client.run_cmd('run landiscovery')
  temphosts = $stdout.string
  $stdout = oldstdout
  print_status "Alive Hosts:"
  temphosts.each do |x|
    if x.match(/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/)
      y = x.chomp
      hosts << y
      print " - #{y}\n"
    end
  end
end
</code>```

I think it is somehow related to the line I have surrounded with ##. It has to be nil so temphosts is nil too and I get the each error.

Can someone point me in a good direction?

Thanks greatly appreciated.

PS: The scripts if someone is interested are in here: http://tools.pentester.es/multirelay

Thanks again!

答:
```<code>$stdout.string
</code>```

This line will return a single String object, containing all the lines of your output, with \n characters included.
String objects do not have any each method.

Maybe you wanted to get a list of Strings, representing the list of lines of your output. In this case, you should first split your String:

```<code>temphosts.split("\n").each do |x|
</code>```

Body:
I love this website, it has helped me a lot through other people's questions, now I have joined so I can help each others if I can.

I have an issue here.
While running meterpreter (from metasploit suite) in a VM, I have tried a script that relays all the ports in the compromised machine and creates a virtual interface in your local machine. But I'm getting the error

Undefined method: each.

While going to the code:

def discovery()
  ip_port = []
  # Alive hosts discovery
  temphosts = []
  hosts = []
  ## oldstdout = $stdout ## Trick for capturing stdout
  $stdout = StringIO.new
  client.run_cmd('run landiscovery')
  temphosts = $stdout.string
  $stdout = oldstdout
  print_status "Alive Hosts:"
  temphosts.each do |x|
    if x.match(/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/)
      y = x.chomp
      hosts << y
      print " - #{y}\n"
    end
  end
end

I think it is somehow related to the line I have surrounded with ##. It has to be nil so temphosts is nil too and I get the each error.

Can someone point me in a good direction?

Thanks greatly appreciated.

PS: The scripts if someone is interested are in here: http://tools.pentester.es/multirelay

Thanks again!

Body:
$stdout.string

This line will return a single String object, containing all the lines of your output, with \n characters included.
String objects do not have any each method.

Maybe you wanted to get a list of Strings, representing the list of lines of your output. In this case, you should first split your String:

temphosts.split("\n").each do |x|


问:
how can i change this to replace the 404 page error with a html page?
I have to change the 404 error page with a customed page from my html file.
I wrote this code but it doesn't work,  and/or I don't know how to use it.</p>

```<code>public static void main(String[] args) throws Exception {
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/rac");

        Server jettyServer = new Server(8080);
        context.setWelcomeFiles(new String[] { "./src/main/resources/index.html" });

        ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
        errorHandler.addErrorPage(HttpStatus.NOT_FOUND_404, "./src/main/resources/error.html");
        context.setErrorHandler(errorHandler);

        // HTML
        DefaultServlet defaultServlet = new DefaultServlet();
        ServletHolder holderPwd = new ServletHolder("default", defaultServlet);
        holderPwd.setInitParameter("resourceBase", "./src/main/resources/index.html");
        context.addServlet(holderPwd, "/*");

        // SERVICES
        ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class,
                "/ajax/*");
        jerseyServlet.setInitOrder(0);

        jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
                DiskServiceWS.class.getCanonicalName() + "," + RamServiceWS.class.getCanonicalName() + ","
                        + CpuServiceWS.class.getCanonicalName());

        jettyServer.setHandler(context);

        try {
            jettyServer.start();
            jettyServer.join();
        } finally {
            jettyServer.destroy();
        }
    }
</code>```

答:
You haven't indicated what kind of 404 error you are getting.

If the 404 from Jetty itself (not part of a context), then that's controlled by the Server level ErrorHandler.  (such as a GET request for http://<machine>/foo/bar in your scenario, as "/foo" is not part of your "/wac" context)

If the 404 from an error that flows back to the ServletContextHandler, then your existing ErrorPageErrorHandler is mostly correct.

The second parameter on addErrorPage is a URL path (relative to your declared Base Resource), not a filesystem path.

Example (assuming that /error.html is accessible via a web GET request):

ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
errorHandler.addErrorPage(HttpStatus.NOT_FOUND_404, "/error.html");
context.setErrorHandler(errorHandler);
```

<p>Note: the URL path could point to a Servlet (yours, a jsp, a jersey endpoint, etc..) if you wanted, it doesn't have to be HTML.</p>

<p>If the 404 is from a JAX-RS / Jersey request, then there's specific handling in JAX-RS / Jersey to produce a valid 404 error response based on the incoming request details.</p>

<p>An example would be a REST client requesting a JSON resource, and Jersey producing a 404 response with a JSON body indicating the error details.</p>

<p>Other notes ...</p>

<pre class="lang-java prettyprint-override"><code>DefaultServlet defaultServlet = new DefaultServlet();
ServletHolder holderPwd = new ServletHolder("default", defaultServlet);
holderPwd.setInitParameter("resourceBase", "./src/main/resources/index.html");
</code>```

Do not declare your resourceBase on your DefaultServlet, declare it on your ServletContextHandler.

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/rac");
context.setBaseResource(Resource.newResource("/path/to/my/base/directory"));
```

<p>Also, a <code>resourceBase</code> is a fully qualified directory path (or URI), never a file, or a relative path.</p>

<p>And <code>setWelcomeFiles</code> are filenames or path relative URL locations to use if the incoming GET request is to a directory resource.</p>

<p>Example:</p>

<pre class="lang-java prettyprint-override"><code>context.setWelcomeFiles(new String[] { "index.html", "welcome.html", "index.jsp" });
</code>```

So that a request for say http://<machine>/wac/ would result in actually serving http://<machine>/wac/index.html (if it exists).

This also applies to deep directory requests, such as http://<machine>/wac/app/deps/scripts/jquery/ would result in serving the contents of http://<machine>/wac/app/deps/scripts/jquery/index.html

Body:
I have to change the 404 error page with a customed page from my html file.
I wrote this code but it doesn't work,  and/or I don't know how to use it.

public static void main(String[] args) throws Exception {
        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
        context.setContextPath("/rac");

        Server jettyServer = new Server(8080);
        context.setWelcomeFiles(new String[] { "./src/main/resources/index.html" });

        ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
        errorHandler.addErrorPage(HttpStatus.NOT_FOUND_404, "./src/main/resources/error.html");
        context.setErrorHandler(errorHandler);

        // HTML
        DefaultServlet defaultServlet = new DefaultServlet();
        ServletHolder holderPwd = new ServletHolder("default", defaultServlet);
        holderPwd.setInitParameter("resourceBase", "./src/main/resources/index.html");
        context.addServlet(holderPwd, "/*");

        // SERVICES
        ServletHolder jerseyServlet = context.addServlet(org.glassfish.jersey.servlet.ServletContainer.class,
                "/ajax/*");
        jerseyServlet.setInitOrder(0);

        jerseyServlet.setInitParameter("jersey.config.server.provider.classnames",
                DiskServiceWS.class.getCanonicalName() + "," + RamServiceWS.class.getCanonicalName() + ","
                        + CpuServiceWS.class.getCanonicalName());

        jettyServer.setHandler(context);

        try {
            jettyServer.start();
            jettyServer.join();
        } finally {
            jettyServer.destroy();
        }
    }

Body:
You haven't indicated what kind of 404 error you are getting.

If the 404 from Jetty itself (not part of a context), then that's controlled by the Server level ErrorHandler.  (such as a GET request for http://<machine>/foo/bar in your scenario, as "/foo" is not part of your "/wac" context)

If the 404 from an error that flows back to the ServletContextHandler, then your existing ErrorPageErrorHandler is mostly correct.

The second parameter on addErrorPage is a URL path (relative to your declared Base Resource), not a filesystem path.

Example (assuming that /error.html is accessible via a web GET request):

ErrorPageErrorHandler errorHandler = new ErrorPageErrorHandler();
errorHandler.addErrorPage(HttpStatus.NOT_FOUND_404, "/error.html");
context.setErrorHandler(errorHandler);

Note: the URL path could point to a Servlet (yours, a jsp, a jersey endpoint, etc..) if you wanted, it doesn't have to be HTML.

If the 404 is from a JAX-RS / Jersey request, then there's specific handling in JAX-RS / Jersey to produce a valid 404 error response based on the incoming request details.

An example would be a REST client requesting a JSON resource, and Jersey producing a 404 response with a JSON body indicating the error details.

Other notes ...

DefaultServlet defaultServlet = new DefaultServlet();
ServletHolder holderPwd = new ServletHolder("default", defaultServlet);
holderPwd.setInitParameter("resourceBase", "./src/main/resources/index.html");

Do not declare your resourceBase on your DefaultServlet, declare it on your ServletContextHandler.

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/rac");
context.setBaseResource(Resource.newResource("/path/to/my/base/directory"));

Also, a resourceBase is a fully qualified directory path (or URI), never a file, or a relative path.

And setWelcomeFiles are filenames or path relative URL locations to use if the incoming GET request is to a directory resource.

Example:

context.setWelcomeFiles(new String[] { "index.html", "welcome.html", "index.jsp" });

So that a request for say http://<machine>/wac/ would result in actually serving http://<machine>/wac/index.html (if it exists).

This also applies to deep directory requests, such as http://<machine>/wac/app/deps/scripts/jquery/ would result in serving the contents of http://<machine>/wac/app/deps/scripts/jquery/index.html


问:
Need help creating a formula for dynamic average of last 4 weeks expenses
I am looking to create a spreadsheet that my staff fill out, it then gives me a master sheet with all the data, then I import dynamically to my financial spreadsheet telling me the average cost of my client over the last 30 days.

I am looking to create an AVERAGE formula of the last 30 days when Date = Today (Monday) (I want the weekday Monday as that's when staff hand in invoices)

Hope this makes sense, it's really tough!

Here's a video of me explaining my desired outcome

https://www.loom.com/share/3a9cb75052b246d1af2ba2f9ce9180a7

I've followed several guides & can't figure it out.

```<code>=ArrayFormula(iferror(query(average(if(today() - weekday(today(),3)-30)))))
</code>```

I expected $90 average and I just get blank

答:
You could use this formula:

=AVERAGE(VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)+1,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-6,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-13,A:H,2,FALSE),VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)-20,A:H,2,FALSE))

To break it down in to its component parts, the AVERAGE is taken from VLOOKUP results:

VLOOKUP(TODAY()-WEEKDAY(TODAY(),2)+1,A:H,2,FALSE)

The VLOOKUP is looking for the last Monday from the current date:

TODAY()-WEEKDAY(TODAY(),2)+1

Then

TODAY()-WEEKDAY(TODAY(),2)-6

and so on...

When using on your sheet, you will have to specify the column you want to reference in your look up, for colunm B (brand1) use: A:H,2,FALSE), for colunm C (brand2) use: A:H,3,FALSE), for colunm d (brand3) use: A:H,4,FALSE) and so on...

Body:
I am looking to create a spreadsheet that my staff fill out, it then gives me a master sheet with all the data, then I import dynamically to my financial spreadsheet telling me the average cost of my client over the last 30 days.

I am looking to create an AVERAGE formula of the last 30 days when Date = Today (Monday) (I want the weekday Monday as that's when staff hand in invoices)

Hope this makes sense, it's really tough!

Here's a video of me explaining my desired outcome

https://www.loom.com/share/3a9cb75052b246d1af2ba2f9ce9180a7

I've followed several guides & can't figure it out.

=ArrayFormula(iferror(query(average(if(today() - weekday(today(),3)-30)))))

I expected $90 average and I just get blank


问:
missing library libX11.so.6 for openjdk:12-jdk docker container
I have a Dockerfile that is from openjdk-12-jdk. In my application a dependency (https://github.com/bonigarcia/webdrivermanager) apperently requires the libX11.so.6 library, as the application fails to start with

/usr/src/app/etc/chromedriver/linux64/75.0.3770.8/chromdriver: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

I tried yum whatprovides libX11.so.6, which returned

```<code>bash-4.2# yum whatprovides libX11.so.6
Loaded plugins: ovl
libX11-1.6.5-1.el7.i686 : Core X11 protocol client library
Repo        : ol7_latest
Matched from:
Provides    : libX11.so.6

libX11-1.6.5-2.el7.i686 : Core X11 protocol client library
Repo        : ol7_latest
Matched from:
Provides    : libX11.so.6

libX11-1.6.5-1.el7.i686 : Core X11 protocol client library
Repo        : @ol7_latest
Matched from:
Provides    : libX11.so.6
</code>```

So I added RUN yum -y install libX11-1.6.5-1.el7.i686 to my Dockerfile.

But the error remains and it still fails with the same error as written above.

So I tried yum install libX11.i686 directly inside of the container, but again with no success for the application

How can I get this library ? Or is this not possible with the oraclelinux, that is the basis of the openjdk-12-jdk docker ?

===== EDIT ====

as I try to start chromedriver for a selenium test, I also tried to call it headless, but also the same error occurrs

答:
Use the following command to add missing component:</p>

```<code>yum -y install libX11
</code>```

Body:
I have a Dockerfile that is from openjdk-12-jdk. In my application a dependency (https://github.com/bonigarcia/webdrivermanager) apperently requires the libX11.so.6 library, as the application fails to start with

/usr/src/app/etc/chromedriver/linux64/75.0.3770.8/chromdriver: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory

I tried yum whatprovides libX11.so.6, which returned

bash-4.2# yum whatprovides libX11.so.6
Loaded plugins: ovl
libX11-1.6.5-1.el7.i686 : Core X11 protocol client library
Repo        : ol7_latest
Matched from:
Provides    : libX11.so.6

libX11-1.6.5-2.el7.i686 : Core X11 protocol client library
Repo        : ol7_latest
Matched from:
Provides    : libX11.so.6

libX11-1.6.5-1.el7.i686 : Core X11 protocol client library
Repo        : @ol7_latest
Matched from:
Provides    : libX11.so.6

So I added RUN yum -y install libX11-1.6.5-1.el7.i686 to my Dockerfile.

But the error remains and it still fails with the same error as written above.

So I tried yum install libX11.i686 directly inside of the container, but again with no success for the application

How can I get this library ? Or is this not possible with the oraclelinux, that is the basis of the openjdk-12-jdk docker ?

===== EDIT ====

as I try to start chromedriver for a selenium test, I also tried to call it headless, but also the same error occurrs

Body:
Use the following command to add missing component:

yum -y install libX11


问:
How can I ignore a parameter in a URL?
My app decodes URLs and I've noticed that when it hits an "&", the process stops and ignores the rest of the URL. It appears that URLComponents is breaking up the URL into pieces - my required parameter and the one that it believes to be a parameter.

```<code> hxxp://www.g.com/url?u=http://a.com/test&d=another
  - scheme : "hxxp"
  - host : "www.g.com"
  - path : "/url"
  ▿ queryItems : 2 elements
    ▿ 0 : u=http://a.com/test
      - name : "u"
      ▿ value : Optional<String>
        - some : "http://a.com/test"
    ▿ 1 : d=another
      - name : "d"
      ▿ value : Optional<String>
        - some : "another"
</code>```

What I need from above is the full URL after "u=".

Here is the initial call to the function that decodes the string:

```<code>if (fullDecode.contains("?u=")) {
            initialDecode = getQueryStringParameter(urlToAttempt: fullDecode, param: "u")!
</code>```

Here is the function that returns the decoded string:

```<code>func getQueryStringParameter(urlToAttempt: String, param: String) -> String? {
        guard let urlDecoded = URLComponents(string: urlToAttempt) else { return nil }
        print(urlDecoded)
        return urlDecoded.queryItems?.first(where: { $0.name == param })?.value
    }
</code>```

For this code, if the url was "http://www.g.com/url?u=http://a.com/test&d=another", it would return "http://a.com/test" - everything else is stripped away. I'd like it to return "http://a.com/test&d=another"

Is there a way that I'm able to do this with URLComponents, or do I need to do custom code to support this?

Update
If I change the url that's being passed to " hxxp://www.g.com/url?u=http://a.com/test%26d=another", URLComponents returns the full url back with the &d=another intact. I'm now going to try to percent encode the special character before sending to the function and see if that fixes the issue.

Second Update

Here is a heavily modified type of link I need to decode:

```<code>hxxps://ue.pt.com/v2/url?u=https-3A__oe.le.com_-3Fauthkey-3D-2521IB-2DCRV-2DqQ88-26cid-3DBACDF2ED353D-26id-3DBACDF2EFB61D353D-2521549-26parId-3Droot-26o-3DOneUp&d=DwMGaQ&c=WNpQK9bFmT89misLWAzsd66s44iGV-VujF_o4whjrfc&r=Ej_UhLznQMBqt3H3IYBQkjyx4xqdnS9mLiYA&m=HOBrLfxamFr4PYdACIR-A49th_oIe3MW69N7X-E&s=bXWSJ8gaSbKSlNuIf30S7Qsa6RcMKA-EOvP577XUyq0&e=
</code>```

These links are generated, which is why I have no control of how the link is built. I need to be able to decode this link to a legible URL. I have dictionaries for the special obfuscation like "-3A__" is "://" Where the above fails is where you see &d=DwM... It's not encoded, and that's where URLComponents is failing:

```<code>https://oe.le.com/?authkey=!IB-CRV-qQ88&cid=BACDF2ED353D&id=BACDF2EFB6353D!549&parId=root&o=OneUp
</code>```

Does this help?

答:
URLComponents is parsing your url properly in this case.

& in the url query can and could ever belong to the outer URL, because inner URL doesn't even starts query section(it doesn't have ? there).

So hxxp://www.g.com/url?u=http://a.com/test&d=another is parsed as:

```<code>  - scheme : "hxxp"
  - host : "www.g.com"
  - path : "/url"
  ▿ queryItems : 2 elements
    ▿ 0 : u=http://a.com/test
      - name : "u"
      ▿ value : Optional<String>
        - some : "http://a.com/test"
    ▿ 1 : d=another
      - name : "d"
      ▿ value : Optional<String>
        - some : "another"
</code>```

But hxxp://www.g.com/url?u=http://a.com/test?d=another (&d replaced with ?d) is parsed like

```<code>- scheme: "hxxp"
- host: "www.g.com"
- path: "/url"
▿ queryItems: 1 element
  ▿ u=http://a.com/test?d=another
    - name: "u"
    ▿ value: Optional("http://a.com/test?d=another")
      - some: "http://a.com/test?d=another"
</code>```

And here you got all your inner URL in u query param.

Title: How can I ignore a parameter in a URL?

Body:
My app decodes URLs and I've noticed that when it hits an "&", the process stops and ignores the rest of the URL. It appears that URLComponents is breaking up the URL into pieces - my required parameter and the one that it believes to be a parameter.

 hxxp://www.g.com/url?u=http://a.com/test&d=another
  - scheme : "hxxp"
  - host : "www.g.com"
  - path : "/url"
  ▿ queryItems : 2 elements
    ▿ 0 : u=http://a.com/test
      - name : "u"
      ▿ value : Optional<String>
        - some : "http://a.com/test"
    ▿ 1 : d=another
      - name : "d"
      ▿ value : Optional<String>
        - some : "another"

What I need from above is the full URL after "u=".

Here is the initial call to the function that decodes the string:

if (fullDecode.contains("?u=")) {
            initialDecode = getQueryStringParameter(urlToAttempt: fullDecode, param: "u")!

Here is the function that returns the decoded string:

func getQueryStringParameter(urlToAttempt: String, param: String) -> String? {
        guard let urlDecoded = URLComponents(string: urlToAttempt) else { return nil }
        print(urlDecoded)
        return urlDecoded.queryItems?.first(where: { $0.name == param })?.value
    }

For this code, if the url was "http://www.g.com/url?u=http://a.com/test&d=another", it would return "http://a.com/test" - everything else is stripped away. I'd like it to return "http://a.com/test&d=another"

Is there a way that I'm able to do this with URLComponents, or do I need to do custom code to support this?

Update
If I change the url that's being passed to " hxxp://www.g.com/url?u=http://a.com/test%26d=another", URLComponents returns the full url back with the &d=another intact. I'm now going to try to percent encode the special character before sending to the function and see if that fixes the issue.

Second Update

Here is a heavily modified type of link I need to decode:

hxxps://ue.pt.com/v2/url?u=https-3A__oe.le.com_-3Fauthkey-3D-2521IB-2DCRV-2DqQ88-26cid-3DBACDF2ED353D-26id-3DBACDF2EFB61D353D-2521549-26parId-3Droot-26o-3DOneUp&d=DwMGaQ&c=WNpQK9bFmT89misLWAzsd66s44iGV-VujF_o4whjrfc&r=Ej_UhLznQMBqt3H3IYBQkjyx4xqdnS9mLiYA&m=HOBrLfxamFr4PYdACIR-A49th_oIe3MW69N7X-E&s=bXWSJ8gaSbKSlNuIf30S7Qsa6RcMKA-EOvP577XUyq0&e=

These links are generated, which is why I have no control of how the link is built. I need to be able to decode this link to a legible URL. I have dictionaries for the special obfuscation like "-3A__" is "://" Where the above fails is where you see &d=DwM... It's not encoded, and that's where URLComponents is failing:

https://oe.le.com/?authkey=!IB-CRV-qQ88&cid=BACDF2ED353D&id=BACDF2EFB6353D!549&parId=root&o=OneUp

Does this help?

Body:
URLComponents is parsing your url properly in this case.

& in the url query can and could ever belong to the outer URL, because inner URL doesn't even starts query section(it doesn't have ? there).

So hxxp://www.g.com/url?u=http://a.com/test&d=another is parsed as:

  - scheme : "hxxp"
  - host : "www.g.com"
  - path : "/url"
  ▿ queryItems : 2 elements
    ▿ 0 : u=http://a.com/test
      - name : "u"
      ▿ value : Optional<String>
        - some : "http://a.com/test"
    ▿ 1 : d=another
      - name : "d"
      ▿ value : Optional<String>
        - some : "another"

But hxxp://www.g.com/url?u=http://a.com/test?d=another (&d replaced with ?d) is parsed like

- scheme: "hxxp"
- host: "www.g.com"
- path: "/url"
▿ queryItems: 1 element
  ▿ u=http://a.com/test?d=another
    - name: "u"
    ▿ value: Optional("http://a.com/test?d=another")
      - some: "http://a.com/test?d=another"

And here you got all your inner URL in u query param.


问:
Drupal, disable path
I have a drupal website using taxonomy. Now google indexed the taxonomy paths like:
http://mysite.com/term/5865.

Now most of the taxonomy pages should not be accessable, and I want to remove the path, but I can't find how to do it anywhere.

Does anyone have an idea how to do this ?

Thanks in advance.

答:
If anyone should like to use Qyx's URL Alter solution, they might also like to include whitespace (\s) characters in their URL matching code, as shown below:

```<code>if (preg_match("/^taxonomy\/term\/([0-9\s]+)(\/.*)?$/i", $path))
</code>```

This prevents urls that call multiple vocabularies from resolving, like taxonomy/term/1 2 3

ContentLicense: CC BY-SA 2.5

Title: Drupal, disable path

Body:
If anyone should like to use Qyx's URL Alter solution, they might also like to include whitespace (\s) characters in their URL matching code, as shown below:

if (preg_match("/^taxonomy\/term\/([0-9\s]+)(\/.*)?$/i", $path))

This prevents urls that call multiple vocabularies from resolving, like taxonomy/term/1 2 3


问:
Debugging macro with the help of gdb
I know the that the alternative approach is to convert the macro to inline function which will allow the gdb to step into it.

But I want to know if there is any way by which I can debug through each line of a macro definition by using gdb like any other function.

e.g. in the below code snippet.

```<code>#define print_macro printf("We're inside the macro now");\
     for(int i=0; i<100; i++) \
     { \
          if(i%2 == 0) \
              printf("%d is even number", i); \
          else \
              printf("%d is odd number);\
     }

int main()
{
    print_macro;
    return 0;
}
</code>```

In the gdb prompt can we break in main and then step into print_macro and go through each line of it's definition one by one by using next

答:
You can't step through macros but you can use the -E flag to see what the macros expand to:

```<code>g++ main.cpp -E | less
</code>```

Title: Debugging macro with the help of gdb

Body:
I know the that the alternative approach is to convert the macro to inline function which will allow the gdb to step into it.

But I want to know if there is any way by which I can debug through each line of a macro definition by using gdb like any other function.

e.g. in the below code snippet.

#define print_macro printf("We're inside the macro now");\
     for(int i=0; i<100; i++) \
     { \
          if(i%2 == 0) \
              printf("%d is even number", i); \
          else \
              printf("%d is odd number);\
     }

int main()
{
    print_macro;
    return 0;
}

In the gdb prompt can we break in main and then step into print_macro and go through each line of it's definition one by one by using next

Body:
You can't step through macros but you can use the -E flag to see what the macros expand to:

g++ main.cpp -E | less


问:
MYSQL- python pip install error
I tried to get build an app on Django and I wanted to use MySQL as the database. After setting up the settings.py right, I tried to migrate. Then I got the obvious error saying that MySQL is not installed. So inorder to install MySQL, I ran:

```<code>sudo -H pip install MySQL-python
</code>```

I get the following error:

```<code>    Collecting MySQL-python
  Using cached MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-zAMhWo/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-zAMhWo/MySQL-python/
</code>```

How do I fix this?

答:
Did you install the SQL client dev pacakge on your system?

```<code>sudo apt install libmysqlclient-dev
</code>```

if you are using mariadb, the drop in replacement for mysql, then run

```<code>sudo apt install libmariadbclient-dev
</code>```

then try again

```<code>pip install mysql-connector
</code>```

Title: MYSQL- python pip install error

Body:
I tried to get build an app on Django and I wanted to use MySQL as the database. After setting up the settings.py right, I tried to migrate. Then I got the obvious error saying that MySQL is not installed. So inorder to install MySQL, I ran:

sudo -H pip install MySQL-python

I get the following error:

    Collecting MySQL-python
  Using cached MySQL-python-1.2.5.zip
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/tmp/pip-build-zAMhWo/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-zAMhWo/MySQL-python/

How do I fix this?

Body:
Did you install the SQL client dev pacakge on your system?

sudo apt install libmysqlclient-dev

if you are using mariadb, the drop in replacement for mysql, then run

sudo apt install libmariadbclient-dev

then try again

pip install mysql-connector


问:
How to get state from multiple children components to parent to handle without using Redux
I have a parent which encloses three child component in a tab view, the parent also contain a button which handles a POST request after getting all the state from all three child components. How do I retrieve all the states from the three child components back to the parent to handle once the button in the parent is clicked?

I do not wish to use Redux as it is complicated to me even though I have watched multiple videos and learnt through many different sources

答:
You can use refs to retrive state from child components https://reactjs.org/docs/refs-and-the-dom.html

```<code>constroctor() {
 super()
 this.tab1 = React.createRef()
 this.tab2 = React.createRef()
 this.tab3 = React.createRef()
}

handleSomeAction = () => {
  console.log(this.tab1.current.state)

  // this method require to create method getState = () => this.state in Tab component
  console.log(this.tab1.current.getState())
}

<Tabs onClick={this.handleSomeAction}>
 <Tab ref={this.tab1}>
 <Tab ref={this.tab2}>
 <Tab ref={this.tab3}>
</Tabs>
</code>```

You can add handler handleSomeAction on your button instead of on Tabs component

Body:
You can use refs to retrive state from child components https://reactjs.org/docs/refs-and-the-dom.html

constroctor() {
 super()
 this.tab1 = React.createRef()
 this.tab2 = React.createRef()
 this.tab3 = React.createRef()
}

handleSomeAction = () => {
  console.log(this.tab1.current.state)

  // this method require to create method getState = () => this.state in Tab component
  console.log(this.tab1.current.getState())
}

<Tabs onClick={this.handleSomeAction}>
 <Tab ref={this.tab1}>
 <Tab ref={this.tab2}>
 <Tab ref={this.tab3}>
</Tabs>

You can add handler handleSomeAction on your button instead of on Tabs component


问:
In Android, why the aar files can speed up compilation
In Android, why  the aar files can speed up compilation

I guess maybe because the content in aar file already compiled or it has the cache of compilation result

答: Because it can include everything needed to build an app, including source code, resource files, and an Android manifest. However, instead of compiling into an APK that runs on a device, an Android library compiles into an Android Archive (AAR) file that you can use as a dependency for an Android app module.</p>


问:
Bootstrap - Progress bar as background in card element
I'm trying to recreate something like the image below (the dark one), that looks like a progress bar in every element of a card. I'm getting close but the problem I have so far is that the text moves with the progress bar.

```<code><div class="card" style="width: 18rem;">
   <ul class="list-group list-group-flush">
    <li class="list-group-item progress-bar bg-success" style="width:40%"><a>Cras justo odio</a></li>
    <li class="list-group-item progress-bar bg-info" style="width:100%">Dapibus ac facilisis in</li>
    <li class="list-group-item progress-bar bg-warning" style="width:10%">Vestibulum at eros</li>
  </ul>
</div>
</code>```

This is the goal, how can I make it?

答:
within your inline style, add: text-align: left; padding-left: 10px;
like as follows:</p>

```<code><li class="list-group-item progress-bar bg-warning" style="width:10% text-align: left; padding-left: 10px;">Vestibulum at eros</li>
</code>```

Body:
I'm trying to recreate something like the image below (the dark one), that looks like a progress bar in every element of a card. I'm getting close but the problem I have so far is that the text moves with the progress bar.

Cras justo odio

Dapibus ac facilisis in

Vestibulum at eros

This is the goal, how can I make it?

Body:
within your inline style, add: text-align: left; padding-left: 10px;
like as follows:

<li class="list-group-item progress-bar bg-warning" style="width:10% text-align: left; padding-left: 10px;">Vestibulum at eros</li>


问:
How can ARM's MOV instruction work with a large number as the second operand?
I just begin to study ARM assembly language, and am not clear about how to use MOV to transfer an immediate number into a register.

From both the ARM reference manual and my textbook, it's said that range of immediate number following MOV instruction is 0-255. But when I test on my own PC in ADS 1.2 IDE, instruction

```<code>MOV     R2, #0xFFFFFFFF
</code>```

performs well. Isn't number 0xFFFFFFFF out of range according to the specification?

答:
If you want to move 0xffffffff to a register you can always do:

```<code>MOV R0, #-1
</code>```

because 0xffffffff is the twos-complement representation of -1

Body:
I just begin to study ARM assembly language, and am not clear about how to use MOV to transfer an immediate number into a register.

From both the ARM reference manual and my textbook, it's said that range of immediate number following MOV instruction is 0-255. But when I test on my own PC in ADS 1.2 IDE, instruction

MOV     R2, #0xFFFFFFFF

performs well. Isn't number 0xFFFFFFFF out of range according to the specification?

Body:
If you want to move 0xffffffff to a register you can always do:

MOV R0, #-1

because 0xffffffff is the twos-complement representation of -1


问:
How do i position divs for lower resolutions without using media query
I would like position divs in a way I drew (pic attached) without using @media query. Is this even possible? First pic is full resolution, next one is when we lower down resolution and the last when resolution is very small-mobile devices. https://i.imgur.com/F4znkfC.png</p>

答:
Check this out, it fits what you're looking for - https://codepen.io/behzad/pen/PbWZRd

HTML

```<code>    <div class="wrapper">
        <h1>Responsive Image Gallery</h1>
        <p>Without Media Queries</p>
        <div class="grid">
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=400" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=401" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=403" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=404" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=405" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=406" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=407" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=408" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=409" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=411" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
        </div>
    </div>
</code>```

CSS

```<code>*, *:before, *:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

// Flexbox Grid
.grid{
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    &-item{
        min-width: 250px;
        max-width: 250px;
        flex: 1 1 250px;
        padding-left: .5rem;
        padding-right: .5rem;
        margin-bottom: 1rem;
    }
}

// Styles
.wrapper{
    min-height: 100vh;
    padding: 2rem 0;
    background: #40424a;
    color: #e4e4e8;
    font-family: 'Roboto', sans-serif;
    text-align: center;

    h1{
        font-size: 2.125em;
        line-height: 1.5;
    }

    p{
        font-size: 1em;
        line-height: 1.5;
        margin-bottom: 1rem;
        color: #c4c4c8;
    }
}

.grid{
    &-item{
        figure{
            padding: 0;
            margin: 0;
            box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.05);

            img{
                display: block;
                max-width: 100%;
            }
        }

        figcaption{
            display: block;
            padding: .625rem .5rem;
            background: lighten(#40424a, 3%);
        }
    }
}
</code>```

Body:
Check this out, it fits what you're looking for - https://codepen.io/behzad/pen/PbWZRd

HTML

    <div class="wrapper">
        <h1>Responsive Image Gallery</h1>
        <p>Without Media Queries</p>
        <div class="grid">
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=400" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=401" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=403" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=404" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=405" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=406" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=407" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=408" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=409" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
            <div class="grid-item">
                <figure>
                    <img src="https://unsplash.it/250/187?image=411" alt="">
                    <figcaption>Image Title</figcaption>
                </figure>
            </div>
        </div>
    </div>

CSS

*, *:before, *:after {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

// Flexbox Grid
.grid{
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    &-item{
        min-width: 250px;
        max-width: 250px;
        flex: 1 1 250px;
        padding-left: .5rem;
        padding-right: .5rem;
        margin-bottom: 1rem;
    }
}

// Styles
.wrapper{
    min-height: 100vh;
    padding: 2rem 0;
    background: #40424a;
    color: #e4e4e8;
    font-family: 'Roboto', sans-serif;
    text-align: center;

    h1{
        font-size: 2.125em;
        line-height: 1.5;
    }

    p{
        font-size: 1em;
        line-height: 1.5;
        margin-bottom: 1rem;
        color: #c4c4c8;
    }
}

.grid{
    &-item{
        figure{
            padding: 0;
            margin: 0;
            box-shadow: 0px 0px 6px 0px rgba(0,0,0,0.05);

            img{
                display: block;
                max-width: 100%;
            }
        }

        figcaption{
            display: block;
            padding: .625rem .5rem;
            background: lighten(#40424a, 3%);
        }
    }
}


问:
how to manage torch.Tensor with variable length in some dimenson?
I am programming a custom optimizer now, and the legth of bias in first dimension is not certain because last batch have no enough data to bulid a batch. So the initialization of weights with fixed batch_size do not satisfy  for torch.add between the last batch and the fixed length weights.

bias = torch.randn(batch_size,units)
batch_data = generator(path)
# for example
weights.shape # is (128,256)
# but the last batch has only 50 samples.
out = sigmoid(x*weights+bias) # where the length of first dimension is not mathed.
```

So, I wonder whether I can create a tensor where the lenght of some dimension could be variable, like variable length list.

答:
This link may be helpful for you: How to initialize weights in PyTorch?

If you use Pytorch's built in data loader class in pytorch. It will generate an iterator to be used to automatically handle batching. The batch size should be explicitly set up front by passing the 'batch_size' keyword to your data loader.

The last batch will be smaller if the dataset isn't divisible by the batch size unless drop last is explicitly set to true for the data loader.

Bias's don't work like this and don't depend on the size of the dataset or batch size.

Body:
I am programming a custom optimizer now, and the legth of bias in first dimension is not certain because last batch have no enough data to bulid a batch. So the initialization of weights with fixed batch_size do not satisfy  for torch.add between the last batch and the fixed length weights.

bias = torch.randn(batch_size,units)
batch_data = generator(path)
# for example
weights.shape # is (128,256)
# but the last batch has only 50 samples.
out = sigmoid(x*weights+bias) # where the length of first dimension is not mathed.

So, I wonder whether I can create a tensor where the lenght of some dimension could be variable, like variable length list.


问:
Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError
I am developing a Spring MVC application using STS (eclipse plugin) and maven.

For creating the project, I followed the STS wizard for a new "Spring MVC project". Afterwards, I added some dependencies to other projects and libraries.

However, when I am now trying to deploy the project to the integrated vFabric server of STS, I sometimes get an exception:

```<code>SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/wsa]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    ...
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVector]
    at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2179)
    ...
</code>```

When issuing a "maven clean", followed by a "maven install" and a restart of the server, the exception sometimes doesn't get thrown and the application works fine. Yet, most of the times, it doesn't work.

I guess there is no need to scan the bouncycastle dependencies for annotations.

Can I somehow disable this scanning for some jars?

I already tried adding metadata-complete="true" to my web.xml and increasing the stack size with no result.

What can I do to fix this?

答: Doing mvn clean in jenkins workspace folder (where my project runs) and doing a Jenkins build (that deletes the old war file) worked for me. </p>

Body:
I am developing a Spring MVC application using STS (eclipse plugin) and maven.

For creating the project, I followed the STS wizard for a new "Spring MVC project". Afterwards, I added some dependencies to other projects and libraries.

However, when I am now trying to deploy the project to the integrated vFabric server of STS, I sometimes get an exception:

SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/wsa]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    ...
Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/app] due to a StackOverflowError. Possible root causes include a too low setting for -Xss and illegal cyclic inheritance dependencies. The class hierarchy being processed was [org.bouncycastle.asn1.ASN1EncodableVector->org.bouncycastle.asn1.DEREncodableVector->org.bouncycastle.asn1.ASN1EncodableVector]
    at org.apache.catalina.startup.ContextConfig.checkHandlesTypes(ContextConfig.java:2179)
    ...

When issuing a "maven clean", followed by a "maven install" and a restart of the server, the exception sometimes doesn't get thrown and the application works fine. Yet, most of the times, it doesn't work.

I guess there is no need to scan the bouncycastle dependencies for annotations.

Can I somehow disable this scanning for some jars?

I already tried adding metadata-complete="true" to my web.xml and increasing the stack size with no result.

What can I do to fix this?


问:
C#, calling an instance of a class from a string
I've been struggling for a while to find a way of calling an instance of a class from a user defined input.

Essentially I want to call an instance from my StandardVehicle class that has already been defined, however the problem is that the name of the instance that I'm calling is defined by a users selection on a combo box on a form.

This is how I assumed it would be formatted, however I get an error when I try calling the instance saying that I cannot complicitly convert from string to StandardVehicle.

```<code>        StandardVehicle VauxhallB = new StandardVehicle();
        VauxhallB.Model = "B";
        VauxhallB.Manufacturer = "Vauxhall";
        VauxhallB.Doors = 5;
        VauxhallB.HorsePower = 200;
        VauxhallB.Transmission = "Manual";
        VauxhallB.Year = 2009;
        VauxhallB.Cylinders = 6;
        VauxhallB.Seats = 7;
        VauxhallB.Price = 17000;
        VauxhallB.Registration = "abc1243";

        StandardVehicle objname = comboBox1.Text;
</code>```

I'm assuming it's just a case of formatting the string, but I've been searching for hours and can't figure out what format it needs to be in to define it as an instance.

Any help would be appreciated.

Regards,
S.

答:
Try this:

```<code>StandardVehicle selectedObject = (StandardVehicle)comboBox1.SelectedItem;
</code>```

Of course, your comboBox should be bound to a collection of StandardVehicles... If it's not, then go for Dictionary as was already suggested.

Body:
I've been struggling for a while to find a way of calling an instance of a class from a user defined input.

Essentially I want to call an instance from my StandardVehicle class that has already been defined, however the problem is that the name of the instance that I'm calling is defined by a users selection on a combo box on a form.

This is how I assumed it would be formatted, however I get an error when I try calling the instance saying that I cannot complicitly convert from string to StandardVehicle.

        StandardVehicle VauxhallB = new StandardVehicle();
        VauxhallB.Model = "B";
        VauxhallB.Manufacturer = "Vauxhall";
        VauxhallB.Doors = 5;
        VauxhallB.HorsePower = 200;
        VauxhallB.Transmission = "Manual";
        VauxhallB.Year = 2009;
        VauxhallB.Cylinders = 6;
        VauxhallB.Seats = 7;
        VauxhallB.Price = 17000;
        VauxhallB.Registration = "abc1243";

        StandardVehicle objname = comboBox1.Text;

I'm assuming it's just a case of formatting the string, but I've been searching for hours and can't figure out what format it needs to be in to define it as an instance.

Any help would be appreciated.

Regards,
S.

Body:
Try this:

StandardVehicle selectedObject = (StandardVehicle)comboBox1.SelectedItem;

Of course, your comboBox should be bound to a collection of StandardVehicles... If it's not, then go for Dictionary as was already suggested.


问:
How can I pass JSON animation file from Internal Storage instead of the Assets folder?
How can I pass JSON animation file from Internal Storage instead of Assets folder in Lottie animation view?</p>

答:
Lottie Library only set JSON file from assets folder using fileName attribute.
For Instance:

```<code><com.airbnb.lottie.LottieAnimationView
    android:id="@+id/anim_iv"
    android:layout_width="wrap_content"
    android:layout_height="300dp"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    app:lottie_fileName="sample.json"
    app:lottie_autoPlay="true"
    app:lottie_loop="true"
    app:lottie_imageAssetsFolder="images"
    />
</code>```

If you tried to set JSON file from Internal or external storage, than it would not work. You have to load all JSON data from JSON file in string and set it to LottieAnimationView using setAnimationFromJson() method, like this-

```<code> LottieCompositionFactory.fromJsonString(json,getString(R.string.app_name)).addListener(new LottieListener<LottieComposition>() {
        @Override
        public void onResult(LottieComposition result) {
            animView.setComposition(result);
 });
</code>```

Body:
Lottie Library only set JSON file from assets folder using fileName attribute.
For Instance:

<com.airbnb.lottie.LottieAnimationView
    android:id="@+id/anim_iv"
    android:layout_width="wrap_content"
    android:layout_height="300dp"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"
    app:lottie_fileName="sample.json"
    app:lottie_autoPlay="true"
    app:lottie_loop="true"
    app:lottie_imageAssetsFolder="images"
    />

If you tried to set JSON file from Internal or external storage, than it would not work. You have to load all JSON data from JSON file in string and set it to LottieAnimationView using setAnimationFromJson() method, like this-

 LottieCompositionFactory.fromJsonString(json,getString(R.string.app_name)).addListener(new LottieListener<LottieComposition>() {
        @Override
        public void onResult(LottieComposition result) {
            animView.setComposition(result);
 });


问:
ExtJs select component by itemId starting with a string
Using Ext Js 4.1.

I have multiple checkboxes in panel with ids and itemIds: 'chA104', 'chA204', 'chB111' etc.
And I want to get all checkboxes that starts with id (or itemId) = 'chA' to make them disabled.

How to do that?
Tryed to use this:

```<code>this.query('*[id^=chA]');
</code>```

But get an array with multiple elements: table, td, input etc.
When doing this:

```<code>Ext.query('input[id^=chA]')[0]
</code>```

I get an html input element. But when trying to do:

```<code>Ext.query('input[id^=chA]')[0].disable();
Ext.query('input[id^=chA]')[0].setDisabled(true);
</code>```

I get an error.

So how to get all checkboxes, starting with a string id (or itemId) and make them enabled/disabled?

答:
If you are using extjs checkboxes, you could do it like this:

```<code>//enable/disable
Ext.ComponentQuery.query('checkboxfield{id.search("chA")!=-1}')[0].disable();
//check/uncheck
Ext.ComponentQuery.query('checkboxfield{id.search("chA")!=-1}')[0].setValue(true);
</code>```

if is pure html just use:

```<code>//enable/disable
Ext.query('input[id^=chA]')[0].disabled = true;
//check/Uncheck
Ext.query('input[id^=chA]')[0].checked = true;
</code>```

Body:
Using Ext Js 4.1.

I have multiple checkboxes in panel with ids and itemIds: 'chA104', 'chA204', 'chB111' etc.
And I want to get all checkboxes that starts with id (or itemId) = 'chA' to make them disabled.

How to do that?
Tryed to use this:

this.query('*[id^=chA]');

But get an array with multiple elements: table, td, input etc.
When doing this:

Ext.query('input[id^=chA]')[0]

I get an html input element. But when trying to do:

Ext.query('input[id^=chA]')[0].disable();
Ext.query('input[id^=chA]')[0].setDisabled(true);

I get an error.

So how to get all checkboxes, starting with a string id (or itemId) and make them enabled/disabled?

Body:
If you are using extjs checkboxes, you could do it like this:

//enable/disable
Ext.ComponentQuery.query('checkboxfield{id.search("chA")!=-1}')[0].disable();
//check/uncheck
Ext.ComponentQuery.query('checkboxfield{id.search("chA")!=-1}')[0].setValue(true);

if is pure html just use:

//enable/disable
Ext.query('input[id^=chA]')[0].disabled = true;
//check/Uncheck
Ext.query('input[id^=chA]')[0].checked = true;


问:
tmux: copy mode stops execution of shell command
when i use the copy mode to scroll in my tmux version while some other program runs in this pane, execution seems to be halted until i return to "normal mode".
My tmux version is 1.8.

Is there an option to change this behaviour?

答: No, there is no way to change this. Later versions will exit copy mode if you don't use it for a while (180 seconds IIRC) to stop programs blocking forever. 1.8 is very old.</p>


问:
Use attribute selector for selecting by class instead of proper class selector
I'm just working on a email html template and I came across this:

*[class=width100pc] { width: 100% !important; }

I've never seen something like this before. Is there a reason of using this syntax for selecting by class instead of just using

.width100pc {width: 100% !important;}

I know that CSS is kind of limited in email clients, is it somehow related to it?

答: The one reason that comes to my mind is when class selector is not supported in a specific environment where this code is used, but can be bypassed by using attribute selector.</p>


问:
React Native: ":CFBundleIdentifier", Does Not Exist
It seems this error is very specific to each case because I have tried everything in this post:
Print: Entry, ":CFBundleIdentifier", Does Not Exist

I have also tried almost everything in this post, I stopped at May 22, 2018 where auxilioivy makes a recommendation for a symlink:
https://github.com/facebook/react-native/issues/7308

Before I do a symlink, I am reaching out you all.

Upgrading my React Native is not an option.

I have the following:

```<code>"react": "16.2.0",
"react-native": "0.53.3",
"react-native-xcode-packager": "^0.1.0",

"detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/NFIBEngage.app",
        "build": "xcodebuild -workspace ios/NFIBEngage.xcworkspace -configuration Debug -scheme NFIBEngage -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone 6"
      }
    },
</code>```

The error is referring to my ios/AppName-tvOS/Info.plist:

```<code><key>CFBundleIdentifier</key>
    <string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
</code>```

The actual error says this:

```<code>fatal error: 'SplashScreen.h' file not found
#import "SplashScreen.h"
        ^~~~~~~~~~~~~~~~
1 error generated.

** BUILD FAILED **

The following build commands failed:
    CompileC build/Build/Intermediates.noindex/NFIBEngage.build/Debug-iphonesimulator/PROD.build/Objects-normal/x86_64/AppDelegate.o NFIBEngage/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/NFIBEngage.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/NFIBEngage.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
</code>```

The splash-screen error is in reference to this line in AppDelegate.m:

```<code>#import "SplashScreen.h"
</code>```

but I don't know how that is related. I am using the Simulator for XCode 10.1 and High Sierra OSX. Also if I go to File -> Project Settings:

And inside Advanced tab I have:

The last thing I tried following one of the recommendations here:
https://github.com/facebook/react-native/issues/21382

gave me this:

```<code>cd ios
➜  ios git:(release/3.6.2_build) ✗ pod install
zsh: command not found: pod
</code>```

On a hunch I thought I would try removing and reinstalling react-native-splash-screen after I reinstalled the same version and then ran react-native link react-native-splash-screen I no longer get the error about splash-screen instead I get this error: caused by: sentry reported an error: You do not have permission to perform this action. (http status: 403)

Could this mean the splash-screen error is resolved and now I am on to something else like a Sentry auth token issue?

Would the above error mean I need an auth.token? If so, is that different from a security token?

答:
So on clues that I got from a colleague who commented on here, I found this article:
https://medium.com/handlebar-labs/how-to-add-a-splash-screen-to-a-react-native-app-ios-and-android-30a3cec835ae

I decided to uninstall react-native-splash-screen@3.0.6 and reinstall it like so:

```<code>npm install react-native-splash-screen@3.0.6
react-native link react-native-splash-screen
</code>```

Sure enough the splashscreen error went away.

Body:
It seems this error is very specific to each case because I have tried everything in this post:
Print: Entry, ":CFBundleIdentifier", Does Not Exist

I have also tried almost everything in this post, I stopped at May 22, 2018 where auxilioivy makes a recommendation for a symlink:
https://github.com/facebook/react-native/issues/7308

Before I do a symlink, I am reaching out you all.

Upgrading my React Native is not an option.

I have the following:

"react": "16.2.0",
"react-native": "0.53.3",
"react-native-xcode-packager": "^0.1.0",

"detox": {
    "configurations": {
      "ios.sim.debug": {
        "binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/NFIBEngage.app",
        "build": "xcodebuild -workspace ios/NFIBEngage.xcworkspace -configuration Debug -scheme NFIBEngage -sdk iphonesimulator -derivedDataPath ios/build",
        "type": "ios.simulator",
        "name": "iPhone 6"
      }
    },

The error is referring to my ios/AppName-tvOS/Info.plist:

<key>CFBundleIdentifier</key>
    <string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>

The actual error says this:

fatal error: 'SplashScreen.h' file not found
#import "SplashScreen.h"
        ^~~~~~~~~~~~~~~~
1 error generated.

** BUILD FAILED **

The following build commands failed:
    CompileC build/Build/Intermediates.noindex/NFIBEngage.build/Debug-iphonesimulator/PROD.build/Objects-normal/x86_64/AppDelegate.o NFIBEngage/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Installing build/Build/Products/Debug-iphonesimulator/NFIBEngage.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/NFIBEngage.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

The splash-screen error is in reference to this line in AppDelegate.m:

#import "SplashScreen.h"

but I don't know how that is related. I am using the Simulator for XCode 10.1 and High Sierra OSX. Also if I go to File -> Project Settings:

And inside Advanced tab I have:

The last thing I tried following one of the recommendations here:
https://github.com/facebook/react-native/issues/21382

gave me this:

cd ios
➜  ios git:(release/3.6.2_build) ✗ pod install
zsh: command not found: pod

On a hunch I thought I would try removing and reinstalling react-native-splash-screen after I reinstalled the same version and then ran react-native link react-native-splash-screen I no longer get the error about splash-screen instead I get this error: caused by: sentry reported an error: You do not have permission to perform this action. (http status: 403)

Could this mean the splash-screen error is resolved and now I am on to something else like a Sentry auth token issue?

Would the above error mean I need an auth.token? If so, is that different from a security token?

Body:
So on clues that I got from a colleague who commented on here, I found this article:
https://medium.com/handlebar-labs/how-to-add-a-splash-screen-to-a-react-native-app-ios-and-android-30a3cec835ae

I decided to uninstall react-native-splash-screen@3.0.6 and reinstall it like so:

npm install react-native-splash-screen@3.0.6
react-native link react-native-splash-screen

Sure enough the splashscreen error went away.


问:
How to send a file from my app to another many application which do support sharing data
I'm actually trying to send a data which is coming from an API(as a text not as a file) to me and I want to send that data as a text file by many apps which includes sharing of files like WhatsApp, hike, telegram, shareit, etc.</p>

答:
```<code><data android:scheme="file" /> //Means local file
<data android:mimeType="*/*"/> //This accept any mimeType
<data android:pathPattern=".*\\.txt" /> //Your excepted extention
</code>```

<p>Try this code:  </p>

```<code>private Uri getUriForFile() {
  Intent intent = getIntent();
  String action = intent.getAction();
  String type = intent.getType();
  if (TextUtils.equals(Intent.ACTION_SEND, action)
           && !TextUtils.isEmpty(type)) {
     Uri uri =
         intent.getParcelableExtra(Intent.EXTRA_STREAM);
     if (uri != null) {
        Log.e("uri",uri.toString());
        return  uri;
     }
  }
  return null;
}
</code>```

Body:
<data android:scheme="file" /> //Means local file
<data android:mimeType="*/*"/> //This accept any mimeType
<data android:pathPattern=".*\\.txt" /> //Your excepted extention

Try this code:

private Uri getUriForFile() {
  Intent intent = getIntent();
  String action = intent.getAction();
  String type = intent.getType();
  if (TextUtils.equals(Intent.ACTION_SEND, action)
           && !TextUtils.isEmpty(type)) {
     Uri uri =
         intent.getParcelableExtra(Intent.EXTRA_STREAM);
     if (uri != null) {
        Log.e("uri",uri.toString());
        return  uri;
     }
  }
  return null;
}


问:
Setting a due date using business days
I'm trying to set a due date using business days based on date received plus a given number of days depending on what a particular test may be but am unsure how to use the while loop within an if/else if/else.  All attempts have resulted in Crystal showing an error that everything after the initial if is not part of the formula.  Main structure of the code comes from https://kenhamady.com/formulas/form17.shtml.    </p>

```<code>WhileReadingRecords;
DateVar Array Holidays;
DateVar Target:=Date({DATE_RECEIVED});
NumberVar Add;
NumberVar Added := 0;

if {METADATA_REPOSITORY.FIELD_VARCHAR_16} = "Test_1" then

    NumberVar Add = 28;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target

else if {ORDTASK.TESTGROUPNAME} = "Test_2" then

    NumberVar Add =14;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target

//else

    NumberVar Add = DateAdd("d", Tonumber({TESTS.DURATION}), {CENTRALRECEIVING.DATE_RECEIVED});
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target
</code>```

答:
Try this:</p>

```<code>WhileReadingRecords;
DateVar Array Holidays;
DateVar Target:=Date({DATE_RECEIVED});
NumberVar Add;
NumberVar Added := 0;

if {METADATA_REPOSITORY.FIELD_VARCHAR_16} = "Test_1" then

    NumberVar Add := 28;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target;

//else
if {ORDTASK.TESTGROUPNAME} = "Test_2" then

    NumberVar Add :=14;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target;

//else

    NumberVar Add := DateAdd("d", Tonumber({TESTS.DURATION}), {CENTRALRECEIVING.DATE_RECEIVED});
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target
</code>```

Title: Setting a due date using business days

Body:
I'm trying to set a due date using business days based on date received plus a given number of days depending on what a particular test may be but am unsure how to use the while loop within an if/else if/else.  All attempts have resulted in Crystal showing an error that everything after the initial if is not part of the formula.  Main structure of the code comes from https://kenhamady.com/formulas/form17.shtml.

WhileReadingRecords;
DateVar Array Holidays;
DateVar Target:=Date({DATE_RECEIVED});
NumberVar Add;
NumberVar Added := 0;

if {METADATA_REPOSITORY.FIELD_VARCHAR_16} = "Test_1" then

    NumberVar Add = 28;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target

else if {ORDTASK.TESTGROUPNAME} = "Test_2" then

    NumberVar Add =14;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target

//else

    NumberVar Add = DateAdd("d", Tonumber({TESTS.DURATION}), {CENTRALRECEIVING.DATE_RECEIVED});
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target

Body:
Try this:

WhileReadingRecords;
DateVar Array Holidays;
DateVar Target:=Date({DATE_RECEIVED});
NumberVar Add;
NumberVar Added := 0;

if {METADATA_REPOSITORY.FIELD_VARCHAR_16} = "Test_1" then

    NumberVar Add := 28;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target;

//else
if {ORDTASK.TESTGROUPNAME} = "Test_2" then

    NumberVar Add :=14;
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target;

//else

    NumberVar Add := DateAdd("d", Tonumber({TESTS.DURATION}), {CENTRALRECEIVING.DATE_RECEIVED});
    WHILE Added < Add
    Do (target := target +1;
        if dayofweek (target) in 2 to 6 and not (target in holidays)
            then Added:=Added+1
            else Added:=Added);
        Target


问:
Can anybody write the select query for this issue?
I havetwo Tables namely mit_follow & mit_tweets

In mit_follow table structure :

```<code>Id    UserName            followers          Following

1     dobriyalji          manish             Sachin
2     dobriyalji          karthik            parul
</code>```

In mit_tweets table structure :

```<code>Id        UserName          tweets

1         dobriyalji        hi everybody
2         manish            hello all m karthik
</code>```

i wanna write the select query for this ..

if i login using username dobriyalji .... and post tweets in mit_tweets table then dobriyalji and all of his followers can view their msgs and all the followers msgs will be viewed by dobriyalji...i m displaying the mit_tweets table using gridview in webform....

and if any new member login to their account and  post tweets then in gridview only new member msg will display ...

can any body write the select query for this ?

答:
```<code>SELECT mit_tweets.*
FROM mit_tweets
WHERE username = 'dobriyalji'

UNION

SELECT t2.*
FROM mit_tweets
    INNER JOIN mit_follow ON mit_tweets.Username = mit_follow.Username
    INNER JOIN mit_tweets t2 ON mit_follow.following = t2.Username
WHERE mit_tweets.username = 'dobriyalji'
</code>```

Is that what you mean?

Or maybe this:

```<code>select *
from mit_tweets
where Username = 'dobryialji'
or username in ( select mit_follow.followers from mit_follow where mit_follow.username = mit_tweets.username )
</code>```

This doesnt' make sense to me.  If I'm dobryialji, then I want to see my own tweets, plus the tweets of the people I follow.  If that is true, then change mit_follow.followers to mit_follow.following.

Body:
I havetwo Tables namely mit_follow & mit_tweets

In mit_follow table structure :

Id    UserName            followers          Following

1     dobriyalji          manish             Sachin
2     dobriyalji          karthik            parul

In mit_tweets table structure :

Id        UserName          tweets

1         dobriyalji        hi everybody
2         manish            hello all m karthik

i wanna write the select query for this ..

if i login using username dobriyalji .... and post tweets in mit_tweets table then dobriyalji and all of his followers can view their msgs and all the followers msgs will be viewed by dobriyalji...i m displaying the mit_tweets table using gridview in webform....

and if any new member login to their account and  post tweets then in gridview only new member msg will display ...

can any body write the select query for this ?

Body:
SELECT mit_tweets.*
FROM mit_tweets
WHERE username = 'dobriyalji'

UNION

SELECT t2.*
FROM mit_tweets
    INNER JOIN mit_follow ON mit_tweets.Username = mit_follow.Username
    INNER JOIN mit_tweets t2 ON mit_follow.following = t2.Username
WHERE mit_tweets.username = 'dobriyalji'

Is that what you mean?

Or maybe this:

select *
from mit_tweets
where Username = 'dobryialji'
or username in ( select mit_follow.followers from mit_follow where mit_follow.username = mit_tweets.username )

This doesnt' make sense to me.  If I'm dobryialji, then I want to see my own tweets, plus the tweets of the people I follow.  If that is true, then change mit_follow.followers to mit_follow.following.


问:
Multiple returns on HTTP request in Firebase / Google Cloud Function
I have a Cloud Function that does some searching on my database. It's quite an expensive process that involves a lot of computing. Its goal is to find the best possible match. I have no way doing an early exit when a good match is found because a better one might be found later in the iteration cycle. So ideally I want to update the client regularly about the best matches so far. The issue is for a HTTP Cloud Function I can only return once. I was thinking of updating the results on the database somewhere and have the client listen in for changes, however, this may not be much faster since there will be some delay in that process too. So is there a way of returning multiples responses to a HTTP query in a Cloud Function? Is there a better solution to this I am not seeing?

Pseudo of what I need

```<code>def cloudFunction(someData):
    goodMatches = []
    for i in database:
        if (i == goodMatch):
            goodMatches.append(goodMatch)
            post new goodMatch to client
    return goodMatches
</code>```

答: An HTTP type function can only have one response, and it will be sent in its entirety.  Cloud Functions does not support HTTP chunking or streaming of results.  If you want to send progressive results, consider writing those into Cloud Firestore or Realtime Database at a unique location that's agreed upon between the client and the function.</p>

Body:
I have a Cloud Function that does some searching on my database. It's quite an expensive process that involves a lot of computing. Its goal is to find the best possible match. I have no way doing an early exit when a good match is found because a better one might be found later in the iteration cycle. So ideally I want to update the client regularly about the best matches so far. The issue is for a HTTP Cloud Function I can only return once. I was thinking of updating the results on the database somewhere and have the client listen in for changes, however, this may not be much faster since there will be some delay in that process too. So is there a way of returning multiples responses to a HTTP query in a Cloud Function? Is there a better solution to this I am not seeing?

Pseudo of what I need

def cloudFunction(someData):
    goodMatches = []
    for i in database:
        if (i == goodMatch):
            goodMatches.append(goodMatch)
            post new goodMatch to client
    return goodMatches