Tutorial by Examples: al

To find the largest items in a collection, heapq module has a function called nlargest, we pass it two arguments, the first one is the number of items that we want to retrieve, the second one is the collection name: import heapq numbers = [1, 4, 2, 100, 20, 50, 32, 200, 150, 8] print(heapq.nl...
The most interesting property of a heap is that its smallest element is always the first element: heap[0] import heapq numbers = [10, 4, 2, 100, 20, 50, 32, 200, 150, 8] heapq.heapify(numbers) print(numbers) # Output: [2, 4, 10, 100, 8, 50, 32, 200, 150, 20] heapq.heappop(numbers) # 2...
Let's create a very simple view to respond a "Hello World" template in html format. To do that go to my_project/my_app/views.py (Here we are housing our view functions) and add the following view: from django.http import HttpResponse def hello_world(request): html = "&lt...
Dim classFile : classFile = "carClass.vbs" Dim fsObj : Set fsObj = CreateObject("Scripting.FileSystemObject") Dim vbsFile : Set vbsFile = fsObj.OpenTextFile(classFile, 1, False) Dim myFunctionsStr : myFunctionsStr = vbsFile.ReadAll vbsFile.Close Set vbsFile = Nothing Set fs...
/* * This example show some ways of using std::function to call * a) C-like function * b) class-member function * c) operator() * d) lambda function * * Function call can be made: * a) with right arguments * b) argumens with different order, types and count */ #include &lt...
Detailed instructions on getting eloquent set up or installed.
The ConstainsKey method is the way to know if a key already exists in the Dictionary. This come in handy for data reduction. In the sample below, each time we encountner a new word, we add it as a key in the dictionary, else we increment the counter for this specific word. Dim dic As IDictionary(...
You can use a TStringList to store Key-Value pairs. This can be useful if you want to store settings, for example. A settings consists of a Key (The Identifier of the setting) and the value. Each Key-Value pair is stored in one line of the StringList in Key=Value format. procedure Demo(const FileN...
You can use plugman command to install/uninstall custom cordova plugins. To install plugman npm install -g plugman Install plugin command syntax: plugman <install|uninstall> --platform <ios|android|blackberry10|wp8> --project <directory> --plugin <name|url|path> Exa...
To call a list of goals as if it were a conjunction of goals, combine the higher-order predicates call/1 and maplist/2: ?- Gs = [X = a, Y = b], maplist(call, Gs). Gs = [a=a, b=b], X = a, Y = b.
The names of modules follow the filesystem's hierarchical structure. With the following file layout: Foo/ ├── Baz/ │ └── Quux.hs └── Bar.hs Foo.hs Bar.hs the module headers would look like this: -- file Foo.hs module Foo where -- file Bar.hs module Bar where -- file Foo/Bar.hs m...
Detailed instructions on getting slick set up or installed. http://kenwheeler.github.io/slick/ Slick Slider is easy to use and to customise. It provides good amount of customisation options including responsive options based on breakpoints. To get started with slick, it is not that difficult. Jus...
C# Visual Studio 2015 (latest update) - you can download the community version here for free: www.VisualStudio.com Important: update all VS extensions to their latest versions Tools->Extensions and Updates->Updates Download the Bot Application template from here: Template Dow...
update <SCHEMA_NAME>.<TABLE_NAME_1> AS A SET <COLUMN_1> = True FROM <SCHEMA_NAME>.<TABLE_NAME_2> AS B WHERE A.<COLUMN_2> = B.<COLUMN_2> AND A.<COLUMN_3> = B.<COLUMN_3>
Standard Version To install the standard version, go to the Plugin section of your WordPress installation. Search for "Advanced Custom Fields" and install/activate. You will now have access to a new area in the WordPress administrative area labeled "Custom Fields" where you can ...
<?php echo get_field('my_field_name', 123); ?> This will echo the value of "my_field_name" from the post with 123 as its ID.
<?php echo get_field('my_field_name', 'option'); ?> This will echo the value of "my_field_name" from the options page created via ACF.
Fabric.js is just like any other JS library just specific to canvas. Easy to setup and get started. All you need to do is download the fabric.js from HERE and include it in your project just like any other JS library for example the way you do it for jQuery. Then create the html file suppose index.h...
The setCustomTitle() method of AlertDialog.Builder lets you specify an arbitrary view to be used for the dialog title. One common use for this method is to build an alert dialog that has a long title. AlertDialog.Builder builder = new AlertDialog.Builder(context, Theme_Material_Light_Dialog); buil...
To read an atom's value, simply put the name of the atom, with a @ before it: @counter ; => 0 A bigger example: (def number (atom 3)) (println (inc @number)) ;; This should output 4

Page 195 of 269