Tutorial by Examples

Due to logical query processing order, alias can be used in order by. SELECT DisplayName, JoinDate as jd, Reputation as rep FROM Users ORDER BY jd, rep And can use relative order of the columns in the select statement .Consider the same example as above and instead of using alias use the relat...
Whenever a Python script is invoked from the command line, the user may supply additional command line arguments which will be passed on to the script. These arguments will be available to the programmer from the system variable sys.argv ("argv" is a traditional name used in most programmi...
You can count the number of rows: SELECT count(*) TotalRows FROM employees; TotalRows4 Or count the employees per department: SELECT DepartmentId, count(*) NumEmployees FROM employees GROUP BY DepartmentId; DepartmentIdNumEmployees1321 You can count over a column/expression with the eff...
REST stands for REpresentational State Transfer and was coined by Roy Fielding in his doctoral thesis Architectural Styles and the Design of Network-based Software Architectures. In it he identifies specific architectural principles like: Addressable Resources: the key abstraction of informatio...
To install Eclipse RCP follow the steps : Download Eclipse RCP/RAP version from Eclipse.org Eclipse RCP/RAP project downloading URL
The @Html.AntiForgeryToken() helper method protects against cross-site request forgery (or CSRF) attacks. It can be used by simply using the Html.AntiForgeryToken() helper within one of your existing forms and decorating its corresponding Controller Action with the [ValidateAntiForgeryToken] attri...
Good unit tests are independent, but code often has dependencies. We use various kinds of test doubles to remove the dependencies for testing. One of the simplest test doubles is a stub. This is a function with a hard-coded return value called in place of the real-world dependency. // Test that ...
If you are able to download an update of Android Studio, but after it restarts nothing happens, check out the following example: After the patch was downloaded and Android Studio closed, open the terminal Go to your android studio folder, e.g. cd ~/android-studio Go to bin subfolder: cd bin ...
.NET Framework defines a interface for types requiring a tear-down method: public interface IDisposable { void Dispose(); } Dispose() is primarily used for cleaning up resources, like unmanaged references. However, it can also be useful to force the disposing of other resources even though ...
val emailRegex: Regex = "(.+)@(.+)\\.(.+)".r "[email protected]" match { case emailRegex(userName, domain, topDomain) => println(s"Hi $userName from $domain") case _ => println(s"This is not a valid email.") } In this example, the regex attem...
Messages printed from NSLog are displayed on Console.app even in the release build of your app, which doesn't make sense for printouts that are only useful for debugging. To fix this, you can use this macro for debug logging instead of NSLog. #ifdef DEBUG #define DLog(...) NSLog(__VA_ARGS__) #els...
To use Leaflet, load its stylesheet and JavaScript file to your page: <link rel="stylesheet" href="/css/leaflet.css" /> <script src="/js/leaflet.js"></script> These resources can be downloaded from a variety of locations such as Leaflet's homepage...
First, import the libraries that work with files: from os import listdir from os.path import isfile, join, exists A helper function to read only files from a directory: def get_files(path): for file in listdir(path): full_path = join(path, file) if isfile(full_path): ...
Syntax: add_months(p_date, integer) return date; Add_months function adds amt months to p_date date. SELECT add_months(date'2015-01-12', 2) m FROM dual; M2015-03-12 You can also substract months using a negative amt SELECT add_months(date'2015-01-12', -2) m FROM dual; M2014-11-12 When the...
public static class ThreadLocalExample { private static final ThreadLocal<SimpleDateFormat> format = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyyMMdd_HHmm")); public String formatDate(Date date) { return format.get().format(date); ...
Java ThreadLocal is used to create thread local variables. It is known that threads of an Object share it’s variables, so the variable is not thread safe. We can use synchronization for thread safety but if we want to avoid synchronization,ThreadLocal allows us to create variables which are local to...
where clause By adding a where clause you can restrict the iterations to ones that satisfy the given condition. for i in 0..<5 where i % 2 == 0 { print(i) } // 0 // 2 // 4 let names = ["James", "Emily", "Miles"] for name in names where name.c...
PHP has great official documentation already at http://php.net/manual/. The PHP Manual documents pretty much all language features, the core libraries and most available extensions. There are plenty of examples to learn from. The PHP Manual is available in multiple languages and formats. Best of al...
If you need to call an Objective-C method from C code, you have two ways: using objc_msgSend, or obtaining the IMP (method implementation function pointer) and calling that. #import <objc/objc.h> @implementation Example - (double)negate:(double)value { return -value; } - (doubl...
NSArray *array = @[ @{ @"id": @"7CDF6D22-8D36-49C2-84FE-E31EECCECB71", @"title": @"Jackie Chan Strike Movie", @"url": @"http://abc.com/playback.m3u8&...

Page 246 of 1336