Option Base is used to declare the default lower bound of array elements. It is declared at module level and is valid only for the current module.
By default (and thus if no Option Base is specified), the Base is 0. Which means that the first element of any array declared in the module has an index...
set can also be invoked with just one argument. When called with just one argument, it returns the contents of that argument.
% set x 235
235
% set x
235
List<Integer> nums = Arrays.asList(1, 2, 3);
List<String> strings = nums.stream()
.map(Object::toString)
.collect(Collectors.toList());
That is:
Create a stream from the list
Map each element using Object::toString
Collect the String values into a List using Collectors...
Adding a footer is not natively possible. Luckily, we can make use of jQuery and CSS to add a footer to the slides of an ioslides presentation rendered with knitr.
First of all we have to include the jQuery plugin. This is done by the line
<script src="https://ajax.googleapis.com/ajax/libs...
Sometimes one has to work with pages that are not using jQuery while most developers are used to have jQuery handy.
In such situations one can use Chrome Developer Tools console (F12) to manually add jQuery on a loaded page by running following:
var j = document.createElement('script');
j.onload ...
This example assumes that your lookup column is named MultiLookupColumnName and that you want to set your multi-lookup field to lookup to the items with IDs 1 and 2.
Using jQuery AJAX
2010
var listName = "YourListName";
var lookupList = "LookupListName";
var idOfItemToUpdate...
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 ...
A Cordova application runs as a website on a WebView component within the native mobile platform. Debugging a cordova application can therefore be done by utilizing your favourite browsers development tools. The following steps are needed to hook the application, running on the device, to the Chrome...
The Replace function in SQL is used to update the content of a string. The function call is REPLACE( ) for MySQL, Oracle, and SQL Server. The syntax of the Replace function is:
REPLACE (str, find, repl)
The following example replaces occurrences of South with Southern in Employees table:
FirstN...
Iterate over JSONObject properties
JSONObject obj = new JSONObject("{\"isMarried\":\"true\", \"name\":\"Nikita\", \"age\":\"30\"}");
Iterator<String> keys = obj.keys();//all keys: isMarried, name & age
while (keys.has...
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"...
When to use abstract classes: To implement the same or different behaviour among multiple related objects
When to use interfaces: to implement a contract by multiple unrelated objects
Abstract classes create "is a" relations while interfaces provide "has a" capability.
This c...
sudo apt-add-repository ppa:brightbox/ruby-ng
Hit Enter to confirm
sudo apt-get update
Then you can install your ruby version of choice (the ppa supports ruby2.0 ruby2.1 ruby2.2 ruby2.3 and legacy versions ruby1.8 ruby1.9.1) Don't forget to include the respective -dev package for your version. Ot...
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...
Session Types are a way to tell the compiler about the protocol you want to use to communicate between threads - not protocol as in HTTP or FTP, but the pattern of information flow between threads. This is useful since the compiler will now stop you from accidentally breaking your protocol and causi...
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 ...
The dimension attribute on an object specifies that that object is an array. There are, in Fortran 2008, five array natures:1
explicit shape
assumed shape
assumed size
deferred shape
implied shape
Take the three rank-1 arrays2
integer a, b, c
dimension(5) a ! Explicit shape (default ...
SUB function allows to substitute text inside awk
sub(regexp, replacement, target)
where regexp could be a full regular expression
$ cat file
AAAAA
BBBB
CCCC
DDDD
EEEE
FFFF
GGGG
$ awk '{sub("AAA","XXX", $0); print}' file
XXXAA
BBBB
CCCC
DDDD
EEEE
FFFF
GGGG
...