Tutorial by Examples: c

Want to create a controller? There is 2 ways of creating it: Manually (You will be forced to manually create Controller file in src/Controller) Baked (Running bin/cake bake controller %controllerName% command from CLI) If You want to create it manually, go to src/Controller folder and create ...
from selenium import webdriver driver = webdriver.Chrome() # Creates a new chromedriver instance driver.get("https://www.python.org/") # Go to https://www.python.org/ # Sends the text "python" to the text search box driver.find_element_by_id("id-search-field").s...
This is a basic example of a Selenium testcase using the python Unittest library from selenium import webdriver import unittest class SeleniumTest(Unittest.testcase): def setUp(self): self.driver = webdriver.Chrome() self.driver.implicitly_wait(30) def te...
from selenium import webdriver # Create a new webdriver driver = webdriver.Chrome() # Get a page that has a popup window (Use mouse to click "try it" button) driver.get("http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert") # Accept the opened alert driver.switch_t...
GRANT SELECT ON [dbo].[someTable] TO [aUser]; REVOKE SELECT ON [dbo].[someTable] TO [aUser]; --REVOKE SELECT [dbo].[someTable] FROM [aUser]; is equivalent DENY SELECT ON [dbo].[someTable] TO [aUser];
--implicitly map this user to a login of the same name as the user CREATE USER [aUser]; --explicitly mapping what login the user should be associated with CREATE USER [aUser] FOR LOGIN [aUser];
-- SQL 2005+ exec sp_addrolemember @rolename = 'myRole', @membername = 'aUser'; exec sp_droprolemember @rolename = 'myRole', @membername = 'aUser'; -- SQL 2008+ ALTER ROLE [myRole] ADD MEMBER [aUser]; ALTER ROLE [myRole] DROP MEMBER [aUser]; Note: role members can be any database-level pri...
In this example we have a service, let's call it search service that has a method called search() which will initiate a get request to a back end API. function SearchService($http) { const service = {}; service.search = function() { return $http({method: 'GET', url: `/api/s...
function calculatorService() { const service = {}; service.add = function(a,b) { return a + b } return service; } angular.module('app').factory('calculatorService', calculatorService); Testing describe('calculator service', function() { var calcula...
Files compressed by gzip can be directly concatenated into larger gzipped files. cat file1.gz file2.gz file3.gz > combined.gz This is a property of gzip that is less efficient than concatenating the input files and gzipping the result: cat file1 file2 file3 | gzip > combined.gz A compl...
The LayerMask structure is an interface that functions almost exactly like passing an integer to the function in question. However, its biggest benefit is allowing the user to select the layer in question from a drop-down menu in the inspector. using UnityEngine; class LayerMaskExample{ pub...
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...
from selenium import webdriver # Create a new cromedriver driver = webdriver.Chrome() # Go to www.google.com driver.get("https://www.google.com") # Saves a .png file with name my_screenshot_name to the directory that # you are running the program from. screenshot_name = "my_s...
Full official instructions can be found here. MacPorts Install MacPorts. Then, in the terminal execute: port install sbt Homebrew Install Homebrew. Then, in the terminal execute: brew install sbt Sources Download sbt All platforms (tgz) installation from SBT. sudo su cd /opt mkdir sbt...
The following example code computes the sum of 1+4(3+3^2+3^3+3^4+...+3^N) series using pow() family of standard math library. #include <stdio.h> #include <math.h> #include <errno.h> #include <fenv.h> int main() { double pwr, sum=0; int i, n; ...
scp command is used to securely copy a file to or from a remote destination. If the file is in current working directly only filename is sufficient else full path is required which included the remote hostname e.g. remote_user@some_server.org:/path/to/file Copy local file in your CWD to new direct...
Sometimes a build combines multiple source directories, each of which is their own 'project'. For instance, you might have a build structure like this: projectName/ build.sbt project/ src/ main/ ... test/ ... core/ src/ main/ ... test/ ... webapp/ src/ main/ ... test/ ... In t...
If one does not want to receive any alert for a specific host or service - at least momentarily - one can squelch it. alert thisis.down { macro = host.mymacro template = mytemplate $notes = This alert will... $metric = "avg:os.service.running{host=*,name=... warn = min( a($metri...
In Haskell, you can define any infix operator you like. For example, I could define the list-enveloping operator as (>+<) :: [a] -> [a] -> [a] env >+< l = env ++ l ++ env GHCi> "**">+<"emphasis" "**emphasis**" You should always give s...

Page 575 of 826