Tutorial by Examples

All needed usage shown with this snippet: #!/usr/bin/env bash declare -A assoc_array=([key_string]=value \ [one]="something" \ [two]="another thing" ...
The Rabin–Karp algorithm or Karp–Rabin algorithm is a string searching algorithm that uses hashing to find any one of a set of pattern strings in a text.Its average and best case running time is O(n+m) in space O(p), but its worst-case time is O(nm) where n is the length of the text and m is the le...
The Longest Increasing Subsequence problem is to find subsequence from the give input sequence in which subsequence's elements are sorted in lowest to highest order. All subsequence are not contiguous or unique. Application of Longest Increasing Subsequence: Algorithms like Longest Increasing Subs...
public class LongestIncreasingSubsequence { private static int Lis(int[] input, int n) { int[] lis = new int[n]; int max = 0; for(int i = 0; i < n; i++) { lis[i] = 1; } for (int i = 1; i < n; i++) { ...
You can change the "$" delimiter to any other. The following example: from string import Template class MyOtherTemplate(Template): delimiter = "#" data = dict(id = 1, name = "Ricardo") t = MyOtherTemplate("My name is #name and I have the id: #id&quot...
Page.html <div data-bind="foreach: blogs"> <br /> <span data-bind="text: entryPostedDate"></span> <br /> <h3> <a data-bind="attr: { href: blogEntryLink }, text: title"></a> </h3> ...
Blog.html <div data-bind="visible: isLoading()"> Loading... </div> <div data-bind="visible: !isLoading(), foreach: blogs"> <br /> <span data-bind="text: entryPostedDate"></span> <br /> <h3> ...
QGraphics can be used to organize complicated scenes of visual objects into a framework that makes them easier to handle. There are three major types of objects used in this framework QGraphicsView, QGraphicsScene, and QGraphicsItems. QGraphicsItems are the basic visual items that exist in the scen...
Usually, services call remote Api to retrieve/send data. But unit tests shouldn't do network calls. Angular internally uses XHRBackend class to do http requests. User can override this to change behavior. Angular testing module provides MockBackend and MockConnection classes which can be used to tes...
In vbscript, an object doesn't necessarily need a designated type. Similar to C#'s var variable. Dim ExampleString1 As String Dim ExampleString2
'Base string Dim exStr : exStr = " <Head>data</Head> " 'Left Dim res: res = Left(exStr,6) 'res now equals " <Head" 'Right Dim res: res = Right(exStr,6) 'res now equals "Head> " 'Mid Dim res: res = Mid(exStr,8,4) 'res now equals "data&quot...
Given a text file test.txt: Ford Jeep Honda The following script is processing this text file: 'Read in File Data to an array, separate by newline vb equivalent (vbcrlf) Dim car, cars Dim filefullname : filefullname = "C:\testenv\test.txt" cars = Split(CreateObject("Scriptin...
'Note: I use this method to extract non-html data in extracted GET telnet results 'This example effectively grabs every other vehicle that have start and finish 'characters, which in this case is "/". 'Resulting in an array like this: 'extractedData(0) = "/Jeep" 'extractedD...
Dim exStr : exStr = " <Head>data</Head> " Dim res res = Ucase(Replace(Mid(exStr, instr(exStr, ">")+1,4), "ata", "ark")) 'res now equals DARK 'instr(exStr, ">") returns 7 'Mid(" <Head>data</Head> ", 7+1,...
Dim mdArray(2,3) mdArray(0, 0) = "test1" mdArray(0, 1) = "test2" mdArray(0, 2) = "test3" mdArray(0, 3) = "test4" mdArray(1, 0) = "test5" mdArray(1, 1) = "test6" mdArray(1, 2) = "test7" mdArray(1, 3) = "test8" md...
Dim mddArray() ReDim mddArray(0) Dim ti, testinc: testinc = "test": ti = 1 For i = 0 To 4 Dim tmpArray(): ReDim tmpArray(0) For j = 0 To 3 tmpArray(UBound(tmpArray)) = testinc & ti ti = ti + 1 ReDim Preserve tmpArray(UBound(tmpArray) + 1) Ne...
def createDissolvedGDB(workspace, gdbName): gdb_name = workspace + "/" + gdbName + ".gdb" if(arcpy.Exists(gdb_name): arcpy.Delete_management(gdb_name) arcpy.CreateFileGDB_management(workspace, gdbName, "") else: arcpy.CreateFi...
In the build.sbt file (or where the project is defined if it is in another location), add the following setting: scalacOptions += "-language:experimental.macros" For instance, a project might be defined like this: lazy val main = project.in(file(".")) // root project .se...
When the last command in an interactive bash instance is done, the evaluated PS1 variable is displayes. Before actually displaying PS1 bash looks whether the PROMPT_COMMAND is set. This value of this var must be a callable program or script. If this var is set this program/script is called BEFORE th...
PS2 is displayed when a command extends to more than one line and bash awaits more keystrokes. It is displayed too when a compound command like while...do..done and alike is entered. export PS2="would you please complete this command?\n" # now enter a command extending to at least two l...

Page 998 of 1336