Tutorial by Examples: am

CL-USER> (maplist (lambda (list) (cons 0 list)) '(1 2 3 4)) ((0 1 2 3 4) (0 2 3 4) (0 3 4) (0 4)) CL-USER> (maplist #'append '(a b c d -) '(1 2 3)) ((A B C D - 1 2 3) (B C D - 2 3) (C D - 3))
MAPCAN: CL-USER> (mapcan #'reverse '((1 2 3) (a b c) (100 200 300))) (3 2 1 C B A 300 200 100) CL-USER> (defun from-to (min max) (loop for i from min to max collect i)) FROM-TO CL-USER> (from-to 1 5) (1 2 3 4 5) CL-USER> (mapcan #'from-to '(1 2 3) '(5 5 5)) (1 2 3 4 5...
MAPC: CL-USER> (mapc (lambda (x) (print (* x x))) '(1 2 3 4)) 1 4 9 16 (1 2 3 4) CL-USER> (let ((sum 0)) (mapc (lambda (x y) (incf sum (* x y))) '(1 2 3) '(100 200 300)) sum) 1400 ; => (1 x 100) + (2 x 200) + (3 x 30...
A single instance of Node.js runs in a single thread. To take advantage of multi-core systems, application can be launched in a cluster of Node.js processes to handle the load. The cluster module allows you to easily create child processes that all share server ports. Following example create the ...
The importance of good naming, can be best illustrated by some bad examples: [Test] Test1() {...} //Cryptic name - absolutely no information [Test] TestFoo() {...} //Name of the function - and where can I find the expected behaviour? [Test] TestTFSid567843() {...} //Huh? You want me to lo...
First we initialize our initial value problem we want to solve. odefun = @(t,y) cos(y).^2*sin(t); tspan = [0 16*pi]; y0=1; We then use the ode45 function without any specified options to solve this problem. To compare it later we plot the trajectory. [t,y] = ode45(odefun, tspan, y0); plot(t,...
Class for which you will create unit test case. class Authorization { /* Observer so that mock object can work. */ public function attach(Curl $observer) { $this->observers = $observer; } /* Method for which we will create test */ public function postAuthorization($url, $met...
A method called in one object will move up the chain of objects until one is found that can properly handle the call. This particular example uses scientific experiments with functions that can just get the title of the experiment, the experiments id or the tissue used in the experiment. abstract c...
This is the code to filter the Datatables [1.10.7] by value programmatically, you can find it on official documentation. function setFilterValue(datatable, value){ if(datatable !== undefined){ datatable .columns(0) .search(value) .draw(); } ...
Wolfram define Mathematica as "The world's definitive system for modern technical computing". A bold statement which is partially true. It's probably not the most predominant (as you have to pay quite a bit for commercial use) system so people use Python or R for example. What it is, is th...
Binding a Swift Library in Xamarin.iOS follows the same process for Objective-C as shown in https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/, but with some caveats. A swift class must inherit from NSObject to be binded. Swift compiler will translate class and protoco...
The basics In the heading of ContentPage, insert following line: xmlns:cv="clr-namespace:Xamarin.Forms;assembly=Xamarin.Forms.CarouselView" Between the <ContentPage.Content> tags place the CarouselView: <cv:CarouselView x:Name="DemoCarouselView"> </cv:Carous...
Place a file like the following in your top level directory. It defines which components to render for which paths import React from 'react'; import { Route, IndexRoute } from 'react-router'; import New from './containers/new-post'; import Show from './containers/show'; import Index from './c...
Let's take a look at a quick example of using REST framework to build a simple model-backed API. We'll create a read-write API for accessing information on the users of our project. Any global settings for a REST framework API are kept in a single configuration dictionary named REST_FRAMEWORK. Sta...
var WebSocketServer = require('ws').Server , wss = new WebSocketServer({ port: 8080 }); // If you want to add a path as well, use path: "PathName" wss.on('connection', function connection(ws) { ws.on('message', function incoming(message) { console.log('received: %s', message); ...
Spinner It is a type of dropdown input. Firstly in layout <Spinner android:id="@+id/spinner" <!-- id to refer this spinner from JAVA--> android:layout_width="match_parent" android:layout_height="wrap_content"> </Spinner> ...
Install symfony correctly as guided above. Start symfony server if you are not installed in www directory. Ensure http://localhost:8000 is working if symfony server is used. Now it is ready to play with simplest example. Add following code in a new file /src/AppBundle/Controller/MyController.p...
Create a sample application using spring-boot from spring-boot initializer site. Import the code in your local IDE and run the goal as clean install spring-boot:run -e Go to target folder and check for the jar file. Open your Amazon account or create a new Amazon Account and selec...
Using the Swift class Mirror works if you want to extract name, value and type (Swift 3: type(of: value), Swift 2: value.dynamicType) of properties for an instance of a certain class. If you class inherits from NSObject, you can use the method class_copyPropertyList together with property_getAttrib...
Layout.xml <WebView android:id="@+id/WebViewToDisplay" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" ...

Page 72 of 129