Tutorial by Examples: n

Servant is a library for declaring APIs at the type-level and then: write servers (this part of servant can be considered a web framework), obtain client functions (in haskell), generate client functions for other programming languages, generate documentation for your web applications and m...
PresenceOf - Validates that a value is not null or empty string $validator->add('name', new \Phalcon\Validation\Validator\PresenceOf([ 'message' => 'The name is required' ])); Email - Checks if a value has a correct e-mail format $validator->add('email', new \Phalcon\Validation\Va...
In Tcl, a control structure is basically just another command. This is one possible implementation of a do ... while / do ... until control structure. proc do {body keyword expression} { uplevel 1 $body switch $keyword { while {uplevel 1 [list while $expression $body]} u...
In Object oriented programming language, a mixin is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depends on the language. It provides a mechanism for multiple inheritan...
2.1.3 1. Preview Different Devices There is a preview panel at the right of the android studio. In thispanel there is a button with device name with which you are previewing the UI of your app like this . Click on small dropdown indicator of this and a floating panel will appear with all the pr...
VB 14.0 introduces the ability to add comments after implicit line continuation. Dim number = From c As Char 'Comment In "dj58kwd92n4" 'Comment Where Char.IsNumber(c) 'Comment Select c 'Comment
In Emacs, basic search tool (I-Search) allows you to search after or before the location of your cursor. To search for sometext after the location of your cursor (search-forward) hit C-s sometext. If you want to go to the next occurence of sometext, just press C-s again (and so on for the ne...
Set mark in cursor location: C-space or C-@ Kill region (Cut): C-w Copy region to kill ring: M-w or Esc-w Yank (Paste) most recently killed: C-y Yank (Paste) next last killed: M-y or Esc-y Kill killis the command used by Emacs for the deletion of ...
Document level It is on by default, but you can have an extra layer of protection by placing Option Explicit On at the top of the code file. The option will apply to the whole document. Project level You can switch it on via the menu in Visual Studio: Project > [Project] Properties > Com...
Use the task dependencies. Depending on how your modules are set up, it may be either ./gradlew dependencies or to see the dependencies of module app use ./gradlew :app:dependencies The example following build.gradle file dependencies { compile 'com.android.support:design:23.2.1' compile...
To create mixins, simply declare lightweight classes that can be used as "behaviours". class Flies { fly() { alert('Is it a bird? Is it a plane?'); } } class Climbs { climb() { alert('My spider-sense is tingling.'); } } class Bulletproof { ...
Using the System.String.Replace method, you can replace part of a string with another string. string s = "Hello World"; s = s.Replace("World", "Universe"); // s = "Hello Universe" All the occurrences of the search string are replaced. This method can al...
The System.String class supports a number of methods to convert between uppercase and lowercase characters in a string. System.String.ToLowerInvariant is used to return a String object converted to lowercase. System.String.ToUpperInvariant is used to return a String object converted to upper...
The System.String.Join method allows to concatenate all elements in a string array, using a specified separator between each element: string[] words = {"One", "Two", "Three", "Four"}; string singleString = String.Join(",", words); // singleString =...
String Concatenation can be done by using the System.String.Concat method, or (much easier) using the + operator: string first = "Hello "; string second = "World"; string concat = first + second; // concat = "Hello World" concat = String.Concat(first, second); // ...
Configure profiling for a project via stack. First build the project with the --profile flag: stack build --profile GHC flags are not required in the cabal file for this to work (like -prof). stack will automatically turn on profiling for both the library and executables in the project. The next...
To find out what packages your project directly depends on, you can simply use this command: stack list-dependencies This way you can find out what version of your dependencies where actually pulled down by stack. Haskell projects frequently find themselves pulling in a lot of libraries indirec...
Add the following code to the onCreate()/onResume() method: SensorManager sensorManager; Sensor mAccelerometer; final float movementThreshold = 0.5f; // You may have to change this value. boolean isMoving = false; float[] prevValues = {1.0f, 1.0f, 1.0f}; float[] currValues = new float[3]; ...
Consider the following code as an illustration: public String joinWords(List<String> words) { String message = ""; for (String word : words) { message = message + " " + word; } return message; } Unfortunate this code is inefficient if the w...
Get all files in Directory var FileSearchRes = Directory.GetFiles(@Path, "*.*", SearchOption.AllDirectories); Returns an array of FileInfo, representing all the files in the specified directory. Get Files with specific extension var FileSearchRes = Directory.GetFiles(@Path, "*...

Page 524 of 1088