Tutorial by Examples: cs

The Protractor API allows CSS element locators to use the jQuery-like shortcut notation $(). Normal CSS Element Locator: element(by.css('h1.documentation-text[ng-bind="title"]')); element(by.css('[ng-click="submit"])); Shortcut $() CSS Element Locator: $('h1.documentatio...
raw_data = {'first_name': ['John', 'Jane', 'Jim'], 'last_name': ['Doe', 'Smith', 'Jones'], 'department': ['Accounting', 'Sales', 'Engineering'],} df = pd.DataFrame(raw_data,columns=raw_data.keys()) df.to_csv('data_file.csv')
CSS can be applied in multiple places: inline (Node.setStyle) in a stylesheet to a Scene as user agent stylesheet (not demonstrated here) as "normal" stylesheet for the Scene to a Node This allows to change styleable properties of Nodes. The following example demonst...
From MSDN: An enumeration type (also named an enumeration or an enum) provides an efficient way to define a set of named integral constants that may be assigned to a variable. Essentially, an enum is a type that only allows a set of finite options, and each option corresponds to a number. By d...
Once connected you can publish messages by calling the ISubscriber.Publish method: // grab an instance of an ISubscriber var subscriber = connection.GetSubscriber(); // publish a message to the 'chat' channel subscriber.Publish("chat", "This is a message") Consumers can ...
Backbone requires Underscore and (optionally) jQuery - for DOM manipulation (using Backbone.View) and RESTful persistence. The quickest way to get up and running with Backbone is to create an index.html file with simple script tags in the HTML <head>: <html> <head> ...
You can specify a column that contains dates so pandas would automatically parse them when reading from the csv pandas.read_csv('data_file.csv', parse_dates=['date_column'])
In the HTTP server code (e.g. server.js): const EventEmitter = require('events') const serverEvents = new EventEmitter() // Set up an HTTP server const http = require('http') const httpServer = http.createServer((request, response) => { // Handler the request... // Then emit an event...
Event Emitters are built into Node, and are for pub-sub, a pattern where a publisher will emit events, which subscribers can listen and react to. In Node jargon, publishers are called Event Emitters, and they emit events, while subscribers are called listeners, and they react to the events. // Requ...
Given the following CSV file: Id,Name 1,"Joel" 2,"Adam" 3,"Ryan" 4,"Matt" You can read the data with the following script: #r "FSharp.Data.dll" open FSharp.Data type PeopleDB = CsvProvider<"people.csv"> let people = Pe...
Scala has a special type of function called a partial function, which extends normal functions -- meaning that a PartialFunction instance can be used wherever Function1 is expected. Partial functions can be defined anonymously using case syntax also used in pattern matching: val pf: PartialFunction...
// Obtain an instance of JavaScript engine ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("JavaScript"); //String to be evaluated String str = "3+2*4+5"; //Value after doing Arithmetic operation with operator preceden...
Suppose you have a simple Customer model: class Customer(models.Model): first_name = models.CharField(max_length=255) last_name = models.CharField(max_length=255) is_premium = models.BooleanField(default=False) You register it in the Django admin and add search field by first_name...
Generics are placeholders for types, allowing you to write flexible code that can be applied across multiple types. The advantage of using generics over Any is that they still allow the compiler to enforce strong type-safety. A generic placeholder is defined within angle brackets <>. Generic...
Suppose we have a list of teams, named like this: Team A, Team B, ..., Team Z. Then: Team [AB]: This will match either either Team A or Team B Team [^AB]: This will match any team except Team A or Team B We often need to match characters that "belong" together in some context or ano...
pd.read_excel('path_to_file.xls', sheetname='Sheet1') There are many parsing options for read_excel (similar to the options in read_csv. pd.read_excel('path_to_file.xls', sheetname='Sheet1', header=[0, 1, 2], skiprows=3, index_col=0) # etc.
State in React components is essential to manage and communicate data in your application. It is represented as a JavaScript object and has component level scope, it can be thought of as the private data of your component. In the example below we are defining some initial state in the constructor f...
BeautifulSoup has a limited support for CSS selectors, but covers most commonly used ones. Use select() method to find multiple elements and select_one() to find a single element. Basic example: from bs4 import BeautifulSoup data = """ <ul> <li class="item&quo...
Records are an extension of sum algebraic data type that allow fields to be named: data StandardType = StandardType String Int Bool --standard way to create a sum type data RecordType = RecordType { -- the same sum type with record syntax aString :: String , aNumber :: Int , isTrue :...
Spacemacs is a popular starter kit for emacs. It features a robust package management solution and centers around emacs's popular evil mode, which provides many of the keybindings from vim. It is called Spacemacs because it uses the Space key as the leader key (the idea is similar to Vim's leader k...

Page 4 of 24