Tutorial by Examples: er

The prototype pattern can be implemented using the ICloneable interface in .NET. class Spoon { } class DessertSpoon : Spoon, ICloneable { ... public object Clone() { return this.MemberwiseClone(); } } class SoupSpoon : Spoon, ICloneable { ... public object Clone() { ret...
The Search API provides access to recent tweets*. This is as opposed to the Stream API, which provides search results in real-time. <example> *Note that "the Search API is focused on relevance and not completeness" - Twitter Search API
The Stream API provides access to tweets in real-time. Streams can be filtered based on keywords, language, location, and more. Here's a simple example to track mentions of the word "tweepy": #set up a new class using tweepy.StreamListener class SimpleListener(tweepy.StreamListener): ...
There are 2 ways to set formBuilder controls parameters. On initialize: exampleForm : FormGroup; constructor(fb: FormBuilder){ this.exampleForm = fb.group({ name : new FormControl({value: 'default name'}, Validators.compose([Validators.required, Validators.maxLength(15)])) }); ...
Inside of your {CATALINA_HOME}/conf/ folder exists a server.xml and context.xml file. Each one of these contains similar code, but references different parts of Tomcat to complete the same task. server.xml is server-wide configuration. This is where you can set up HTTPS, HTTP2, JNDI Resources, etc....
public void test() { Connection conn = null; Statement stmt = null; try { Context ctx = (Context) new InitialContext().lookup("java:comp/env"); conn = ((DataSource) ctx.lookup("jdbc/SomeDataSource")).getConnection(); stmt = conn.createS...
Let's consider the below snippet, Get-ChildItem -Path C:\MyFolder | Select-Object Name, CreationTime, Length It simply output the folder content with the selected properties. Something like, What if I want to display the file size in KB ? This is where calcualted properties comes handy. Get-...
Unlike functions, there's no need to forward declare a procedure. It can be placed anywhere in your code, before or after you call it using RUN. RUN proc. //Procedure starts here PROCEDURE proc: //Procedure ends here END PROCEDURE. The procedure name is folowed by a colon sign telling u...
A procedure can have parameters of different kinds: input, output, input-output (bidirectional) and also some special types like temp-tables and datasets). In the run statement it's optional to declare INPUT (it's considered default) - all other directions must be specifically declared. A procedur...
Recursion is easy - RUN the procedure itself from inside the procedure. However if you recurse too far the stack will run out of space. A procedure calculation the factorial. PROCEDURE factorial: DEFINE INPUT PARAMETER piNum AS INTEGER NO-UNDO. DEFINE OUTPUT PARAMETER piFac AS INTEG...
Incorrect Code Sub DoSomething() GoSub DoThis DoThis: Debug.Print "Hi!" Return End Sub Why doesn't this work? Execution enters the DoSomething procedure, jumps to the DoThis label, prints "Hi!" to the debug output, returns to the instruction immediately afte...
Incorrect code Sub DoSomething() Dim row As Integer For row = 1 To 100000 'do stuff Next End Sub Why doesn't this work? The Integer data type is a 16-bit signed integer with a maximum value of 32,767; assigning it to anything larger than that will overflow the type and ...
Incorrect code Sub DoSomething() Dim foo(1 To 10) Dim i As Long For i = 1 To 100 foo(i) = i Next End Sub Why doesn't this work? foo is an array that contains 10 items. When the i loop counter reaches a value of 11, foo(i) is out of range. This error occurs whenever...
Incorrect code Public Sub DoSomething() DoSomethingElse "42?" End Sub Private Sub DoSomethingElse(foo As Date) ' Debug.Print MonthName(Month(foo)) End Sub Why doesn't this work? VBA is trying really hard to convert the "42?" argument into a Date value. When it ...
Incorrect code Sub DoSomething() Dim foo As Collection With foo .Add "ABC" .Add "XYZ" End With End Sub Why doesn't this work? Object variables hold a reference, and references need to be set using the Set keyword. This error occurs whenever ...
Probably the most common way to invoke a Lambda is to use API Gateway, which maps a REST call to the lambda code. You can add multiple triggers to your Lambda during at any time, including when creating a new lambda. If you are familiar with API Gateway, you can associate any method with a deployed...
The known sub-classes for Entity Events are: Sub-ClassesSub-ClassesSub-ClassesCreatureSpawnEventCreeperPowerEventEntityChangeBlockEventEntityCombustEventEntityCreatePortalEventEntityDamageEventEntityDeathEventEntityExplodeEventEntityInteractEventEntityPortalEnterEventEntityRegainHealthEventEntitySh...
UITabBarController building in Swift 3 Change image color and title according to selection with changing selected tab color. import UIKit class TabbarController: UITabBarController { override func viewDidLoad() { super.viewDidLoad() self.navigationController?.isNavigat...
public static class MyHelpers { public static MvcHtmlString MyCustomDiv(this HtmlHelper htmlHelper, string text, object htmlAttributes = null) { var mainTag = new TagBuilder("div"); mainTag.MergeAttributtes(htmlAttributes); mainTag.AddCssClas...

Page 352 of 417