Tutorial by Examples: al

In Julia, a for loop can contain a comma (,) to specify iterating over multiple dimensions. This acts similarly to nesting a loop within another, but can be more compact. For instance, the below function generates elements of the Cartesian product of two iterables: function cartesian(xs, ys) f...
Julia provides macros to simplify distributing computation across multiple machines or workers. For instance, the following computes the sum of some number of squares, possibly in parallel. function sumofsquares(A) @parallel (+) for i in A i ^ 2 end end Usage: julia> sumo...
Although not traditionally considered loops, the @goto and @label macros can be used for more advanced control flow. One use case is when the failure of one part should lead to the retry of an entire function, often useful in input validation: function getsequence() local a, b @label start ...
pushunique!(A, x) = x in A ? A : push!(A, x) The ternary conditional operator is a less wordy if...else expression. The syntax specifically is: [condition] ? [execute if true] : [execute if false] In this example, we add x to the collection A only if x is not already in A. Otherwise, we jus...
MySQLi is a PHP Extension which enables PHP to communicate with MySQL Databases. MySQLi comes built in with PHP. MySQLi was introduced with PHP 5.0. For More details about Installations Refer official PHP MySQLi Documentation
// 1. Instantiate an AlertDialog.Builder with its constructor // the parameter this is the context (usually your activity) AlertDialog.Builder builder = new AlertDialog.Builder(this); // 2. Chain together various setter methods to set the dialog characteristics builder.SetMessage(Resource.Str...
HBase Standalone is a mode which allow you to get rid of HDFS and to test HBase before deploying in a cluster, It is not production oriented. Installing HBase in standalone is extremely simple. First you have to download the HBase archive named hbase-X.X.X-bin.tar.gz available on one of the apache ...
If you only need a given resource for a specific control, you can make it more local by adding it to this specific control, instead of the window. It works exactly the same way, the only difference being that you can now only access from inside the scope of the control where you put it: <StackPa...
in this way '0' representing the known values ​​are ranked first, '1' representing the NULL values ​​are sorted by the last: SELECT ID ,REGION ,CITY ,DEPARTMENT ,EMPLOYEES_NUMBER FROM DEPT ORDER BY CASE WHEN REGION IS NULL THEN 1 ELSE 0 END, REGION ...
If you need to send events from fragment to activity, one of the possible solutions is to define callback interface and require that the host activity implement it. Example Send callback to an activity, when fragment's button clicked First of all, define callback interface: public interface Samp...
You can use parfor to execute the iterations of a loop in parallel: Example: poolobj = parpool(2); % Open a parallel pool with 2 workers s = 0; % Performing some parallel Computations parfor i=0:9 s = s + 1; end disp(s) % Outputs '10' d...
You can use the $q.all function to call a .then method after an array of promises has been successfully resolved and fetch the data they resolved with. Example: JS: $scope.data = [] $q.all([ $http.get("data.json"), $http.get("more-data.json"), ]).then(funct...
Ubuntu Below are detailed instructions to install Caffe, pycaffe as well as its dependencies, on Ubuntu 14.04 x64 or 14.10 x64. Execute the following script, e.g. "bash compile_caffe_ubuntu_14.sh" (~30 to 60 minutes on a new Ubuntu). # This script installs Caffe and pycaffe. # CPU onl...
Even experienced Java developers tend to think that Java has only three protection modifiers. The language actually has four! The package private (a.k.a. default) level of visibility is often forgotten. You should pay attention to what methods you make public. The public methods in an application a...
These Java issues can be very embarrassing, and sometimes remain undiscovered until run in production. Fallthrough behavior in switch statements is often useful; however, missing a “break” keyword when such behavior is not desired can lead to disastrous results. If you have forgotten to put a “break...
Every time a program opens a resource, such as a file or network connection, it is important to free the resource once you are done using it. Similar caution should be taken if any exception were to be thrown during operations on such resources. One could argue that the FileInputStream has a finaliz...
Java manages memory automatically. You are not required to free memory manually. An object's memory on the heap may be freed by a garbage collector when the object is no longer reachable by a live thread. However, you can prevent memory from being freed, by allowing objects to be reachable that are...
This example is about deliberately ignoring or "squashing" exceptions. Or to be more precise, it is about how to catch and handle an exception in a way that ignores it. However, before we describe how to do this, we should first point out that squashing exceptions is generally not the co...
This exception occurs when a collection is modified while iterating over it using methods other than those provided by the iterator object. For example, we have a list of hats and we want to remove all those that have ear flaps: List<IHat> hats = new ArrayList<>(); hats.add(new Ushanka...
pip is your friend when you need to install any package from the plethora of choices available at the python package index (PyPI). pip is already installed if you're using Python 2 >= 2.7.9 or Python 3 >= 3.4 downloaded from python.org. For computers running Linux or another *nix with a native...

Page 114 of 269