Tutorial by Examples: ch

Many symbols and special characters are required while developing a web page in html, but as we know that sometimes the use of characters directly may interfere with the actual html code which have certain characters reserved and also certain characters being not available on keyboard. Thus, to avoi...
Pseudorandom Distribution Accorinding to this Stack Overflow answer, user CherryDT pointed out this code: set /a num=%random% %% 100 does not give a uniform distribution. The internal dynamic variable %random% does gives a uniform distribution, but the above code will not be a uniformed random...
Project build.gradle allprojects { repositories { jcenter() // Add this if you use Gradle 4.0+ google() // Add this if you use Gradle < 4.0 maven { url 'https://maven.google.com' } } } ext { archVersion = '1.0.0-alpha5' } Applic...
This example shows how to catch custom Exception class CustomError(Exception): pass try: raise CustomError('Can you catch me ?') except CustomError as e: print ('Catched CustomError :{}'.format(e)) except Exception as e: print ('Generic exception: {}'.format(e)) Output:...
From the Terminal command line Get the current URL from Safari osascript -e 'tell app "safari" to get the url of the current tab of window 1' Get the active URL in Google Chrome osascript -e 'tell app "google chrome" to get the url of the active tab of window 1'
Get the name of the web page in Safari osascript -e 'tell app "safari" to get the name of the current tab of window 1' Get the title of the web page in Google Chrome osascript -e 'tell app "google chrome" to get the title of the active tab of window 1'
ng-repeat is the built-in directive provided by AngularJS, mostly used for listing the array elements on UI dynamically as per the changes in our model. Official "ng-repeat" docs can be found at : https://docs.angularjs.org/api/ng/directive/ngRepeat Also the most common error faced whil...
In order to search for records in nedb, again we need to just pass the json containing the search criteria as a parameter to the find function of db object. db.find({ name: 'bigbounty' }, function (err, docs) { // docs is an array containing documents that have name as bigbounty // If no docu...
Many modern Image Processing algorithms use patches are their basic element to work on. For instance one could denoise patches (See BM3D Algorithm). Yet when building the image form the processed patches we have many results for the same pixel. One way to deal with it is taking the average (Empir...
Sometimes you'll need to execute synchronous code from within an asynchronous task. To do this, simply schedule a synchronous task from within the asynchronous block. Bukkit.getScheduler().runTaskTimerAsynchronously(VoidFlame.getPlugin(), () -> { Bukkit.getScheduler().runTask(VoidFlame.ge...
In this example we are going to implement spring-data-elasticsearch project to store POJO in elasticsearch. We will see a sample maven project which does the followings: Insert a Greeting(id, username, message) item on elasticsearch. Get All Greeting items which have been inserted. Update a Gr...
In this example we are going to see a maven based spring boot application which integrates spring-data-elasticsearch. Here, we will do the followings and see the respective code segments. Insert a Greeting(id, username, message) item on elasticsearch. Get all items from elasticsearch Update a s...
To remote tracking between local and deleted remote branches use git fetch -p you can then use git branch -vv to see which branches are no longer being tracked. Branches that are no longer being tracked will be in the form below, containing 'gone' branch 12345e6 [origin/bran...
The following method will take a second or two depending on your connection to retrieve a web page and count the text length. Whatever thread calls it will block for that period of time. Also it rethrows an exception which is useful later on. public static long blockingGetWebPageLength(String urlS...
(from official doc) fun main(args: Array<String>) { launch(CommonPool) { // create new coroutine in common thread pool delay(1000L) // non-blocking delay for 1 second (default time unit is ms) println("World!") // print after delay } println("He...
git diff-tree --no-commit-id --name-only -r COMMIT_ID
Suppose you’ve got a lot of commit against a project (here ulogd2, official branch is git-svn) and that you wan to send your patchset to the Mailling list [email protected]. To do so, just open a shell at the root of the git directory and use: git format-patch --stat -p --raw --signoff --subject...
Creates a scheduled task that executes immediately, then on start up to run C:\myscript.ps1 as SYSTEM $ScheduledTaskPrincipal = New-ScheduledTaskPrincipal -UserId "SYSTEM" -LogonType ServiceAccount $ScheduledTaskTrigger1 = New-ScheduledTaskTrigger -AtStartup $ScheduledTaskTrigger2 = New...
public static String convert(String str) { str = str.replaceAll("à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ", "a"); str = str.replaceAll("è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ", "e"); str = str.replaceAll("ì|í|ị|ỉ|ĩ", "i"); str = str.replaceAl...
Catch is a header only library that allows you to use both TDD and BDD unit test style. The following snippet is from the Catch documentation page at this link: SCENARIO( "vectors can be sized and resized", "[vector]" ) { GIVEN( "A vector with some items" ) { std::vector v( 5 ); ...

Page 108 of 109