Tutorial by Examples: l

You can delete all blank lines in a file with the following command: :g/^$/d This command is explained as follows: enter Command mode with : g is a global command that should occur on the entire file / start of the search pattern the search pattern of blank line is ^g /end of the search pat...
import WatchConnectivity var watchSession : WCSession? override func awake(withContext context: Any?) { super.awake(withContext: context) // Configure interface objects here. startWatchSession() } func startWatchSession(){ if(WCSession....
Boolean literals are the simplest of the literals in the Java programming language. The two possible boolean values are represented by the literals true and false. These are case-sensitive. For example: boolean flag = true; // using the 'true' literal flag = false; // using the 'fa...
func isValidEmail(email: String) -> Bool { let emailRegEx = "[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}" let emailTest = NSPredicate(format:"SELF MATCHES %@", emailRegEx) return emailTest.evaluate(with: email) } or you could use String extensio...
//create a list to hold all the values List<string> excelData = new List<string>(); //read the Excel file as byte array byte[] bin = File.ReadAllBytes("C:\\ExcelDemo.xlsx"); //or if you use asp.net, get the relative path byte[] bin = File.ReadAllBytes(Server.MapPath(&q...
Let's say that you have the following class: public class PersonInfo { public int ID { get; set; } [Display(Name = "First Name")] [Required(ErrorMessage = "Please enter your first name!")] public string FirstName{ get; set; } [Display(Name = "L...
//set the formatting options ExcelTextFormat format = new ExcelTextFormat(); format.Delimiter = ';'; format.Culture = new CultureInfo(Thread.CurrentThread.CurrentCulture.ToString()); format.Culture.DateTimeFormat.ShortDatePattern = "dd-mm-yyyy"; format.Encoding = new UTF8Encoding(); ...
In the file myConfig.groovy is the following content. message = 'Hello World!' aNumber=42 aBoolean=false aList=["apples", "grapes", "oranges"] Then in your main script you create a ConfigSlurper for your myConfig.groovy file which is really just another groovy sc...
public String getCitiesByCountry(String countryName) throws MalformedURLException, IOException { //Code to make a webservice HTTP request String responseString = ""; String outputString = ""; String wsURL = "http://www.webservicex.com/globalweather.asm...
Go to https://www.mozilla.org/firefox/new/. 1.Click on Download button. 2.An executable file will be downloaded. 3.Double click on the .exe file and click run. 4.Finish the setup. 5.Select the option of "Maintain shortcut on the desktop".
For iterating more than two lists simultaneously within list comprehension, one may use zip() as: >>> list_1 = [1, 2, 3 , 4] >>> list_2 = ['a', 'b', 'c', 'd'] >>> list_3 = ['6', '7', '8', '9'] # Two lists >>> [(i, j) for i, j in zip(list_1, list_2)] [(1, '...
Go to https://ftp.mozilla.org/pub/firefox/releases/ Find the list of older versions in the above link. Select the operating system you want to install in. Select the Language you want to install in. An executable will be downloaded. Run the .exe file to install the firef...
The following tests range A2 to A7 for duplicate values. Remark: This example illustrates a possible solution as a first approach to a solution. It's faster to use an array than a range and one could use collections or dictionaries or xml methods to check for duplicates. Sub find_duplicates() ...
To test an add-on you are developing, you will likely desire to install it in Firefox temporarily. You can do so by loading it as a Temporary Add-on. To do so: Go to about:debugging Click on "Load Temporary Add-on" In the file picker, navigate to the directory containing the add-on f...
Create vectors to hold the x- and y-locations of vertices, feed these into patch. Single Polygon X=rand(1,4); Y=rand(1,4); h=patch(X,Y,'red'); Multiple Polygons Each polygon's vertices occupy one column of each of X, Y. X=rand(4,3); Y=rand(4,3); for i=2:3 X(:,i)=X(:,i)+(i-1); % create ...
Where command line arguments are supported they can be read in via the get_command_argument intrinsic (introduced in the Fortran 2003 standard). The command_argument_count intrinsic provides a way to know the number of arguments provided at the command line. All command-line arguments are read in ...
This: class Foo extends Dynamic { // Expressions are only rewritten to use Dynamic if they are not already valid // Therefore foo.realField will not use select/updateDynamic var realField: Int = 5 // Called for expressions of the type foo.field def selectDynamic(fieldName: String) = ...
This: class Villain(val minions: Map[String, Minion]) extends Dynamic { def applyDynamic(name: String)(jobs: Task*) = jobs.foreach(minions(name).do) def applyDynamicNamed(name: String)(jobs: (String, Task)*) = jobs.foreach { // If a parameter does not have a name, and is simply given, th...
Slightly counterintuitively (but also the only sane way to make it work), this: val dyn: Dynamic = ??? dyn.x(y) = z is equivalent to: dyn.selectDynamic("x").update(y, z) while dyn.x(y) is still dyn.applyDynamic("x")(y) It is important to be aware of this, or else...
Result<T, E> is an enum type which has two variants: Ok(T) indicating successful execution with meaningful result of type T, and Err(E) indicating occurrence of an unexpected error during execution, described by a value of type E. enum DateError { InvalidDay, InvalidMonth, } str...

Page 681 of 861