Tutorial by Examples

Generally, most of the data that is to be analyzed will be produced by various data sources like applications servers, social networking sites, cloud servers, and enterprise servers. This data will be in the form of log files and events. Log file − In general, a log file is a file that lists events...
cf apps I usually start with this as now I get the AppName for cut-n-paste and if verifies I am where I want to be in space and cloud. And yes, I really really want to say space and time.
cf logs AppName --recent Note, depending on who is hosting your CF app, the size of this log may be limited.
CF keeps you logged in. I sometimes have to switch between regions and don't always know where I am #Where am I? cf target #Login. This is logging in to the UK region of bluemix. Replace eu-gb with ng to go to the US. cf login -a https://api.eu-gb.bluemix.net #List spaces cf spaces #C...
cf ssh AppName Only for Diego apps. Useful to see what is actually running.
The If control statement allows different code to be executed depending upon the evaluation of a conditional (Boolean) statement. A conditional statement is one that evaluates to either True or False, e.g. x > 2. There are three patterns that can be used when implementing an If statement, which ...
This is the simplest way to connect. First, the driver has to be registered with java.sql.DriverManager so that it knows which class to use. This is done by loading the driver class, typically with java.lang.Class.forname(<driver class name>). /** * Connect to a PostgreSQL database. *...
Instead of specifying connection parameters like user and password (see a complete list here) in the URL or a separate parameters, you can pack them into a java.util.Properties object: /** * Connect to a PostgreSQL database. * @param url the JDBC URL to connect to. Must start with "jdbc:...
It is common to use javax.sql.DataSource with JNDI in application server containers, where you register a data source under a name and look it up whenever you need a connection. This is code that demonstrates how data sources work: /** * Create a data source with connection pool for PostgreSQL c...
CDI is a Java EE specification. It specifies how things should be done, and which features must be provided, but it isn't actually a specific library or set of code. In order to use CDI, you will need to use a CDI implementation. The reference implementation of the CDI spec is a set of libraries kn...
You can install Solr in any system where a suitable Java Runtime Environment (JRE) is available, as detailed below. Currently this includes Linux, OS X, and Microsoft Windows. You will need the Java Runtime Environment (JRE) version 1.8 or higher. At a command line, check your Java version like thi...
You can start Solr by running bin/solr from the Solr directory and this will start Solr in the background, listening on port 8983. $ bin/solr start To change the port Solr listens on, you can use the -p parameter when starting, such as: $ bin/solr start -p 8984 Since Solr is a server, it is more...
Given the following class: public class FinalizableObject { public FinalizableObject() { Console.WriteLine("Instance initialized"); } ~FinalizableObject() { Console.WriteLine("Instance finalized"); } } A program that create...
Rule of thumb: when garbage collection occurs, "live objects" are those still in use, while "dead objects" are those no longer used (any variable or field referencing them, if any, has gone out of scope before the collection occurs). In the following example (for convenience, Fi...
What if two (or several) otherwise dead objects reference one another? This is shown in the example below, supposing that OtherObject is a public property of FinalizableObject: var obj1 = new FinalizableObject1(); var obj2 = new FinalizableObject2(); obj1.OtherObject = obj2; obj2.OtherObject = ...
Weak references are... references, to other objects (aka "targets"), but "weak" as they do not prevent those objects from being garbage-collected. In other words, weak references do not count when the Garbage Collector evaluates objects as "live" or "dead". T...
Implement Dispose() method (and declare the containing class as IDisposable) as a means to ensure any memory-heavy resources are freed as soon as the object is no longer used. The "catch" is that there is no strong guarantee the the Dispose() method would ever be invoked (unlike finalizers...
As Dispose() and finalizers are aimed to different purposes, a class managing external memory-heavy resources should implement both of them. The consequence is writing the class so that it handles well two possible scenarios: When only the finalizer is invoked When Dispose() is invoked first and...

Page 1209 of 1336