Tutorial by Examples: dynamic

Dynamic SQL enables us to generate and run SQL statements at run time. Dynamic SQL is needed when our SQL statements contains identifier that may change at different compile times. Simple Example of dynamic SQL: CREATE PROC sp_dynamicSQL @table_name NVARCHAR(20), @col_name NVARCHAR(2...
Important: Using the dynamic configuration files (.htaccess) is a big performance hit. When you have access to the static configuration file (httpd.conf or something similar) you should use that instead. In the static configuration file, allow dynamic configuration files to override "Filei...
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...
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...
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 ...
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 ...
To query a field which name is contained in a variable, use the field function. some_field = :id some_value = 10 from p in Post, where: field(p, ^some_field) == ^some_value
If you have email column you can mask it with email() mask: ALTER TABLE Company ALTER COLUMN Email ADD MASKED WITH (FUNCTION = 'email()') When user tries to select emails from Company table, he will get something like the following values: [email protected] [email protected] [email protected]
If you're creating an image, decoding an image, or resizing an image to fit the large notification image area, you can get the correct pixel dimensions like so: Resources resources = context.getResources(); int width = resources.getDimensionPixelSize(android.R.dimen.notification_large_icon_width)...
WKWebView resizes the fonts on web content so that a full-sized web page will fit on the device's form factor. If you want the web text in both portrait and landscape to be similar in size to the user's preferred reading size, you need to set it explicitly. Swift // build HTML header for dynamic t...

Page 4 of 6