Sun Labs Lively Kernel a highly dynamic web programming environment
built around JavaScript, asynchronous networking and other existing web
technologies. Lively Kernel and applications built for it are intended
to run in a regular web browser with no installation or plug-in components
whatsoever. The system even includes development tools that allow JavaScript
applications to be inspected and modified from within the system itself.
In this tutorial we provide a step-by-step summary of the main features of the system.
Note that Lively Kernel applications aren't usally run inside
HTML web pages. However, in this tutorial we have used the
conventional HTML format so that the features of the system
can be viewed also by people who do not have a compatible web browser.
In order to run all the examples properly, you will need a compatible
web browser such as Apple Safari 3.0 or Mozilla Firefox 3.0.
For best viewing experience and performance,
we recommend Safari 3.0.
With Mozilla Firefox,
many of the features still don't work fully, and the
performance of the system may be inadequate.
Note that Lively Kernel currently doesn't
run in Microsoft Internet Explorer. We hope to have
support for Internet Explorer available soon.
Screenshot of the Lively Kernel system
Below is a screenshot of the Lively Kernel system.
This is approximately what you should see when you click
the "Enter Lively Kernel" link below.
In order to view the HTML tutorial,
click the "Begin Interactive Tutorial" link instead.
Click
to learn how to use Lively Kernel.
You can also
to try out the Lively Kernel system yourself.


This page benchmarks the performance of a collection of matrix libraries for numerical computation.
Sylvester (v0.1.3, 2015-11-19).
Benchmarks for each library are run in an iframe. Results measure hundreds of iterations per second of the target operation.
Adapted by Waylon Flinn from the benchmarks created by Stephen Bannasch for glmatrix library.
JavaScript Plotting library: Flotr;
Sortable Table by Andrew Tetlaw.
The source code for these benchmarks can be found here on github. Pull requests welcome!


Painting trim. It's like painting walls, only narrower and more annoying.
3/27/2009, 12:55:47 PM
Favs: 0
Retweets: 0
link--- layout: tweet ---
Painting trim. It's like painting walls, only narrower and more annoying.
3/27/2009, 12:55:47 PM
Favs: 0
Retweets: 0
link


{% extends 'layout.html' %} {% block body %} Get your free account Ready to Organize and/or Participate in amazing activities? Make new friends, learn new skills? Even make some money out of your hobby GetOut is the place for you {% from "includes/_formhelpers.html" import render_field %} {{ form.hidden_tag() }} {{render_field(form.first_name)}} {{render_field(form.last_name)}} {{render_field(form.username)}} {{render_field(form.email)}} {{render_field(form.password)}} {{render_field(form.confirm)}} By creating an account you agree to our Terms and Conditions {% endblock %}
Ready to Organize and/or Participate in amazing activities?
Make new friends, learn new skills?
Even make some money out of your hobby
By creating an account you agree to our Terms and Conditions


@* * Copyright 2021 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import uk.gov.hmrc.play.views.html.helpers.form @import views.html.main_template @import views.html.helpers._ @import play.api.Application @import common.Dates @import models._ @import config.ApplicationConfig @(taxYear: TaxYearModel)(implicit request: Request[_], messages: Messages, application: Application, applicationConfig: ApplicationConfig) @main_template( Messages("calc.nonresident.outsideTaxYears.title") ) { @Messages("calc.base.back")
@Messages("calc.nonresident.outsideTaxYears.message", taxYear.calculationTaxYear)
@Messages("calc.base.button.continue") }


Fishing Guild Member Klufe:
Nice to meet you! Interested in learning about fishing?
There's no better way to enjoy a warm summer day, I can promise you that!
Ask how to fish.
Fishing Contest
Learn fishing skill.
Buy/Sell/Refund.
Sell fish.
View information about the local lord and tax rate.
Quest


Sensex at record closing high amid strong gains in metal, banking & telecom stocks; Nifty ends at 12,074
by AgenciesHighlights
- Top gainers in the sensex pack include Airtel, Tata Steel, IndusInd Bank, Axis Bank and HDFC with their stocks rising as much as 7.20 per cent
- On the other hand, Yes Bank and ONGC slipped as much as 2.17 per cent
- During the late deals, sensex also touched an all-time intra-day high of 40,932
MUMBAI: Market benchmark BSE sensex jumped over 500 points on Monday amid strong gains in metal, banking and telecom stocks on positive cues from global equities. The 30-share BSE index surged 530 points or 1.31 per cent to close at 40,889, while the broader NSE Nifty moved 159 points or 1.34 per cent higher to settle at 12,074.
Top gainers in the sensex pack include Bharti Airtel, Tata Steel, IndusInd Bank, Axis Bank, HDFC, Maruti and Vedanta with their stocks rising as much as 7.20 per cent.
On the other hand, Yes Bank and ONGC slipped as much as 2.17 per cent. During the late deals, sensex also touched an all-time intra-day high of 40,932.
On NSE, except for Nifty Media, all other sub-indices finished in green with Nifty Metal and Nifty Auto rising as much as 3.09 per cent.
According to traders, domestic benchmarks followed global equities which were enthused by fresh optimism over a trade truce between the US and China amid reports that an initial deal may be signed by the end of this year.
Bourses in Shanghai, Hong Kong, Seoul and Tokyo were trading up to 1.50 per cent higher.
Stock exchanges in Europe also opened on a positive note.
On the currency front, the rupee appreciated marginally against the US dollar to 71.69 in early session.
Brent futures, the global oil benchmark, rose 0.21 per cent to $62.50 per barrel.
Meanwhile, foreign institutional investors (FIIs) bought shares worth Rs 305.72 crore in the capital market in the previous session, while domestic institutional investors (DIIs) sold equities worth Rs 177.37 crore, data available with stock exchange showed.


Site content curated by OWPER and partners
OWPER Tech Page
Contact<EMAIL_ADDRESS>with questions
Site Build 2021-02-05


Chapter 6 edgeR TMM
TMM (Trimmed median of m-values) is another method borrowed from RNA-Seq analysis. This method uses, or calculates a reference sample, and compares all other samples to the reference sample. The size factor is the mean of the log-ratios after excluding the highest count taxa and taxa with the largest fold change. As taxa with zero counts are excluded, a pseudocount is needed. Additionally, there is the TMMwsp
option which is encouraged as it is more robust to zero counts. Positive counts are reused to increase the number of features when we compared. The singleton positive counts are paired up in decreasing order of size and then a modified TMM method is applied to the re-ordered libraries.
6.1 EdgeR TMM implementatin
norm_TMM <- function(physeq, group = 1, method="TMM", pseudocount = 1, ...){
require("edgeR", quietly = T)
require("phyloseq", quietly = T)
# Enforce orientation.
if( !taxa_are_rows(physeq) ){ physeq <- t(physeq) }
x = as(otu_table(physeq), "matrix")
# Add one to protect against overflow, log(0) issues.
x = x + pseudocount
# Check `group` argument
if( identical(all.equal(length(group), 1), TRUE) & nsamples(physeq) > 1 ){
# Assume that group was a sample variable name (must be categorical)
group = get_variable(physeq, group)
}
# Define gene annotations (`genes`) as tax_table
taxonomy = tax_table(physeq, errorIfNULL=FALSE)
if( !is.null(taxonomy) ){
taxonomy = data.frame(as(taxonomy, "matrix"))
}
# Now turn into a DGEList
y = DGEList(counts=x, group=group, genes=taxonomy, remove.zeros = TRUE)
# Calculate the normalization factors
d = edgeR::calcNormFactors(y, method=method)
# Check for division by zero inside `calcNormFactors`
if( !all(is.finite(d$samples$norm.factors)) ){
stop("Something wrong with edgeR::calcNormFactors on this data,
non-finite $norm.factors, consider changing `method` argument")
}
scalingFactor <- d$samples$norm.factors * d$samples$lib.size / 1e6
dataNormalized <- t(t(otu_table(physeq)) / scalingFactor)
#dataNormalized <- cpm(d)
otu <- otu_table(dataNormalized, taxa_are_rows = T)
sam <- access(physeq, "sam_data")
sam$scaling_factor <- scalingFactor
tax <- access(physeq, "tax_table")
phy <- access(physeq, "phy_tree")
ps_edgeR <- phyloseq(otu,sam,tax,phy)
return(ps_edgeR)
}


The Historic Sites Of Lafayette
Next
City of Lafayette Website
A Brief History of Lafayette
Lafayette Interactive Walking Tour
Lafayette Historical Coal Mines
Back To My Projects Page
This site is a brief look into the historical significance of Lafayette Colorado. Use the jump to menu above or begin by clicking on the outline of Colorado to look deeper.
Created and Updated by Patrick Gorman. Last Update: 11/15/09


Instructions
- You are given a random number to start the game.
- There are 4 crystals below. When you click on a crystal you will add a specific number to your point total.
- You win by matching your total to the random number.
- The crystal values are hidden -- You will find the number value once you click on them.
- Each time the game starts the crystal values will change.


We strive to include as many complete genomes as possible, provided they are released publicly and meet reasonable quality standards. We are open for suggestions and are willing to adapt our priority queue based on user requests. If you want to analyze your "own" genomes, you can use the
OMA standalone pipeline to do so and even make use of already analyzed genomes using the export function. OMA standalone is licenced under the Mozilla Public License Version 2.0. In a nutshell, OMA standalone is open source and free for commercial and non-commercial use.


--- layout: post title: Phone doodle date: '2014-09-12T07:30:39+02:00' categories: - Sketches picture_url: https://film-Storyboards.tumblr.com/post/97296908750/phone-doodle ---
Phone doodle.


mor::Analysis - Phylogenetic analysis functions
use strict; use mor::Log; use mor::Settings; use mor::DatabaseIO; use mor::Utilities; use Bio::TreeIO; use vars qw( $log *settings $maindb );
This module does phylogenetic analyses using the programs RAxML and PAUP*
raxml
Title : raxml Usage : my @raxmlFiles = mor::Analysis::raxml($alnObj) Function: Runs a ML analysis on a passed in Bio::Align object Returns : Returns an array of the file names that are created Args : a Bio::Align object.createPAUPfile
Title : createPAUPfile Usage : my $runFile = mor::Analysis::createPAUPfile($nexus, $batchFile, $paupBlock, @keywords,@replacements) Function: Creates a PAUP* batch file, by appending a paup block from a nexus file to a character matrix in a nexus file. Returns : The file name of the batch file (same as $batchFile) Args : The file name of an alignment in nexus format The file name of the batch file that will be run with mor::runPAUP The file name of the paup command block An array of words in the paup block that are to be replaced An array of related words in that are filled in.runPAUP
Title : runPAUP Usage : mor::Analysis::runPAUP($runFile) Function: Runs PAUP* on a supplied batch file Returns : Nothing Args : The file name of the batch file
The mor Team - http://mor.clarku.edu/morTeam.php
Hey! The above document had some coding errors, which are explained below:
Unknown directive: =chapter
Unknown directive: =chapter
You can't have =items (as at line 140) unless the first thing after the =over is an =item
Unknown directive: =function


Writing good code is hard, or at least it can be. A major challenge is to ensure that your code remains correct as you add new functionality.
Unit testing is a modern, light-weight testing methodology in widespread use in many programming languages. Development that relies on unit tests is often referred to as Test-Driven Development (TDD). Most Twisted code is tested using TDD.
To gain a solid understanding of unit testing in Python, you should read the unittest -- Unit testing framework chapter of the Python Library Reference. There is also a ton of information available online and in books.
Introductory example of Python unit testing
This document is principally a guide to Trial, Twisted's unit testing framework. Trial is based on Python's unit testing framework. While we do not aim to give a comprehensive guide to general Python unit testing, it will be helpful to consider a simple non-networked example before expanding to cover a networking code that requires the special capabilities of Trial. If you are already familiar with unit test in Python, jump straight to the section specific to testing Twisted code.
_N
(where the N
are successive
integers) to file names to keep them separate. This is a minor visual
distraction that should be ignored.Creating an API and writing tests
We'll create a library for arithmetic calculation. First, create a
project structure with a directory called calculus
containing an empty __init__.py
file.
Then put the following simple class definition API into calculus/base_1.py
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
# -*- test-case-name: calculus.test.test_base_1 -*- class Calculation(object): def add(self, a, b): pass def subtract(self, a, b): pass def multiply(self, a, b): pass def divide(self, a, b): pass
(Ignore the test-case-name
comment for
now. You'll see why that's useful below.)
We've written the interface, but not the code. Now we'll write a set of tests. At this point of development, we'll be expecting all tests to fail. Don't worry, that's part of the point. Once we have a test framework functioning, and we have some decent tests written (and failing!), we'll go and do the actual development of our calculation API. This is the preferred way to work for many people using TDD - write tests first, make sure they fail, then do development. Others are not so strict and write tests after doing the development.
Create a test
directory beneath calculus
, with an empty __init__.py
file. In a calculus/test/test_base_1.py
, put the
following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
from calculus.base_1 import Calculation from twisted.trial import unittest class CalculationTestCase(unittest.TestCase): def test_add(self): calc = Calculation() result = calc.add(3, 8) self.assertEqual(result, 11) def test_subtract(self): calc = Calculation() result = calc.subtract(7, 3) self.assertEqual(result, 4) def test_multiply(self): calc = Calculation() result = calc.multiply(12, 5) self.assertEqual(result, 60) def test_divide(self): calc = Calculation() result = calc.divide(12, 5) self.assertEqual(result, 2)
You should now have the following 4 files:
calculus/__init__.py calculus/base_1.py calculus/test/__init__.py calculus/test/test_base_1.py
To run the tests, there are two things you must get set up. Make sure you get these both done - nothing below will work unless you do.
First, make sure that the directory that contains your
calculus
directory is in your Python load path. If you're
using the Bash shell on some form of unix (e.g., Linux, Mac OS X), run
PYTHONPATH="$PYTHONPATH:`pwd`/.."
at
the command line in the calculus
directory. Once you have your
Python path set up correctly, you should be able to run Python from the
command line and import calculus
without seeing
an import error.
Second, make sure you can run the trial
command. That is, make sure the directory containing the trial
program on you system is in your shell's PATH
. The easiest way to check if you have this is to
try running trial --help
at the command line. If
you see a list of invocation options, you're in business. If your shell
reports something like trial: command not found
,
make sure you have Twisted installed properly, and that the Twisted
bin
directory is in your PATH
. If
you don't know how to do this, get some local help, or figure it out by
searching online for information on setting and changing environment
variables for you operating system.
With those (one-time) preliminary steps out of the way, let's perform
the tests. Run trial calculus.test.test_base_1
from the
command line from the calculus
directory.
You should see the following output (though your files are probably not in
/tmp
:
$ trial calculus.test.test_base_1 calculus.test.test_base_1 CalculationTestCase test_add ... [FAIL] test_divide ... [FAIL] test_multiply ... [FAIL] test_subtract ... [FAIL] =============================================================================== [FAIL] Traceback (most recent call last): File "/tmp/calculus/test/test_base_1.py", line 8, in test_add self.assertEqual(result, 11) twisted.trial.unittest.FailTest: not equal: a = None b = 11 calculus.test.test_base_1.CalculationTestCase.test_add =============================================================================== [FAIL] Traceback (most recent call last): File "/tmp/calculus/test/test_base_1.py", line 23, in test_divide self.assertEqual(result, 2) twisted.trial.unittest.FailTest: not equal: a = None b = 2 calculus.test.test_base_1.CalculationTestCase.test_divide =============================================================================== [FAIL] Traceback (most recent call last): File "/tmp/calculus/test/test_base_1.py", line 18, in test_multiply self.assertEqual(result, 60) twisted.trial.unittest.FailTest: not equal: a = None b = 60 calculus.test.test_base_1.CalculationTestCase.test_multiply =============================================================================== [FAIL] Traceback (most recent call last): File "/tmp/calculus/test/test_base_1.py", line 13, in test_subtract self.assertEqual(result, 4) twisted.trial.unittest.FailTest: not equal: a = None b = 4 calculus.test.test_base_1.CalculationTestCase.test_subtract ------------------------------------------------------------------------------- Ran 4 tests in 0.042s FAILED (failures=4)
How to interpret this output? You get a list of the individual tests, each
followed by its result. By default, failures are printed at the end, but this
can be changed with the -e
(or --rterrors
) option.
One very useful thing in this output is the fully-qualified name of the
failed tests. This appears at the bottom of each =-delimited area of the
output. This allows you to copy and paste it to just run a single test you're
interested in. In our example, you could run trial
calculus.test.test_base_1.CalculationTestCase.test_subtract
from the
shell.
Note that trial can use different reporters to modify its output. Run
trial --help-reporters
to see a list of
reporters.
The tests can be run by trial
in multiple ways:
trial calculus
: run all the tests for the calculus package.trial calculus.test
: run using Python'simport
notation.trial calculus.test.test_base_1
: as above, for a specific test module. You can follow that logic by putting your class name and even a method name to only run those specific tests.trial --testmodule=calculus/base_1.py
: use thetest-case-name
comment in the first line ofcalculus/base_1.py
to find the tests.trial calculus/test
: run all the tests in the test directory (not recommended).trial calculus/test/test_base_1.py
: run a specific test file (not recommended).
You'll notice that Trial create a _trial_temp
directory in
the directory where you run the tests. This has a file called
test.log
which contains the log output of the tests (created
using log.msg
or log.err
functions). Examine this file if you add
logging to your tests.
Making the tests pass
Now that we have a working test framework in place, and our tests are
failing (as expected) we can go and try to implement the correct API. We'll do
that in a new version of the above base_1
module, calculus/base_2.py
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
# -*- test-case-name: calculus.test.test_base_2 -*- class Calculation(object): def add(self, a, b): return a + b def subtract(self, a, b): return a - b def multiply(self, a, b): return a * b def divide(self, a, b): return a / b
We'll also create a new version of test_base_1 which imports and tests this
new implementation,
in calculus/test_base_2.py
:
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
from calculus.base_2 import Calculation from twisted.trial import unittest class CalculationTestCase(unittest.TestCase): def test_add(self): calc = Calculation() result = calc.add(3, 8) self.assertEqual(result, 11) def test_subtract(self): calc = Calculation() result = calc.subtract(7, 3) self.assertEqual(result, 4) def test_multiply(self): calc = Calculation() result = calc.multiply(12, 5) self.assertEqual(result, 60) def test_divide(self): calc = Calculation() result = calc.divide(12, 5) self.assertEqual(result, 2)
trial
again as above, and your tests should now pass:
$ trial calculus.test.test_base_2 Running 4 tests. calculus.test.test_base CalculationTestCase test_add ... [OK] test_divide ... [OK] test_multiply ... [OK] test_subtract ... [OK] ------------------------------------------------------------------------------- Ran 4 tests in 0.067s PASSED (successes=4)
Factoring out common test logic
You'll notice that our test file contains redundant code. Let's get rid
of that. Python's unit testing framework allows your test class to define a
setUp
method that is called before
each test method in the class. This allows you to add attributes
to self
that can be used in tests
methods. We'll also add a parameterized test method to further simplify the
code.
Note that a test class may also provide the counterpart of setUp
, named tearDown
,
which will be called after each test (whether successful or
not). tearDown
is mainly used for post-test
cleanup purposes. We will not use tearDown
until later.
Create calculus/test/test_base_2b.py
as
follows:
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
from calculus.base_2 import Calculation from twisted.trial import unittest class CalculationTestCase(unittest.TestCase): def setUp(self): self.calc = Calculation() def _test(self, operation, a, b, expected): result = operation(a, b) self.assertEqual(result, expected) def test_add(self): self._test(self.calc.add, 3, 8, 11) def test_subtract(self): self._test(self.calc.subtract, 7, 3, 4) def test_multiply(self): self._test(self.calc.multiply, 6, 9, 54) def test_divide(self): self._test(self.calc.divide, 12, 5, 2)
Much cleaner, no?
We'll now add some additional error tests. Testing just for successful
use of the API is generally not enough, especially if you expect your code
to be used by others. Let's make sure the Calculation
class raises exceptions if someone tries
to call its methods with arguments that cannot be converted to
integers.
We arrive at calculus/test/test_base_3.py
:
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
from calculus.base_3 import Calculation from twisted.trial import unittest class CalculationTestCase(unittest.TestCase): def setUp(self): self.calc = Calculation() def _test(self, operation, a, b, expected): result = operation(a, b) self.assertEqual(result, expected) def _test_error(self, operation): self.assertRaises(TypeError, operation, "foo", 2) self.assertRaises(TypeError, operation, "bar", "egg") self.assertRaises(TypeError, operation, [3], [8, 2]) self.assertRaises(TypeError, operation, {"e": 3}, {"r": "t"}) def test_add(self): self._test(self.calc.add, 3, 8, 11) def test_subtract(self): self._test(self.calc.subtract, 7, 3, 4) def test_multiply(self): self._test(self.calc.multiply, 6, 9, 54) def test_divide(self): self._test(self.calc.divide, 12, 5, 2) def test_errorAdd(self): self._test_error(self.calc.add) def test_errorSubtract(self): self._test_error(self.calc.subtract) def test_errorMultiply(self): self._test_error(self.calc.multiply) def test_errorDivide(self): self._test_error(self.calc.divide)
We've added four new tests and one general-purpose function, _test_error
. This function uses the assertRaises
method, which takes an exception class,
a function to run and its arguments, and checks that calling the function
on the arguments does indeed raise the given exception.
If you run the above, you'll see that not all tests fail. In Python it's
often valid to add and multiply objects of different and even differing
types, so the code in the add and mutiply tests does not raise an exception
and those tests therefore fail. So let's add explicit type conversion to
our API class. This brings us to calculus/base_3.py
:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# -*- test-case-name: calculus.test.test_base_3 -*- class Calculation(object): def _make_ints(self, *args): try: return map(int, args) except ValueError: raise TypeError("Couldn't coerce arguments to integers: %s" % args) def add(self, a, b): a, b = self._make_ints(a, b) return a + b def subtract(self, a, b): a, b = self._make_ints(a, b) return a - b def multiply(self, a, b): a, b = self._make_ints(a, b) return a * b def divide(self, a, b): a, b = self._make_ints(a, b) return a / b
Here the _make_ints
helper function tries to
convert a list into a list of equivalent integers, and raises a TypeError
in case the conversion goes wrong.
int
conversion can also
raise a TypeError
if passed something of the
wrong type, such as a list. We'll just let that exception go by as TypeError
is already what we want in case something
goes wrong.Twisted specific testing
Up to this point we've been doing fairly standard Python unit testing.
With only a few cosmetic changes (most importantly, directly importing
unittest
instead of using Twisted's unittest
version) we could make the
above tests run using Python's standard library unit testing framework.
Here we will assume a basic familiarity with Twisted's network I/O, timing, and Deferred APIs. If you haven't already read them, you should read the documentation on Writing Servers, Writing Clients, and Deferreds.
Now we'll get to the real point of this tutorial and take advantage of Trial to test Twisted code.
Testing a protocol
We'll now create a custom protocol to invoke our class from within a telnet-like session. We'll remotely call commands with arguments and read back the response. The goal will be to test our network code without creating sockets.
Creating and testing the server
First we'll write the tests, and then explain what they do. The first version of the remote test code is:
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
from calculus.remote_1 import RemoteCalculationFactory from twisted.trial import unittest from twisted.test import proto_helpers class RemoteCalculationTestCase(unittest.TestCase): def setUp(self): factory = RemoteCalculationFactory() self.proto = factory.buildProtocol(('<IP_ADDRESS>', 0)) self.tr = proto_helpers.StringTransport() self.proto.makeConnection(self.tr) def _test(self, operation, a, b, expected): self.proto.dataReceived('%s %d %d\r\n' % (operation, a, b)) self.assertEqual(int(self.tr.value()), expected) def test_add(self): return self._test('add', 7, 6, 13) def test_subtract(self): return self._test('subtract', 82, 78, 4) def test_multiply(self): return self._test('multiply', 2, 8, 16) def test_divide(self): return self._test('divide', 14, 3, 4)
To fully understand this client, it helps a lot to be comfortable with the Factory/Protocol/Transport pattern used in Twisted.
We first create a protocol factory object. Note that we have yet to see
the RemoteCalculationFactory
class. It is in
calculus/remote_1.py
below. We
call buildProtocol
to ask the factory to build us a
protocol object that knows how to talk to our server. We then make a fake
network transport, an instance of twisted.test.proto_helpers.StringTransport
class (note that test packages are generally not part of Twisted's public API;
twisted.test.proto_helpers
is an exception). This fake
transport is the key to the communications. It is used to emulate a network
connection without a network. The address and port passed to buildProtocol
are typically used by the factory to choose to immediately deny remote connections; since we're using a fake transport, we can choose any value that will be acceptable to the factory. In this case the factory just ignores the address, so we don't need to pick anything in particular.
Testing protocols without the use of real network connections is both simple and recommended when testing Twisted code. Even though there are many tests in Twisted that use the network, most good tests don't. The problem with unit tests and networking is that networks aren't reliable. We cannot know that they will exhibit reasonable behavior all the time. This creates intermittent test failures due to network vagaries. Right now we're trying to test our Twisted code, not network reliability. By setting up and using a fake transport, we can write 100% reliable tests. We can also test network failures in a deterministic manner, another important part of your complete test suite.
The final key to understanding this client code is the _test
method. The call to dataReceived
simulates data arriving on the network
transport. But where does it arrive? It's handed to the lineReceived
method of the protocol instance (in
calculus/remote_1.py
below). So the client
is essentially tricking the server into thinking it has received the
operation and the arguments over the network. The server (once again, see
below) hands the work off to its CalculationProxy
object which in turn hands it to its
Calculation
instance. The result is written
back via sendLine
(into the fake string
transport object), and is then immediately available to the client, who
fetches it with tr.value()
and checks that it
has the expected value. So there's quite a lot going on behind the scenes
in the two-line _test
method above.
Finally, let's see the implementation of this protocol. Put the
following into calculus/remote_1.py
:
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
# -*- test-case-name: calculus.test.test_remote_1 -*- from twisted.protocols import basic from twisted.internet import protocol from calculus.base_3 import Calculation class CalculationProxy(object): def __init__(self): self.calc = Calculation() for m in ['add', 'subtract', 'multiply', 'divide']: setattr(self, 'remote_%s' % m, getattr(self.calc, m)) class RemoteCalculationProtocol(basic.LineReceiver): def __init__(self): self.proxy = CalculationProxy() def lineReceived(self, line): op, a, b = line.split() a = int(a) b = int(b) op = getattr(self.proxy, 'remote_%s' % (op,)) result = op(a, b) self.sendLine(str(result)) class RemoteCalculationFactory(protocol.Factory): protocol = RemoteCalculationProtocol def main(): from twisted.internet import reactor from twisted.python import log import sys log.startLogging(sys.stdout) reactor.listenTCP(0, RemoteCalculationFactory()) reactor.run() if __name__ == "__main__": main()
As mentioned, this server creates a protocol that inherits from basic.LineReceiver
, and then a
factory that uses it as protocol. The only trick is the CalculationProxy
object, which calls Calculation
methods through remote_*
methods. This pattern is used frequently in
Twisted, because it is very explicit about what methods you are making
accessible.
If you run this test (trial
calculus.test.test_remote_1
), everything should be fine. You can also
run a server to test it with a telnet client. To do that, call python calculus/remote_1.py
. You should have the following output:
2008-04-25 10:53:27+0200 [-] Log opened. 2008-04-25 10:53:27+0200 [-] __main__.RemoteCalculationFactory starting on 46194 2008-04-25 10:53:27+0200 [-] Starting factory <__main__.RemoteCalculationFactory instance at 0x846a0cc>
46194 is replaced by a random port. You can then call telnet on it:
$ telnet localhost 46194 Trying <IP_ADDRESS>... Connected to localhost. Escape character is '^]'. add 4123 9423 13546
It works!
Creating and testing the client
Of course, what we build is not particulary useful for now : we'll now build a client to our server, to be able to use it inside a Python program. And it will serve our next purpose.
Create calculus/test/test_client_1.py
:
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
from calculus.client_1 import RemoteCalculationClient from twisted.trial import unittest from twisted.test import proto_helpers class ClientCalculationTestCase(unittest.TestCase): def setUp(self): self.tr = proto_helpers.StringTransport() self.proto = RemoteCalculationClient() self.proto.makeConnection(self.tr) def _test(self, operation, a, b, expected): d = getattr(self.proto, operation)(a, b) self.assertEqual(self.tr.value(), '%s %d %d\r\n' % (operation, a, b)) self.tr.clear() d.addCallback(self.assertEqual, expected) self.proto.dataReceived("%d\r\n" % (expected,)) return d def test_add(self): return self._test('add', 7, 6, 13) def test_subtract(self): return self._test('subtract', 82, 78, 4) def test_multiply(self): return self._test('multiply', 2, 8, 16) def test_divide(self): return self._test('divide', 14, 3, 4)
It's really symmetric to the server test cases. The only tricky part is that we don't use a client factory. We're lazy, and it's not very useful in the client part, so we instantiate the protocol directly.
Incidentally, we have introduced a very important concept here: the tests now return a Deferred object, and the assertion is done in a callback. The important thing to do here is to not forget to return the Deferred. If you do, your tests will pass even if nothing is asserted. That's also why it's important to make tests fail first: if your tests pass whereas you know they shouldn't, there is a problem in your tests.
We'll now add the remote client class to produce calculus/client_1.py
:
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
# -*- test-case-name: calculus.test.test_client_1 -*- from twisted.protocols import basic from twisted.internet import defer class RemoteCalculationClient(basic.LineReceiver): def __init__(self): self.results = [] def lineReceived(self, line): d = self.results.pop(0) d.callback(int(line)) def _sendOperation(self, op, a, b): d = defer.Deferred() self.results.append(d) line = "%s %d %d" % (op, a, b) self.sendLine(line) return d def add(self, a, b): return self._sendOperation("add", a, b) def subtract(self, a, b): return self._sendOperation("subtract", a, b) def multiply(self, a, b): return self._sendOperation("multiply", a, b) def divide(self, a, b): return self._sendOperation("divide", a, b)
More good practices
Testing scheduling
When testing code that involves the passage of time, waiting e.g. for a two hour timeout to occur in a test is not very realistic. Twisted provides a solution to this, the Clock
class that allows one to simulate the passage of time.
As an example we'll test the code for client request timeout: since our client uses TCP it can hang for a long time (firewall, connectivity problems, etc...). So generally we need to implement timeouts on the client side. Basically it's just that we send a request, don't receive a response and expect a timeout error to be triggered after a certain duration.
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
from calculus.client_2 import RemoteCalculationClient, ClientTimeoutError from twisted.internet import task from twisted.trial import unittest from twisted.test import proto_helpers class ClientCalculationTestCase(unittest.TestCase): def setUp(self): self.tr = proto_helpers.StringTransportWithDisconnection() self.clock = task.Clock() self.proto = RemoteCalculationClient() self.tr.protocol = self.proto self.proto.callLater = self.clock.callLater self.proto.makeConnection(self.tr) def _test(self, operation, a, b, expected): d = getattr(self.proto, operation)(a, b) self.assertEqual(self.tr.value(), '%s %d %d\r\n' % (operation, a, b)) self.tr.clear() d.addCallback(self.assertEqual, expected) self.proto.dataReceived("%d\r\n" % (expected,)) return d def test_add(self): return self._test('add', 7, 6, 13) def test_subtract(self): return self._test('subtract', 82, 78, 4) def test_multiply(self): return self._test('multiply', 2, 8, 16) def test_divide(self): return self._test('divide', 14, 3, 4) def test_timeout(self): d = self.proto.add(9, 4) self.assertEqual(self.tr.value(), 'add 9 4\r\n') self.clock.advance(self.proto.timeOut) return self.assertFailure(d, ClientTimeoutError)
What happens here? We instantiate our protocol as usual, the only trick
is to create the clock, and assign proto.callLater
to
clock.callLater
. Thus, every callLater calls in the protocol
will finish before clock.advance()
returns.
In the new test (test_timeout), we call clock.advance
, that simulates and advance in time
(logically it's similar to a time.sleep
call). And
we just have to verify that our Deferred got a timeout error.
Let's implement that in our code.
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
# -*- test-case-name: calculus.test.test_client_2 -*- from twisted.protocols import basic from twisted.internet import defer, reactor class ClientTimeoutError(Exception): pass class RemoteCalculationClient(basic.LineReceiver): callLater = reactor.callLater timeOut = 60 def __init__(self): self.results = [] def lineReceived(self, line): d, callID = self.results.pop(0) callID.cancel() d.callback(int(line)) def _cancel(self, d): d.errback(ClientTimeoutError()) def _sendOperation(self, op, a, b): d = defer.Deferred() callID = self.callLater(self.timeOut, self._cancel, d) self.results.append((d, callID)) line = "%s %d %d" % (op, a, b) self.sendLine(line) return d def add(self, a, b): return self._sendOperation("add", a, b) def subtract(self, a, b): return self._sendOperation("subtract", a, b) def multiply(self, a, b): return self._sendOperation("multiply", a, b) def divide(self, a, b): return self._sendOperation("divide", a, b)
The only important thing here is to not forget to cancel our callLater when everything went fine.
Cleaning up after tests
This chapter is mainly intended for people that want to have sockets or processes created in their tests. If it's still not obvious, you must try to avoid that like the plague, because it ends up with a lot of problems, one of them being intermittent failures. And intermittent failures are the plague of automated tests.
To actually test that, we'll launch a server with our protocol.
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
from calculus.remote_1 import RemoteCalculationFactory from calculus.client_2 import RemoteCalculationClient from twisted.trial import unittest from twisted.internet import reactor, protocol class RemoteRunCalculationTestCase(unittest.TestCase): def setUp(self): factory = RemoteCalculationFactory() self.port = reactor.listenTCP(0, factory, interface="<IP_ADDRESS>") self.client = None def tearDown(self): if self.client is not None: self.client.transport.loseConnection() return self.port.stopListening() def _test(self, op, a, b, expected): creator = protocol.ClientCreator(reactor, RemoteCalculationClient) def cb(client): self.client = client return getattr(self.client, op)(a, b ).addCallback(self.assertEqual, expected) return creator.connectTCP('<IP_ADDRESS>', self.port.getHost().port ).addCallback(cb) def test_add(self): return self._test("add", 5, 9, 14) def test_subtract(self): return self._test("subtract", 47, 13, 34) def test_multiply(self): return self._test("multiply", 7, 3, 21) def test_divide(self): return self._test("divide", 84, 10, 8)
Recent versions of trial will fail loudly if you remove the
stopListening
call, which is good.
Also, you should be aware that tearDown
will
called in any case, after success or failure. So don't expect that every
objects you created in the test method are present, because your tests may
have failed in the middle.
Trial also has a addCleanup
method, which makes
these kind of cleanups easy and removes the need for tearDown
. For example, you could remove the code in _test
this way:
1 2 3 4 5 6 7 8 9 10 11
def setUp(self): factory = RemoteCalculationFactory() self.port = reactor.listenTCP(0, factory, interface="<IP_ADDRESS>") self.addCleanup(self.port.stopListening) def _test(self, op, a, b, expected): creator = protocol.ClientCreator(reactor, RemoteCalculationClient) def cb(client): self.addCleanup(self.client.transport.loseConnection) return getattr(client, op)(a, b).addCallback(self.assertEqual, expected) return creator.connectTCP('<IP_ADDRESS>', self.port.getHost().port).addCallback(cb)
This remove the need of a tearDown method, and you don't have to check for the value of self.client: you only call addCleanup when the client is created.
Handling logged errors
Currently, if you send an invalid command or invalid arguments to our server, it logs an exception and closes the connection. This is a perfectly valid behavior, but for the sake of this tutorial, we want to return an error to the user if he sends invalid operators, and log any errors on server side. So we'll want a test like this:
1 2 3
def test_invalidParameters(self): self.proto.dataReceived('add foo bar\r\n') self.assertEqual(self.tr.value(), "error\r\n")
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
# -*- test-case-name: calculus.test.test_remote_1 -*- from twisted.protocols import basic from twisted.internet import protocol from twisted.python import log from calculus.base_3 import Calculation class CalculationProxy(object): def __init__(self): self.calc = Calculation() for m in ['add', 'subtract', 'multiply', 'divide']: setattr(self, 'remote_%s' % m, getattr(self.calc, m)) class RemoteCalculationProtocol(basic.LineReceiver): def __init__(self): self.proxy = CalculationProxy() def lineReceived(self, line): op, a, b = line.split() op = getattr(self.proxy, 'remote_%s' % (op,)) try: result = op(a, b) except TypeError: log.err() self.sendLine("error") else: self.sendLine(str(result)) class RemoteCalculationFactory(protocol.Factory): protocol = RemoteCalculationProtocol def main(): from twisted.internet import reactor from twisted.python import log import sys log.startLogging(sys.stdout) reactor.listenTCP(0, RemoteCalculationFactory()) reactor.run() if __name__ == "__main__": main()
If you try something like that, it will not work. Here is the output you should have:
trial calculus.test.test_remote_3.RemoteCalculationTestCase.test_invalidParameters calculus.test.test_remote_3 RemoteCalculationTestCase test_invalidParameters ... [ERROR] =============================================================================== [ERROR]: calculus.test.test_remote_3.RemoteCalculationTestCase.test_invalidParameters Traceback (most recent call last): File "/tmp/calculus/remote_2.py", line 27, in lineReceived result = op(a, b) File "/tmp/calculus/base_3.py", line 11, in add a, b = self._make_ints(a, b) File "/tmp/calculus/base_3.py", line 8, in _make_ints raise TypeError exceptions.TypeError: ------------------------------------------------------------------------------- Ran 1 tests in 0.004s FAILED (errors=1)
At first, you could think there is a problem, because you catch this
exception. But in fact trial doesn't let you do that without controlling it:
you must expect logged errors and clean them. To do that, you have to use the
flushLoggedErrors
method. You call it with the
exception you expect, and it returns the list of exceptions logged since the
start of the test. Generally, you'll want to check that this list has the
expected length, or possibly that each exception has an expected message. We do
the former in our test:
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
from calculus.remote_2 import RemoteCalculationFactory from twisted.trial import unittest from twisted.test import proto_helpers class RemoteCalculationTestCase(unittest.TestCase): def setUp(self): factory = RemoteCalculationFactory() self.proto = factory.buildProtocol(('<IP_ADDRESS>', 0)) self.tr = proto_helpers.StringTransport() self.proto.makeConnection(self.tr) def _test(self, operation, a, b, expected): self.proto.dataReceived('%s %d %d\r\n' % (operation, a, b)) self.assertEqual(int(self.tr.value()), expected) def test_add(self): return self._test('add', 7, 6, 13) def test_subtract(self): return self._test('subtract', 82, 78, 4) def test_multiply(self): return self._test('multiply', 2, 8, 16) def test_divide(self): return self._test('divide', 14, 3, 4) def test_invalidParameters(self): self.proto.dataReceived('add foo bar\r\n') self.assertEqual(self.tr.value(), "error\r\n") errors = self.flushLoggedErrors(TypeError) self.assertEqual(len(errors), 1)
Resolve a bug
A bug was left over during the development of the timeout (probably several bugs, but that's not the point), concerning the reuse of the protocol when you got a timeout: the connection is not dropped, so you can get timeout forever. Generally an user will come to you saying "I have this strange problem on my crappy network environment. It seems you could solve it with doing XXX at YYY."
Actually, this bug can be corrected several ways. But if you correct it without adding tests, one day you'll face a big problem: regression. So the first step is adding a failing test.
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
from calculus.client_3 import RemoteCalculationClient, ClientTimeoutError from twisted.internet import task from twisted.trial import unittest from twisted.test import proto_helpers class ClientCalculationTestCase(unittest.TestCase): def setUp(self): self.tr = proto_helpers.StringTransportWithDisconnection() self.clock = task.Clock() self.proto = RemoteCalculationClient() self.tr.protocol = self.proto self.proto.callLater = self.clock.callLater self.proto.makeConnection(self.tr) def _test(self, operation, a, b, expected): d = getattr(self.proto, operation)(a, b) self.assertEqual(self.tr.value(), '%s %d %d\r\n' % (operation, a, b)) self.tr.clear() d.addCallback(self.assertEqual, expected) self.proto.dataReceived("%d\r\n" % (expected,)) return d def test_add(self): return self._test('add', 7, 6, 13) def test_subtract(self): return self._test('subtract', 82, 78, 4) def test_multiply(self): return self._test('multiply', 2, 8, 16) def test_divide(self): return self._test('divide', 14, 3, 4) def test_timeout(self): d = self.proto.add(9, 4) self.assertEqual(self.tr.value(), 'add 9 4\r\n') self.clock.advance(self.proto.timeOut) return self.assertFailure(d, ClientTimeoutError) def test_timeoutConnectionLost(self): called = [] def lost(arg): called.append(True) self.proto.connectionLost = lost d = self.proto.add(9, 4) self.assertEqual(self.tr.value(), 'add 9 4\r\n') self.clock.advance(self.proto.timeOut) def check(ignore): self.assertEqual(called, [True]) return self.assertFailure(d, ClientTimeoutError).addCallback(check)
What have we done here ?
- We switched to StringTransportWithDisconnection. This transport manages
loseConnection
and forwards it to its protocol. - We assign the protocol to the transport via the
protocol
attribute. - We check that after a timeout our connection has closed.
For doing that, we then use the TimeoutMixin
class, that does almost everything we want. The great thing is that it almost
changes nothing to our class.
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
# -*- test-case-name: calculus.test.test_client -*- from twisted.protocols import basic, policies from twisted.internet import defer class ClientTimeoutError(Exception): pass class RemoteCalculationClient(object, basic.LineReceiver, policies.TimeoutMixin): def __init__(self): self.results = [] self._timeOut = 60 def lineReceived(self, line): self.setTimeout(None) d = self.results.pop(0) d.callback(int(line)) def timeoutConnection(self): for d in self.results: d.errback(ClientTimeoutError()) self.transport.loseConnection() def _sendOperation(self, op, a, b): d = defer.Deferred() self.results.append(d) line = "%s %d %d" % (op, a, b) self.sendLine(line) self.setTimeout(self._timeOut) return d def add(self, a, b): return self._sendOperation("add", a, b) def subtract(self, a, b): return self._sendOperation("subtract", a, b) def multiply(self, a, b): return self._sendOperation("multiply", a, b) def divide(self, a, b): return self._sendOperation("divide", a, b)
Code coverage
Code coverage is one of the aspects of software testing that shows how much your tests cross (cover) the code of your program. There are different kind of measures: path coverage, condition coverage, statement coverage... We'll only consider statement coverage here, whether a line has been executed or not.
Trial has an option to generate the statement coverage of your tests. This option is --coverage. It creates a coverage directory in _trial_temp, with a file .cover for every modules used during the tests. The ones interesting for us are calculus.base.cover and calculus.remote.cover. In front of each line is the number of times you went through during the tests, or the marker '>>>>>>' if the line was not covered. If you went through all the tutorial to this point, you should have complete coverage :).
Again, this is only another useful pointer, but it doesn't mean your code is perfect: your tests should consider every possibile input and output, to get full coverage (condition, path, etc.) as well .
Conclusion
So what did you learn in this document?
- How to use the trial command-line tool to run your tests
- How to use string transports to test individual clients and servers without creating sockets
- If you really want to create sockets, how to cleanly do it so that it doesn't have bad side effects
- And some small tips you can't live without.


This website quizzes individuals on words/concepts we've been exposed to in the Code Partners 102 + 201 classes. Based on three project sprints that were part of 201, this covers five topic areas: functions, loops, objects, the DOM, and local storage. The hope is that this quiz helps prepare students for the final technical interview that occurs at the end of 201 and improves the likelihood that students are ready to undertake the 301 course.
Brittany Stubbs, Harold Wolfinger, Jalal Kasaat, Patrice Thomas, and Caleb Pase are graduating students from the inaugural Code Partners 201 cohort. They are each looking forward to the 301 course.
(1) The questions are dynamically populated to the HTML using JavaScript code, specifically by an object constructor that houses an initial array (testBank), which is accessed and that then pushes to a second array (quizBank), based on which topics the individual checks off to be tested on.
(2) Local storage is utilized to keep a running tally of the correct and incorrect answers a user provides to whatever quiz they are taking. This score is then used to populate a bar chart on a separate Quiz Results page
(3) The website also includes a reset button so users can initiate clearing the local storage that's saved.


The CSVDataStore plugin provides support for the CSV format. The contents of a data store can thus be exported to that format.


W - Win | L - Loss | D - Draw | GF - Goals For | GA - Goals Against | GD - Goal Difference | Pts - Points
Nothing to see here...
UEFA Champion League group stage
Europa League group stage
Europa League qualifier
Relegation


| Manual section: | 1 |
|---|
varnishtest [-hikLlqvW] [-b size] [-D name=val] [-j jobs] [-n iter] [-t duration] file [file ...]
The varnishtest program is a script driven program used to test the Varnish Cache.
The varnishtest program, when started and given one or more script files, can create a number of threads representing backends, some threads representing clients, and a varnishd process. This is then used to simulate a transaction to provoke a specific behavior.
The following options are available:
| -b size | Set internal buffer size (default: 512K) |
-D name=val Define macro for use in scripts
| -h | Show help |
| -i | Set PATH and vmod_path to find varnish binaries in build tree |
| -j jobs | Run this many tests in parallel |
| -k | Continue on test failure |
| -L | Always leave temporary vtc.* |
| -l | Leave temporary vtc.* if test fails |
| -n iterations | Run tests this many times |
-p name=val Pass parameters to all varnishd command lines
| -q | Quiet mode: report only failures |
| -t duration | Time tests out after this long (default: 60s) |
| -v | Verbose mode: always report test log |
| -W | Enable the witness facility for locking |
file File to use as a script
If TMPDIR is set in the environment, varnishtest creates temporary vtc.* directories for each test in $TMPDIR, otherwise in /tmp.
The vtc syntax is documented at length in VTC. Should you want more examples than the one below, you can have a look at the Varnish source code repository, under bin/varnishtest/tests/, where all the regression tests for Varnish are kept.
An example:
varnishtest "#1029"
server s1 {
rxreq
expect req.url == "/bar"
txresp -gzipbody {[bar]}
rxreq
expect req.url == "/foo"
txresp -body {
FOO<esi:include src="/bar"/>BARF
}
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_esi = true;
if (bereq.url == "/foo") {
set beresp.ttl = 0s;
} else {
set beresp.ttl = 10m;
}
}
} -start
client c1 {
txreq -url "/bar" -hdr "Accept-Encoding: gzip"
rxresp
gunzip
expect resp.bodylen == 5
txreq -url "/foo" -hdr "Accept-Encoding: gzip"
rxresp
expect resp.bodylen == 21
} -run
When run, the above script will simulate a server (s1) that expects two different requests. It will start a Varnish server (v1) and add the backend definition to the VCL specified (-vcl+backend). Finally it starts the c1-client, which is a single client sending two requests.
Whether you are building a VMOD or trying to use one that you freshly built, you can tell varnishtest to pass a vmod_path to varnishd instances started using the varnish -start command in your test case:
varnishtest -p vmod_path=... /path/to/*.vtc
This way you can use the same test cases on both installed and built VMODs:
server s1 {...} -start
varnish v1 -vcl+backend {
import wossname;
...
} -start
...
You are not limited to the vmod_path and can pass any parameter, allowing you to run a build matrix without changing the test suite. You can achieve the same with macros, but then they need to be defined on each run.
You can see the actual varnishd command lines in test outputs, they look roughly like this:
exec varnishd [varnishtest -p params] [testing params] [vtc -arg params]
Parameters you define with varnishtest -p may be overriden by parameters needed by varnishtest to run properly, and they may in turn be overriden by parameters set in test scripts.
There's also a special mode in which varnishtest builds itself a PATH and a vmod_path in order to find Varnish binaries (programs and VMODs) in the build tree surrounding the varnishtest binary. This is meant for testing of Varnish under development and will disregard your vmod_path if you set one.
If you need to test your VMOD against a Varnish build tree, you must install it first, in a temp directory for instance. With information provided by the installation's pkg-config(1) you can build a proper PATH in order to access Varnish programs, and a vmod_path to access both your VMOD and the built-in VMODs:
export PKG_CONFIG_PATH=/path/to/install/lib/pkgconfig
BINDIR="$(pkg-config --variable=bindir varnishapi)"
SBINDIR="$(pkg-config --variable=sbindir varnishapi)"
PATH="SBINDIR:BINDIR:$PATH"
VMODDIR"$(pkg-config --variable=vmoddir varnishapi)"
VMOD_PATH="/path/to/your/vmod/build/dir:$VMODDIR"
varnishtest -p vmod_path="$VMOD_PATH" ...
The varnishtest program was developed by Poul-Henning Kamp<EMAIL_ADDRESS>in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen<EMAIL_ADDRESS>and updated by Kristian Lyngstøl<EMAIL_ADDRESS>This document is licensed under the same licence as Varnish itself. See LICENCE for details.


Welcome to today’s Meme the News. I hope you enjoy it.
Cutter
Selfies
hopeful?
yep
nope
unrelated
almost like they knew
creepy? normal?
This page is synchronized from the post: ‘Meme the News- 4/30/18 alfie, guns, kanye’


create_ranges_multiple.Rd
Takes in the input of create_error_df_redox_multiple and creates a simple ranges plot: e.g. minimum and maximum measureable value at different error thresholds for each sensor.
create_ranges_multiple( error_df, thresholds = c(0.5, 1, 1.5, 2, 2.5), parameter = "E" )
| error_df | A dataframe of errors at least these columns: 'Name': this sensor name 'E': the redox potential (mV), 'Error': the error in this redox potential (mV) 'Inaccuracy': The inaccuracy of the measurements (relative to R). |
|---|---|
| thresholds | A vector of error thresholds (e.g. c(0.5, 1) for 0.5mV and 1mV) |
| parameter | the biochemical value being measured |
A dataframe of suited ranges with these columns: 'Sensor_Name': the name of the sensor 'Minimum': the minimum redox potential (mV) measurable at the given inaccuracy 'Maximum': the maximum redox potential (mV) measurable at the given inaccuracy 'Inaccuracy': the inaccuracy associated with this row (relative) 'error_thresh': the error threshold associated with this row (mV)
error_df <- create_error_df_redox_multiple( c(0.02), -400, -200, data.frame( Rmin = 0.97, Rmax = 4.12, delta = 0.23, name = "roGFP2", e0 = -299 ) ) create_ranges_multiple(error_df)#> Sensor_Name Minimum Maximum Inaccuracy error_thresh #> 1 roGFP2_0.02 NA NA 0.02 0.5 #> 2 roGFP2_0.02 -304.11 -274.38 0.02 1.0 #> 3 roGFP2_0.02 -312.56 -266.09 0.02 1.5 #> 4 roGFP2_0.02 -317.29 -261.39 0.02 2.0 #> 5 roGFP2_0.02 -320.59 -258.11 0.02 2.5


| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| src/ | 76.19% | 16/21 | 100% | 4/4 | 100% | 1/1 | 66.67% | 10/15 | |
| src/actions/ | 30.74% | 79/257 | 44.44% | 20/45 | 5.19% | 4/77 | 21.08% | 47/223 | |
| src/components/ | 73.17% | 30/41 | 72.73% | 8/11 | 40% | 2/5 | 60% | 15/25 | |
| src/components/article/ | 81.13% | 129/159 | 97.18% | 69/71 | 54.55% | 18/33 | 59.02% | 36/61 | |
| src/components/auth/ | 80.47% | 136/169 | 71.67% | 86/120 | 77.42% | 24/31 | 34.78% | 16/46 | |
| src/components/main/ | 91.96% | 183/199 | 100% | 102/102 | 71.05% | 27/38 | 76.47% | 39/51 | |
| src/components/navBar/ | 42.86% | 15/35 | 44.44% | 4/9 | 10% | 1/10 | 31.03% | 9/29 | |
| src/components/profile/ | 83.33% | 100/120 | 72.15% | 57/79 | 68.18% | 15/22 | 52.78% | 19/36 | |
| src/reducers/ | 78% | 117/150 | 70.24% | 59/84 | 71.43% | 15/21 | 54.79% | 40/73 | |
| src/util/ | 25.53% | 12/47 | 28.57% | 4/14 | 7.14% | 1/14 | 17.07% | 7/41 |


The Crimson Fairy Book
by Andrew Lang
“The Three Robes”
by Andrew Lang
Additional Information
- Year Published: 1903
- Language: English
- Country of Origin: Iceland
- Source: Lang, A. (Ed.). (1903). The Crimson Fairy Book. London: Dover Publications.
-
Readability:
- Flesch–Kincaid Level: 8.1
- Word Count: 3,568
- Genre: Fairy Tale/Folk Tale
- Keywords: heritage, merit
- ✎ Cite This
Downloads
Long, long ago, a king and queen reigned over a large and powerful country. What their names were nobody knows, but their son was called Sigurd, and their daughter Lineik, and these young people were famed throughout the whole kingdom for their wisdom and beauty.
There was only a year between them, and they loved each other so much that they could do nothing apart. When they began to grow up the king gave them a house of their own to live in, with servants and carriages, and everything they could possibly want.
For many years they all lived happily together, and then the queen fell ill, and knew that she would never get better.
 But rather seek out a princess of some great kingdom, who has been used to courts all her life, and holds them at their true worth. The other thing I have to ask is, that you will never cease to watch over our children, who will soon become your greatest joy.’
These were the queen’s last words, and a few hours later she was dead. The king was so bowed down with sorrow that he would not attend even to the business of the kingdom, and at last his Prime Minister had to tell him that the people were complaining that they had nobody to right their wrongs. ‘You must rouse yourself, sir,’ went on the minister, ‘and put aside your own sorrows for the sake of your country.’
‘You do not spare me,’ answered the king; ‘but what you say is just, and your counsel is good. I have heard that men say, likewise, that it will be for the good of my kingdom for me to marry again, though my heart will never cease to be with my lost wife. But it was her wish also; therefore, to you I entrust the duty of finding a lady fitted to share my throne; only, see that she comes neither from a small town nor a remote island.’
So an embassy was prepared, with the minister at its head, to visit the greatest courts in the world, and to choose out a suitable princess. But the vessel which carried them had not been gone many days when a thick fog came on, and the captain could see neither to the right nor to the left. For a whole month the ship drifted about in darkness, till at length the fog lifted and they beheld a cliff jutting out just in front. On one side of the cliff lay a sheltered bay, in which the vessel was soon anchored, and though they did not know where they were, at any rate they felt sure of fresh fruit and water.
The minister left the rest of his followers on board the ship, and taking a small boat rowed himself to land, in order to look about him and to find out if the island was really as deserted as it seemed.
He had not gone far, when he heard the sound of music, and, turning in its direction, he saw a woman of marvellous beauty sitting on a low stool playing on a harp, while a girl beside her sang. The minister stopped and greeted the lady politely, and she replied with friendliness, asking him why he had come to such an out-of-the way place. In answer he told her of the object of his journey.
‘I am in the same state as your master,’ replied the lady; ‘I was married to a mighty king who ruled over this land, till Vikings [sea-robbers] came and slew him and put all the people to death. But I managed to escape, and hid myself here with my daughter.’
And the daughter listened, and said softly to her mother: ‘Are you speaking the truth now?’
‘Remember your promise,’ answered the mother angrily, giving her a pinch which was unseen by the minister.
‘What is your name, madam?’ asked he, much touched by this sad story.
‘Blauvor,’ she replied ‘and my daughter is called Laufer’; and then she inquired the name of the minister, and of the king his master. After this they talked of many things, and the lady showed herself learned in all that a woman should know, and even in much that men only were commonly taught. ‘What a wife she would make for the king,’ thought the minister to himself, and before long he had begged the honour of her hand for his master. She declared at first that she was too unworthy to accept the position offered her, and that the minister would soon repent his choice; but this only made him the more eager, and in the end he gained her consent, and prevailed on her to return with him at once to his own country.
The minister then conducted the mother and daughter back to the ship; the anchor was raised, the sails spread, and a fair wind was behind them.
Now that the fog had lifted they could see as they looked back that, except just along the shore, the island was bare and deserted and not fit for men to live in; but about that nobody cared. They had a quick voyage, and in six days they reached the land, and at once set out for the capital, a messenger being sent on first by the minister to inform the king of what had happened.
When his Majesty’s eyes fell on the two beautiful women, clad in dresses of gold and silver, he forgot his sorrows and ordered preparations for the wedding to be made without delay. In his joy he never remembered to inquire in what kind of country the future queen had been found. In fact his head was so turned by the beauty of the two ladies that when the invitations were sent by his orders to all the great people in the kingdom, he did not even recollect his two children, who remained shut up in their own house!
After the marriage the king ceased to have any will of his own and did nothing without consulting his wife. She was present at all his councils, and her opinion was asked before making peace or war. But when a few months had passed the king began to have doubts as to whether the minister’s choice had really been a wise one, and he noticed that his children lived more and more in their palace and never came near their stepmother.
It always happens that if a person’s eyes are once opened they see a great deal more than they ever expected; and soon it struck the king that the members of his court had a way of disappearing one after the other without any reason. At first he had not paid much attention to the fact, but merely appointed some fresh person to the vacant place. As, however, man after man vanished without leaving any trace, he began to grow uncomfortable and to wonder if the queen could have anything to do with it.
Things were in this state when, one day, his wife said to him that it was time for him to make a progress through his kingdom and see that his governors were not cheating him of the money that was his due. ‘And you need not be anxious about going,’ she added, ‘for I will rule the country while you are away as carefully as you could yourself.’
The king had no great desire to undertake this journey, but the queen’s will was stronger than his, and he was too lazy to make a fight for it. So he said nothing and set about his preparations, ordering his finest ship to be ready to carry him round the coast. Still his heart was heavy, and he felt uneasy, though he could not have told why; and the night before he was to start he went to the children’s palace to take leave of his son and daughter.
He had not seen them for some time, and they gave him a warm welcome, for they loved him dearly and he had always been kind to them. They had much to tell him, but after a while he checked their merry talk and said:
‘If I should never come back from this journey I fear that it may not be safe for you to stay here; so directly there are no more hopes of my return go instantly and take the road eastwards till you reach a high mountain, which you must cross. Once over the mountain keep along by the side of a little bay till you come to two trees, one green and the other red, standing in a thicket, and so far back from the road that without looking for them you would never see them. Hide each in the trunk of one of the trees and there you will be safe from all your enemies.’
With these words the king bade them farewell and entered sadly into his ship. For a few days the wind was fair, and everything seemed going smoothly; then, suddenly, a gale sprang up, and a fearful storm of thunder and lightning, such as had never happened within the memory of man. In spite of the efforts of the frightened sailors the vessel was driven on the rocks, and not a man on board was saved.
That very night Prince Sigurd had a dream, in which he thought his father appeared to him in dripping clothes, and, taking the crown from his head, laid it at his son’s feet, leaving the room as silently as he had entered it.
Hastily the prince awoke his sister Lineik, and they agreed that their father must be dead, and that they must lose no time in obeying his orders and putting themselves in safety. So they collected their jewels and a few clothes and left the house without being observed by anyone.
They hurried on till they arrived at the mountain without once looking back. Then Sigurd glanced round and saw that their stepmother was following them, with an expression on her face which made her uglier than the ugliest old witch. Between her and them lay a thick wood, and Sigurd stopped for a moment to set it on fire; then he and his sister hastened on more swiftly than before, till they reached the grove with the red and green trees, into which they jumped, and felt that at last they were safe.
Now, at that time there reigned over Greece a king who was very rich and powerful, although his name has somehow been forgotten. He had two children, a son and a daughter, who were more beautiful and accomplished than any Greeks had been before, and they were the pride of their father’s heart.
The prince had no sooner grown out of boyhood than he prevailed on his father to make war during the summer months on a neighbouring nation, so as to give him a chance of making himself famous. In winter, however, when it was difficult to get food and horses in that wild country, the army was dispersed, and the prince returned home.
During one of these wars he had heard reports of the Princess Lineik’s beauty, and he resolved to seek her out, and to ask for her hand in marriage. All this Blauvor, the queen, found out by means of her black arts, and when the prince drew near the capital she put a splendid dress on her own daughter and then went to meet her guest.
She bade him welcome to her palace, and when they had finished supper she told him of the loss of her husband, and how there was no one left to govern the kingdom but herself.
‘But where is the Princess Lineik?’ asked the prince when she had ended her tale.
‘Here,’ answered the queen, bringing forward the girl, whom she had hitherto kept in the background.
The prince looked at her and was rather disappointed. The maiden was pretty enough, but not much out of the common.
‘Oh, you must not wonder at her pale face and heavy eyes,’ said the queen hastily, for she saw what was passing in his mind. ‘She has never got over the loss of both father and mother.’
‘That shows a good heart,’ thought the prince; ‘and when she is happy her beauty will soon come back.’ And without any further delay he begged the queen to consent to their betrothal, for the marriage must take place in his own country.
The queen was enchanted. She had hardly expected to succeed so soon, and she at once set about her preparations. Indeed she wished to travel with the young couple, to make sure that nothing should go wrong; but here the prince was firm, that he would take no one with him but Laufer, whom he thought was Lineik.
They soon took leave of the queen, and set sail in a splendid ship; but in a short time a dense fog came on, and in the dark the captain steered out of his course, and they found themselves in a bay which was quite strange to all the crew. The prince ordered a boat to be lowered, and went on shore to look about him, and it was not long before he noticed the two beautiful trees, quite different from any that grew in Greece. Calling one of the sailors, he bade him cut them down, and carry them on board the ship. This was done, and as the sky was now clear they put out to sea, and arrived in Greece without any more adventures.
The news that the prince had brought home a bride had gone before them, and they were greeted with flowery arches and crowns of coloured lights. The king and queen met them on the steps of the palace, and conducted the girl to the women’s house, where she would have to remain until her marriage. The prince then went to his own rooms and ordered that the trees should be brought in to him.
The next morning the prince bade his attendants bring his future bride to his own apartments, and when she came he gave her silk which she was to weave into three robes—one red, one green, and one blue—and these must all be ready before the wedding. The blue one was to be done first and the green last, and this was to be the most splendid of all, ‘for I will wear it at our marriage,’ said he.
Left alone, Laufer sat and stared at the heap of shining silk before her. She did not know how to weave, and burst into tears as she thought that everything would be discovered, for Lineik’s skill in weaving was as famous as her beauty. As she sat with her face hidden and her body shaken by sobs, Sigurd in his tree heard her and was moved to pity. ‘Lineik, my sister,’ he called, softly, ‘Laufer is weeping; help her, I pray you.’
‘Have you forgotten the wrongs her mother did to us’ answered Lineik, ‘and that it is owing to her that we are banished from home?’
But she was not really unforgiving, and very soon she slid quietly out of her hiding-place, and taking the silk from Laufer’s hands began to weave it. So quick and clever was she that the blue dress was not only woven but embroidered, and Lineik was safe back in her tree before the prince returned.
‘It is the most beautiful work I have ever seen,’ said he, taking up a bit. ‘And I am sure that the red one will be still better, because the stuff is richer,’ and with a low bow he left the room.
Laufer had hoped secretly that when the prince had seen the blue dress finished he would have let her off the other two; but when she found she was expected to fulfil the whole task, her heart sank and she began to cry loudly. Again Sigurd heard her, and begged Lineik to come to her help, and Lineik, feeling sorry for her distress, wove and embroidered the second dress as she had done the first, mixing gold thread and precious stones till you could hardly see the red of the stuff. When it was done she glided into her tree just as the prince came in.
‘You are as quick as you are clever,’ said he, admiringly. ‘This looks as if it had been embroidered by the fairies! But as the green robe must outshine the other two I will give you three days in which to finish it. After it is ready we will be married at once.’
Now, as he spoke, there rose up in Laufer’s mind all the unkind things that she and her mother had done to Lineik. Could she hope that they would be forgotten, and that Lineik would come to her rescue for the third time? And perhaps Lineik, who had not forgotten the past either, might have left her alone, to get on as best she could, had not Sigurd, her brother, implored her to help just once more. So Lineik again slid out of her tree, and, to Laufer’s great relief, set herself to work. When the shining green silk was ready she caught the sun’s rays and the moon’s beams on the point of her needle and wove them into a pattern such as no man had ever seen. But it took a long time, and on the third morning, just as she was putting the last stitches into the last flower the prince came in.
Lineik jumped up quickly, and tried to get past him back to her tree; but the folds of the silk were wrapped round her, and she would have fallen had not the prince caught her.
‘I have thought for some time that all was not quite straight here,’ said he.
Lineik then told her name and her story. When she had ended the prince turned angrily to Laufer, and declared that, as a punishment for her wicked lies, she deserved to die a shameful death.
But Laufer fell at his feet and begged for mercy. It was her mother’s fault, she said: ‘It was she, and not I, who passed me off as the Princess Lineik.
She was still on her knees when Prince Sigurd entered the room. He prayed the Prince of Greece to forgive Laufer, which he did, on condition that Lineik would consent to marry him. ‘Not till my stepmother is dead,’ answered she, ‘for she has brought misery to all that came near her.’ Then Laufer told them that Blauvor was not the wife of a king, but an ogress who had stolen her from a neighbouring palace and had brought her up as her daughter. And besides being an ogress she was also a witch, and by her black arts had sunk the ship in which the father of Sigurd and Lineik had set sail. It was she who had caused the disappearance of the courtiers, for which no one could account, by eating them during the night, and she hoped to get rid of all the people in the country, and then to fill the land with ogres and ogresses like herself.
So Prince Sigurd and the Prince of Greece collected an army swiftly, and marched upon the town where Blauvor had her palace. They came so suddenly that no one knew of it, and if they had, Blauvor had eaten most of the strong men; and others, fearful of something they could not tell what, had secretly left the place. Therefore she was easily captured, and the next day was beheaded in the market-place. Afterwards the two princes marched back to Greece.
Lineik had no longer any reason for putting off her wedding, and married the Prince of Greece at the same time that Sigurd married the princess. And Laufer remained with Lineik as her friend and sister, till they found a husband for her in a great nobleman; and all three couples lived happily until they died.


Startup Idea Every Day #12: Integrated Home Electronics
Why does Sonos crush it? Because I can control the speakers in my house without getting up, I don't even have to stop what I'm doing. Sonos adds a phenominal amount of convenience to the home, which is exactly what this startup idea is about. Sonos is great for speakers, but what my coffee maker, my refrigerator, or even my lights? Could I get a push notification when the water is running? How about a text if my stove is on too long? If you wanted a startup idea with exorbitantly high startup costs and huge potential return, you got it.
I've had a sneaking suspicion that people are getting very sick of software, and that computer interfaces are becoming less and less desirable, while the practical, wearable, and tangible technology is growing rapidly (have you seen Jawbone, Fitbit, and Fitbug?).  The idea behind this company is to create a suite of home products that all run on one interface, for consistent user experience. The same way you can pick up any iPhone in the world and immediately know how it works.
The way to start a company like this? Create a smartphone app that has an SDK and API, so that when Keurig comes out with their new coffee maker, they can take an extra step in development to make it connectable to your app. This way you could avoid the costs of building an manufacturing all of these products yourself.
In short, integrating household electronics is going to the most baller move for mobile devices in this decade.


How Can I Help? A Playbook for Collaboration in Big WordPress Projects
Matt Johnson / @xmatt / alleyinteractive.com
http://xmattus.github.io/playbook-for-collaboration
- We are a full-service digital agency
- WordPress.com VIP partner
- Hiring!
Why should I listen to this guy?
- I've been through a lot of these projects.
- I've seen the process go well...and not so well.
- I'm here to talk positive, though!
What is "big"?
- Enterprise = built for an organization, not a person.
- More than one person involved for both client and vendor.
- Just a word. How do you define "big"?
Going Big with WordPress
Going Big with WordPress
Lifecycle of a Big WordPress Project
Discovery
↓
UX Design
↓
Visual Design
↓
Development
↓
QA
↓
Launch
Agile or Waterfall?
- Agile: sprints with short feedback-iteration cycle.
- Waterfall: each phase produces the next phase's deliverables.
- Truly agile process is challenging in new client builds.
Discovery
- A time to learn the entirety of a project's requirements.
- Chance to develop full and complete understanding of the client's context.
(also the title of Daft Punk's second album)
Discovery
How can we help?
- Listen, listen, listen.
- Ask questions to understanding the client organization first. Get specific about design and tech issues second.
- Learn the client's level of experience with big web projects.
- Manage expectations. Finalize the scope after the discovery instead of before, if we can.
Discovery
How can they help?
- Recognize our role as outsiders has benefits and drawbacks.
- Highlight unexpected internal politics and conflicts.
- Explain why the project matters to their organization.
- Give us the big picture first and the details last.
UX Design
- Creating a plan for the site's information architecture.
- Building wireframes to illustrate the likely layout and structure of the site.
UX Design
How can we help?
- Keep wireframes simple and visually non-suggestive.
- Stay close to the notes from discovery.
- Ask questions early and often.
UX Design
How can they help?
- Get stakeholders involved at the right time.
- Recheck assumptions against discovery.
Visual Design
- Crafting a style guide and visual direction for the site.
- Applying the style book to components in the wireframes.
Visual Design
How can we help?
- Design in the browser!
- Seriously though. Design in the browser.
- Emphasize rational decision-making and explain our reasoning.
Visual Design
How can they help?
- Contextualize for stakeholders.
- Remember that design is aesthetic; focus on the reasons for visual decisions.
Development
- Building a WordPress codebase to drive the site.
- Educating our client about its care and feeding.
- Migrating legacy content.
Development
How can we help?
- Put work-in-progress in its proper context.
- Be fully transparent about unexpected complexities.
- Start migration testing early.
Development
How can they help?
- Acknowledge the difficulty of building bespoke software products.
- See the process as a team effort more than an exchange of services for money.
QA and Launch
- Reviewing the finished product against the requirements.
- Tying up loose ends.
- Flipping the switch!
QA and Launch
How can we help?
- Plan ahead. Use a checklist.
- Be sympathetic to the client's timing and coordination needs.
- Reduce their need to double-post content.
QA and Launch
How can they help?
- Relax! :)
- Be honest about what features can be moved to "immediately post launch".
Launch is not the Finish Line
- Be a valuable partner to clients after the launch.
- Build a plan for the long-term health of our product throughout the project.
The End
Want to work on projects like this?
We're hiring.
info@alleyinteractive.com


Full-Stack Web developer and experienced in technical support with compTIA A+, Network+ and Server+ certifications. Looking to use his past experience with newly obtained skills at Full-Stack Web development.
I have experience with networking, end user support, server administration, as well as many skills in coding like JavaScript, HTML, as well as server-side applications like Nodejs and SQL.
I love working with technology from the past, to the present, and doing research on what the future will bring, to make sound judgements to advise on the direction of the information systems strategies for the company. The challenge of making technology work with the end user and getting them trained has always been a challenge that I have enjoyed and always exceed expectations.
Gem Game is a web browser-based game that will generate a random number and then assign random values to 4 gems. The player has to not only figure out the values of the gems, but also try to match the total. This was made with HTML, JavaScript, and jQuery
Back to PortfolioMos Eisely Space Port is a Firebase - web browser data based application that will track the incoming arrivals of star ships. Letting the user know the Frequency, Next Arrival, and Minuets away. This was made with HTML, JavaScript, and Firebase
Close ProjectBurger List is a web-based application that will allow a user to keep track of burgers that they would like to try and then using the “DEVOUR!” button move them to the list of burgers that they have eaten. This app uses minimal HTML, but is powered by Nodejs, npm functions such as Handle Bars Express, and the data is stored in SQL.
Close ProjectForce Guess is a game that you are to use the force to see what letter Yoda is thinking in 10 guesses or less.
Close ProjectNational Parks Finder is an app that will allow you to get a list of all the national parks in a state. Along with information about the parks, it will also give links to the park’s web site, display weather conditions, and pictures of the national parks in the state.
Close ProjectParking find Group #2 application using Foundation, Passport, and JavaScript
Close Project


I would like to introduce my self to you friends
My name is Roya Alakayleh and I'm 23 years old
I've graduated from AL AL Bayt uni in Almafraq-Jordan with MLS bachelor degree, but you see I'v spent 5 months after graduation jop hunting, and had zero luck. It was depressing time, spending this much time without doing something meaningful related to the field of my study, and that where it started to change. My friend told me about a programming scholarship that I sign for and was accepted in then I started this new field in life.
I'm a passionate person who hopes one day to leave a mark that will help to improve the world and wont be deleted no matter what.
I've been interested in programming since 10 or so years, but when my interest was in it's peak, it wasn't that acceptable in the society so I dropped the idea and navigated my interest to the medical field, and that's what got me into the MLS mess. Don't get me wrong, I'm not trying to change my major or something, after all the medical field have always been a childhood dream. I'm a part of ASAC to merge those two fields together, come up with a new thing no one came up with before and make my dream come true, but you know? lets forget about all this poring things and let me till you about the things I love
you see, I've always had a lot of hobbies, so I'm a malty-talented person, I can draw, write in both Arabic and English languages, poetry reading, acting and a lot more. I don't know if it was sad or not, but I stopped doing most of those since 4 or 5 years by now. If you're curious to read what wrote up till now you can visit me on:
*you can find some of my drawings here*
-And like everyone else I have my favorites of wvery thing, cause I'm not fixed person and here is a list of my favorite shows


|
JMS 1.1 - April 12, 2002 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A client uses a QueueBrowser
object to look at messages on a
queue without removing them.
The getEnumeration
method returns a
java.util.Enumeration
that is used to scan
the queue's messages. It may be an enumeration of the entire content of a
queue, or it may contain only the messages matching a message selector.
Messages may be arriving and expiring while the scan is done. The JMS API does not require the content of an enumeration to be a static snapshot of queue content. Whether these changes are visible or not depends on the JMS provider.
A QueueBrowser
can be created from either a
Session
or a QueueSession
.
Session.createBrowser(javax.jms.Queue)
,
QueueSession.createBrowser(javax.jms.Queue)
,
QueueReceiver
| Method Summary | |
void |
close()
Closes the QueueBrowser . |
java.util.Enumeration |
getEnumeration()
Gets an enumeration for browsing the current queue messages in the order they would be received. |
java.lang.String |
getMessageSelector()
Gets this queue browser's message selector expression. |
Queue |
getQueue()
Gets the queue associated with this queue browser. |
| Method Detail |
public Queue getQueue() throws JMSException
JMSException
- if the JMS provider fails to get the
queue associated with this browser
due to some internal error.public java.lang.String getMessageSelector() throws JMSException
JMSException
- if the JMS provider fails to get the
message selector for this browser
due to some internal error.public java.util.Enumeration getEnumeration() throws JMSException
JMSException
- if the JMS provider fails to get the
enumeration for this browser
due to some internal error.public void close() throws JMSException
QueueBrowser
.
Since a provider may allocate some resources on behalf of a QueueBrowser outside the Java virtual machine, clients should close them when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.
JMSException
- if the JMS provider fails to close this
browser due to some internal error.
|
JMS 1.1 - April 12, 2002 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


class: center, middle # Pure-Functional Database Access in Scala Rob Norris / `@tpolecat` ??? - name is rob - going to talk about some work i have been doing with pure functional database access - please ask questions as I go, it's likely i will lose some people since i haven't put a lot of time into this --- # What is Functional Programming? Key idea: *Referential Transparency* - Expressions can be replaced with their values without changing the meaning of the program. - More generally, equivalent expressions are interchangeable. - When you can't do the above, we call it a *side effect*. - Printing to the console - Throwing an exception - Looking at the clock - Reading a file - Etc., etc. Intuition: FP is about programming with *values* ??? - so RT is a syntactic property of programs that tells you what kinds of transformations you can do freely - so what you get is equational reasoning; you can treat equal things as truly equal --- # What is Functional IO? Key idea: *programs* are values ```scala sealed trait ConsoleAction case class Print(s: String) extends ConsoleAction case object Newline extends ConsoleAction type Program = List[ConsoleAction] ``` Here is a pure functional IO program: ```scala val prog = List(Print("Hello"), Newline, Print("World!")) ``` --- # What is Functional IO? ... ```scala val prog = List(Print("Hello"), Newline, Print("World!")) ``` Here is a possible *interpreter* for our program. ```scala def stringInterpreter(p: Program): String = p.foldLeft("") { (accum, a) => a match { case Print(s) => accum + s case Newline => accum + '\n' } } ``` And we can run it: ```scala scala> stringInterpreter(prog) res0: String = Hello World! ``` --- # What is Functional IO? ... ```scala scala> stringInterpreter(prog) res0: String = Hello World! ``` Note: - No side-effects anywhere. - `prog` is just a value. --- # What is Functional IO? Another interpreter: ```scala def unsafeInterpreter(p: Program): Unit = p.foreach { case Print(s) => Console.print(s) case Newline => Console.println() } ``` And we can run it: ```scala scala> unsafeInterpreter(prog) Hello World! ``` --- # What is Functional IO? ... ```scala scala> unsafeInterpreter(prog) Hello World! ``` Note: - No side-effects anywhere *until we run the unsafe interpreter* - `prog` is *still* just a value. Intuition: - We treat the interpreter as *part of the runtime*. - We can talk about programs as values right up until we run them. ??? - Ok so in real life you need something more sophisticated than a list of statements, but you actually don't need *much* more. - Data structure called `Free` that provides this minimal structure, and that's what is really happning in the examples I'll be showing you. --- # Problems with Existing DB Libs - Not functional (effects are uncontrolled). - Unprincipled resource management (implicit sessions). - No proper abstractions. - Lots of new not-quite-right stuff to learn. - Can't build big programs from smaller ones. - Can't reuse existing library support like scalaz. - Some people can cope with this. I can't. ??? - today there was a guy on `#scala` struggling to abstract over tables in Slick and he was really suffering. --- # Introducing Doobie Pure-functional library for writing JDBC programs. - Programs are values. - Monadic API (no nutty DSL) with familiar scalaz abstractions. - *Interpreted* into a target monad of your choosing (`IO` and `Task` provided). API is open; you can write your own interpreter if you prefer. - *Not* an ORM. - *Not* a relational algebra or SQL generator, although such a thing could be built on top. --- # Introducing Doobie Out of the box: - Low-level API allows direct translation of existing imperative JDBC code. - Supports full `java.sql` API (as of JDK 1.6) - Designed for library implementors. - High-level API provides a resource-safe subset with higher-level features: - Typeclass-based mapping of product types to columns. - Treat result sets as streams. - String interpolation and other syntax to make this easy. - Designed for end users. - *Good* support for String-based queries. - Same types used in both APIs; drop down as needed. --- # Low-Level API Key idea: *nested* programs
- Each carrier type has its own monadic DSL, and all can be interpreted directly or lifted into another carrier type's DSL. ??? - So what this means is, you can use doobie just to process a resultset, and do everything else with your existing database code; all you need is a resultset. - Or you can build your whole program by composing programs written in these little languages. --- # Low-Level API Example program. You are not expected to think this looks easy. ```scala // Data type to read case class CountryCode(code: String) // DriverManager program val tmain: DriverManagerIO[List[CountryCode]] = for { c <- getConnection("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "") a <- liftConnection(c, speakerQuery("English", 10)) } yield a // Connection Program def speakerQuery(s: String, p: Double): ConnectionIO[List[CountryCode]] = for { ps <- prepareStatement("""SELECT COUNTRYCODE FROM COUNTRYLANGUAGE WHERE LANGUAGE = ?  - Things to notice, we're just using monad comprehensions here to sequence our computations. - We use lifting to embed smaller programs inside larger one. --- # Low-Level API Example program (cont'd) ```scala // ResultSet Program def unroll[A](action: ResultSetIO[A]): ResultSetIO[List[A]] = { def unroll0(as: List[A]): ResultSetIO[List[A]] = next flatMap { case false => as.point[ResultSetIO] case true => action flatMap { a => unroll0(a :: as) } } unroll0(Nil).map(_.reverse) } // Main Program def main(args: Array[String]): Unit = tmain.trans[IO].traverseU(putStrLn).unsafePerformIO ``` Takeaway: - Powerful and very general; can write *any* JDBC program this way. - Must be careful: raw JDBC objects, manual error handling. - Also kind of verbose. ??? - But, we're using map and flatMap and traverse and all these operations that you get for free if you use the right abstractions. - Ok but you don't want to write programs like this; it's too much work. So most of the time... --- # High-Level API - Same types as low-level API, but all operations are resource-safe. - Implemented entirely in terms of low-level API. (Abstractions FTW) - Syntax and helper classes. --- # High-Level API A much better program, in much less code: ```scala // Data type to read case class Country(name: String, continent: String, population: Int) // Transactor knows how to create connection and manage transactions val xa = DriverManagerTransactor[Task]("org.h2.Driver", "jdbc:...", "sa", "") // A parameterized query, as a scalaz-stream Process def q(e: Double) = sql"""SELECT NAME, CONTINENT, POPULATION FROM COUNTRY WHERE LIFEEXPECTANCY >= $e""".process[Country] // Transact yields Process[Task,Country] ... stream top 5 results to stdout val program = xa.transact(q(80)).take(5).map(_.toString).to(io.stdOutLines).run // Main program def main(args: Array[String]): Unit = program.run ``` ??? - (Be sure to talk about desugaring of query) --- class: center, middle # Demos --- # Status - Currently a preview release (0.1) for the daring. - Features in the works. - High-level API support for callable statements. - Integration with HTTP4s. - Structured logging ([example](https://raw.githubusercontent.com/tpolecat/doobie/master/log.png)). - Static typechecking of SQL literals. - Relational algebra (SQL generation). --- class: center, middle # Thanks! Questions? Rob Norris / `@tpolecat`
Code and examples at `github.com/tpolecat/doobie`.
??? - feedback, complaints


This is a very simple test harness which posts to https://fingerection-fcc-filemeta.herokuapp.com/api/fileanalyse Take a look at View page source to see how it works.


Changing policies can make aging workforce a 'boon' to economy – report
Adapting technologies and policies to let an aging populace stay in the workforce for longer can help countries' economies in certain situations, says a new Asian Development Bank report
by Michelle AbadSubscribe
Email Address
Newsletters
- Glenda Gloria's Take this Tuesday
- Huddle by Miriam Grace Go
- The Newsbreak Agenda by Chay Hofileña
- Sometimes, all you need is video by Lilibeth Frondoso


Government College of Engineering, Aurangabad.
Languages: Python, Java, Julia, Scala, JavaScript, SQL,
HTML/CSS
Other: Unix/Linux, Node.js, Angular, Spark, Hadoop, MongoDB, Cassandra, Bootstrap, Jkyll, Git
Languages: English, Mandarin, Hindi, Marathi.
Submitted in SIH 2018
Web platform for mapping of various government schemes to geographically economically and socially diverse regions of India by engaging 37 different Sector Skill Councils under Ministry of Skill development Entrepreneurship. Used Sqoop to move MySQL data to Hive for analysis with Hadoop and HiCharts were used for visualizations.
Multichain Enabled Electronic Health Record Storage and Retrieval system using a web application. Blockchain is used for security and anonymized data is stored offchain on MongoDB. Robust analysis is performed on data and machine learning algorithms are used for epidemic predictions.
Awards: • Deollite "Most Innovative Idea" award in Smart India Hackathon 2018.
Acheivements: • Research paper on "Multichain Enabled Electronic Health Record Management system with Predictive Analytics" presented in 3rd International Conference on Smart Trends for Computing and Communication (SmartCom2019) held in Bangkok on 24th January 2019.
• Finalist in "Smart India Hackathon 2019" which will be held on 2nd March 2019.
• Finalist in "NITI Aayog Pune Smart City Hackathon" from among 3,226 registered teams.
• Certification in "Business Analytics and Data Modelling" securing 77% and Elite Class, offered by IIT Roorkee .
• Headed "WEB-QUEST" an event in "WINGS" a National level technical festival 2019.
Analysis and Insights club
• Co-Founder of AI club which is a Data Science community formed in Aurangabad, Maharashtra.
Technical Secretary
• For Computer Science and Engineering Department, GECA.
Experience
• Organized and managed a 4 day workshop on Blockchain Technology and Applications held in Government College of Engineering, Aurangabad.
• Organized and managed a 3 day workshop on Entrepreneurship and Innovations held in Government College of Engineering, Aurangabad.
• Organized and conducted workshop on Open Source Software Technologies for students of Computer Science department.