Tutorial by Examples: f

UITextView has extra paddings by default. Sometimes it's annoying especially if you want to measure some text without view instance and place them at some area precisely. Do this to remove such paddings. messageTextView.textContainerInset = UIEdgeInsetsZero messageTextView.textContainer.lineFragm...

For

For-loops iterate over an iterating collection. An iterating collection is any class which structurally unifies with Iterator<T> or Iterable<T> types from the Haxe standard library. A for-loop which logs numbers in range 0 to 10 (exclusive) can be written as follows: for (i in 0...10) ...
The flow or execution of a loop can be controlled by use of break and continue expressions. Break break exits the current loop. In case the loop is nested inside another loop, the parent loop is unaffected. for (i in 0...10) { for (j in 0...10) { if (j == 5) break; trace(i,...
Pre -Requsite: Download Visual Studio IDE Create a new project Install specflow visual studio integration, Nunit Adapter & Nunit framework Download specflow for visual studio as shown below
In Visual Studio go to your Solution Explorer then click on Project you will be adding model Right mouse. Choose ADO.NET Entity Data Model Then choose Generate from database and click Next in next window click New Connection... and point to the database you want to generate model from (Could be M...
We can use $q to defer operations to the future while having a pending promise object at the present, by using $q.defer we create a promise that will either resolve or reject in the future. This method is not equivalent of using the $q constructor, as we use $q.defer to promisify an existing routin...
Let's say we want to change main loop, only for specific taxonomy, or post type. Targeting only main loop on book post type archive page. add_action( 'pre_get_posts', 'my_callback_function' ); function my_callback_function( $query ) { if( !$query->is_main_query() || is_admin() ) return;...
add_action( 'pre_get_posts', 'single_category' ); function single_category( $query ) { if( !$query->is_main_query() || is_admin() ) return; $query->set( 'cat', '1' ); return; }
Sometimes you would like to change main WordPress query. Filter pre_get_posts is the way to go. For example using pre_get_posts you can tell main loop to show only 5 posts. Or to show posts only from one category, or excluding any category etc. add_action( 'pre_get_posts', 'my_callback_function' ...
add_action( 'pre_get_posts', 'single_category_exclude' ); function single_category_exclude( $query ) { if( !$query->is_main_query() || is_admin() ) return; $query->set( 'cat', '-1' ); return; }
All we need to do is to use set() method of $query object. It takes two arguments, first what we want to set and second what value to set. add_action( 'pre_get_posts', 'change_posts_per_page' ); function change_posts_per_page( $query ) { if( !$query->is_main_query() || is_admin() ) retu...
Let's say you need to check if an email address appears in a long list of email addresses. Use the MATCH function to return the row number on which the email address can be found. If there is no match, the function returns an #N/A error. =MATCH(F2,$D$2:$D$200,0) The value you're retrieving ...
DECLARE @xmlIN XML = '<TableData> <aaa Main="First"> <row name="a" value="1" /> <row name="b" value="2" /> <row name="c" value="3" /> </aaa> <aaa Main="Second"> &l...
As-per the Haskell 2010 Language Specification, the following are standard IO functions available in Prelude, so no imports are required to use them. getChar :: IO Char - read a Char from stdin -- MyChar.hs main = do myChar <- getChar print myChar -- In your shell runhaskell MyChar...
Encoding //convert the image to NSData first let imageData:NSData = UIImagePNGRepresentation(image)! // convert the NSData to base64 encoding let strBase64:String = imageData.base64EncodedStringWithOptions(.Encoding64CharacterLineLength) Decoding let dataDecoded:NSData = NSData(base64Encoded...
Haskell supports many forms of concurrency and the most obvious being forking a thread using forkIO. The function forkIO :: IO () -> IO ThreadId takes an IO action and returns its ThreadId, meanwhile the action will be run in the background. We can demonstrate this quite succinctly using ghci: ...
To insert data retrieved from SQL query (single or multiple rows) INSERT INTO Table_name (FirstName, LastName, Position) SELECT FirstName, LastName, 'student' FROM Another_table_name Note, 'student' in SELECT is a string constant that will be inserted in each row. If required, you can select a...
Following query will provide information about TempDb usage. Analyzing the counts you can identify which thing is impacting TempDb SELECT SUM (user_object_reserved_page_count)*8 as usr_obj_kb, SUM (internal_object_reserved_page_count)*8 as internal_obj_kb, SUM (version_store_reserved_page_cou...
using System; using System.Linq; using System.Security.Cryptography; namespace YourCryptoNamespace { /// <summary> /// Salted password hashing with PBKDF2-SHA1. /// Compatibility: .NET 3.0 and later. /// </summary> /// <remarks>See http://crackstation.net/h...
When a single parameter is passed to the .attr() function it returns the value of passed attribute on the selected element. Syntax: $([selector]).attr([attribute name]); Example: HTML: <a href="/home">Home</a> jQuery: $('a').attr('href'); Fetching data attributes: jQue...

Page 198 of 457