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
...
You can customize parsing rules using different options in WITH clause:
BULK INSERT People
FROM 'f:\orders\people.csv'
WITH ( CODEPAGE = '65001',
FIELDTERMINATOR =',',
ROWTERMINATOR ='\n'
);
In this example, CODEPAGE specifies that a source file in UTF-8 f...
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...
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...
This example show how one may create a simple "Hello World" in Gtk3, setting up a window and button widgets. The sample code will also demonstrate how to set different attributes and actions on the widgets.
module Main (Main.main) where
import Graphics.UI.Gtk
main :: IO ()
main = d...
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
task My_Task;
task body My_Task is
begin
for I in 1 .. 4 loop
Put_Line ("Hello from My_Task");
end loop;
end;
begin
for I in 1 .. 4 loop
Put_Line ("Hello from Main");
e...
with Ada.Text_IO; use Ada.Text_IO;
procedure Main is
task My_Task_1;
task My_Task_2;
task body My_Task_1 is
begin
for I in 1 .. 4 loop
Put_Line ("Hello from My_Task_1");
end loop;
end;
task body My_Task_2 is
begin
for ...
a = [1, 2, 3, 4, 5]
# steps through the list backwards (step=-1)
b = a[::-1]
# built-in list method to reverse 'a'
a.reverse()
if a = b:
print(True)
print(b)
# Output:
# True
# [5, 4, 3, 2, 1]
One drawback of creating private method in Javascript is memory-inefficient because a copy of the private method will be created every time a new instance is created. See this simple example.
function contact(first, last) {
this.firstName = first;
this.lastName = last;
this.mobile;
...
Encoded with [uri]::EscapeDataString()
First, we'll decode the URL and Query String encoded with [uri]::EscapeDataString() in the above example:
https://example.vertigion.com/foos?
foo2=complex%3B%2F%3F%3A%40%26%3D%2B%24%2C%20bar'%22&
complex%3B%2F%3F%3A%40%26%3D%2B%24%2C%20foo'%22=bar2&am...
Encoded with [uri]::EscapeDataString()
First, we'll decode the URL and Query String encoded with [uri]::EscapeDataString() in the above example:
https://example.vertigion.com/foos?
foo2=complex%3B%2F%3F%3A%40%26%3D%2B%24%2C%20bar'%22&
complex%3B%2F%3F%3A%40%26%3D%2B%24%2C%20foo'%22=bar2&am...
List all the node versions installed
nvm ls
v4.5.0
v6.7.0
Run command using any node installed version
nvm run 4.5.0 --version or nvm exec 4.5.0 node --version
Running node v4.5.0 (npm v2.15.9)
v4.5.0
nvm run 6.7.0 --version or nvm exec 6.7.0 node --version
Running node v6.7.0...