Tutorial by Examples

Function contracts allow the programer to check for inconsistencies. Inconsistencies include invalid parameters, checks for the correct return value or an invalid state of the object. The checks can happen before and after the body of the function or method is executed. void printNotGreaterThan42(...
For example if an method is invoked the state of the object may not allow that a method is called with specific parameters or not at all. class OlderThanEighteen { uint age; final void driveCar() in { assert(age >= 18); // variable must be in range } body { ...
Before running this sample, you must: Download and install the Java SE Development Kit (JDK): Download JDK Download Apache Maven version 3.3.9 or greater: Install and configure Maven for your local development environment.
We've created a simple Hello World app for Java so you can quickly get a feel for deploying an app to Google Cloud Platform. Follow these steps to download Hello World to your local machine. Clone the Hello World sample app repository to your local machine: git clone https://github.com/GoogleCloud...
Test the application using the development web server, which is included with the App Engine SDK. Run the following Maven command from within your helloworld directory, to compile your app and start the development web server: mvn appengine:devserver The web server is now listening for re...
You can leave the web server running while you develop your application. When you make a change, use the mvn clean package command to build and update your app. Try it now: Leave the web server running, then edit HelloServlet.java to change Hello, world to something else. Run mvn clean package,...
To deploy your app to App Engine, you will need to register a project to create your project ID, which will determine the URL for the app. In the Cloud Platform Console, go to the Projects page and select or create a new project. Note the project ID you created above, and enter it in src/m...
Detailed instructions on getting sybase set up or installed.
Slices are pointers to arrays, with the length of the segment, and its capacity. They behave as pointers, and assigning their value to another slice, will assign the memory address. To copy a slice value to another, use the built-in copy function: func copy(dst, src []Type) int (returns the amount o...
Package fmt implements formatted I/O using format verbs: %v // the value in a default format %T // a Go-syntax representation of the type of the value %s // the uninterpreted bytes of the string or slice Format Functions There are 4 main function types in fmt and several variations w...
With Option Strict On, although the .NET Framework allows the creation of single dimension arrays with non-zero lower bounds they are not "vectors" and so not compatible with VB.NET typed arrays. This means they can only be seen as Array and so cannot use normal array (index) references. ...
Since Qt 5.5 we have a new wonderful TreeView, a control we've all been waiting for. A TreeView implements a tree representation of items from a model. In general it looks like other QML views - ListView or TableView. But data structure of TreeView is more complex. A data in ListView or TableView...
import sympy as sy x1, x2 = sy.symbols("x1 x2") equations = [ sy.Eq( 2*x1 + 1*x2 , 10 ), sy.Eq( 1*x1 - 2*x2 , 11 ) ] print sy.solve(equations) # Result: {x1: 31/5, x2: -12/5}
sort command is used to sort a list of lines. Input from a file sort file.txt Input from a command You can sort any output command. In the example a list of file following a pattern. find * -name pattern | sort
If each lines of the output need to be unique, add -u option. To display owner of files in folder ls -l | awk '{print $3}' | sort -u
import sympy as sy x, y = sy.symbols("x y") # nsolve needs the (in this case: two) equations, the names of the variables # (x,y) we try to evaluate solutions for, and an initial guess (1,1) for the # solution print sy.nsolve((x**3+sy.exp(y)-4,x+3*y),(x,y),(1,1)) The result s...
myfunc(){ echo "I will never be executed." } another_func(){ # this "redeclare" overwrites original function myfunc(){ echo "I am the one and only"; } } # myfunc will print "I will never be executed" myfunc # but if we call another_func fi...
Django Admin comes with some Models registerd by default. There a some occasions where you might want to remove a Model from the admin pages. This is done in the admin submodule. If your app wass created using manage.py startapp, the admin.py file should already lay in your app module. Otherwise cr...
By default, queries that return entity types are tracking This means you can make changes to those entity instances and have those changes persisted by SaveChanges() Example : The change to the book rating will be detected and persisted to the database during SaveChanges(). using (va...
No tracking queries are useful when the results are used in a read-only scenario They are quicker to execute because there is no need to setup change tracking information Example : using (var context = new BookContext()) { var books = context.Books.AsNoTracking().ToList(); } With ...

Page 928 of 1336