Tutorial by Examples: a

The Memory Model is difficult to understand, and difficult to apply. It is useful if you need to reason about the correctness of multi-threaded code, but you do not want to have to do this reasoning for every multi-threaded application that you write. If you adopt the following principals when wri...
Let's make a function to divide two numbers, that's very trusting about its input: def divide(x, y) return x/y end This will work fine for a lot of inputs: > puts divide(10, 2) 5 But not all > puts divide(10, 0) ZeroDivisionError: divided by 0 > puts divide(10, 'a') TypeE...
You can save the error if you want to use it in the rescue clause def divide(x, y) begin x/y rescue => e puts "There was a %s (%s)" % [e.class, e.message] puts e.backtrace end end > divide(10, 0) There was a ZeroDivisionError (divided by 0) from ...
You can use an else clause for code that will be run if no error is raised. def divide(x, y) begin z = x/y rescue ZeroDivisionError puts "Don't divide by zero!" rescue TypeError puts "Division only works on numbers!" return nil rescue => e ...
Use an ensure clause if there is code you always want to execute. def divide(x, y) begin z = x/y return z rescue ZeroDivisionError puts "Don't divide by zero!" rescue TypeError puts "Division only works on numbers!" return nil rescue => e ...
select :start_value + level -1 n from dual connect by level <= :end_value - :start_value + 1
Qt offers a deployment tool for Mac: The Mac Deployment Tool. The Mac deployment tool can be found in QTDIR/bin/macdeployqt. It is designed to automate the process of creating a deployable application bundle that contains the Qt libraries as private frameworks. The mac deployment tool also deploys...
import matplotlib.pyplot as plt import numpy as np # generate 1000 data points with normal distribution data = np.random.randn(1000) plt.hist(data) plt.show()
You can read content of file using OPENROWSET(BULK) function and store content in some table: INSERT INTO myTable(content) SELECT BulkColumn FROM OPENROWSET(BULK N'C:\Text1.txt', SINGLE_BLOB) AS Document; SINGLE_BLOB option will read entire content from a file as single cell. ...
Yu can define format of the file that will be imported using FORMATFILE option: INSERT INTO mytable SELECT a.* FROM OPENROWSET(BULK 'c:\test\values.txt', FORMATFILE = 'c:\test\values.fmt') AS a; The format file, format_file.fmt, describes the columns in values.txt: 9.0 2 1 SQ...
You can use OPENROWSET to read content of file and pass it to some other function that will parse results. The following example shows hot to read entire content of JSON file using OPENROWSET(BULK) and then provide BulkColumn to OPENJSON function that will parse JSON and return columns: SELECT boo...
follow these step to creating Custom Framework in Swift-IOS: Create a new project. In Xcode Choose iOS/Framework & Library/Cocoa Touch Framework to create a new framework click next and set the productName click next and choose directory to create Project there add code and resources to c...
There’s a tempting existing field called profile that is added by default when a new user registers. This field was historically intended to be used as a scratch pad for user-specific data - maybe their image avatar, name, intro text, etc. Because of this, the profile field on every user is automati...
A basic implementation for singly-linked-list in java - that can add integer values to the end of the list, remove the first value encountered value from list, return an array of values at a given instant and determine whether a given value is present in the list. Node.java package com.example.so....
Following setup ensures that testing framework (PHPUnit) uses :memory: database. config/database.php 'connections' => [ 'sqlite_testing' => [ 'driver' => 'sqlite', 'database' => ':memory:', 'prefix' => '', ], . . . ./phpun...
As with everything in Windows Azure, You have to have a Windows Azure account and an Azure Subscription. After you have both, go to https://portal.azure.com. From here, you can add new resources to your Azure subscription. Click New on the left menu.A new blade will be added to the right of you...
PERFORM VARYING TALLY FROM 1 BY 1 UNTIL TALLY > 5 DISPLAY TALLY END-PERFORM
PERFORM some-paragraph

Page 797 of 1099