Tutorial by Examples: ad

Add a keystore using: keytool -genkey -v -keystore example.keystore -alias example -keyalg RSA -keysize 2048 -validity 10000 Note: This should be at root of project. Though not a hard requirement, it eases the file referencing Add a build.json with release/dev configuration for key...
Like an HTTP request, an HTTP response may include additional headers to modify or augment the response it provides. A full list of available headers is defined in §6.2 of the specification. The most commonly-used headers are: Server, which functions like a User-Agent request header for the serv...
Not always we have liberty to read from or write to a local system path. For example if R code streaming map-reduce must need to read and write to file connection. There can be other scenarios as well where one is going beyond local system and with advent of cloud and big data, this is becoming incr...
std::function can cause significant overhead. Because std::function has [value semantics][1], it must copy or move the given callable into itself. But since it can take callables of an arbitrary type, it will frequently have to allocate memory dynamically to do this. Some function implementations h...
You can read an a binary file using this piece of code in all recent versions of Java: Java SE 1.4 File file = new File("path_to_the_file"); byte[] data = new byte[(int) file.length()]; DataInputStream stream = new DataInputStream(new FileInputStream(file)); stream.readFully(data); s...
This code compiles: Integer arg = null; int x = arg; But it will crash at runtime with a java.lang.NullPointerException on the second line. The problem is that a primitive int cannot have a null value. This is a minimalistic example, but in practice it often manifests in more sophisticated f...
At run time the following would display a list of url in your console and continue computation payload = [{url:..., title:...}, {url=..., title=...}] main = payload |> List.map .url -- only takes the url |> Debug.log " My list of URLs" -- pass the url...
Say you want to print variables in a 3 character column. Note: doubling { and } escapes them. s = """ pad {{:3}} :{a:3}: truncate {{:.3}} :{e:.3}: combined {{:>3.3}} :{a:>3.3}: {{:3.3}} :{a:3.3}: {{:3.3}} :{c:3...
To create a function which accepts an undetermined number of arguments, there are two methods depending on your environment. 5 Whenever a function is called, it has an Array-like arguments object in its scope, containing all the arguments passed to the function. Indexing into or iterating over th...
Declaration A common misunderstanding, especially beginners, have is read-only property is the one marked with readonly keyword. That's not correct and in fact following is a compile time error: public readonly string SomeProp { get; set; } A property is read-only when it only has a getter. pu...
(Copy an item and send the copies to every block that it’s linked to) Unlike BufferBlock, BroadcastBlock’s mission in life is to enable all targets linked from the block to get a copy of every element published, continually overwriting the “current” value with those propagated to it. Additionally,...
Public Function GetUserFirstName(UserName As String) As String Dim Firstname As String = "" 'Specify the SQL that you want to use including a Parameter Dim SQL As String = "select firstname from users where username=@UserName" 'Provide a Data Sourc...
Variables are SHADOWED and methods are OVERRIDDEN. Which variable will be used depends on the class that the variable is declared of. Which method will be used depends on the actual class of the object that is referenced by the variable. class Car { public int gearRatio = 8; public St...
If we try to change an object on the UI thread from a different thread we will get a cross-thread operation exception: Private Sub Button_Click(sender As Object, e As EventArgs) Handles MyButton.Click ' Cross thread-operation exception as the assignment is executed on a different thread '...
std::ifstream f("file.txt"); if (f) { std::stringstream buffer; buffer << f.rdbuf(); f.close(); // The content of "file.txt" is available in the string `buffer.str()` } The rdbuf() method returns a pointer to a streambuf that can be pushed into buffer...
The following scripts are for uploading a file from the server filesystem into the server. Mostly for config files and filewatchers. //https://forums.meteor.com/t/read-file-from-the-public-folder/4910/5 // Asynchronous Method. Meteor.startup(function () { console.log('starting up'); ...
It's possible to send broadcast to BroadcastReceiver with adb. In this example we are sending broadcast with action com.test.app.ACTION and string extra in bundle 'foo'='bar': adb shell am broadcast -a action com.test.app.ACTION --es foo "bar" You can put any other supported type to b...
A branch is just a pointer to a commit, so you can freely move it around. To make it so that the branch is referring to the commit aabbcc, issue the command git reset --hard aabbcc Please note that this will overwrite your branch's current commit, and as so, its entire history. You might loose s...
Custom events usually need custom event arguments containing information about the event. For example MouseEventArgs which is used by mouse events like MouseDown or MouseUp events, contains information about Location or Buttons which used to generate the event. When creating new events, to create a...
Modern browsers provide a classList object to ease manipulation of the element's class attribute. Older browsers require direct manipulation of the element's className property. W3C DOM4 A simple method to add a class to an element is to append it to the end of the className property. This will no...

Page 33 of 114