Without further ado, here is the program zpipe.c:
/* zpipe.c: example of proper use of zlib's inflate() and deflate() Not copyrighted -- provided to the public domain Version 1.4 11 December 2005 Mark Adler */ /* Version history: 1.0 30 Oct 2004 First version 1.1 8 Nov 2004 Add void casting for unused return values Use switch statement for inflate() return values 1.2 9 Nov 2004 Add assertions to document zlib guarantees 1.3 6 Apr 2005 Remove incorrect assertion in inf() 1.4 11 Dec 2005 Add hack to avoid MSDOS end-of-line conversions Avoid some compiler warnings for input and output buffers */We now include the header files for the required definitions. From stdio.h we use fopen(), fread(), fwrite(), feof(), ferror(), and fclose() for file i/o, and fputs() for error messages. From string.h we use strcmp() for command line argument processing. From assert.h we use the assert() macro. From zlib.h we use the basic compression functions deflateInit(), deflate(), and deflateEnd(), and the basic decompression functions inflateInit(), inflate(), and inflateEnd().
#include <stdio.h> #include <string.h> #include <assert.h> #include "zlib.h"This is an ugly hack required to avoid corruption of the input and output data on Windows/MS-DOS systems. Without this, those systems would assume that the input and output files are text, and try to convert the end-of-line characters from one standard to another. That would corrupt binary data, and in particular would render the compressed data unusable. This sets the input and output to binary which suppresses the end-of-line conversions. SET_BINARY_MODE() will be used later on stdin and stdout, at the beginning of main().
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) # include <fcntl.h> # include <io.h> # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) #else # define SET_BINARY_MODE(file) #endifCHUNK is simply the buffer size for feeding data to and pulling data from the zlib routines. Larger buffer sizes would be more efficient, especially for inflate(). If the memory is available, buffers sizes on the order of 128K or 256K bytes should be used.
#define CHUNK 16384The def() routine compresses data from an input file to an output file. The output data will be in the zlib format, which is different from the gzip or zip formats. The zlib format has a very small header of only two bytes to identify it as a zlib stream and to provide decoding information, and a four-byte trailer with a fast check value to verify the integrity of the uncompressed data after decoding.
/* Compress from file source to file dest until EOF on source. def() returns Z_OK on success, Z_MEM_ERROR if memory could not be allocated for processing, Z_STREAM_ERROR if an invalid compression level is supplied, Z_VERSION_ERROR if the version of zlib.h and the version of the library linked do not match, or Z_ERRNO if there is an error reading or writing the files. */ int def(FILE *source, FILE *dest, int level) {Here are the local variables for def(). ret will be used for zlib return codes. flush will keep track of the current flushing state for deflate(), which is either no flushing, or flush to completion after the end of the input file is reached. have is the amount of data returned from deflate(). The strm structure is used to pass information to and from the zlib routines, and to maintain the deflate() state. in and out are the input and output buffers for deflate().
int ret, flush; unsigned have; z_stream strm; unsigned char in[CHUNK]; unsigned char out[CHUNK];The first thing we do is to initialize the zlib state for compression using deflateInit(). This must be done before the first use of deflate(). The zalloc, zfree, and opaque fields in the strm structure must be initialized before calling deflateInit(). Here they are set to the zlib constant Z_NULL to request that zlib use the default memory allocation routines. An application may also choose to provide custom memory allocation routines here. deflateInit() will allocate on the order of 256K bytes for the internal state. (See zlib Technical Details.)
deflateInit() is called with a pointer to the structure to be initialized and the compression level, which is an integer in the range of -1 to 9. Lower compression levels result in faster execution, but less compression. Higher levels result in greater compression, but slower execution. The zlib constant Z_DEFAULT_COMPRESSION, equal to -1, provides a good compromise between compression and speed and is equivalent to level 6. Level 0 actually does no compression at all, and in fact expands the data slightly to produce the zlib format (it is not a byte-for-byte copy of the input). More advanced applications of zlib may use deflateInit2() here instead. Such an application may want to reduce how much memory will be used, at some price in compression. Or it may need to request a gzip header and trailer instead of a zlib header and trailer, or raw encoding with no header or trailer at all.
We must check the return value of deflateInit() against the zlib constant Z_OK to make sure that it was able to allocate memory for the internal state, and that the provided arguments were valid. deflateInit() will also check that the version of zlib that the zlib.h file came from matches the version of zlib actually linked with the program. This is especially important for environments in which zlib is a shared library.
Note that an application can initialize multiple, independent zlib streams, which can operate in parallel. The state information maintained in the structure allows the zlib routines to be reentrant.
/* allocate deflate state */ strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; ret = deflateInit(&strm, level); if (ret != Z_OK) return ret;With the pleasantries out of the way, now we can get down to business. The outer do-loop reads all of the input file and exits at the bottom of the loop once end-of-file is reached. This loop contains the only call of deflate(). So we must make sure that all of the input data has been processed and that all of the output data has been generated and consumed before we fall out of the loop at the bottom.
/* compress until end of file */ do {We start off by reading data from the input file. The number of bytes read is put directly into avail_in, and a pointer to those bytes is put into next_in. We also check to see if end-of-file on the input has been reached using feof(). If we are at the end of file, then flush is set to the zlib constant Z_FINISH, which is later passed to deflate() to indicate that this is the last chunk of input data to compress. If we are not yet at the end of the input, then the zlib constant Z_NO_FLUSH will be passed to deflate to indicate that we are still in the middle of the uncompressed data.
If there is an error in reading from the input file, the process is aborted with deflateEnd() being called to free the allocated zlib state before returning the error. We wouldn't want a memory leak, now would we? deflateEnd() can be called at any time after the state has been initialized. Once that's done, deflateInit() (or deflateInit2()) would have to be called to start a new compression process. There is no point here in checking the deflateEnd() return code. The deallocation can't fail.
strm.avail_in = fread(in, 1, CHUNK, source); if (ferror(source)) { (void)deflateEnd(&strm); return Z_ERRNO; } flush = feof(source) ? Z_FINISH : Z_NO_FLUSH; strm.next_in = in;The inner do-loop passes our chunk of input data to deflate(), and then keeps calling deflate() until it is done producing output. Once there is no more new output, deflate() is guaranteed to have consumed all of the input, i.e., avail_in will be zero.
/* run deflate() on input until output buffer not full, finish compression if all of source has been read in */ do {Output space is provided to deflate() by setting avail_out to the number of available output bytes and next_out to a pointer to that space.
strm.avail_out = CHUNK; strm.next_out = out;Now we call the compression engine itself, deflate(). It takes as many of the avail_in bytes at next_in as it can process, and writes as many as avail_out bytes to next_out. Those counters and pointers are then updated past the input data consumed and the output data written. It is the amount of output space available that may limit how much input is consumed. Hence the inner loop to make sure that all of the input is consumed by providing more output space each time. Since avail_in and next_in are updated by deflate(), we don't have to mess with those between deflate() calls until it's all used up.
The parameters to deflate() are a pointer to the strm structure containing the input and output information and the internal compression engine state, and a parameter indicating whether and how to flush data to the output. Normally deflate will consume several K bytes of input data before producing any output (except for the header), in order to accumulate statistics on the data for optimum compression. It will then put out a burst of compressed data, and proceed to consume more input before the next burst. Eventually, deflate() must be told to terminate the stream, complete the compression with provided input data, and write out the trailer check value. deflate() will continue to compress normally as long as the flush parameter is Z_NO_FLUSH. Once the Z_FINISH parameter is provided, deflate() will begin to complete the compressed output stream. However depending on how much output space is provided, deflate() may have to be called several times until it has provided the complete compressed stream, even after it has consumed all of the input. The flush parameter must continue to be Z_FINISH for those subsequent calls.
There are other values of the flush parameter that are used in more advanced applications. You can force deflate() to produce a burst of output that encodes all of the input data provided so far, even if it wouldn't have otherwise, for example to control data latency on a link with compressed data. You can also ask that deflate() do that as well as erase any history up to that point so that what follows can be decompressed independently, for example for random access applications. Both requests will degrade compression by an amount depending on how often such requests are made.
deflate() has a return value that can indicate errors, yet we do not check it here. Why not? Well, it turns out that deflate() can do no wrong here. Let's go through deflate()'s return values and dispense with them one by one. The possible values are Z_OK, Z_STREAM_END, Z_STREAM_ERROR, or Z_BUF_ERROR. Z_OK is, well, ok. Z_STREAM_END is also ok and will be returned for the last call of deflate(). This is already guaranteed by calling deflate() with Z_FINISH until it has no more output. Z_STREAM_ERROR is only possible if the stream is not initialized properly, but we did initialize it properly. There is no harm in checking for Z_STREAM_ERROR here, for example to check for the possibility that some other part of the application inadvertently clobbered the memory containing the zlib state. Z_BUF_ERROR will be explained further below, but suffice it to say that this is simply an indication that deflate() could not consume more input or produce more output. deflate() can be called again with more output space or more available input, which it will be in this code.
ret = deflate(&strm, flush); /* no bad return value */ assert(ret != Z_STREAM_ERROR); /* state not clobbered */Now we compute how much output deflate() provided on the last call, which is the difference between how much space was provided before the call, and how much output space is still available after the call. Then that data, if any, is written to the output file. We can then reuse the output buffer for the next call of deflate(). Again if there is a file i/o error, we call deflateEnd() before returning to avoid a memory leak.
have = CHUNK - strm.avail_out; if (fwrite(out, 1, have, dest) != have || ferror(dest)) { (void)deflateEnd(&strm); return Z_ERRNO; }The inner do-loop is repeated until the last deflate() call fails to fill the provided output buffer. Then we know that deflate() has done as much as it can with the provided input, and that all of that input has been consumed. We can then fall out of this loop and reuse the input buffer.
The way we tell that deflate() has no more output is by seeing that it did not fill the output buffer, leaving avail_out greater than zero. However suppose that deflate() has no more output, but just so happened to exactly fill the output buffer! avail_out is zero, and we can't tell that deflate() has done all it can. As far as we know, deflate() has more output for us. So we call it again. But now deflate() produces no output at all, and avail_out remains unchanged as CHUNK. That deflate() call wasn't able to do anything, either consume input or produce output, and so it returns Z_BUF_ERROR. (See, I told you I'd cover this later.) However this is not a problem at all. Now we finally have the desired indication that deflate() is really done, and so we drop out of the inner loop to provide more input to deflate().
With flush set to Z_FINISH, this final set of deflate() calls will complete the output stream. Once that is done, subsequent calls of deflate() would return Z_STREAM_ERROR if the flush parameter is not Z_FINISH, and do no more processing until the state is reinitialized.
Some applications of zlib have two loops that call deflate() instead of the single inner loop we have here. The first loop would call without flushing and feed all of the data to deflate(). The second loop would call deflate() with no more data and the Z_FINISH parameter to complete the process. As you can see from this example, that can be avoided by simply keeping track of the current flush state.
} while (strm.avail_out == 0); assert(strm.avail_in == 0); /* all input will be used */Now we check to see if we have already processed all of the input file. That information was saved in the flush variable, so we see if that was set to Z_FINISH. If so, then we're done and we fall out of the outer loop. We're guaranteed to get Z_STREAM_END from the last deflate() call, since we ran it until the last chunk of input was consumed and all of the output was generated.
/* done when last data in file processed */ } while (flush != Z_FINISH); assert(ret == Z_STREAM_END); /* stream will be complete */The process is complete, but we still need to deallocate the state to avoid a memory leak (or rather more like a memory hemorrhage if you didn't do this). Then finally we can return with a happy return value.
/* clean up and return */ (void)deflateEnd(&strm); return Z_OK; }Now we do the same thing for decompression in the inf() routine. inf() decompresses what is hopefully a valid zlib stream from the input file and writes the uncompressed data to the output file. Much of the discussion above for def() applies to inf() as well, so the discussion here will focus on the differences between the two.
/* Decompress from file source to file dest until stream ends or EOF. inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be allocated for processing, Z_DATA_ERROR if the deflate data is invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and the version of the library linked do not match, or Z_ERRNO if there is an error reading or writing the files. */ int inf(FILE *source, FILE *dest) {The local variables have the same functionality as they do for def(). The only difference is that there is no flush variable, since inflate() can tell from the zlib stream itself when the stream is complete.
int ret; unsigned have; z_stream strm; unsigned char in[CHUNK]; unsigned char out[CHUNK];The initialization of the state is the same, except that there is no compression level, of course, and two more elements of the structure are initialized. avail_in and next_in must be initialized before calling inflateInit(). This is because the application has the option to provide the start of the zlib stream in order for inflateInit() to have access to information about the compression method to aid in memory allocation. In the current implementation of zlib (up through versions 1.2.x), the method-dependent memory allocations are deferred to the first call of inflate() anyway. However those fields must be initialized since later versions of zlib that provide more compression methods may take advantage of this interface. In any case, no decompression is performed by inflateInit(), so the avail_out and next_out fields do not need to be initialized before calling.
Here avail_in is set to zero and next_in is set to Z_NULL to indicate that no input data is being provided.
/* allocate inflate state */ strm.zalloc = Z_NULL; strm.zfree = Z_NULL; strm.opaque = Z_NULL; strm.avail_in = 0; strm.next_in = Z_NULL; ret = inflateInit(&strm); if (ret != Z_OK) return ret;The outer do-loop decompresses input until inflate() indicates that it has reached the end of the compressed data and has produced all of the uncompressed output. This is in contrast to def() which processes all of the input file. If end-of-file is reached before the compressed data self-terminates, then the compressed data is incomplete and an error is returned.
/* decompress until deflate stream ends or end of file */ do {We read input data and set the strm structure accordingly. If we've reached the end of the input file, then we leave the outer loop and report an error, since the compressed data is incomplete. Note that we may read more data than is eventually consumed by inflate(), if the input file continues past the zlib stream. For applications where zlib streams are embedded in other data, this routine would need to be modified to return the unused data, or at least indicate how much of the input data was not used, so the application would know where to pick up after the zlib stream.
strm.avail_in = fread(in, 1, CHUNK, source); if (ferror(source)) { (void)inflateEnd(&strm); return Z_ERRNO; } if (strm.avail_in == 0) break; strm.next_in = in;The inner do-loop has the same function it did in def(), which is to keep calling inflate() until has generated all of the output it can with the provided input.
/* run inflate() on input until output buffer not full */ do {Just like in def(), the same output space is provided for each call of inflate().
strm.avail_out = CHUNK; strm.next_out = out;Now we run the decompression engine itself. There is no need to adjust the flush parameter, since the zlib format is self-terminating. The main difference here is that there are return values that we need to pay attention to. Z_DATA_ERROR indicates that inflate() detected an error in the zlib compressed data format, which means that either the data is not a zlib stream to begin with, or that the data was corrupted somewhere along the way since it was compressed. The other error to be processed is Z_MEM_ERROR, which can occur since memory allocation is deferred until inflate() needs it, unlike deflate(), whose memory is allocated at the start by deflateInit().
Advanced applications may use deflateSetDictionary() to prime deflate() with a set of likely data to improve the first 32K or so of compression. This is noted in the zlib header, so inflate() requests that that dictionary be provided before it can start to decompress. Without the dictionary, correct decompression is not possible. For this routine, we have no idea what the dictionary is, so the Z_NEED_DICT indication is converted to a Z_DATA_ERROR.
inflate() can also return Z_STREAM_ERROR, which should not be possible here, but could be checked for as noted above for def(). Z_BUF_ERROR does not need to be checked for here, for the same reasons noted for def(). Z_STREAM_END will be checked for later.
ret = inflate(&strm, Z_NO_FLUSH); assert(ret != Z_STREAM_ERROR); /* state not clobbered */ switch (ret) { case Z_NEED_DICT: ret = Z_DATA_ERROR; /* and fall through */ case Z_DATA_ERROR: case Z_MEM_ERROR: (void)inflateEnd(&strm); return ret; }The output of inflate() is handled identically to that of deflate().
have = CHUNK - strm.avail_out; if (fwrite(out, 1, have, dest) != have || ferror(dest)) { (void)inflateEnd(&strm); return Z_ERRNO; }The inner do-loop ends when inflate() has no more output as indicated by not filling the output buffer, just as for deflate(). In this case, we cannot assert that strm.avail_in will be zero, since the deflate stream may end before the file does.
} while (strm.avail_out == 0);The outer do-loop ends when inflate() reports that it has reached the end of the input zlib stream, has completed the decompression and integrity check, and has provided all of the output. This is indicated by the inflate() return value Z_STREAM_END. The inner loop is guaranteed to leave ret equal to Z_STREAM_END if the last chunk of the input file read contained the end of the zlib stream. So if the return value is not Z_STREAM_END, the loop continues to read more input.
/* done when inflate() says it's done */ } while (ret != Z_STREAM_END);At this point, decompression successfully completed, or we broke out of the loop due to no more data being available from the input file. If the last inflate() return value is not Z_STREAM_END, then the zlib stream was incomplete and a data error is returned. Otherwise, we return with a happy return value. Of course, inflateEnd() is called first to avoid a memory leak.
/* clean up and return */ (void)inflateEnd(&strm); return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR; }That ends the routines that directly use zlib. The following routines make this a command-line program by running data through the above routines from stdin to stdout, and handling any errors reported by def() or inf().
zerr() is used to interpret the possible error codes from def() and inf(), as detailed in their comments above, and print out an error message. Note that these are only a subset of the possible return values from deflate() and inflate().
/* report a zlib or i/o error */ void zerr(int ret) { fputs("zpipe: ", stderr); switch (ret) { case Z_ERRNO: if (ferror(stdin)) fputs("error reading stdin\n", stderr); if (ferror(stdout)) fputs("error writing stdout\n", stderr); break; case Z_STREAM_ERROR: fputs("invalid compression level\n", stderr); break; case Z_DATA_ERROR: fputs("invalid or incomplete deflate data\n", stderr); break; case Z_MEM_ERROR: fputs("out of memory\n", stderr); break; case Z_VERSION_ERROR: fputs("zlib version mismatch!\n", stderr); } }Here is the main() routine used to test def() and inf(). The zpipe command is simply a compression pipe from stdin to stdout, if no arguments are given, or it is a decompression pipe if zpipe -d is used. If any other arguments are provided, no compression or decompression is performed. Instead a usage message is displayed. Examples are zpipe < foo.txt > foo.txt.z to compress, and zpipe -d < foo.txt.z > foo.txt to decompress.
/* compress or decompress from stdin to stdout */ int main(int argc, char **argv) { int ret; /* avoid end-of-line conversions */ SET_BINARY_MODE(stdin); SET_BINARY_MODE(stdout); /* do compression if no arguments */ if (argc == 1) { ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION); if (ret != Z_OK) zerr(ret); return ret; } /* do decompression if -d specified */ else if (argc == 2 && strcmp(argv[1], "-d") == 0) { ret = inf(stdin, stdout); if (ret != Z_OK) zerr(ret); return ret; } /* otherwise, report usage */ else { fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr); return 1; } }


MovieClub
Sign up
Log in
Register
First Name
Last Name
Username
Password
Confirm Password
E-mail Address


00:00
00:05
00:10
00:15
00:20
00:25
00:30
00:35
00:40
00:45
00:50
00:55
01:00
01:05
01:10
01:15
01:20
01:25
01:30
01:35
01:40
01:45
01:50
02:00


Zend Framework provides support for file uploading by using features in Zend\Form, Zend\InputFilter, Zend\Validator, Zend\Filter, and Zend\ProgressBar. These reusable framework components provide a convenient and secure way for handling file uploads in your projects.
Note
If the reader has experience with file uploading in Zend Framework v1.x, he/she will notice some major differences. Zend_File\Transfer has been deprecated in favor of using the standard ZF2 Zend\Form and Zend\InputFilter features.
Note
The file upload features described here are specifically for forms using the POST method. Zend Framework itself does not currently provide specific support for handling uploads via the PUT method, but it is possible with PHP. See the PUT Method Support in the PHP documentation for more information.
Handling file uploads is essentially the same as how you would use Zend\Form for form processing, but with some slight caveats that will be described below.
In this example we will:
Here we define a Zend\Form\Element\File input in a Form class named UploadForm.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | // File: UploadForm.php
use Zend\Form\Element;
use Zend\Form\Form;
class UploadForm extends Form
{
public function __construct($name = null, $options = array())
{
parent::__construct($name, $options);
$this->addElements();
}
public function addElements()
{
// File Input
$file = new Element\File('image-file');
$file->setLabel('Avatar Image Upload')
->setAttribute('id', 'image-file');
$this->add($file);
}
}
|
The File element provides some automatic features that happen behind the scenes:
In the view template we render the <form>, a file input (with label and errors), and a submit button.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | // File: upload-form.phtml
<?php $form->prepare(); // The correct enctype is set here ?>
<?php echo $this->form()->openTag($form); ?>

<?php $fileElement = $form->get('image-file'); ?>
<?php echo $this->formLabel($fileElement); ?>
<?php echo $this->formFile($fileElement); ?>
<?php echo $this->formElementErrors($fileElement); ?>

<button>Submit</button>
<?php echo $this->form()->closeTag(); ?>
|
When rendered, the HTML should look similar to:
1 2 3 4 5 6 7 8 | <form name="upload-form" id="upload-form" method="post" enctype="multipart/form-data">

Avatar Image Upload
<input type="file" name="image-file" id="image-file">

<button>Submit</button>
</form>
|
For the final step, we will instantiate the UploadForm and process any postbacks in a Controller action.
The form processing in the controller action will be similar to normal forms, except that you must merge the $_FILES information in the request with the other post data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | // File: MyController.php
public function uploadFormAction()
{
$form = new UploadForm('upload-form');
$request = $this->getRequest();
if ($request->isPost()) {
// Make certain to merge the files info!
$post = array_merge_recursive(
$request->getPost()->toArray(),
$request->getFiles()->toArray()
);
$form->setData($post);
if ($form->isValid()) {
$data = $form->getData();
// Form is valid, save the form!
return $this->redirect()->toRoute('upload-form/success');
}
}
return array('form' => $form);
}
|
Upon a successful file upload, $form->getData() would return:
1 2 3 4 5 6 7 8 9 | array(1) {
["image-file"] => array(5) {
["name"] => string(11) "myimage.png"
["type"] => string(9) "image/png"
["tmp_name"] => string(22) "/private/tmp/phpgRXd58"
["error"] => int(0)
["size"] => int(14908679)
}
}
|
Note
It is suggested that you always use the Zend\Http\PhpEnvironment\Request object to retrieve and merge the $_FILES information with the form, instead of using $_FILES directly.
This is due to how the file information is mapped in the $_FILES array:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | // A $_FILES array with single input and multiple files:
array(1) {
["image-file"]=>array(2) {
["name"]=>array(2) {
[0]=>string(9)"file0.txt"
[1]=>string(9)"file1.txt"
}
["type"]=>array(2) {
[0]=>string(10)"text/plain"
[1]=>string(10)"text/html"
}
}
}
// How Zend\Http\PhpEnvironment\Request remaps the $_FILES array:
array(1) {
["image-file"]=>array(2) {
[0]=>array(2) {
["name"]=>string(9)"file0.txt"
["type"]=>string(10)"text/plain"
},
[1]=>array(2) {
["name"]=>string(9)"file1.txt"
["type"]=>string(10)"text/html"
}
}
}
|
Zend\InputFilter\FileInput expects the file data be in this re-mapped array format.
When using other standard form inputs (i.e. text, checkbox, select, etc.) along with file inputs in a Form, you can encounter a situation where some inputs may become invalid and the user must re-select the file and re-upload. PHP will delete uploaded files from the temporary directory at the end of the request if it has not been moved away or renamed. Re-uploading a valid file each time another form input is invalid is inefficient and annoying to users.
One strategy to get around this is to split the form into multiple forms. One form for the file upload inputs and another for the other standard inputs.
When you cannot separate the forms, the File Post-Redirect-Get Controller Plugin can be used to manage the file inputs and save off valid uploads until the entire form is valid.
Changing our earlier example to use the fileprg plugin will require two changes.
Adding a RenameUpload filter to our form’s file input, with details on where the valid files should be stored:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | // File: UploadForm.php
use Zend\InputFilter;
use Zend\Form\Element;
use Zend\Form\Form;
class UploadForm extends Form
{
public function __construct($name = null, $options = array())
{
parent::__construct($name, $options);
$this->addElements();
$this->addInputFilter();
}
public function addElements()
{
// File Input
$file = new Element\File('image-file');
$file->setLabel('Avatar Image Upload')
->setAttribute('id', 'image-file');
$this->add($file);
}
public function addInputFilter()
{
$inputFilter = new InputFilter\InputFilter();
// File Input
$fileInput = new InputFilter\FileInput('image-file');
$fileInput->setRequired(true);
$fileInput->getFilterChain()->attachByName(
'filerenameupload',
array(
'target' => './data/tmpuploads/avatar.png',
'randomize' => true,
)
);
$inputFilter->add($fileInput);
$this->setInputFilter($inputFilter);
}
}
|
The filerenameupload options above would cause an uploaded file to be renamed and moved to: ./data/tmpuploads/avatar_4b3403665fea6.png.
See the RenameUpload filter documentation for more information on its supported options.
And, changing the Controller action to use the fileprg plugin:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | // File: MyController.php
public function uploadFormAction()
{
$form = new UploadForm('upload-form');
$tempFile = null;
$prg = $this->fileprg($form);
if ($prg instanceof \Zend\Http\PhpEnvironment\Response) {
return $prg; // Return PRG redirect response
} elseif (is_array($prg)) {
if ($form->isValid()) {
$data = $form->getData();
// Form is valid, save the form!
return $this->redirect()->toRoute('upload-form/success');
} else {
// Form not valid, but file uploads might be valid...
// Get the temporary file information to show the user in the view
$fileErrors = $form->get('image-file')->getMessages();
if (empty($fileErrors)) {
$tempFile = $form->get('image-file')->getValue();
}
}
}
return array(
'form' => $form,
'tempFile' => $tempFile,
);
}
|
Behind the scenes, the FilePRG plugin will:
Note
In the case of a partially valid form, it is up to the developer whether to notify the user that files have been uploaded or not. For example, you may wish to hide the form input and/or display the file information. These things would be implementation details in the view or in a custom view helper. Just note that neither the FilePRG plugin nor the formFile view helper will do any automatic notifications or view changes when files have been successfully uploaded.
With HTML5 we are able to select multiple files from a single file input using the multiple attribute. Not all browsers support multiple file uploads, but the file input will safely remain a single file upload for those browsers that do not support the feature.
To enable multiple file uploads in Zend Framework, just set the file element’s multiple attribute to true:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | // File: UploadForm.php
use Zend\InputFilter;
use Zend\Form\Element;
use Zend\Form\Form;
class UploadForm extends Form
{
public function __construct($name = null, $options = array())
{
parent::__construct($name, $options);
$this->addElements();
$this->addInputFilter();
}
public function addElements()
{
// File Input
$file = new Element\File('image-file');
$file->setLabel('Avatar Image Upload')
->setAttribute('id', 'image-file')
->setAttribute('multiple', true); // That's it
$this->add($file);
}
public function addInputFilter()
{
$inputFilter = new InputFilter\InputFilter();
// File Input
$fileInput = new InputFilter\FileInput('image-file');
$fileInput->setRequired(true);
// You only need to define validators and filters
// as if only one file was being uploaded. All files
// will be run through the same validators and filters
// automatically.
$fileInput->getValidatorChain()
->attachByName('filesize', array('max' => 204800))
->attachByName('filemimetype', array('mimeType' => 'image/png,image/x-png'))
->attachByName('fileimagesize', array('maxWidth' => 100, 'maxHeight' => 100));
// All files will be renamed, i.e.:
// ./data/tmpuploads/avatar_4b3403665fea6.png,
// ./data/tmpuploads/avatar_5c45147660fb7.png
$fileInput->getFilterChain()->attachByName(
'filerenameupload',
array(
'target' => './data/tmpuploads/avatar.png',
'randomize' => true,
)
);
$inputFilter->add($fileInput);
$this->setInputFilter($inputFilter);
}
}
|
You do not need to do anything special with the validators and filters to support multiple file uploads. All of the files that are uploaded will have the same validators and filters run against them automatically (from logic within FileInput). You only need to define them as if one file was being uploaded.
While pure client-based upload progress meters are starting to become available with HTML5’s Progress Events, not all browsers have XMLHttpRequest level 2 support. For upload progress to work in a greater number of browsers (IE9 and below), you must use a server-side progress solution.
Zend\ProgressBar\Upload provides handlers that can give you the actual state of a file upload in progress. To use this feature you need to choose one of the Upload Progress Handlers (APC, uploadprogress, or Session) and ensure that your server setup has the appropriate extension or feature enabled.
Note
For this example we will use PHP 5.4‘s Session progress handler
PHP 5.4 is required and you may need to verify these php.ini settings for it to work:
file_uploads = On
post_max_size = 50M
upload_max_filesize = 50M
session.upload_progress.enabled = On
session.upload_progress.freq = "1%"
session.upload_progress.min_freq = "1"
; Also make certain 'upload_tmp_dir' is writable
When uploading a file with a form POST, you must also include the progress identifier in a hidden input. The File Upload Progress View Helpers provide a convenient way to add the hidden input based on your handler type.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | // File: upload-form.phtml
<?php $form->prepare(); ?>
<?php echo $this->form()->openTag($form); ?>
<?php echo $this->formFileSessionProgress(); // Must come before the file input! ?>

<?php $fileElement = $form->get('image-file'); ?>
<?php echo $this->formLabel($fileElement); ?>
<?php echo $this->formFile($fileElement); ?>
<?php echo $this->formElementErrors($fileElement); ?>

<button>Submit</button>
<?php echo $this->form()->closeTag(); ?>
|
When rendered, the HTML should look similar to:
1 2 3 4 5 6 7 8 9 10 | <form name="upload-form" id="upload-form" method="post" enctype="multipart/form-data">
<input type="hidden" id="progress_key" name="PHP_SESSION_UPLOAD_PROGRESS" value="12345abcde">

Avatar Image Upload
<input type="file" name="image-file" id="image-file">

<button>Submit</button>
</form>
|
There are a few different methods for getting progress information to the browser (long vs. short polling). Here we will use short polling since it is simpler and less taxing on server resources, though keep in mind it is not as responsive as long polling.
When our form is submitted via AJAX, the browser will continuously poll the server for upload progress.
The following is an example Controller action which provides the progress information:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | // File: MyController.php
public function uploadProgressAction()
{
$id = $this->params()->fromQuery('id', null);
$progress = new \Zend\ProgressBar\Upload\SessionProgress();
return new \Zend\View\Model\JsonModel($progress->getProgress($id));
}
// Returns JSON
//{
// "total" : 204800,
// "current" : 10240,
// "rate" : 1024,
// "message" : "10kB / 200kB",
// "done" : false
//}
|
Warning
This is not the most efficient way of providing upload progress, since each polling request must go through the Zend Framework bootstrap process. A better example would be to use a standalone php file in the public folder that bypasses the MVC bootstrapping and only uses the essential Zend\ProgressBar adapters.
Back in our view template, we will add the JavaScript to perform the AJAX POST of the form data, and to start a timeout interval for the progress polling. To keep the example code relatively short, we are using the jQuery Form plugin to do the AJAX form POST. If your project uses a different JavaScript framework (or none at all), this will hopefully at least illustrate the necessary high-level logic that would need to be performed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | // File: upload-form.phtml
// ...after the form...

|
And finally, our Controller action can be modified to return form status and validation messages in JSON format if we see the ‘isAjax’ post parameter (which was set in the JavaScript just before submit):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | // File: MyController.php
public function uploadFormAction()
{
$form = new UploadForm('upload-form');
$request = $this->getRequest();
if ($request->isPost()) {
// Make certain to merge the files info!
$post = array_merge_recursive(
$request->getPost()->toArray(),
$request->getFiles()->toArray()
);
$form->setData($post);
if ($form->isValid()) {
$data = $form->getData();
// Form is valid, save the form!
if (!empty($post['isAjax'])) {
return new JsonModel(array(
'status' => true,
'redirect' => $this->url()->fromRoute('upload-form/success'),
'formData' => $data,
));
} else {
// Fallback for non-JS clients
return $this->redirect()->toRoute('upload-form/success');
}
} else {
if (!empty($post['isAjax'])) {
// Send back failure information via JSON
return new JsonModel(array(
'status' => false,
'formErrors' => $form->getMessages(),
'formData' => $form->getData(),
));
}
}
}
return array('form' => $form);
}
|
Related documentation:
External resources and blog posts from the community:
The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.


Simply, And badly. It fetches a random stock photo from Pexels, Sticks a random motivational quote on it from a list of about 300 motivational quotes, And then it shows it to you.
This whole shit is a Flask app, When the index page is requested, It grabs a random image from Pexels using the Pexels API, Then it picks a quote from this file. Once the image and quote have been selected, It uses PIL to slap the quote on top of the image which is then saved to a file. Then it serves you index.html, Which contains the aforementioned image.
It's worth noting that the Pexels API is rate-limited to 200 requests per hour, And 20,000 requests per month. If that's exceeded, This app doesn't deal with it at all so it will probably just crash :)


Primary X-Axis:
Zoom Factor
Zoom Position
Primary Y-Axis:
Zoom Factor
Zoom Position
Series 1 Visibility
Visible
Hidden
Series 2 Visibility
Visible
Hidden


You already have an account! Fill this to make sure you have it and see your transactions
Client Details
Deposit
Withdraw


ssh-pkcs11-helper —
ssh-agent helper program for PKCS#11
support
ssh-pkcs11-helper is used by
ssh-agent(1) to access
keys provided by a PKCS#11 token.
ssh-pkcs11-helper is not intended to be invoked by
the user, but from
ssh-agent(1).
ssh(1),
ssh-add(1),
ssh-agent(1)
ssh-pkcs11-helper first appeared in
OpenBSD 4.7.
Markus Friedl
<
markus@openbsd.org>


| OLD line(s): 105
| NEW line(s): 106
<xsd:include schemaLocation="../../CorporateIncomeTax/Common/Dependencies/SaleOrExchangeOfCollectiblesStatement2.xsd" /> |
| OLD line(s): 106
| NEW line(s): 108
<xsd:include schemaLocation="../../CorporateIncomeTax/Common/Dependencies/Section481aAdjustmentStatement.xsd" /> |
| OLD line(s): 248
<xsd:include schemaLocation="../../CorporateIncomeTax/Common/IRS3115/Section481aAdjustmentStatement.xsd" /> | NEW line(s): 249
|
| OLD line(s): 328
<xsd:include schemaLocation="../../CorporateIncomeTax/Common/IRS8586/OverOnePassThroughEntitySchedule.xsd"/> | NEW line(s): 328
|
| OLD line(s): 378
| NEW line(s): 379,381
<!-- Includes for 8864 (supporting info, schedules, computations, and such) --> <xsd:include schemaLocation="../../CorporateIncomeTax/Common/IRS8864/EvidencePreviouslyFiledClaimForBiodieselSoldorUsedStatement.xsd" /> |
| OLD line(s): 440
<xsd:include schemaLocation="../../CorporateIncomeTax/Common/IRS8865ScheduleK1/SaleOrExchangeOfCollectiblesStatement2.xsd" /> | NEW line(s): 442
|
| OLD line(s): 454,457
<!-- Includes for 8900 (supporting info, schedules, computations, and such) --> <xsd:include schemaLocation="../../CorporateIncomeTax/Common/IRS8900/AssigneeRailroadTrackMilesStatement.xsd" /> <xsd:include schemaLocation="../../CorporateIncomeTax/Common/IRS8900/AssignorRailroadTrackMilesStatement.xsd" /> | NEW line(s): 455
|
| OLD line(s): 2096,2102
<xsd:element ref="OverOnePassThroughEntitySch" minOccurs="0" maxOccurs="unbounded"> <xsd:annotation> <xsd:documentation>Over One Pass-through Entity Schedule</xsd:documentation> </xsd:annotation> </xsd:element> <!-- Form 8586 schedule --> | NEW line(s): 2093
|
| OLD line(s): 2304
| NEW line(s): 2296,2302
<!-- Form 8864 --> <xsd:element ref="EvdncofPrevFldClmBiodieselStmt" minOccurs="0" maxOccurs="unbounded"> <xsd:annotation> <xsd:documentation>Evidence of a Previously Filed Claim for Biodiesel Sold or Used Statement</xsd:documentation> </xsd:annotation> </xsd:element> |
| OLD line(s): 2878,2891
<!-- Form 8900 statement --> <xsd:element ref="AssigneeRailroadTrackMilesStmt" minOccurs="0" maxOccurs="unbounded"> <xsd:annotation> <xsd:documentation>Assignee Railroad Track Miles Statement</xsd:documentation> </xsd:annotation> </xsd:element> <!-- Form 8900 statement --> <xsd:element ref="AssignorRailroadTrackMilesStmt" minOccurs="0" maxOccurs="unbounded"> <xsd:annotation> <xsd:documentation>Assignor Railroad Track Miles Statement</xsd:documentation> </xsd:annotation> </xsd:element> | NEW line(s): 2875
|


For right now here’s the tl:dr: Take your post payout listed on steemit.com and multiply by 5.5. That will tell you how many USD worth of Steem and SBD you’re going to get for your post at the time of payout. If you multiply by 5 this will give you a rough estimate of what it’s worth in liquid rewards.
Here’s the deal
When you look at a post and see the value that’s not actually USD (even though there is a dollar sign there). That number references post rewards, which is a combination of SBDs and SP that are going to be rewarded by the blockchain. It’s pretty complicated how it works so I thought I’d break it down for you so that’d you know what a post is worth.
I’m going to take my last post to payout as an example: https://steemit.com/mspwaves/@aggroed/minnow-mayor-town-hall-live-in-90-min
The post payout was 142.01. I’m going to call the units here Pay (post payout)
As the author I received 113.79Pay.
As curators folks received 28.22Pay
From those author rewards due to conversions in the system those 113.79 Pay turn into 56.895 SBD and 33.448 Steem Power.
(you’ll notice that SBD is at exactly 50% of Pay is dolled out as SBD rewards, “Rewards” when you post initially says 50/50 but conversions set by the witnesses distort it from that)
SBDs are worth $12.8 USD at the time of writing this. SP is worth 1.8.
So, from SBD I earned $728 USD. From SP I earned $60USD. For a grand total of $788.46.
So, if you’re looking for a fast way to figure out what it’s worth to you in USD simply take the post reward shown on the post and multiply by 5.5 and that will tell you roughly how much it’s worth in USD (this number is undergoing a lot of change right now because SBDs and Steem values are bouncing a lot). If you want to know what the liquid portion is worth just multiply post reards by 5.
Here’s a spreadsheet to help you see the USD value of a post when it pays out will be
https://docs.google.com/spreadsheets/d/18FOyy7ngm5Ar-7TWyaW0b46SYYFX4gqZgQhLZ7YlagY/edit?usp=sharing
This thing is subject to change so don’t take this as certain forever. Edit. It would also seem that people like to edit google sheets to the point they are unusable…
This page is synchronized from the post: ‘What’’s a post worth in USD right now?’


pcf.particle.aws.rds package¶
Submodules¶
pcf.particle.aws.rds.rds_instance module¶
-
class
pcf.particle.aws.rds.rds_instance.
RDS
(particle_definition, session=None)¶ Bases:
pcf.core.aws_resource.AWSResource
Particle that maps to AWS RDS Instance.
Required Parameters:
Parameters: - DBInstanceIdentifier (string) – The DB instance identifier.
- DBInstanceClass (string) – The compute and memory capacity of the DB instance, for example, db.m4.large .
- Engine (string) – The name of the database engine to be used for this instance.
-
START_PARAM_FILTER
= {'AllocatedStorage', 'AvailabilityZone', 'BackupRetentionPeriod', 'DBInstanceClass', 'DBInstanceIdentifier', 'DBName', 'DBParameterGroupName', 'DBSubnetGroupName', 'Engine', 'EngineVersion', 'KmsKeyId', 'MasterUserPassword', 'MasterUsername', 'MultiAZ', 'Port', 'StorageEncrypted', 'Tags', 'VpcSecurityGroupIds'}¶
-
UNIQUE_KEYS
= ['aws_resource.DBInstanceIdentifier']¶
-
UPDATE_PARAM_FILTER
= {'AllocatedStorage', 'ApplyImmediately', 'BackupRetentionPeriod', 'DBInstanceClass', 'DBInstanceIdentifier', 'EngineVersion'}¶
-
_set_unique_keys
()¶ Logic that sets keys from state definition that are used to uniquely identify the RDS Instance
-
_start
()¶ starts the stopped rds instance that matches current state definition
Returns: response of boto3 start rds instance with action start_db_instance.
-
_stop
()¶ Stops the rds instance that matches current state definition
Returns: response of boto3 stop rds instance with action stop_db_instance.
-
_terminate
()¶ Deletes the rds instance that matches current state definition
Returns: response of boto3 terminate resource rds instance with action delete_db_instance.
-
_update
()¶ Updates the rds instance that matches current state definition
Returns: response of boto3 change rds instance with modify_db_instance.
-
create
()¶ Creates the rds instance that matches current state definition
Returns: response of boto3 create rds instance with action create_db_instance.
-
flavor
= 'rds_instance'¶
-
get_status
()¶ Get the current status of your rds instance.
Returns: status of rds instance.
-
is_state_definition_equivalent
()¶ Determines if the current state definition matches the desired state definition.
Returns: bool
-
state_lookup
= {'available': <State.running: 1>, 'backing-up': <State.pending: 4>, 'creating': <State.pending: 4>, 'deleting': <State.pending: 4>, 'maintenance': <State.pending: 4>, 'missing': <State.terminated: 3>, 'modifying': <State.pending: 4>, 'rebooting': <State.pending: 4>, 'renaming': <State.pending: 4>, 'resetting-master-credentials': <State.pending: 4>, 'starting': <State.pending: 4>, 'stopped': <State.stopped: 2>, 'stopping': <State.pending: 4>, 'upgrading': <State.pending: 4>}¶
-
sync_state
()¶ Sync state calls get_status to determines and set the state of the rds instance particle.


Network Developer - New York, NY 10007
NOTE: Remote applicants welcome.
Company Overview:
Packet [https://www.packet.net/] is the leading bare metal automation platform for developers, which is available in 18 global locations and supports over 60,000 bare metal installs each month. In addition to its public cloud, the company offers a popular Private Deployment product targeted at SaaS companies and enterprises that want to take advantage of customized infrastructure with the automation and operational benefits of a public cloud.
Packet’s combination of flexible bare metal automation and focus on carrier-grade networking features has positioned it at the center of the edge computing conversation. The company is rapidly expanding its edge computing presence with some 50 new sites under development. In a departure from the hyperscale cloud model, Packet is inviting physical and supply chain partners to participate in what is expected to be a highly disaggregated and rapidly expanding ecosystem.
Central to Packet’s vision is a rethinking of the infrastructure “last mile” for a world that features widely distributed, diverse and specialized hardware in a cloud consumption model. Packet is working directly with global suppliers to accelerate the availability of hardware innovation.
Responsibilities:
Packet is the global leader in automated bare-metal infrastructure, and is seeking a Network Developer, working within its Network Engineering team.
In this position, you will be responsible for developing and maintaining tools that make our large network easier to manage. This includes automating device configuration, monitoring, and supporting the general needs of our network planning and scale-out.
We are looking for a candidate with not only an extensive technical background, but a passion for developing creative solutions on time and within budget. We offer a competitive compensation and benefits package, as well as the ability to work within a small and tightly-knit team building products which are truly first in industry.
Specific responsibilities include:
Developing, maintaining, and enhancing our set of open source and internally developed tools to solve for the tactical needs of Packet’s network architecture organization
Working holistically towards automating the bring-up of complex network hardware in new racks and facilities, as well as validating that all configurations and firmware remain in line with standards
Implementing our next generation of monitoring systems to provide insights into all parts of the network
Automated remediation of problems based on alerts generated from our monitoring systems
Automated traffic engineering of internal backbone and external provider-facing connectivity
Qualifications:
(4+) years of network engineering and operations experience
(4+) years of software development/scripting experience in a Linux environment
Experience working with configuration management frameworks such as Ansible and SaltStack
Deep understanding of network automation concepts at scale
Strong Linux systems administration and networking skills, along and proficiency with Python, Perl, Go
Knowledge and experience working with tools such as Jinja2, NAPALM, NetBox, Github, Prometheus, and Grafana
High-level understanding of network engineering concepts including L2/L3 protocols, data center networking, transit, peering, optical, and backbone networking / traffic engineering
Hands-on experience automating network bootstrapping (ZTP), backbone-level configuration, operational tooling, and code updates/change management
Experience with current-generation routers and switches from Cisco, Juniper, Arista, or a similar vendor
Experience with network traffic analysis platforms such as Kentik, Arbor, open source alternatives
Travel (< 5%) to Packet’s New York headquarters and relevant conferences and team events as required


Reports loops that cannot complete without index overflow or doesn't execute at all
Usually it happens because of mistake in update operationExample:
void foo(int s) {
for (int i = s; i > 12; i++) { // i-- should be here
System.out.println(i);
}
}
New in 2019.1


Speech
Schools Minister David Laws spoke at the Teaching Leaders graduation ceremony.
I am delighted to be here tonight to celebrate the achievement of the fourth graduating cohort of middle leaders from the Teaching Leaders Fellows Programme.
And thank you all for the hard work you are doing in your schools to improve the standards of education available to the children who are most in need of additional help. Your dedication to getting the most for your pupils is inspiring.
The importance of high-quality leadership in schools cannot be overstated.
Analysis of Ofsted inspection reports by McKinsey has shown that the overall performance of a school rarely exceeds the quality of its leadership and management.
For every 100 schools that have good leadership and management, 93 will have good standards of pupil achievement. For every 100 schools that do not have good leadership and management, only one will have good standards of pupil achievement. [i]
The support of great leadership and management helps all teachers to improve the quality of their teaching. And recruiting and training high-quality teachers for leadership positions amplifies their impact.
One great leader can build a team of great leaders. A team of great leaders can build a school of great teachers. And a school of great teachers can support thousands of children to achieve to their full potential.
It has long been held that having an outstanding headteacher can make a significant difference to the performance of a whole school. But it is not headteachers alone that make this difference. We need strong leaders at all levels within a school, working together as a team.
Middle leaders are able to take a direct role in improving teaching and learning. First and foremost they can act as models of great teaching. But they can also contribute to improving standards by helping other teachers to develop and by challenging under-performance. And they are at the forefront of developing curricula, and establishing systems to track and improve pupil progress.
Senior leaders benefit from distributing leadership to a strong group of middle-leaders because it frees up their time to focus on whole school improvement. Schools are stronger with great middle leaders because they are less reliant on a small group of senior leaders, and therefore more resilient to changes in the senior leadership team.
And by identifying and developing outstanding middle leaders today, we are able to help ensure that we will have a sufficient supply of outstanding headteachers in the future.
We need great school leaders because the challenges are great. Around 40% of young people still fail to secure 5 GCSEs at grade C and above, including English and maths, rising to above 60% when we look only at children from poorer families. These figures remain completely unacceptable for an advanced society such as England. We cannot accept these levels of educational failure, and there is nothing inevitable about this.
Excellent practice does of course already exist, and some schools are closing the gap between poorer children and their better off peers. But the attainment of pupils who are eligible for free school meals varies greatly between schools in different regions. There are too few secondary schools outside London where large numbers of pupils from poorer backgrounds are matching the attainment of their peers.
A recent report from Ofsted found that attainment at GCSE varies across the regions of England by 23 percentage points for pupils eligible for free school meals. But attainment varies by only 6 percentage points for pupils who are not eligible for free school meals.
In 2012, there were only 97 secondary schools in England with over 14% of pupils eligible for free school meals where these pupils attained above the national average at GCSE . Sixty-four of these 97 schools were in London. Well done London. But we have to be concerned that there were none in the South West or South East of England. [ii]
So schools with a strong record of attainment amongst all of their pupils are heavily concentrated in London. The weakest performing schools are spread across the country, and often in smaller towns rather than large urban areas.
And the greatest challenge is that within schools the quality of teaching varies too much. The Sutton Trust estimate that having a very effective rather than an average teacher raises each pupil’s attainment by a third of a GCSE grade. [iii]
This is both a striking finding and a great opportunity. It makes clear the consequences for individual children of ending up in the wrong class at school. But it also gives us a clear indication of what we need to do.
The quality of teaching is absolutely critical. And middle leaders like you can make improvements across a department so that all of the pupils benefit from the same high standards of teaching.
We look to you to help us meet these challenges. Teaching Leaders identifies and develops middle leaders to improve teaching in the most challenging schools, and for the pupils who will benefit most from it.
In 5 years, Teaching Leaders has grown from a pilot of 25 middle leaders to over 776 fellows in 365 schools. The vast majority of alumni stay in education. Of those from the 2011 cohort staying in education in the UK:
You and your cohort are improving teaching for around 15,000 pupils in 81 schools. The pupils for whom you are responsible are making more progress and achieving better GCSE results than the national average. And this is especially impressive given they come from groups that are too often expected to fail.
These pupils are being helped by outstanding teaching leaders such as Shamim Hussain. Shamim is Head of Maths at Lilian Baylis Technology School in Lambeth, where 76% of pupils are eligible for free school meals.
He has introduced systems to monitor and support teachers in the maths department. This has led to the majority of the team being rated ‘outstanding’ by Ofsted, and the rest as ‘good’. Shamim also introduced systems to track student progress against challenging targets, giving pupils a clear picture of the learning gaps that they needed to address. Seventy-nine per cent of Shamim’s pupils made 3 or more levels of progress, significantly higher than the national average.
Jackie Bowen started the Teaching Leaders programme as Head of English and is now Assistant Vice Principal for Achievement at Cedar Mount Academy in Gorton, Manchester. Jackie worked with her team to move each member of staff up at least one Ofsted grade. Having been judged ‘inadequate’ when she arrived, 80% of Jackie’s team now secure ‘good’ or better in lesson observations.
Jackie’s work has helped achieve big increases in the proportion of pupils making expected progress and the proportion achieving a grade from A* to C. And this has been a success for pupils of all backgrounds. Amongst Jackie’s pupils there was no gap between the attainment of those eligible for the pupil premium and the rest of the cohort. If ever you needed proof that the gap between the achievement of poorer and better off pupils is not inevitable, Jackie has provided it.
This demonstrates what can be achieved. But we want to do more, especially in those areas that have not benefitted from the programme so far.
So I am pleased to announce that the Department for Education is investing an additional £9.9 million in Teaching Leaders from 2014 to 2016.
This funding will more than double the number of Teaching Leaders fellows and alumni from 776 to 1,706. This means over 900 new fellows, working with 3,000 classroom teachers, to improve teaching for 150,000 pupils.
And as well as creating more fellows we want to expand their reach. We want Teaching Leaders to work with schools outside of the urban areas that already benefit from the programme. This will include schools in the East Midlands, Humberside, West Yorkshire, the North East and Merseyside.
The new fellows in these areas will benefit from the same intensive programme that you all received. They will receive face-to-face coaching, and there will also be local evening training and more geographically-focused networks, providing opportunities to share with other middle leaders from their area.
But, of course, we must continue to improve the impact of the programme. Teaching Leaders has already found ways to enable more middle leaders to benefit from the programme within the funding that is available. Getting more from the money we spend is essential given the financial constraints that we face. I would like to thank you for this achievement.
My challenge to Teaching Leaders, and to you, is that whilst the programme grows in terms of the numbers of pupils it benefits, it also continues to grow in terms of the impact it has.
I want you to be at the heart of a self-improving school system:
We look to you to provide the proof that by putting the teaching profession in charge of school improvement we can ensure that all children have the opportunity to succeed.
Thank you for everything you have achieved and will achieve. I wish all of you the very best for your future careers.
[i] Barber et al. Capturing the leadership premium: How the world’s top school systems are building leadership capacity for the future (2008). A similar piece of analysis was included in Ofsted’s annual report for 2009 to 2010: “In 96% of the primary schools and 95% of the secondary schools inspected this year, where the teaching was good or outstanding, the leadership and management of teaching and learning were also judged to be good or outstanding.”
[ii] Unseen children: access and achievement 20 years on - Evidence report, Ofsted, June 2013
[iii] Improving the impact of teacher on pupil achievement in the UK – Interim findings, Sutton Trust, September 2011
Published: 8 November 2013


cccrm: Concordance Correlation Coefficient for Repeated (and
Non-Repeated) Measures
Estimates the Concordance Correlation Coefficient to assess agreement. The scenarios considered are non-repeated measures, non-longitudinal repeated measures (replicates) and longitudinal repeated measures. The estimation approaches implemented are variance components and U-statistics approaches.
| Version: |
1.2.1 |
| Depends: |
R (≥ 3.1.0), nlme, gdata |
| Published: |
2015-07-08 |
| Author: |
Josep Lluis Carrasco, Josep Puig Martinez |
| Maintainer: |
Josep Lluis Carrasco <jlcarrasco at ub.edu> |
| License: |
GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| NeedsCompilation: |
no |
| CRAN checks: |
cccrm results |
Downloads:
Reverse dependencies:
Linking:
Please use the canonical form
https://CRAN.R-project.org/package=cccrm
to link to this page.


Lessons are always FUN AND EXCITING. The perfect balance of learning, counter-balanced with a young at heart still loves Rock n Roll real world touch. A great learning experience. Demetri is FRIENDLY, UNDERSTANDING, POSITIVE, KIND, PATIENT, COMFORTABLE. The best teacher ever. He is dependable, flexible, and very skilled in note reading and music theory. The student are saying they get -- CONFIDENCE, ABLE TO PLAY SEVERAL SONGS VERY WELL, DEVELOP A PASSION AND DRIVE, ENTER HIGH SCHOOL JAZZ BAND WITH SKILLS, PLAY A SPECIAL SONG.
My lessons always start the same way, with a question and a statement: What song do you want to play? Show me what you know and I will try to show you something you don't know. I can hear any song once, know the chords to the song and put the song into a skill level that will give you the satisfaction of accomplishment. That is my technique for teaching and it is simply the best!
"Demetri is one of the best teachers I've ever had.  He was friendly to me since the moment I met him and always gave me fair prices on lessons. I wholeheartedly recommend him to anyone who wants a great learning experience.” - Efrain
"My 9 year old son has been taking guitar lessons from Demetri for almost a year now. Prior to lessons, my son knew nothing about playing the guitar. Now he can play many different songs very well. As well as, he has developed such a passion and drive for playing the guitar, which I attribute to Demetri's way of teaching. Not only is Demetri kind and patient, but he makes every lesson fun and exciting for my son." - Pamela
"Thank you Demetri! You really have been amazing to our family and to see Makayla have passion about something makes us so happy. You have been so patient with her and wonderful. I know our house had been crazy running in and out to sports and events. Have a wonderful Christmas and see you soon!" - April


Sotheby’s Auction House Launches Wine Brands Part I
by Liza B. ZimmermanMost auction houses are best known for selling the wines of upscale producers. Few have yet to put their personal mark on the world of international wine sales. However, the New York- and London-based Sotheby’s has thrown its private-label collection into the ring.At the end of October, the auction house announced its debut of a primarily European collection of wines which sell from $16.95 for the Prosecco, to $29.95 for a Champagne. The 12 wines in the current collection include:
Non-vintage Sotheby's Champagne: Blanc de Blancs, Grand Cru, $36.95 USD (bottle) $79.95 USD (Magnum)
2018 Sotheby's Prosecco: Valdobbiadene Superiore Brut, $16.95
2018 Sotheby’s Sancerre Blanc, $22.95 USD
2016 Sotheby’s Bourgogne Blanc, $36.95 USD
2018 Sotheby’s Sonoma County Chardonnay, $24.95 USD
2018 Sotheby’s Sancerre Rosé, $22.95 USD
2016 Sotheby’s Bourgogne Rouge, $36.95 USD
2017 Sotheby’s Sonoma Coast Pinot Noir, $39.95 USD
2017 Sotheby’s Langhe Nebbiolo, $24.95 USD
2017 Sotheby’s St. Émilion, $34.95USD
2017 Sotheby’s Pessac-Léognan, $24.95 USD
2010 Sotheby’s Haut Médoc, $24.95 USD
I had a recent chat with Jamie Ritchie, the chairman of Sotheby’s Wine about the new wines’ rollout.
All responses have been edited for length and clarity.
Liza B. Zimmerman (LBZ): Why did you decide to launch these wines?
Jamie Ritchie (JR): Selecting wine can be intimidating for many people and so we have launched a range of Sotheby’s-branded wines that will assure the consumer that they are getting the best value from classic regions at affordable prices. We have both the expertise and relationships to ensure that each wine is of high quality, authentic to the region and good value for the money.
LBZ: Where did you source them?
JR: The wines were sourced from producers whose wines we like and with whom we have great relationships.
LBZ: How did you choose which regions and grapes to feature?
JR: We wanted to launch our initial range with 12 wines, six red, three white, two sparkling and one rosé. Most of the initial 12 are the wines and appellations that have sold best in our New York retail business and we will continue to expand the range over time.
LBZ: Do you plan to create more domestic labels?
JR: Yes, included in this initial collection we have a Sonoma Chardonnay and a Sonoma Pinot Noir and there are plans to add more domestic selections over time.
LBZ: Who is the demographic for them? Current auction customers or the general wine market?
JR: The general wine market – consumers who want to be reassured that they are getting great wines that offer good value for the money
LBZ: Are you planning to do wine club and other promotions with them?
JR: In due course, that is a logical next step
JR: I think they are different and serve a different purpose. For instance, the producers that we have worked with are prominently disclosed on the front label as we are very proud of our relationships with them. So consumers know they are going to get something great inside the bottle.


1) Telecommunication Specialist
Job Reference No: TCS25
What will you do?
You will serve as a Telecommunications Specialist in the AL TECHNOLOGIES ,Dhaka
Salary Range: A$50 000- 90 000 per year
Key responsibilities:
- You will provide for maintenance and repair of the Commands commercial trunked voice radio systems,
conventional voice radio repeater systems, and associated microwave radio repeater networks.
- You will provide for evaluation of alternate approaches for satisfying the requirements of the Commands commercial
trunked voice radio systems, conventional voice radio repeater systems, and associated microwave radio repeater networks.
- • You will provide for maintenance and repair of the Commands commercial computer hardware suites, including peripherals such as printers,
scanners and external voice and data storage and retrieval devices
- • You will provide for maintenance and repair for a variety of electronic equipment; i.e., public address systems, intercom systems,
solar power systems, and operator alignment of electronic support equipment.
- • You will assist project managers and SMEs during evaluations of alternate approaches for satisfying the requirements of the Command?s associated microwave radio repeater networks,
Information Technology systems (computers) and other requirements.
Apply
Experience needed
Essential:
- Have a bachelor degree in Computer Science or Information Technology
- Age: 18-50 years old
- Have a great skill on C++, Python,Ruby
- Be able to work in teams
- Proven experience as a Telecommunication Specialist
- Have a knowledge of Information Technology standards, policies and established system design approaches;
knowledge of digital and analog communications requirements, voice radio systems, and switching systems; modifying and
adapting precedentsystem approaches to meet specialized requirements of new projects; AND maintaining and repairing electronic equipment.
Preferable:
- Have a Cisco Certification
- Decision-making skills are needed
- Expertise in solving problems
- Competent worker
2) Security Specialist
Job Reference No: SSI52
What will you do?
You will serve as a TELECOMMUNICATIONS SPECIALIST in the AL TECHNOLOGIES HQ,Dhaka
Salary Range: $50 000-70 000 per year
Key responsibilities:
- You have to keep an eye on our network enterprise and help us to point out any matter.
- Make a Strategy outline to validate company private information and construct blue print for redemption of previous data
- Serve as a security proffesional and supervise trainers
- You are responsible to draft approach and principles
- Reporting to IT team regards any early matters happen in our network enterprise
Apply
Experience needed
Essential:
- Have a bachelor degree in Computer science or Information Technology
- Age: 18-50 years old
- Have a great skill on C++ or PHP language
- Be able to work in teams
- Proven experience as a Security Specialist
- Have a knowledge on Patch Management,Firewalls and intrusion detection
Preferable:
- Have a Cisco Certification
- Decision-making skills are needed
- Expertise in solving problems
- Competent worker


Web Audio API examples: AudioContext object's states
Create context
Suspend context
Stop context
Current context time: No context exists.


Full Stack Web Developer and Engineering professional continually learning and developing new skills to utilize within an organization. Background in developing automated solutions for a world-class 24/7 manufacturing environment, including projects integrating machinery into an internet-of-things (IoT) system for viewing current states of the devices.
Originally a design and manufacturing engineer, responsibilities included designing and implementing inventive solutions for a wide variety of issues. Several of these issues were best resolved with developing software to automate manual systems that were error prone, unreliable, and consistency impacted on-time delivery and quality costs.
Further expansion of this skill set resulted in developing programs ensuring new production capabilities were completely digital allowing data collection for all aspects of the manufacturing process. This production capability integrated network capable low voltage hardware into the machinery which would transmit information to the database in addition to interfaces for operators at each process step to capture operational data for the system.
Resume