Tutorial by Examples

Install Chrome by first considering which version to use, relevant if you are going to be doing Web Development: Google Chrome releases major versions about every 6 weeks and provides access to multiple versions of the product as they are being stabilized. This process is done in a series of channe...
Getting installed on Windows 10 is as easy as it's ever been, and despite (true) rumours flying around regarding Windows 10 being the last 'normal' version of Windows, it has and always will stay the same process. Installing a new version Get the windows image (Go straight to step 4 if you have ...
For efficiency, Prolog code is typically compiled to abstract machine code before it is run. Many different abstract machine architectures and variants have been proposed for efficient execution of Prolog programs. These include: WAM, the Warren Abstract Machine TOAM, an abstract machine used i...
All widely used Prolog interpreters use argument indexing to efficiently select suitable clauses. Users can typically rely on at least first argument indexing, meaning that clauses can be efficiently told apart by the functor and arity of the outermost term of the first argument. In calls where tha...
Virtually all Prolog systems implement tail call optimization (TCO). This means that predicate calls that are in a tail position can be executed in constant stack space if the predicate is deterministic. Tail recursion optimization (TRO) is a special case of tail call optimization.
As long as you have an internet connection, you can read images from an hyperlink I=imread('https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png');
In this example we illustrate how to take a double real-type 3D matrix from MATLAB, and pass it to a C double* array. The main objectives of this example are showing how to obtain data from MATLAB MEX arrays and to highlight some small details in matrix storage and handling. matrixIn.cpp #include...
To retreive the screens width and height in pixels, we can make use of the WindowManagers display metrics. // Get display metrics DisplayMetrics metrics = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metrics); These DisplayMetrics hold a series of informatio...
To get the screens density, we also can make use of the Windowmanagers DisplayMetrics. This is a quick example: // Get density in dpi DisplayMetrics metrics = new DisplayMetrics(); context.getWindowManager().getDefaultDisplay().getMetrics(metrics); int densityInDpi = metrics.densityDpi;
Some applications that use Hibernate generate a huge amount of SQL when the application is started. Sometimes it's better to enable/disable the SQL log in specific points when debugging. To enable, just run this code in your IDE when you are debugging the aplication: org.apache.log4j.Logger.getLog...
Type switches can also be used to get a variable that matches the type of the case: func convint(v interface{}) (int,error) { switch u := v.(type) { case int: return u, nil case float64: return int(u), nil case string: return strconv(u) default: ...
Generally, if we want to remove an element from an array, we need to know it's index so that we can remove it easily using remove(at:) function. But what if we don't know the index but we know the value of element to be removed! So here is the simple extension to an array which will allow us to re...
# models fit1 <- lm(mpg ~ wt, data = mtcars) fit2 <- lm(mpg ~ wt+hp, data = mtcars) fit3 <- lm(mpg ~ wt+hp+cyl, data = mtcars) # export to html texreg::htmlreg(list(fit1,fit2,fit3),file='models.html') # export to doc texreg::htmlreg(list(fit1,fit2,fit3),file='models.doc') Th...
Using Angular markup like {{hash}} in a src attribute doesn't work right. The browser will fetch from the URL with the literal text {{hash}} until Angular replaces the expression inside {{hash}}. ng-src directive overrides the original src attribute for the image tag element and solves the problem ...
NOTE: This example is WIP, it will be updated with diagrams, images, more examples, etc. What is Phong? Phong is a very basic, but real looking light model for surfaces that has three parts: ambient, diffuse, and specular lighting. Ambient Lighting: Ambient lighting is the simplest of the t...
As of IntelliJ IDEA version 2016.2, and IdeaVim version 0.46, IntelliJ's native option for showing line numbers is ineffective. When clicking Show line numbers, the line numbers immediately show and disappear. This problem is caused by a bug in the IdeaVim plugin, which can be resolved by using the...
By default, some keystrokes that are useful in Vim contradict with the keystrokes of IntelliJ. For example, ^R in Vim is 'redo', but in IntelliJ it's the shortcut for Run To decide which program interprets the keystroke, go to Preferences -> Other Settings -> Vim Emulation and choose which k...
RecyclerView will perform a relevant animation if any of the "notify" methods are used except for notifyDataSetChanged; this includes notifyItemChanged, notifyItemInserted, notifyItemMoved, notifyItemRemoved, etc. The adapter should extend this class instead of RecyclerView.Adapter. impo...
You can save the layout of your tabs and windows to standardize your work environment. The layouts menu can be found in the upper right corner of Unity Editor: Unity ships with 5 default layouts (2 by 3, 4 Split, Default, Tall, Wide) (marked with 1). In the picture above, aside from default layo...
PriorityQueue is a data structure. Like SortedSet, PriorityQueue sorts also its elements based on their priorities. The elements, which have a higher priority, comes first. The type of the PriorityQueue should implement comparable or comparator interface, whose methods decides the priorities of the ...

Page 569 of 1336