For some use cases, you can use the using syntax to help define a custom scope. For example, you can define the following class to execute code in a specific culture.
public class CultureContext : IDisposable
{
private readonly CultureInfo originalCulture;
public CultureContext(string ...
Copy the package installer unit file to /etc where changes will not be overwritten on an upgrade:
cp /lib/systemd/system/docker.service /etc/systemd/system/docker.service
Update /etc/systemd/system/docker.service with your options on ExecStart:
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0...
Return the index of the first occurrence of a substring (zero if not found)
Syntax: INSTR ( string, substring )
SELECT INSTR('FooBarBar', 'Bar') -- return 4
SELECT INSTR('FooBarBar', 'Xar') -- return 0
Sometimes you have to deal with structures defined in terms of C data types from Perl. One such application is the creation of raw network packets, in case you want to do something fancier than what the regular socket API has to offer. This is just what pack() (and unpack() of course) is there for.
...
Raycasting means throwing a ray from the mouse position on the screen to the scene, this is how threejs determines what object you want to click on if you have implemented it. Threejs gets that information using an octree, but still in production you may not want to compute the result at each frame ...
Xamarin.Forms provide great mechanism for styling your cross-platforms application with global styles.
In mobile world your application must be pretty and stand out from the other applications.
One of this characters is Custom Fonts used in application.
With power support of XAML Styling in Xamar...
Traditional way
interface MathOperation{
boolean unaryOperation(int num);
}
public class LambdaTry {
public static void main(String[] args) {
MathOperation isEven = new MathOperation() {
@Override
public boolean unaryOperation(int num) {
...
A class can have non-static member functions, which operate on individual instances of the class.
class CL {
public:
void member_function() {}
};
These functions are called on an instance of the class, like so:
CL instance;
instance.member_function();
They can be defined either ins...
A simple EntitySystem that processes each entity of a given family in the order specified by a comparator and calls processEntity() for each entity every time the EntitySystem is updated. This is really just a convenience class as rendering systems tend to iterate over a list of entities in a sort...
Our first element directive will not do much: it will just calculate 2+2 and will be called in html like this:
<my-calculator></my-calculator>
Notice the name of the directive is myCalculator (in CamelCase), but in html it's used as my-calculator (in lisp-case).
Since we want our di...
string is an alias to the .NET datatype System.String, which allows text (sequences of characters) to be stored.
Notation:
string a = "Hello";
var b = "world";
var f = new string(new []{ 'h', 'i', '!' }); // hi!
Each character in the string is encoded in UTF-16, which mean...
Android developers(mainly beginners) have been confused regarding Internal & External storage terminology. There are lot of questions on Stackoverflow regarding the same. This is mainly because of the fact that terminology according to Google/official Android documentation is quite different to...
trigger MyTrigger on SomeObject__c (after insert, after update) {
if (Trigger.isAfter && Trigger.isInsert) {
System.debug('The following records were inserted: ');
for (SomeObject__c o : Trigger.new) {
System.debug(o.Name);
}
} else if (Trigg...
Code in documentation comments will automatically be executed by cargo test. These are known as "documentation tests", and help to ensure that your examples work and will not mislead users of your crate.
You can import relative from the crate root (as if there were a hidden extern crate ...