You can check for syntax errors and referenced files in an NGINX configuration file before running it with:
nginx -t
Alternatively you can run service script
service nginx configtest
While both of these commands will tell you if your new nginx configuration is ok [without killing your curren...
Fetching resources over the network is both slow and expensive: the download may require multiple roundtrips between the client and server, which delays processing and may block rendering of page content, and also incurs data costs for the visitor. All server responses should specify a caching p...
A condition variable is a primitive used in conjunction with a mutex to orchestrate communication between threads. While it is neither the exclusive or most efficient way to accomplish this, it can be among the simplest to those familiar with the pattern.
One waits on a std::condition_variable with...
Passing a pointer argument to a T* parameter, if possible, is better than passing it to a const T* parameter.
struct Base {};
struct Derived : Base {};
void f(Base* pb);
void f(const Base* pb);
void f(const Derived* pd);
void f(bool b);
Base b;
f(&b); // f(Base*) is better than f(const...
java -jar [Path to client JAR] -s [Server address] install-plugin [Plugin ID]
The client JAR must be the CLI JAR file, not the same JAR/WAR that runs Jenkins itself. Unique IDs can be found on a plugins respective page on the Jenkins CLI wiki (https://wiki.jenkins-ci.org/display/JENKINS/Plugins)
...
An object pointer (including void*) or function pointer can be converted to an integer type using reinterpret_cast. This will only compile if the destination type is long enough. The result is implementation-defined and typically yields the numeric address of the byte in memory that the pointer poin...
To view line numbers from Default view enter
:set number
To hide line numbers
:set nonumber
There is also a shortcut for above. nu is same as number.
:set nonu
To hide line numbers, we can also use
:set nu!
int main (void)
{
const int foo_readonly = 10;
int *foo_ptr;
foo_ptr = (int *)&foo_readonly; /* (1) This casts away the const qualifier */
*foo_ptr = 20; /* This is undefined behavior */
return 0;
}
Quoting ISO/IEC 9899:201x, section 6.7.3 §2:
If an attempt i...
Add-ons:
Firefox add-ons are generally grouped into Extensions, and then "other types" of Firefox add-ons.
Extensions
Extensions allow Firefox to be customized by adding to or modifying the functionality of Firefox. Some of the types of things which can be done with extensions include:...
Ada is a programming language for which there exists multiple compilers.
One of these compilers, and perhaps the most used, is GNAT. It is part of the GCC toolchain. It can be installed from several sources:
The yearly GPL release done by AdaCore, available for free on libre site. This ver...
Note: This example is based on the Oracle JVM implementation.
Built-in tools like jmap, jconsole, and jvisualvm are available in a JDK and can be used to generate and analyze heap memory dumps taken from a running JVM application. However, one option to generate a heap dump without using JDK tools ...
class Foldable t where
{-# MINIMAL foldMap | foldr #-}
foldMap :: Monoid m => (a -> m) -> t a -> m
foldMap f = foldr (mappend . f) mempty
foldr :: (a -> b -> b) -> b -> t a -> b
foldr f z t = appEndo (foldMap (Endo #. f) t) z
-- and a nu...
class (Functor t, Foldable t) => Traversable t where
{-# MINIMAL traverse | sequenceA #-}
traverse :: Applicative f => (a -> f b) -> t a -> f (t b)
traverse f = sequenceA . fmap f
sequenceA :: Applicative f => t (f a) -> f (t a)
sequenceA = t...
Window functions are used to do operations(generally aggregation) on a set of rows collectively called as window. Window functions work in Spark 1.4 or later. Window functions provides more operations then the built-in functions or UDFs, such as substr or round (extensively used before Spark 1.4). W...
To calculate moving average of salary of the employers based on their role:
val movAvg = sampleData.withColumn("movingAverage", avg(sampleData("Salary"))
.over( Window.partitionBy("Role").rowsBetween(-1,1)) )
withColumn() creates a new column named m...
By default the Custom Tool property for a VB resource file is VbMyResourcesResXFileCodeGenerator. However, with this code generator the view (XAML) will not be able to access the resources. To solve this problem add Public before the Custom Tool property value.
To select the Resources.resx file in ...
In order to add Firebase Crash Reporting to your app, perform the following steps:
Create an app on the Firebase Console here.
Copy the google-services.json file from your project into your in app/ directory.
Add the following rules to your root-level build.gradle file in order to inc...