问:
Best approach for setting up AEM S3 Data Store
We have an existing setup of AEM 6.1 which uses TarMK for data storage. To migrate the all assets to S3, I followed all steps here: https://docs.adobe.com/docs/en/aem/6-1/deploy/platform/data-store-config.html#Data%20Store%20Configurations (Amazon S3 Data Store). Apparently, the data synced to S3 but when I checked the disk usage report, I still see that assets are using disk space even for existing and newly added assets. What's the purpose of using S3 for assets if they still use the disk space? Or am I doing something wrong? How can I verify that my setup is really using S3? Here is my S3DataStore.config

```<code>accessKey="xxxxxxxxxx"
secretKey="xxxxxxxxxx"
s3Bucket="dev-aem-assets-local"
s3Region="eu-west-1"
connectionTimeout="120000"
socketTimeout="120000"
maxConnections="40"
writeThreads="30"
maxErrorRetry="10"
continueOnAsyncUploadFailure=B"true"
cacheSize="0"
minRecordLength="10"
</code>```

Another question is: Do I need to do the same setup on publisher? Or is it ok just to do it on author and use publisher as is by replicating the binary data?

答:
There are a few parts to your questiob so I'll break down the answer into logical blocks. Shout if I miss anything.

Your setup for migration is correct and S3 will use disk space. This is for the write-through cache.

AEM uses write-through cache for writing to S3 and all the settings for this cache are in your S3 config file. Any writes to data store are first written to this cache. Asynchronous background threads then uploaded to the S3 bucket. This mechanism makes AEM very responsive as it's not blocked by slow S3 writes. Also, data reads for recently written blobs are fast because they don't need slow reads from S3. In short, S3 IO traffic is too slow for AEM so this cache boosts the performance. You cannot disable it as it is required for asynchronous write to S3. You can reduce the size but it's recommended to be at least 50% of your S3 bucket size.

You can verify your S3 setup by looking at your logs for messages related to AWS (grep for aws).

As for publisher, yes you need to migrate from your old publisher to the new publisher. Assuming that you are not using binary-less replication, you will need a different S3 bucket for your publisher. In general, you migrate from author to author and publisher to publisher for a standard implementation.

Body:
We have an existing setup of AEM 6.1 which uses TarMK for data storage. To migrate the all assets to S3, I followed all steps here: https://docs.adobe.com/docs/en/aem/6-1/deploy/platform/data-store-config.html#Data%20Store%20Configurations (Amazon S3 Data Store). Apparently, the data synced to S3 but when I checked the disk usage report, I still see that assets are using disk space even for existing and newly added assets. What's the purpose of using S3 for assets if they still use the disk space? Or am I doing something wrong? How can I verify that my setup is really using S3? Here is my S3DataStore.config

accessKey="xxxxxxxxxx"
secretKey="xxxxxxxxxx"
s3Bucket="dev-aem-assets-local"
s3Region="eu-west-1"
connectionTimeout="120000"
socketTimeout="120000"
maxConnections="40"
writeThreads="30"
maxErrorRetry="10"
continueOnAsyncUploadFailure=B"true"
cacheSize="0"
minRecordLength="10"

Another question is: Do I need to do the same setup on publisher? Or is it ok just to do it on author and use publisher as is by replicating the binary data?


来源: stackexchange

问:
HTML Download attribute of  tag
I'm using following code for making a pdf file downloadable

```<code><a href="E:\NetBeans Project\Online Examination System\web\Syllabus\FT Syllabus.pdf" download style="color:black;">Click Here</a>
</code>```

but when I click to download error I'm getting an error "Failed - Network error"

答:
Rename FT Syllabus to FTSyllabus as spaces cannot be there in Links and try this code. This may give you a solution

```<code><a href="E:\NetBeans Project\Online Examination System\web\Syllabus\FTSyllabus.pdf" download="Syllabus" style="color:black;">Click Here</a>
</code>```

ContentLicense: CC BY-SA 3.0

Title: HTML Download attribute of <a> tag

Body:
I'm using following code for making a pdf file downloadable

Click Here

but when I click to download error I'm getting an error "Failed - Network error"

Body:
Rename FT Syllabus to FTSyllabus as spaces cannot be there in Links and try this code. This may give you a solution

<a href="E:\NetBeans Project\Online Examination System\web\Syllabus\FTSyllabus.pdf" download="Syllabus" style="color:black;">Click Here</a>


问:
how do I store value that is returned by the function without executing the function again?
so getBoundedNumber() is to let the user input some numbers and return the input. My other functions base on the return value and do calculations. I tried to assign it to a global variable outside the function(like var=getBoundedNumber(...)),but instead of storing the value from function, it executes the function again and ask for user to input again. How do I fix this?Thank you!

```<code>def getBoundedNumber(qq,ww,ee):

    while True:
        try:
            AA = float(input('Enter chain parameter between %r and %r '%(qq,ww)))
            ee='%r is not between %r and %r'%(AA,qq,ww)
            assert type(AA)==float or int,'not a valid input'
            if qq<= AA <= ww:

                break
            else:
            print(ee)
        except ValueError:
            print(' not a valid input')
    exit

return AA
</code>```

This is my main function:

```<code>def MAIN():

while True:

    xx=menu()

    if xx == 'A':
        aa=getBoundedNumber(0.5,4.5,1)

    elif xx == 'N':
        numpoints=getBoundedNumber(10,100000,1)

    elif xx == 'P':

        print('  Parameter a:%20.3f'%aa,'[m]')#console gives me aa not defined
        print('  Number of points:%20d'%numpoints)#console gives me numpoints not defined
        print('  Length:%20.3f'%chainlength(xs,ys),'[m]')#this function requires value from aa and numpoints so it won't execute.
        print('  Angle with support:%20.3f'%anglewithsupport(g_,dd,aa,numpoints))
        print('  Net force:%20.3f'%netforce(),'[N]')

    elif xx == 'Q':
        break
    else:
        print(' not a valid option')

exit
</code>```

This is my menu function

```<code>def menu():
print('Main menu choices')
print('   A - enter chain parameter a' )
print('   N - enter number of points in chain' )
print('   P - calculate and print chain results')
print('   Q - quit program')
while True:
    try:
        SELECTION = input('Enter your selection: ')

        if SELECTION.upper()== 'A':

            break
        elif SELECTION.upper() == 'N':
            break
        elif SELECTION.upper()=='P':
            break
        elif SELECTION.upper()=='Q':
            break

        else:
            print('%r is not a valid option'%SELECTION)
    except ValueError:
        print('%r is not a valid option'%SELECTION)
    exit
return SELECTION.upper()
</code>```

答:
Another way of achieving the same:</p>

```<code>def getBoundedNumber(qq,ww,ee,aList):

    while True:
        try:
            x = float(input('Enter chain parameter between %r and %r '%(qq,ww)))
            ee='%r is not between %r and %r'%(AA,qq,ww)
            assert type(x)==float or int,'not a valid input'
            if qq<= x <= ww:
                aList.append(x)
                break
            else:
                print(ee)
        except ValueError:
            print(' not a valid input')
            exit
    return aList

def MAINMENU():
    print('A - enter chain parameter a' )
    print('N - enter number of points in chain' )
    print('P - calculate and print chain results')
    print('Q - quit program')
    AA = []
    try:
        SELECTION = input('Enter your selection: ')

        if SELECTION.upper() == 'A':
            AA = getBoundedNumber(0.5,4.5,1,AA)
            MAINMENU()
        elif SELECTION.upper() == 'N':
            AA=getBoundedNumber(10,100000,1,AA)
            MAINMENU()
        elif SELECTION.upper() == 'P':
         #calculations that base on user input from A and N
        elif SELECTION.upper() == 'Q':
            exit
        else:
            print('%r is not a valid option'%SELECTION)
            MAINMENU()
    except ValueError:
        print('%r is not a valid option'%SELECTION)
</code>```

Body:
so getBoundedNumber() is to let the user input some numbers and return the input. My other functions base on the return value and do calculations. I tried to assign it to a global variable outside the function(like var=getBoundedNumber(...)),but instead of storing the value from function, it executes the function again and ask for user to input again. How do I fix this?Thank you!

def getBoundedNumber(qq,ww,ee):

    while True:
        try:
            AA = float(input('Enter chain parameter between %r and %r '%(qq,ww)))
            ee='%r is not between %r and %r'%(AA,qq,ww)
            assert type(AA)==float or int,'not a valid input'
            if qq<= AA <= ww:

                break
            else:
            print(ee)
        except ValueError:
            print(' not a valid input')
    exit

return AA

This is my main function:

def MAIN():

while True:

    xx=menu()

    if xx == 'A':
        aa=getBoundedNumber(0.5,4.5,1)

    elif xx == 'N':
        numpoints=getBoundedNumber(10,100000,1)

    elif xx == 'P':

        print('  Parameter a:%20.3f'%aa,'[m]')#console gives me aa not defined
        print('  Number of points:%20d'%numpoints)#console gives me numpoints not defined
        print('  Length:%20.3f'%chainlength(xs,ys),'[m]')#this function requires value from aa and numpoints so it won't execute.
        print('  Angle with support:%20.3f'%anglewithsupport(g_,dd,aa,numpoints))
        print('  Net force:%20.3f'%netforce(),'[N]')

    elif xx == 'Q':
        break
    else:
        print(' not a valid option')

exit

This is my menu function

def menu():
print('Main menu choices')
print('   A - enter chain parameter a' )
print('   N - enter number of points in chain' )
print('   P - calculate and print chain results')
print('   Q - quit program')
while True:
    try:
        SELECTION = input('Enter your selection: ')

        if SELECTION.upper()== 'A':

            break
        elif SELECTION.upper() == 'N':
            break
        elif SELECTION.upper()=='P':
            break
        elif SELECTION.upper()=='Q':
            break

        else:
            print('%r is not a valid option'%SELECTION)
    except ValueError:
        print('%r is not a valid option'%SELECTION)
    exit
return SELECTION.upper()

Body:
Another way of achieving the same:

def getBoundedNumber(qq,ww,ee,aList):

    while True:
        try:
            x = float(input('Enter chain parameter between %r and %r '%(qq,ww)))
            ee='%r is not between %r and %r'%(AA,qq,ww)
            assert type(x)==float or int,'not a valid input'
            if qq<= x <= ww:
                aList.append(x)
                break
            else:
                print(ee)
        except ValueError:
            print(' not a valid input')
            exit
    return aList

def MAINMENU():
    print('A - enter chain parameter a' )
    print('N - enter number of points in chain' )
    print('P - calculate and print chain results')
    print('Q - quit program')
    AA = []
    try:
        SELECTION = input('Enter your selection: ')

        if SELECTION.upper() == 'A':
            AA = getBoundedNumber(0.5,4.5,1,AA)
            MAINMENU()
        elif SELECTION.upper() == 'N':
            AA=getBoundedNumber(10,100000,1,AA)
            MAINMENU()
        elif SELECTION.upper() == 'P':
         #calculations that base on user input from A and N
        elif SELECTION.upper() == 'Q':
            exit
        else:
            print('%r is not a valid option'%SELECTION)
            MAINMENU()
    except ValueError:
        print('%r is not a valid option'%SELECTION)


问:
How to redirect siteA to siteB with A or CNAME records
I have 2 hosts and I would like to point a subdomain on host one to a subdomain on host two:

```<code>subdomain.hostone.com --> subdomain.hosttwo.com
</code>```

I added a CNAME record to host one that points to subdomain.hosttwo.com but all I get is a '400 Bad Request' Error.

Can anyone see what I'm doing wrong?

答:
These days, many site owners are using CDN services which pulls data from CDN server. If that's your case then you are left with two options:

Create a subdomain and edit DNS by Adding a CNAME record

Don't create a subdomain but only create a CNAME record pointing back to your temporary DNS URL.

This solution only implies to pulling code from CDN which will show that it's fetching data from cdn.sitename.com but practically its pulling from your CDN host.

OwnerDisplayName: Peter Coulton

ContentLicense: CC BY-SA 2.5

Body:
I have 2 hosts and I would like to point a subdomain on host one to a subdomain on host two:

subdomain.hostone.com --> subdomain.hosttwo.com

I added a CNAME record to host one that points to subdomain.hosttwo.com but all I get is a '400 Bad Request' Error.

Can anyone see what I'm doing wrong?

LastEditorDisplayName: Chris Fournier


问:
jQuery not triggering change event on dropdown
I'm trying to trigger the dropdown change event in jQuery (wordpress) but it's not working.

```<code>jQuery("select.buDropDown").each(function() { this.selectedIndex = 0 }).trigger('change');
</code>```

Running this in console only changes the selectedIndex to 0, but never triggers the change event that shows/hides certain elements on the page.

However, running this in console, everything triggers fine:

```<code>$("select.buDropDown").each(function() { this.selectedIndex = 0 }).trigger('change');
</code>```

I can't find any reasons why "$" would work but not "jQuery"

I tried wrapping it in:

```<code>jQuery(function($) {}
</code>```

to be able to use $ instead, but in the wordpress code it still doesn't trigger the change events

Any ideas?

答:
Your problem is that you are calling trigger function after closing the each loop. This would never happen. The following would work:

```<code>jQuery("select.buDropDown").each(function() {
    this.selectedIndex = 0;
    jQuery(this).trigger('change');
});
</code>```

And by the way, the following statement:

```<code>$("select.buDropDown").each(function() { this.selectedIndex = 0 }).trigger('change');
</code>```

This means that select the collection of select.buDropDown and loop this collection and then trigger change on this collection. It will trigger change for only the first object in this collection. Not for the whole.

Body:
I'm trying to trigger the dropdown change event in jQuery (wordpress) but it's not working.

jQuery("select.buDropDown").each(function() { this.selectedIndex = 0 }).trigger('change');

Running this in console only changes the selectedIndex to 0, but never triggers the change event that shows/hides certain elements on the page.

However, running this in console, everything triggers fine:

$("select.buDropDown").each(function() { this.selectedIndex = 0 }).trigger('change');

I can't find any reasons why "$" would work but not "jQuery"

I tried wrapping it in:

jQuery(function($) {}

to be able to use $ instead, but in the wordpress code it still doesn't trigger the change events

Any ideas?

Body:
Your problem is that you are calling trigger function after closing the each loop. This would never happen. The following would work:

jQuery("select.buDropDown").each(function() {
    this.selectedIndex = 0;
    jQuery(this).trigger('change');
});

And by the way, the following statement:

$("select.buDropDown").each(function() { this.selectedIndex = 0 }).trigger('change');

This means that select the collection of select.buDropDown and loop this collection and then trigger change on this collection. It will trigger change for only the first object in this collection. Not for the whole.


问:
Change Twilio SMS Inbound Request Timeout
I saw that Twilio has a default 15 second timeout for SMS inbound requests. I'm using a Java-based AWS Lambda behind API Gateway for my SMS inbound requests, and it takes a few seconds to spin up a java-based lambda function if it's been dormant for a while. Is it possible to increase my timeout in Twilio?</p>

答:
I've been having issues with Twilio not being able to connect to our server within the 15 second timeout and their support just plainly refuses to increase the timeout. So no, you can't increase it.

You can provide a fallback URL but it is not helping things at all for us.

Something is not right with their setup, they should have built in retries like other service providers.


问:
how to load local html file to string variable in ios swift?
i want to load my local html file into a string variable. i don't know how to do it. please help me.
i found below link but it load it from online url.
Swift & UIWebView element to hide</p>

答:
You can write some utility method like this and get the html string and load it to webview. I used the URL approach here</p>

```<code>   private func getHTML() -> String {
        var html = ""
        if let htmlPathURL = Bundle.main.url(forResource: "test", withExtension: "html"){
            do {
                html = try String(contentsOf: htmlPathURL, encoding: .utf8)
            } catch  {
                print("Unable to get the file.")
            }
        }

        return html
    }
</code>```

Body:
You can write some utility method like this and get the html string and load it to webview. I used the URL approach here

   private func getHTML() -> String {
        var html = ""
        if let htmlPathURL = Bundle.main.url(forResource: "test", withExtension: "html"){
            do {
                html = try String(contentsOf: htmlPathURL, encoding: .utf8)
            } catch  {
                print("Unable to get the file.")
            }
        }

        return html
    }


问:
Best Solution For the Train Composition
Recently I answered My Online Interview test Wherein I was asked Following question

A TrainComposition is built by attaching and detaching wagons from the left and the right sides.

For example, if we start by attaching wagon 7 from the left followed by attaching wagon 13, again from the left, we get a composition of two wagons (13 and 7 from left to right). Now the first wagon that can be detached from the right is 7 and the first that can be detached from the left is 13. Implement a TrainComposition that models this problem.

I used doubly linked list to solve the issue

```<code>class Node

{
    protected int data;
    protected Node next, prev;
    /* Constructor */
    public Node()
    {
        next = null;
        prev = null;
        data = 0;
    }

    /* Constructor */

    public Node(int d, Node n, Node p)
    {
        data = d;
        next = n;
        prev = p;
    }

    /* Function to set link to next node */
    public void setLinkNext(Node n) {
        next = n;
    }
    /* Function to set link to previous node */
    public void setLinkPrev(Node p) {
        prev = p;
    }

    /* Funtion to get link to next node */

    public Node getLinkNext() {
        return next;
    }

    /* Function to get link to previous node */

    public Node getLinkPrev() {
        return prev;
    }

    /* Function to set data to node */
    public void setData(int d) {
        data = d;
    }

    /* Function to get data from node */

    public int getData() {
        return data;
    }
}

public class SortedSearch {
    protected Node start;
    protected Node end;
    public int size;
    /* Constructor */
    public SortedSearch()
    {
        start = null;
        end = null;
        size = 0;
    }
    public boolean isEmpty()
    {
        return start == null;
    }

    public int getSize()
    {
        return size;
    }

    public void attachWagonFromLeft(int wagonId) {
        Node nptr = new Node(wagonId, null, null);
        if (start == null)
        {
            start = nptr;
            end = start;
        }
        else
        {
            start.setLinkPrev(nptr);
            nptr.setLinkNext(start);
            start = nptr;
        }
        size++;
    }
    public void attachWagonFromRight(int wagonId) {
        Node nptr = new Node(wagonId, null, null);
        if (start == null)
        {
            start = nptr;
            end = start;
        }
        else
        {
            nptr.setLinkPrev(end);
            end.setLinkNext(nptr);
            end = nptr;
        }
        size++;
    }
    public int detachWagonFromLeft() {
        int value=0;
        if (size == 1)
        {
            value = start.getData();
            start = null;
            end = null;
            size = 0;
            return value;

        }
        value = start.getData();
        start = start.getLinkNext();
        start.setLinkPrev(null);
        size--;
        return value;
    }

    public int detachWagonFromRight() {
        int value=0;
            value = end.getData();
            end = end.getLinkPrev();
            end.setLinkNext(null);
            size-- ;
            return value;
    }

    public static void main(String[] args) {
        SortedSearch tree = new SortedSearch();
        tree.attachWagonFromLeft(7);
        tree.attachWagonFromLeft(13);
        tree.attachWagonFromLeft(12);
        tree.attachWagonFromLeft(10);
        tree.attachWagonFromLeft(6);
        tree.attachWagonFromLeft(4);
        tree.attachWagonFromLeft(3);
        tree.attachWagonFromLeft(2);
        System.out.println(tree.detachWagonFromRight()); // 7
        System.out.println(tree.detachWagonFromRight()); // 13
        System.out.println(tree.detachWagonFromRight()); // 7
        System.out.println(tree.detachWagonFromRight()); // 13
        System.out.println(tree.detachWagonFromRight()); // 7
        System.out.println(tree.detachWagonFromRight()); // 13

    }
}
</code>```

And tested it accordingly. But when submitted it said failed internal test cases, and the answer was marked wrong.
Can you please tell which is the best solution for this problem.

答:
Why not just use this simple implementation?</p>

```<code>private static class TrainComposition {

  private final Deque<Integer> wagons = new LinkedList<>();

  public void attachLeft(int wagonNumber) {
    wagons.addFirst(wagonNumber);
  }

  public void attachRight(int wagonNumber) {
    wagons.addLast(wagonNumber);
  }

  public void detachLeft() {
    if (!wagons.isEmpty()) {
      wagons.removeFirst(); // Alternative if exception should not be bubbled up: wagons.pollFirst()
    } else {
      throw new IndexOutOfBoundsException("No wagons available");
    }
  }

  public void detachRight() {
    if (!wagons.isEmpty()) {
      wagons.removeLast(); // Alternative if exception should not be bubbled up: wagons.pollLast()
    } else {
      throw new IndexOutOfBoundsException("No wagons available");
    }
  }
}
</code>```

Title: Best Solution For the Train Composition

Body:
Recently I answered My Online Interview test Wherein I was asked Following question

A TrainComposition is built by attaching and detaching wagons from the left and the right sides.

For example, if we start by attaching wagon 7 from the left followed by attaching wagon 13, again from the left, we get a composition of two wagons (13 and 7 from left to right). Now the first wagon that can be detached from the right is 7 and the first that can be detached from the left is 13. Implement a TrainComposition that models this problem.

I used doubly linked list to solve the issue

class Node

{
    protected int data;
    protected Node next, prev;
    /* Constructor */
    public Node()
    {
        next = null;
        prev = null;
        data = 0;
    }

    /* Constructor */

    public Node(int d, Node n, Node p)
    {
        data = d;
        next = n;
        prev = p;
    }

    /* Function to set link to next node */
    public void setLinkNext(Node n) {
        next = n;
    }
    /* Function to set link to previous node */
    public void setLinkPrev(Node p) {
        prev = p;
    }

    /* Funtion to get link to next node */

    public Node getLinkNext() {
        return next;
    }

    /* Function to get link to previous node */

    public Node getLinkPrev() {
        return prev;
    }

    /* Function to set data to node */
    public void setData(int d) {
        data = d;
    }

    /* Function to get data from node */

    public int getData() {
        return data;
    }
}

public class SortedSearch {
    protected Node start;
    protected Node end;
    public int size;
    /* Constructor */
    public SortedSearch()
    {
        start = null;
        end = null;
        size = 0;
    }
    public boolean isEmpty()
    {
        return start == null;
    }

    public int getSize()
    {
        return size;
    }

    public void attachWagonFromLeft(int wagonId) {
        Node nptr = new Node(wagonId, null, null);
        if (start == null)
        {
            start = nptr;
            end = start;
        }
        else
        {
            start.setLinkPrev(nptr);
            nptr.setLinkNext(start);
            start = nptr;
        }
        size++;
    }
    public void attachWagonFromRight(int wagonId) {
        Node nptr = new Node(wagonId, null, null);
        if (start == null)
        {
            start = nptr;
            end = start;
        }
        else
        {
            nptr.setLinkPrev(end);
            end.setLinkNext(nptr);
            end = nptr;
        }
        size++;
    }
    public int detachWagonFromLeft() {
        int value=0;
        if (size == 1)
        {
            value = start.getData();
            start = null;
            end = null;
            size = 0;
            return value;

        }
        value = start.getData();
        start = start.getLinkNext();
        start.setLinkPrev(null);
        size--;
        return value;
    }

    public int detachWagonFromRight() {
        int value=0;
            value = end.getData();
            end = end.getLinkPrev();
            end.setLinkNext(null);
            size-- ;
            return value;
    }

    public static void main(String[] args) {
        SortedSearch tree = new SortedSearch();
        tree.attachWagonFromLeft(7);
        tree.attachWagonFromLeft(13);
        tree.attachWagonFromLeft(12);
        tree.attachWagonFromLeft(10);
        tree.attachWagonFromLeft(6);
        tree.attachWagonFromLeft(4);
        tree.attachWagonFromLeft(3);
        tree.attachWagonFromLeft(2);
        System.out.println(tree.detachWagonFromRight()); // 7
        System.out.println(tree.detachWagonFromRight()); // 13
        System.out.println(tree.detachWagonFromRight()); // 7
        System.out.println(tree.detachWagonFromRight()); // 13
        System.out.println(tree.detachWagonFromRight()); // 7
        System.out.println(tree.detachWagonFromRight()); // 13

    }
}

And tested it accordingly. But when submitted it said failed internal test cases, and the answer was marked wrong.
Can you please tell which is the best solution for this problem.

Body:
Why not just use this simple implementation?

private static class TrainComposition {

  private final Deque<Integer> wagons = new LinkedList<>();

  public void attachLeft(int wagonNumber) {
    wagons.addFirst(wagonNumber);
  }

  public void attachRight(int wagonNumber) {
    wagons.addLast(wagonNumber);
  }

  public void detachLeft() {
    if (!wagons.isEmpty()) {
      wagons.removeFirst(); // Alternative if exception should not be bubbled up: wagons.pollFirst()
    } else {
      throw new IndexOutOfBoundsException("No wagons available");
    }
  }

  public void detachRight() {
    if (!wagons.isEmpty()) {
      wagons.removeLast(); // Alternative if exception should not be bubbled up: wagons.pollLast()
    } else {
      throw new IndexOutOfBoundsException("No wagons available");
    }
  }
}


问:
javascript: how to judge a function name exists?
Is it possible to judge if a function names exists before calling it?</p>

答:
If you only want to avoid errors, you can turn the tables:</p>

```<code>try{function2call();}
catch(e){alert('function2call() doesn\'t exist');}
</code>```

Body:
If you only want to avoid errors, you can turn the tables:

try{function2call();}
catch(e){alert('function2call() doesn\'t exist');}


问:
Is there a PHP function like array_column that only returns single values?
I am looping through instances of associative arrays (these associative arrays themselves are part of an array).

For each array I want to return a value, based on a key.

Currently I have:

```<code>$image_path = array_column($myarray, 'uri');
</code>```

But of course array_column stores its values in a array, which, considering it's only returning 1 value, is useless to me.

Is there an existing function that will allow me to just get a value based off a supplied key?

Eg:

```<code>$image_path = get_keys_value($myarray, 'uri');
</code>```

Example array. This is a very basic example. The real thing has many levels to it:

```<code>$myarray = array
  (
    'instance' => array(
      'type' => 'somedata',
      'content' => somedata',
      'image' => array(
         'name' => 'photo',
         'uri' => 'path/to/file.png'
      ),
    ),
  );
</code>```

Desired outcome:

$image_path contains 'path/to/file.png' string.

答:
I guess you can use array_map.

Ex:

```<code>$arr = [
    [
        'root' => [
            'child1' => [
                'child2' => 123
            ]
        ]
    ],
    [
        'root' => [
            'child1' => [
                'child2' => 456
            ]
        ]
    ],
    [
        'root' => [
            'child1' => [
                'child2' => 789
            ]
        ]
    ],
    [
        'root' => [
            'child1' => [
                'child2' => 123
            ]
        ]
    ],
];

print_r(array_map(function($row) {
    // here goes expression to get required path
    return $row['root']['child1']['child2'];
}, $arr));
</code>```

Output:

```<code>Array
(
    [0] => 123
    [1] => 456
    [2] => 789
    [3] => 123
)
</code>```

Body:
I am looping through instances of associative arrays (these associative arrays themselves are part of an array).

For each array I want to return a value, based on a key.

Currently I have:

$image_path = array_column($myarray, 'uri');

But of course array_column stores its values in a array, which, considering it's only returning 1 value, is useless to me.

Is there an existing function that will allow me to just get a value based off a supplied key?

Eg:

$image_path = get_keys_value($myarray, 'uri');

Example array. This is a very basic example. The real thing has many levels to it:

$myarray = array
  (
    'instance' => array(
      'type' => 'somedata',
      'content' => somedata',
      'image' => array(
         'name' => 'photo',
         'uri' => 'path/to/file.png'
      ),
    ),
  );

Desired outcome:

$image_path contains 'path/to/file.png' string.

Body:
I guess you can use array_map.

Ex:

$arr = [
    [
        'root' => [
            'child1' => [
                'child2' => 123
            ]
        ]
    ],
    [
        'root' => [
            'child1' => [
                'child2' => 456
            ]
        ]
    ],
    [
        'root' => [
            'child1' => [
                'child2' => 789
            ]
        ]
    ],
    [
        'root' => [
            'child1' => [
                'child2' => 123
            ]
        ]
    ],
];

print_r(array_map(function($row) {
    // here goes expression to get required path
    return $row['root']['child1']['child2'];
}, $arr));

Output:

Array
(
    [0] => 123
    [1] => 456
    [2] => 789
    [3] => 123
)


问:
VB.net Need Text Box to Only Accept Numbers
I'm fairly new to VB.net (self taught) and was just wondering if someone out there could help me out with some code. I'm not trying to do anything too involved, just have a TextBox that accepts a numeric value from 1 to 10. I don't want it to accept a string or any number above 10. If someone types a word or character an error message will appear, telling him to enter a valid number. This is what I have; obviously it's not great as I am having problems. Thanks again to anyone who can help.

```<code> If TxtBox.Text > 10 Then
        MessageBox.Show("Please Enter a Number from 1 to 10")
        TxtBox.Focus()
    ElseIf TxtBox.Text < 10 Then
        MessageBox.Show("Thank You, your rating was " & TxtBox.Text)
        Total = Total + 1
    ElseIf IsNumeric(TxtBox.Text) Then
        MessageBox.Show("Thank you, your rating was " & ValueTxtBox.Text)
    End If

    ValueTxtBox.Clear()
    ValueTxtBox.Focus()
</code>```

答:
I know this post is old but I want to share my code.</p>

```<code> Private Sub txtbox1_TextChanged(sender As Object, e As EventArgs) Handles txtbox1.TextChanged
    If txtbox1.Text.Length > 0 Then
        If Not IsNumeric(txtbox1.Text) Then
            Dim sel As Integer = txtbox1.SelectionStart
            txtbox1.Text = txtbox1.Text.Remove(sel - 1, 1)
            txtbox1.SelectionStart = sel - 1
        End If
    End If
End Sub
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I'm fairly new to VB.net (self taught) and was just wondering if someone out there could help me out with some code. I'm not trying to do anything too involved, just have a TextBox that accepts a numeric value from 1 to 10. I don't want it to accept a string or any number above 10. If someone types a word or character an error message will appear, telling him to enter a valid number. This is what I have; obviously it's not great as I am having problems. Thanks again to anyone who can help.

 If TxtBox.Text > 10 Then
        MessageBox.Show("Please Enter a Number from 1 to 10")
        TxtBox.Focus()
    ElseIf TxtBox.Text < 10 Then
        MessageBox.Show("Thank You, your rating was " & TxtBox.Text)
        Total = Total + 1
    ElseIf IsNumeric(TxtBox.Text) Then
        MessageBox.Show("Thank you, your rating was " & ValueTxtBox.Text)
    End If

    ValueTxtBox.Clear()
    ValueTxtBox.Focus()

Body:
I know this post is old but I want to share my code.

 Private Sub txtbox1_TextChanged(sender As Object, e As EventArgs) Handles txtbox1.TextChanged
    If txtbox1.Text.Length > 0 Then
        If Not IsNumeric(txtbox1.Text) Then
            Dim sel As Integer = txtbox1.SelectionStart
            txtbox1.Text = txtbox1.Text.Remove(sel - 1, 1)
            txtbox1.SelectionStart = sel - 1
        End If
    End If
End Sub


问:
Is it possible to accumulate values with increment in a Django template?
I would like to know if there is any way to sum values in a variable in a Django template using {% for obj in objects %}. Something like this:

```<code>for student in students:
         notes += student.note
</code>```

Using the mathfilters or something similar to make the sum

Thanks!

答:
You can use add filter.

It is a not a good idea to do so anyway. You want to keep your logic inside the views and keep the rendering inside the templates.

You can also use django-mathfilters

```<code>{% load mathfilters %}
{{ num1 | addition:num2 }}
</code>```

Body:
I would like to know if there is any way to sum values in a variable in a Django template using {% for obj in objects %}. Something like this:

for student in students:
         notes += student.note

Using the mathfilters or something similar to make the sum

Thanks!

Body:
You can use add filter.

It is a not a good idea to do so anyway. You want to keep your logic inside the views and keep the rendering inside the templates.

You can also use django-mathfilters

{% load mathfilters %}
{{ num1 | addition:num2 }}


问:
Can you cast the result of sizeof
I was wondering if it makes sense to cast the result of sizeof?

Example:

Change sizeof(example) to (size_t) sizeof(example)

The return type is std::size_tbut I get the error "Invalid arguements" in many functions (malloc, memset, ...) and after the cast it works. A quick check with printf showed me, that the results stayed the same.

-edited-

As requested a short example function:

```<code>   __cxa_dependent_exception* __cxxabiv1:: __cxa_allocate_dependent_exception()  throw()
    {
        __cxa_dependent_exception *ps_ret;

        ps_ret = static_cast<__cxa_dependent_exception *> (o_exception_pool.allocate (
                (size_t) sizeof(__cxa_dependent_exception )));

        if (!ps_ret)
        {
            std::terminate ();
        }

        memset (ps_ret, 0, (size_t) sizeof(__cxa_dependent_exception ));

        return ps_ret;
    }
</code>```

Without the casts this code throws the mentioned error. The full example can be found in the gcc 4.5.4 source code "libstdc++-v3/libsupc++/eh_alloc.cc"

I am using MinGW.

答: Yes, you can cast result of sizeof, since sizeof(something) is compile time and you will get result in type of (size_t)5 if sizeof(something) returns 5.

Title: Can you cast the result of sizeof

Body:
I was wondering if it makes sense to cast the result of sizeof?

Example:

Change sizeof(example) to (size_t) sizeof(example)

The return type is std::size_tbut I get the error "Invalid arguements" in many functions (malloc, memset, ...) and after the cast it works. A quick check with printf showed me, that the results stayed the same.

-edited-

As requested a short example function:

   __cxa_dependent_exception* __cxxabiv1:: __cxa_allocate_dependent_exception()  throw()
    {
        __cxa_dependent_exception *ps_ret;

        ps_ret = static_cast<__cxa_dependent_exception *> (o_exception_pool.allocate (
                (size_t) sizeof(__cxa_dependent_exception )));

        if (!ps_ret)
        {
            std::terminate ();
        }

        memset (ps_ret, 0, (size_t) sizeof(__cxa_dependent_exception ));

        return ps_ret;
    }

Without the casts this code throws the mentioned error. The full example can be found in the gcc 4.5.4 source code "libstdc++-v3/libsupc++/eh_alloc.cc"

I am using MinGW.


问:
how to prevent  background overlapping other text
i need to create a text withs some markings that need to look a bit customized ( using an image )

i used the background-property and padding like so:

```<code>mark{
    padding:10px;
    background:url(http://www.fillmurray.com/200/300);
    background-repeat: no-repeat;
}
</code>```

which works as planned, but the backgroundimage is obscuring the previous text-line.
adding a z-index also did not work.
see fiddle:
fiddlelyfidd

any ideas on how to send it to the back?

thanks

答:
try to add background-position: 0px 10px; it's working fine

```<code>   mark{
        z-index:-10;
        padding:10px;
        background:url(http://www.fillmurray.com/200/300);
        background-repeat: no-repeat;
       background-position: 0px 10px;

    }
</code>```

check this updated jsfiddle

Title: how to prevent <mark> background overlapping other text

Body:
i need to create a text withs some markings that need to look a bit customized ( using an image )

i used the background-property and padding like so:

mark{
    padding:10px;
    background:url(http://www.fillmurray.com/200/300);
    background-repeat: no-repeat;
}

which works as planned, but the backgroundimage is obscuring the previous text-line.
adding a z-index also did not work.
see fiddle:
fiddlelyfidd

any ideas on how to send it to the back?

thanks

Body:
try to add background-position: 0px 10px; it's working fine

   mark{
        z-index:-10;
        padding:10px;
        background:url(http://www.fillmurray.com/200/300);
        background-repeat: no-repeat;
       background-position: 0px 10px;

    }

check this updated jsfiddle


问:
Publish docker container port and access that port from another docker container
I'm trying to run a postgres container with docker and access to it from another container.
Steps to reproduce:

Run postgres container and publish port: docker run -e POSTGRES_PASSWORD=test -d -p 5555:5432 postgres:9.6

Run other container to access to the postgres:

docker run -it debian /bin/bash
apt-get update
apt-get install telnet
telnet 172.17.0.1 5555

Result: Trying 172.17.0.1... and then fail.
But i can access it from the host with localhost or from outside with the public ip because the image allow all ip, and i am not blocking that port.
The ping works.

I have tested this in my machine and it works as expected, but i need to know why it is not working on this server.

Where can i start looking to know what i have wrong on my server?

Update:
I tried doing the telnet directly to the ip asigned to the postgres container(172.17.0.2) and i get the following error:

telnet 172.17.0.2
Trying 172.17.0.2...
telnet: Unable to connect to remote host: Connection refused

But ping still works at 172.17.0.2

Output of docker inspect on the postgres container:

```<code>docker inspect a379130e94f7
[
    {
        "Id": "a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310",
        "Created": "2017-03-31T08:07:36.06939775Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 20283,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-03-31T08:07:37.257557864Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:9910dc9f2ac0dbc193abc4718984cb3ad48989fc02cac4b36ad3d6b7d5d781f9",
        "ResolvConfPath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/hostname",
        "HostsPath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/hosts",
        "LogPath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310-json.log",
        "Name": "/gallant_thompson",
        "RestartCount": 0,
        "Driver": "overlay",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "5432/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "5555"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/var/lib/docker/overlay/34f43052282b0bcba741b61cb812bc4e05d1d0045820c36781684e2f2f763b41/root",
                "MergedDir": "/var/lib/docker/overlay/904ec813189c55332d8cb5ee3dca74e211a0d42a4434f8a90e07b8a05f4d5c5b/merged",
                "UpperDir": "/var/lib/docker/overlay/904ec813189c55332d8cb5ee3dca74e211a0d42a4434f8a90e07b8a05f4d5c5b/upper",
                "WorkDir": "/var/lib/docker/overlay/904ec813189c55332d8cb5ee3dca74e211a0d42a4434f8a90e07b8a05f4d5c5b/work"
            }
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "82dd5d73415e8142eb5bb985a9695f46772328f271ede839cbf55436917ed120",
                "Source": "/var/lib/docker/volumes/82dd5d73415e8142eb5bb985a9695f46772328f271ede839cbf55436917ed120/_data",
                "Destination": "/var/lib/postgresql/data",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "a379130e94f7",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "POSTGRES_PASSWORD=test",
                "PATH=/usr/lib/postgresql/9.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.7",
                "LANG=en_US.utf8",
                "PG_MAJOR=9.6",
                "PG_VERSION=9.6.2-1.pgdg80+1",
                "PGDATA=/var/lib/postgresql/data"
            ],
            "Cmd": [
                "postgres"
            ],
            "ArgsEscaped": true,
            "Image": "postgres:9.6",
            "Volumes": {
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "55c678dffab73ca25857667ddb003751494d32beb917abd1bba4d77f61071d9f",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "5432/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "5555"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/55c678dffab7",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "a0f845fa572fd6b15fc7c2ba74d3a302eb353e51ddbafb97d81e8858124808d7",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "16d30671a47d90037673ef30843421eaeeeba41028ec204a8fcea13ac8108f6d",
                    "EndpointID": "a0f845fa572fd6b15fc7c2ba74d3a302eb353e51ddbafb97d81e8858124808d7",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02"
                }
            }
        }
    }
]
</code>```

答:
I followed your steps and for me it is working.

What you could try is inspect the container. First get it's name with:

```<code>docker ps
</code>```

Then inspect the container with:

```<code>docker inspect CONTAINER_NAME
</code>```

In my example it was docker inspect zealous_wright.
Here you can find the IP adress and port of the container, try to use this IP and port. If it's still not working maybe try assigning a port other then 5555. It could be usefull to share this inspect data of the container maybe we can see what's wrong.

UPDATE:

It probally has to do with proxies. I'm using DockerForMac so there were quite some differences but the one standing out was:

```<code>"no_proxy=*.local, 169.254/16"
</code>```

I had this one and you didn't. When I removed this I got the same error as you. I changed this by going to:

Docker preferences -> Proxies -> Use system proxy, instead of No proxy.

Hope this helps!

Body:
I'm trying to run a postgres container with docker and access to it from another container.
Steps to reproduce:

Run postgres container and publish port: docker run -e POSTGRES_PASSWORD=test -d -p 5555:5432 postgres:9.6

Run other container to access to the postgres:

docker run -it debian /bin/bash
apt-get update
apt-get install telnet
telnet 172.17.0.1 5555

Result: Trying 172.17.0.1... and then fail.
But i can access it from the host with localhost or from outside with the public ip because the image allow all ip, and i am not blocking that port.
The ping works.

I have tested this in my machine and it works as expected, but i need to know why it is not working on this server.

Where can i start looking to know what i have wrong on my server?

Update:
I tried doing the telnet directly to the ip asigned to the postgres container(172.17.0.2) and i get the following error:

telnet 172.17.0.2
Trying 172.17.0.2...
telnet: Unable to connect to remote host: Connection refused

But ping still works at 172.17.0.2

Output of docker inspect on the postgres container:

docker inspect a379130e94f7
[
    {
        "Id": "a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310",
        "Created": "2017-03-31T08:07:36.06939775Z",
        "Path": "docker-entrypoint.sh",
        "Args": [
            "postgres"
        ],
        "State": {
            "Status": "running",
            "Running": true,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 20283,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2017-03-31T08:07:37.257557864Z",
            "FinishedAt": "0001-01-01T00:00:00Z"
        },
        "Image": "sha256:9910dc9f2ac0dbc193abc4718984cb3ad48989fc02cac4b36ad3d6b7d5d781f9",
        "ResolvConfPath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/resolv.conf",
        "HostnamePath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/hostname",
        "HostsPath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/hosts",
        "LogPath": "/var/lib/docker/containers/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310/a379130e94f7596ebe632e3ae825710c978577a3fb6b245a4f95374051eb8310-json.log",
        "Name": "/gallant_thompson",
        "RestartCount": 0,
        "Driver": "overlay",
        "MountLabel": "",
        "ProcessLabel": "",
        "AppArmorProfile": "",
        "ExecIDs": null,
        "HostConfig": {
            "Binds": null,
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "json-file",
                "Config": {}
            },
            "NetworkMode": "default",
            "PortBindings": {
                "5432/tcp": [
                    {
                        "HostIp": "",
                        "HostPort": "5555"
                    }
                ]
            },
            "RestartPolicy": {
                "Name": "no",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": null,
            "CapDrop": null,
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": null,
            "GroupAdd": null,
            "IpcMode": "",
            "Cgroup": "",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": null,
            "UTSMode": "",
            "UsernsMode": "",
            "ShmSize": 67108864,
            "Runtime": "runc",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": -1,
            "OomKillDisable": false,
            "PidsLimit": 0,
            "Ulimits": null,
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0
        },
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/var/lib/docker/overlay/34f43052282b0bcba741b61cb812bc4e05d1d0045820c36781684e2f2f763b41/root",
                "MergedDir": "/var/lib/docker/overlay/904ec813189c55332d8cb5ee3dca74e211a0d42a4434f8a90e07b8a05f4d5c5b/merged",
                "UpperDir": "/var/lib/docker/overlay/904ec813189c55332d8cb5ee3dca74e211a0d42a4434f8a90e07b8a05f4d5c5b/upper",
                "WorkDir": "/var/lib/docker/overlay/904ec813189c55332d8cb5ee3dca74e211a0d42a4434f8a90e07b8a05f4d5c5b/work"
            }
        },
        "Mounts": [
            {
                "Type": "volume",
                "Name": "82dd5d73415e8142eb5bb985a9695f46772328f271ede839cbf55436917ed120",
                "Source": "/var/lib/docker/volumes/82dd5d73415e8142eb5bb985a9695f46772328f271ede839cbf55436917ed120/_data",
                "Destination": "/var/lib/postgresql/data",
                "Driver": "local",
                "Mode": "",
                "RW": true,
                "Propagation": ""
            }
        ],
        "Config": {
            "Hostname": "a379130e94f7",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "5432/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "POSTGRES_PASSWORD=test",
                "PATH=/usr/lib/postgresql/9.6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "GOSU_VERSION=1.7",
                "LANG=en_US.utf8",
                "PG_MAJOR=9.6",
                "PG_VERSION=9.6.2-1.pgdg80+1",
                "PGDATA=/var/lib/postgresql/data"
            ],
            "Cmd": [
                "postgres"
            ],
            "ArgsEscaped": true,
            "Image": "postgres:9.6",
            "Volumes": {
                "/var/lib/postgresql/data": {}
            },
            "WorkingDir": "",
            "Entrypoint": [
                "docker-entrypoint.sh"
            ],
            "OnBuild": null,
            "Labels": {}
        },
        "NetworkSettings": {
            "Bridge": "",
            "SandboxID": "55c678dffab73ca25857667ddb003751494d32beb917abd1bba4d77f61071d9f",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {
                "5432/tcp": [
                    {
                        "HostIp": "0.0.0.0",
                        "HostPort": "5555"
                    }
                ]
            },
            "SandboxKey": "/var/run/docker/netns/55c678dffab7",
            "SecondaryIPAddresses": null,
            "SecondaryIPv6Addresses": null,
            "EndpointID": "a0f845fa572fd6b15fc7c2ba74d3a302eb353e51ddbafb97d81e8858124808d7",
            "Gateway": "172.17.0.1",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "IPAddress": "172.17.0.2",
            "IPPrefixLen": 16,
            "IPv6Gateway": "",
            "MacAddress": "02:42:ac:11:00:02",
            "Networks": {
                "bridge": {
                    "IPAMConfig": null,
                    "Links": null,
                    "Aliases": null,
                    "NetworkID": "16d30671a47d90037673ef30843421eaeeeba41028ec204a8fcea13ac8108f6d",
                    "EndpointID": "a0f845fa572fd6b15fc7c2ba74d3a302eb353e51ddbafb97d81e8858124808d7",
                    "Gateway": "172.17.0.1",
                    "IPAddress": "172.17.0.2",
                    "IPPrefixLen": 16,
                    "IPv6Gateway": "",
                    "GlobalIPv6Address": "",
                    "GlobalIPv6PrefixLen": 0,
                    "MacAddress": "02:42:ac:11:00:02"
                }
            }
        }
    }
]

Body:
I followed your steps and for me it is working.

What you could try is inspect the container. First get it's name with:

docker ps

Then inspect the container with:

docker inspect CONTAINER_NAME

In my example it was docker inspect zealous_wright.
Here you can find the IP adress and port of the container, try to use this IP and port. If it's still not working maybe try assigning a port other then 5555. It could be usefull to share this inspect data of the container maybe we can see what's wrong.

UPDATE:

It probally has to do with proxies. I'm using DockerForMac so there were quite some differences but the one standing out was:

"no_proxy=*.local, 169.254/16"

I had this one and you didn't. When I removed this I got the same error as you. I changed this by going to:

Docker preferences -> Proxies -> Use system proxy, instead of No proxy.

Hope this helps!


问:
Paperclip::Errors::MissingRequiredValidatorError
Sorry, but i cant found solution for my situation

I have next code:

```<code>class Document < ActiveRecord::Base
    has_attached_file :item,
                 content_type: { content_type: ["image/jpeg",    "image/gif", "document/pdf"] }
end
</code>```

gemfile:

```<code>source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'bootstrap-sass'
gem 'haml'

gem "paperclip"
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
</code>```

shema.db:

ActiveRecord::Schema.define(version: 20151015113219) do

```<code>  create_table "documents", force: :cascade do |t|
    t.string   "title"
    t.datetime "created_at",        null: false
    t.datetime "updated_at",        null: false
    t.string   "item_file_name"
    t.string   "item_content_type"
    t.integer  "item_file_size"
    t.datetime "item_updated_at"
  end

end
</code>```

Documentscontroller:

```<code>class DocumentsController < ApplicationController
    def index
    @documents = Document.order('created_at')
  end

  def new
    @document = Document.new
  end

  def create
    @document = Document.new(document_params)
    if @document.save
      flash[:success] = "The file was added!"
      redirect_to root_path
    else
      render 'new'
    end
  end

  private

  def document_params
    params.require(:document).permit(:item, :title)
  end
end
</code>```

When i unload new file, displaying error: Paperclip::Errors::MissingRequiredValidatorError

Full trace:

```<code>paperclip (4.3.1) lib/paperclip/attachment.rb:399:in `ensure_required_validations!'
paperclip (4.3.1) lib/paperclip/attachment.rb:99:in `assign'
paperclip (4.3.1) lib/paperclip/has_attached_file.rb:66:in `block in define_setter'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `public_send'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
activerecord (4.2.1) lib/active_record/core.rb:559:in `init_attributes'
activerecord (4.2.1) lib/active_record/core.rb:281:in `initialize'
activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
actionpack (4.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.1) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.1) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.1) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.1) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `call'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:819:in `call'
rack (1.6.1) lib/rack/etag.rb:24:in `call'
rack (1.6.1) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.1) lib/rack/head.rb:13:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.1) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.1) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
activerecord (4.2.1) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.1.2) lib/web_console/middleware.rb:29:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.1) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.1) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.1) lib/rack/lock.rb:17:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.1) lib/rack/sendfile.rb:113:in `call'
railties (4.2.1) lib/rails/engine.rb:518:in `call'
railties (4.2.1) lib/rails/application.rb:164:in `call'
rack (1.6.1) lib/rack/lock.rb:17:in `call'
rack (1.6.1) lib/rack/content_length.rb:15:in `call'
rack (1.6.1) lib/rack/handler/webrick.rb:89:in `service'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'
</code>```

答: Specify a version lower than 4.0 for paperclip fixed for me, you can try that </p>

Body:
Sorry, but i cant found solution for my situation

I have next code:

class Document < ActiveRecord::Base
    has_attached_file :item,
                 content_type: { content_type: ["image/jpeg",    "image/gif", "document/pdf"] }
end

gemfile:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'bootstrap-sass'
gem 'haml'

gem "paperclip"
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

shema.db:

ActiveRecord::Schema.define(version: 20151015113219) do

  create_table "documents", force: :cascade do |t|
    t.string   "title"
    t.datetime "created_at",        null: false
    t.datetime "updated_at",        null: false
    t.string   "item_file_name"
    t.string   "item_content_type"
    t.integer  "item_file_size"
    t.datetime "item_updated_at"
  end

end

Documentscontroller:

class DocumentsController < ApplicationController
    def index
    @documents = Document.order('created_at')
  end

  def new
    @document = Document.new
  end

  def create
    @document = Document.new(document_params)
    if @document.save
      flash[:success] = "The file was added!"
      redirect_to root_path
    else
      render 'new'
    end
  end

  private

  def document_params
    params.require(:document).permit(:item, :title)
  end
end

When i unload new file, displaying error: Paperclip::Errors::MissingRequiredValidatorError

Full trace:

paperclip (4.3.1) lib/paperclip/attachment.rb:399:in `ensure_required_validations!'
paperclip (4.3.1) lib/paperclip/attachment.rb:99:in `assign'
paperclip (4.3.1) lib/paperclip/has_attached_file.rb:66:in `block in define_setter'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `public_send'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:54:in `_assign_attribute'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:41:in `block in assign_attributes'
actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
actionpack (4.2.1) lib/action_controller/metal/strong_parameters.rb:183:in `each_pair'
activerecord (4.2.1) lib/active_record/attribute_assignment.rb:35:in `assign_attributes'
activerecord (4.2.1) lib/active_record/core.rb:559:in `init_attributes'
activerecord (4.2.1) lib/active_record/core.rb:281:in `initialize'
activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
activerecord (4.2.1) lib/active_record/inheritance.rb:61:in `new'
actionpack (4.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.2.1) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:92:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
activerecord (4.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.2.1) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.1) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.1) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.1) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `call'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:819:in `call'
rack (1.6.1) lib/rack/etag.rb:24:in `call'
rack (1.6.1) lib/rack/conditionalget.rb:38:in `call'
rack (1.6.1) lib/rack/head.rb:13:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
rack (1.6.1) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.6.1) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
activerecord (4.2.1) lib/active_record/migration.rb:378:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call'
activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
web-console (2.1.2) lib/web_console/middleware.rb:29:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.1) lib/rack/methodoverride.rb:22:in `call'
rack (1.6.1) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.1) lib/rack/lock.rb:17:in `call'
actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
rack (1.6.1) lib/rack/sendfile.rb:113:in `call'
railties (4.2.1) lib/rails/engine.rb:518:in `call'
railties (4.2.1) lib/rails/application.rb:164:in `call'
rack (1.6.1) lib/rack/lock.rb:17:in `call'
rack (1.6.1) lib/rack/content_length.rb:15:in `call'
rack (1.6.1) lib/rack/handler/webrick.rb:89:in `service'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:138:in `service'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/httpserver.rb:94:in `run'
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/webrick/server.rb:294:in `block in start_thread'