Tutorial by Examples: al

When allocating multidimensional arrays with malloc, calloc, and realloc, a common pattern is to allocate the inner arrays with multiple calls (even if the call only appears once, it may be in a loop): /* Could also be `int **` with malloc used to allocate outer array. */ int *array[4]; int i; ...
There's no built in way to search a list for a particular item. However Programming in Lua shows how you might build a set that can help: function Set (list) local set = {} for _, l in ipairs(list) do set[l] = true end return set end Then you can put your list in the Set and test for m...
In Python 2, True, False and None are built-in constants. Which means it's possible to reassign them. Python 2.x2.0 True, False = False, True True # False False # True You can't do this with None since Python 2.4. Python 2.x2.4 None = None # SyntaxError: cannot assign to None In ...
To create a parallel collection from a sequential collection, call the par method. To create a sequential collection from a parallel collection, call the seq method. This example shows how you turn a regular Vector into a ParVector, and then back again: scala> val vect = (1 to 5).toVector vect:...
Do not use parallel collections when the collection elements must be received in a specific order. Parallel collections perform operations concurrently. That means that all of the work is divided into parts and distributed to different processors. Each processor is unaware of the work being done by...
The most common mode of using TensorFlow involves first building a dataflow graph of TensorFlow operators (like tf.constant() and tf.matmul(), then running steps by calling the tf.Session.run() method in a loop (e.g. a training loop). A common source of memory leaks is where the training loop conta...
To improve memory allocation performance, many TensorFlow users often use tcmalloc instead of the default malloc() implementation, as tcmalloc suffers less from fragmentation when allocating and deallocating large objects (such as many tensors). Some memory-intensive TensorFlow programs have been kn...
PyPar is a library that uses the message passing interface (MPI) to provide parallelism in Python. A simple example in PyPar (as seen at https://github.com/daleroberts/pypar) looks like this: import pypar as pp ncpus = pp.size() rank = pp.rank() node = pp.get_processor_name() print 'I am r...
Detailed instructions on getting dropwizard set up or installed.
There are several scopes that are available only in a web-aware application context: request - new bean instance is created per HTTP request session - new bean instance is created per HTTP session application - new bean instance is created per ServletContext globalSession - new bean instance i...
When using async queries, you can execute multiple queries at the same time, but not on the same context. If the execution time of one query is 10s, the time for the bad example will be 20s, while the time for the good example will be 10s. Bad Example IEnumerable<TResult1> result1; IEnumera...
Apart from LF the only allowed white space character is Space (ASCII value 32). Note that this implies that other white space characters (in, for instance, string and character literals) must be written in escaped form. \', \", \\, \t, \b, \r, \f, and \n should be preferred over corres...
long l = 5432L; int i = 0x123 + 0xABC; byte b = 0b1010; float f1 = 1 / 5432f; float f2 = 0.123e4f; double d1 = 1 / 5432d; // or 1 / 5432.0 double d2 = 0x1.3p2; long literals should use the upper case letter L suffix. Hexadecimal literals should use upper case letters A-F. All other num...
First, here's what can happen when text/template is used for HTML. Note Harry's FirstName property). package main import ( "fmt" "html/template" "os" ) type Person struct { FirstName string LastName string Street string Cit...
var gradient = createRadialGradient( centerX1, centerY1, radius1, // this is the "display' circle centerX2, centerY2, radius2 // this is the "light casting" circle ) gradient.addColorStop(gradientPercentPosition, CssColor) gradient.addColorStop(gradientPerce...
package main import ( "fmt" "net/http" "os" "text/template" ) var requestTemplate string = ` {{range $i, $url := .URLs}} {{ $url }} {{(status_code $url)}} {{ end }}` type Requests struct { URLs []string } func main() {...
These operators have the usual precedence in C++: AND before OR. // You can drive with a foreign license for up to 60 days bool can_drive = has_domestic_license || has_foreign_license && num_days <= 60; This code is equivalent to the following: // You can drive with a foreign licens...
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) ...
Highcharts.setOptions({ lang: { loading: 'Aguarde...', months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'], weekdays: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sex...
Highcharts.setOptions({ lang: { loading: 'Загрузка...', months: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'], weekdays: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'П...

Page 102 of 269