Tutorial by Examples: cs

Three main functions available (description from man pages): fromfile - A highly efficient way of reading binary data with a known data-type, as well as parsing simply formatted text files. Data written using the tofile method can be read using this function. genfromtxt - Load data from a t...
CSS Here are the minimum CSS rules that Google advises you to use, in a separate CSS file, or within an HTML style tag, e.g. <style type="text/css">...</style>. html, body { height: 100%; margin: 0; padding: 0; } #map { height: 400px; } HTML Goo...
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...
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 ...
HTML DOM is Expensive Each web page is represented internally as a tree of objects. This representation is called Document Object Model. Moreover, it is a language-neutral interface that allows programming languages (such as JavaScript) to access the HTML elements. In other words The HTML DOM...
Insert the analytics function within index.js function analytics(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a...
This example uses the map format introduced in Erlang/OTP 18.0. %% A module implementing a supervisor usually has a name ending with `_sup`. -module(my_sup). -behaviour(supervisor). %% API exports -export([start_link/0]). %% Behaviour exports -export([init/1]). start_link() -> ...
Framebuffer is a type of buffer which stores color values, depth and stencil information of pixels in memory. When you draw something in OpenGL the output is stored in the default framebuffer and then you actually see the color values of this buffer on screen. You can also make your own framebuffer ...
This Example assumes you setup as explained in Example: Setting Up Environment for aurelia-cli Explained of this document. Creating a new project In main host os, open terminal (Mac OS in my case) $cd /path/to/project/vagrant $vagrant up (Launches VM GUI) Log into VM via UI U...
Small, simple csv files can be built using just a text editor, because a CSV file is simply text. If you have spreadsheet software available these are usually an easy way to open and save CSV files. Reading and writing them, or otherwise processing their contents is done more efficiently using the ...
Note that the allowDiskUse: true option is optional but will help mitigate out of memory issues as this aggregation can be a memory intensive operation if your collection size is large - so i recommend to always use it. var duplicates = []; db.transactions.aggregate([ { $group: { _id: { c...
Here is an example of a basic page using the Materialize CSS framework which incorporates the grid system and materialboxed. <!DOCTYPE html> <html> <head> <title>Materializecss Example webpage</title> <!--Import Google Icon Font--> <link href="ht...
Creating a new array is slightly confusing, as there is no real identifier for an array in awk. So, an array cannot really be initialised with our AWK code. An array in awk is associative, meaning that any string or number can be a key. This means that the array is more like a key-value pair dictio...
const correctness is the practice of designing code so that only code that needs to modify an instance is able to modify an instance (i.e. has write access), and conversely, that any code that doesn't need to modify an instance is unable to do so (i.e. only has read access). This prevents the insta...
Quicksort is a sorting algorithm that picks an element ("the pivot") and reorders the array forming two partitions such that all elements less than the pivot come before it and all elements greater come after. The algorithm is then applied recursively to the partitions until the list is so...
The Problem: Given a set of items where each item contains a weight and value, determine the number of each to include in a collection so that the total weight is less than or equal to a given limit and the total value is as large as possible. Pseudo code for Knapsack Problem Given: Values(arr...
You can technically access the Google Analytics APIs using any programing language that can handle a HTTP Post or HTTP Get request. That being said, Google has also created a number of official standard client libraries to help you with this. Using a standard client library for your chosen programm...
DBCC statements act as Database Console Commands for SQL Server. To get the syntax information for the specified DBCC command use DBCC HELP (...) statement. The following example returns all DBCC statements for which Help is available: DBCC HELP ('?'); The following example returns options f...

Page 17 of 24