Tutorial by Examples: ami

Assume having a method returning IEnumerable<T>, f.e. private IEnumerable<T> GetData() { try { // return results from database } catch(Exception exception) { throw; } } Creates an Observable and starts a method asynchronously. Sel...
In features/documentation.feature: Feature: Documentation Scenario: User views documentation When I go to the "Cucumber" documentation Then I should see the "Cucumber" documentation A minimal feature has a Feature line and a Scenario with one or more steps begi...
The importance of good naming, can be best illustrated by some bad examples: [Test] Test1() {...} //Cryptic name - absolutely no information [Test] TestFoo() {...} //Name of the function - and where can I find the expected behaviour? [Test] TestTFSid567843() {...} //Huh? You want me to lo...
Layout.xml <WebView android:id="@+id/WebViewToDisplay" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" ...
If different users need different datetime format then you may need to parse your incoming date string to actual date according to the format. In this case this snippet may help you. public class DateTimeBinder : DefaultModelBinder { public override object BindModel(ControllerContext control...
When using instances of QML files by directly declaring them, every property creates a binding. This is explained in the above examples. This is how you dynamically create components: var component = Qt.createComponent("Popup.qml"); var popup = component.createObject(parent, {"widt...
The following example is a very useful basis when you are trying to convert transaction data to un-pivoted data for BI/reporting reasons, where the dimensions which are to be un-pivoted can have a dynamic set of columns. For our example, we suppose that the raw data table contains employee assessme...
Suppose we want to have the following behaviour - We have a heading (say h3 element) and on clicking it, we want it to become an input box so that we can modify heading name. React makes this highly simple and intuitive using component states and if else statements. (Code explanation below) // I ha...
With Ruby you can modify the structure of the program in execution time. One way to do it, is by defining methods dynamically using the method method_missing. Let's say that we want to be able to test if a number is greater than other number with the syntax 777.is_greater_than_123?. # open Numeric...
Notice that if we consider the path (in order): (1,2,3,4,6,0,5,7) and the path (1,2,3,5,0,6,7,4) The cost of going from vertex 1 to vertex 2 to vertex 3 remains the same, so why must it be recalculated? This result can be saved for later use. Let dp[bitmask][vertex] represent the minimum c...
Sometimes you need to replace a value matching a pattern with a new value that's based on that specific match, making it impossible to predict the new value. For these types of scenarios, a MatchEvaluator can be very useful. In PowerShell, a MatchEvaluator is as simple as a scriptblock with a singl...
docker logs --follow <containerid> This tails the output of the running container. This is useful if you did not set up a logging driver on the docker daemon.
This example adds a new parameter to MyTestFunction if $SomeUsefulNumber is greater than 5. function MyTestFunction { [CmdletBinding(DefaultParameterSetName='DefaultConfiguration')] Param ( [Parameter(Mandatory=$true)][int]$SomeUsefulNumber ) DynamicParam {...
This examples shows how to build a JavaFX application, where the language can be switched dynamically while the application is running. These are the message bundle files used in the example: messages_en.properties: window.title=Dynamic language change button.english=English button.german=Germa...
When mapping our entities to database table names we rely on a @Table annotation. But if we have a naming convention for our database table names, we can implement a custom physical naming strategy in order to tell hibernate to calculate table names based on the names of the entities, without explic...
You can execute SQL query as different user using AS USER = 'name of database user' EXEC(N'SELECT * FROM product') AS USER = 'dbo' SQL query will be executed under dbo database user. All permission checks applicable to dbo user will be checked on SQL query.
Dynamic queries are SET @sql = N'SELECT COUNT(*) FROM AppUsers WHERE Username = ''' + @user + ''' AND Password = ''' + @pass + '''' EXEC(@sql) If value of user variable is myusername'' OR 1=1 -- the following query will be executed: SELECT COUNT(*) FROM AppUsers WHERE Username = 'myusername...
In order to avoid injection and escaping problems, dynamic SQL queries should be executed with parameters, e.g.: SET @sql = N'SELECT COUNT(*) FROM AppUsers WHERE Username = @user AND Password = @pass EXEC sp_executesql @sql, '@user nvarchar(50), @pass nvarchar(50)', @username, @password Second ...
Samtools can be used to convert between sam and bam: -b indicates that the input file will be in BAM format -S indicates that the stdout should be in SAM format samtools view -sB thing.bam > thing.sam And to convert between sam and bam: samtools view thing.sam > thing.bam samtools ...
For example, we need to create two visualisations, "Before" and "After", and use dynamic filter for the date of the split. Let's say our query is called table. Add an additional date table with possible dates of the split. Add a slicer control with the table added ...

Page 7 of 11