Tutorial by Examples: c

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 ...
Let's say you want to test method which throws an exception class Car { /** * @throws \Exception */ public function drive() { throw new \Exception('Useful message', 1); } } You can do that by enclosing the method call into a try/catch block and making a...
Applets could easily be used to create a GUI. They act like a Container and have an add() method that takes any awt or swing component. public class MyGUIApplet extends JApplet{ private JPanel panel; private JButton button; private JComboBox<String> cmbBox; private JText...
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 we have a table team_person as below: +======+===========+ | team | person | +======+===========+ | A | John | +------+-----------+ | B | Smith | +------+-----------+ | A | Walter | +------+-----------+ | A | Louis | +------+-----------+ | C | ...
RENAME TABLE t TO t_old, t_copy TO t; No other sessions can access the tables involved while RENAME TABLE executes, so the rename operation is not subject to concurrency problems. Atomic Rename is especially for completely reloading a table without waiting for DELETE and load to finish: CREATE ...
To install the software: After the download completes, run the installer. For Windows, the installer executable file has the .exe extension. Double-click the installer file to run it. For Linux platforms, the installer file has the .sh extension. For these platforms, you need to make ...
To run the software: After the download of the platform-independent ZIP file completes, extract it to any folder on your system. Run the executable file located in the netbeans/bin directory. Accept the License Agreement. Click Next. The NetBeans IDE installation starts. Note: If a compatib...
The ROLLUP operator is useful in generating reports that contain subtotals and totals. CUBE generates a result set that shows aggregates for all combinations of values in the selected columns. ROLLUP generates a result set that shows aggregates for a hierarchy of values in the selected col...
R contains a Date class, which is created with as.Date(), which takes a string or vector of strings, and if the date is not in ISO 8601 date format YYYY-MM-DD, a formatting string of strptime-style tokens. as.Date('2016-08-01') # in ISO format, so does not require formatting string ## [1] &quot...
Sometimes you will create classes that won't be used in their own right, rather only be extended inside other rule sets. This means that the compiled CSS file will be larger than it needs to be. Placeholder selectors solve this problem. Placeholder selectors are similar to class selectors, but th...
A common mistake is to hide an indexed column inside a function call. For example, this can't be helped by an index: WHERE DATE(dt) = '2000-01-01' Instead, given INDEX(dt) then these may use the index: WHERE dt = '2000-01-01' -- if `dt` is datatype `DATE` This works for DATE, DATETIME, TIM...
Create a testing class in the src/test/scala directory, in a file named HelloWorldSpec.scala. Put this inside the file: import org.scalatest.{FlatSpec, Matchers} class HelloWorldSpec extends FlatSpec with Matchers { "Hello World" should "not be an empty String" in { ...
This example has two parts - some boilerplate steps for adding Castle Windsor to your WCF service, and then a simple, concrete example to show how we configure and use Windsor's container. That makes the example a little bit long. If you already understand using a DI container then you likely only ...
Prototype: aggregate(zeroValue, seqOp, combOp) Description: aggregate() lets you take an RDD and generate a single value that is of a different type than what was stored in the original RDD. Parameters: zeroValue: The initialization value, for your result, in the desired format. seqOp: ...
Helper yii\helpers\Url provides a set of static methods for managing URLs. This helper may used in views/controllers code. URL to a route: echo Url::to(['post/index']); URL to a route with parameters: echo Url::to(['post/view', 'id' => 100]); anchored URL: echo Url::to(['post/view', 'id...
/** * Checks if a resource exists by sending a HEAD-Request. * @param url The url of a resource which has to be checked. * @return true if the response code is 200 OK. */ public static final boolean checkIfResourceExists(URL url) throws IOException { HttpURLConnection conn = (HttpURLCo...
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...

Page 475 of 826