Tutorial by Examples: c

To get started quickly with Express, you can use the Express generator which will create an application skeleton for you. First, install it globally with npm: npm install express-generator -g You may need to put sudo before this command if you get a "permission denied" error. Once th...
CPAN.pm is a Perl module which allows to query and install modules from CPAN sites. It supports interactive mode invoked with cpan or perl -MCPAN -e shell Querying modules By name: cpan> m MooseX::YAML By a regex against module name: cpan> m /^XML::/ Note: to enable a pager o...
Command line You can use cpan to install modules directly from the command line: cpan install DBI This would be followed by possibly many pages of output describing exactly what it is doing to install the module. Depending on the modules being installed, it may pause and ask you questions. Int...
IQueryable<Cat> cats = session.Query<Cat>() .Where(c => c.Name == "Max");
A basic QueryOver query is performed against an ISession using the QueryOver<T> method, where T is the type of a mapped entity. IList<Customer> customers = session.QueryOver<Customer>() .Where(c => c.LastName == "Simpson") .List();
In the logging configuration file of your choice set the logging of the following packages to the levels shown.: # log the sql statement org.hibernate.SQL=DEBUG # log the parameters org.hibernate.type=TRACE There will probably be some logger specific prefixes that are required. Log4j config:...
If you have any exposure to other text-based template languages, such as Smarty, Django, or Jinja, you should feel right at home with Twig. It's both designer and developer friendly by sticking to PHP's principles and adding functionality useful for templating environments. The key-features are... ...
Categories provide the ability to add some extra functionality to an object without subclassing or changing the actual object. For example we want to set some custom fonts. Let's create a category that add functionality to UIFont class. Open your XCode project, click on File -> New -> File a...
Pattern matching can also be used to check the type of an instance, rather than using isInstanceOf[B]: val anyRef: AnyRef = "" anyRef match { case _: Number => "It is a number" case _: String => "I...
The [ and [[ operators are primitive functions that are generic. This means that any object in R (specifically isTRUE(is.object(x)) --i.e. has an explicit "class" attribute) can have its own specified behaviour when subsetted; i.e. has its own methods for [ and/or [[. For example, this is...
This operator checks whether the object is of a particular class/interface type. instanceof operator is written as: ( Object reference variable ) instanceof (class/interface type) Example: public class Test { public static void main(String args[]){ String name = "Buyya";...
Lazy evaluation means Haskell will evaluate only list items whose values are needed. The basic recursive definition is: f (0) <- 0 f (1) <- 1 f (n) <- f (n-1) + f (n-2) If evaluated directly, it will be very slow. But, imagine we have a list that records all the results, fibs ...
First, instantiate a Toast object with one of the MakeText() methods. This method takes three parameters: the application Context, the text message, and the duration for the toast. It returns a properly initialized Toast object. You can display the toast notification with Show(), as shown in the fol...
Behavior Driven Development (BDD) testing style revolves around "given", "when" and "then" stages in tests. However, classical Mockito uses "when" word for "given" phase, and does not include other natural language constructions that can encompass B...
// static: is callable on a class even when no instance of the class has been created public static void MyMethod() // virtual: can be called or overridden in an inherited class public virtual void MyMethod() // internal: access is limited within the current assembly internal void MyMetho...
There is no simple way to obtain attributes from an interface, since classes does not inherit attributes from an interface. Whenever implementing an interface or overriding members in a derived class, you need to re-declare the attributes. So in the example below output would be True in all three c...
Selection sort selects the minimum element, repeatedly, until the list is empty. import Data.List (minimum, delete) ssort :: Ord t => [t] -> [t] ssort [] = [] ssort xs = let { x = minimum xs } in x : ssort (delete x xs)
with clause is used to combine matching clauses. It looks like we combine anonymous functions or handle function with multiple bodies (matching clauses). Consider the case: we create a user, insert it into DB, then create greet email and then send it to the user. Without the with clause we might ...
Query: SELECT * FROM Customers ORDER BY CustomerID LIMIT 3; Result: CustomerID CustomerName ContactName Address City PostalCode Country 1 Alfreds Futterkiste Maria Anders Obere Str. 57 Berlin 12209 Ge...
In this example our project name is "helloworld" which was created with stack new helloworld simple First we have to build the project with stack build and then we can run it with stack exec helloworld-exe

Page 291 of 826