Background: The Household entity includes a set of options, each of which is an entity that is managed in an admin backend. Each option has a boolean enabled flag. If a previously enabled option is set to disabled it will need to be persisted in later Household edits, but cannot be edited away. T...
In a simple case statement, one value or variable is checked against multiple possible answers. The code below is an example of a simple case statement:
SELECT CASE DATEPART(WEEKDAY, GETDATE())
WHEN 1 THEN 'Sunday'
WHEN 2 THEN 'Monday'
WHEN 3 THEN 'Tuesday'
WHEN 4 THEN 'Wednes...
It's possible to make a simple lazily-evaluated list using mutable types and closures. A lazily-evaluated list is a list whose elements are not evaluated when it's constructed, but rather when it is accessed. Benefits of lazily evaluated lists include the possibility of being infinite.
import Base:...
# encode/decode UTF-8 for files and standard input/output
use open qw( :encoding(UTF-8) :std );
This pragma changes the default mode of reading and writing text ( files, standard input, standard output, and standard error ) to UTF-8, which is typically what you want when writing new application...
boost::replace_all():
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
using namespace std;
int main()
{
// String to replace characters in
string str = "Darn you, Darn you to the 5th power!!!";
// Replace "Da...
to_upper():
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
using namespace std;
int main()
{
// String to convert characters to uppercase
string str = "ThIS iS SUpPoSEd tO Be UpPeR CAsE.";
// Convert characters i...
The typical Visitor example in Java would be:
interface ShapeVisitor {
void visit(Circle c);
void visit(Rectangle r);
}
interface Shape {
void accept(ShapeVisitor sv);
}
class Circle implements Shape {
private Point center;
private double radius;
public Circl...
Objective-C
NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:@"Hello. That is a test attributed string."];
[str addAttribute:NSBackgroundColorAttributeName value:[UIColor yellowColor] range:NSMakeRange(3,5)];
[str addAttribute:NSForegroundColorAttrib...
So you want to add material design to your business or career portfolio.huh? You Just can not resist using a Modal? which pops upon a click on those crisp cards you intend to design, for each of your projects/products!
Let us say, for each project, you have done, or for each product you have design...
Note
I assume you know
Webcomponent Specifications
Polymer from Google
What if, we could just have one custom element, say
<tool-bar></tool-bar>
and it magically did everything that messy Modal markup could?
Tempting eh!
How do you specify which Modal belongs to which project...
So far, we defined how easy it is to write a custom element that hides the messy html behind it and gives the user, an easy to write and brief markup.
Time to code it!
Our custom element, to display the bar below the hero image should
Accept a Link to be shared
Accept a Link to the Repo to be ...
On whichever page you want to display your product / project portfolio, invoke the custom element like so:
<article id="project-neighbourhood">
<div class="row">
<div class="col-12 hero">
<img src="path-to-hero-image...
In order to emphasize text the command \emph can be used which usually displays the text in an italics font:
This is some text with \emph{emphasized words}.
Empty string
Empty string is not null but has zero length:
string emptyString = "";
// an empty string is not null...
assert(emptyString !is null);
// ... but it has zero lenght
assert(emptyString.length == 0);
Null string
string nullString = null;
a null string is null (De ...
IF you are using simple categories, with each physics body belonging to only one category, then this alternative form of didBeginContact may be more readable:
func didBeginContact(contact: SKPhysicsContact) {
let contactMask = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask
...
Here is a simple Sprite-Kit GameScene.swift. Create a new, empty SpriteKit project and replace the GameScene.swift with this. Then build and run.
Click on any of the objects on screen to give make them move. Check the logs and the comments to see which ones collide and which ones make contact.
//
...