Dim flags = BindingFlags.Static Or BindingFlags.Public Or BindingFlags.Instance
Dim members = GetType(String).GetMembers(flags)
For Each member In members
Console.WriteLine($"{member.Name}, ({member.MemberType})")
Next
Static method:
Dim parseMethod = GetType(Integer).GetMethod("Parse",{GetType(String)})
Dim result = DirectCast(parseMethod.Invoke(Nothing,{"123"}), Integer)
Instance method:
Dim instance = "hello".ToUpper
Dim method = Gettype(String).GetMethod("ToUpper&quo...
ArrayList is one of the inbuilt data structures in Java. It is a dynamic array (where the size of the data structure not needed to be declared first) for storing elements (Objects).
It extends AbstractList class and implements List interface. An ArrayList can contain duplicate elements where it mai...
The thing is; you can't connect Ionic to any database (MySQL, Postgres, MSSQL, ...) directly. The keyword here is directly.
No, there's no workaround, no magic involved, it's just not the way this is supposed to work. Ionic works on top of Angular and Angular is a frontend framework.
However, the ...
Enable and configure the experimental Gradle plugin to improve AndroidStudio's NDK support. Check that you fulfill the following requirements:
Gradle 2.10 (for this example)
Android NDK r10 or later
Android SDK with build tools v19.0.0 or later
Configure MyApp/build.gradle file
Edit the dep...
You can use method chaining while working with JSONObject and JSONArray.
JSONObject example
JSONObject obj = new JSONObject();//Initialize an empty JSON object
//Before: {}
obj.put("name","Nikita").put("age","30").put("isMarried","true"...
cycle is an infinite iterator.
>>> import itertools as it
>>> it.cycle('ABCD')
A B C D A B C D A B C D ...
Therefore, take care to give boundaries when using this to avoid an infinite loop. Example:
>>> # Iterate over each element in cycle for a fixed range
>&g...
Disclaimer: In no way does this example advocate the use of singletons. Singletons are to be used with a lot of care.
In PHP there is quite a standard way of implementing a singleton:
public class Singleton {
private $instance;
private function __construct() { };
public function...
Bridge pattern decouples abstraction from implementation so that both can vary independently. It has been achieved with composition rather than inheritance.
Bridge UML diagram from wikipedia:
You have four components in this pattern.
Abstraction: It defines an interface
RefinedAbstraction: It ...
Problem
There is a series of repeating elements in page that you need to know which one an event occurred on to do something with that specific instance.
Solution
Give all common elements a common class
Apply event listener to a class. this inside event handler is the matching selector elemen...
Be aware that Microsoft Excel 2013 (and higher) uses Single Document
Interface (SDI) and that Excel 2010 (And below) uses Multiple Document
Interfaces (MDI).
This implies that for Excel 2013 (SDI), each workbook in a single instance of Excel contains its own ribbon UI:
Conversely for Excel...
The DATE data type does not handle time zones or changes in daylight savings time.
Either:
use the TIMESTAMP WITH TIME ZONE data type; or
handle the changes in your application logic.
A DATE can be stored as Coordinated Universal Time (UTC) and converted to the current session time zone like...
Command line arguments parsing is Go is very similar to other languages. In you code you just access slice of arguments where first argument will be the name of program itself.
Quick example:
package main
import (
"fmt"
"os"
)
func main() {
progName := o...
It is common for an AsyncTask to require a reference to the Activity that called it.
If the AsyncTask is an inner class of the Activity, then you can reference it and any member variables/methods directly.
If, however, the AsyncTask is not an inner class of the Activity, you will need to pass an A...
If your team is following a rebase-based workflow, it may be a advantageous to setup git so that each newly created branch will perform a rebase operation, instead of a merge operation, during a git pull.
To setup every new branch to automatically rebase, add the following to your .gitconfig or .gi...
You can call an instance method using the . special form:
(.trim " hello ")
;;=> "hello"
You can call instance methods with arguments like this:
(.substring "hello" 0 2)
;;=> "he"
You can call static methods like this:
(System/currentTimeMillis)
;;=> 1469493415265
Or pass in arguments, like this:
(System/setProperty "foo" "42")
;;=> nil
(System/getProperty "foo")
;;=> "42"