Tutorial by Examples: ad

Inline style You can manipulate the inline CSS style of an HTML element by simply reading or editing its style property. Assume the following element: <div id="element_id" style="color:blue;width:200px;">abc</div> With this JavaScript applied: var element = doc...
package { import flash.display.Sprite; import flash.events.Event; public class Viewport extends Sprite { /** Constructor */ public function Viewport() { super(); // Listen for added to stage event addEventListener(Event.ADDED_TO_STAGE, addedToStageHandle...
Create a DataFrame from multiple lists by passing a dict whose values lists. The keys of the dictionary are used as column labels. The lists can also be ndarrays. The lists/ndarrays must all be the same length. import pandas as pd # Create DF from dict of lists/ndarrays df = pd.DataFrame({'...
Function level annotations help IDEs identify return values or potentially dangerous code /** * Adds two numbers together. * * @param Int $a First parameter to add * @param Int $b Second parameter to add * @return Int */ function sum($a, $b) { return (int) $a + $b; } /** * ...
File level metadata applies to all the code within the file and should be placed at the top of the file: <?php /** * @author John Doe ([email protected]) * @copyright MIT */
If a class extends another class and would use the same metadata, providing it @inheritDoc is a simple way for use the same documentation. If multiple classes inherit from a base, only the base would need to be changed for the children to be affected. abstract class FooBase { /** * @par...
Maybe is used to represent possibly empty values - similar to null in other languages. Usually it is used as the output type of functions that can fail in some way. Consider the following function: halve :: Int -> Maybe Int halve x | even x = Just (x `div` 2) | odd x = Nothing Think ...
The dexcount plugin counts methods and class resource count after a successful build. Add the plugin in the app/build.gradle: apply plugin: 'com.android.application' buildscript { repositories { mavenCentral() // or jcenter() } dependencies { classpath 'com.ge...
Html5-Canvas ... Is an Html5 element. Is supported in most modern browsers (Internet Explorer 9+). Is a visible element that is transparent by default Has a default width of 300px and a default height of 150px. Requires JavaScript because all content must be programmatically added to the Canv...
The URLVariables class allows you to define data to be sent along with a URLRequest. Example: var variables:URLVariables = new URLVariables(); variables.prop = "hello"; variables.anotherProp = 10; var request:URLRequest = new URLRequest('http://someservice.com'); request.data = v...
function randomAngleRadians():Number { return Math.random() * Math.PI * 2; } Example outputs: 5.490068569213088 3.1984284719180205 4.581117863808207
Simple example of how to create a custom plugin and DSL for your gradle project. This sample uses one of the three possible ways of creating plugins. The three ways are: inline buildSrc standalone plugins This example shows creating a plugin from the buildSrc folder. This sample will crea...
Detailed instructions on getting openerp set up or installed in Debian/Ubuntu. To install from source code, we need Python 2.7, Git and a PostgreSQL database: $ sudo apt-get install git python-pip python2.7-dev -y $ sudo apt-get install postgresql -y $ sudo su -c "createuser -s $(whoami)&qu...
from pandas_datareader import data # Only get the adjusted close. aapl = data.DataReader("AAPL", start='2015-1-1', end='2015-12-31', data_source='yahoo')['Adj Close'] >>> aapl.plot(title='AAPL Adj. C...
Using the Control.Invoke() method you may move the execution of a method or function from a background thread to the thread that the control was created on, which is usually the UI (User Interface) thread. By doing so your code will be queued to run on the control's thread instead, which removes the...
Dim inputCode As Integer = Console.Read() Console.Read() awaits input from the user and, upon receipt, returns an integer value corresponding with the character code of the entered character. If the input stream is ended in some way before input can be obtained, -1 is returned instead.
Dim inputChar As ConsoleKeyInfo = Console.ReadKey() Console.ReadKey() awaits input from the user and, upon receipt, returns an object of class ConsoleKeyInfo, which holds information relevant to the character which the user provided as input. For detail regarding the information provided, visit t...
You can easily add a breakpoint to your code by clicking on the grey column to the left of the line of your VBA code where you want execution to stop. A red dot appears in the column and the breakpoint code is also highlighted in red. You can add multiple breakpoints throughout your code and resumi...
A commonly used CSS/Javascript library is Bootstrap. To install it into your Aurelia CLI driven application first you need to install it using Npm. npm install bootstrap --save Because Bootstrap has a hard dependency on jQuery, we need to make sure we also have jQuery installed: npm install jqu...
use lib 'includes'; use MySuperCoolModule; use lib 'includes'; adds the relative directory includes/ as another module search path in @INC. So assume that you have a module file MySyperCoolModule.pm inside includes/, which contains: package MySuperCoolModule; If you want, you can group as ma...

Page 19 of 114