Tutorial by Examples: sin

The built-in werkzeug server certainly is not suitable for running production servers. The most obvious reason is the fact that the werkzeug server is single-threaded and thus can only handle one request at a time. Because of this we want to use the uWSGI Server to serve our application instead. In...
A common mistake for Java beginners is to use the == operator to test if two strings are equal. For example: public class Hello { public static void main(String[] args) { if (args.length > 0) { if (args[0] == "hello") { System.out.println(&q...
In Object Oriented Programming a common task is to compose objects (values). In Functional Programming it is as common task to compose values as well as functions. We are used to compose values from our experience of other programming languages using operators like +, -, *, / and so on. Value co...
In a statically typed language like F# we work with types well-known at compile-time. We consume external data sources in a type-safe manner using type providers. However, occassionally there's need to use late binding (like dynamic in C#). For instance when working with JSON documents that have...
Pooling provides a higher level abstraction of the Worker functionality, including the management of references in the way required by pthreads. From: http://php.net/manual/en/class.pool.php Pools and workers provide an higher level of control and ease of creating multi-threaded <?php // T...
Add the gradle dependency in app-level build.gradle compile 'com.android.volley:volley:1.0.0' Also, add the android.permission.INTERNET permission to your app's manifest. **Create Volley RequestQueue instance singleton in your Application ** public class InitApplication extends Application { ...
For functions that need to take a collection of objects, slices are usually a good choice: fn work_on_bytes(slice: &[u8]) {} Because Vec<T> and arrays [T; N] implement Deref<Target=[T]>, they can be easily coerced to a slice: let vec = Vec::new(); work_on_bytes(&vec); le...
This example hides the MANDT (client) field from the ALV. Note that the parameter passed to get_column( ) must be capitalized in order for this to work. alv->get_columns( )->get_column( 'MANDT' )->set_visible( if_salv_c_bool_sap=>false ).
The column text may change upon the horizontal resizing of a column. There are three methods to accomplish this: Method NameMaximum Length of Headingset_short_text10set_medium_text20set_long_text40 The following example shows usage of all three. A column object is declared and instantiated as a re...
CSS .bordered { border-image: linear-gradient(to right, red 20%, green 20%, green 40%, blue 40%, blue 60%, maroon 60%, maroon 80%, chocolate 80%); /* gradient with required colors */ border-image-slice: 1; } HTML <div class='bordered'>Border on all sides</div> The above ex...
WITHOUT_ARRAY_WRAPPER option enables you to generate a single object instead of the array. Use this option if you know that you will return single row/object: SELECT top 3 object_id, name, type, principal_id FROM sys.objects WHERE object_id = 3 FOR JSON PATH, WITHOUT_ARRAY_WRAPPER Single obje...
WHERE clause filters only those rows that satisfy some condition: SELECT * FROM sys.objects WHERE type = 'IT'
ORDER BY clause sorts rows in the returned result set by some column or expression: SELECT * FROM sys.objects ORDER BY create_date
GROUP BY clause groups rows by some value: SELECT type, count(*) as c FROM sys.objects GROUP BY type You can apply some function on each group (aggregate function) to calculate sum or count of the records in the group. typecSQ3S72IT16PK1U5
HAVING clause removes groups that do not satisfy condition: SELECT type, count(*) as c FROM sys.objects GROUP BY type HAVING count(*) < 10 typecSQ3PK1U5
OFFSET FETCH clause is more advanced version of TOP. It enables you to skip N1 rows and take next N2 rows: SELECT * FROM sys.objects ORDER BY object_id OFFSET 50 ROWS FETCH NEXT 10 ROWS ONLY You can use OFFSET without fetch to just skip first 50 rows: SELECT * FROM sys.objects ORDER BY obj...
@Singleton @Component(modules = AppModule.class) public interface AppComponent { void inject(App app); Context provideContext(); Gson provideGson(); MainActivityComponent mainActivityComponent(ActivityModule activityModule); } @ActivityScope @Subcomponent(modules = Act...
We want to gather data created by multiple Workers. First we create a Queue: sink = Queue.new Then 16 workers all generating a random number and pushing it into sink: (1..16).to_a.map do Thread.new do sink << rand(1..100) end end.map(&:join) And to get the data, conver...
We want to process data in parallel and push it down the line to be processed by other workers. Since Workers both consume and produce data we have to create two queues: first_input_source = Queue.new first_output_sink = Queue.new 100.times { |i| first_input_source << i } First wave of...
BackAndroid.addEventListener('hardwareBackPress', function() { if (!this.onMainScreen()) { this.goBack(); return true; } return false; }); Note: this.onMainScreen() and this.goBack() are not built in functions, you also need to implement those. (https://github.c...

Page 76 of 161