Tutorial by Examples

In pygame you usually use Surfaces to represent the appearance of objects, and Rectangles to represent their positions. A Surface is like a blank sheet of paper which contain colors or images. There are two ways to create a Surface: blank from scratch or by loading an image. Create a Surface To cr...
There are kinds 3 of transparency supported in pygame: colorkeys, Surface alphas, and per-pixel alphas. Colorkeys Makes a color fully transparent, or more accurately, making a color simply not be blit. If you have an image with a black rect inside you could set a colorkey to prevent the black colo...
You can always run JavaScript from inside itself, although this is strongly discouraged due to the security vulnerabilities it presents (see Remarks for details). To run JavaScript from inside JavaScript, simply use the below function: eval("var a = 'Hello, World!'");
You can set a variable to something with the eval() function by using something similar to the below code: var x = 10; var y = 20; var a = eval("x * y") + "<br>"; var b = eval("2 + 2") + "<br>"; var c = eval("x + 17") + "<br&...
This example implements a custom binding that toggles visibility (similar to the existing visible binding), but will utilize jQuery's fading API to animate the transition from visible to invisible. Custom binding definition: //Add a custom binding called "fadeVisible" by adding it as a p...
DIVIDE a INTO b c d Data item b, c, and d are changed as b/a, c/a and d/a. DIVIDE a INTO b GIVING c Data item c is changed as b/a. DIVIDE a BY b GIVING c Data item c is changed as a/b. DIVIDE a INTO b GIVING q REMAINDER r Data items q and r are set with results of b/a DIVIDE a BY b G...
DISPLAY "An error occurred with " tracked-resource UPON SYSERR DISPLAY A, B, C UPON CONSOLE DISPLAY group-data UPON user-device ON EXCEPTION WRITE device-exception-notice NOT ON EXCEPTION WRITE device-usage-log END-DISPLAY UPON CONSOLE is a default, ra...
EVALUATE a ALSO b ALSO TRUE WHEN 1 ALSO 1 THRU 9 ALSO c EQUAL 1 PERFORM all-life WHEN 2 ALSO 1 THRU 9 ALSO c EQUAL 2 PERFORM life WHEN 3 THRU 9 ALSO 1 ALSO c EQUAL 9 PERFORM disability WHEN OTHER PERFORM invalid END-EVALUATE
PERFORM VARYING counter FROM 1 BY 1 UNTIL counter > 10 IF debug-override THEN EXIT PERFORM IF counter = 5 THEN EXIT PERFORM CYCLE PERFORM some-miracle END-PERFORM
This example is a custom binding that replaces text whenever an input value is updated. In this case, spaces will be replaced with "+". It is intended to be used alongside the existing value binding, and shows binding with an object literal. Sample markup with the replaceText binding: &l...
index.html <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="Content-Security-Policy" content="default-src *; script-src 'self' 'unsafe-inline' 'unsafe-eval' *; style-src 'self' 'unsafe-inline' *"/> ...
Using the IntDef#flag() attribute set to true, multiple constants can be combined. Using the same example in this topic: public abstract class Car { //Define the list of accepted constants @IntDef(flag=true, value={MICROCAR, CONVERTIBLE, SUPERCAR, MINIVAN, SUV}) //Tell the compi...
Detailed instructions on getting opencart set up or installed.
CELERY Installation - pip install django-celery Add Basic project structure. - src/ - bin/celery_worker_start # will be explained later on - logs/celery_worker.log - stack/__init __.py - stack/celery.py - stack/settings.py - stack/urls.py - manage.py ...
Create a script to start celery worker. Insert your script within your app. For example: stack/bin/celery_worker_start #!/bin/bash NAME="StackOverflow Project - celery_worker_start" PROJECT_DIR=/home/stackoverflow/apps/proj/proj/ ENV_DIR=/home/stackoverflow/apps/proj/env/...
.loc uses labels to read and write data. Let's setup a DataFrame: df = pd.DataFrame({'one': [1, 2, 3, 4, 5], 'two': [6, 7, 8, 9, 10], }, index=['a', 'b', 'c', 'd', 'e']) Then we can print the DataFrame to have a look at the shape: print df This will o...
Step 1: Go to root directory of project and open command line prompt cordova build --release android This generates an unsigned apk under \platforms\android\build\outputs\apk with the name android-release-unsigned.apk Step 2: Key generation for obtaining signed apk Syntax: keytool -genkey ...

iOS

Step 1: Create a build.json file in the root directory of the project. Sample of build.json { "ios": { "debug": { "codeSignIdentity": "iPhone Developer", "provisioningProfile": "your-developer-provisioning-profile-UUID-he...
Objects that are not built-in To print the source code of a Python object use inspect. Note that this won't work for built-in objects nor for objects defined interactively. For these you will need other methods explained later. Here's how to print the source code of the method randint from the ran...
Given an interface: public interface Logger { void log(String message); } Rather than usage: public void doJob(Logger logger) { if (logger != null) { logger.log("[doJob]:Step 1"); } // ... if (logger != null) { logger.log("[doJob]:Step 2&q...

Page 953 of 1336