Building on the previously suggested solutions: // First, checks if it isn't implemented yet. if (!String.prototype.format) { String.prototype.format = function() { var args = arguments; return this.replace(/{(d+)}/g, function(match, number) { return typeof args[number] != 'undefined' ? args[number] : match ; }); }; } "{0} is dead, … [Read more...]
How fix ‘Failed to load resource: the server responded with a status of 403’?
a 403 HTTP status error indicates that the request was understood, but will not fullfill the request because the requested asset is 'forbidden'. This is most likely an issue with your .htaccess file, or a permissions issue within your wordpress installation. Try to delete the .htaccess file that is in your root folder. Then, log in to your wordpress dashboard, go to Settings … [Read more...]
Why would a “java.net.ConnectException: Connection timed out” exception occur when URL is up?
Connection timeouts (assuming a local network and several client machines) typically result from a) some kind of firewall on the way that simply eats the packets without telling the sender things like "No Route to host" b) packet loss due to wrong network configuration or line overload c) too many requests overloading the server d) a small number of simultaneously available … [Read more...]
When to use margin vs padding in CSS [closed]
TL;DR: By default I use margin everywhere, except when I have a border or background and want to increase the space inside that visible box. To me, the biggest difference between padding and margin is that vertical margins auto-collapse, and padding doesn't. Consider two elements one above the other each with padding of 1em. This padding is considered to be part of the element … [Read more...]
Generating a Random Number between 1 and 10 Java [duplicate]
As the documentation says, this method call returns "a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive)". This means that you will get numbers from 0 to 9 in your case. So you've done everything correctly by adding one to that number. Generally speaking, if you need to generate numbers from min to max (including both), you … [Read more...]
Are static class variables possible in Python?
Variables declared inside the class definition, but not inside a method are class or static variables: >>> class MyClass: ... i = 3 ... >>> MyClass.i 3 As @millerdev points out, this creates a class-level i variable, but this is distinct from any instance-level i variable, so you could have >>> m = MyClass() >>> m.i = 4 >>> MyClass.i, m.i >>> (3, 4) This is different … [Read more...]
Linker Command failed with exit code 1 (use -v to see invocation), Xcode 8, Swift 3
i was facing same issue today in xcode 8 version 8.3.2 right click on issue --> reveal in log then you are able to check what is causing that issue Maybe you installed a pod file and you are still trying to build from the .xcodeproj file instead of .xcworkspace … [Read more...]
How to plot a histogram using Matplotlib in Python with a list of data?
If you want a histogram, you don't need to attach any 'names' to x-values, as on x-axis you would have data bins: import matplotlib.pyplot as plt import numpy as np %matplotlib inline np.random.seed(42) x = np.random.normal(size=1000) plt.hist(x, density=True, bins=30) # density=False would make counts plt.ylabel('Probability') plt.xlabel('Data'); Note, the number of … [Read more...]
Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function [closed]
The 500 code would normally indicate an error on the server, not anything with your code. Some thoughts Talk to the server developer for more info. You can't get more info directly. Verify your arguments into the call (values). Look for anything you might think could cause a problem for the server process. The process should not die and should return you a better code, but … [Read more...]
MySQL ERROR 1045 (28000): Access denied for user ‘bill’@’localhost’ (using password: YES)
You probably have an anonymous user ''@'localhost' or ''@'127.0.0.1'. As per the manual: When multiple matches are possible, the server must determine which of them to use. It resolves this issue as follows: (...) When a client attempts to connect, the server looks through the rows [of table mysql.user] in sorted order. The server uses the first row that matches the client … [Read more...]