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...
Introduction
Maps stores key/value pairs, where each key has an associated value. Given a particular key, the map can look up the associated value very quickly.
Maps, also known as associate array, is an object that stores the data in form of keys and values. In Java, maps are represented using Ma...
You can disable compiler warnings using #pragma warning disable and restore them using #pragma warning restore:
#pragma warning disable CS0168
// Will not generate the "unused variable" compiler warning since it was disabled
var x = 5;
#pragma warning restore CS0168
// Will gene...
my_array = array('i', [1,2,3,4,5])
my_array.append(6)
# array('i', [1, 2, 3, 4, 5, 6])
Note that the value 6 was appended to the existing array values.
Sometimes, if an action should be bind to a collection view's cell selection, you have to implement the UICollectionViewDelegate protocol.
Let's say the collection view is inside a UIViewController MyViewController.
Objective-C
In your MyViewController.h declares that it implements the UICollecti...
An interface is declared like a class, but without access modifiers (public, private, ...). Also, no definitions are allowed, so variables and constants can't be used.
Interfaces should always have an Unique Identifier, which can be generated by pressing Ctrl + Shift + G.
IRepository = interface
...
When using the DllImport attribute you have to know the correct dll and method name at compile time. If you want to be more flexible and decide at runtime which dll and methods to load, you can use the Windows API methods LoadLibrary(), GetProcAddress() and FreeLibrary(). This can be helpful if the ...
When I first started managing the keyboard I would use separate Notifications in each ViewController.
Notification Method (Using NSNotification):
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
NSNotificationCenter.defaultCenter().a...
A simple EntitySystem that processes a Family of entities not once per frame, but after a given interval. Entity processing logic should be placed in processEntity(Entity). For more info, please see IntervalIteratingSystem
In the below code example, the best usage for this is the physics world ...
This is a relatively common mistake: You created an rect element, in a bar chart for instance, and you want to add a text label (let's say, the value of that bar). So, using the same variable that you used to append the rect and define its x and y position, you append your text element. Very logic, ...
To create seeders, you may use the make:seeder Artisan command. All seeders generated will be placed in the database/seeds directory.
$ php artisan make:seeder MoviesTableSeeder
Generated seeders will contain one method: run. You may insert data into your database in this method.
<?php
us...
To split strings, Guava introduces the Splitter class.
Why not use Java's splitting capabilities?
As a rule, Guava does not duplicate functionality that is readily available in Java. Why then do we need an additional Splitter class? Do the split methods in Java's String class not provide us with a...
You can group all your custom functions/filters/tests/... inside a custom Twig_Extension class:
ProjectTwigExtension
class ProjectTwigExtension extends Twig_Extension {
public function getFunctions() {
return array(
new Twig_SimpleFunction('twig_function_name', array($...
This is an example on how to call a web service from salesforce. The code below is calling a REST based service hosted on data.gov to find farmers markets close to the zipcode.
Please remember in order to invoke a HTTP callout from your org, you need to tweak the remote settings for the org.
strin...
Selecting all accounts that have open opportunity records under them
SELECT Id, Name FROM Account WHERE AccountId IN
(SELECT Id FROM Opportunity WHERE IsClosed = false)
Resolving scoped services during application startup can be difficult, because there is no request and hence no scoped service.
Resolving a scoped service during application startup via app.ApplicationServices.GetService<AppDbContext>() can cause issues, because it will be created in the sc...
Jersey is one of the many frameworks available to create Rest Services, This example will show you how to create Rest Services using Jersey and Spring Boot
1.Project Setup
You can create a new project using STS or by using the Spring Initializr page. While creating a project, include the followi...