Tutorial by Examples: comp

To compute a signature: final PrivateKey privateKey = keyPair.getPrivate(); final byte[] data = "FOO BAR".getBytes(); final Signature signer = Signature.getInstance("SHA1withRSA"); signer.initSign(privateKey); signer.update(data); final byte[] signature = signer.sign();...
Before the Julia 0.5, there is no way to use conditions inside the array comprehensions. But, it is no longer true. In Julia 0.5 we can use the conditions inside conditions like the following: julia> [x^2 for x in 0:9 if x > 5] 4-element Array{Int64,1}: 36 49 64 81 Source of the ...
Strings can be compared with the == operator in Julia, but this is sensitive to differences in case. For instance, "Hello" and "hello" are considered different strings. julia> "Hello" == "Hello" true julia> "Hello" == "hello" fa...
Sometimes, one wants strings like "resume" and "résumé" to compare equal. That is, graphemes that share a basic glyph, but possibly differ because of additions to those basic glyphs. Such comparison can be accomplished by stripping diacritical marks. equals_ignore_mark(s, t) =...
This small example shows how you can lose backward compatibility in your programs if you do not take care in advance about this. And ways to get more control of serialization process At first, we will write an example of the first version of the program: Version 1 [Serializable] class Data { ...
Of course, just like most things in browser JavaScript, you just can't count on the fact that everything will be the same everywhere. In this case, requestAnimationFrame might have a prefix on some platforms and are named differently, such as webkitRequestAnimationFrame. Fortunately, there's a reall...
In many situations, a composite index performs better than an index with a single column. To build an optimal composite index, populate it with columns in this order. = column(s) from the WHERE clause first. (eg, INDEX(a,b,...) for WHERE a=12 AND b='xyz' ...) IN column(s); the optimizer may be...
Dynamically switch beetween multiple components using <component> element and pass data to v-bind:is attribute: Javascript: new Vue({ el: '#app', data: { currentPage: 'home' }, components: { home: { template: "<p>Home</p>" }, about...
#ifndef MYCOMPAREFILEDIALOG_H #define MYCOMPAREFILEDIALOG_H #include <QtWidgets/QDialog> class MyCompareFileDialog : public QDialog { Q_OBJECT public: MyCompareFileDialog(QWidget *parent = 0); ~MyCompareFileDialog(); }; #endif // MYCOMPAREFILEDIALOG_H
#include "MyCompareFileDialog.h" #include <QLabel> MyCompareFileDialog::MyCompareFileDialog(QWidget *parent) : QDialog(parent) { setWindowTitle("Compare Files"); setWindowFlags(Qt::Dialog); setWindowModality(Qt::WindowModal); resize(300, 100); ...
The only way if your components does not have a parent-child relationship (or are related but too further such as a grand grand grand son) is to have some kind of a signal that one component subscribes to, and the other writes into. Those are the 2 basic operations of any event system: subscribe/li...
Given an m times n matrix A with n larger than m. The singular value decomposition [U,S,V] = svd(A); computes the matrices U,S,V. The matrix U consists of the left singular eigenvectors which are the eigenvectors of A*A.' while V consists of the right singular eigenvalues which are the eigenvec...
Visual Basic.NET, like most languages, permits recursion, a process by which a function calls itself under certain conditions. Here is a basic function in Visual Basic .NET to compute Fibonacci numbers. ''' <summary> ''' Gets the n'th Fibonacci number ''' </summary> ''' <param na...
variables this local arguments
Before using gcov, source code should be compiled with gcc using the two flags, -fprofile-arcs and -ftest-coverage. This tells the compiler to generate the information and extra object file code required by gcov. gcc -fprofile-arcs -ftest-coverage hello.c Linking should also use the -fprofile-a...
Python allows you to hack list comprehensions to evaluate conditional expressions. For instance, [value_false, value_true][<conditional-test>] Example: >> n = 16 >> print [10, 20][n <= 15] 10 Here n<=15 returns False (which equates to 0 in Python). So what Python i...
Here is an example of usage with a database. On the page where the CAPTCHA will be shown you'll have something like this: $this->load->helper('captcha'); $vals = array( 'img_path' => './captcha/', 'img_url' => 'http://example.com/captcha/' ); $cap = create_captc...
type Props = { posts: Array<Article>, dispatch: Function, children: ReactElement } const AppContainer = ({ posts, dispatch, children }: Props) => ( <div className="main-app"> <Header {...{ posts, dispatch }} /> {children} </...
When working with components, such as vertices or uv points, Maya defaults to returning a colon-separated range rather than individual items: print cmds.ls('pCube1.vtx[*]') # get all the vertices in the cube # [u'pCube1.vtx[0:7]'] You can use ls with the flatten option to force Maya to expan...
Problem ConcurrentDictionary shines when it comes to instantly returning of existing keys from cache, mostly lock free, and contending on a granular level. But what if the object creation is really expensive, outweighing the cost of context switching, and some cache misses occur? If the same key ...

Page 25 of 34