Tutorial by Examples: e

@parallel can be used to parallellize a loop, dividing steps of the loop up over different workers. As a very simple example: addprocs(3) a = collect(1:10) for idx = 1:10 println(a[idx]) end For a slightly more complex example, consider: @time begin @sync begin @paral...
The Julia documentation advises that pmap() is designed for the case where each function call does a large amount of work. In contrast, @parallel for can handle situations where each iteration is tiny, perhaps merely summing two numbers. There are several reasons for this. First, pmap incurs ...
When you first start Julia, by default, there will only be a single process running and available to give work to. You can verify this using: julia> nprocs() 1 In order to take advantage of parallel processing, you must first add additional workers who will then be available to do work that...
SELECT s.name AS [schema], t.object_id AS [table_object_id], t.name AS [table_name], c.column_id, c.name AS [column_name], i.name AS [index_name], i.type_desc AS [index_type] FROM sys.schemas AS s INNER JOIN sys.tables AS t ON s.schema_id = t.schema_id I...
SELECT @@VERSION Returns the version of MS SQL Server running on the instance. SELECT @@SERVERNAME Returns the name of the MS SQL Server instance. SELECT @@SERVICENAME Returns the name of the Windows service MS SQL Server is running as. SELECT serverproperty('ComputerNamePhysicalNetBIOS'...
Whenever you change data, in a Data Manipulation Language(DML) command, you can wrap your changes in a transaction. DML includes UPDATE, TRUNCATE, INSERT and DELETE. One of the ways that you can make sure that you're changing the right data would be to use a transaction. DML changes will take a loc...
To create a view with an index, the view must be created using the WITH SCHEMABINDING keywords: CREATE VIEW view_EmployeeInfo WITH SCHEMABINDING AS SELECT EmployeeID, FirstName, LastName, HireDate FROM [dbo].Employee GO Any clustered or non-clustered ...
Stored procedures can return values using the OUTPUT keyword in its parameter list. Creating a stored procedure with a single out parameter CREATE PROCEDURE SprocWithOutParams ( @InParam VARCHAR(30), @OutParam VARCHAR(30) OUTPUT ) AS BEGIN SELECT @OutParam = @InParam + ' must co...
One might want to GROUP BY more than one column declare @temp table(age int, name varchar(15)) insert into @temp select 18, 'matt' union all select 21, 'matt' union all select 21, 'matt' union all select 18, 'luke' union all select 18, 'luke' union all select 21, 'luke' union all select 1...
-- Identity primary key - unique arbitrary increment number create table person ( id int identity(1,1) primary key not null, firstName varchar(100) not null, lastName varchar(100) not null, dob DateTime not null, ssn varchar(9) not null )
-- GUID primary key - arbitrary unique value for table create table person ( id uniqueIdentifier default (newId()) primary key, firstName varchar(100) not null, lastName varchar(100) not null, dob DateTime not null, ssn varchar(9) not null )
-- natural primary key - using an existing piece of data within the table that uniquely identifies the record create table person ( firstName varchar(100) not null, lastName varchar(100) not null, dob DateTime not null, ssn varchar(9) primary key not null )
-- composite key - using two or more existing columns within a table to create a primary key create table person ( firstName varchar(100) not null, lastName varchar(100) not null, dob DateTime not null, ssn varchar(9) not null, primary key (firstName, lastName, dob) )
ALTER TABLE person ADD CONSTRAINT pk_PersonSSN PRIMARY KEY (ssn) Note, if the primary key column (in this case ssn) has more than one row with the same candidate key, the above statement will fail, as primary key values must be unique.
ALTER TABLE Person DROP CONSTRAINT pk_PersonSSN
You can use limit to tell the number of records to be fetched, and use offset to tell the number of records to skip before starting to return the records. For Example User.limit(3) #returns first three records It will generate following sql query. "SELECT `users`.* FROM `users` LIMIT 3&q...
In the absence of explicit initialization, external and static variables are guaranteed to be initialized to zero; automatic variables (including register variables) have indeterminate1 (i.e., garbage) initial values. Scalar variables may be initialized when they are defined by following the name w...
The simplest way is to use the Activator class. However, even though Activator performance have been improved since .NET 3.5, using Activator.CreateInstance() is bad option sometimes, due to (relatively) low performance: Test 1, Test 2, Test 3... With Activator class Type type = typeof(BigInteg...
AppDomain.UnhandledException This event provides notification of uncaught exceptions.It allows the application to log information about the exception before the system default handler reports the exception to the user and terminates the application.If sufficient information about the state of the a...
There are several to evaluate a certain expression when debugging a Java application. 1. Manually inspecting an expression When the program execution is suspended at a certain line (either due to a breakpoint or manually stepping through the debugger), you can manually evaluate an expression by se...

Page 545 of 1191