Reptile • Sort of like REPL
As we build our programming language we'll need some way to interact with it. C uses a compiler, where you can change the program, recompile and run it. It'd be good if we could do something better, and interact with the language dynamically. Then we test its behaviour under a number of conditions very quickly. For this we can build something called an interactive prompt.
This is a program that prompts the user for some input, and when supplied with it, replies back with some message. Using this will be the easiest way to test our programming language and see how it acts. This system is also called a REPL, which stands for read-evaluate-print loop. It is a common way of interacting with a programming language which you may have used before in languages such as Python.
Before building a full REPL we'll start with something simpler. We are going to make a system that prompts the user, and echoes any input straight back. If we make this we can later extend it to parse the user input and evaluate it, as if it were an actual Lisp program.
For the basic setup we want to write a loop which repeatedly writes out a message, and then waits for some input. To get user input we can use a function called fgets
, which reads any input up until a new line. We need somewhere to store this user input. For this we can declare a constantly sized input buffer.
Once we have this user input stored we can then print it back to the user using a function called printf
.
#include <stdio.h>
/* Declare a buffer for user input of size 2048 */
static char input[2048];
int main(int argc, char** argv) {
/* Print Version and Exit Information */
puts("Lispy Version <IP_ADDRESS>.1");
puts("Press Ctrl+c to Exit\n");
/* In a never ending loop */
while (1) {
/* Output our prompt */
fputs("lispy> ", stdout);
/* Read a line of user input of maximum size 2048 */
fgets(input, 2048, stdin);
/* Echo input back to user */
printf("No you're a %s", input);
}
return 0;
}
What is that text in light green?
The above code contains comments. These are sections of the code between /*
*/
symbols, which are ignored by the compiler, but are used to inform the person reading what is going on. Take notice of them!
Let's go over this program in a little more depth.
The line static char input[2048];
declares a global array of 2048 characters. This is a reserved block of data we can access anywhere from our program. In it we are going to store the user input which is typed into the command line. The static
keyword makes this variable local to this file, and the [2048]
section is what declares the size.
We write an infinite loop using while (1)
. In a conditional block 1
always evaluates to true. Therefore commands inside this loop will run forever.
To output our prompt we use the function fputs
. This is a slight variation on puts
which does not append a newline character. We use the fgets
function for getting user input from the command line. Both of these functions require some file to write to, or read from. For this we supply the special variables stdin
and stdout
. These are declared in <stdio.h>
and are special file variables representing input to, and output from, the command line. When passed this variable the fgets
function will wait for a user to input a line of text, and when it has it will store it into the input
buffer, including the newline character. So that fgets
does not read in too much data we also must also supply the size of the buffer 2048
.
To echo the message back to the user we use the function printf
. This is a function that provides a way of printing messages consisting of several elements. It matches arguments to patterns in the given string. For example in our case we can see the %s
pattern in the given string. This means that it will be replaced by whatever argument is passed in next, interpreted as a string.
For more information on these different patterns please see the documentation on printf
.
How am I meant to know about functions like fgets
and printf
?
It isn't immediately obvious how to know about these standard functions, and when to use them. When faced with a problem it takes experience to know when it has been solved for you by library functions.
Luckily C has a very small standard library and almost all of it can be learnt in practice. If you want to do something that seems quite basic, or fundamental, it is worth looking at the reference documentation for the standard library and checking if there are any functions included that do what you want.
You can compile this with the same command as was used in the second chapter.
cc -std=c99 -Wall prompt.c -o prompt
After compiling this you should try to run it. You can use Ctrl+c
to quit the program when you are done. If everything is correct your program should run something like this.

No you're a Stop being so rude!
lispy>
If you're working on Linux or Mac you'll notice some weird behaviour when you use the arrow keys to attempt to edit your input.
Lispy Version <IP_ADDRESS>.3
Press Ctrl+c to Exit
lispy> hel^[[D^[[C
Using the arrow keys is creating these weird characters ^[[D
or ^[[C
, rather than moving the cursor around in the input. What we really want is to be able to move around on the line, deleting and editing the input in case we make a mistake.
On Windows this behaviour is the default. On Linux and Mac it is provided by a library called editline
. On Linux and Mac we need to replace our calls to fputs
and fgets
with calls to functions this library provides.
If you're developing on Windows and just want to get going, feel free to skip to the end of this chapter as the next few sections may not be relevant.
The library editline
provides two functions we are going to use called readline
and add_history
. This first function, readline
is used to read input from some prompt, while allowing for editing of that input. The second function add_history
lets us record the history of inputs so that they can be retrieved with the up and down arrows.
We replace fputs
and fgets
with calls to these functions to get the following.
#include <stdio.h>
#include <stdlib.h>
#include <editline/readline.h>
#include <editline/history.h>
int main(int argc, char** argv) {
/* Print Version and Exit Information */
puts("Lispy Version <IP_ADDRESS>.1");
puts("Press Ctrl+c to Exit\n");
/* In a never ending loop */
while (1) {
/* Output our prompt and get input */
char* input = readline("lispy> ");
/* Add input to history */
add_history(input);
/* Echo input back to user */
printf("No you're a %s\n", input);
/* Free retrieved input */
free(input);
}
return 0;
}
We have included a few new headers. There is #include <stdlib.h>
, which gives us access to the free
function used later on in the code. We have also added #include <editline/readline.h>
and #include <editline/history.h>
which give us access to the editline
functions, readline
and add_history
.
Instead of prompting, and getting input with fgets
, we do it in one go using readline
. The result of this we pass to add_history
to record it. Finally we print it out as before using printf
.
Unlike fgets
, the readline
function strips the trailing newline character from the input, so we need to add this to our printf
function. We also need to delete the input given to us by the readline
function using free
. This is because unlike fgets
, which writes to some existing buffer, the readline
function allocates new memory when it is called. When to free memory is something we cover in depth in later chapters.
If you try to compile this right away with the previous command you'll get an error. This is because you first need to install the editline
library on your computer.
fatal error: editline/readline.h: No such file or directory #include <editline/readline.h>
On Mac the editline
library comes with Command Line Tools. Instructions for installing these can be found in Chapter 2. You may still get an error about the history header not being found. In this case remove the line #include <editline/history.h>
, as this header may not be required.
On Linux you can install editline with sudo apt-get install libedit-dev
. On Fedora you can use the command su -c "yum install libedit-dev*"
Once you have installed editline you can try to compile it again. This time you'll get a different error.
undefined reference to `readline'
undefined reference to `add_history'
This means that you haven't linked your program to editline
. This linking process allows the compiler to directly embed calls to editline
in your program. You can make it link by adding the flag -ledit
to your compile command, just before the output flag.
cc -std=c99 -Wall prompt.c -ledit -o prompt
Run it and check that now you can edit inputs as you type them in.
It's still not working!
Some systems might have slight variations on how to install, include, and link to editline
. For example on Arch linux the editline history header is histedit.h
. If you are having trouble search online and see if you can find distribution specific instructions on how to install and use the editline
library. If that fails search for instructions on the readline
library. This is a drop-in replacement for editline. On Mac it can be installed using HomeBrew or MacPorts.
For such a small project it might be okay that we have to program differently depending on what operating system we are using, but if I want to send my source code to a friend on different operating system to give me a hand with the programming, it is going to cause problems. In an ideal world I'd wish for my source code to be able to compile no matter where, or on what computer, it is being compiled. This is a general problem in C, and it is called portability. There is not always an easy or correct solution.
Octopus • Sort of like Octothorpe
But C does provide a mechanism to help, called the preprocessor.
The preprocessor is a program that runs before the compiler. It has a number of purposes, and we've been actually using it already without knowing. Any line that starts with a octothorpe #
character (hash to you and me) is a preprocessor command. We've been using it to include header files, giving us access to functions from the standard library and others.
Another use of the preprocessor is to detect which operating system the code is being compiled on, and to use this to emit different code.
This is exactly how we are going to use it. If we are running Windows we're going to let the preprocessor emit code with some fake readline
and add_history
functions I've prepared, otherwise we are going to include the headers from editline
and use these.
To declare what code the compiler should emit we can wrap it in #ifdef
, #else
, and #endif
preprocessor statements. These are like an if
function that happens before the code is compiled. All the contents of the file from the first #ifdef
to the next #else
are used if the condition is true, otherwise all the contents from the #else
to the final #endif
are used instead. By putting these around our fake functions, and our editline headers, the code that is emitted should compile on Windows, Linux or Mac.
#include <stdio.h>
#include <stdlib.h>
/* If we are compiling on Windows compile these functions */
#ifdef _WIN32
#include <string.h>
static char buffer[2048];
/* Fake readline function */
char* readline(char* prompt) {
fputs(prompt, stdout);
fgets(buffer, 2048, stdin);
char* cpy = malloc(strlen(buffer)+1);
strcpy(cpy, buffer);
cpy[strlen(cpy)-1] = '\0';
return cpy;
}
/* Fake add_history function */
void add_history(char* unused) {}
/* Otherwise include the editline headers */
#else
#include <editline/readline.h>
#include <editline/history.h>
#endif
int main(int argc, char** argv) {
puts("Lispy Version <IP_ADDRESS>.1");
puts("Press Ctrl+c to Exit\n");
while (1) {
/* Now in either case readline will be correctly defined */
char* input = readline("lispy> ");
add_history(input);
printf("No you're a %s\n", input);
free(input);
}
return 0;
}


Example: Screen resolution, mouse coordinates only defined once for the whole program and therefore same for each pixel. Same for time. By agreement, in this environment all uniform variables have u_ prefix – u_time, u_mouse.
By default uniform values are not normalized! Ex: u_mouse can have values ranging from 0 to 1440 for instance. That's the reasoning for passing screen resolution as uniform – u_resolution
gl_FragCoord is vec2 that describes fragment position on the screen space. Values go from 0 to screen width and from 0 to screen height.


Upload un/stiched panoramic 360° from Gear 360 Camera.
If you already have panoramic-ready pictures feel free to opt-out of auto-conversion.
Expect a maximum processing time of 30 seconds per picture if you're auto-converting now.
Remember the order on which you submited them, as it'll be used for the next step.


pymatgen.io.qchem_deprecated module¶
-
class
QcInput
(jobs)[source]¶ Bases:
monty.json.MSONable
An object representing a multiple step QChem input file.
Parameters: jobs – The QChem jobs (List of QcInput object)
-
class
QcOutput
(filename)[source]¶ Bases:
object
-
final_energy
¶
-
final_structure
¶
-
kcal_per_mol_2_eV
= 0.043363¶
-
-
class
QcTask
(molecule=None, charge=None, spin_multiplicity=None, jobtype='SP', title=None, exchange='HF', correlation=None, basis_set='6-31+G*', aux_basis_set=None, ecp=None, rem_params=None, optional_params=None, ghost_atoms=None, method=None)[source]¶ Bases:
monty.json.MSONable
An object representing a QChem input file.
Parameters: - molecule – The input molecule. If it is None of string “read”, QChem will read geometry from checkpoint file. If it is a Molecule object, QcInput will convert it into Cartesian coordinates. Valid values: pymatgen Molecule object, “read”, None Defaults to None.
- charge (int) – Charge of the molecule. If None, charge on molecule is used. Defaults to None.
- spin_multiplicity (int) – Spin multiplicity of molecule. Defaults to None, which means that the spin multiplicity is set to 1 if the molecule has no unpaired electrons and to 2 if there are unpaired electrons.
- jobtype (str) – The type the QChem job. “SP” for Single Point Energy, “opt” for geometry optimization, “freq” for vibrational frequency.
- title (str) – Comments for the job. Defaults to None. Which means the $comment section will be discarded.
- exchange (str) – The exchange methods of the theory. Examples including: “B” (in pure BLYP), “PW91”, “PBE”, “TPSS”. Defaults to “HF”. This parameter can also be common names of hybrid functionals, such as B3LYP, TPSSh, XYGJOS. In such cases, the correlation parameter should be left as None.
- correlation (str) – The correlation level of the theory. Example including: “MP2”, “RI-MP2”, “CCSD(T)”, “LYP”, “PBE”, “TPSS” Defaults to None.
- basis_set (str/dict) – The basis set. If it is a dict, each element can use different basis set.
- aux_basis_set (str/dict) – Auxiliary basis set. For methods, like RI-MP2, XYG3, OXYJ-OS, auxiliary basis set is required. If it is a dict, each element can use different auxiliary basis set.
- ecp – Effective core potential (ECP) to be used. If it is a dict, each element can use different ECP.
- rem_params (dict) – The parameters supposed to write in the $rem section. Dict of key/value pairs. Example: {“scf_algorithm”: “diis_gdm”, “scf_max_cycles”: 100}
- optional_params (dict) – The parameter for keywords other than $rem section. Dict of key/value pairs. Example: {“basis”: {“Li”: “cc-PVTZ”, “B”: “aug-cc-PVTZ”, “F”: “aug-cc-PVTZ”} “ecp”: {“Cd”: “srsc”, “Br”: “srlc”}}
- ghost_atom (list) – List of ghost atoms indices. Indices start from 0. The ghost atom will be represented in of the form of @element_symmbol
-
alternative_keys
= {'job_type': 'jobtype', 'scf_max_cycles': 'max_scf_cycles', 'symmetry_ignore': 'sym_ignore'}¶
-
alternative_values
= {'frequency': 'freq', 'optimization': 'opt'}¶
-
classmethod
from_string
(contents)[source]¶ Creates QcInput from a string.
Parameters: contents – String representing a QChem input file. Returns: QcInput object
-
molecule
¶
-
optional_keywords_list
= {'alist', 'aux_basis', 'basis', 'basis2', 'cdft', 'ecp', 'efp_fragments', 'efp_params', 'empirical_dispersion', 'external_charges', 'force_field_params', 'intracule', 'isotopes', 'localized_diabatization', 'multipole_field', 'nbo', 'occupied', 'opt', 'pcm', 'pcm_solvent', 'plots', 'qm_atoms', 'solvent', 'svp', 'svpirf', 'swap_occupied_virtual', 'van_der_waals', 'velocity', 'xc_functional'}¶
-
scale_geom_opt_threshold
(gradient=0.1, displacement=0.1, energy=0.1)[source]¶ Adjust the convergence criteria of geometry optimization.
Parameters: - gradient – the scale factor for gradient criteria. If less than 1.0, you are tightening the threshold. The base value is 300 × 10E−6
- displacement – the scale factor for atomic displacement. If less then 1.0, you are tightening the threshold. The base value is 1200 × 10E−6
- energy – the scale factor for energy change between successive iterations. If less than 1.0, you are tightening the threshold. The base value is 100 × 10E−8.
-
set_dft_grid
(radical_points=128, angular_points=302, grid_type='Lebedev')[source]¶ Set the grid for DFT numerical integrations.
Parameters: - radical_points – Radical points. (Integer)
- angular_points – Angular points. (Integer)
- grid_type – The type of of the grid. There are two standard grids: SG-1 and SG-0. The other two supported grids are “Lebedev” and “Gauss-Legendre”
-
set_geom_max_iterations
(iterations)[source]¶ Set the max iterations of geometry optimization.
Parameters: - iterations – the maximum iterations of geometry optimization.
- (Integer) –
-
set_geom_opt_coords_type
(coords_type='internal_switch')[source]¶ Set the coordinates system used in geometry optimization. “cartesian” — always cartesian coordinates. “internal” — always internal coordinates. “internal-switch” — try internal coordinates first, if fails, switch to cartesian coordinates. “z-matrix” — always z-matrix coordinates. “z-matrix-switch” — try z-matrix first, if fails, switch to cartesian coordinates.
Parameters: coords_type – The type of the coordinates. (str)
-
set_geom_opt_use_gdiis
(subspace_size=None)[source]¶ Use GDIIS algorithm in geometry optimization.
Parameters: subspace_size – The size of the DIIS subsapce. None for default value. The default value is min(NDEG, NATOMS, 4) NDEG = number of moleculardegrees of freedom.
-
set_integral_threshold
(thresh=12)[source]¶ Cutoff for neglect of two electron integrals. 10−THRESH (THRESH <= 14). In QChem, the default values are: 8 For single point energies. 10 For optimizations and frequency calculations. 14 For coupled-cluster calculations.
Parameters: thresh – The exponent of the threshold. (Integer)
-
set_max_num_of_scratch_files
(num=16)[source]¶ In QChem, the size of a single scratch is limited 2GB. By default, the max number of scratich is 16, which is cooresponding to 32GB scratch space. If you want to use more scratch disk space, you need to increase the number of scratch files:
Parameters: num – The max number of the scratch files. (Integer)
-
set_memory
(total=None, static=None)[source]¶ Set the maxium allowed memory.
Parameters: - total – The total memory. Integer. Unit: MBytes. If set to None, this parameter will be neglected.
- static – The static memory. Integer. Unit MBytes. If set to None, this parameterwill be neglected.
-
set_scf_algorithm_and_iterations
(algorithm='diis', iterations=50)[source]¶ Set algorithm used for converging SCF and max number of SCF iterations.
Parameters: - algorithm – The algorithm used for converging SCF. (str)
- iterations – The max number of SCF iterations. (Integer)
-
set_scf_convergence_threshold
(exponent=8)[source]¶ SCF is considered converged when the wavefunction error is less than 10**(-exponent). In QChem, the default values are: 5 For single point energy calculations. 7 For geometry optimizations and vibrational analysis. 8 For SSG calculations
Parameters: exponent – The exponent of the threshold. (Integer)
-
set_scf_initial_guess
(guess='SAD')[source]¶ Set initial guess method to be used for SCF
Parameters: guess – The initial guess method. (str)
-
set_velocities
(velocities)[source]¶ Parameters: (au) (velocities) – list of list of atom velocities Returns:
-
use_cosmo
(dielectric_constant=78.4)[source]¶ Set the solvent model to COSMO.
Parameters: dielectric_constant – the dielectric constant for the solvent.
-
use_pcm
(pcm_params=None, solvent_key='solvent', solvent_params=None, radii_force_field=None)[source]¶ Set the solvent model to PCM. Default parameters are trying to comply to gaussian default value
Parameters: - pcm_params (dict) – The parameters of “$pcm” section.
- solvent_key (str) – for versions < 4.2 the section name is “pcm_solvent”
- solvent_params (dict) – The parameters of solvent_key section
- radii_force_field (str) – The force fied used to set the solute radii. Default to UFF.
-
xyz_patt
= re.compile('^(\\w+)[\\s,]+([\\d\\.eE\\-]+)[\\s,]+([\\d\\.eE\\-]+)[\\s,]+([\\d\\.eE\\-]+)[\\-\\.\\s,\\w.]*$')¶
-
zmat_patt
= re.compile('^(\\w+)*([\\s,]+(\\w+)[\\s,]+(\\w+))*[\\-\\.\\s,\\w]*$')¶


Job values. Income, destination, source, etc.
Initialise a job object
In-game time to the moment the job delivery window close
The RemainingDeliveryTime is negative if the delivery is to late
Remaining in-game time until the job delivery window close
Id of the destination city for internal use by code. Limited to C-identifier characters and dots.
Name of the destination city for display purposes. Localized using the current in-game language.
Id of the destination company for internal use by code. Limited to C-identifier characters and dots.
Name of the destination company for display purposes. Localized using the current in-game language.
Id of the source city for internal use by code. Limited to C-identifier characters and dots.
Name of the source city for display purposes. Localized using the current in-game language.
Id of the source company for internal use by code. Limited to C-identifier characters and dots.
Name of the source company for display purposes. Localized using the current in-game language.
Reward in internal game-specific currency.


The templates in this document use terms from several code systems. These vocabularies are defined in various supporting specifications and may be maintained by other bodies, as is the case for the LOINC and SNOMED CT vocabularies.
Note that value-set identifiers (e.g., ValueSet 2.16.840.1.1138<IP_ADDRESS> Observation Interpretation (HL7) DYNAMIC) do not appear in CDA submissions; they tie the conformance requirements of an implementation guide to the appropriate code system for validation.
Value-set bindings adhere to HL7 Vocabulary Working Group best practices, and include both a conformance verb (SHALL, SHOULD, MAY, etc.) and an indication of DYNAMIC vs. **STATIC ** binding. Value-set constraints can be static, meaning that they are bound to a specified version of a value set, or dynamic, meaning that they are bound to the most current version of the value set. A simplified constraint, used when the binding is to a single code, includes the meaning of the code, as follows.
Binding to a Single Code
The notation conveys the actual code (11450-4), the code’s displayName (Problem List), the OID of the codeSystem from which the code is drawn (2.16.840.1.113883.6.1), and the codeSystemName (LOINC).
HL7 Data Types Release 1 requires the codeSystem attribute unless the underlying data type is “Coded Simple” or “CS”, in which case it is prohibited. The displayName and the codeSystemName are optional, but recommended, in all cases.
The above example would be properly expressed as follows.
XML Expression of a Single-code Binding

A full discussion of the representation of vocabulary is outside the scope of this document; for more information, see the HL7 V3 Normative Edition 20105 sections on Abstract Data Types and XML Data Types R1.
Value set tables are presented below the first template that uses that value set; links are provided in subsequent templates that use the same value set. The value set tables include the value set identifier, a description, a link (where appropriate), and a list of codes in the value set. Ellipses in the last row of value-set members shown indicate that the list is an excerpt and the complete source must be accessed to see all members. Where the table is an excerpt and no link is provided, the full set of values are contained in the hai_voc.xls spreadsheet included with this package.
Example Value Set Table
| Code | Code System | Code System OID | Print Name |
|---|---|---|---|
| Value Set: Referral Types 2.16.840.1.1138<IP_ADDRESS>.56 A value set of SNOMED CT codes descending from "3457005" patient referral (procedure). Value Set Source: http://vsac.nlm.nih.gov |
|||
| 44383000 | SNOMED CT | 2.16.840.1.113883.6.96 | Patient referral for consultation |
| 391034007 | SNOMED CT | 2.16.840.1.113883.6.96 | Refer for falls assessment (procedure) |
| 86395003 | SNOMED CT | 2.16.840.1.113883.6.96 | Patient referral for family planning (procedure) |
| 306106002 | SNOMED CT | 2.16.840.1.113883.6.96 | Referral to intensive care service (procedure) |
| 306140002 | SNOMED CT | 2.16.840.1.113883.6.96 | Referral to clinical oncology service (procedure) |
| 396150002 | SNOMED CT | 2.16.840.1.113883.6.96 | Referral for substance abuse (procedure) |
| ... |
5 HL7 Version 3 Interoperability Standards, *Normative Edition 2010. http://www.hl7.org/memonly/downloads/v3edition.cfm - V32010


Switch to English
|
Switch to Thai
Property Search
Location
:
Budget
(with placeholder text):
Min Beds
:
0
1
2
3
4
5
6+
Property Type
:
Show All
House
Town House
Apartment
Condominium
Commercial
Office
Storage
Land
Added In
:
Anytime
Last 24 Hours
Last 3 Days
Last Week
Last Month

Last Month Moo Anytime
:
Last Month
Moo
Anytime
<input type="button">:
<button>:
Search...
<reset>:
Search...
Click to test alert text:
Click to test loading dynamic content:


Giles and Olivia
Code Name: They don't get one
Seasons Together: 4, maybe more?
Relationship In-A-Nutshell:
Not too much to say about this one. Olivia came on the scene in season four (episode 10, Hush, to be exact because it is the best episode!) She is Bristish as well. But I mean nothing too special here. She is also later mentioned as Giles' girlfriend and appears in another episode in a dream sequence. She lives in England, so pretty long distance. She was also kind of put off by the demons and such that Giles deals with. That's it. Nothing special. Giles really only had one great love and it was Jenny. I would rate this relationship 1 out of 5 stakes, just because it wasn't developed at all. But I probably wouldn't have liked it because no one could ever replace Jenny. And again I say, thanks Joss...


| | |
- pexpect.exceptions.ExceptionPexpect(exceptions.Exception)
-
- psftp.psftp.ExceptionPsftpInteraction
- psftp.psftp.ExceptionPsftpLocal
- pexpect.pty_spawn.spawn(pexpect.spawnbase.SpawnBase)
-
- psftp.psftp.psftp
class psftp(pexpect.pty_spawn.spawn) |
| |
This class extends pexpect.spawn to specialize setting up sftp
connections. This add methods for login, logout, interactive commands and
expecting the shell prompt. It does various tricky things to handle many
situations in the sftp login process and interactive commands process.
For example, if the session is you first login, the psftp automatically
accepts the remote certificate, or if you have public key authenticate
setup then pxssh won't wait for the password prompt.
Example that runs a few commands on a remote server and prints the result::
import psftp
import getpass
try:
s = psftp.sftp()
hostname = raw_input('hostname: ')
username = raw_input('username: ')
password = getpass.getpass('password: ')
s.login(hostname, username, password)
s.pwd()
s.lpwd()
s.lls()
s.ls()
s.put('./hello.txt')
s.ls()
except:
pass
Example showing how to specify ssh options::
import psftp
s = psftp.psftp(options={
"StrictHostKeyChecking": "no",
"UserKnownHostsFile": "/dev/null"}
)
# ...
Note that if you have ssh-agent running while doing development with psftp
then this can lead to a lot of confusion. Many X display managers (xdm,
gdm, kdm, etc.) will automatically start a GUI agent. You may see a GUI
dialog box popup asking for a password during development. You should turn
off any key agents during testing. The 'force_password' attribute will turn
off public key authentication. This will only work if the remote SSH server
is configured to allow password logins. Example of useing 'force_password'
attribute::
s = psftp.psftp()
s.force_password = True
hostname = raw_input('hostname: ')
username = raw_input('username: ')
password = getpass.getpass('password: ')
s.login (hostname, username, password) |
| |
- Method resolution order:
- psftp
- pexpect.pty_spawn.spawn
- pexpect.spawnbase.SpawnBase
- __builtin__.object
Methods defined here:
- __init__(self, timeout=60, maxread=100, searchwindowsize=None, logfile=None, cwd=None, env=None, ignore_sighup=True, echo=True, options={}, encoding=None, codec_errors='strict')
- cd(self, path)
- Change remote directory to path.
- chgrp(self, grp, path)
- Change group of file path to grp. path may contain glob(3)
characters and may match multiple files. grp must be a numeric GID.
- chmod(self, mode, path)
- Change permissions of file path to mode. path may contain glob(3)
characters and may match multiple files.
- df(self, path='', options='')
- Display usage information for the filesystem holding the current
directory (of path if specified).
*attention* This function is only supported on servers that implement
the<EMAIL_ADDRESS>extension.
:options: every char is one of 'hi'.
-h the capacity information will be displayed using human-readable
suffixes.
-i display of inode information in addition to capacity information.
:return: tuple, the first value is the item list
the second is the value list
- get(self, remote_path, local_path='', options='')
- Retrieve the remote-path and store it on the local machine. If the
local path name is not specified, it is given the same name it has on
the remote machine. rempte-path may contain glob(3) characters and may
match multiple files. If it does and local-path is specified, then
local-path must specify a directory.
:options: every char is one of 'afPpr'.
-a attempt to resume partial transfers of existing files.
Note that resumption assumes that any partial copy of the local file
matches the remote copy. If the remote file contents differ from the
partial local copy then the resultant file is likely to corrupt.
-f fsync(2) will be called after the file transfer has completed
to flush the file to disk.
-P,-p full file permissions and access times are copied too.
-r directories will be copied recursively. Note that sftp
does not follow symbolic links when performing recursive transfers.
- help(self)
- Display help text.
- lcd(self, path)
- Change local directory to path
- lls(self, path='', options='')
- Display local directory listing of either path or current directory
if path is not specified. options may contain any flags supported by
the local system's ls(1) command. path may contain glob(3) characters
and may match multiple files.
:returns: lines of output
- lmkdir(self, path)
- Create local directory specified by path.
- ln(self, oldpath, newpath, options='')
- Create a link from oldpath to newpath in remote server.
:options: every char is one of 's'.
-s created link is a symbolic link, otehrwise it's a hard link.
- local_command(self, command)
- Execute command in local shell
- login(self, server, username, password='', terminal_type='ansi', login_timeout=10, port=None, ssh_key=None, quiet=True, check_local_ip=True)
- This logs the user into the given server.
- logout(self)
- Sends exit to the remote shell.
If there are stopped jobs then this automatically sends exit twice.
- lpwd(self)
- Get local working directory.
- ls(self, path='', options='')
- Display a remote directory listing of either path or the current
directory if path is not specified. path may contain glob(3) characters
and may match multiple files.
:options: every char is one of '1afhlnrSt'.
-1 Produce single columnar output.
-a List files begining with a dot ('.').
-f Do not sort the listing. The default sort order is lexicographical.
-h When used with a long format option, use unit suffixes: Byte,
Kilobyte, Megabyte, Gigabyte, Terabyte, Petabyte, and Exabyte in
order to reduce the number of digits to four or fewer using powers
of 2 for sizes (K=1024, M=1048576, etc.).
-l Display additional details includeing permissions and ownership
information.
-n Produce a long listing with user and group information presented
numerically.
-r Reverse the sort order of the listing.
-S Sort the listing by file size.
-t Sort the listing by last modification time.
:return: lines of output
- lumask(self, umask)
- Set localumask to umask
- mkdir(self, path)
- Create remote directory specified by path.
- progress(self)
- Toggle display of progress meter.
- prompt(self, timeout=-1)
- Match the next shell prompt.
This is little more than a short-cut to the
:meth:`~pexpect.spawn.expect` method.
Note that if you called :meth:`login` with
Calling :meth:`prompt` will erase the contents of the :attr:`before`
attribute even if no prompt is ever matched. If timeout is not given or
it is set to -1 then self.timeout is used.
:return: True if the shell prompt was matched, False if the timeout was
reached.
- put(self, local_path, remote_path='', options='')
- Upload local-path and store it on the remote machine. If the remote
path name is not specified, it is given the same name it has on the
local machine. local-path may contain glob(3) characters and may match
multiple files. If it does and remote-path is specified, then
remote-path speciff a directory.
:options: every char is one of 'afPpr'.
-a attempt to resume partial transfers of existing files.
Note that resumption assumes that any partial copy of the remote file
matches the local copy. If the local file contents differ from the
remote local copy then the resultant file is likely to the corrupt.
-f a request will be send to the server to call fsync(2) after the
file has been transferred. Note that this is only supported by servers
that implement the<EMAIL_ADDRESS>extension.
-P,-p full file permissions and access times are copied too.
-r directories will be copied recursively. Note that sftp
does not follow symbolic links when performing recursive transfers.
- pwd(self)
- Get remote working directory.
- reget(self, remote_path, local_path='', options='')
- Resume download of remote-path.
Equivalent to get with the -a flag set.
:options: every char is one of 'Ppr'.
-P,-p full file permissions and access times are copied too.
-r directories will be copied recursively. Note that sftp
does not follow symbolic links when performing recursive transfers.
- rename(self, oldpath, newpath)
- Rename remote file from oldpath to newpath
- reput(self, remote_path, local_path='', options='')
- Resume upload of local_path.
Equivalent to put with the -a flag set.
:options: every char is one of '1afhlnrSt'.
-P,-p full file permissions and access times are copied too.
-r directories will be copied recursively. Note that sftp
does not follow symbolic links when performing recursive transfers.
- rm(self, path)
- Delete remote file specified by path
- rmdir(self, path)
- Remote remote directory specified by path.
- symlink(self, oldpath, newpath)
- Create a symbolic link from oldpath to newpath.
- version(self)
- Display the sftp protocol version.
Methods inherited from pexpect.pty_spawn.spawn:
- __str__(self)
- This returns a human-readable string that represents the state of
the object.
- close(self, force=True)
- This closes the connection with the child application. Note that
calling close() more than once is valid. This emulates standard Python
behavior with files. Set force to True if you want to make sure that
the child is terminated (SIGKILL is sent if the child ignores SIGHUP
and SIGINT).
- eof(self)
- This returns True if the EOF exception was ever raised.
- getecho(self)
- This returns the terminal echo mode. This returns True if echo is
on or False if echo is off. Child applications that are expecting you
to enter a password often set ECHO False. See waitnoecho().
Not supported on platforms where ``isatty()`` returns False.
- getwinsize(self)
- This returns the terminal window size of the child tty. The return
value is a tuple of (rows, cols).
- interact(self, escape_character='\x1d', input_filter=None, output_filter=None)
- This gives control of the child process to the interactive user (the
human at the keyboard). Keystrokes are sent to the child process, and
the stdout and stderr output of the child process is printed. This
simply echos the child stdout and child stderr to the real stdout and
it echos the real stdin to the child stdin. When the user types the
escape_character this method will return None. The escape_character
will not be transmitted. The default for escape_character is
entered as ``Ctrl - ]``, the very same as BSD telnet. To prevent
escaping, escape_character may be set to None.
If a logfile is specified, then the data sent and received from the
child process in interact mode is duplicated to the given log.
You may pass in optional input and output filter functions. These
functions should take a string and return a string. The output_filter
will be passed all the output from the child process. The input_filter
will be passed all the keyboard input from the user. The input_filter
is run BEFORE the check for the escape_character.
Note that if you change the window size of the parent the SIGWINCH
signal will not be passed through to the child. If you want the child
window size to change when the parent's window size changes then do
something like the following example::
import pexpect, struct, fcntl, termios, signal, sys
def sigwinch_passthrough (sig, data):
s = struct.pack("HHHH", 0, 0, 0, 0)
a = struct.unpack('hhhh', fcntl.ioctl(sys.stdout.fileno(),
termios.TIOCGWINSZ , s))
global p
p.setwinsize(a[0],a[1])
# Note this 'p' global and used in sigwinch_passthrough.
p = pexpect.spawn('/bin/bash')
signal.signal(signal.SIGWINCH, sigwinch_passthrough)
p.interact()
- isalive(self)
- This tests if the child process is running or not. This is
non-blocking. If the child was terminated then this will read the
exitstatus or signalstatus of the child. This returns True if the child
process appears to be running or False if not. It can take literally
SECONDS for Solaris to return the right status.
- isatty(self)
- This returns True if the file descriptor is open and connected to a
tty(-like) device, else False.
On SVR4-style platforms implementing streams, such as SunOS and HP-UX,
the child pty may not appear as a terminal device. This means
methods such as setecho(), setwinsize(), getwinsize() may raise an
IOError.
- kill(self, sig)
- This sends the given signal to the child application. In keeping
with UNIX tradition it has a misleading name. It does not necessarily
kill the child unless you send the right signal.
- read_nonblocking(self, size=1, timeout=-1)
- This reads at most size characters from the child application. It
includes a timeout. If the read does not complete within the timeout
period then a TIMEOUT exception is raised. If the end of file is read
then an EOF exception will be raised. If a logfile is specified, a
copy is written to that log.
If timeout is None then the read may block indefinitely.
If timeout is -1 then the self.timeout value is used. If timeout is 0
then the child is polled and if there is no data immediately ready
then this will raise a TIMEOUT exception.
The timeout refers only to the amount of time to read at least one
character. This is not affected by the 'size' parameter, so if you call
read_nonblocking(size=100, timeout=30) and only one character is
available right away then one character will be returned immediately.
It will not wait for 30 seconds for another 99 characters to come in.
This is a wrapper around os.read(). It uses select.select() to
implement the timeout.
- send(self, s)
- Sends string ``s`` to the child process, returning the number of
bytes written. If a logfile is specified, a copy is written to that
log.
The default terminal input mode is canonical processing unless set
otherwise by the child process. This allows backspace and other line
processing to be performed prior to transmitting to the receiving
program. As this is buffered, there is a limited size of such buffer.
On Linux systems, this is 4096 (defined by N_TTY_BUF_SIZE). All
other systems honor the POSIX.1 definition PC_MAX_CANON -- 1024
on OSX, 256 on OpenSolaris, and 1920 on FreeBSD.
This value may be discovered using fpathconf(3)::
>>> from os import fpathconf
>>> print(fpathconf(0, 'PC_MAX_CANON'))
256
On such a system, only 256 bytes may be received per line. Any
subsequent bytes received will be discarded. BEL (``''``) is then
sent to output if IMAXBEL (termios.h) is set by the tty driver.
This is usually enabled by default. Linux does not honor this as
an option -- it behaves as though it is always set on.
Canonical input processing may be disabled altogether by executing
a shell, then stty(1), before executing the final program::
>>> bash = pexpect.spawn('/bin/bash', echo=False)
>>> bash.sendline('stty -icanon')
>>> bash.sendline('base64')
>>> bash.sendline('x' * 5000)
- sendcontrol(self, char)
- Helper method that wraps send() with mnemonic access for sending control
character to the child (such as Ctrl-C or Ctrl-D). For example, to send
Ctrl-G (ASCII 7, bell, '')::
child.sendcontrol('g')
See also, sendintr() and sendeof().
- sendeof(self)
- This sends an EOF to the child. This sends a character which causes
the pending parent output buffer to be sent to the waiting child
program without waiting for end-of-line. If it is the first character
of the line, the read() in the user program returns 0, which signifies
end-of-file. This means to work as expected a sendeof() has to be
called at the beginning of a line. This method does not send a newline.
It is the responsibility of the caller to ensure the eof is sent at the
beginning of a line.
- sendintr(self)
- This sends a SIGINT to the child. It does not require
the SIGINT to be the first character on a line.
- sendline(self, s='')
- Wraps send(), sending string ``s`` to child process, with
``os.linesep`` automatically appended. Returns number of bytes
written. Only a limited number of bytes may be sent for each
line in the default terminal mode, see docstring of :meth:`send`.
- setecho(self, state)
- This sets the terminal echo mode on or off. Note that anything the
child sent before the echo will be lost, so you should be sure that
your input buffer is empty before you call setecho(). For example, the
following will work as expected::
p = pexpect.spawn('cat') # Echo is on by default.
p.sendline('1234') # We expect see this twice from the child...
p.expect(['1234']) # ... once from the tty echo...
p.expect(['1234']) # ... and again from cat itself.
p.setecho(False) # Turn off tty echo
p.sendline('abcd') # We will set this only once (echoed by cat).
p.sendline('wxyz') # We will set this only once (echoed by cat)
p.expect(['abcd'])
p.expect(['wxyz'])
The following WILL NOT WORK because the lines sent before the setecho
will be lost::
p = pexpect.spawn('cat')
p.sendline('1234')
p.setecho(False) # Turn off tty echo
p.sendline('abcd') # We will set this only once (echoed by cat).
p.sendline('wxyz') # We will set this only once (echoed by cat)
p.expect(['1234'])
p.expect(['1234'])
p.expect(['abcd'])
p.expect(['wxyz'])
Not supported on platforms where ``isatty()`` returns False.
- setwinsize(self, rows, cols)
- This sets the terminal window size of the child tty. This will cause
a SIGWINCH signal to be sent to the child. This does not change the
physical window size. It changes the size reported to TTY-aware
applications like vi or curses -- applications that respond to the
SIGWINCH signal.
- terminate(self, force=False)
- This forces a child process to terminate. It starts nicely with
SIGHUP and SIGINT. If "force" is True then moves onto SIGKILL. This
returns True if the child was terminated. This returns False if the
child could not be terminated.
- wait(self)
- This waits until the child exits. This is a blocking call. This will
not read any data from the child, so this will block forever if the
child has unread output and has terminated. In other words, the child
may have printed output then called exit(), but, the child is
technically still alive until its output is read by the parent.
This method is non-blocking if :meth:`wait` has already been called
previously or :meth:`isalive` method returns False. It simply returns
the previously determined exit status.
- waitnoecho(self, timeout=-1)
- This waits until the terminal ECHO flag is set False. This returns
True if the echo mode is off. This returns False if the ECHO flag was
not set False before the timeout. This can be used to detect when the
child is waiting for a password. Usually a child application will turn
off echo mode when it is waiting for the user to enter a password. For
example, instead of expecting the "password:" prompt you can wait for
the child to set ECHO off::
p = pexpect.spawn('ssh<EMAIL_ADDRESS>p.waitnoecho()
p.sendline(mypassword)
If timeout==-1 then this method will use the value in self.timeout.
If timeout==None then this method to block until ECHO flag is False.
- write(self, s)
- This is similar to send() except that there is no return value.
- writelines(self, sequence)
- This calls write() for each element in the sequence. The sequence
can be any iterable object producing strings, typically a list of
strings. This does not add line separators. There is no return value.
Data descriptors inherited from pexpect.pty_spawn.spawn:
- flag_eof
Data and other attributes inherited from pexpect.pty_spawn.spawn:
- use_native_pty_fork = True
Methods inherited from pexpect.spawnbase.SpawnBase:
- __enter__(self)
- # For 'with spawn(...) as child:'
- __exit__(self, etype, evalue, tb)
- __iter__(self)
- This is to support iterators over a file-like object.
- compile_pattern_list(self, patterns)
- This compiles a pattern-string or a list of pattern-strings.
Patterns must be a StringType, EOF, TIMEOUT, SRE_Pattern, or a list of
those. Patterns may also be None which results in an empty list (you
might do this if waiting for an EOF or TIMEOUT condition without
expecting any pattern).
This is used by expect() when calling expect_list(). Thus expect() is
nothing more than::
cpl = self.compile_pattern_list(pl)
return self.expect_list(cpl, timeout)
If you are using expect() within a loop it may be more
efficient to compile the patterns first and then call expect_list().
This avoid calls in a loop to compile_pattern_list()::
cpl = self.compile_pattern_list(my_pattern)
while some_condition:
...
i = self.expect_list(cpl, timeout)
...
- expect(self, pattern, timeout=-1, searchwindowsize=-1, async=False)
- This seeks through the stream until a pattern is matched. The
pattern is overloaded and may take several types. The pattern can be a
StringType, EOF, a compiled re, or a list of any of those types.
Strings will be compiled to re types. This returns the index into the
pattern list. If the pattern was not a list this returns index 0 on a
successful match. This may raise exceptions for EOF or TIMEOUT. To
avoid the EOF or TIMEOUT exceptions add EOF or TIMEOUT to the pattern
list. That will cause expect to match an EOF or TIMEOUT condition
instead of raising an exception.
If you pass a list of patterns and more than one matches, the first
match in the stream is chosen. If more than one pattern matches at that
point, the leftmost in the pattern list is chosen. For example::
# the input is 'foobar'
index = p.expect(['bar', 'foo', 'foobar'])
# returns 1('foo') even though 'foobar' is a "better" match
Please note, however, that buffering can affect this behavior, since
input arrives in unpredictable chunks. For example::
# the input is 'foobar'
index = p.expect(['foobar', 'foo'])
# returns 0('foobar') if all input is available at once,
# but returs 1('foo') if parts of the final 'bar' arrive late
When a match is found for the given pattern, the class instance
attribute *match* becomes an re.MatchObject result. Should an EOF
or TIMEOUT pattern match, then the match attribute will be an instance
of that exception class. The pairing before and after class
instance attributes are views of the data preceding and following
the matching pattern. On general exception, class attribute
*before* is all data received up to the exception, while *match* and
*after* attributes are value None.
When the keyword argument timeout is -1 (default), then TIMEOUT will
raise after the default value specified by the class timeout
attribute. When None, TIMEOUT will not be raised and may block
indefinitely until match.
When the keyword argument searchwindowsize is -1 (default), then the
value specified by the class maxread attribute is used.
A list entry may be EOF or TIMEOUT instead of a string. This will
catch these exceptions and return the index of the list entry instead
of raising the exception. The attribute 'after' will be set to the
exception type. The attribute 'match' will be None. This allows you to
write code like this::
index = p.expect(['good', 'bad', pexpect.EOF, pexpect.TIMEOUT])
if index == 0:
do_something()
elif index == 1:
do_something_else()
elif index == 2:
do_some_other_thing()
elif index == 3:
do_something_completely_different()
instead of code like this::
try:
index = p.expect(['good', 'bad'])
if index == 0:
do_something()
elif index == 1:
do_something_else()
except EOF:
do_some_other_thing()
except TIMEOUT:
do_something_completely_different()
These two forms are equivalent. It all depends on what you want. You
can also just expect the EOF if you are waiting for all output of a
child to finish. For example::
p = pexpect.spawn('/bin/ls')
p.expect(pexpect.EOF)
print p.before
If you are trying to optimize for speed then see expect_list().
On Python 3.4, or Python 3.3 with asyncio installed, passing
``async=True`` will make this return an :mod:`asyncio` coroutine,
which you can yield from to get the same result that this method would
normally give directly. So, inside a coroutine, you can replace this code::
index = p.expect(patterns)
With this non-blocking form::
index = yield from p.expect(patterns, async=True)
- expect_exact(self, pattern_list, timeout=-1, searchwindowsize=-1, async=False)
- This is similar to expect(), but uses plain string matching instead
of compiled regular expressions in 'pattern_list'. The 'pattern_list'
may be a string; a list or other sequence of strings; or TIMEOUT and
EOF.
This call might be faster than expect() for two reasons: string
searching is faster than RE matching and it is possible to limit the
search to just the end of the input buffer.
This method is also useful when you don't want to have to worry about
escaping regular expression characters that you want to match.
Like :meth:`expect`, passing ``async=True`` will make this return an
asyncio coroutine.
- expect_list(self, pattern_list, timeout=-1, searchwindowsize=-1, async=False)
- This takes a list of compiled regular expressions and returns the
index into the pattern_list that matched the child output. The list may
also contain EOF or TIMEOUT(which are not compiled regular
expressions). This method is similar to the expect() method except that
expect_list() does not recompile the pattern list on every call. This
may help if you are trying to optimize for speed, otherwise just use
the expect() method. This is called by expect().
Like :meth:`expect`, passing ``async=True`` will make this return an
asyncio coroutine.
- expect_loop(self, searcher, timeout=-1, searchwindowsize=-1)
- This is the common loop used inside expect. The 'searcher' should be
an instance of searcher_re or searcher_string, which describes how and
what to search for in the input.
See expect() for other arguments, return value and exceptions.
- fileno(self)
- Expose file descriptor for a file-like interface
- flush(self)
- This does nothing. It is here to support the interface for a
File-like object.
- read(self, size=-1)
- This reads at most "size" bytes from the file (less if the read hits
EOF before obtaining size bytes). If the size argument is negative or
omitted, read all data until EOF is reached. The bytes are returned as
a string object. An empty string is returned when EOF is encountered
immediately.
- readline(self, size=-1)
- This reads and returns one entire line. The newline at the end of
line is returned as part of the string, unless the file ends without a
newline. An empty string is returned if EOF is encountered immediately.
This looks for a newline as a CR/LF pair (\r\n) even on UNIX because
this is what the pseudotty device returns. So contrary to what you may
expect you will receive newlines as \r\n.
If the size argument is 0 then an empty string is returned. In all
other cases the size argument is ignored, which is not standard
behavior for a file-like object.
- readlines(self, sizehint=-1)
- This reads until EOF using readline() and returns a list containing
the lines thus read. The optional 'sizehint' argument is ignored.
Remember, because this reads until EOF that means the child
process should have closed its stdout. If you run this method on
a child that is still running with its stdout open then this
method will block until it timesout.
Data descriptors inherited from pexpect.spawnbase.SpawnBase:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from pexpect.spawnbase.SpawnBase:
- encoding = None
- pid = None
| |


Mesos single node cluster on Ubuntu
Apache Mesos is a distributed scheduling framework which allows us to build a fault tolerant distributed system from scratch. In this post we are going to see step by step instructions to install mesos on a ubuntu system.
To follow these steps, make sure that you have a 64-bit machine with Ubuntu 12.04 or later.
Step 1 : Download Mesos
Run the following commands to download and extract mesos distribution. Here we are downloading latest stable mesos version 0.20.0.
wget http://www.apache.org/dist/mesos/0.20.0/mesos-0.20.0.tar.gz
tar -zxf mesos-0.20.0.tar.gz
After running above commands, we will get a folder named mesos-0.20.0 which we refer as MESOS_INSTALL from now on.
Step 2 : Install Prerequisites
Mesos is written in C and C++. So to install mesos, we need to install it’s dependencies. So run the following command to install all the needed dependencies.
sudo apt-get update; sudo apt-get install build-essential openjdk-6-jdk python-dev python-boto libcurl4-nss-dev libsasl2-dev
Step 3 : Build mesos
Mesos is distributed as a source code package, rather than as binary. So we have to build the source code in order to get running binaries. Run the following commands to build the source code. Please replace MESOS_INSTALL in the commands with the path to mesos-0.20.0 directory.
cd MESOS_INSTALL # Replace MESOS_INSTALL with actual path to mesos-0.20.0
mkdir build #create directory where the compiled code lives
cd build
../configure
make
make check
Compiling and running test cases may take while to complete. It took around 1hr on my machine. So be patient.
Once make check completes successfully, mesos is successfully installed on your machine.
Step 4 : Setting up single node cluster
Mesos cluster can have single master and multiple slaves. In this post, we will discuss how to setup single master and single slave.
Make sure that you are in mesos-0.20.0/build folder to run the following commands.
#start master
./bin/mesos-master.sh --ip=<IP_ADDRESS> --work_dir=/tmp/mesos
#start slave
./bin/mesos-slave.sh --master=<IP_ADDRESS>:5050
You can check if the cluster started or not by pointing your web browser at <IP_ADDRESS>:5050. If you can see 1 at under “Slaves -> Activated” then you have single node cluster running.
bin folder contains all the shell scripts to start master and slave daemons. mesos-master.sh starts the mesos master with a checkpoint directory supplied at –work-dir. For this example I have used /tmp directory. But in real use case please use some other directory.
The script starts the mesos master at localhost:5050. To see all the options for the script, run
./bin/mesos-master.sh --help
Same way, you can start mesos slave using mesos-slave.sh. You have to pass master info in order to mesos slave to discover it’s master. To see all the options for the script, run
./bin/mesos-slave.sh --help
Step 5 : Testing single node cluster
Now we have single node cluster running. But how we can be sure that it is rightly configured to run tasks?. To test that, mesos provides few tests. We are going to use only the java test cases, as we are interested in Mesos Java API. Mesos also provides C++,Python API’s.
Run the following command to make sure mesos is rightly configured to run Java frameworks.
./src/examples/java/test-framework <IP_ADDRESS>:5050
If the test framework is able to run all the tasks successfully you have the mesos single node cluster working.


Main.java
and change the value of the activeProfile
data-member.
Spring-Boot sets up error view as the default error-page and we are using Thymeleaf to define it via the error.html template (if you don't configure your own error view you see the so-called "Whitelabel Error Page").
Without Spring Boot you would see your container's default error page. Rename error.html to error2.html and restart to see this for yourself.
The previous version of this demo tried to show everything on one page. It has been broken down into different pages for clarity.
demo1.web.ExceptionHandlingController
which handles its own exceptions using its own @ExceptionHandler
methods.
demo2.web.ControllerWithoutExceptionHandlers
which relies on a Controller Advice demo2.web.GlobalExceptionHandlingControllerAdvice
to handle any exceptions thrown.
mvc-configuration.xml
.
With
Exception Resolver - Exceptions handled by a customized bean
defined in demo.config.ExceptionConfiguration
. With Exception
Resolver - Exceptions handled by a runtime switchable (for demo
purposes only) bean
defined by demo3.config.DemoExceptionConfiguration
. demo3.web.ExceptionThrowingController
error.html
.
For those interested, Spring Boot provides RESTful URLs for interrogating your application (they return JSON format data):


Woman killed in hit-and-run crash while walking along I-5 in Whatcom County
by KOMO News StaffBOW, Wash. -- A woman was struck and killed by a hit-and-run driver while she went into I-5 in Whatcom County Wednesday morning.
The woman went into the southbound lanes at Bow Hill just before 1:30 a.m. when she was hit by a car, according to Trooper Heather Axtman.
That driver sped off, but then the woman was struck again by a second vehicle. The driver of that car remained at the scene, troopers said.
Medics rushed to the crash site, but the woman was pronounced dead.
All lanes of the freeway were closed for a few hours for the crash investigation but have since reopened.
Police are still looking for the first driver. It's unclear why the woman was on the freeway.


title = "Blog Category" url = "/blog/category/:slug" layout = "ion" description = "Viewing blog posts in a specific category" hidden = "0" [blogPosts] pageNumber = "{{ :page }}" categoryFilter = "{{ :slug }}" postsPerPage = "10" noPostsMessage = "No posts found" sortOrder = "published_at desc" categoryPage = "blog/category" postPage = "blog/post" ==


StackEdit has stopped because another instance was running in the same browser.
If you want to reopen StackEdit, click on "Reload".


Match Play. Red leads 10-0 (Crawford) to 11. How should Red play 22?
pips Red=114 White=115
(CorrectAnswer= 0/0, ErrorScore= 0)
When I set this problem there was quite a difference in the top two plays on initial evaluation but on rollout three plays tie for first place. So long as you play 20/18(2) with two of the twos then you are OK.
The other two can be played 3/1(2)*, 10/8, 6/4 or 10/6 and there is no difference between those moves. So, this problem turned out to be rather easier than I had planned.
Of course, in a money game with White owning a 2-cube then you must have 3/1(2)* as part of your move to maximise your gammon threat.
The other two can be played 3/1(2)*, 10/8, 6/4 or 10/6 and there is no difference between those moves. So, this problem turned out to be rather easier than I had planned.
Of course, in a money game with White owning a 2-cube then you must have 3/1(2)* as part of your move to maximise your gammon threat.
1. Cubeful 2-ply 20/18(2) 10/8 6/4 Eq.: +0.728 0.866 0.358 0.013 - 0.134 0.025 0.000 2. Cubeful 2-ply 20/18(2) 10/6 Eq.: +0.724 (-0.004) 0.864 0.363 0.012 - 0.136 0.024 0.000 3. Cubeful 2-ply 20/18(2) 3/1*(2) Eq.: +0.720 (-0.008) 0.862 0.481 0.010 - 0.138 0.027 0.000 4. Cubeful 2-ply 20/18(2) 6/2 Eq.: +0.715 (-0.013) 0.859 0.345 0.012 - 0.141 0.026 0.000 5. Cubeful 2-ply 20/18 10/8 3/1*(2) Eq.: +0.706 (-0.022) 0.856 0.512 0.011 - 0.144 0.039 0.001


CNRClient (CNICTEST\CNRClient)
- Get p o s t data secured
- Get p o s t data obj
- Get p o s t data str
- Get p o s t data null
- Get session
- Get session i d set
- Get u r l
- Get user agent
- Set user agent
- Set user agent modules
- Set u r l
- Set o t p set
- Set o t p reset
- Set session set
- Set session credentials
- Set session reset
- Save reuse session
- Set remote i p address set
- Set remote i p address reset
- Set credentials set
- Set credentials reset
- Set role credentials set
- Set role credentials reset
- Login creds o k
- Login creds f a i l
- Login extended creds o k
- Logout o k
- Logout f a i l
- Request flatten command
- Idna to ascii
- Request a u t o idn convert
- Request a u t o idn convert 1a
- Request a u t o idn convert
- Request a u t o idn convert
- Request code tmp error dbg
- Request code tmp error no dbg
- Request next response page no last
- Request next response page last
- Request next response page no first
- Request all response pages o k
- Set user view
- Reset user view
- Set proxy
- Set referer
- Use high performance connection setup
Client Factory (CNICTEST\ClientFactory)
- Hexonet client 1
- Hexonet client 2
- C n r client
- Invalid client
Hexonet Client (CNICTEST\HexonetClient)
- Get p o s t data secured
- Get p o s t data obj
- Get p o s t data str
- Get p o s t data null
- Get session
- Get session i d set
- Get u r l
- Get user agent
- Set user agent
- Set user agent modules
- Set u r l
- Set o t p set throws
- Set o t p set
- Set o t p reset
- Set session set
- Set session credentials
- Set session reset
- Save reuse session
- Set remote i p address set throws
- Set remote i p address set
- Set remote i p address reset
- Set credentials set
- Set credentials reset
- Set role credentials set
- Set role credentials reset
- Login creds o k
- Login creds f a i l
- Login extended creds o k
- Logout o k
- Logout f a i l
- Request curl init fail
- Request curl exec fail 2
- Request flatten command
- Request a u t o idn convert
- Request a u t o idn convert
- Request a u t o idn convert
- Request code tmp error dbg
- Request code tmp error no dbg
- Request next response page no last
- Request next response page last
- Request next response page no first
- Request all response pages o k
- Set user view
- Reset user view
- Set proxy
- Set referer
- Use high performance connection setup
Column (CNICTEST\Column)
Record (CNICTEST\Record)
Response Parser (CNICTEST\ResponseParser)
- Serialize property
- Serialize no property
- Serialize no code no description
- Serialize q tand r t
Response Template Manager (CNICTEST\ResponseTemplateManager)
- Get template not found
- Get templates
- Is template match hash
- Is template match plain
- Add template
Response (CNICTEST\Response)
- Command plain
- Command plain secure
- Get current page number entries
- Get current page number no entries
- Get first record index no first no rows
- Get first record index no first rows
- Get columns
- Get column index exists
- Get column index not exists
- Get column keys
- Get current record rows
- Get current record no rows
- Get list hash
- Get next record
- Get pagination
- Get previous record
- Has next page no rows
- Has next page rows
- Has previous page no rows 1
- Has previous page no rows 2
- Get last record index no rows
- Get last record index no last rows
- Get next page number no rows
- Get next page number rows
- Get number of pages
- Get previous page number no rows
- Get previous page number rows
- Rewind record list
- Constructor empty raw
- Invalid a p i response
- Invalid a p i response
- Get hash
- Get queuetime no
- Get queuetime
- Get runtime no
- Get runtime
- Is pending no
- Is pending
- Is tmp error
Response Translator (CNICTEST\ResponseTranslator)
- Place holder replacements
- Is template match hash
- Is template match plain
- Constructor vars
- Invalid response
- Get hash
- A c l translation
- Check domain transfer translation
- Translate
Socket Config (CNICTEST\SocketConfig)


| Producer: | Dell |
|---|---|
| Type: | Laptop |
| Installed Os: | Windows 10 |
| RAM: | 16GB |
| Capacity: | 512GB |
| Processor: | Intel Core i7-1065G7 |
| Cores: | 8 |
| Weight: | 1.80 kilograms |
| Display: | 15.6 inch, Full HD (1920 x 1080), IPS |
| GPU: | NVIDIA GeForce GTX 1050 (4GB GDDR5) |
| Battery: | Li-ion, 4,649mAh |
| Camera: | HD (720p) |
1899$


{% extends "sentry/bases/forceauth_modal.html" %} {% load crispy_forms_tags %} {% load i18n %} {% load sentry_helpers %} {% block title %}{% trans "Unsubscribe" %}{% endblock %} {% block main %}
You are about to unsubscribe from notifications for the selected issue.


software engineering
Contents
2.4. software engineering#
Some notes on software engineering, based on two courses at UVA.
2.4.1. ch 2 - software engineering#
software engineering - the application of a systematic, disciplined, quantifiable approach to the development, operation, and maintenance of software; that is, the application of engineering to software
SWEBOK guide
Polya
Understand the problem (communication and analysis).
Plan a solution (modeling and software design).
Carry out the plan (code generation).
Examine the result for accuracy (testing and quality assurance).
tools - provide automated or semi-automated support
methods - provide technical how-tos
ex: communication, requirements analysis, design modeling, program construction, testing and support
process model - framework for delivering technology
framework activities
communication, planning, modeling, construction, deployment
umbrella activities
software project tracking and control, risk management, software quality assurance, technical reviews, measurement, software configuration management, reusability management, work product preparation and production
a quality focus - bedrock that supports software engineering
every software has some business need
2.4.2. ch 3 - software process structure#
task set - defines the actual work to be done to accomplish the objectives of a software engineering action
process pattern - template - describes process-related problem, suggests solutions
stage patterns - defines problems associated with a framework activity
task patterns
phase patterns - define sequence of framework activities
process assessment and improvement
SCAMPI, CBAIPI, SPICE, ISO 9001:2000 for software
2.4.3. ch 4 - process models#
prescriptive models - advocated orderly approach
waterfall model
everything is in order
communication, planning, modeling, construction, deployment
V model
move down the model and then test each step on the way up
incremental model
increments (like versions are produced)
evolutionary models - use prototyping, users may think prototype is actual model
spiral - continually do each step of waterfall
concurrent - different parts have different interations
others
component based - when using outside code
the process to apply when reuse is a development objective
formal - when safety is needed
aspect-oriented - construct aspects - new paradigm
unified process - use-case driven, works well with UML
personal and team software processes
2.4.4. ch 5 - agile development#
driven by customer descriptions
adapts as changes occur
delivers multiple software increments
self-organizing teams
at regular intervals, the team reflects on how to become more effective
agile unified process - each AUP iteration addresses several activies
modeling, implementation, testing, deployment,…
agile modeling - set of modeling principles
model with a purpose
use multiple models
adapt locally
extreme programming (xp) - most widely used agile process
begins with user stories
each one gets a cost
grouped together for deliverable increment
CRC - class responsibility collaborator
commitment is made on delivery date
project velocity defines subsequent delivery dates
encourages unit tests, pair programming
acceptance tests defined by the user
industrial xp - greater inclusion of management, customers
readiness assesment, project community, project chartering, test driven management, retrospectives, continuous learning
scrum - development work is partition into “packets”
testing and documentation are on-going
work occurs in sprints and derived from a backlog
meetings are short
demos are delivered to the customer
dynamic systems development method - similar to xp
2.4.5. ch 6 - human aspects#
roles
ambassador – represents team to outside constituencies
scout – crosses team boundaries to collect information
guard – protects access to team work products
sentry – controls information sent by stakeholders
coordinator – communicates across the team and organization
teams
sense of purpose, involvement, trust, improvement
diversity of skill sets
organizational paradigms
closed paradigm — structure by authority
random paradigm - loose, depends on individual initiatives
open paradigm - mix of closed and random
synchronous paradigm - compartmentalizes problem
some collaboration tools
slack
gforge
onedesk
rational team concert
collaboration, coordination, communication
2.4.6. ch 7 - principles#
process principles
be agile, effective team, communicate, assess risk, quality focus,
practice principles
divide and conquer, transfer of information, abstraction, patterns, maintenance
communication principles
gather customer requirements
planning principles
understand scope, be iterative
modeling principles
UML diagrams
requirements models - analysis models - represent customer requirements in information domain, functional domain, behavioral domain
design models - represent characteristics of software that helps construct it effectively - ex. like an architect’s plans for a house
preparation, construction, testing, deployment
The deployment activity encompasses 3 actions:
Delivery
Support
Feedback
2.4.7. ch 8 - understanding requirements#
inception - first questions
elicitation - requirements understood
elaboration
negotiation
specification - maybe in models
validation - products are assessed
requirements managing
quality function deployment - determines the customer satisfaction of each requirement
requirement types - functional describes what software should do, while non-functional place constraints on how
Functional Requirement: A system must send an email whenever a certain condition is met (e.g. an order is placed, a customer registers, etc.
Nonfunctional Requirement: Emails should be sent with a latency of no greater than 12 hours from such an activity
use-cases - collection of user scenarios that describe the thread of usage of a system
each described from point-of-view of an actor
analysis model - provides description for computer-based system
scenario-based elements - functional and use-cases
class-based elements - implied by scenarios
behavioral elements - state diagram
flow-oriented elements - data flow diagram
state diagram - represents the behavior of a system by depicting its states and the events that cause the system to change state
UML diagrams
case diagrams
activity diagrams
class diagrams
2.4.8. ch 9 - requirements modeling - scenario-based#
analysis modeling - focuses on what not how
requirements modeling must achieve 3 objectives
to describe what the customer requires
basis for creation of a software design
define a set of requirements that can be validated
domain analysis - define the domain to be investigated
analyze applications in the domain
scenario-based modeling
use-case - a scenario that describes a thread of usage
actors - represent roles people or devices play as the system functions
users - can play a number of different roles for a given scenario
exceptions - situations that cause the system to exhibit unusual behavior
uml models
activity diagrams – supplements the use case by providing a graphical representation of the flow of interaction within a specific scenario.
swimlane diagrams - is a useful variation of the activity diagram and allows you to represent the flow of activities described by the use case at the same time indicate which actor or analysis class has responsibility for the action described by an activity rectangle
2.4.9. ch 10 - requirements modeling - class-based methods#
structured analysis - considers data and the processes that transform the data as separate entities
object-oriented analysis - focuses on definition of classes
class-based modeling - objects, operations, relationships, collaborations
processing narrative - describes overall description of the function to be developed - nouns underlined
attributes - describe a class that has been selected for inclusion in the analysis model
operations - define the behavior of an object
class-responsibility-collaborator (CRC) modeling - provides simple means for making classes that are relevant to requirements
like index cards with class, responsibilities, collaborators on each card
class types
entity classes - extracted directly from problem statement
boundary classes - used to create the interface
controller classes - manage a unit of work from start to finish
collaborations - three different generic relationships
associations
is-part-of
has-knowledge-of
dependencies
depends-upon
plus - public visible, minus - private
2.4.10. ch 11 - requirements modeling - behavior models#
behavioral modeling - depicts the system states and its classes
indicates how software will respond to external events or stimuli
state representations
passive state - current status of attributes
active state - current status of object as it undergoes continuing transformation
event - occurrence that cuases the system to exhibit some behavoir
action - process that occurs as a consequence of making a transaction
semantic analysis pattern - describes set of use cases for application
content Analysis - The full spectrum of content to be provided by the WebApp is identified, including text, graphics and images, video, and audio data. Data modeling can be used to identify and describe each of the data objects.
interaction model
use-cases
sequence diagrams
state diagrams
user interface prototypes
functional model - describes operations that will be applied to manipulate content and describes other processing functions that are independent of content but necessary to the end user
configuration model - environment and infrastructure in which the app resides
server-side and client-side
navigation modeling - defines overall navigation strategy for the app


You aren't connected to Twitter yet. Click the button to connect this application with your Twitter account.
Connect to Twitter


Contains the classes that obtain the current read and write io for the given process. The default implementation reads the /proc/PID/io file for the read_bytes and write_bytes for the current process


About Me
- Basics?
-
Hi, I'm Anmol. I was born in Bombay, but now I stay in Delhi, India. My pronouns are he/him/his.
- Work?
-
I'm a freelance web developer. In simpler terms, I started learning something I liked and now make a lil dough on the side by helping companies piece together websites.
- Politics?
-
I always agree with the side that isn't discrimatory, so none as of now. Maybe that'll change. All I know is, I got my morals and ethics in the right place.
- What do you admire in people?
-
Passion. People who have things in their lives that make their eyes light up brighter than the moon when they talk about it, those are the kind of humans I love.
- Biggest fear?
-
Not achieving the things that I know and don't know I'm capable of.
- Biggest pet peeve?
-
People that talk too much and do too little. After a point, the talk should stop and the actions should speak.
- Why this journal?
-
I've realised that writing about something helps me interalise it. I'm on a life-long journey of self improvement and If somehow you stumble upon this particular website, I want you to gain something from it. I'll be sharing insights here about everything I learn, be it from work, working out, people, experiences, etc. My grandfather used to say, "Life is a buffet, pick whatever you like and move on.
Reviews
If he had the looks, the talent, and the personality, he'd be an awesome guy to hang out with.
- Dad
Hung.
- Buble Match
Excellent programmer, would hire.
- Sundar Pichai,
CEO, Google
Gifted.
- III Grade Teacher
Anmol, what can I say, he's like the Mona Lisa, someone that stands the test of time and remains youthful about it. He is the only person that can be so completely sexy in every single way. Like seriously, he's perfect.  I love being around him, he's one of the most warm people I've met. So humble, never brags at all, I found out he flew a Cessna 172 but not because he told me, but because I asked him. Wonderful character, great person to meet with, great set of washboard abs. 14/10 would recommend


{% extends "layout_unbranded.html" %} {% block page_title %} sportplaces.uk {% endblock %} {% block content %} {% include "includes/header_sports_places.html" %} Back What do you call this space? What do you call this space? {% endblock %}


{{- partial "head.html" . -}}
About HamBSD
Getting Source{{ range .Site.Menus.gettingsource }}HamBSD Resources
Supporting HamBSD
|
Current status:
Current goal:
The HamBSD project aims to bring amateur packet radio to OpenBSD, including support for TCP/IP over AX.25 and APRS tracking/digipeating in the base system. HamBSD will not provide a full AX.25 stack but instead only implement support for UI frames. There will be a focus on simplicity, security and readable code. The amateur radio community needs a reliable platform for packet radio for use in both leisure and emergency scenarios. It should be expected that the system is stable and resilient (but as yet it is neither). |
|
For monthly updates on HamBSD development, please support the project on Patreon. |


C
/
*
back
7
8
9
-
4
5
6
+
1
2
3
.
(
0
)
=
Copyright 2021 © All right reserved | powered by Rahand.Amin


The PlotDevice canvas "remembers" the style and transformation settings used to draw primitives. These settings make up the "graphics state" and exist independently from the primitives you add to the canvas. This lets you keep drawing- and styling-related code separate and allows you to apply styles to groups of objects rather than needing to configure each one.
You can think of it like working on an oil-painting. While at the easel, you can hold one type of brush and put one color of paint on it. All the strokes you paint on the canvas will have the same color and texture according to the thickness of the brush and color of paint. Naturally, you could paint with both hands and feet holding multiple brushes with multiple colors … but we wouldn't recommend it.
In PlotDevice you ‘paint’ with one color at a time. All of the elements you draw have the same color until you actively switch to a different one. Then all subsequent elements you draw will use that new color.
When you run a script, PlotDevice reads the code from top to bottom, like a recipe. When it encounters certain state-changing commands, it responds not through any immediately visible change, but instead by silently updating the canvas's "current" setting for the given attribute. Afterwards, any primitives you draw will "inherit" the graphics state, including your modification.
Quite a few commands affect the graphics state, but they fall into four general categories:
At the beginning of your script, the state is initialized to a set of reasonable defaults:
You can also restore the graphics state to these defaults at any time by calling the clear() command with the parameter all
.
All the primitives we draw to the canvas will use the default style settings (until we overwrite them with new values). For example, observe the following script. We start by drawing a circular arc with the default color state. We then change the fill to
and draw a pair of circles below the first. Finally we change the stroke from transparent to and the fill color to . After making this change, we draw two more circles which inherit the new style:Many PlotDevice commands support an optional "clean up" behavior. In fact nearly everything that affects the graphics state can be made into a temporary modification by calling the command as part of a with
statement.
When you call a command in a with
statement, place a colon at the end of the line and add one or more indented lines of code below it. When called this way, the state-changing commands will "remember" the previous setting before modifying it. When the indented-block is done executing, the remembered state will be restored for the given command.
For example, both of the following are equivalent:
oldfill = fill() # remember the old color fill('red') # set the new color arc(40,40, 10) # draw fill(oldfill) # restore the old color
with fill('red'): # remember the old color and set a new one arc(40,40, 10) # draw ... # old color automatically restored
You can even combine multiple commands (separated by commas) and their effects will be limited to the drawing that happens inside the indented code-block that follows. Once you return to the outer indentation-level, it's as if you never changed the graphics state:
Commands that support the with
statement are called "context managers" in Python lingo. Take a look at the Reference section's table of contents to see which commands can be used in this manner (they're all marked with dots). Then read their reference entries for details on how the with
usage changes their behavior.
If necessary, you can break away from the "current" state and colorize or transform elements individually. Each of the drawing primitives accepts optional parameters that correspond to the state-changing commands:
In addition to these parameters, the text() primitive also supports all of the settings available in the font() and layout() commands:
So you could "override" the canvas's fill color with:
rect(20, 20, 100, 100, fill="red")
Or you could break away from the canvas's Typography settings with:
text("hello", 200, 200, family="Baskerville", size=24, italic=True, align=CENTER)
When you call a primitive command, it returns a reference to the Bezier, Text, or Image object that has been created. If you assign this value to a variable, you can inspect the style-settings it "inherited" from the global state and modify them for that object alone. This can come in handy in looping contexts where you may not know the settings you wish to modify until after calling the primitive command.
For instance, the previous example of drawing a red box (regardless of the current fill() color) could also be achieved by modifying a reference to the Bezier returned by the rect() command:
r = rect(20, 20, 100, 100) r.fill = color("red")
Similarly, you can modify the object's Transform by calling its methods:
r.translate(x, y=None) r.rotate(angle) r.scale(x, y=None) r.skew(x, y=None) r.reset()
The transformations are then applied only to rectangle r. Since each of the transform methods returns a reference to the primitive, you can even "chain" these calls:
r.reset().translate(100, 50).rotate(45)


JWPlayerController Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | JWPlayerController.h |
Overview
A class that encapsulates JW Player and provides control over the playback as well as holds the state of the player and notifies about status updates.
Accessing Player Controller Attributes
view
Player view.
@property (nonatomic, retain, readonly) UIView *view
Discussion
to be added to the application view hierarchy.
Declared In
JWPlayerController.h
delegate
The object that acts as the delegate of the jwPlayerController.
@property (nonatomic, weak) id<JWPlayerDelegate> delegate
Discussion
The delegate must adopt the JWPlayerDelegate protocol. The delegate is not retained.
See Also
Declared In
JWPlayerController.h
drmDataSource
The JWDrmDataSource is adopted by an object that mediates the application’s data model and key server. The data source provides the JWPlayerController object with the data needed to reproduce encrypted content.
@property (nonatomic, weak) id<JWDrmDataSource> drmDataSource
Discussion
The drmDataSource must adopt the JWDrmDataSource protocol. The drmDataSource is not retained.
See Also
Declared In
JWPlayerController.h
googleIMAVersion
Returns the version of google IMA framework used by the SDK.
@property (nonatomic, retain, readonly) NSString *googleIMAVersion
Declared In
JWPlayerController.h
googleChromeCastVersion
Returns the version of google ChromeCast framework used by the SDK.
@property (nonatomic, retain, readonly) NSString *googleChromeCastVersion
Declared In
JWPlayerController.h
playerState
Returns current state of the player.
@property (nonatomic, retain, readonly) NSString *playerState
Discussion
Can be “idle”, “playing”, “paused” and “buffering”.
Declared In
JWPlayerController.h
metadata
Metadata associated with the current video. Usually includes dimensions and duration of the video.
@property (nonatomic, retain, readonly) NSDictionary *metadata
Discussion
becomes available shortly after the video starts playing. There is a notification JWMetaDataAvailableNotification posted right after metadata is available.
Declared In
JWPlayerController.h
buffer
Returns the current PlaylistItem’s filled buffer, as a percentage (0 to 100) of the total video’s length.
@property (nonatomic, readonly) NSInteger buffer
Discussion
This only applies to progressive downloads of media (MP4/FLV/WebM and AAC/MP3/Vorbis); streaming media (HLS/RTMP/YouTube/DASH) do not expose this behavior.
Declared In
JWPlayerController.h
controls
Enable the built-in controls by setting them true, disable the controls by setting them false.
@property (nonatomic) BOOL controls
Declared In
JWPlayerController.h
displayLockScreenControls
When enabled, the user will be able to control playback of the current video (play, pause, and when applicable next/previous) from the device’s Lock Screen and some information (title, playback position, duration, poster image) will be presented on the lockscreen. Defaults to YES.
@property (nonatomic) BOOL displayLockScreenControls
Discussion
In order for the lock screen controls to appear, background audio must be enabled and the audio session must be set to AVAudioSessionCategoryPlayback.
Declared In
JWPlayerController.h
Managing Video Quality Levels
currentQualityLevel
The index of the object in quality levels list currently used by the player.
@property (nonatomic) NSInteger currentQualityLevel
Declared In
JWPlayerController.h
levels
List of quality levels available for the current media.
@property (nonatomic, retain, readonly) NSArray *levels
Declared In
JWPlayerController.h
Managing Closed Captions
currentCaptions
The index of the caption object in captions list currently used by the player.
@property (nonatomic) NSInteger currentCaptions
Discussion
index 0 stands for no caption.
See Also
Declared In
JWPlayerController.h
captionsList
List of all the captions supplied in the config
@property (nonatomic, retain, readonly) NSArray *captionsList
Discussion
Use currentCaptions to activate one of the captions programmatically. Object at index 0 is “off”.
See Also
Declared In
JWPlayerController.h
Managing Audio Tracks
currentAudioTrack
The index of the currently active audio track.
@property (nonatomic) NSInteger currentAudioTrack
Declared In
JWPlayerController.h
audioTracks
Array with audio tracks from the player.
@property (nonatomic, retain, readonly) NSArray *audioTracks
Declared In
JWPlayerController.h
Managing Playlists
playlistIndex
The index of the currently active item in the playlist.
@property (nonatomic) NSInteger playlistIndex
Declared In
JWPlayerController.h
Initializing Player Controller Object
– initWithConfig:delegate:
Inits the player with config object in JWConfig format and sets the object that acts as the delegate of the JWPlayerController.
- (instancetype)initWithConfig:(JWConfig *)config delegate:(id<JWPlayerDelegate>)delegate
Parameters
config |
JWConfig object that is used to setup the player. |
|---|---|
delegate |
The object that acts as the delegate of the jwPlayerController. |
See Also
Declared In
JWPlayerController.h
– initWithConfig:delegate:drmDataSource:
Inits the player with a JWConfig object and sets the object that acts as a DRM data source, as well as the delegate of the JWPlayerController.
- (instancetype)initWithConfig:(JWConfig *)config delegate:(id<JWPlayerDelegate>)delegate drmDataSource:(id<JWDrmDataSource>)drmDataSource
Parameters
config |
JWConfig object that is used to setup the player. |
|---|---|
delegate |
The object that acts as the delegate of the jwPlayerController. |
drmDataSource |
The object that acts as a data source for reproducing drm encrypted content. |
See Also
Declared In
JWPlayerController.h
Managing Playback
– stop
Stops the player (returning it to the idle state) and unloads the currently playing media file.
- (void)stop
Declared In
JWPlayerController.h
– seek:
Time in the video to seek to
- (void)seek:(NSUInteger)position
Parameters
position |
Time in the video to seek to |
|---|
See Also
Declared In
JWPlayerController.h
playbackPosition
Playback position of the current video.
@property (nonatomic, retain, readonly) NSNumber *playbackPosition
Discussion
gets updated as the video plays. JWPlaybackProgressNotification is posted every time position changes. KVO compliant.
Declared In
JWPlayerController.h
volume
The volume of the JWPlayerController’s audio. At 0.0 the player is muted, at 1.0 the player’s volume is as loud as the device’s volume.
@property (nonatomic) CGFloat volume
Discussion
This property should be used to control the volume of the player relative to other audio output, not for volume control by viewers. This property will have no effect when ads are played using Google IMA, or when casting. Viewers can control volume when casting by changing the device’s volume.
Declared In
JWPlayerController.h
playbackRate
The rate at which media is being reproduced.
@property (nonatomic) CGFloat playbackRate
Discussion
Setting this property to 1.0 will play the media at its natural rate. Ability to set a different value is limited to the rates supported by the media item; if an unsupported rate is requested, playbackRate will not change. Rates between 0.0 and 1.0 will slow forward, rates greater than 1.0 will fast forward, rates between 0.0 and -1.0 will slow reverse, and rates lower than -1.0 will fast reverse. This property will have no effect when ads are being played, or when casting. Cannot be set to 0; to pause playback, please call the pause method.
Declared In
JWPlayerController.h
Managing Full Screen / Picture in Picture
isInFullscreen
A Boolean value that determines whether the video is in full screen.
@property (nonatomic, readonly) BOOL isInFullscreen
Declared In
JWPlayerController.h
forceFullScreenOnLandscape
A Boolean value that determines whether the video should go to full screen mode when the device rotates to landscape.
@property (nonatomic) BOOL forceFullScreenOnLandscape
Discussion
Make sure your app supports landscape to make this property work.
Declared In
JWPlayerController.h
forceLandscapeOnFullScreen
A Boolean value that determines whether the video should rotate to landscape when the fullscreen button is pressed.
@property (nonatomic) BOOL forceLandscapeOnFullScreen
Discussion
Make sure your app supports landscape to make this property work.
Declared In
JWPlayerController.h
pictureInPictureDisabled
A Boolean value that determines whether the video should allow Picture In Picture display. Default value is NO.
@property (nonatomic) BOOL pictureInPictureDisabled
Discussion
Picture in Picture is only available on iPad Pro, iPad Air (or later), and iPad mini 2 (or later) running iOS 9.
Declared In
JWPlayerController.h
– enterFullScreen
Switches the player to full screen mode.
- (void)enterFullScreen
Declared In
JWPlayerController.h
– exitFullScreen
Switches the player to inline mode.
- (void)exitFullScreen
Declared In
JWPlayerController.h
– togglePictureInPicture
Toggles the player into and out of Picture In Picture display.
- (void)togglePictureInPicture
Discussion
Picture in Picture is only available on iPad Pro, iPad Air (or later), and iPad mini 2 (or later) running iOS 9.
Declared In
JWPlayerController.h
Loading New Media
– load:
Loads a new file into the player.
- (void)load:(NSString *)file
Parameters
file |
Video URL to play using JW Player. |
|---|
Declared In
JWPlayerController.h
– loadConfig:
Loads a new JWConfig object into the player.
- (void)loadConfig:(JWConfig *)config
Parameters
config |
COnfiguration object. |
|---|
Declared In
JWPlayerController.h
– loadPlaylist:
Loads a new playlist into the player.
- (void)loadPlaylist:(NSArray *)playlist
Parameters
playlist |
An array containing playlist items. |
|---|
Declared In
JWPlayerController.h
Injecting Ads
– playAd:
Immediately starts to play an ad using the vastPlugin.
- (void)playAd:(NSString *)tag
Parameters
tag |
Xml file with info about the ad. |
|---|
Discussion
Usually used to inject an ad in streams where you can’t schedule an ad. If you wish to play the ad with the Google IMA Client, please use playAd:onClient: instead and specify ‘googima’ as your ad client.
Declared In
JWPlayerController.h
– playAd:onClient:
Immediately starts to play an ad.
- (void)playAd:(NSString *)tag onClient:(JWAdClient)adClient
Parameters
tag |
Xml file with info about the ad. |
|---|---|
adClient |
Set to googima if you wish to use google IMA; set to vastPlugin if not. Setting to nil defaults to vastPlugin. Note: Due to the fact that Google IMA’s iOS SDK is still in Beta mode, we suggest using the vastPlugin. |
Discussion
Usually used to inject an ad in streams where you can’t schedule an ad.
Declared In
JWPlayerController.h
openSafariOnAdClick
If set to YES will open Safari after the user clicks the ad.
@property (nonatomic) BOOL openSafariOnAdClick
Declared In
JWPlayerController.h
Related
– openRelatedOverlay
Opens the related overlay. This will pause content if it is currently playing.
- (void)openRelatedOverlay
Declared In
JWPlayerController.h
– closeRelatedOverlay
Closes the related plugin overlay. This will resume content.
- (void)closeRelatedOverlay
Declared In
JWPlayerController.h
Accessing SDK Info
playerVersion
Version of underlying web player
@property (nonatomic, retain, readonly) NSString *playerVersion
Declared In
JWPlayerController.h
playerEdition
Player edition based on the provided JW License key
@property (nonatomic, retain, readonly) NSString *playerEdition
Declared In
JWPlayerController.h
+ SDKVersionToMinor
Version of the iOS SDK, truncated. (i.e.: if SDKVersion returns 1.001, SDKVersionToMinor returns 1.).
+ (NSString *)SDKVersionToMinor
Declared In
JWPlayerController.h
+ setPlayerKey:
Sets the Player Key programmatically instead of having to type it into the application’s info.plist. We recommend setting the key in the AppDelegate’s application:didFinishLaunchingWithOptions: method.
+ (void)setPlayerKey:(NSString *)key
Discussion
If a different key is entered in the info.plist, the key set with this method will supersede. Use this method before instantiating the JWPlayerController, ideally in the AppDelegate’s application:didFinishLaunchingWithOptions: method.
Declared In
JWPlayerController.h


Yuware
Yuware™ is all in one tool for YU devices. Its designed for User friendly, Easy to use and Premium GUI purpose. Everything is coded in JAVA only. A third party Libarary is been used for Look and feel of JFrames. You can find it in my code. All work is free and open source that doesnt means i had not spend much time. I had spent hours of time in coding perfect way. If you use my work or code please mention proper credits Feel free to send pull requests whenever you think a better code can replace it.
Credits :- 1) DooMLoRD for Flashing tools and Guides 2) AyushTyagi for Guide of Yunique 3) PDA net for drivers