java.lang.ref package provides reference-object classes, which support a limited degree of interaction with the garbage collector.
Java has four main different reference types. They are:
Strong Reference
Weak Reference
Soft Reference
Phantom Reference
1. Strong Reference
This is the usual...
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...
A function is a block of code that will be called several times during the execution. Instead of writing the same piece of code again and again, one can write this code inside a function and call that function whenever it is needed.
A function :
Must be declared in a class or a module
Returns a...
Configuring your environment
RabbitMQ looks for an set of environment variables in /etc/rabbitmq/rabbitmq-env.conf. If it does not exist, it assumes default values. All values in rabbitmq-env.conf get exported to the environment the RabbitMQ server runs in with a RABBITMQ_ prefix; this prefix is no...
From the documentation :
In C#, arguments can be passed to parameters either by value or by
reference. Passing by reference enables function members, methods,
properties, indexers, operators, and constructors to change the value
of the parameters and have that change persist in the calling
e...
Go standard library provides package flag that helps with parsing flags passed to program.
Note that flag package doesn't provide usual GNU-style flags. That means that multi-letter flags must be started with single hyphen like this:
-exampleflag , not this: --exampleflag. GNU-style flags can be d...
Using the document-ready event can have small performance drawbacks, with delayed execution of up to ~300ms. Sometimes the same behavior can be achieved by execution of code just before the closing </body> tag:
<body>
<span id="greeting"></span> world!
<sc...
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...
Copy foo.txt from /path/to/source/ to /path/to/target/folder/
cp /path/to/source/foo.txt /path/to/target/folder/
Copy foo.txt from /path/to/source/ to /path/to/target/folder/ into a file called bar.txt
cp /path/to/source/foo.txt /path/to/target/folder/bar.txt
copy folder foo into folder bar
cp -r /path/to/foo /path/to/bar
if folder bar exists before issuing the command, then foo and its content will be copied into the folder bar.
However, if bar does not exist before issuing the command, then the folder bar will be created and the content of foo wil...
If you have loaded a file into GHCi (e.g. using :l filename.hs) and you have changed the file in an editor outside of GHCi you must reload the file with :r or :reload in order to make use of the changes, hence you don't need to type again the filename.
ghci> :r
OK, modules loaded: Main.
ghci...
The FASTA file format is used for representing one or more nucleotide or amino acid sequences as a continuous string of characters. Sequences are annotated with a comment line, which starts with the > character, that precedes each sequence. The comment line is typically formatted in a uniform w...
A string can be written to a file with an instance of the File class.
file = File.new('tmp.txt', 'w')
file.write("NaNaNaNa\n")
file.write('Batman!\n')
file.close
The File class also offers a shorthand for the new and close operations with the open method.
File.open('tmp.txt', 'w') ...
You can call a Clojure function from Java code by looking up the function and invoking it:
IFn times = Clojure.var("clojure.core", "*");
times.invoke(2, 2);
This looks up the * function from the clojure.core namespace and invokes it with the arguments 2 & 2.
Goto https://atom.io/ and install the atom editor.
Then install some Atom packages for easier Titanium coding:
NameTypeFeaturestitanium language javascriptLanguageJS Autocomplete (non alloy)Titanium Alloyadd-onAll-in-one packageJump to definitionOpen relatedTSS HighlightTi-Createadd-onCreate proje...
We are just creating an empty Alloy app using CLI and Atom.
Open a new terminal and add the following:
ti create --id com.test -d . -n APPNAME -p all -t app -u http://migaweb.de
cd APPNAME/
alloy new
This will create a basic app (name: APPNAME, bundle identifier: com.test, type: app, platform...