Highcharts.setOptions({
lang: {
contextButtonTitle: "Menú contextual del diagrama",
decimalPoint: ",",
downloadJPEG: "Desa com a imatge JPEG",
downloadPDF: "Desa com a document PDF",
downloa...
An XML document can contain a DTD. DTD stands for Document Type Declaration. A DTD begins with <!DOCTYPE root-element-name > where doc-element-name must match the name of the so-called document element (the one element at the top-level).
<?xml version="1.0"?>
<!DOCTYPE doc...
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...
Format strings may contain named placeholders that are interpolated using keyword arguments to format.
Using a dictionary (Python 2.x)
>>> data = {'first': 'Hodor', 'last': 'Hodor!'}
>>> '{first} {last}'.format(**data)
'Hodor Hodor!'
Using a dictionary (Python 3.2+)
>>...
A variable declared constexpr is implicitly const and its value may be used as a constant expression.
Comparison with #define
A constexpr is type-safe replacement for #define based compile-time expressions. With constexpr the compile-time evaluated expression is replaced with the result. For examp...
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...
A method can take an array parameter and destructure it immediately into named local variables. Found on Mathias Meyer's blog.
def feed( amount, (animal, food) )
p "#{amount} #{animal}s chew some #{food}"
end
feed 3, [ 'rabbit', 'grass' ] # => "3 rabbits chew some gra...
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...
Always use Rails.logger.{debug|info|warn|error|fatal} rather than puts. This allows your logs to fit into the standard log format, have a timestamp and have a level so you choose whether they are important enough to be shown in a specific environment. You can see the separate log files for your appl...