You can also use regular expressions to split a string. For example,
import re
data = re.split(r'\s+', 'James 94 Samantha 417 Scarlett 74')
print( data )
# Output: ['James', '94', 'Samantha', '417', 'Scarlett', '74']
You can get rid of manage.py and use the django-admin command instead. To do so, you will have to manually do what manage.py does:
Add your project path to your PYTHONPATH
Set the DJANGO_SETTINGS_MODULE
export PYTHONPATH="/home/me/path/to/your_project"
export DJANGO_SETTINGS_MODULE...
If you have a vsix file, you can install it by running the file.
Get the vsix file (this is the extension installer)
Run the file.
In the window that opens, confirm the installation.
To add annotations, hints, or exclude some code from being executed JavaScript provides two ways of commenting code lines
Single line Comment //
Everything after the // until the end of the line is excluded from execution.
function elementAt( event ) {
// Gets the element from Event coordinate...
It is not possible to use eval or exec to execute code from untrusted user securely. Even ast.literal_eval is prone to crashes in the parser. It is sometimes possible to guard against malicious code execution, but it doesn't exclude the possibility of outright crashes in the parser or the tokenizer....
In oracle, the difference (in days and/or fractions thereof) between two DATEs can be found using subtraction:
SELECT DATE '2016-03-23' - DATE '2015-12-25' AS difference FROM DUAL;
Outputs the number of days between the two dates:
DIFFERENCE
----------
89
And:
SELECT TO_DATE( '201...
Enum classes can also declare members (i.e. properties and functions). A semicolon (;) must be placed between the last enum object and the first member declaration.
If a member is abstract, the enum objects must implement it.
enum class Color {
RED {
override val rgb: Int = 0xFF0000
...
The routing configuration is included in your app/config/config.yml file, by default the app/config/routing.yml file.
From there you can link to your own routing configuration in a bundle
# app/config/routing.yml
app:
resource: "@AppBundle/Resources/config/routing.yml"
It migh...
The routing configuration is included in your app/config/config.yml file, by default the app/config/routing.yml file.
From there you can link to the controllers that have annotated routing configuration:
# app/config/routing.yml
app:
resource: "@AppBundle/Controller"
type: ...
In the simplest use-case, just navigate to the directory your file is in, and type:
pyinstaller myfile.py
Pyinstaller analyzes the file and creates:
A myfile.spec file in the same directory as myfile.py
A build folder in the same directory as myfile.py
A dist folder in the same directory as m...
You can use the .Net Math class to do calculations ([System.Math])
If you want to know which methods are available you can use:
[System.Math] | Get-Member -Static -MemberType Methods
Here are some examples how to use the Math class:
PS C:\> [System.Math]::Floor(9.42)
9
PS C:\> [System....
Any predicate function can be used as a spec. Here's a simple example:
(clojure.spec/valid? odd? 1)
;;=> true
(clojure.spec/valid? odd? 2)
;;=> false
the valid? function will take a spec and a value and return true if the value conforms to the spec and false otherwise.
One other inte...
You can use the ** keyword argument unpacking operator to deliver the key-value pairs in a dictionary into a function's arguments. A simplified example from the official documentation:
>>>
>>> def parrot(voltage, state, action):
... print("This parrot wouldn't", ac...
Node.js is built against modern versions of V8. By keeping up-to-date with the latest releases of this engine, we ensure new features from the JavaScript ECMA-262 specification are brought to Node.js developers in a timely manner, as well as continued performance and stability improvements.
All ECM...
For the character entity
character(len=5), parameter :: greeting = "Hello"
a substring may be referenced with the syntax
greeting(2:4) ! "ell"
To access a single letter it isn't sufficient to write
greeting(1) ! This isn't the letter "H"
but
greeting(1:...
The complex entity
complex, parameter :: x = (1., 4.)
has real part 1. and complex part 4.. We can access these individual components as
real(x) ! The real component
aimag(x) ! The complex component
x%re ! The real component
y%im ! The complex component
The x%.. form is new to F...
Sometimes what you want to do is just too complex for a filter or a simple_tag. Fow this you will need to create a compilation function and a renderer.
In this example we will create a template tag verbose_name with the following syntax:
ExampleDescription{% verbose_name obj %}Verbose name of a mo...
The process.env property returns an object containing the user environment.
It returns an object like this one :
{
TERM: 'xterm-256color',
SHELL: '/usr/local/bin/bash',
USER: 'maciej',
PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin',
PWD: '/Users/maciej',
EDITOR: 'vi...
There may be situations where you have setup a pool of MySQL connections, but you have a number of queries you would like to run in sequence:
SELECT 1;
SELECT 2;
You could just run then using pool.query as seen elsewhere, however if you only have one free connection in the pool you must wait un...
Loading the library
(ql:quickload "fiveam")
Define a test case
(fiveam:test sum-1
(fiveam:is (= 3 (+ 1 2))))
;; We'll also add a failing test case
(fiveam:test sum2
(fiveam:is (= 4 (+ 1 2))))
Run tests
(fiveam:run!)
which reports
Running test suite NIL
Running test...