Tutorial by Examples: ee

Let's say you have two commits d9e1db9 and 5651067 and want to see what happened between them. d9e1db9 is the oldest ancestor and 5651067 is the final descendant in the chain of commits. gitk --ancestry-path d9e1db9 5651067
Consider the Node class having 3 members data, left child pointer and right child pointer like below. public class Node { public int data; public Node left; public Node right; public Node(int data){ this.data = data; } } We can traverse the tree construct...
<svg width="800px" height="600px"> <defs> <filter id="greyscale"> <feColorMatrix type="matrix" values="0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 ...
@Entity class Note { @Id Integer id; @Basic String note; @Basic int count; } Getters, setters etc. are ommitted for brevity, but they are not needed for JPA anyway. This Java class would map to the following table (depending on your database, here given in on...
Suppose we want to get all product categories with total sales greater than 20. Here is a query without Common Table Expressions: SELECT category.description, sum(product.price) as total_sales FROM sale LEFT JOIN product on sale.product_id = product.id LEFT JOIN category on product.category_id ...
Suppose we want to query the "cheapest products" from the "top categories". Here is an example of query using Common Table Expressions -- all_sales: just a simple SELECT with all the needed JOINS WITH all_sales AS ( SELECT product.price as product_price, category.id a...
It is good practice to test the calling program's __name__ variable before executing your code. import sys def main(): # Your code starts here # Don't forget to provide a return code return 0 if __name__ == "__main__": sys.exit(main()) Using this pattern ens...
Before you compile your app and run it on your device, you'll need create some icons and splash screens, and add a mobile-config.js file to your app. App.icons({ // iOS 'iphone': 'resources/icons/icon-60x60.png', 'iphone_2x': 'resources/icons/[email protected]', 'ipad': 'resources/icons...
Mongo supports database-to-database copying, which is useful if you have large databases on a staging database that you want to copy into a local development instance. // run mongod so we can create a staging database // note that this is a separate instance from the meteor mongo and minimongo ins...
Use $state.transitionTo to go form one state to another. This is a low level method to transition and $state.go is the recommended way for most common use cases as it uses this method internally. $state.transitionTo(toState [, toParams] [, options]) toState - the state to transition to toPara...
AndroidManifest.xml: <activity android:name="com.example.MainActivity" > <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <c...
The following might have undefined behavior due to incorrect pointer alignment: char *memory_block = calloc(sizeof(uint32_t) + 1, 1); uint32_t *intptr = (uint32_t*)(memory_block + 1); /* possible undefined behavior */ uint32_t mvalue = *intptr; The undefined behavior happens as the pointer...
for /r command can be used to recursively visit all the directories in a directory tree and perform a command. @echo off rem start at the top of the tree to visit and loop though each directory for /r %%a in (.) do ( rem enter the directory pushd %%a echo In directory: cd rem leave...
//Creates a Random instance with a seed of 12345. Random random = new Random(12345L); //Gets a ThreadLocalRandom instance ThreadLocalRandom tlr = ThreadLocalRandom.current(); //Set the instance's seed. tlr.setSeed(12345L); Using the same seed to generate random numbers will return the sa...
You can evaluate any valid C# code: int value = await CSharpScript.EvaluateAsync<int>("15 * 89 + 95"); var span = await CSharpScript.EvaluateAsync<TimeSpan>("new DateTime(2016,1,1) - DateTime.Now"); If type is not specified, the result is object: object value = ...
You are right in the middle of working on a new feature, and your boss comes in demanding that you fix something immediately. You may typically want use git stash to store your changes away temporarily. However, at this point your working tree is in a state of disarray (with new, moved, and removed ...
docker run --name="test-app" --entrypoint="/bin/bash" example-app This command will override the ENTRYPOINT directive of the example-app image when the container test-app is created. The CMD directive of the image will remain unchanged unless otherwise specified: docker run -...
Given a simple DataObject like this: class MyDataObject extends DataObject { private static $db = array( 'Name' => 'Varchar(255)' ); } To provide full Create-Read-Update-Delete for the objects then this is the ModelAdmin code required: class MyModelAdmin extends ModelAd...
class MyAdmin extends ModelAdmin { ... function getEditForm($id = null, $fields = null) { $form = parent::getEditForm($id, $fields); if ($this->modelClass == 'MyDataObjectName') { $form->Fields() ->fieldByName($this->sanitis...
Some LINQ methods return a query object. This object does not hold the results of the query; instead, it has all the information needed to generate those results: var list = new List<int>() {1, 2, 3, 4, 5}; var query = list.Select(x => { Console.Write($"{x} "); return ...

Page 18 of 54