Tutorial by Examples: di

BufferedImage image = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); //you don't have to use the Graphics object, you can read and set pixel color individually for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { int alpha = 255; //don't forget this, or ...
Java applets are able to load different resources. But since they are running in the web browser of the client you need to make sure that these resources are accessible. Applets are not able to access client resources as the local file system. If you want to load resources from the same URL the App...
Common Lisp does not have interfaces in the sense that some languages (e.g., Java) do, and there is less need for that type of interface given that Common Lisp supports multiple inheritance and generic functions. However, the same type of patterns can be realized easily using mixin classes. This e...
Let's say you're working on an app called MyTasks, and you want to allow inbound URLs to create a new task with a title and a body. The URL you're designing might look something like this: mytasks://create?title=hello&body=world (Of course, the text and body parameters are used to populate our...
Sometimes we need to perform basic operations like hide/show view based on single value, for that single variable we cannot create model or it is not good practice to create model for that. DataBinding supports basic datatypes to perform those oprations. <layout xmlns:android="http://schema...
NSLog is good, but you can also log by appending to a file instead, using code like: NSFileHandle* fh = [NSFileHandle fileHandleForWritingAtPath:path]; if ( !fh ) { [[NSFileManager defaultManager] createFileAtPath:path contents:nil attributes:nil]; fh = [NSFileHandle fileHandleForWriting...
$ gzip extremelylargefile.txt & $ bg $ disown %1 This allows a long running process to continue once your shell (terminal, ssh, etc) is closed.
Files can be read byte- and line-wise using the Files class. Path p2 = Paths.get(URI.create("file:///home/testuser/File.txt")); byte[] content = Files.readAllBytes(p2); List<String> linesOfContent = Files.readAllLines(p2); Files.readAllLines() optionally takes a charset as para...
When making a bind of something, for example a date you may want to show it in a specific format without messing around with it in the code. To do this we can use the StringFormat property. Here are some examples: Text="{Binding Path=ReleaseDate, StringFormat=dddd dd MMMM yyyy}" This...
Lets create a simple transformation to convert a CSV into an XML file. Our Transformation has to do the following: Read the CSV file Build the greetings message Save the greetings in the XML file Create a Transformation: Here's how to start the Transformation: To the left of the works...
Pentaho Data Integration comes in two varieties: Community Edition (CE) - Free version for developers Enterprise Edition (EE) - Paid version for enterprise use Installation steps: You can download Pentaho Data Integration Community Edition from Sourceforge.net. For the Enterprise Editio...
Digital hardware is built from two types of hardware primitives: Combinatorial gates (inverters, and, or, xor, 1-bit full adders, 1-bit multiplexers...) These logic gates perform a simple boolean computation on their inputs and produce an output. Each time one of their inputs changes, they st...
This example is the second of a series of 3. If you didn't yet, please read the Block diagram example first. With a block diagram that complies with the 10 rules (see the Block diagram example), the VHDL coding becomes straightforward: the large surrounding rectangle becomes the VHDL entity,...
In most object oriented languages, allocating memory for an object and initializing it is an atomic operation: // Both allocates memory and calls the constructor MyClass object = new MyClass(); In Objective-C, these are separate operations. The class methods alloc (and its historic sibling allo...
Consider the following example: public final class Person { private final String firstName; private final String lastName; public Person(String firstName, String lastName) { this.firstName = (firstName == null) ? "" : firstName; this.lastName = (lastN...
[InitializeOnLoad] public class AttributesExample : MonoBehaviour { static AttributesExample() { [...] } [InitializeOnLoadMethod] private static void Foo() { [...] } } [InitializeOnLoad] public class AttributesExample : MonoBeh...
Data frames are R's tabular data structure. They can be written to or read from in a variety of ways. This example illustrates a couple common situations. See the links at the end for other resources. Writing Before making the example data below, make sure you're in a folder you want to write to....
We can change the tasks execution order with the dependsOn method. task A << { println 'Hello from A' } task B(dependsOn: A) << { println "Hello from B" } Adding `dependsOn: causes: task B depends on task A Gradle to execute A task everytime before the B ta...
project('projectA') { task A(dependsOn: ':projectB:B') << { println 'Hello from A' } } project('projectB') { task B << { println 'Hello from B' } } To refer to a task in another project, you prefix the name of the task with the path of the pr...
task A << { println 'Hello from A' } task B << { println 'Hello from B' } B.dependsOn A It is an alternative way to define the dependency instead of using the task name. And the output is the same: > gradle -q B Hello from A Hello from B

Page 97 of 164