Tutorial by Examples: er

If you want to remove calls to certain methods, assuming they return void and have no side affects (as in, calling them doesn't change any system values, reference arguments, statics, etc.) then you can have ProGuard remove them from the output after the build is complete. For example, I find this ...
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...
template <div id="demo">{{fullName}}</div> watch example var vm = new Vue({ el: '#demo', data: { firstName: 'Foo', lastName: 'Bar', fullName: 'Foo Bar' } }) vm.$watch('firstName', function (val) { this.fullName = val + ' ' + this.lastName })...
This method increases readability by giving consecutive rows alternating background color shading. alv->get_display_settings( )->set_striped_pattern( if_salv_c_bool_sap=>true ).
Suppose you have a parentView into which you want to insert a new subView programmatically (eg. when you want to insert an UIImageView into a UIViewController's view), than you can do it as below. Objective-C [parentView addSubview:subView]; Swift parentView.addSubview(subView) You can also...
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
HAVING clause removes groups that do not satisfy condition: SELECT type, count(*) as c FROM sys.objects GROUP BY type HAVING count(*) < 10 typecSQ3PK1U5
This example shows a helper class that contains methods useful, when executing the queries for data. Every method here uses Java Generic's in order to be very flexible. public <T> List<T> selectElements(AbstractDao<T, ?> dao) { if (dao == null) { return null; } ...
This technique details how to ensure that your .apk has been signed with your developer certificate, and leverages the fact that the certificate remains consistent and that only you have access to it. We can break this technique into 3 simple steps: Find your developer certificate signature. Em...
Enable Offline Work: Click File -> Settings. Search for "gradle" and click in Offline work box. Go to Compiler (in same settings dialog just below Gradle) and add --offline to Command-line Options text box. Improve Gradle Performance Add following two line of code in your gradle...
Given the following XML document : <?xml version="1.0" encoding="UTF-8"?> <values> <value>1</value> <value>3</value> <value>5</value> </values> We can produce an XML document describing the sum of the values wit...
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. Let's populate source with some data: source = Queue.new data = (1..100) data.each { |e| source << e } Then create some workers to process data: (1..16).to_a.map do Thread.new do until source.empty? item = source.pop sleep 0.5 ...
syncer = Queue.new a = Thread.new do syncer.pop puts "this happens at end" end b = Thread.new do puts "this happens first" STDOUT.flush syncer << :ok end [a, b].map(&:join)
q = Queue.new q << 1 q << 2 a = Array.new a << q.pop until q.empty? Or a one liner: [].tap { |array| array < queue.pop until queue.empty? }
To avoid infinitely blocking, reading from queues shouldn't happen on the thread merge is happening on. To avoid synchronization or infinitely waiting for one of queues while other has data, reading from queues shouldn't happen on same thread. Let's start by defining and populating two queues:...
Haxe's enumeration types are algebraic data types (ADT). Their primary use is for describing data structures. Enums are denoted by the enum keyword and contain one or more enum constructors. enum Color { Red; Green; Blue; RGB(r : Int, g : Int, b : Int); } The above enum can ...

Page 201 of 417