Tutorial by Examples: n

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');
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...
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...
The wrap panel acts in a similar way to stack panel. Except when it recognizes the items will exceed it's size, it would then wrap them to a new row/column, depending on it's orientation. Horizontal orientation <WrapPanel Width="100"> <Button Content="Button"/&g...
Uniform grid will place all it's children in a grid layout, each child in it's own cell. All the cells will have the same size. It can be thought to be a shorthand to a grid where all the row and column definitions are set to * Default rows and columns By default the UniformGrid will try to crea...
public class CustomTextView extends TextView { private float strokeWidth; private Integer strokeColor; private Paint.Join strokeJoin; private float strokeMiter; public CustomTextView(Context context) { super(context); init(null); } public ...
The following code makes the UI unresponsive for a short while after the button click, since too many Platform.runLater calls are used. (Try scrolling the ListView immediately after the button click.) @Override public void start(Stage primaryStage) { ObservableList<Integer> data = FXCol...

Page 463 of 1088