Tutorial by Examples

Name binding is a concept that allows to say to a JAX-RS runtime that a specific filter or interceptor will be executed only for a specific resource method. When a filter or an interceptor is limited only to a specific resource method we say that it is name-bound. Filters and interceptors that do no...
Connection factories are the managed objects that allows application to connect to provider by creating Connection object. javax.jms.ConnectionFactory is an interface that encapsulates configuration parameters defined by an administrator. For using ConnectionFactory client must execute JNDI lookup ...
Often we wish to convert, or transform the contents of a collection (a list, or something traversable). In Haskell we use map: -- Simple add 1 map (+ 1) [1,2,3] [2,3,4] map odd [1,2,3] [True,False,True] data Gender = Male | Female deriving Show data Person = Person String Gender ...
Given a list: li = [1,2,3,4,5] we can filter a list with a predicate using filter :: (a -> Bool) -> [a] -> [a]: filter (== 1) li -- [1] filter (even) li -- [2,4] filter (odd) li -- [1,3,5] -- Something slightly more complicated comfy i = notTooLarg...
var bufferBlock = new BufferBlock<int>(new DataflowBlockOptions { BoundedCapacity = 1000 }); var cancellationToken = new CancellationTokenSource(TimeSpan.FromSeconds(10)).Token; var producerTask = Task.Run(async () => { var random = new Random(); while (!cancellati...
From "How to use Truth" http://google.github.io/truth/ String string = "awesome"; assertThat(string).startsWith("awe"); assertWithMessage("Without me, it's just aweso").that(string).contains("me"); Iterable<Color> googleColors = googleLog...
In order to load the XML data with XOM you will need to make a Builder from which you can build it into a Document. Builder builder = new Builder(); Document doc = builder.build(file); To get the root element, the highest parent in the xml file, you need to use the getRootElement() on the Doc...
Writing to a XML File using XOM is very similar to reading it except in this case we are making the instances instead of retrieving them off the root. To make a new Element use the constructor Element(String name). You will want to make a root element so that you can easily add it to a Document. E...
The Reflection API could be used to change values of private and final fields even in the JDK default library. This could be used to manipulate the behaviour of some well known classes as we will see. What is not possible Lets start first with the only limitation means the only field we can't chan...
The @switch annotation tells the compiler that the match statement can be replaced with a single tableswitch instruction at the bytecode level. This is a minor optimization that can remove unnecessary comparisons and variable loads during runtime. The @switch annotation works only for matches again...
You can use 5 properties on each layer to configure your shadows: shadowOffset - this property moves your shadow left/right or up/down self.layer.shadowOffset = CGSizeMake(-1, -1); // 1px left and up self.layer.shadowOffset = CGSizeMake(1, 1); // 1px down and right shadowColor - this s...
Most KVO and KVC functionality is already implemented by default on all NSObject subclasses. To start observing a property named firstName of an object named personObject do this in the observing class: [personObject addObserver:self forKeyPath:@"firstName" ...
Objective-C NSURL *url = [[NSURL alloc] initWithString:@"YOUR URL"]; // url can be remote or local AVPlayer *player = [AVPlayer playerWithURL:url]; // create a player view controller AVPlayerViewController *controller = [[AVPlayerViewController alloc] init]; [self presentViewC...
A function is a block of organised, reusable code that is used to perform a single, related action. Functions usually "take in" data, process it, and "return" a result. User defined function A function defined by user. Example in PHP //Function definition function a...
This example shows the behaviour of getopt when the user input is uncommon: getopt.php var_dump( getopt("ab:c::", ["delta", "epsilon:", "zeta::"]) ); Shell command line $ php getopt.php -a -a -bbeta -b beta -cgamma --delta --epsilon --zeta --zeta=f...
You can execute a database query from a String rather than a regular SOQL expression: String tableName = 'Account'; String queryString = 'SELECT Id FROM ' + tableName + ' WHERE CreatedDate >= YESTERDAY'; List<SObject> objects = Database.query(queryString); Since dynamic SOQL queries a...
DROP INDEX IX_NonClustered ON Employees
sys.dm_db_index_physical_stats ( { database_id | NULL | 0 | DEFAULT } , { object_id | NULL | 0 | DEFAULT } , { index_id | NULL | 0 | -1 | DEFAULT } , { partition_number | NULL | 0 | DEFAULT } , { mode | NULL | DEFAULT } ) Sample : SELECT * FROM sys.dm_db_inde...
avg_fragmentation_in_percent valueCorrective statement>5% and < = 30%REORGANIZE>30%REBUILD ALTER INDEX IX_NonClustered ON tableName REORGANIZE; ALTER INDEX ALL ON Production.Product REBUILD WITH (FILLFACTOR = 80, SORT_IN_TEMPDB = ON, STATISTICS_NORECOMPUTE = ON);
Rebuilding indexes is done using the following statement ALTER INDEX All ON tableName REBUILD; This drops the index and recreates it, removing fragementation, reclaims disk space and reorders index pages. One can also reorganize an index using ALTER INDEX All ON tableName REORGANIZE; which ...

Page 699 of 1336