Tutorial by Examples: bi

List comprehensions can introduce local bindings for variables to hold some interim values: [(x,y) | x <- [1..4], let y=x*x+1, even y] -- [(1,2),(3,10)] Same effect can be achieved with a trick, [(x,y) | x <- [1..4], y <- [x*x+1], even y] -- [(1,2),(3,10)] The let in list compr...
This example shows how to perform basic mathematical operations using BigDecimals. 1.Addition BigDecimal a = new BigDecimal("5"); BigDecimal b = new BigDecimal("7"); //Equivalent to result = a + b BigDecimal result = a.add(b); System.out.println(result); Result : 12 ...
Ruby keeps track of local variables and self variable via an object called binding. We can get binding of a scope with calling Kernel#binding and evaluate string inside a binding via Binding#eval. b = proc do local_variable = :local binding end.call b.eval "local_variable" #=&gt...
Many bugs in knockout data binds are caused by undefined properties in a viewmodel. Knockout has two handy methods to retrieve the binding context of an HTML element: // Returns the binding context to which an HTMLElement is bound ko.contextFor(element); // Returns the viewmodel to which ...
CREATE TABLE all_binary_types( c_boolean boolean, c_binary binary ); Sample data: insert into all_binary_types values (0,1234); insert into all_binary_types values (1,4321); Note: For boolean, internally it stored as true or false. For binary, it will store base64 encoded value....
void methods can be stubbed using the doThrow(), doAnswer(), doNothing(), doCallRealMethod() family of methods. Runnable mock = mock(Runnable.class); doThrow(new UnsupportedOperationException()).when(mock).run(); mock.run(); // throws the UnsupportedOperationException Note thatvoid methods...
Name binding is a concept that allows to say to a JAX-RS runtime that a specific filter or interceptor will be executed only for a specific resource method. When a filter or an interceptor is limited only to a specific resource method we say that it is name-bound. Filters and interceptors that do no...
Prefix bitwise operators Bitwise operators are like logical operators but executed per bit rather than per boolean value. // bitwise NOT ~: sets all unset bits and unsets all set bits printf("%'06b", ~0b110110); // 001001 Bitmask-bitmask operators Bitwise AND &: a bit is set onl...
The population count of a bitstring is often needed in cryptography and other applications and the problem has been widely studied. The naive way requires one iteration per bit: unsigned value = 1234; unsigned bits = 0; // accumulates the total number of bits set in `n` for (bits = 0; value; ...
Texttastic Code Editor - Code editor with syntax highlighting for iOS devices. Working Copy - Clone Github repositories to your iPad and code on the go. CodeHub - Browse and maintain your GitHub repositories. Management tool. iOctocat - Social utility for following Github projects. iMockups fo...
"MySQL Cluster" disambiguation... NDB Cluster -- A specialized, mostly in-memory, engine. Not widely used. Galera Cluster aka Percona XtraDB Cluster aka PXC aka MariaDB with Galera. -- A very good High Availability solution for MySQL; it goes beyond Replication. See individual page...
// Usage: var p0={x:50,y:100}; var p1={x:100,y:0}; var p2={x:200,y:200}; var p3={x:300,y:100}; cubicCurveArrowHeads(p0, p1, p2, p3, 15, true, true); quadraticCurveArrowHeads(p0, p1, p2, 15, true, true); // or use defaults true for both ends with arrow heads cubicCurveArrowHeads(p0, p...
With the bind command it is possible to define custom key bindings. The next example bind an Alt + w to >/dev/null 2>&1: bind '"\ew"':"\" >/dev/null 2>&1\"" If you want to execute the line immediately add \C-m (Enter) to it: bind '"\ew&quo...
<Image x:Name="MyImage" /> // Show image from web MyImage.Source = new BitmapImage(new Uri("http://your-image-url.com")) // Show image from solution MyImage.Source = new Uri("ms-appx:///your-image-in-solution", UriKind.Absolute) // Show image from file ...
<TextBlock x:Name="MyControl" Text="Hello, world!" /> var rtb = new RenderTargetBitmap(); await rtb.RenderAsync(MyControl); // Render control to RenderTargetBitmap // Get pixels from RTB IBuffer pixelBuffer = await rtb.GetPixelsAsync(); byte[] pixels = ...
IRandomAccessStreamReference bitmap = GetBitmap(); IRandomAccessStreamWithContentType stream = await bitmap.OpenReadAsync(); BitmapDecoder decoder = await BitmapDecoder.CreateAsync(stream); var pixels = await decoder.GetPixelDataAsync(); var outStream = new InMemoryRandomAccessStream(); // Cr...
public static async Task<IRandomAccessStream> ConvertWriteableBitmapToRandomAccessStream(WriteableBitmap writeableBitmap) { var stream = new InMemoryRandomAccessStream(); BitmapEncoder encoder = await BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream); Stream pixe...
Here is a generic ViewHolder class that you can use with any DataBinding layout. Here an instance of particular ViewDataBinding class is created using the inflated View object and DataBindingUtil utility class. import android.databinding.DataBindingUtil; import android.support.v7.widget.RecyclerVi...
A bit field is a variable that holds various boolean states as individual bits. A bit on would represent true, and off would be false. In the past bit fields were routinely used as they saved memory and reduced processing load. Though the need to use bit field is no longer so important they do offer...
Hi everyone! This is a demo I love running for people that get started with BigQuery. So let's run some simple queries to get you started. Setup You will need a Google Cloud project: Go to http://bigquery.cloud.google.com/. If it tells you to create a project, follow the link to create a proje...

Page 15 of 29