# 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...
// Create the request.
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]];
// Specify that it will be a POST request
request.HTTPMethod = @"POST";
// This is how we set header fields
[request setValue:@&...
// Create the request.
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://google.com"]];
// Specify that it will be a POST request
request.HTTPMethod = @"POST";
// Setting a timeout
request.timeoutInterval = 20.0;
//...
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...
The command \sout of the package ulem strikes through a text:
\sout{This text is striked through}
The package ulem redefines the command \emph. When you do not want to have this behavior you can use the package ulem with the option normalem:
\usepackage[normalem]{ulem}
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.
//
...
Depth-first search is an algorithm for traversing or searching tree or graph data structures. One starts at the root and explores as far as possible along each branch before backtracking. A version of depth-first search was investigated in the 19th century French mathematician Charles Pierre Trémaux...
If the tables use InnoDB, MySQL automatically uses row level locking so that multiple transactions can use same table simultaneously for read and write, without making each other wait.
If two transactions trying to modify the same row and both uses row level locking, one of the transactions waits f...