Python comes with many handy tools that can make our lives as developers or sysadmins easier. These tools are in the form of modules and libraries that are also executable. Many of these tools are known, but not all are as well known as they should be. I will mention a few useful tools that I have found in this post.
How to write an executable Python script
First, for beginners, a quick introduction to how to write executable scripts in Python. It is actually really easy.
We can simply run a python script from the command line by prepending python
to the name, such as python <script>
.
To run a module which is present in the current PYTHONPATH, you can run from command-line too
$ python -m <module>
Adding python -m
to your script everytime can be tedious sometimes, so in Unix you can tell the shell how to execute your script. This is done by specifying the executing binary path in the first line of the script by appending #!
(aka she-bang) to the command and then simply running the script.
#!/usr/bin/python
or better
#!/usr/bin/env python
When Python executes a script it runs the code top-down line by line. All the functions and classes at the top level of the script will get compiled and any module level statements will be executed. This process is the same as when Python imports a module from another module.
If you want to write code that only executes when the module is run as a script, you can write it in a if __name__ == '__main__'
block as below.
The argparse module in stdlib can be used to parse command-line parameters and ensuring that the interface is clearly specified.
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('-o', '--output')
parser.add_argument('-v', dest='verbose', action='store_true')
args = parser.parse_args()
# ... do something with args.output ...
# ... do something with args.verbose ..
Now let’s look at some interesting and useful runnable modules in the Python Standard Library…
File sharing
A very useful tool is the HTTP Server module. This module can be run to allow sharing of local file over your internal network easily using Python. To start a web server and serve files in current directory simply run the following command…
# Python 3
$ python3 -m http.server
# Python 2
$ python2 -m SimpleHTTPServer
Now the files in local directory are it’s subdirectories are visible on http://localhost:8000/
. Others in the local network can access the files by replcating localhost with our machine’s IP address.
I have used this in the past to quickly share files with collegues where a file share was not readily available and the file is too big to send over email.
JSON pretty printing
json.tool is a handy way of pretty printing and validating JSON format files from the command line.
$ echo '{"json":"obj"}' | python -m json.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
I have used JSON tool in the past to debug integration with HTTP APIs that serve JSON results.
Debugging
The Python debugger pdb
makes it very easy to debug issues with Python scripts. Simply run the target script using pdb
module rather than directly running it. If an unhandled exception is raised the debugger drops in a debug shell allowing us to run a post-mortem analysis by inspecting state and variables.
$ python -m pdb script.py
If you want the debugger to stop at a particular point in execution, simply add the below statement above it in the code.
import pdb; pdb.set_trace()
Performance analysis
Timing
The timeit module is an easy way to time a piece of code. The module can run some setup code (import string), and then run test code many (default 10,000,000) times to time execution of the code.
$ python -m timeit -s 'text = "sample string"; char = "g"' 'char in text'
10000000 loops, best of 3: 0.0408 usec per loop
$ python -m timeit -s 'text = "sample string"; char = "g"' 'text.find(char)'
10000000 loops, best of 3: 0.195 usec per loop
Some useful command-line options are:
-n
- how many times to repeat the statement (default 10M)-r
- how many times to repeat the timer (default 3)-s
- setup statement to be executed once before the test
Profiling
cProfile
module makes it easy to measure the time spent in executing a script and pinpoint the slow bits.
$ python cProfile scriptfile [arg] ...
A couple of useful flags are:
-o
- output file path-s
- sort output
Running tests - Doctests and Unit tests
Python doctests can be run from the command-line using the doctest executable module.
$ python -m doctest -v example.py
Similarly Unit tests can executed using the unittest module
$ python3 -m unittest
This very useful command-line tool will scan the current directory and sub-modules to discover tests and run them. We can also run specific modules or functions by specifying them. Look at the various options here.
Working with archives
Creating and opening Zip and TAR archive files
In case you don’t have tar
or Zip
tools handy, in Python 3 tarfile and zipfile modules allow us to bundle directories into archives and open existing ones.
# Create a new TAR archive
$ python3 -m tarfile -c <tarname>.tgz <file> <file>
# Extract from an existing TAR archive
$ python3 -m tarfile -e <tarname>.tgz
Making executable Zip files
In Python 3, the zipapp module also allows us to pack up a directory into an archive, and makes it executable. When run, the archive will execute the main
function in the myapp
module.
$ python3 -m zipapp myapp
$ python3 myapp.pyz
<output from myapp>
Other useful and interesting modules
Opening a web page in a Browser locally
The webbrowser module has a programatic as well as command-line interface.
$ python -m webbrowser -t http://www.yahoo.com
Base64 encoding and decoding
When working with a REST APIs, especially where authentication tokens are involved, use of Base64 encoding is quite common. Python base64
module can be used from the command-line a tool in the shell as well.
$ python -m base64 -e
Calendar
Did you know that Python comes with an in-built text calendar? The calendar module is executable and can take many parameters that allow for customised display.
$ python -m calendar
2017
January February March
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 1 2 3 4 5 1 2 3 4 5
2 3 4 5 6 7 8 6 7 8 9 10 11 12 6 7 8 9 10 11 12
9 10 11 12 13 14 15 13 14 15 16 17 18 19 13 14 15 16 17 18 19
16 17 18 19 20 21 22 20 21 22 23 24 25 26 20 21 22 23 24 25 26
23 24 25 26 27 28 29 27 28 27 28 29 30 31
30 31
April May June
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 7 1 2 3 4
3 4 5 6 7 8 9 8 9 10 11 12 13 14 5 6 7 8 9 10 11
10 11 12 13 14 15 16 15 16 17 18 19 20 21 12 13 14 15 16 17 18
17 18 19 20 21 22 23 22 23 24 25 26 27 28 19 20 21 22 23 24 25
24 25 26 27 28 29 30 29 30 31 26 27 28 29 30
July August September
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 2 1 2 3 4 5 6 1 2 3
3 4 5 6 7 8 9 7 8 9 10 11 12 13 4 5 6 7 8 9 10
10 11 12 13 14 15 16 14 15 16 17 18 19 20 11 12 13 14 15 16 17
17 18 19 20 21 22 23 21 22 23 24 25 26 27 18 19 20 21 22 23 24
24 25 26 27 28 29 30 28 29 30 31 25 26 27 28 29 30
31
October November December
Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su
1 1 2 3 4 5 1 2 3
2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10
9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17
16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24
23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31
30 31
Print system configuration
Sysconfig module allows you to print the detailed system configuration including environment variables which might be useful for debugging purposes.
$ python -m sysconfig
Platform: "macosx-10.6-intel"
Python version: "3.6"
Current installation scheme: "posix_prefix"
Paths:
data = "/Library/Frameworks/Python.framework/Versions/3.6"
include = "/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m"
platinclude = "/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m"
platlib = "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages"
platstdlib = "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6"
purelib = "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages"
scripts = "/Library/Frameworks/Python.framework/Versions/3.6/bin"
stdlib = "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6"
Variables:
ABIFLAGS = "m"
AC_APPLE_UNIVERSAL_BUILD = "1"
AIX_GENUINE_CPLUSPLUS = "0"
ANDROID_API_LEVEL = "0"
...


Sam Jones showing up just in time to save the Tune Squad and the Earth.
But do you know the entire list of this one man's accomplishments?
Sam Jones learning from a master on how to dissect MF DOOM lyrics.
1. A devastatingly effective tool. When used correctly, onlookers will spend the next day reevaluating their lives.
He was a thug.
> That's racist.
He was white.
> That's racist.
Its use has proven so destrutive that it has been banned in high school debate.


Took me more than an hour to make sure that the background could keep in place.
The main problem was that I didn't understand the difference between a "canvas" object and a simple GameObject.
And the difference is still not very clear to me in fact...


Leverage simple tools to obtain your BIN, create a Technology Plan, and create and file an ERATE FORM 470 with ERATECycle.
Create simple and objective evaluation criteria to help quickly choose the winning E-RATE provider
The E-RATE process can seem complicated. ERATECycle simplifies the process into a few key steps.
Each step is clearly defined, published and updated.
Transparency and automated updates keep decision cycles fast and accurate.
Keep all historic records online and backed up. Making filing for next year’s E-RATE cycle simple, fast and accurate.
From 470 to evaluating and archiving provider bills
Automating every step of the process for schools, districts and libraries. Each entity securely gets access to all filings, Gains access to powerful automation, ensures proper process alignment and automatically prepares for future filings. A full E-RATE lifecycle management tool
Learn more


Toshiaki Takahashi is a front-end engineer at the red-hot language startup Gengo.com in Tokyo, Japan. He also works on Github.com. You can reach him at @toshipon.


HTTP Feature Testing¶
Feature testing allows you to view the results of a single call to your application. This might be returning the results of a single web form, hitting an API endpoint, and more. This is handy because it allows you to test the entire life-cycle of a single request, ensuring that the routing works, the response is the correct format, analyze the results, and more.
The Test Class¶
Feature testing requires that all of your test classes extend the CodeIgniter\Test\FeatureTestCase
class or use the CodeIgniter\Test\FeatureTestTrait
. Since these testing tools extend
CIDatabaseTestCase you must always ensure that parent::setUp()
and parent::tearDown()
are called before you take your actions.
<?php
namespace App;
use CodeIgniter\Test\FeatureTestCase;
class TestFoo extends FeatureTestCase
{
public function setUp(): void
{
parent::setUp();
}
public function tearDown(): void
{
parent::tearDown();
}
}
Requesting A Page¶
Essentially, the FeatureTestCase simply allows you to call an endpoint on your application and get the results back.
to do this, you use the call()
method. The first parameter is the HTTP method to use (most frequently either GET or POST).
The second parameter is the path on your site to test. The third parameter accepts an array that is used to populate the
superglobal variables for the HTTP verb you are using. So, a method of GET would have the $_GET variable
populated, while a post request would have the $_POST array populated.
// Get a simple page
$result = $this->call('get', '/');
// Submit a form
$result = $this->call('post', 'contact'), [
'name' => 'Fred Flintstone',
'email' =><EMAIL_ADDRESS>]);
Shorthand methods for each of the HTTP verbs exist to ease typing and make things clearer:
$this->get($path, $params);
$this->post($path, $params);
$this->put($path, $params);
$this->patch($path, $params);
$this->delete($path, $params);
$this->options($path, $params);
Note
The $params array does not make sense for every HTTP verb, but is included for consistency.
Setting Different Routes¶
You can use a custom collection of routes by passing an array of “routes” into the withRoutes()
method. This will
override any existing routes in the system:
$routes = [
[ 'get', 'users', 'UserController::list' ]
];
$result = $this->withRoutes($routes)
->get('users');
Each of the “routes” is a 3 element array containing the HTTP verb (or “add” for all), the URI to match, and the routing destination.
Setting Session Values¶
You can set custom session values to use during a single test with the withSession()
method. This takes an array
of key/value pairs that should exist within the $_SESSION variable when this request is made, or null` to indicate
that the current values of ``$_SESSION
should be used. This is handy for testing authentication and more.
$values = [
'logged_in' => 123
];
$result = $this->withSession($values)
->get('admin');
// Or...
$_SESSION['logged_in'] = 123;
$result = $this->withSession()->get('admin');
Setting Headers¶
You can set header values with the withHeaders()
method. This takes an array of key/value pairs that would be
passed as a header into the call.:
$headers = [
'CONTENT_TYPE' => 'application/json'
];
$result = $this->withHeaders($headers)->post('users');
Bypassing Events¶
Events are handy to use in your application, but can be problematic during testing. Especially events that are used
to send out emails. You can tell the system to skip any event handling with the skipEvents()
method:
$result = $this->skipEvents()
->post('users', $userInfo);
Formatting The Request¶
You can set the format of your request’s body using the withBodyFormat()
method. Currently this supports either
json or xml. This will take the parameters passed into call(), post(), get()...
and assign them to the
body of the request in the given format. This will also set the Content-Type header for your request accordingly.
This is useful when testing JSON or XML API’s so that you can set the request in the form that the controller will expect.
//If your feature test contains this:
$result = $this->withBodyFormat('json')
->post('users', $userInfo);
//Your controller can then get the parameters passed in with:
$userInfo = $this->request->getJson();
Setting the Body¶
You can set the body of your request with the withBody()
method. This allows you to format the body how you want
to format it. It is recommended that you use this if you have more complicated xml’s to test. This will also not set
the Content-Type header for you so if you need that, you can set it with the withHeaders()
method.
Testing the Response¶
Once you’ve performed a call()
and have results, there are a number of new assertions that you can use in your
tests.
Note
The Response object is publicly available at $result->response
. You can use that instance to perform
other assertions against, if needed.
Checking Response Status¶
isOK()
Returns a boolean true/false based on whether the response is perceived to be “ok”. This is primarily determined by a response status code in the 200 or 300’s.
if ($result->isOK())
{
...
}
assertOK()
This assertion simply uses the isOK() method to test a response.
$result->assertOK();
isRedirect()
Returns a boolean true/false based on whether the response is a redirected response.
if ($result->isRedirect())
{
...
}
assertRedirect()
Asserts that the Response is an instance of RedirectResponse.
$result->assertRedirect();
getRedirectUrl()
Returns the URL set for a RedirectResponse, or null for failure.
$url = $result->getRedirectUrl();
$this->assertEquals(site_url('foo/bar'), $url);
assertStatus(int $code)
Asserts that the HTTP status code returned matches $code.
$result->assertStatus(403);
Session Assertions¶
assertSessionHas(string $key, $value = null)
Asserts that a value exists in the resulting session. If $value is passed, will also assert that the variable’s value matches what was specified.
$result->assertSessionHas('logged_in', 123);
assertSessionMissing(string $key)
Asserts that the resulting session does not include the specified $key.
$result->assertSessionMissin('logged_in');
Header Assertions¶
assertHeader(string $key, $value = null)
Asserts that a header named $key exists in the response. If $value is not empty, will also assert that the values match.
$result->assertHeader('Content-Type', 'text/html');
assertHeaderMissing(string $key)
Asserts that a header name $key does not exist in the response.
$result->assertHeader('Accepts');
Cookie Assertions¶
assertCookie(string $key, $value = null, string $prefix = ‘’)
Asserts that a cookie named $key exists in the response. If $value is not empty, will also assert that the values match. You can set the cookie prefix, if needed, by passing it in as the third parameter.
$result->assertCookie('foo', 'bar');
assertCookieMissing(string $key)
Asserts that a cookie named $key does not exist in the response.
$result->assertCookieMissing('ci_session');
assertCookieExpired(string $key, string $prefix = ‘’)
Asserts that a cookie named $key exists, but has expired. You can set the cookie prefix, if needed, by passing it in as the second parameter.
$result->assertCookieExpired('foo');
DOM Assertions¶
You can perform tests to see if specific elements/text/etc exist with the body of the response with the following assertions.
assertSee(string $search = null, string $element = null)
Asserts that text/HTML is on the page, either by itself or - more specifically - within a tag, as specified by type, class, or id:
// Check that "Hello World" is on the page
$result->assertSee('Hello World');
// Check that "Hello World" is within an h1 tag
$result->assertSee('Hello World', 'h1');
// Check that "Hello World" is within an element with the "notice" class
$result->assertSee('Hello World', '.notice');
// Check that "Hello World" is within an element with id of "title"
$result->assertSee('Hellow World', '#title');
assertDontSee(string $search = null, string $element = null)
Asserts the exact opposite of the assertSee() method:
// Checks that "Hello World" does NOT exist on the page
$results->dontSee('Hello World');
// Checks that "Hello World" does NOT exist within any h1 tag
$results->dontSee('Hello World', 'h1');
assertSeeElement(string $search)
Similar to assertSee(), however this only checks for an existing element. It does not check for specific text:
// Check that an element with class 'notice' exists
$results->seeElement('.notice');
// Check that an element with id 'title' exists
$results->seeElement('#title')
assertDontSeeElement(string $search)
Similar to assertSee(), however this only checks for an existing element that is missing. It does not check for specific text:
// Verify that an element with id 'title' does NOT exist
$results->dontSeeElement('#title');
assertSeeLink(string $text, string $details=null)
Asserts that an anchor tag is found with matching $text as the body of the tag:
// Check that a link exists with 'Upgrade Account' as the text::
$results->seeLink('Upgrade Account');
// Check that a link exists with 'Upgrade Account' as the text, AND a class of 'upsell'
$results->seeLink('Upgrade Account', '.upsell');
assertSeeInField(string $field, string $value=null)
Asserts that an input tag exists with the name and value:
// Check that an input exists named 'user' with the value 'John Snow'
$results->assertSeeInField('user', 'John Snow');
// Check a multi-dimensional input
$results->assertSeeInField('user[name]', 'John Snow');
Working With JSON¶
Responses will frequently contain JSON responses, especially when working with API methods. The following methods can help to test the responses.
getJSON()
This method will return the body of the response as a JSON string:
// Response body is this:
['foo' => 'bar']
$json = $result->getJSON();
// $json is this:
{
"foo": "bar"
}
Note
Be aware that the JSON string will be pretty-printed in the result.
assertJSONFragment(array $fragment)
Asserts that $fragment is found within the JSON response. It does not need to match the entire JSON value.
// Response body is this:
[
'config' => ['key-a', 'key-b']
]
// Is true
$result->assertJSONFragment(['config' => ['key-a']]);
assertJSONExact($test)
Similar to assertJSONFragment(), but checks the entire JSON response to ensure exact matches.
Working With XML¶
getXML()
If your application returns XML, you can retrieve it through this method.


This section describes how to define a top-level REST resource page and deploy it in our microservice.
The example is a router page that serves as a jumping off page to child resources.
| @Rest(
| path="/*",
| title="My Microservice",
| description="Top-level resources page",
| htmldoc=@HtmlDoc(
| navlinks={
| "options: servlet:/?method=OPTIONS"
| }
| ),
| children={
| HelloWorldResource.class,
| ConfigResource.class,
| LogsResource.class
| }
| )
| public class RootResources extends BasicRestServletGroup {
| // No code!
| }
When deployed, it looks like this in a browser:
| http://localhost:10000
-
The title and description annotations define the titles on the page.
These can be globalized using $L{...} variables, or by defining specially-named properties in the
properties file for the resource.
-
In this case, the path annotation defines the context root of your application since it was
not specified in the manifest or config file.
Therefore, this resource is mapped to http://localhost:10000.
-
The children annotation make up the list of child resources.
These child resources can be anything that extends from Servlet, although usually
they will be subclasses of {@link oajr.servlet.BasicRestServlet} or other resource groups.
If you click the helloWorld link in your application, you'll get a simple hello world message:
| http://localhost:10000/helloWorld
...which is generated by this class...
| @Rest(
| path="/helloWorld",
| title="Hello World example",
| description="Simplest possible REST resource"
| )
| public class HelloWorldResource extends BasicRestServlet {
|
| @RestGet("/*")
| public String sayHello() {
| return "Hello world!";
| }
| }
The most-common case for deploying the top-level resource is to use the {@link oaj.microservice.jetty.JettyMicroservice.Builder#servlet(Class)} method:
| public class App {
| public static void main(String[] args) {
| JettyMicroservice
| .create()
| .args(args)
| .servlet(RootResources.class) // Our root resource.
| .build()
| .start()
| ;
| }
| }
However, there are multiple ways of deploying top-level resources:
-
{@link oaj.microservice.jetty.JettyMicroservice.Builder#servlet(Class)} - Using the builder. Several methods provided.
-
{@link oaj.microservice.jetty.JettyMicroservice#addServlet(Servlet,String)} - After the Jetty container has been started.
-
As a configuration variable "Jetty/servlets".
| #=======================================================================================================================
| # Jetty settings
| #=======================================================================================================================
| [Jetty]
|
| # Subclasses of RestServlet
| servlets = org.apache.juneau.examples.rest.RootResources
-
As a configuration variable "Jetty/servletMap".
| #=======================================================================================================================
| # Jetty settings
| #=======================================================================================================================
| [Jetty]
|
| # Any servlets and their path specs
| servletMap =
| {
| '/*': 'org.apache.juneau.examples.rest.RootResources'
| }
|
-
Directly in the jetty.xml file.
| <Configure id="ExampleServer" class="org.eclipse.jetty.server.Server">
| ...
| <New id="context" class="org.eclipse.jetty.servlet.ServletContextHandler">
| <Set name="contextPath">/</Set>
| <Call name="addServlet">
| <Arg>org.apache.juneau.rest.test.Root</Arg>
| <Arg>/*</Arg>
| </Call>
| <Set name="sessionHandler">
| <New class="org.eclipse.jetty.server.session.SessionHandler" />
| </Set>
| </New>
| ...


LIVE
Total coverage for all files
Coverage by file
| Name | Executable Count | Execution Count | Coverage % | {% for f in file_details_list %}
|---|---|---|---|
| {{f.filename}} | {{f.executable}} | {{f.executed}} | {{f.percent_executed}}% |
Covered Routes
| Route | Visited | {% for t in covered_routes_list %}
|---|---|
| {{t.route}} | {{t.visited}} |
Covered Modules
| Module | Touched by test | {% for t in covered_modules_list %}
|---|---|
| {{t.module}} | {{t.visited}} |
Test Efficiency
| ID | Execution Count | Coverage % | {% for t in tc_coverage_list %}
|---|---|---|
| {{t.test_id}} | {{t.total_executed}} | {{t.coverage}} |


Recent Actions
-
{% for action in recent_actions %}
- {{ action.when_igt|date }} - {{ action.description }} {% endfor %}
For more view the Action Log
{% extends 'base.html' %} {% load humanize %} {% block title %}{{ enterprise.name }}{% endblock %} {% block content %}
Current Balance: ${{ enterprise.get_balance|intcomma }}
Launches End Turn (make stuff happen)
For more view the Action Log
| Date | Description | Amount |
|---|---|---|
| {{ transaction.when_igt|date }} | {{ transaction.details }} | {{ transaction.amount|intcomma }} |
For more view the Transaction Log


cell2nancat documentation
The cell2nancat function concatenates elements of a cell into a NaN-separated vector.
Back to Climate Data Tools Contents
Contents
Syntax
xv = cell2nancat(xc) [xv,yv,...,zv] = cell2nancat(xc,yc,...,zc)
Description
xv = cell2nancat(xc) concatenates the numeric arrays of cell array xc into a single vector separated by NaNs.
[xv,yv,...,zv] = cell2nancat(xc,yc,...,zc) as above but for any number of cell arrays.
Example
CDT comes with data for all the national and US states boundaries. Here's the format it's in:
load borderdata whos % prints name & size of each variable in workspace
Name Size Bytes Class Attributes GEOM 1x4 32 double clat 302x1 36240 cell clon 302x1 36240 cell lat 302x1 4629240 cell lon 302x1 4629240 cell places 302x1 40192 cell
Thos are all cell arrays. Each of those 302 arrays contains the borders of a different state or country. To see what that looks like, here are the names and latitudes of the first three countries:
[places(1:3) lat(1:3)]
ans = 3×2 cell array {'Antigua and Barbuda'} {1×50 double} {'Algeria' } {1×1242 double} {'Azerbaijan' } {1×876 double}
If you want to plot all the borderlines, your first inclination might be to loop through each of the 302 entries and plot them individually, like this:
hold on for k = 1:302 plot(lon{k},lat{k}) end
However, looping is computationally slow and you might not want 300+ different objects plotted in your figure. So instead, you can turn each cell array into a vector and plot everything together.
Here's how cell2nancat works: Give it a cell array, and get a vector in return:
latv = cell2nancat(lat); whos lat latv
Name Size Bytes Class Attributes lat 302x1 4629240 cell latv 574729x1 4597832 double
Now that 302x1 cell array has been turned into a 574729x1 vector array containing all the borderlines from lat. To use the function on multiple cell arrays, just enter them all into cell2nancat:
[latv,lonv,clatv,clonv] = cell2nancat(lat,lon,clat,clon); plot(lonv,latv,'b') % blue borderlines hold on plot(clonv,clatv,'r.') % landmass centroids as red dots
Author Info
This function is part of the Climate Data Toolbox for Matlab. The function and supporting documentation were written by Chad A. Greene of the University of Texas at Austin.


Dayan Perera
About
Portfolio
Contact
Portfolio
Hangman
RPG Game
Rutgers Info Widget
Trivia Game
Rock Paper Scissors
Connect With Me


One-time, authorize your locker by entering
dropbox app credentials
and logging into your dropbox account
App Key:
App Secret:
Email address:
Password:


Dear EOs and APOs,
Tomorrow, at 10am, there will be a meeting for the international students only. This is specifically for students to give them a forum and address their concerns.
For EOs, APOs, and faculty, an additional meeting has been scheduled at 1pm tomorrow – to address questions regarding the new and troubling announcement from SEVP on International Students that has caused much confusion and anxiety.
The link to the 1pm meeting is below.
Linda Asaro is inviting you to a scheduled Zoom meeting.
Topic: SEVP Guidance International Students Meeting for EO's
Time: Jul 8, 2020 01:00 PM Eastern Time (US and Canada)
Join Zoom Meeting
https://gc-cuny.zoom.us/j/99197159243?pwd=YkdEM3hXRFZlUzU2dVE1dmpkcGxCQT09
Meeting ID: 991 9715 9243
Password: 826751
One tap mobile
+13126266799,,99197159243#,,,,0#,,826751# US (Chicago)
+16468769923,,99197159243#,,,,0#,,826751# US (New York)
Dial by your location
+1<PHONE_NUMBER> US (Chicago) +1<PHONE_NUMBER> US (New York) +1<PHONE_NUMBER> US (Germantown) +1<PHONE_NUMBER> US (Houston) +1<PHONE_NUMBER> US (San Jose) +1<PHONE_NUMBER> US (San Jose) +1<PHONE_NUMBER> US (Tacoma)
Meeting ID: 991 9715 9243
Password: 826751
Find your local number: https://gc-cuny.zoom.us/u/ac4KSTz99U


--- author: Andre Charland categories: app date: '2010-11-25 01:50:56' link: http://blogs.nitobi.com/andre/index.php/2010/11/24/ars-technica-ipad-app-w-phonegap/ permalink: /2010/11/25/ars-technica-ipad-app-w-phonegap-2/ slug: ars-technica-ipad-app-w-phonegap-2 status: publish title: Ars Technica iPad App w/ PhoneGap type: post format: html ---
A couple weeks ago Ars Technica released their iPad App. It's certainly one of the nicer PhoneGap apps I've seen today. It's very simple and feels like a native in look and in feel. Scrolling through the articles is great. IBM built the app for them, which is very exciting to us at Nitobi and for the rest of the PhoneGap project. It's a great example of what can be achieved with HTML5, JS and CSS. They have a full write up on how they built it on their blog.
Here's a quick video of me interacting with the app:
Download it from iTunes here. Let me know what you think and if you have any feedback. There's also an update on the Ars blog about how they're planning to improve scrolling and navigation in a future release of the app. Kudos to them on a job well done and being very transparent about that!


The coronavirus package provides a tidy format dataset of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic. The raw data pulled from the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) Coronavirus repository.
More details available here, and a csv
format of the package dataset available here
A summary dashboard is available here
As this an ongoing situation, frequent changes in the data format may occur, please visit the package news to get updates about those changes
Install the CRAN version:
install.packages("coronavirus")
Install the Github version (refreshed on a daily bases):
# install.packages("devtools")
devtools::install_github("covid19r/coronavirus")
The package contains a single dataset - coronavirus
:
This coronavirus
dataset has the following fields:
head(coronavirus)
#> Province.State Country.Region Lat Long date cases type
#> 1 Afghanistan 33 65 2020-01-22 0 confirmed
#> 2 Afghanistan 33 65 2020-01-23 0 confirmed
#> 3 Afghanistan 33 65 2020-01-24 0 confirmed
#> 4 Afghanistan 33 65 2020-01-25 0 confirmed
#> 5 Afghanistan 33 65 2020-01-26 0 confirmed
#> 6 Afghanistan 33 65 2020-01-27 0 confirmed
tail(coronavirus)
#> Province.State Country.Region Lat Long date cases type
#> 64569 Zhejiang China 29.1832 120.0934 2020-04-08 2 recovered
#> 64570 Zhejiang China 29.1832 120.0934 2020-04-09 3 recovered
#> 64571 Zhejiang China 29.1832 120.0934 2020-04-10 0 recovered
#> 64572 Zhejiang China 29.1832 120.0934 2020-04-11 1 recovered
#> 64573 Zhejiang China 29.1832 120.0934 2020-04-12 2 recovered
#> 64574 Zhejiang China 29.1832 120.0934 2020-04-13 1 recovered
Here is an example of a summary total cases by region and type (top 20):
library(dplyr)
summary_df <- coronavirus %>% group_by(Country.Region, type) %>%
summarise(total_cases = sum(cases)) %>%
arrange(-total_cases)
summary_df %>% head(20)
#> # A tibble: 20 x 3
#> # Groups: Country.Region [13]
#> Country.Region type total_cases
#> <chr> <chr> <int>
#> 1 US confirmed 580619
#> 2 Spain confirmed 170099
#> 3 Italy confirmed 159516
#> 4 France confirmed 137875
#> 5 Germany confirmed 130072
#> 6 United Kingdom confirmed 89570
#> 7 China confirmed 83213
#> 8 China recovered 78039
#> 9 Iran confirmed 73303
#> 10 Spain recovered 64727
#> 11 Germany recovered 64300
#> 12 Turkey confirmed 61049
#> 13 Iran recovered 45983
#> 14 US recovered 43482
#> 15 Italy recovered 35435
#> 16 Belgium confirmed 30589
#> 17 France recovered 28001
#> 18 Netherlands confirmed 26710
#> 19 Switzerland confirmed 25688
#> 20 Canada confirmed 25679
Summary of new cases during the past 24 hours by country and type (as of 2020-04-13):
library(tidyr)
coronavirus %>%
filter(date == max(date)) %>%
select(country = Country.Region, type, cases) %>%
group_by(country, type) %>%
summarise(total_cases = sum(cases)) %>%
pivot_wider(names_from = type,
values_from = total_cases) %>%
arrange(-confirmed)
#> # A tibble: 185 x 4
#> # Groups: country [185]
#> country confirmed death recovered
#> <chr> <int> <int> <int>
#> 1 US 25306 1509 10494
#> 2 United Kingdom 4364 718 -322
#> 3 France 4205 574 532
#> 4 Turkey 4093 98 511
#> 5 Spain 3268 547 2336
#> 6 Italy 3153 566 1224
#> 7 Russia 2558 18 179
#> 8 Peru 2265 23 844
#> 9 Germany 2218 172 4000
#> 10 Iran 1617 111 2089
#> # … with 175 more rows
The raw data pulled and arranged by the Johns Hopkins University Center for Systems Science and Engineering (JHU CCSE) from the following resources:


Interface IPlatformScheduler
- All Known Implementing Classes:
AbstractScheduler
,NativeThreadPoolScheduler
public interface IPlatformScheduler
Implements a platform dependent scheduler to schedule a synchronization job or handle on-demand sync.
The implementation must handle adding or removing a new schedule.
-
Method Summary
Modifier and TypeMethodDescriptioncancel()
Cancel all queued scheduled jobs and terminate the timer threads as soon as possible.scheduleAtFixedRate
(Runnable job, long period) Schedule a re-occurring job with a timer at a fixed timing rate.Schedule a single job for immediate background execution.stopSchedule
(String jobKey) Stop the scheduled job, identified with a key.
-
Method Details
-
scheduleForImmediateExecution
Schedule a single job for immediate background execution.The job is started on a separate timer thread immediately, but only once.
- Parameters:
job
- the runnable to to execute. In case it isnull
, the schedule is ignored.- Returns:
this
.
-
scheduleAtFixedRate
Schedule a re-occurring job with a timer at a fixed timing rate.Starting from this very millisecond, the job is executed after every
period
milliseconds have passed.period
is also used as initial delay. So in case it is set to one hour (=3600000
milliseconds), the job is first executed in an hour and then every hour afterwards.There is no check whether the same instance is added again.
- Parameters:
job
- the runnable to to execute. In case it isnull
, the schedule is ignored.period
- the period in milliseconds to execute the job.- Returns:
- a key to the scheduled job, that can be used to remove the schedule later with
stopSchedule(String)
.
-
stopSchedule
Stop the scheduled job, identified with a key.- Parameters:
jobKey
- As returned by#schedule(Runnable)
- Returns:
this
to support Fluent Interface.
-
cancel
IPlatformScheduler cancel()Cancel all queued scheduled jobs and terminate the timer threads as soon as possible.The currently running job is not terminated. Only the queue is cleared and all schedules cancelled.
- Returns:
this
to support Fluent Interface.
-


Get a Quote for Taxi Services
United Kingdom
Saloon - (4 Seater)
Estate Car - (4 Seater)
Executive Car - (4 Seater)
6 Seater people carrier
Minibus - (7 Seater)
Get Quote


Watch: Rapsody Spits Fire Bars In New Hot 97 Funk Flex Freestyle – “How Y’All Gonna Boo Drake, Wouldn’t Have A Boo Without Drake”
by Team SOHHRap artist Rapsody is nice-nice with the lyrical wordplay. The hip-hop entertainer pulled through this week for an unforgettable Hot 97 Funk Flex freestyle. Watch and comment below!


Package com.whirled.avrg
Classes
AgentSubControl
AVRGameAvatar
AVRGameControl
AVRGameControlEvent
AVRGamePlayerEvent
AVRGameRoomEvent
AVRServerGameControl
GameSubControlBase
GameSubControlClient
GameSubControlServer
LocalSubControl
MobSubControlBase
MobSubControlClient
MobSubControlServer
OfflinePlayerPropertyControl
PlayerSubControlBase
PlayerSubControlClient
PlayerSubControlServer
PropControl
RoomSubControlBase
RoomSubControlClient
RoomSubControlServer
UIConstants


Project Founder and Lead
Paul Hammant
Active Committers
Paul Hammant
Mauro Talevi
Guilherme Silveira


Photo Credit: {{ page.image.credit }}
{% endif %}{% endif %}--- title: "Contact" permalink: /contact/ layout: archive author_profile: true header: image: /images/cover.jpg caption: "[**Contact**](https://mishravip.github.io/contact)" ---
{% include head.html %} {% include navigation.html %}Photo Credit: {{ page.image.credit }}
{% endif %}{% endif %}


Student Loan Fraud
by BRIEFSANTA ANA, Calif. — The FTC accuses American Financial Support Services, Arete Financial Group dba Arete Financial Freedom and a slew of other business and their operators of preying upon student debtors in a $43 million advance-fee debt relief scam, in federal court.
Copyright © 2019 courthousenews.com


SALO [Spoilers] A film review by<EMAIL_ADDRESS>Copyright 1993<EMAIL_ADDRESS>As you all know, I have solicited best film lists from the readership of rec.arts.movies. What has surprised me is that so far there has been so little overlap in the many lists sent to me. The lists have revealed very eclectic tastes, and have been generally unresponsive to what are often called "The Great Films." CITIZEN KANE has appeared on only one list, for example. I was intrigued by the fact that the only film common to several lists was the infamous SALO of the Italian director Pier Paolo Pasolini. I had not seen this film, but after an e-mail exchange with one of the readers whose list contained it, I decided to view it. Since I have read the book on which the film is based, THE 120 DAYS OF SODOM, by the Marquis de Sade (1740-1814) and many have not, I thought my observations on the film would be of interest to the Net readership.
SALO is not for everyone.  Full nudity of both sexes abounds. In the films of established, "respected" directors, SALO has no antecedents. A measure of Pasolini's facility with morally extreme thematic material is the fact that many consider his THE GOSPEL ACCORDING TO ST. MATTHEW (1964) to be the finest film setting of the life of Christ. SALO (1975) is the moral obverse of the earlier film.
De Sade, from whom the word "sadism" derives, wrote THE 120 DAYS OF SODOM while imprisoned for sexual crimes. Though the book is considered his most important work, it was not published in his lifetime.
De Sade professed a philosophy of Rousseauian individualism, carried to psychopathic excess. Men have the right to do whatever they want to do. (It is not clear whether he would grant women the same authority, although many of the women in his writings have a startling degree of self-actualization.) Pity and compassion are lies, promulgated by the weak to procure the leniency of the strong. De Sade would revile the ideas of humanism as self-deception and folly. Humankind is divided into two classes, the oppressors and the oppressed. You must choose to be either one or the other. While you may cringe at making such a choice, you cannot change the facts: that's the way things are, and the history of our species proves it.
De Sade claimed that his philosophy brought him happiness: "On the basis of my errors, I have established principles; since that time, I have known felicity." His writings, as I point out later, reveal otherwise. De Sade placed himself in a prison grimmer than the physical prison he inhabited, a prison of the soul.
Some may question why we should tolerate de Sade's writings. Simone de Beauvoir has written a very perceptive defense of de Sade, and her essay is contained as a preface to the Grove Press edition of THE 120 DAYS, under the title, "Must we burn de Sade?" However, rather than get into a swivet of self-debate about whether such material should be permitted in even a free society, I suggest that, if the first paragraph or so of my description indicates the film would not be congenial to your tastes, you avoid it.
What follows is a TOTAL SPOILER! Also, I warn that my description of the film and book may offend some.
PASOLINI'S IDIOM
For a number of years I have tried to analyze the reasons for the exceptional texture of Pier Paolo Pasolini's films. His films seem to possess a strange kind of stasis, consisting of a series of brief, isolated set-pieces, not narrative but rather visual in character, somewhat like snapshots, mathematical lemmas, or pronouncements from a catechism. It is interesting that TEOREMA, one of his most striking films, takes its title from the Italian word for a medieval theological treatise.
The methods that Pasolini uses to achieve this effect, as I see it, are three: i) the frequent use of long shots, often with either no action or some non-committal action, like walking; ii) almost no camera movement; iii) the use of untrained actors. No one has used untrained actors more effectively than Pasolini. Directors working with trained actors rely on the reaction shot to establish film continuity. The more skilled the actors, the more emotional momentum the film has. When Pasolini's camera captures the face of a young peasant, the effect is one of disjunction: the film, in a sense, comes to a halt. The face is affectless, bland, passive--not even baffled or uncomprehending. There is no bad acting, there is simply no acting at all. Such devices allow Pasolini to produce an almost mechanical passivity, an implicit fatalism.
"This is the way things are," the films seem to be saying. "There's nothing that can be done about it."
Whether you like Pasolini's films will depend to a large extent not so much on the subject matter but whether you accept his film language. Some people can't. Several years ago I attended a revival of TEOREMA at the Theater of the Living Arts, in Philadelphia. There were titters and even guffaws from the audience during the film. In the face of what cannot be understood, Pasolini seems to be saying, passivity is inevitable. Audience laughter is a way of resisting this invitation to victimhood. On the other hand, Pasolini's films enjoy a rare timelessness because his style often lifts the material above social conventions.
Such a film vocabulary is, I believe, perfect for translating de Sade's dark vision. It is safe to say that no other director could have dealt with THE 120 DAYS OF SODOM, certainly the most appalling book ever written. Whether you think that Pasolini himself deals with it successfully is, I suppose, a matter of personal taste.
THE FILM
The Duc de Blangis, with a entourage of depraved nobles and prelates, a rogue Archbishop, servants, armed guards, and congeries of male and female youths kidnapped for the occasion, retire to an immense castle in the countryside. There, over a period of 120 days, they execute a series of activities designed to explore the extremes of sexual perversion, generally to the detriment of the kidnapped youths, including torture and murder.
The Duc begins the festivities by reading to the soldiers and the terrified youths certain rules: 1) the mention of God, or the undertaking of any religious observance, including prayer, is punishable by immediate death; 2) any private sexual act is punishable by immediate death. All sexual activity must be prescribed by the Duc and witnessed by him.
Each morning begins with a dissolute middle-aged courtesan named Duclos relating one of her past sexual escapades to the assembled nobles, youths, and soldiers--de Sade's version of matins. The assembled leaders impatiently prod Duclos for more details. These scenes follow the book closely. The furious probing for ever more lurid details suggests that de Sade during these episodes was the prey of his own fantasies, that he was indulging them as gingerly and fearfully as one might hand-feed a starving tiger.
 The activities of the first several days are rather conventional, but because of the Duc's boredom and impatience, they soon begin to assume a cruel and bizarre aspect: frequent homosexual and heterosexual rape, coprophagia, uropinia, morophilia (I'm having to reach for my Greek dictionary now), miscegenation, elaborate tortures. There is a remarkable banquet with only one entree. A young soldier and a maid are found in bed together and are summarily executed.
The cynosure of the book is the Duc. In the Duc de Blangis, de Sade created an unforgettable character: implacable, fathomlessly evil, a moral black hole. He is the most intimidating figure in literature. "He may be regarded as the depository of every vice and crime," de Sade stipulates. "He has killed his mother, his sister, and three of his wives." One has to look to the Jacobean stage to find any close contenders in villainy. Even the Duc's lust, fueled by a sort of ethereal rage ("Today would go badly for them. The Duc was in a black mood...") seems theoretical, divorced from human concerns. For those of us worried about the redemption of our species, he presents a terrifying construct.
SALO is truly shocking. However, it is neither exploitative nor sensationalistic. Exploitation and sensationalism are film devices adopted for a particular occasion with the response of a particular audience in mind. Pasolini's adaptation of de Sade's long (500 pp.) book is measured, literal, almost reverent. He selects, but he alters little. He places the film in northern Italy during the Second World War--the leaders, in black business suits, are higher-ups in the Gestapo, the guards are SS men. We hear throughout the film the low distant rumble of war, as though some gigantic inscrutable machine were at work, a very effective device. The suggestion is that the only difference between war and systematic torture is the ingredient of specific human intent. The film attains some resonance because of the setting, which invites us to reflect on the nature of fascism. However the Duc is not a fascist. Fascism involves values, perverted, perhaps, but values nevertheless. The Duc has no values. The contemporary setting is useful only to explain the origins of the Duc's power.
Toward the end, de Sade's writing becomes frantic. Sentences tumble out. Tortures are more grotesque and abbreviated. The excised nerves of a maid servant are wound on red-hot spools of iron. "In order to combine incest, adultery, sodomy and sacrilege," we are informed, "he embuggers his married daughter with a Host." Like a racing driver trapped under the carriage of his runaway machine, de Sade has become the ejecta of his own fixations.
At this point Pasolini distances himself from de Sade's hysteria and shapes the material to his own ends, revealing a formidable artistry. The Duc and the Archbishop are seated in elegant drag, almost as though they were holding court. With binoculars, they watch through the castle windows the silent, prolonged torture of young males in the courtyard below: disembowlings, blindings, branding, the excisions of tongues, scalping. Beyond the small window panes partly obscured with dirt we can observe the silent, sprightly glee, the awful grin, of the torturer who presides over the mayhem. Pasolini's use of this distancing device is a stroke of genius. The effect it produces is unearthly.
The seated Duc peers through the eyepiece of his binoculars, then the lens piece, then again through the eyepiece, so the action is enlarged, diminished, and enlarged again. In just this way, Pasolini is saying, tyrants can always orchestrate their own reactions to the cruelty they inspire.
Then the film ends with an unexpected scene, typical of Pasolini's lavish use of irony. In an upstairs bedroom two handsome young armed guards in street clothes are listening to the radio. One tunes it from the ominous cadences of "Carmina Burana," which has been playing during the torture sequence, to a light-hearted '40's dance tune.
"Can you dance?" he asks the other.
"No."
"Let's try," the first urges.
"A bit."
They rise, put down their guns, clasps hands and waists, and proceed to move in a clumsy, yet stately, dance.
"What's your girlfriend's name?" one asks.
"Margarita," the other replies, with a soft, embarrassed grin.
My feeling is that SALO is a unique phenomenon in the history of film. It cannot be dismissed nor ignored, and those who view it must be willing to live with its images. It forces us to think in new ways about the nature of power and victimhood. Time and again it stresses that victimhood--far from eliciting pity in an oppressor--is the posture that is most likely to goad him to increased cruelty. In its ability to make such extreme material real, SALO is a testament to the franchise of film in today's aesthetic world, as unassailable and nonnegotiable as the hegemony of the Duc himself.
The Italian government pressed obscenity charges against SALO which delayed its release for many months. The film was finally released in 1975, the year of Pasolini's own death by homicide.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Iron Man is a fictional superhero appearing in American comic books published by Marvel Comics. The character was created by writer and editor Stan Lee, developed by scripter Larry Lieber, and designed by artists Don Heck and Jack Kirby. The character made his first appearance in Tales of Suspense #39 (cover dated March 1963).
Stark Industries was founded by Howard Stark in the 1940s and then by his son Tony, after his death. Over the years, through bankruptcy, Tony's "death", Tony's return and hostile takeovers, the company has gone through many name changes including Stark International (later Stane International), Stark Enterprises, Stark/Fujikawa and Stark Solutions.
| English | Mother tongue |
|---|---|
| Spanish | Advanced level |
| Italian | Basic level |


The Perfect Stall
问题描述 :
Farmer John completed his new barn just last week, complete with all the latest milking technology. Unfortunately, due to engineering problems, all the stalls in the new barn are different. For the first week, Farmer John randomly assigned cows to stalls, but it quickly became clear that any given cow was only willing to produce milk in certain stalls. For the last week, Farmer John has been collecting data on which cows are willing to produce milk in which stalls. A stall may be only assigned to one cow, and, of course, a cow may be only assigned to one stall.
Given the preferences of the cows, compute the maximum number of milk-producing assignments of cows to stalls that is possible.
Given the preferences of the cows, compute the maximum number of milk-producing assignments of cows to stalls that is possible.
输入:
The input includes several cases. For each case, the first line contains two integers, N (0 <= N <= 200) and M (0 <= M <= 200). N is the number of cows that Farmer John has and M is the number of stalls in the new barn. Each of the following N lines corresponds to a single cow. The first integer (Si) on the line is the number of stalls that the cow is willing to produce milk in (0 <= Si <= M). The subsequent Si integers on that line are the stalls in which that cow is willing to produce milk. The stall numbers will be integers in the range (1..M), and no stall will be listed twice for a given cow.
输出:
For each case, output a single line with a single integer, the maximum number of milk-producing stall assignments that can be made.
样例输入:
5 5 2 2 5 3 2 3 4 2 1 5 3 1 2 5 1 2
样例输出:
4
解题代码:
/* @author<EMAIL_ADDRESS>import java.io.*; import java.util.*; public class Main { static int m,n; static boolean[] flag; static int[] occ; static int[][] adj; public static void main(String args[]) throws Exception { Scanner cin=new Scanner(System.in); while(cin.hasNext()) { n=cin.nextInt(); m=cin.nextInt(); adj=new int[n+1][m+1]; for(int i=0;i< n;i++) { int a=cin.nextInt(); while(a--!=0) { adj[i+1][cin.nextInt()]=1; } } int count=0; occ=new int[m+1]; for(int i=1;i<=n;i++) { flag=new boolean[m+1]; if(find(i)) { count++; } } System.out.println(count); } } public static boolean find(int i) { for(int j=1;j<=m;j++) { if(!flag[j]&&adj[i][j]==1) { flag[j]=true; if(occ[j]==0||find(occ[j])) { occ[j]=i; return true; } } } return false; } }
(adsbygoogle = window.adsbygoogle || []).push({});
第二个方法挺不错。NewHead代表新的头节点，通过递归找到最后一个节点之后，就把这个节点赋给NewHead，然后一直返回返回，中途这个值是没有变化的，一边返回一边把相应的指针方向颠倒，最后结束时返回新的头节点到主函数。
约瑟夫也用说这么长……很成熟的一个问题了，分治的方法解起来o(n)就可以了，有兴趣可以看看具体数学的第一章，关于约瑟夫问题推导出了一系列的结论，很漂亮
第二块代码if(it != mp.end())应改为if(it != mp.end() && (i+1)!=(it->second +1))；因为第二种解法如果数组有重复元素 就不正确
没有对题目进行一番分析，真是美中不足啊
Often We don’t set up on weblogs, but I would like to condition that this established up really forced me individually to do this! considerably outstanding publish
有些说不通吧，只有1个孩子肯定是男孩了
正确性是关键，冲突是都会有的，主要是那种算法冲突的概率低
较好的写法是 start+(end-start)/2
这配图…..
隐藏最深的bug是(start+end)/2有可能上溢
后面的掩码变量部分乍一看比较难理解，其实就是把32位按照一个整体来看待。
对于第一题，我的直觉告诉我换不换都一样，求指教
给力，赞一个
这是往年的笔试题，非在线，主要考察基础，Java会在面试时问到


--- layout: post title: no title date: '2011-03-29T22:53:22+02:00' tags: [] tumblr_url: http://dotmr.tumblr.com/post/4200271347 ---


You can read the latest crime and crime related news here.
You can see the most wanted criminals here.
You can lodge new complaint/FIR here.
you can see current status of your complaint/FIR.
We provide local alerts related to crime and other things.


| Number of Classes | Line Coverage | Mutation Coverage |
|---|---|---|
| 8 | 99% | 88% |
| Name | Line Coverage | Mutation Coverage |
|---|---|---|
| Block.java | 100% |
100% |
| Direction.java | 100% |
46% |
| LineClearer.java | 100% |
92% |
| Matrix.java | 100% |
90% |
| Piece.java | 100% |
96% |
| RandomTetromino.java | 100% |
100% |
| Tetra.java | 95% |
78% |
| Tetromino.java | 100% |
95% |


1
Alex’s mother sings like an angel
to his baby brother.
2
After her illness, grandma was
as thin as a rake.
3
The twin sisters look like
two peas in a pod.
4
The nurse was as gentle as a lamb
while dressing the wound.
5
Rohan swims like a fish for every
competition.
6
The new student in our
class is as timid as a rabbit.
7
That pizza sauce tastes as
sour as vinegar.
8
The children were as happy as a
lark after the birthday celebrations.
9
The poor and hungry beggar
ate like a pig.
10
Due to fever, Tim felt as warm as a toast.


Contents
- STM32F2xx Standard Peripherals Library Drivers
update History
- License
STM32F2xx
Standard Peripherals Library Drivers update History
V1.0.0 / 18-April-2011
Main
Changes
- First official release for STM32F2xx devices
- All drivers
- Update file and function's header comments to add more explanation and fix Doxygen tags formatting
- stm32f2xx_syscfg.h/.c
- stm32f2xx_rtc.h
- RTC_DateTypeDef structure: change RTC_Month and RTC_WeekDay members size to 8bit (instead of 32bit)
V1.0.0RC1 / 18-March-2011
Main
Changes
- Official version (V1.0.0) Release Candidate 1
- All drivers
- Add more comments and information about how to use the driver and the functions API
- Delete registers definition from stm32f2xx_ppp.c and use defines within stm32f2xx.h file
- stm32f2xx_rcc.h/.c
- RCC_PLLConfig() function updated to support only Silicon RevisionB and RevisionY (PLLR parameter removed)
- stm32f2xx_spi.c
- I2S_Init() function updated to support only the I2S clock scheme available in Silicon RevisionB and RevisionY
- stm32f2xx_can.h/.c
- Add 5 new functions
- 3
new functions controlling the counter errors: CAN_GetLastErrorCode(),
CAN_GetReceiveErrorCounter() and CAN_GetLSBTransmitErrorCounter()
- 1 new function to select the CAN operating mode: CAN_OperatingModeRequest()
- 1 new function to support CAN TT mode: CAN_TTComModeCmd()
- CAN_TransmitStatus() function updated to support all CAN transmit intermediate states
- stm32f2xx_adc.h/.c
- stm32f2xx_cryp.h/.c
- CRYP_GetITStatus() function coding updated
- Add 2 functions for CRYP Context swapping:
ErrorStatus CRYP_SaveContext(CRYP_Context* CRYP_ContextSave, CRYP_KeyInitTypeDef* CRYP_KeyInitStruct); void CRYP_RestoreContext(CRYP_Context* CRYP_ContextRestore);
- Name of the possible values of CRYP_DMAReq parameter modified as below:
CRYP_DMAReq_Rx -> CRYP_DMAReq_DataIN CRYP_DMAReq_Tx -> CRYP_DMAReq_DataOUT
- Add three drivers to provide high level functions for AES, DES and TDES:
- stm32f2xx_cryp_aes.c: provides high level functions to encrypt and decrypt an input message using AES in ECB/CBC/CTR modes
- stm32f2xx_cryp_des.c: provides high level functions to encrypt and decrypt an input message using DES in ECB/CBC modes
- stm32f2xx_cryp_tdes.c: provides high level functions to encrypt and decrypt an input message using TDES in ECB/CBC modes
- These drivers uses the stm32f2xx_cryp.c/.h driver to access the STM32F2xx CRYP peripheral
- stm32f2xx_hash.h/.c
- Add two drivers to provide high level functions for SHA1 and MD5:
- stm32f2xx_hash_sha1.c: provides high level functions to compute the HASH SHA1 and HMAC SHA1 Digest of an input message
- stm32f2xx_hash_md5.c: provides high level functions to compute the HASH MD5 and HMAC MD5 Digest of an input message
- These drivers uses the stm32f2xx_hash.c/.h driver to access the STM32F2xx HASH peripheral
- stm32f2xx_rng.h/.c
- stm32f2xx_gpio.h
- Change the name of the parameter GPIO_Mode_AIN by GPIO_Mode_AN
- stm32f2xx_rtc.h/.c
- stm32f2xx_flash.h/.c
- stm32f2xx_i2c.h/.c
- Add 1 new function:
- I2C_NACKPositionConfig():
This function configures the same bit (POS) as I2C_PECPositionConfig()
but is intended to be used in I2C mode while I2C_PECPositionConfig() is
intended to used in SMBUS mode.
- stm32f2xx_tim.h
- Change the TIM_DMABurstLength_xBytes definitions to TIM_DMABurstLength_xTansfers
License
The enclosed firmware and all the related documentation are
not covered by a License Agreement, if you need such License you can
contact your local STMicroelectronics office.
THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING
CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR
THEM TO SAVE TIME.
For
complete documentation on STM32(CORTEX M3) 32-Bit
Microcontrollers visit www.st.com/STM32
|


Dell built a color calibrator into its new monitor
Creators can get crisp, accurate colors across a variety of color standards.
by Rachel EnglandDell's newest monitor has been designed with creators in mind. The UP2720Q is the world's first 27-inch 4K monitor with a built-in colorimeter -- a light-sensitive device that measures the intensity and concentration of color. It offers 100 percent Adobe RBG, 98 percent DCI-P3 and 80 percent BT2020, allowing designers to maximize a larger color gamut and more accurately work with images on devices such as smartphones, computers and TVs, where the DCI-P3 standard is increasingly being used.
The monitor also comes with Thunderbolt 3 with speed up to 40Gbps, which can charge up to 90W to a connected notebook while simultaneously transferring video and data signals. It also has a handy Picture-by-Picture feature that allows users to compare visual content side by side in contrasting color spaces or from different sources. It'll be available from January 15th, priced at $2,000.


Cakes Flowers Combos
From www.lakeofcakes.com Corporate Services department we are here to help your company strengthen all of your important relationships with our fabulous range of quality cakes, flowers & combos gifting. Our highly trained staff will help you to choose the perfect gifting whether you are celebrating Work Anniversaries, Birthday’s, Rewarding your employees for their hard work and dedication, or saying "Thank-You" to your regular/new clients.


{{> header.html}}
Hi, {{account.title}}
You have a new follower on CannaSOS!
{{senderAccount.title}}
{{senderAddress}}
Contribution: {{senderAccount.totalContributionPoints}}
{{relations.length}} Mutual Friends {{senderAccount.followersCount}} Followers {{senderAccount.followingCount}} Following
{{senderInterests}}
Build your audience to get better content in your feed
Thank you, CannaSOS Team


2019 Skoda Karoq 110TSI long-term review: Cabin comfort and practicality
Despite its relatively compact dimensions the Karoq offers a stack of room for anything you might want to throw at it.
by James Wong$35,290 Mrlp
- Fuel Economy
5.8L - Engine Power
110kW - CO2 Emissions
133g - ANCAP Rating
5Stars
Looking for a deal on this car?
- shares
People buy SUVs because they're more practical, right? Well, that's not always the case – so we're taking a closer look at the comfort and practicality of our 2019 Skoda Karoq 110TSI long-termer.
The Czech brand's mantra is 'Simply Clever', and likes to add thoughtful touches throughout its models to make things that little bit easier.
For example, there's an umbrella in the boot, along with a removable LED torch that clips in as the luggage area light source. There's a small rubbish bin that clips into the door bin, and a clip on the windscreen so you can clearly display your parking ticket.
The Karoq also gets a very clever rear-seat system called VarioFlex. It allows you to fold, tumble and even remove each seat individually in the second row.
It enables the Karoq to open up the rear luggage area to a whopping 1810L with the back seats removed – for reference, the dimensionally larger seven-seat Volkswagen Tiguan Allspace claims a maximum load capacity of 1775L with the second and third rows folded.
LINK: Here's a video showing the seats in motion
With the second row in place in its rearmost position, the Karoq offers a decent 479L of boot space. Slide the outer seats forward and that expands to 588L.
Fold the rear seats down, and the Karoq offers a van-like 1605L up to the roof, with the space itself nice and square, while the low rear bumper means there's not a huge lip to lift things over.
Moving things around is quite easy, too, thanks to the ergonomic handles and straps used to slide and fold the seats (also demonstrated in the clip above). There are also hooks and nets about so you can keep loose items secure.
If you haven't guessed already, there's a ton of space on offer, which is great if you need to move furniture, or even as simple as lugging around your kids' pram and all their stuff without fuss.
Our tester is also fitted with the optional electric tailgate with gesture control, which can be operated by a switch in the front of the cabin, via the key fob, or by waving your foot under the rear bumper. The luggage cover also attaches to the rear door, so you don't have to move it out of the way yourself – another Simply Clever touch.
Beyond its load-lugging capabilities, the Karoq actually stacks up reasonably well for a young family of four. There's good room in the rear for kids and average-sized teenagers, and there are ISOFIX child seat mounts on the outboard rear seats, along with top-tether mounts behind all three pews in the second row.
Head room is pretty good for taller passengers, though leg and knee room can get a little tight behind a taller driver (like six-foot-one-ish me).
Rear amenities are pretty good, though, with a fold-down centre armrest, rear air vents, big door bins, map pockets behind the front seats, individual reclining rear seats, and outboard pews that slide fore and aft.
Comfort up front is better again, with supple, supportive seats (trimmed in leather on our tester as part of the various option packages fitted) that offer good amounts of adjustment all round. The driver's seat is electrically adjustable in our tester, including lumbar support, and offers memory settings for three drivers.
All the controls fall easily to hand, and the various screens, buttons and dials are logically laid out – though the climate controls are a little low-set, so you may need to take your eyes off the road to engage the air-recirculation function, for example.
The overall perception of quality is generally pretty good, being on par with the related Volkswagen Tiguan, and more so in some areas.
Skoda has been fairly liberal with the use of soft-touch materials across the dashboard, adorning the top and belt-level sections, along with the two bits of trim that line each side of the centre console where your leg comes to rest.
On the doors, the top layer is again the yielding, squishy type of plastic, though the door insert and grab handle are of the hard, scratchy variety. So far we haven't notice any flexing or squeaking from the door handle like I've noticed on a previous test car, which is a good sign.
The perforated flat-bottom sports steering wheel is a nice touch (again, part of the option packages), and ahead of the driver in this tester is the optional 10.25-inch Virtual Cockpit digital instrument cluster.
Compared to the unit used in Volkswagen models, the Skoda's display offers a greater range of personalisation, to the point where you can change the colour theme to match the ambient lighting.
It's a high-resolution and crisp display with quick and smooth refresh rates so it feels really high end, pretty much at Audi levels – though the Virtual Cockpit offered in the luxury brand's latest models is compatible with Google Earth maps and some other extended functions.
Plenty of storage is available up front, too, including large door bins, a tray to store your smartphone that doubles up as a wireless charger (the latter as part of an option pack), a cubby under the centre armrest that includes an insert that is a tray on one side or a storage console with cupholders on the other, along with a sunglasses holder on the headliner.
One highlight worth noting is that there's enough room for larger smartphones to sit in the charging tray, even when wired in via USB for Apple CarPlay (often overlooked by manufacturers). Also, the sunglasses holder is deleted when the panoramic sunroof is optioned (not fitted to our tester).
To sum up, the Karoq offers surprising levels of comfort and space despite its relatively compact dimensions, and really stays true to Skoda's reputation for maximising the practicality of its products.
Stay tuned for our next long-term update, where we'll have a look at the Karoq's infotainment and technology suite.
2019 Skoda Karoq 110TSI
- Odometer: 1904km
- Distance travelled since last update: 1867.6km
- Fuel consumption (indicated): 7.9L/100km
MORE: Long-term report one: Introduction
MORE: Karoq news, reviews, comparisons and videos
MORE: Everything Skoda
Looking for a deal on this car?
1
15
nextprevious
2019 Skoda Karoq 110TSI long-term review: Cabin comfort and practicality


{{site.user_description}}
I explore social and technological systems to unpick how they work.
I love: data, insight, and a clear process map.
I translate insight into compelling, inspiring stories for any audience.
I love: writing, speaking, and effective slideware.
I build collaborative communities to build and deliver a shared vision.
I love: inclusive teams and holistic decisions.


From Arno to Colorado
Functest: Many rivers to cross
Functest contributors
OPNFV Design Summit, 20/6/2016, Berlin
“Bad programmers have all the answers. Good testers have all the questions. Gil Zilberfeld - ”
# Agenda
* Functest
* Arno
* Brahmaputra
* Colorado
* D, E, F rivers and beyond
# The dream team
![team](../../../img/teamSummitBerlin.png)
## Our goals
### make sure OPNFV works......
## so concretely...
* Validate scenarios for the release
* Give confidence on OPNFV fresh releases
* Ensure consistancy towards installers
* Ensure End to End interoperability
## and also
* Provide functional test suites to be replayed
* ~ post install sanity check
* usable for plugfests
* coherent with ETSI and Telco needs
* Provide test tools
* run tests
* collect info
* create dashboard
## Our goals are not....
* Performance testing (yardstick, Xperf )
* Re-do tests done in specific projects
* storage/storeperf
* infra audit/qtip
* Compare results
## Our rules
* Re-use as much as possible upstream suites (Rally, Tempest, Robot, testOn..)
* Keep it simple...
* Automate (if not it is not a test...)
* Create new suites only if tests not covered
* Consider fields not addressed by existing test projects
## Our rules
* Installer neutral
* Controller neutral
* Black box approach
## Proof of concept
* 4 Testcases: vPing (userdata), Tempest, Rally, ODL
* 1 scenario: os-odl_l2-nofeature-ha
* 2 installers: Foreman/Fuel
* Lots of manual operations (reporting, documentation)
## More everything....
* 7 Testcases: vPing (ssh), ONOS, vIMS, Tempest and Rally extended
* 3 feature projects: doctor, promise, sdnvpn
* 13 Scenarios
* 4 Installers (Apex, Compass, Fuel, Joid)
* Test result collection
* Automatic dashboard
Jiras
Brahmaputra Scenario matrix
Comparison odl_l2-nofeature-ha scenario
| Project |
Apex |
Compass |
Fuel |
Joid |
| POD |
LF POD1 |
Huawei US |
Ericsson POD2 |
Orange POD2 |
| Functest |
2h50 |
1h45 |
2h35 |
2h30 |
| Yardstick |
1h05 |
1h00 |
1h00 |
0h55 |
* difference of duration due to POD and test suites
## Lessons learned
* Tempest/Rally
* harmonizing installer related OpenStack configuration differences
* creating customized test lists
* main challenge was resolving SDN controller interworking problems
* vIMS
* complete but complex test case
* very interesting to automate (pre MANO, most of Telco needs met there)
## What's new?
* New internal test cases: healthcheck, security
* New controler: OpenContrail?
* New feature projects (domino, multisites, movie, parser, moon, copper, models, onos-sfc...)
* ARM Support (congratulations to ENEA team!)
* Simplified feature project integration journey
## What's new?
* Slicing of the tests (healthcheck / Smoke / SDN controllers / Features / Components / VNFs)
* Better Test duration management
* Refactoring (repo, case management, TestAPI)
* Automatic reporting
* Dashboard evolution to ELK
* CLI
# Many rivers to cross
## Functest beyond Colorado
## More test cases
* New VNFs (vEPC, vCDN, vWhatever...)
* Multi sites (e.g bgpvpn with different back ends)
* Better test coverage
## A Functional testing As a Service framework
* Scenario owner can select their relevant test cases
* Test duration estimation
* Agile dashboarding
* Analytics
## Upstream
* Rally: time to give back more
* Functest description for ETSI?
Thank you


This page demonstrates creation of a view on some database tables
The details of the products purchased by a customer is distributed between two tables 'order_master' and 'order_details'. In order to generate a customer bill, both the tables need to be queried for the relevant information.
Create a view that contains the entire purchase order information for the customers. This view enables quick generation of the customer bill. This view also addresses the security concern by not selecting the 'payment_mode' column of the order_master table
The corresponding view is created


Our coconuts are picked up from farms in and around Pollachi in India. The coconuts after plucking are segregated and properly graded, cleaned and packed. We also offer tender coconuts and coconut copra.
The natural tender coconut supplied by us is acquired directly from the coconut groves known for its richness in taste and are perfectly healthy to eat and use. Our coconuts are usually groomed with organic farming and you can buy them at very affordable rates. Naachimaar Exports is widely known as India's leading pure tender coconut suppliers and natural fresh coconut exporters.
As fully husked and semi husked coconut exporters in South India, our natural husked coconuts are available in different ranges. They are widely used for culinary purposes and different medical applications. Our husked coconuts are known for their taste and nutritious content.
Coconut copra is derived from mature coconuts, after the dried and dehydrated fruit is removed from the shell. This copra has a long shelf life and finds application in the food and oil extract industry and confectionary trade. These coconuts are also used for extracting coconut oil of high graded quality.
Nachimaar Exports is a leading exporter of natural coir fibre this is extracted from matured green and brown coconut husks. It is then processed into the finest fibres which go into the making of mattresses, door mats, sacking etc.
coir fibre is of two types-brown and white. Coir obtained from fresh green coconut is termed as white fibre, which is finer than the Brown fibre. The brown fibre is the outcome of seasoned fully matured coconuts which lose their green colour in the process. Each of them has their own distinct types of applications. The brown fibre is widely used for fabrication of doormats, brushes, coir mattress and other upholstery material. Whereas the white fibre is used for making ropes, making fishing nets and other eco-friendly products.
We are one of the highly acclaimed coir rope suppliers based out of Karur and Coimbatore districts of Tamil Nadu, India. Our coconut fibre product is eco-friendly, durable and cost effective. We are reckoned as a prime natural coir rope exporter in India.
Usage - Used to produce rubberised coir sheets for mattresses. Also used to produce upholstery padding such as car seats for automobiles.
Application Automobile Upholstery, Mattresses, Erosion Control, Shipping and Fishing Industries.
Nachimaar Exports is the leading coir pith suppliers in India. We are the suppliers of coco peat, coir pith and coco peat bricks and blocks.  The product finds application in farming due to its water absorbent property, and excellent soil conditioning.
The coco peat is dried and processed to produce different items - blocks, briquettes, tablets, etc (which is an excellent growing medium for hydroponics or container plant growing). As the leading coir peat suppliers we ensure that you get the best of products with our quality services.
Usage - Growing medium and soil potting for commercial farming
Application - Hydroponics, Agriculture, Horticulture, Floriculture, Green Houses, Erosion Control and Golf Courses
Usage - Growing medium and soil potting for commercial farming
Application - Hydroponics, Agriculture, Horticulture, Floriculture, Green Houses, Erosion Control and Golf Courses
Usage - Growing medium and soil potting for commercial purposes


---
sort_order: 115
tei_id: rdx_b5j2m.p.idm199692736
annotation_count: 0
images:
small-thumbnail: http://readux.library.emory.edu/books/emory:b5j2m/pages/emory:p7780/mini-thumbnail/
json: http://readux.library.emory.edu/books/emory:b5j2m/pages/emory:p7780/info/
full: http://readux.library.emory.edu/books/emory:b5j2m/pages/emory:p7780/fs/
page: http://readux.library.emory.edu/books/emory:b5j2m/pages/emory:p7780/single-page/
thumbnail: http://readux.library.emory.edu/books/emory:b5j2m/pages/emory:p7780/thumbnail/
title: Page 115
number: 115
---
{% raw %}CHAPTER XVII.{% endraw %}
{% raw %}SECOND JOUENEY ON TFLE UNDEEGEOUND{% endraw %}
{% raw %}EAILEOAD.{% endraw %}
{% raw %}A. SHOWER OF STARS.—KENTUCKIANS.—A STRATAGEM.—A PROVI¬{% endraw %}
{% raw %}DENCE.--CONDUCTED ACROSS THE MIAMI RIVER BY A COW.--{% endraw %}
{% raw %}ARRIVAL AT CINCINNATI.—ONE OF THE PARTY TAKEN ILL.—WE{% endraw %}
{% raw %}LEAVE HEM TO DIE.—MEET A "FRIEND."—A POOR WHITE MAN.{% endraw %}
{% raw %}—A STRANGE IMPRESSION.—ONCE MORE IN CANADA.{% endraw %}
{% raw %}I remained at home, working on my farm, until{% endraw %}
{% raw %}the next autumn, about the time I had pro¬{% endraw %}
{% raw %}mised to assist in the restoring to liberty the friends{% endraw %}
{% raw %}of James Lightfoot, the individual who had excited{% endraw %}
{% raw %}mv sympathy at the meeting at Fort Erie. In pur¬{% endraw %}
{% raw %}suance of this promise, I again started on my long{% endraw %}
{% raw %}journey into Kentucky.{% endraw %}
{% raw %}On my way, that strange occurrence happened,{% endraw %}
{% raw %}called the great meteoric shower. The heavens{% endraw %}
{% raw %}seemed broken up into streaks of light and falling{% endraw %}
{% raw %}stars. I reached Lancaster, Ohio, at three o'clock{% endraw %}
{% raw %}in the morning, found the village aroused, the bells{% endraw %}
{% raw %}Tinging, and the people exclaiming, " The day of{% endraw %}
{% raw %}judgment is come ! " I thought it was probably so;{% endraw %}
{% raw %}but felt that I was in the right business, and walked{% endraw %}
{% raw %}on through the village, leaving the terrified people{% endraw %}
{% raw %}behind The stars continued to fall till the light of{% endraw %}
{% raw %}the sun appeared.{% endraw %}
{% raw %}On arriving at Portsmouth, in the State of Ohio,{% endraw %}


Please fill up the following details to get started
General Details
Quotation Details
Confirm Job Order
Project Name
{{confirmJobOrder.job_order_project_name}}
Due Date
{{confirmJobOrder.job_order_due_date | date : 'MMMM d, y'}}
Shipping Address
{{confirmJobOrder.company_address_label}}
{{confirmJobOrder.company_address}}
Contact Person
{{confirmJobOrder.company_address_person_firstname}} {{confirmJobOrder.company_address_person_lastname}}
Contact Number
{{confirmJobOrder.company_address_contact}}
| Product | Dimensions | Qty | Unit Price | Amount |
|---|---|---|---|---|
| ({{item.machine_print}}) {{item.product_media}} | {{item.job_order_item_width}} {{item.unit_words}} x {{item.job_order_item_length}} {{item.unit_words}} | {{item.job_order_item_qty}} | {{item.job_order_item_price | currency}} | {{item.total_price | currency}} |
Subtotal
Total
{{subTotal | currency}}
{{gross | currency}}
Job order created!
J.O Number
{{job_order_number}}
This job order has been successfully created.
Terms and Conditions
Privacy Policy
Save as draft successfully!
All changes has been saved.
loading...


WebLink
public struct WebLink : BoxModel
Undocumented
-
Undocumented
Declaration
Swift
public let type: ItemType
-
Undocumented
Declaration
Swift
public let id: String
-
Undocumented
Declaration
Swift
public let sequenceId: String?
-
Undocumented
Declaration
Swift
public let etag: String?
-
Undocumented
Declaration
Swift
public let name: String?
-
Undocumented
Declaration
Swift
public let url: URL?
-
Undocumented
Declaration
Swift
public let createdBy: User?
-
Undocumented
Declaration
Swift
public let createdAt: Date?
-
Undocumented
Declaration
Swift
public let modifiedAt: Date?
-
Undocumented
Declaration
Swift
public let parent: Folder?
-
Undocumented
Declaration
Swift
public let description: String?
-
Undocumented
Declaration
Swift
public let itemStatus: ItemStatus?
-
Undocumented
Declaration
Swift
public let trashedAt: Date?
-
Undocumented
Declaration
Swift
public let purgedAt: Date?
-
Undocumented
Declaration
Swift
public let sharedLink: SharedLink?
-
Undocumented
Declaration
Swift
public let pathCollection: PathCollection?
-
Undocumented
Declaration
Swift
public let modifiedBy: User?
-
Undocumented
Declaration
Swift
public let ownedBy: User?
-
Undocumented
Declaration
Swift
public var client: BoxClient?


Lets create a simple RPG!
First we need to break down some basic aspects of an RPG so that we figure out what we're going to do and how we're going to do them.
So lets look at each part in more detail about how we should approach each part.
There are many different ways to represent a game world, the number of dimensions (from 1 upwards) need not be a limiting factor. Neither how they're represented, either in chunks like a grid, hexes or voxels (3d pixels).
With so much to choose from we're going to stick with the reliable and much simplier to work with 2d square tiles world. And while this isn't necessarily tied to the game world, we're also going to be making the game turn based.
Different games deal with characters in different ways, and for different reasons. Many games take a different approach for the player and for NPCs and enemies.
Take Diablo for example, the player has a set of stats, an inventory and equippable body parts. However the enemies have their own stats, no inventory and no equippable slots. Their stats are essentially pre-defined and not reflective of whatever items they might be appearing to hold. This gives the game developers a lot of control over how much of a threat they are, however it does create a disconnect because the stats of the enemies aren't controlled by what they're wearing in their graphics.
This is in contrast to how Fallout or The Elder Scrolls typically work. All the characters in that world do have equippable slots, inventories and generally speaking their stats are determined by their equipment which you can see them holding. I would assume there's some additional fudging of enemy stats to make them more or less of a danger to the player but for the most part an enemy is setup basically like a player. The same is true for NPCs.
I tend to lean more towards the Elder Scrolls and Fallout way of doing things. Where the only real difference between the player and other NPCs is the code that controls the player object and what the game camera is following. This also has some advantages where anything that you allow the character to do, NPCs can do as well, and vice versa.
Skills and stats are a big part of any RPG since they're abstractions of what an item or character in a game world can do. This means that the amount of work you want to put into your skills and stats is pretty open ended.
For the sake of simplicty we're going with a system that doesn't involve any skills other than the ability to move and attack, and stats are minimal as well.
Another big part of an RPG is progression in some form. For the sake of simplicty we're going with a more Diablo like system where items make up the majority of your progression but without any skills.
In short, no story here, because one isn't needed for an example. However that wouldn't fly for making a real game for the most part.
Another thing that in todays world is becoming more open ended with motion controls, VR, AR, touch screens. Our game is going to be pretty simple being a top down 2d turn based game, but along with this simplicity means that we could in theory use just about any input scheme.
We're going to keep things simple go with keyboard controls for moving and mouse controls for dealing with items.
Another important part of any game, that we're going to skip over for the most part. But we could come back to it at a later date since handling playing back music and short sound clips is quite easy with modern HTML and Javascript.


import pandas as pd
#Loading of the labeled data
BLE_RSSI = pd.read_csv('iBeacon_RSSI_Labeled.csv') #Labeled dataset
#Loading of the Unlabeled data
BLE_RSSI_UL = pd.read_csv('iBeacon_RSSI_Unlabeled.csv')#Unlabeled dataset
#Visulisation of first five data entries/rows in labled dataset
BLE_RSSI.head(6)
#Visulisation of first five data entries/rows in Unlabled dataset
BLE_RSSI_UL.head()
#Information about the data variables in labled dataset
BLE_RSSI.info()
#Information about the data variables in Unlabled dataset
BLE_RSSI_UL.info()
#description of labled data including count, mean, std,min,max,median, 1st and 2nd quartiles.
BLE_RSSI.describe()
#description of Unlabled data including count, mean, std,min,max,median, 1st and 2nd quartiles.
BLE_RSSI_UL.describe()
locations = BLE_RSSI['location'][:] #The output variable, location, isolated from labled dataframe
dates = BLE_RSSI['date'][:]##The object type input variable, date, isolated from labled dataframe
features = BLE_RSSI.drop(['date','location'], axis = 1)#64int iBeacon RSSI valued variables for data processing
%matplotlib inline
import matplotlib.pyplot as plt
features.hist(figsize=(20,15))# Plotting all the beacons values
#x axis = RSSI value
#y axis = number of data points at a perticular RSSI value
plt.savefig('Leabeled_beacons_HIstograms.png')
plt.show()
#A quick look at the output variable, location, categories
locations.head(10)
locations.hist(figsize=(50,50))# Plotting all the beacons values
#x axis = Location
#y axis = number of data points at a perticular location
plt.savefig('Leabeled_location_histogram.png')
plt.show()
from sklearn.preprocessing import OneHotEncoder
#Number the categories from 0 to 104
locations_encoded, locations_categories = pd.factorize(locations)
#One hot encoding
encoder = OneHotEncoder()
locations_1hot = encoder.fit_transform(locations_encoded.reshape(-1,1))
locations_categories
#The following histogram shows the number of points at each category in location variable
plt.hist(locations_encoded)
locations_1hot.toarray()
#Correlation among the features
features.corr()
from pandas.plotting import scatter_matrix
#Scatter plot matrix to observe the similarities and diffeences between features visually
scatter_matrix(features, figsize=(12, 8))
plt.savefig('scatter_matrix.png')
plt.show()
from sklearn.model_selection import train_test_split
X = features
y = locations
#Deviding data into train, validate and test
#X_train1, X_test, y_train1, y_test indicates only train and test data groups
X_train1, X_test, y_train1, y_test = train_test_split(X, y, test_size = 0.18, random_state =1017)
#X_test, y_test,X_train, X_val, y_train,y_val indicates train, validation and test dat groups
X_train, X_val, y_train,y_val = train_test_split(X_train1, y_train1, test_size=0.18, random_state=6296)
y_train1.hist(figsize=(50,50))# Plotting all the beacons values
#x axis = Location
#y axis = number of data pointsat a perticular location
plt.savefig('Leabeled_location_histogram_trainset.png')
plt.show()
y_test.hist(figsize=(50,50))# Plotting all the beacons values
#x axis = Location
#y axis = number of data pointsat a perticular location
plt.savefig('Leabeled_location_histogram_testset.png')
plt.show()
#The lengths of test, validation and test datasets
print('Length of X_train1, y_train1:',len(X_train1))
print('Length of X_train, y_train :',len(X_train))
print('Length of X_val, y_val :',len(X_val))
print('Length of X_test,y_test :',len(X_test))
#Logistic Regression Model using default settings
from sklearn.linear_model import LogisticRegression
model_lr = LogisticRegression()
model_lr.fit(X_train, y_train)
from sklearn.model_selection import cross_val_predict
from sklearn.model_selection import cross_val_score
from sklearn.metrics import accuracy_score
from sklearn.metrics import classification_report
#Performance analysis of default Logistic Regression Model
print('Logistic regression model score (Default): ',model_lr.score(X_test, y_test))
print(classification_report(y_test, model_lr.predict(X_test), digits=3))
import numpy as np
#The following for loop finds the best value of C
score = [];
for x in range (1 , 20):
model_lr.set_params(C =x)
model_lr.fit(X_train, y_train)
score.append(model_lr.score(X_val, y_val))
x = np.arange(1,20,1);
y1 = score
plt.plot(x, y1)
plt.xlabel('C')
plt.ylabel('Score')
#Visulization of the coefficints of the model
model_lr = LogisticRegression(multi_class='ovr', C = 5,penalty='l2')
model_lr.fit(X_train, y_train)
model_lr.coef_
#Logistic regression model using K-fold CV
import warnings
warnings.filterwarnings("ignore")
from sklearn.model_selection import cross_val_score
score = []
ary = []
for x in range (2 , 27):
ary = cross_val_score(model_lr, X_train1, y_train1, cv=x)
score.append(max(ary[:]))
x = np.arange(2,27,1);
y_1 = score
plt.plot(x,y_1)
plt.xlabel('K-fold')
plt.ylabel('Score')
#from the graph above, CV = 26 seems a good fit
cross_val_score(model_lr, X_train1, y_train1, cv=26)
#Performance analysis of Logistic regression using K-fold cross validation
predicted = cross_val_predict(model_lr, X_test, y_test)
print('Logistic regression model score (k-fold cross validation): ',accuracy_score(y_test, predicted))
print(classification_report(y_test, predicted, digits=3))
#Fine-tuning of the logistic regression model using grid search CV
from sklearn.model_selection import GridSearchCV
# Tuning parameters: Penalty & the inverse of regularization strength (C)
parameters = {'penalty':('l1', 'l2'), 'C':[5,6,7,8,9,10]}
model_lr2 = LogisticRegression()
grid_search_lr = GridSearchCV(model_lr2, parameters,cv=5)
grid_search_lr.fit(X_train1,y_train1)
grid_search_lr.best_params_ #shows the best params
#Performance analysis Logistic Regression using GridSearchCV
print('Logistic regression model score (GridSearchCV): ',grid_search_lr.score(X_test, y_test))
print(classification_report(y_test, grid_search_lr.predict(X_test), digits=3))
#Feature selection and fine tuning using PCA, selectKbest and grid search.
#Pipelining: chaining a PCA , a selectKbest and a logistic regression
#This code block took 26.5min to finish!
from sklearn.model_selection import KFold
from sklearn.pipeline import Pipeline
from sklearn.pipeline import FeatureUnion
from sklearn.decomposition import PCA
from sklearn.feature_selection import SelectKBest
#PCA
#The following statement is same for all three model:
#Logistic Rregression, Decision Tree, Ramdom Forest
pca = PCA(n_components=5)
#SelectKbest
#The following statement is same for all three model:
#Logistic Rregression, Decision Tree, Ramdom Forest
selection = SelectKBest(k=5)
#Combination of PCA and SelectKbest features
#The following statement is same for all three model:
#Logistic Rregression, Decision Tree, Ramdom Forest
combined_features = FeatureUnion([("pca", pca), ("univ_select", selection)])
#Logistic reression classifier
lr3 = LogisticRegression()
#pipelining
pipeline = Pipeline([("features", combined_features), ("lr3", lr3)])
#The total parameters of PCA, selectKbest and logistic regression
#Tunig parameters
#PCA: n_components
#SelectKbest: select_k
#Logistic regression: C & penalty
param_grid = dict(features__pca__n_components= [5,10],
features__univ_select__k=[5,10],
lr3__C=[5,7],lr3__penalty=['l1','l2'])
grid_search = GridSearchCV(pipeline, param_grid=param_grid, cv = 3)
grid_search.fit(X_train1, y_train1)# Fitting the training data
print(grid_search.best_params_)# Best logistic regression params
print(grid_search.best_estimator_)#Best parameters f logistic regression
#Performance analysis of Logistic Regression using PCA, SlectKbest and GridSearchCV
prediction = grid_search.predict(X_test)
print('Logistic regression model score (Pipeline): ',accuracy_score(y_test, prediction))
print(classification_report(y_test, prediction, digits=3))
#Decision Tree default model
from sklearn.tree import DecisionTreeClassifier
model_dt = DecisionTreeClassifier()
model_dt.fit(X_train, y_train)
#Performance analysis of default Decision tree model
print('Decision tree model score (Default): ', model_dt.score(X_test, y_test))
print(classification_report(y_test, model_dt.predict(X_test), digits=3))
#Decision tree model using K-fold CV
score = []
ary = []
for x in range (2 , 27):
ary = cross_val_score(model_dt, X_train1, y_train1, cv=x)
score.append(max(ary[:]))
x = np.arange(2,27,1);
y_1 = score
plt.plot(x,y_1)
plt.xlabel('K-fold')
plt.ylabel('Score')
#K-Fold Cross Validation of Decision tree model
kfold = KFold(n_splits=24, random_state=7)
score_arr = cross_val_score(model_dt, X, y, cv=kfold)
#Performance Analysis of K-Fold Cross Validation of Decision tree model
print('Decision tree model mean score (K-fold cross validation): ',score_arr.mean())
predicted = cross_val_predict(model_dt, X_test, y_test)
print(classification_report(y_test, predicted, digits=3))
#Feature selection and fine tuning using PCA, selectKbest and grid search.
#Pipelining: chaining a PCA , a selectKbest and a decision tree
#This code block took 24.1sec to finish!
#Tuning parameters: criterion & max_depth
parameters = {'criterion':('gini', 'entropy'), 'max_depth':np.arange(1,50)}
dTree = GridSearchCV(DecisionTreeClassifier(), parameters, cv =24)
dTree.fit(X_train1,y_train1)
dTree.best_params_#Best params
#Performance analysis Decision Tree using GridSearchCV
print('Decision tree model score (GridSearchCV): ',dTree.score(X_test,y_test))
print(classification_report(y_test, dTree.predict(X_test), digits=3))
#Feature selection and fine tuning using PCA, selectKbest and grid search.
#Pipelining: chaining a PCA , a selectKbest and a decision tree
#This code block took 4.5min to finish!
#Decision tree
tree =DecisionTreeClassifier();
#pipelinig
pipeline = Pipeline([("features", combined_features), ("tree", tree)])
#Tunig parameters
#PCA: n_components
#SelectKbest: select_k
#Decision Tree: criterion & max_depth
param_grid = dict(features__pca__n_components= [1,5,8,12],
features__univ_select__k=[1,5,8,12],
tree__criterion=['gini', 'entropy'], tree__max_depth=np.arange(1,30))
tree_search = GridSearchCV(pipeline, param_grid=param_grid, cv = 5)
tree_search.fit(X_train1, y_train1)
print(tree_search.best_params_)
#Performance analysis of Decision tree using PCA, SelectKbest and GridSearchCV
prediction = tree_search.predict(X_test)
print('Decision tree model score (Pipeline): ', tree_search.score(X_test,y_test))
print(classification_report(y_test, prediction, digits=3))
#Default model of Random Forest
from sklearn.ensemble import RandomForestClassifier
model_rf = RandomForestClassifier()
model_rf.fit(X_train, y_train)
#Performance analysis of default random forest model
print('Random Forest model score (Default):',model_rf.score(X_test, y_test))
print(classification_report(y_test, model_rf.predict(X_test), digits=3))
#Random forest model using K-fold CV
score = []
ary = []
for x in range (2 , 27):
ary = cross_val_score(model_rf, X_train1, y_train1, cv=x)
score.append(max(ary[:]))
x = np.arange(2,27,1);
y_1 = score
plt.plot(x,y_1)
plt.xlabel('K-fold')
plt.ylabel('Score')
#K-Fold Cross Validation of Random Forest model
kfold = KFold(n_splits=22, random_state=7)
score_arr = cross_val_score(model_rf, X, y, cv=kfold)
#Performance Analysis of K-Fold Cross Validation of Decision tree model
print('Random forest model mean score (K-fold cross validation): ',score_arr.mean())
predicted = cross_val_predict(model_rf, X_test, y_test)
print(classification_report(y_test, predicted, digits=3))
#Fine tuning of the logistic regression model using grid search CV
#This code block took 1.8min to finish!
#Tuning parameters: max_features & n_estimators
parameters = {'max_features':['log2', 'auto',5,8,1,3,0.1,0.7], 'n_estimators':[10,15,20,30,40]}
rf = RandomForestClassifier(bootstrap = True,n_jobs = -1)
grid_search_rf = GridSearchCV(rf, parameters,cv=8)
grid_search_rf.fit(X_train1,y_train1)
grid_search_rf.best_params_#The best params
#Performance analysis Random Forest using GridSearchCV
print('Random forest model score (GridSearchCV): ',grid_search_rf.score(X_test,y_test))
print(classification_report(y_test, grid_search_rf.predict(X_test), digits=3))
#Feature selection and fine tuning using PCA, selectKbest and grid search.
#Pipelining: chaining a PCA , a selectKbest and a random forest
#This code block took 13.6min to finish!
#Random Forest Classifier
rftree =RandomForestClassifier(bootstrap = True,n_jobs = -1);
#pipelining
pipeline = Pipeline([("features", combined_features), ("rftree", rftree)])
#Tunig parameters
#PCA: n_components
#SelectKbest: select_k
#Random Forest: max_features & n_estimators
param_grid = dict(features__pca__n_components= [3,5,8,12],
features__univ_select__k=[3,5,8,12],
rftree__max_features=['log2','auto',5,3,0.1], rftree__n_estimators =[20,30,40,50,60] )
rftree_search = GridSearchCV(pipeline, param_grid=param_grid, cv = 5)
rftree_search.fit(X_train1, y_train1)
print(rftree_search.best_params_)
##Performance analysis of Random forest using PCA, SlectKbest and GridSearchCV
print('Random forest model score (Pipeline): ', rftree_search.score(X_test,y_test))
print(classification_report(y_test, rftree_search.predict(X_test), digits=3))
#Voting classifier
#voting classifier collects the best models and
#outputs the result based on the best outcome of the best models
#This code block took approx. 15min to finish!
from sklearn.ensemble import VotingClassifier
estimators = [('rf1',rftree_search),('dt',dTree),('rf2',grid_search_rf)]
voting_clf = VotingClassifier(estimators, voting='soft')
voting_clf.fit(X_train1,y_train1)
#Voting Classifier vs The best models
#This code block took approx. 17min to finish!
#The following commented for loop is the loop version
#of voting classifer vs the best models comparison
#taken from the hands on machine learning book
#for models in (rftree_search, dTree, grid_search_rf, voting_clf):
# models.fit(X_train1,y_train1)
# y_pred = models.predict(X_test)
# print(models.__class__.__name__,accuracy_score(y_test,y_pred))
#Comparison between the best classifiers
#tree_search.fit(X_train1,y_train1)
y_pred = tree_search.predict(X_test)
print('Decision Tree Grid Search CV with PCA:',accuracy_score(y_test,y_pred))
#dTree.fit(X_train1,y_train1)
y_pred = dTree.predict(X_test)
print('Decision Tree Grid Search CV without PCA::',accuracy_score(y_test,y_pred))
#grid_search_rf.fit(X_train1,y_train1)
y_pred = grid_search_rf.predict(X_test)
print('Random Forest Tree Grid Search without PCA:',accuracy_score(y_test,y_pred))
#voting_clf.fit(X_train1,y_train1)
y_pred = voting_clf.predict(X_test)
print('Voting Classifier:',accuracy_score(y_test,y_pred))


{if $Think.session.user.authority == 0 }
{/if}
{if $Think.session.user.authority == 0 || $Think.session.user.authority == 2}
{/if}
{if $Think.session.user.authority == 0 || $Think.session.user.authority == 1}
{/if}