Tutorial by Examples: ee

function randomAngle():Number { return (Math.random() * 360); } Example outputs: 31.554428357630968 230.4078639484942 312.7964010089636
nuget sources add -name feedname -source http://sourcefeedurl
TRUNCATE TABLE Employee; Using truncate table is often better then using DELETE TABLE as it ignores all the indexes and triggers and just removes everything. Delete table is a row based operation this means that each row is deleted. Truncate table is a data page operation the entire data page is...
Define your class that will represent your custom error. public class ErrorDto { public int Code { get; set; } public string Message { get; set; } // other fields public override string ToString() { return JsonConvert.SerializeObject(this); } } Then put nex...
app/assets/javascripts/channels/notifications.coffee App.notifications = App.cable.subscriptions.create "NotificationsChannel", connected: -> # Called when the subscription is ready for use on the server $(document).on "change", "input", (e)=> ...
Java-like enumerations can be created by extending Enumeration. object WeekDays extends Enumeration { val Mon, Tue, Wed, Thu, Fri, Sat, Sun = Value } def isWeekend(day: WeekDays.Value): Boolean = day match { case WeekDays.Sat | WeekDays.Sun => true case _ => false } isWeekend...
With UIAlertController, action sheets like the deprecated UIActionSheet are created with the same API as you use for AlertViews. Simple Action Sheet with two buttons Swift let alertController = UIAlertController(title: "Demo", message: "A demo with two buttons", preferredStyle...
The following is an excerpt from Gradle - What is a non-zero exit value and how do I fix it?, see it for the full discussion. Let's say you are developing an application and you get some Gradle error that appears that generally will look like so. :module:someTask FAILED FAILURE: Build failed with...
Use the speakUtterance: method of AVSpeechSynthesizer to convert text to speech. You need to pass an AVSpeechUtterance object to this method, which contains the text that you want to be spoken. Objective C AVSpeechSynthesizer *speaker = [[AVSpeechSynthesizer alloc] init]; AVSpeechUtterance *speec...
NSSet *set = [NSSet set]; NSArray *array = [NSArray array]; NSArray *fromSet = [set allObjects]; NSSet *fromArray = [NSSet setWithArray:array];
hash( (1, 2) ) # ok hash( ([], {"hello"}) # not ok, since lists and sets are not hashabe Thus a tuple can be put inside a set or as a key in a dict only if each of its elements can. { (1, 2) } # ok { ([], {"hello"}) ) # not ok
As Handlers are used to send Messages and Runnables to a Thread's message queue it's easy to implement event based communication between multiple Threads. Every Thread that has a Looper is able to receive and process messages. A HandlerThread is a Thread that implements such a Looper, for example th...
iex(1)> i :ok Term :ok Data type Atom Reference modules Atom iex(2)> x = "mystring" "mystring" iex(3)> i x Term "mystring" Data type BitString Byte size 8 Description This is a string: a UTF-8 encoded binary. It's printed surround...
g$ The above matches one letter (the letter g) at the end of a string in most regex engines (not in Oniguruma, where the $ anchor matches the end of a line by default, and the m (MULTILINE) modifier is used to make a . match any characters including line break characters, as a DOTALL modifier in ...
Create Subtree Add a new remote called plugin pointing to the plugin's repository: git remote add plugin https://path.to/remotes/plugin.git Then Create a subtree specifying the new folder prefix plugins/demo. plugin is the remote name, and master refers to the master branch on the subtree's rep...
When filtering an email address filter_var() will return the filtered data, in this case the email address, or false if a valid email address cannot be found: var_dump(filter_var('[email protected]', FILTER_VALIDATE_EMAIL)); var_dump(filter_var('notValidEmail', FILTER_VALIDATE_EMAIL)); Results: ...
This code takes in various brace styles and converts them to One True Brace Style: const auto input = "if (KnR)\n\tfoo();\nif (spaces) {\n foo();\n}\nif (allman)\n{\n\tfoo();\n}\nif (horstmann)\n{\tfoo();\n}\nif (pico)\n{\tfoo(); }\nif (whitesmiths)\n\t{\n\tfoo();\n\t}\n"s; cout &lt...
TreeWalker is a generator-like interface that makes recursively filtering nodes in a DOM tree easy and efficient. The following code concatenates the value of all Text nodes in the page, and prints the result. let parentNode = document.body; let treeWalker = document.createTreeWalker(parentNode, ...
extern crate serde; extern crate serde_json; macro_rules! enum_str { ($name:ident { $($variant:ident($str:expr), )* }) => { #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum $name { $($variant,)* } impl ::serde::Serialize for $name {...
First of all, we need to add our first Fragment at the beginning, we should do it in the onCreate() method of our Activity: if (null == savedInstanceState) { getSupportFragmentManager().beginTransaction() .addToBackStack("fragmentA") .replace(R.id.container, FragmentA.n...

Page 7 of 54