It is fun to share apps you create with others. To make your work available to others, the most simple option is to put your HTML and JavaScript files on a web server and run the app using Evothings Viewer (estimated time 15 minutes).
Evothings Viewer is a bit like a web browser for IoT. You can use it to run apps hosted on a web server. This is useful for testing and for quickly sharing apps for evaluation.
Here is how to run your app in Evothings Viewer:
Upload HTML, CSS, JavaScript and media files (images) to a web server. Note that you don't need to upload any Cordova JavaScript files. The file cordova.js and Cordova plugin files are bundled with Evothings Viewer.
Install and run Evothings Viewer on your mobile device.
Enter the URL to the main HTML file on the web server in the connect field and press the Connect button.
For example, if you have
index.html in the folder "demo", you can enter a url like this (just as with a web page!): http://evothings.com/demo
The protocol defaults to http://
so you can just type: evothings.com/demo
When using https://
you need to specify this explicitly in the URL.
You can also make a menu page with links to all of your apps, and open that page in the Viewer.
The drawback is that the user must be online to run the app.
The positive thing is that it is very quick and easy to share apps with others. Just ask them to install Evothings Viewer and supply a URL to your app or start page.
A potential problem is that Evothings Viewer may not load the most recent files when your app code has been updated on the web server. Testing we have done indicates iOS does not cache apps, but Android does.
The current solution is to include the following meta tags in the head section of index.html, this makes Android not cache the app (works well on iOS too):
<meta http-equiv="pragma" content="no-cache" /> <meta http-equiv="expires" content="-1" />
If you have published apps without the above tags, the users have to clear the web cache on Android to get the new version. Go to Settings/Apps/Evothings and select "Clear data" to clear the cache.
You can also put a Reload button in the app (which can be useful during development):
<button onclick="window.location.reload(true)">Reload</button>
If you have several apps you wish to share, make an index page that acts like a menu or gallery you can use as a launchpad (just put links to your apps on the menu page, as you would for any web page).


Restart
Home
Projects
Oh no, my resume got ripped up! Please help me find all of the pieces.
Good luck!
Well Done!
Keep Looking
Not Here
You can do it!
9 left
Start
Seek


public final class DebugComponentTimeMachine
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DebugComponentTimeMachine.TreeRevision |
static class |
DebugComponentTimeMachine.TreeRevisions |
| Modifier and Type | Method and Description |
|---|---|
static DebugComponentTimeMachine.TreeRevisions |
getTimeline(DebugComponent component)
Finds the timeline corresponding to a component
|
static boolean |
loadTimelineSnapshot(DebugComponent node,
java.lang.String destination)
Applies a StateHandler to a Component node from the cache
|
static boolean |
maybeSkipNextSnapshot(DebugComponent node)
Prevents the next call to saveTimelineSnapshot for this DebugComponent
|
static boolean |
saveTimelineSnapshot(ComponentTree componentTree,
Component root,
TreeState treeState,
TreeProps props,
int source,
java.lang.String attribution)
Caches a StateHandler and Component root alongside metadata for them
|
static void |
skipNextSnapshot(ComponentTree tree)
Prevents the next call to saveTimelineSnapshot for this ComponentTree
|
public static DebugComponentTimeMachine.TreeRevisions getTimeline(DebugComponent component)
component
- the component the timeline is forpublic static boolean saveTimelineSnapshot(ComponentTree componentTree, Component root, TreeState treeState, TreeProps props, int source, java.lang.String attribution)
componentTree
- the ComponentTree we want to save the snapshot forroot
- the component to save the timeline forstateHandler
- the state handler for the context in the rootprops
- the props of the component rootsource
- the cause of the redraw that will be savedattribution
- the context of the cause of the redrawpublic static boolean loadTimelineSnapshot(DebugComponent node, java.lang.String destination)
node
- the component the timeline is fordestination
- the TreeRevision#key at the timeline we'll be traveling topublic static void skipNextSnapshot(ComponentTree tree)
tree
- the component tree the timeline is forpublic static boolean maybeSkipNextSnapshot(DebugComponent node)
node
- the component the timeline is for


Aurelia Table supports client side pagination. It is very easy to enable pagination, there are 3 properties you need to provide:
current-page
: This property specifies the page that is currently active, the index starts at 1.page-size
: This property specifies how many items you want to display on each page.total-items
: This property specifies the total number of items in the table.hide-single-page
property. This property is true
by default and it will hide the Pagination
Component when there is only a single page. And of course you can bind this to false
to disable the behavior.
Of the 3 properties current-page
and page-size
need to be manually managed outside of Aurelia Table.
total-items
will be managed by Aurelia Table based on the data
property and any filters we may have.
As mentioned there are some properties you need to manually manage, but don't worry, we provide a Pagination Component that will allow you to have pagination out of the box
The aut-pagination
component provides a simple pagination control that will allow you to navigate the table pages. For
this component you also need to provide the same 3 properties you used for the Aurelia Table: current-page
,
page-size
and total-items
.
Additionally there are some extra configurations for the pagination:
hide-single-page
: Boolean that determines whether or not we show hide the pagination when there is only one single
page.
This is true
by default.
pagination-size
: You can specify the number of visible page links for the pagination.
By default we will show every single page link. boundary-links
: Boolean that determines whether or not we should two links to navigate to the First and Last page.
This is false
by default.
first-text
: You can specify the text for the First Page link. By default it is 'First'.last-text
: You can specify the text for the Last Page link. By default it is 'Last'.direction-links
: Booleans that determines whether or not we should have direction links to navigate back and forth
between pages. By default this is true
.
previous-text
: You can specify the text for the Previous Page link. By default it is '<'.next-text
: You can specify the text for the Next Page link. By default it is '>'.The Pagination Component requires Bootstrap for its layout. If you don't want to have a dependency in Bootstrap you can provide your own template. Check the Custom Pagination section for details.
| Name | Age | Active | |
|---|---|---|---|
| ${user.name} | ${user.age} | ${user.email} | ${user.isActive} |
<template>

Name
Age
E-mail
Active

${open}user.name}
${open}user.age}
${open}user.email}
${open}user.isActive}

<aut-pagination current-page.bind="currentPage" page-size.bind="pageSize" total-items.bind="totalItems"
pagination-size.bind="5" boundary-links.bind="true"> </aut-pagination>

Page Size:
<select value.bind="pageSize" id="pageSize" class="form-control">
<option model.bind="5">5</option>
<option model.bind="10">10</option>
<option model.bind="20">20</option>
<option model.bind="50">50</option>
</select>

</template>
import {HttpClient} from "aurelia-fetch-client";
export class Example {
users = [];
pageSize = 10;
bind(){
let client = new HttpClient();
return client.fetch('data.json')
.then(response => response.json())
.then(users => this.users = users);
}
}
Don't get scared by the long markup, a big part of it is just Bootstrap layout. Note how the aut-pagination
controller
is binding the same properties we are setting into the aurelia-table
custom attribute. We are also adding a standard
dropdown to control the page size.


Spring 2018 Project- Admit-Ed
May 4, 2018
In spring 2018 we expanded on the Admit-Ed project for Next Generation Scholars. We worked with two key members of the non-profit to determine what their goals for the technology were, and scoped out specific feature adds to help them meet those goals, and delivered a product that they deployed this summer with 50 of their students.
Find the live site and code here!
Features:
Auto-Populated College Profiles
We import updated college profile information from ed.gov to ensure that the data Admit-Ed provides to students is accurate and up-to-date. Via google translate, we are also able to provide this information in Spanish for parents and students.
Scattergrams
Admit-Ed provides functionality on College Profile pages to show scattergrams of students’ admit statuses based on their GPA and test scores. They are able to add this information via a CSV upload. This will allow Next Generation Scholars to provide this sort of graph data specifically for the local students that they serve.
Student Profile
We provided an easy way for students to track their interested colleges/majors, their applications for schools and for scholarships, and the net cost to them of different schools they’ve been accepted to via a student profile.
Student Database
We also ensured counselors who work at Next Generation Scholars are able to view and filter all students in the system based on essay status etc. This allows the counselors to make sure they keep on top of their students and provides more of the college counseling relationship.
View and Search Colleges
Students and counselors can view and search through lists of colleges. Colleges can also be sorted by deadline for admission or financial aid.


Multiway Powersort
This paper describes Multiway Powersort, an extension of our adaptive mergesort variant for merging several runs at once while still adapting nearly optimally to existing runs. Our C++ implementation of 4-way Powersort (GitHub) achieved a 15–20% speedup over the standard 2-way Powersort (see Fig 3–6).
Since September 2021, Powersort is used in CPython and PyPy instead of Timsort’s suboptimal merge policy; see our ESA 2018 paper for details and background. In scenarios where comparisons are rather expensive (in particular when sorting pointers as in implementations of Python or Java), Timsort/Powersort offers a clear advantage for many inputs and comes with no significant detriment to the worst case.
When comparisons are cheap, memory transfers become a major influence, and multiway merging can subsantially reduce these. This effect has been demonstrated repeatedly for Multiway Quicksort. For adaptive Mergesort, a generalization to multiway merging is not obvious, but for Powersort, it can be achieved (§3), resulting in significant speedups.
This work originated in an Masters dissertation project of William Cawley Gelling.
Powersort: Clean explanation and self-contained analysis
The effect of explaining (standard 2-way) Powersort to loads of people was that I found much clearer ways to introduce it compared to the original description. §3 of this paper gives (in my biased opinion) the best introduction to the algorithm (multiway or not).
Moreover, §3.3 gives a completely elementary and self-contained proof of the optimality of Powersort’s merge cost.
Relation to Other Papers
The algorithms of this paper generalize Peeksort and Powersort from the ESA 2018 with Ian Munro.
Intended Audience
This paper is accessible to all computer scientists.


Hashing is the process of mapping data i.e. key to a hash. On a basic level hashing is used to retrieve data quickly mostly in O(1) time. The commercial DB holds lots and lots of data and it will be very inefficient to access that data linearly as an application could be used by thousands of users at a time. So, in this case the hashing used and a hash table is created to hold records and retrieve them with the smallest latency possible. But, The problem with this approach is that a hash table must be stored on a server and as it is stored on a single server it can be a "Single point of failure" and we tried to store it on multiple servers to achieve fault tolerance then the problem of consistency occurs and there is no "Single Point of Truth".
So to tackle this situation the distributed hashing comes into picture.
In the distributed hashing, the hashtable is divided and stored and multiple servers each fragment of hash table may be replicated 2-3 times to achieve greater fault tolerance. So, as there are limited number of records each server holds it can cache it and improve the response time. Only if there is cache miss then the request will be sent to the DB server. How to divide the records among N servers? The simplest strategy used is HASH mod N, So the records are split among N servers and when user request for particular record then it goes through hash function and modulo operation is done to find the server on which record is stored.
Consider the scenario when a server failed or a new server is added and value of N changes. Then we have to rehash all the keys, the cache of all the servers is no longer useful and we have to again store the hash fragments on different servers according to the value of N. This will cause the performance degradation.
Answer to all the above problems is "Consistent Hashing". It is also known as Ring Hashing. As shown in figure the keys are hashed and placed on the ring (We use the angle from 0 to 360 to place) also the servers also hashed according to id or any other parameter and placed on the ring. Now, in consistent hashing according to convention clockwise or anti-clockwise the records are stored in the next immediate server in that direction.
Here distributed hashing is achieved also the drawback of distributed hashing is nullified, How? let's see. If a new server, let's say D, is added it will also be placed on ring right before server C. Now, some of the keys which were previously stored on server C will be stored on the server D and cache of C for only some keys has to be updated. In this way all other nodes remain unaffected. So, the performance degradation will not happen.
Many systems like Memcached, Redis include support for consistent hashing out of the box.


I am a full stack web developer looking for project opportunities. I had sharpened my skills and learned more during this pandemic . I am ready for implementing my skills for betterment of an Organization. Currently I am finding an Internship.
Hiring?
Node.js, Progressive Web Apps, WebSockets, Frontend
PHP, jQuery, Frontend, MySQL
tech lead, node.js, flutter, COVID-19


Chinese Medicine
Welcome,
Admin
General
Home
Search
About
Users
Login
Logout
Change Password
Admin
Profile
50%
Settings
Help
Log Out
John Smith
3 mins ago
Film festivals used to be do-or-die moments for movie makers. They were where...
John Smith
3 mins ago
Film festivals used to be do-or-die moments for movie makers. They were where...
John Smith
3 mins ago
Film festivals used to be do-or-die moments for movie makers. They were where...
John Smith
3 mins ago
Film festivals used to be do-or-die moments for movie makers. They were where...
See All Alerts


@@include('../components/_head.html')
@@include('../components/header.html')
@@include('../components/product-slider.html')
@@include('../components/footer.html')


module Sass::Util
A module containing various useful functions.
Constants
- ATOMIC_WRITE_MUTEX
@private
- BASE64_DIGITS
- BASE64_DIGIT_MAP
- CHARSET_REGEXPS
- ENCODINGS_TO_CHECK
We could automatically add in any non-ASCII-compatible encodings here, but there’s not really a good way to do that without manually checking that each encoding encodes all ASCII characters properly, which takes long enough to affect the startup time of the CLI.
- MultibyteStringScanner
rubocop:disable ConstantName
- RUBY_ENGINE
The Ruby engine we’re running under. Defaults to `“ruby”` if the top-level constant is undefined. @api public
- RUBY_VERSION
An array of ints representing the Ruby version number. @api public
- URI_ESCAPE
This is a hack around the fact that you can’t instantiate a URI parser on 1.8, so we have to have this hacky stuff to work around it. When 1.8 support is dropped, we can remove this method.
@private
- VLQ_BASE
- VLQ_BASE_MASK
- VLQ_BASE_SHIFT
- VLQ_CONTINUATION_BIT
Public Instance Methods
@private
# File lib/sass/util.rb, line 825 def _enc(string, encoding) string.encode(encoding).force_encoding("BINARY") end
A cross-platform implementation of `File.absolute_path`.
@param path [String] @param dir_string [String] The directory to consider [path] relative to. @return [String] The absolute version of `path`.
# File lib/sass/util.rb, line 1152 def absolute_path(path, dir_string = nil) # Ruby 1.8 doesn't support File.absolute_path. return File.absolute_path(path, dir_string) unless ruby1_8? # File.expand_path expands "~", which we don't want. return File.expand_path(path, dir_string) unless path[0] == ?~ File.expand_path(File.join(".", path), dir_string) end
Throws a NotImplementedError for an abstract method.
@param obj [Object] `self` @raise [NotImplementedError]
# File lib/sass/util.rb, line 449 def abstract(obj) raise NotImplementedError.new("#{obj.class} must implement ##{caller_info[2]}") end
Returns whether this environment is using ActionPack of a version greater than or equal to that specified.
@param version [String] The string version number to check against.
Should be greater than or equal to Rails 3, because otherwise ActionPack::VERSION isn't autoloaded
@return [Boolean]
# File lib/sass/util.rb, line 534 def ap_geq?(version) # The ActionPack module is always loaded automatically in Rails >= 3 return false unless defined?(ActionPack) && defined?(ActionPack::VERSION) && defined?(ActionPack::VERSION::STRING) version_geq(ActionPack::VERSION::STRING, version) end
Returns whether this environment is using ActionPack version 3.0.0 or greater.
@return [Boolean]
# File lib/sass/util.rb, line 523 def ap_geq_3? ap_geq?("3.0.0.beta1") end
Returns a sub-array of `minuend` containing only elements that are also in `subtrahend`. Ensures that the return value has the same order as `minuend`, even on Rubinius where that’s not guaranteed by `Array#-`.
@param minuend [Array] @param subtrahend [Array] @return [Array]
# File lib/sass/util.rb, line 334 def array_minus(minuend, subtrahend) return minuend - subtrahend unless rbx? set = Set.new(minuend) - subtrahend minuend.select {|e| set.include?(e)} end
This creates a temp file and yields it for writing. When the write is complete, the file is moved into the desired location. The atomicity of this operation is provided by the filesystem’s rename operation.
@param filename [String] The file to write to. @param perms [Integer] The permissions used for creating this file.
Will be masked by the process umask. Defaults to readable/writeable by all users however the umask usually changes this to only be writable by the process's user.
@yieldparam tmpfile [Tempfile] The temp file that can be written to. @return The value returned by the block.
# File lib/sass/util.rb, line 1195 def atomic_create_and_write_file(filename, perms = 0666) require 'tempfile' tmpfile = Tempfile.new(File.basename(filename), File.dirname(filename)) tmpfile.binmode if tmpfile.respond_to?(:binmode) result = yield tmpfile tmpfile.close ATOMIC_WRITE_MUTEX.synchronize do begin File.chmod(perms & ~File.umask, tmpfile.path) rescue Errno::EPERM # If we don't have permissions to chmod the file, don't let that crash # the compilation. See issue 1215. end File.rename tmpfile.path, filename end result ensure # close and remove the tempfile if it still exists, # presumably due to an error during write tmpfile.close if tmpfile tmpfile.unlink if tmpfile end
Returns an ActionView::Template* class. In pre-3.0 versions of Rails, most of these classes were of the form `ActionView::TemplateFoo`, while afterwards they were of the form `ActionView;:Template::Foo`.
@param name [#to_s] The name of the class to get.
For example, `:Error` will return `ActionView::TemplateError` or `ActionView::Template::Error`.
# File lib/sass/util.rb, line 565 def av_template_class(name) return ActionView.const_get("Template#{name}") if ActionView.const_defined?("Template#{name}") ActionView::Template.const_get(name.to_s) end
Returns information about the caller of the previous method.
@param entry [String] An entry in the `#caller` list, or a similarly formatted string @return [[String, Fixnum, (String, nil)]]
An array containing the filename, line, and method name of the caller. The method name may be nil
# File lib/sass/util.rb, line 397 def caller_info(entry = nil) # JRuby evaluates `caller` incorrectly when it's in an actual default argument. entry ||= caller[1] info = entry.scan(/^(.*?):(-?.*?)(?::.*`(.+)')?$/).first info[1] = info[1].to_i # This is added by Rubinius to designate a block, but we don't care about it. info[2].sub!(/ \{\}\Z/, '') if info[2] info end
Checks that the encoding of a string is valid in Ruby 1.9 and cleans up potential encoding gotchas like the UTF-8 BOM. If it’s not, yields an error string describing the invalid character and the line on which it occurrs.
@param str [String] The string of which to check the encoding @yield [msg] A block in which an encoding error can be raised.
Only yields if there is an encoding error
@yieldparam msg [String] The error message to be raised @return [String] `str`, potentially with encoding gotchas like BOMs removed
# File lib/sass/util.rb, line 751 def check_encoding(str) if ruby1_8? return str.gsub(/\A\xEF\xBB\xBF/, '') # Get rid of the UTF-8 BOM elsif str.valid_encoding? # Get rid of the Unicode BOM if possible if str.encoding.name =~ /^UTF-(8|16|32)(BE|LE)?$/ return str.gsub(Regexp.new("\\A\uFEFF".encode(str.encoding.name)), '') else return str end end encoding = str.encoding newlines = Regexp.new("\r\n|\r|\n".encode(encoding).force_encoding("binary")) str.force_encoding("binary").split(newlines).each_with_index do |line, i| begin line.encode(encoding) rescue Encoding::UndefinedConversionError => e yield <<MSG.rstrip, i + 1 Invalid #{encoding.name} character #{undefined_conversion_error_char(e)} MSG end end str end
Asserts that `value` falls within `range` (inclusive), leaving room for slight floating-point errors.
@param name [String] The name of the value. Used in the error message. @param range [Range] The allowed range of values. @param value [Numeric, Sass::Script::Value::Number] The value to check. @param unit [String] The unit of the value. Used in error reporting. @return [Numeric] `value` adjusted to fall within range, if it
was outside by a floating-point margin.
# File lib/sass/util.rb, line 363 def check_range(name, range, value, unit = '') grace = (-0.00001..0.00001) str = value.to_s value = value.value if value.is_a?(Sass::Script::Value::Number) return value if range.include?(value) return range.first if grace.include?(value - range.first) return range.last if grace.include?(value - range.last) raise ArgumentError.new( "#{name} #{str} must be between #{range.first}#{unit} and #{range.last}#{unit}") end
Like {#check_encoding}, but also checks for a `@charset` declaration at the beginning of the file and uses that encoding if it exists.
The Sass encoding rules are simple. If a `@charset` declaration exists, we assume that that’s the original encoding of the document. Otherwise, we use whatever encoding Ruby has. Then we convert that to UTF-8 to process internally. The UTF-8 end result is what’s returned by this method.
@param str [String] The string of which to check the encoding @yield [msg] A block in which an encoding error can be raised.
Only yields if there is an encoding error
@yieldparam msg [String] The error message to be raised @return [(String, Encoding)] The original string encoded as UTF-8,
and the source encoding of the string (or `nil` under Ruby 1.8)
@raise [Encoding::UndefinedConversionError] if the source encoding
cannot be converted to UTF-8
@raise [ArgumentError] if the document uses an unknown encoding with `@charset`
# File lib/sass/util.rb, line 796 def check_sass_encoding(str, &block) return check_encoding(str, &block), nil if ruby1_8? # We allow any printable ASCII characters but double quotes in the charset decl bin = str.dup.force_encoding("BINARY") encoding = Sass::Util::ENCODINGS_TO_CHECK.find do |enc| re = Sass::Util::CHARSET_REGEXPS[enc] re && bin =~ re end charset, bom = $1, $2 if charset charset = charset.force_encoding(encoding).encode("UTF-8") if (endianness = encoding[/[BL]E$/]) begin Encoding.find(charset + endianness) charset << endianness rescue ArgumentError # Encoding charset + endianness doesn't exist end end str.force_encoding(charset) elsif bom str.force_encoding(encoding) end str = check_encoding(str, &block) return str.encode("UTF-8"), str.encoding end
Like `Pathname#cleanpath`, but normalizes Windows paths to always use backslash separators. Normally, `Pathname#cleanpath` actually does the reverse – it will convert backslashes to forward slashes, which can break `Pathname#relative_path_from`.
@param path [String, Pathname] @return [Pathname]
# File lib/sass/util.rb, line 646 def cleanpath(path) path = Pathname.new(path) unless path.is_a?(Pathname) pathname(path.cleanpath.to_s) end
Prints a deprecation warning for the caller method.
@param obj [Object] `self` @param message [String] A message describing what to do instead.
# File lib/sass/util.rb, line 457 def deprecated(obj, message = nil) obj_class = obj.is_a?(Class) ? "#{obj}." : "#{obj.class}#" full_message = "DEPRECATION WARNING: #{obj_class}#{caller_info[2]} " + "will be removed in a future version of Sass.#{("\n" + message) if message}" Sass::Util.sass_warn full_message end
Prepare a value for a destructuring assignment (e.g. `a, b = val`). This works around a performance bug when using ActiveSupport, and only needs to be called when `val` is likely to be `nil` reasonably often.
See [this bug report](redmine.ruby-lang.org/issues/4917).
@param val [Object] @return [Object]
# File lib/sass/util.rb, line 660 def destructure(val) val || [] end
Encodes `value` as VLQ (en.wikipedia.org/wiki/VLQ).
@param value [Fixnum] @return [String] The encoded value
# File lib/sass/util.rb, line 1113 def encode_vlq(value) if value < 0 value = ((-value) << 1) | 1 else value <<= 1 end result = '' begin digit = value & VLQ_BASE_MASK value >>= VLQ_BASE_SHIFT if value > 0 digit |= VLQ_CONTINUATION_BIT end result << BASE64_DIGITS[digit] end while value > 0 result end
A version of `Enumerable#enum_cons` that works in Ruby 1.8 and 1.9.
@param enum [Enumerable] The enumerable to get the enumerator for @param n [Fixnum] The size of each cons @return [Enumerator] The consed enumerator
# File lib/sass/util.rb, line 883 def enum_cons(enum, n) ruby1_8? ? enum.enum_cons(n) : enum.each_cons(n) end
A version of `Enumerable#enum_slice` that works in Ruby 1.8 and 1.9.
@param enum [Enumerable] The enumerable to get the enumerator for @param n [Fixnum] The size of each slice @return [Enumerator] The consed enumerator
# File lib/sass/util.rb, line 892 def enum_slice(enum, n) ruby1_8? ? enum.enum_slice(n) : enum.each_slice(n) end
A version of `Enumerable#enum_with_index` that works in Ruby 1.8 and 1.9.
@param enum [Enumerable] The enumerable to get the enumerator for @return [Enumerator] The with-index enumerator
# File lib/sass/util.rb, line 874 def enum_with_index(enum) ruby1_8? ? enum.enum_with_index : enum.each_with_index end
URI-escape `string`.
@param string [String] @return [String]
# File lib/sass/util.rb, line 1143 def escape_uri(string) URI_ESCAPE.escape string end
Destructively removes all elements from an array that match a block, and returns the removed elements.
@param array [Array] The array from which to remove elements. @yield [el] Called for each element. @yieldparam el [*] The element to test. @yieldreturn [Boolean] Whether or not to extract the element. @return [Array] The extracted elements.
# File lib/sass/util.rb, line 904 def extract!(array) out = [] array.reject! do |e| next false unless yield e out << e true end out end
Extracts the non-string vlaues from an array containing both strings and non-strings. These values are replaced with escape sequences. This can be undone using {#inject_values}.
This is useful e.g. when we want to do string manipulation on an interpolated string.
The precise format of the resulting string is not guaranteed. However, it is guaranteed that newlines and whitespace won’t be affected.
@param arr [Array] The array from which values are extracted. @return [(String, Array)] The resulting string, and an array of extracted values.
# File lib/sass/util.rb, line 998 def extract_values(arr) values = [] mapped = arr.map do |e| next e.gsub('{', '{{') if e.is_a?(String) values << e next "{#{values.count - 1}}" end return mapped.join, values end
Flattens the first `n` nested arrays in a cross-version manner.
@param arr [Array] The array to flatten @param n [Fixnum] The number of levels to flatten @return [Array] The flattened array
# File lib/sass/util.rb, line 927 def flatten(arr, n) return arr.flatten(n) unless ruby1_8_6? return arr if n == 0 arr.inject([]) {|res, e| e.is_a?(Array) ? res.concat(flatten(e, n - 1)) : res << e} end
Flattens the first level of nested arrays in `arrs`. Unlike `Array#flatten`, this orders the result by taking the first values from each array in order, then the second, and so on.
@param arrs [Array] The array to flatten. @return [Array] The flattened array.
# File lib/sass/util.rb, line 939 def flatten_vertically(arrs) result = [] arrs = arrs.map {|sub| sub.is_a?(Array) ? sub.dup : Array(sub)} until arrs.empty? arrs.reject! do |arr| result << arr.shift arr.empty? end end result end
Like `Dir.glob`, but works with backslash-separated paths on Windows.
@param path [String]
# File lib/sass/util.rb, line 617 def glob(path) path = path.gsub('\', '/') if windows? if block_given? Dir.glob(path) {|f| yield(f)} else Dir.glob(path) end end
Performs the equivalent of `enum.group_by.to_a`, but with a guaranteed order. Unlike {Util#hash_to_a}, the resulting order isn’t sorted key order; instead, it’s the same order as `#group_by` has under Ruby 1.9 (key appearance order).
@param enum [Enumerable] @return [Array<[Object, Array]>] An array of pairs.
# File lib/sass/util.rb, line 310 def group_by_to_a(enum) return enum.group_by {|e| yield(e)}.to_a unless ruby1_8? order = {} arr = [] groups = enum.group_by do |e| res = yield(e) unless order.include?(res) order[res] = order.size end res end groups.each do |key, vals| arr[order[key]] = [key, vals] end arr end
Checks to see if a class has a given method. For example:
Sass::Util.has?(:public_instance_method, String, :gsub) #=> true
Method collections like `Class#instance_methods` return strings in Ruby 1.8 and symbols in Ruby 1.9 and on, so this handles checking for them in a compatible way.
@param attr [#to_s] The (singular) name of the method-collection method
(e.g. `:instance_methods`, `:private_methods`)
@param klass [Module] The class to check the methods of which to check @param method [String, Symbol] The name of the method do check for @return [Boolean] Whether or not the given collection has the given method
# File lib/sass/util.rb, line 866 def has?(attr, klass, method) klass.send("#{attr}s").include?(ruby1_8? ? method.to_s : method.to_sym) end
Converts a Hash to an Array. This is usually identical to `Hash#to_a`, with the following exceptions:
-
In Ruby 1.8, `Hash#to_a` is not deterministically ordered, but this is.
-
In Ruby 1.9 when running tests, this is ordered in the same way it would be under Ruby 1.8 (sorted key order rather than insertion order).
@param hash [Hash] @return [Array]
# File lib/sass/util.rb, line 298 def hash_to_a(hash) return hash.to_a unless ruby1_8? || defined?(Test::Unit) hash.sort_by {|k, v| k} end
Undoes {#extract_values} by transforming a string with escape sequences into an array of strings and non-string values.
@param str [String] The string with escape sequences. @param values [Array] The array of values to inject. @return [Array] The array of strings and values.
# File lib/sass/util.rb, line 1014 def inject_values(str, values) return [str.gsub('{{', '{')] if values.empty? # Add an extra { so that we process the tail end of the string result = (str + '{{').scan(/(.*?)(?:(\{\{)|\{(\d+)\})/m).map do |(pre, esc, n)| [pre, esc ? '{' : '', n ? values[n.to_i] : ''] end.flatten(1) result[-2] = '' # Get rid of the extra { merge_adjacent_strings(result).reject {|s| s == ''} end
Like `Object#inspect`, but preserves non-ASCII characters rather than escaping them under Ruby 1.9.2. This is necessary so that the precompiled Haml template can be `#encode`d into `@options` before being evaluated.
@param obj {Object} @return {String}
# File lib/sass/util.rb, line 979 def inspect_obj(obj) return obj.inspect unless version_geq(::RUBY_VERSION, "1.9.2") return ':' + inspect_obj(obj.to_s) if obj.is_a?(Symbol) return obj.inspect unless obj.is_a?(String) '"' + obj.gsub(/[\x00-\x7F]+/) {|s| s.inspect[1...-1]} + '"' end
Intersperses a value in an enumerable, as would be done with `Array#join` but without concatenating the array together afterwards.
@param enum [Enumerable] @param val @return [Array]
# File lib/sass/util.rb, line 208 def intersperse(enum, val) enum.inject([]) {|a, e| a << e << val}[0...-1] end
Whether or not this is running on IronRuby.
@return [Boolean]
# File lib/sass/util.rb, line 586 def ironruby? return @ironruby if defined?(@ironruby) @ironruby = RUBY_ENGINE == "ironruby" end
Wehter or not this is running under JRuby 1.6 or lower.
# File lib/sass/util.rb, line 698 def jruby1_6? return @jruby1_6 if defined?(@jruby1_6) @jruby1_6 = jruby? && jruby_version[0] == 1 && jruby_version[1] < 7 end
Whether or not this is running on JRuby.
@return [Boolean]
# File lib/sass/util.rb, line 602 def jruby? return @jruby if defined?(@jruby) @jruby = RUBY_PLATFORM =~ /java/ end
Returns an array of ints representing the JRuby version number.
@return [Array<Fixnum>]
# File lib/sass/util.rb, line 610 def jruby_version @jruby_version ||= ::JRUBY_VERSION.split(".").map {|s| s.to_i} end
Escapes certain characters so that the result can be used as the JSON string value. Returns the original string if no escaping is necessary.
@param s [String] The string to be escaped @return [String] The escaped string
# File lib/sass/util.rb, line 1052 def json_escape_string(s) return s if s !~ /["\\b\f\n\r\t]/ result = "" s.split("").each do |c| case c when '"', "\\" result << "\\" << c when "\n" then result << "\\n" when "\t" then result << "\\t" when "\r" then result << "\\r" when "\f" then result << "\\f" when "\b" then result << "\\b" else result << c end end result end
Converts the argument into a valid JSON value.
@param v [Fixnum, String, Array, Boolean, nil] @return [String]
# File lib/sass/util.rb, line 1076 def json_value_of(v) case v when Fixnum v.to_s when String "\"" + json_escape_string(v) + "\"" when Array "[" + v.map {|x| json_value_of(x)}.join(",") + "]" when NilClass "null" when TrueClass "true" when FalseClass "false" else raise ArgumentError.new("Unknown type: #{v.class.name}") end end
Computes a single longest common subsequence for `x` and `y`. If there are more than one longest common subsequences, the one returned is that which starts first in `x`.
@param x [Array] @param y [Array] @yield [a, b] An optional block to use in place of a check for equality
between elements of `x` and `y`.
@yieldreturn [Object, nil] If the two values register as equal,
this will return the value to use in the LCS array.
@return [Array] The LCS
# File lib/sass/util.rb, line 282 def lcs(x, y, &block) x = [nil, *x] y = [nil, *y] block ||= proc {|a, b| a == b && a} lcs_backtrace(lcs_table(x, y, &block), x, y, x.size - 1, y.size - 1, &block) end
Returns whether this environment is using Listen version 2.0.0 or greater.
@return [Boolean]
# File lib/sass/util.rb, line 546 def listen_geq_2? return @listen_geq_2 unless @listen_geq_2.nil? @listen_geq_2 = begin require 'listen/version' version_geq(::Listen::VERSION, '2.0.0') rescue LoadError false end end
# File lib/sass/util.rb, line 1218 def load_listen! if defined?(gem) begin gem 'listen', '>= 1.1.0', '< 3.0.0' require 'listen' rescue Gem::LoadError dir = scope("vendor/listen/lib") $LOAD_PATH.unshift dir begin require 'listen' rescue LoadError => e if version_geq(RUBY_VERSION, "1.9.3") version_constraint = "~> 2.7" else version_constraint = "~> 1.1" end e.message << "\n" << "Run \"gem install listen --version '#{version_constraint}'\" to get it." raise e end end else begin require 'listen' rescue LoadError => e dir = scope("vendor/listen/lib") if $LOAD_PATH.include?(dir) raise e unless File.exist?(scope(".git")) e.message << "\n" << 'Run "git submodule update --init" to get the bundled version.' else $LOAD_PATH.unshift dir retry end end end end
Whether or not this is running under MacRuby.
@return [Boolean]
# File lib/sass/util.rb, line 706 def macruby? return @macruby if defined?(@macruby) @macruby = RUBY_ENGINE == 'macruby' end
Maps the key-value pairs of a hash according to a block.
@example
map_hash({:foo => "bar", :baz => "bang"}) {|k, v| [k.to_s, v.to_sym]} #=> {"foo" => :bar, "baz" => :bang}
@param hash [Hash] The hash to map @yield [key, value] A block in which the key-value pairs are transformed @yieldparam [key] The hash key @yieldparam [value] The hash value @yieldreturn [(Object, Object)] The new value for the `[key, value]` pair @return [Hash] The mapped hash @see map_keys @see map_vals
# File lib/sass/util.rb, line 98 def map_hash(hash) # Copy and modify is more performant than mapping to an array and using # to_hash on the result. rv = hash.class.new hash.each do |k, v| new_key, new_value = yield(k, v) new_key = hash.denormalize(new_key) if hash.is_a?(NormalizedMap) && new_key == k rv[new_key] = new_value end rv end
Maps the keys in a hash according to a block.
@example
map_keys({:foo => "bar", :baz => "bang"}) {|k| k.to_s} #=> {"foo" => "bar", "baz" => "bang"}
@param hash [Hash] The hash to map @yield [key] A block in which the keys are transformed @yieldparam key [Object] The key that should be mapped @yieldreturn [Object] The new value for the key @return [Hash] The mapped hash @see map_vals @see map_hash
# File lib/sass/util.rb, line 58 def map_keys(hash) map_hash(hash) {|k, v| [yield(k), v]} end
Maps the values in a hash according to a block.
@example
map_values({:foo => "bar", :baz => "bang"}) {|v| v.to_sym} #=> {:foo => :bar, :baz => :bang}
@param hash [Hash] The hash to map @yield [value] A block in which the values are transformed @yieldparam value [Object] The value that should be mapped @yieldreturn [Object] The new value for the value @return [Hash] The mapped hash @see map_keys @see map_hash
# File lib/sass/util.rb, line 74 def map_vals(hash) # We don't delegate to map_hash for performance here # because map_hash does more than is necessary. rv = hash.class.new hash = hash.as_stored if hash.is_a?(NormalizedMap) hash.each do |k, v| rv[k] = yield(v) end rv end
Concatenates all strings that are adjacent in an array, while leaving other elements as they are.
@example
merge_adjacent_strings([1, "foo", "bar", 2, "baz"]) #=> [1, "foobar", 2, "baz"]
@param arr [Array] @return [Array] The enumerable with strings merged
# File lib/sass/util.rb, line 148 def merge_adjacent_strings(arr) # Optimize for the common case of one element return arr if arr.size < 2 arr.inject([]) do |a, e| if e.is_a?(String) if a.last.is_a?(String) a.last << e else a << e.dup end else a << e end a end end
Returns the ASCII code of the given character.
@param c [String] All characters but the first are ignored. @return [Fixnum] The ASCII code of `c`.
# File lib/sass/util.rb, line 918 def ord(c) ruby1_8? ? c[0] : c.ord end
Converts a hash or a list of pairs into an order-preserving hash.
On Ruby 1.8.7, this uses the orderedhash gem to simulate an order-preserving hash. On Ruby 1.9 and up, it just uses the native Hash class, since that preserves the order itself.
@overload #ordered_hash(hash)
@param hash [Hash] a normal hash to convert to an ordered hash @return [Hash]
@overload #ordered_hash(*pairs)
@example ordered_hash([:foo, "bar"], [:baz, "bang"]) #=> {:foo => "bar", :baz => "bang"} ordered_hash #=> {} @param pairs [Array<(Object, Object)>] the list of key/value pairs for the hash. @return [Hash]
# File lib/sass/util.rb, line 730 def ordered_hash(*pairs_or_hash) if pairs_or_hash.length == 1 && pairs_or_hash.first.is_a?(Hash) hash = pairs_or_hash.first return hash unless ruby1_8? return OrderedHash.new.merge hash end return Hash[pairs_or_hash] unless ruby1_8? (pairs_or_hash.is_a?(NormalizedMap) ? NormalizedMap : OrderedHash)[*flatten(pairs_or_hash, 1)] end
Like `Pathname.new`, but normalizes Windows paths to always use backslash separators.
`Pathname#relative_path_from` can break if the two pathnames aren’t consistent in their slash style.
@param path [String] @return [Pathname]
# File lib/sass/util.rb, line 634 def pathname(path) path = path.tr("/", "\\") if windows? Pathname.new(path) end
Return an array of all possible paths through the given arrays.
@param arrs [Array<Array>] @return [Array<Arrays>]
@example
paths([[1, 2], [3, 4], [5]]) #=> # [[1, 3, 5], # [2, 3, 5], # [1, 4, 5], # [2, 4, 5]]
# File lib/sass/util.rb, line 265 def paths(arrs) arrs.inject([[]]) do |paths, arr| flatten(arr.map {|e| paths.map {|path| path + [e]}}, 1) end end
Computes the powerset of the given array. This is the set of all subsets of the array.
@example
powerset([1, 2, 3]) #=> Set[Set[], Set[1], Set[2], Set[3], Set[1, 2], Set[2, 3], Set[1, 3], Set[1, 2, 3]]
@param arr [Enumerable] @return [Set<Set>] The subsets of `arr`
# File lib/sass/util.rb, line 118 def powerset(arr) arr.inject([Set.new].to_set) do |powerset, el| new_powerset = Set.new powerset.each do |subset| new_powerset << subset new_powerset << subset + [el] end new_powerset end end
Returns the environment of the Rails application, if this is running in a Rails context. Returns `nil` if no such environment is defined.
@return [String, nil]
# File lib/sass/util.rb, line 513 def rails_env return ::Rails.env.to_s if defined?(::Rails.env) return RAILS_ENV.to_s if defined?(RAILS_ENV) nil end
Returns the root of the Rails application, if this is running in a Rails context. Returns `nil` if no such root is defined.
@return [String, nil]
# File lib/sass/util.rb, line 499 def rails_root if defined?(::Rails.root) return ::Rails.root.to_s if ::Rails.root raise "ERROR: Rails.root is nil!" end return RAILS_ROOT.to_s if defined?(RAILS_ROOT) nil end
Whether or not this is running on Rubinius.
@return [Boolean]
# File lib/sass/util.rb, line 594 def rbx? return @rbx if defined?(@rbx) @rbx = RUBY_ENGINE == "rbx" end
Non-destructively replaces all occurrences of a subsequence in an array with another subsequence.
@example
replace_subseq([1, 2, 3, 4, 5], [2, 3], [:a, :b]) #=> [1, :a, :b, 4, 5]
@param arr [Array] The array whose subsequences will be replaced. @param subseq [Array] The subsequence to find and replace. @param replacement [Array] The sequence that `subseq` will be replaced with. @return [Array] `arr` with `subseq` replaced with `replacement`.
# File lib/sass/util.rb, line 176 def replace_subseq(arr, subseq, replacement) new = [] matched = [] i = 0 arr.each do |elem| if elem != subseq[i] new.push(*matched) matched = [] i = 0 new << elem next end if i == subseq.length - 1 matched = [] i = 0 new.push(*replacement) else matched << elem i += 1 end end new.push(*matched) new end
Restricts a number to falling within a given range. Returns the number if it falls within the range, or the closest value in the range if it doesn’t.
@param value [Numeric] @param range [Range<Numeric>] @return [Numeric]
# File lib/sass/util.rb, line 136 def restrict(value, range) [[value, range.first].max, range.last].min end
Whether or not this is running under a Ruby version under 2.0.
@return [Boolean]
# File lib/sass/util.rb, line 669 def ruby1? return @ruby1 if defined?(@ruby1) @ruby1 = Sass::Util::RUBY_VERSION[0] <= 1 end
Whether or not this is running under Ruby 1.8 or lower.
Note that IronRuby counts as Ruby 1.8, because it doesn’t support the Ruby 1.9 encoding API.
@return [Boolean]
# File lib/sass/util.rb, line 680 def ruby1_8? # IronRuby says its version is 1.9, but doesn't support any of the encoding APIs. # We have to fall back to 1.8 behavior. return @ruby1_8 if defined?(@ruby1_8) @ruby1_8 = ironruby? || (Sass::Util::RUBY_VERSION[0] == 1 && Sass::Util::RUBY_VERSION[1] < 9) end
Whether or not this is running under Ruby 1.8.6 or lower. Note that lower versions are not officially supported.
@return [Boolean]
# File lib/sass/util.rb, line 692 def ruby1_8_6? return @ruby1_8_6 if defined?(@ruby1_8_6) @ruby1_8_6 = ruby1_8? && Sass::Util::RUBY_VERSION[2] < 7 end
The same as `Kernel#warn`, but is silenced by {#silence_sass_warnings}.
@param msg [String]
# File lib/sass/util.rb, line 487 def sass_warn(msg) msg = msg + "\n" unless ruby1? Sass.logger.warn(msg) end
Tests the hash-equality of two sets in a cross-version manner. Aggravatingly, this is order-dependent in Ruby 1.8.6.
@param set1 [Set] @param set2 [Set] @return [Boolean] Whether or not the sets are hashcode equal
# File lib/sass/util.rb, line 967 def set_eql?(set1, set2) return set1.eql?(set2) unless ruby1_8_6? set1.to_a.uniq.sort_by {|e| e.hash}.eql?(set2.to_a.uniq.sort_by {|e| e.hash}) end
Returns the hash code for a set in a cross-version manner. Aggravatingly, this is order-dependent in Ruby 1.8.6.
@param set [Set] @return [Fixnum] The order-independent hashcode of `set`
# File lib/sass/util.rb, line 956 def set_hash(set) return set.hash unless ruby1_8_6? set.map {|e| e.hash}.uniq.sort.hash end
Silence all output to STDERR within a block.
@yield A block in which no output will be printed to STDERR
# File lib/sass/util.rb, line 467 def silence_warnings the_real_stderr, $stderr = $stderr, StringIO.new yield ensure $stderr = the_real_stderr end
# File lib/sass/util.rb, line 212 def slice_by(enum) results = [] enum.each do |value| key = yield(value) if !results.empty? && results.last.first == key results.last.last << value else results << [key, [value]] end end results end
Destructively strips whitespace from the beginning and end of the first and last elements, respectively, in the array (if those elements are strings).
@param arr [Array] @return [Array] `arr`
# File lib/sass/util.rb, line 248 def strip_string_array(arr) arr.first.lstrip! if arr.first.is_a?(String) arr.last.rstrip! if arr.last.is_a?(String) arr end
Returns whether or not `seq1` is a subsequence of `seq2`. That is, whether or not `seq2` contains every element in `seq1` in the same order (and possibly more elements besides).
@param seq1 [Array] @param seq2 [Array] @return [Boolean]
# File lib/sass/util.rb, line 381 def subsequence?(seq1, seq2) i = j = 0 loop do return true if i == seq1.size return false if j == seq2.size i += 1 if seq1[i] == seq2[j] j += 1 end end
Substitutes a sub-array of one array with another sub-array.
@param ary [Array] The array in which to make the substitution @param from [Array] The sequence of elements to replace with `to` @param to [Array] The sequence of elements to replace `from` with
# File lib/sass/util.rb, line 230 def substitute(ary, from, to) res = ary.dup i = 0 while i < res.size if res[i...i + from.size] == from res[i...i + from.size] = to end i += 1 end res end
Converts an array of `[key, value]` pairs to a hash.
@example
to_hash([[:foo, "bar"], [:baz, "bang"]]) #=> {:foo => "bar", :baz => "bang"}
@param arr [Array<(Object, Object)>] An array of pairs @return [Hash] A hash
# File lib/sass/util.rb, line 42 def to_hash(arr) ordered_hash(*arr.compact) end
Returns a string description of the character that caused an `Encoding::UndefinedConversionError`.
@param e [Encoding::UndefinedConversionError] @return [String]
# File lib/sass/util.rb, line 345 def undefined_conversion_error_char(e) # Rubinius (as of 2.0.0.rc1) pre-quotes the error character. return e.error_char if rbx? # JRuby (as of 1.7.2) doesn't have an error_char field on # Encoding::UndefinedConversionError. return e.error_char.dump unless jruby? e.message[/^"[^"]+"/] # " end
Returns whether one version string represents the same or a more recent version than another.
@param v1 [String] A version string. @param v2 [String] Another version string. @return [Boolean]
# File lib/sass/util.rb, line 441 def version_geq(v1, v2) version_gt(v1, v2) || !version_gt(v2, v1) end
Returns whether one version string represents a more recent version than another.
@param v1 [String] A version string. @param v2 [String] Another version string. @return [Boolean]
# File lib/sass/util.rb, line 412 def version_gt(v1, v2) # Construct an array to make sure the shorter version is padded with nil Array.new([v1.length, v2.length].max).zip(v1.split("."), v2.split(".")) do |_, p1, p2| p1 ||= "0" p2 ||= "0" release1 = p1 =~ /^[0-9]+$/ release2 = p2 =~ /^[0-9]+$/ if release1 && release2 # Integer comparison if both are full releases p1, p2 = p1.to_i, p2.to_i next if p1 == p2 return p1 > p2 elsif !release1 && !release2 # String comparison if both are prereleases next if p1 == p2 return p1 > p2 else # If only one is a release, that one is newer return release1 end end end
Whether or not this is running on Windows.
@return [Boolean]
# File lib/sass/util.rb, line 578 def windows? return @windows if defined?(@windows) @windows = (RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i) end
Allows modifications to be performed on the string form of an array containing both strings and non-strings.
@param arr [Array] The array from which values are extracted. @yield [str] A block in which string manipulation can be done to the array. @yieldparam str [String] The string form of `arr`. @yieldreturn [String] The modified string. @return [Array] The modified, interpolated array.
# File lib/sass/util.rb, line 1032 def with_extracted_values(arr) str, vals = extract_values(arr) str = yield str inject_values(str, vals) end
Private Instance Methods
Computes a single longest common subsequence for arrays x and y. Algorithm from [Wikipedia](en.wikipedia.org/wiki/Longest_common_subsequence_problem#Reading_out_an_LCS)
# File lib/sass/util.rb, line 1284 def lcs_backtrace(c, x, y, i, j, &block) # rubocop:enable ParameterList, LineLengths return [] if i == 0 || j == 0 if (v = yield(x[i], y[j])) return lcs_backtrace(c, x, y, i - 1, j - 1, &block) << v end return lcs_backtrace(c, x, y, i, j - 1, &block) if c[i][j - 1] > c[i - 1][j] lcs_backtrace(c, x, y, i - 1, j, &block) end
Calculates the memoization table for the Least Common Subsequence algorithm. Algorithm from [Wikipedia](en.wikipedia.org/wiki/Longest_common_subsequence_problem#Computing_the_length_of_the_LCS)
# File lib/sass/util.rb, line 1262 def lcs_table(x, y) # This method does not take a block as an explicit parameter for performance reasons. # rubocop:enable LineLength c = Array.new(x.size) {[]} x.size.times {|i| c[i][0] = 0} y.size.times {|j| c[0][j] = 0} (1...x.size).each do |i| (1...y.size).each do |j| c[i][j] = if yield x[i], y[j] c[i - 1][j - 1] + 1 else [c[i][j - 1], c[i - 1][j]].max end end end c end


As Consumers Embrace eCommerce, Tax Complexity Grows
by PYMNTSSouth Dakota vs. Wayfair was only the beginning. The Supreme Court ruling has started the ball rolling for states and municipalities to tax eCommerce – specifically, out-of-state firms and online marketplaces. But there have already been disputes making their way through the courts, as detailed in the latest Next-Gen Sales Tax Tracker. The tax jurisdictions number in the thousands, and the landscape is a fragmented one.
Data:
$57M: Expected value of state revenue to be generated by Arizona’s online transaction tax in 2020.
$41.7M: Projected state revenues tied to Massachusetts’ economic nexus tax in FY 2020.
$1.8M: Amount Walmart allegedly owes Jefferson Parish, Louisiana in unpaid 2009 to 2015 sales taxes.
24: Number of states that have joined the Streamlined Sales and Use Tax Agreement.
12,000: Number of different sales and use taxes in the U.S.


Hello and welcome to the About Me of Qadree Trimble. I am excited for you to learn more about me and hopefully I'll get a chance to know you as well. First things first let's start with my First name Qadree, pronounced Kah-dree. It's an Arabic name and it means "The Strength and Might of God!
Education History
- Code Fellows
- Le Cordon Bleu College of Culinary Arts
- Naval Training Command, Japan
Job Experience
- Farestart: Lead Chef Instructor
- Space Needle: Linecook
- 13 Coins: Pantry Chef
- Sys Administrator
Goals
- Gain a firm understanding of HTML, CSS and JavaSCript
- Get employeed at a tech company to fund business expenses.
- Continue building my business along the way.
MY TOP TEN MOVIES
- Bram Stoker's Dracula
- Moulin Rouge
- Little Shop of Horrors
- Fright Night (80s version)
- Black Panther
- Avengers 1-4
- Ninja Scroll Anime
- The Conjouring
- Dr. Strange
- A Quiet Place


These are the latest cases and convictions from Preston's courts - Monday, November 18, 2019
by LP ReporterHere is today's round-up of cases from Preston's courts.
Linda Mary Rose, 49, of Thorpe Close, Preston, got a curfew after being found guilty of assaulting a woman and must pay £100 compensation and £100 costs.
Liam John Donnelly, 30, of Hesketh Close, Preston, must do 150 hours unpaid work after admitting assaulting a woman and damaging a window, and must pay £150 compensation and £50 costs.
Muhammad Ali, 51, of St Michael’s Road, Deepdale, was found guilty of failing to have a TV licence, and must pay a £220 fine and £120 costs.
Peter Nield, 28, of Ryelands Crescent, Ashton-on-Ribble, Preston, admits assaulting a man and possessing cannabis, and must pay a £160 fine and £85 costs.
Callum Ryan, 22, of no fixed address, was ordered to do 200 hours of unpaid work and a rehabilitation activity after admitting assaulting a man in Preston in March, and must pay £50 compensation.
Paul Adams, 41, of Auster Crescent, Freckleton, was found guilty of failing to have a TV licence, and must pay a £440 fine, £44 surcharge and £120 costs.
Stuart Wood, 35, of Kellet Avenue, Leyland, admits having no insurance while driving on a public road and must pay a £185 fine, £30 surcharge and £85 costs.


You can customize the message to all participants. This is the initial invitation they'll receive. You can send additional reminders later.
{{model.user_name}} {{inviteMessage.user.full_name}} has invited you to participate in {{model.name}} for {{model.district_name || district.text}}.
PDredesign is a digital toolkit dedicated to improving professional development for educators. The PDredesign tools were designed with school districts who wanted to support their teachers through more relevant, flexible, timely and collaborative professional development opportunities. The toolkit is freely available on PDredesign.org and can be used by any school district to transform existing professional development systems to better support teachers in the classroom.


Sartaj Sahni is a Distinguished Professor of Computer and Information Sciences and Engineering at the University of Florida. He is also a member of the European Academy of Sciences, a Fellow of IEEE, ACM, AAAS, and Minnesota Supercomputer Institute, and a Distinguished Alumnus of the IIT, Kanpur.
Murat is a Professor of Computer Science at University of Texas at Dallas and Director, UTD Data Security and Privacy Lab. His research focuses on creating technologies that can efficiently extract useful information from any data without sacrificing privacy or security. He has been working on security and privacy issues raised by data mining, privacy issues in social networks, applied cryptography for data security, etc.
Sigurd Meldal is a Professor and Director of Silicon Valley Big Data and Cybersecurity Center at San Jose State University, USA. As Director of the Cybersecurity + Big Data Initiative he is developing new research and graduate programs in cybersecurity and data sciences, exploiting the interplay of these two fields as well as their separate and distinct promises and challenges.
Rajeev is Computer Scientist at U.S. Army Engineer Research and Development Center (ERDC). Previously he was an Associate Professor at North Carolina A&T State University. He is Machine Learning practitioner with research in the domain of medical datasets and online social media.
Sumeet Dua is a Professor of Computer Science and Cyber Engineering and Director, Center for Secure Cyberspace, at Louisiana Tech University, LA. He leads the Data Mining Research Laboratory at Louisiana Tech and actively works in machine learning applications for the medical domain. He has authored several books on Data Mining and Machine Learning.
Oge Marques is Professor in the Department of Computer and Electrical Engineering & Computer Science at Florida Atlantic University in Boca Raton, Florida. His research interests include: image processing, analysis, annotation, search, and retrieval; human and computer vision; and video processing and analysis. He is the author of 7 technical books, one patent, and more than 80 scientific articles in these topics.
Inderjit Dhillon is the Gottesman Family Centennial Professor of Computer Science and Mathematics at UT Austin, where he is also the Director of the ICES Center for Big Data Analytics. He is an ACM Fellow, IEEE Fellow, SIAM Fellow, AAAS Fellow and has won the SIAM Linear Algebra Prize. Some of his current research topics: high-dimensional data analysis, divide-and- conquer methods for big data analytics, social network analysis, and predicting gene-disease associations.
P. (Saday) Sadayappan is a Professor of Computer Science and Engineering at The Ohio State University. His research interests include compiler optimization for heterogeneous systems, domain/pattern-specific compiler optimization, characterization of data movement complexity of algorithms, and data-structure centric performance optimization. He obtained a Bachelors degree from IIT-Madras, and an M.S. and Ph.D. from Stony Brook University. He is a Fellow of the IEEE.
Chandrajit Bajaj is the director of the Center for Computational Visualization and a Professor of Computer Sciences at UT Austin. Bajaj holds the Computational Applied Mathematics Chair in Visualization. He is currently on the editorial boards for the International Journal of Computational Geometry and Applications and the ACM Computing Surveys. He is a Distinguished Alumnus of the Indian Institute of Technology, Delhi, (IIT Delhi). He is also a Fellow of AAAS, ACM, IEEE and SIAM.
Srinivasan Parthasarathy is a Professor of Computer Science and Engineering and the Director of the data mining research laboratory at Ohio State. His research interests span databases, data mining and high performance computing. He is among a handful of researchers nationwide (USA) to have won both the Department of Energy and National Science Foundation Career awards. He has won multiple best paper awards or "best of" nominations at ACM SIGKDD, VLDB, ISMB, WWW, ICDM, etc.


"""Utilities needed to emulate Python's interactive interpreter.
"""
# Inspired by similar code by Jeff Epler and Fredrik Lundh.
import sys
import traceback
from codeop import CommandCompiler, compile_command
__all__ = ["InteractiveInterpreter", "InteractiveConsole", "interact",
"compile_command"]
[docs]class InteractiveInterpreter:
"""Base class for InteractiveConsole.
This class deals with parsing and interpreter state (the user's
namespace); it doesn't deal with input buffering or prompting or
input file naming (the filename is always passed in explicitly).
"""
def __init__(self, locals=None):
"""Constructor.
The optional 'locals' argument specifies the dictionary in
which code will be executed; it defaults to a newly created
dictionary with key "__name__" set to "__console__" and key
"__doc__" set to None.
"""
if locals is None:
locals = {"__name__": "__console__", "__doc__": None}
self.locals = locals
self.compile = CommandCompiler()
[docs] def runsource(self, source, filename="<input>", symbol="single"):
"""Compile and run some source in the interpreter.
Arguments are as for compile_command().
One of several things can happen:
1) The input is incorrect; compile_command() raised an
exception (SyntaxError or OverflowError). A syntax traceback
will be printed by calling the showsyntaxerror() method.
2) The input is incomplete, and more input is required;
compile_command() returned None. Nothing happens.
3) The input is complete; compile_command() returned a code
object. The code is executed by calling self.runcode() (which
also handles run-time exceptions, except for SystemExit).
The return value is True in case 2, False in the other cases (unless
an exception is raised). The return value can be used to
decide whether to use sys.ps1 or sys.ps2 to prompt the next
line.
"""
try:
code = self.compile(source, filename, symbol)
except (OverflowError, SyntaxError, ValueError):
# Case 1
self.showsyntaxerror(filename)
return False
if code is None:
# Case 2
return True
# Case 3
self.runcode(code)
return False
[docs] def runcode(self, code):
"""Execute a code object.
When an exception occurs, self.showtraceback() is called to
display a traceback. All exceptions are caught except
SystemExit, which is reraised.
A note about KeyboardInterrupt: this exception may occur
elsewhere in this code, and may not always be caught. The
caller should be prepared to deal with it.
"""
try:
exec(code, self.locals)
except SystemExit:
raise
except:
self.showtraceback()
[docs] def showsyntaxerror(self, filename=None):
"""Display the syntax error that just occurred.
This doesn't display a stack trace because there isn't one.
If a filename is given, it is stuffed in the exception instead
of what was there before (because Python's parser always uses
"<string>" when reading from a string).
The output is written by self.write(), below.
"""
type, value, tb = sys.exc_info()
sys.last_type = type
sys.last_value = value
sys.last_traceback = tb
if filename and type is SyntaxError:
# Work hard to stuff the correct filename in the exception
try:
msg, (dummy_filename, lineno, offset, line) = value.args
except ValueError:
# Not the format we expect; leave it alone
pass
else:
# Stuff in the right filename
value = SyntaxError(msg, (filename, lineno, offset, line))
sys.last_value = value
if sys.excepthook is sys.__excepthook__:
lines = traceback.format_exception_only(type, value)
self.write(''.join(lines))
else:
# If someone has set sys.excepthook, we let that take precedence
# over self.write
sys.excepthook(type, value, tb)
[docs] def showtraceback(self):
"""Display the exception that just occurred.
We remove the first stack item because it is our own code.
The output is written by self.write(), below.
"""
sys.last_type, sys.last_value, last_tb = ei = sys.exc_info()
sys.last_traceback = last_tb
try:
lines = traceback.format_exception(ei[0], ei[1], last_tb.tb_next)
if sys.excepthook is sys.__excepthook__:
self.write(''.join(lines))
else:
# If someone has set sys.excepthook, we let that take precedence
# over self.write
sys.excepthook(ei[0], ei[1], last_tb)
finally:
last_tb = ei = None
[docs] def write(self, data):
"""Write a string.
The base implementation writes to sys.stderr; a subclass may
replace this with a different implementation.
"""
sys.stderr.write(data)
[docs]class InteractiveConsole(InteractiveInterpreter):
"""Closely emulate the behavior of the interactive Python interpreter.
This class builds on InteractiveInterpreter and adds prompting
using the familiar sys.ps1 and sys.ps2, and input buffering.
"""
def __init__(self, locals=None, filename="<console>"):
"""Constructor.
The optional locals argument will be passed to the
InteractiveInterpreter base class.
The optional filename argument should specify the (file)name
of the input stream; it will show up in tracebacks.
"""
InteractiveInterpreter.__init__(self, locals)
self.filename = filename
self.resetbuffer()
[docs] def resetbuffer(self):
"""Reset the input buffer."""
self.buffer = []
[docs] def interact(self, banner=None, exitmsg=None):
"""Closely emulate the interactive Python console.
The optional banner argument specifies the banner to print
before the first interaction; by default it prints a banner
similar to the one printed by the real Python interpreter,
followed by the current class name in parentheses (so as not
to confuse this with the real interpreter -- since it's so
close!).
The optional exitmsg argument specifies the exit message
printed when exiting. Pass the empty string to suppress
printing an exit message. If exitmsg is not given or None,
a default message is printed.
"""
try:
sys.ps1
except AttributeError:
sys.ps1 = ">>> "
try:
sys.ps2
except AttributeError:
sys.ps2 = "... "
cprt = 'Type "help", "copyright", "credits" or "license" for more information.'
if banner is None:
self.write("Python %s on %s\n%s\n(%s)\n" %
(sys.version, sys.platform, cprt,
self.__class__.__name__))
elif banner:
self.write("%s\n" % str(banner))
more = 0
while 1:
try:
if more:
prompt = sys.ps2
else:
prompt = sys.ps1
try:
line = self.raw_input(prompt)
except EOFError:
self.write("\n")
break
else:
more = self.push(line)
except KeyboardInterrupt:
self.write("\nKeyboardInterrupt\n")
self.resetbuffer()
more = 0
if exitmsg is None:
self.write('now exiting %s...\n' % self.__class__.__name__)
elif exitmsg != '':
self.write('%s\n' % exitmsg)
[docs] def push(self, line):
"""Push a line to the interpreter.
The line should not have a trailing newline; it may have
internal newlines. The line is appended to a buffer and the
interpreter's runsource() method is called with the
concatenated contents of the buffer as source. If this
indicates that the command was executed or invalid, the buffer
is reset; otherwise, the command is incomplete, and the buffer
is left as it was after the line was appended. The return
value is 1 if more input is required, 0 if the line was dealt
with in some way (this is the same as runsource()).
"""
self.buffer.append(line)
source = "\n".join(self.buffer)
more = self.runsource(source, self.filename)
if not more:
self.resetbuffer()
return more
[docs]def interact(banner=None, readfunc=None, local=None, exitmsg=None):
"""Closely emulate the interactive Python interpreter.
This is a backwards compatible interface to the InteractiveConsole
class. When readfunc is not specified, it attempts to import the
readline module to enable GNU readline if it is available.
Arguments (all optional, all default to None):
banner -- passed to InteractiveConsole.interact()
readfunc -- if not None, replaces InteractiveConsole.raw_input()
local -- passed to InteractiveInterpreter.__init__()
exitmsg -- passed to InteractiveConsole.interact()
"""
console = InteractiveConsole(local)
if readfunc is not None:
console.raw_input = readfunc
else:
try:
import readline
except ImportError:
pass
console.interact(banner, exitmsg)
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-q', action='store_true',
help="don't print version and copyright messages")
args = parser.parse_args()
if args.q or sys.flags.quiet:
banner = ''
else:
banner = None
interact(banner)


Hi,
I was wondering if Emoncms plans to support third party electricity monitors such as CurrentCost. I found this post http://openenergymonitor.org/emon/node/1418 but it seems like it's a DIY affair. As most of these monitors communicate over serial is there scope to share some code between them?
A while ago I ported a cheap Maplin electricity monitor to Linux (https://github.com/jpsingleton/Raspberry-Pi-Electricity-Monitor and https://unop.uk/dev/raspberry-pi-electricity-monitor/) and I'd love to integrate this with Emoncms. It looks like there are a couple of options:
- Create a standalone project that reads the data and posts it to the Emoncms API
- Integrate the python serial reading code into https://github.com/emonhub/emonhub/
I'd prefer the second option and it would be great if emonHub could support a range of monitors in addition to the native open energy monitor hardware. There seems to be a lot of shared logic as most are very similar.
Anyone have ideas / preferences on this before I open a pull request and get coding?
Cheers
Re: Support for third party electricity monitors
I think a current cost (or similar) interface could be a good addition as there are many of those out there, I would be happy to assist with the emonhub side of things if it helps. However emonHub is about to under go some quite heavy changes so beware not to invest too heavily into integrating with it in it's current form. I can't be absolutely sure on the full extent of the changes required just yet. but thought you should know.
Paul
Re: Support for third party electricity monitors
OK, thanks. It looked like things might be in a state of flux with new projects like emonview. I'll see about integrating my python code into emonhub as I think that's currently the logical place for it.
I believe a good long term strategy would be to de-couple the raspberry pi software from the open energy monitor hardware so that commercial off the shelf electricity monitors (and maybe smart meters in the future) can be used as well. Not everyone has a power source near their meter.
This project seems to be a good example of a robust raspberry pi python daemon:
It uses advanced features such as the watchdog available on the pi.
Re: Support for third party electricity monitors
The emonTx V3 can run from batteries of no power source is close by. It had a 3 x AA battery holder on board. But yes I agree using emonhub to support other energy monitors and being able to forward data to other services would be good in the spirit of openness! I'm all for it.
Re: Support for third party electricity monitors
Ah, I didn't see that. Do you have data on how long they last? Can the voltage be measured from a separate location and combined with the current measurement or does the timing need to be very accurate?
It looks like someone else has done the same as me so there is probably a demand for standard server side software to use with cheap hardware: http://electroncastle.com/wp/?p=1808
Re: Support for third party electricity monitors
You could monitor the voltage at a separate location, but that would limit your measurement to apparent power only. Real power (and by inference import/export) and power factor are not available as precise timing between corresponding samples of the wave (at approx 2500 samples per second) is required, and the samples values must be transmitted between locations too!
Re: Support for third party electricity monitors
I've updated my code to post to the emoncms API. As this monitor has been discontinued I decided not to integrate into emonhub.


Welcome back to another Dev Blog and to the new site!(Again). We decided to switch to a free wordpress sight for two main reasons, one being money, and the other being that we got tired of keeping up with our old site by hand, so we decided to just switch to a CMS like wordpress to simplifiy things.
This month has been a little laid back as we have been enjoying the sun and remainder of our summer, however, we have made great progress on our new building system! This ended up taking a bit longer then we would have liked, however we are happy with the progress that has been made on it.
Additionally this month, we have began looking into different art styles and are exploring the end results for how we want our game to look. In other words, while our Dev Blogs have had images displayed on different things we are implementing into the game, those images are by no means what we want our final product to look like, so expect to see some visual changes down the road.
As always, theres the fair share of bug fixes and tweaks to previous systems, but nothing substantial enough worth noting. School starts back up in September so development will be slowed, but rest assured we will still be working on the Exiled Project.


[...] offer a range of potential creative affordances
role of a catalyst, or a stimulant, to our own creative thinking.
lift the level of concern in a way that promotes enhanced creative thinking.


abstract class VoiceStream
Base class for voice streams between the Zello Channels SDK and the Zello Channels server
open val channel: String
The name of the channel this stream is connected to |
|
val context: SessionContext |
|
val events: SessionListener? |
|
val position: Long
Time in milliseconds that has passed since the message has started playing or recording. Roughly matches the amount of data played or recorded, but in the case of an incoming message may be significantly higher than the amount of data received and played because of network delays and packet losses. |
|
val session: Session |
|
var state: VoiceStreamState
The stream's current state |
|
var streamId: Int |
abstract class IncomingVoiceStream : VoiceStream
This class implements voice streams from the Zello channels server to the client device |
|
abstract class OutgoingVoiceStream : VoiceStream
Stream sending voice audio to the Zello Channels server. Create an outgoing voice stream by calling startVoiceMessage and stop it by calling stop. After stopping an outgoing voice stream, the object is defunct. To send more voice audio to the server, you will need to create a new stream. |


Load protein and spin label data from molecular dynamics simulation trajectory output files.
MD = mdload(TrajFile,TopFile,Info); MD = mdload(TrajFile,TopFile,Info,Opt);
This function loads spin label frame data with and without protein global rotational diffusion, rotation matrices representing the protein's orientation, and spin label side chain dihedral angles data from molecular dynamics (MD) simulation trajectory output files.
TrajFile
is the trajectory filename or set of filenames to be loaded. If TrajFile
is just a file name without a directory (e.g. 'TrajFile1.DCD'
), mdload
looks for it in Matlab's current directory. TrajFile
can also include the full path to the file (e.g. C:\mydata\sample5\TrajFile1.DCD'
). For multiple trajectory files, TrajFile
can be set to a cell array containing character arrays as entries (e.g. {'TrajFile1.DCD','TrajFile2.DCD'}
).
TopFile
is the name of the topology input file. Please specify the full path.
Formats are identified by the extension of the file name specified in TrajFile
and TopFile
. The following MD simulation programs, their default output trajectory file extensions, and their input topology file extensions are supported:
| MD program | Trajectory file extension | Topology file extension |
| NAMD | DCD | PSF |
| CHARMM | DCD | PSF |
Info
is a structure containing information regarding the structure and organization of the MD trajectory data.
SegName
TopFile
assigned to the spin-labeled protein.
ResName
TopFile
assigned to the spin-label, e.g. 'CYR1'
is the default name given to R1 by CHARMM-GUI.
LabelName
TopFile
, either 'R1'
(default) or 'TOAC'
.
AtomNames
TopFile
.
ONname
, NNname
, C1name
, C2name
, C1Rname
, C2Rname
, C1Lname
, S1Lname
, SGname
, CBname
, CAname
, Nname
.
ONname
, NNname
, CGSname
, CGRname
, CBSname
, CBRname
, CAname
, Nname
.
Opt
is a structure containing options regarding the output of mdload
. The field Verbosity
controls whether or not mdload
will display messages to the console regarding its progress. Since MD simulation trajectory output files can be quite large (several gigabytes), loading and processing their data can be time-consuming, and Verbosity
is set to 1 by default.
MD
is a structure containing all output from mdload
, including all raw and processed data that can be used by cardamom to simulate an EPR spectrum.
nSteps
dt
RProtDiff
nTraj
xnSteps
containing the rotation matrices representing the global rotational diffusion of the protein.
FrameTraj
nTraj
xnSteps
containing the cartesian coordinates of the spin label tensor frame's x-, y-, and z-coordinate frame axis vectors with respect to the MD simulation box frame, in Å.
FrameTrajwrtProt
FrameTraj
, but without global rotational diffusion of the host protein, in Å.
To load and process a DCD
trajectory file myTraj.DCD
generated by NAMD, with a PSF
topology input file myTop.PSF
, use
TrajFile = 'myTop.DCD'; TopFile = 'myTop.PSF'; Info.ResName = 'CYR1'; Info.SegName = 'PROA'; MD = mdload(TrajFile,TopFile,Info);


UI calibration is one of the latest features comes into Hurdle. With this functionality, UEDs and developers are able to check whether the UI implementation is aligned with design spec. Color-picker and magnifier is one of the feature inside.
Obtain bitmap from Activity
The content to show inside MagnifierView is a crop from background Activity bitmap. To obtain a bitmap of the Activity:
Prepare drawing
Before implementing onDraw(), there are something to be prepared. First we have a content-bitmap and a mask-bitmap, both with the same size of the MagnifierView, say 130*130dp. The mask-bitmap is from a bitmap drawable which is a white-colored circle with transparent background.
Draw the magnifier
Whenever the magnifier is moved, calculate the part of activity-bitmap which should be shown inside, copy that area into content-bitmap, as the content-bitmap is much smaller than activity-bitmap, it is cropped. Then mask the content-bitmap against the mask-bitmap, which translate the shape of content-bitmap from rectanglar to circle.
Somebody may point out that rawY should be substract by the height of system notification bar. But in fact, the Activity window is actually drawn full-screen, the notification bar is an overlay at the top. The Activity window just leaves the area obstructed as transparent.
Please note that the parameters passed to Canvas.translate() are (-bmpLtX, -bmpLtY), instead of (bmpLtX, bmpLtY). I was quite confusing about this at the begining. Translation moves the base point (0, 0) of the Canvas to (-bmpLtX, -bmpLtY), say (-150, -200). When the activity-bitmap is then drawn to the canvas, the base point of the bitmap is actually drawn at view coordinator (-150, -200), which is out of the screen and will not displayed. So the point of bitmap (150, 200) is now drawn at view coordinator (0, 0), that exactly what I want.
Update window location
The MagnifierView is show atop of any Activity. It's manipulated directly by WindowManager.


NSW Australian Primary Schools mapped and visualized using SIMILE Exhibit JS library. Includes data from the Better Education site for the 2013, 2012, 2011 and 2010 NSW top Primary Schools all based on NAPLAN scores.
|
Type: Suburb:
Enrolments 2013:
|


class: center, middle Elements of Data Science - F2019 # Introduction Bryan R. Gibson, PhD --- # Who is this course for?
People fairly new to: -- count: false - Data Science Python tools -- count: false - Experimental Statistics -- count: false - Visualization -- count: false - Machine Learning --- # What will we be covering? -- count: false - DS tools -- count: false - Data manipulation, cleaning and transformation -- count: false - Intro to data exploration and visualization -- count: false - Intro to analysis and hypothesis testing -- count: false - Intro to predictive modeling -- count: false - Intro to clustering and topic modeling -- count: false - Intro to dimensionality reduction and image recognition -- count: false - Intro to time series data -- count: false - Intro to databases -- count: false - Intro to recommendation engines --- # Logistics ## Email<EMAIL_ADDRESS>## IAs: See the course website ## Office Hours - Bryan: 5-7pm Mondays in DSI - IAs: See the course website ??? --- # Course Materials
-- counter:false - Website via Canvas:
https://courseworks2.columbia.edu/courses/90048 -- counter:false - Slides and quizzes via git:
https://github.com/bryanrgibson/eods-f19 -- counter:false - Assignments via git:
More instructions to come --- # Slides
-- counter:false - Written in Remark -- counter:false - To view slides, open index.html in a browser --- # Textbook - **Python Data Science Handbook** by Jake VanderPlas:
https://jakevdp.github.io/PythonDataScienceHandbook/ .center[ ![:scale 25%](https://jakevdp.github.io/PythonDataScienceHandbook/figures/PDSH-cover.png)] --- # Additional Resources ## Books: - **Practical Statistics for Data Scientists** by Bruce & Bruce - **Data Science from Scatch** by Joel Grus - **Feature Engineering for Machine Learning** by Zheng & Casari ### See the course website for more! ??? --- # Homeworks and Exams
-- counter:false - Weekly Quiz, submit online, graded on completion - 10% of grade, equally weighted - no late days -- counter:false - 4 Homework Assignments, submit online, equally weighted - 40%, equally weighted - 2 free late days to be used when you choose - 25% off for each late day -- counter:false - Midterm Exam in class -- counter:false - Final Exam in class? --- # Plagiarism and Code copying
- Homeworks are checked for plagiarism - Copied code will result in 0 points for all involved - Copying from my slides or online sources (Stack overflow, tutorials, etc. ) is fine. ??? --- class: middle # Questions re Logistics? --- # What is DataScience? -- count:false Data science, also known as data-driven science, is **an interdisciplinary field** about scientific methods, processes, and systems **to extract knowledge or insights from data** in various forms, either structured or unstructured, similar to data mining.
https://en.wikipedia.org/wiki/Data_science --- # What is DataScience? .center[ ![](images/Data_Science_VD.png)] http://drewconway.com/zia/2013/3/26/the-data-science-venn-diagram --- # Data Science ≠ Magic
-- counter:false - "Can we find something in this data?" **Yes** -- counter:false - "Will it solve our business problem?" **Maybe** -- counter:false - "Will it be easy?" **Probably not** --- # What does a Data Science workflow look like?
-- counter:false - Business Need → -- counter:false - DS Question → -- counter:false - ETL ↔ -- counter:false - Experimentation → -- counter:false - Tool Creation → -- counter:false - Reporting --- # Important Before You Start!
-- counter:false 1. What's the question?
-- counter:false 2. What does success look like?
-- counter:false 3. How are we going to measure it?
-- counter:false **Can't always get answers to these, but good to ask.** --- # Examples
-- count:false - [Machine Bias in Criminal Sentencing, Propublica](https://github.com/propublica/compas-analysis) -- count:false - [Analysis of OkCupid Data](https://nbviewer.jupyter.org/github/lalelale/profiles_analysis/blob/master/profiles.ipynb) -- count:false - [David Bowie Job Mentions](https://twitter.com/AndyRileyish/status/1170765576878329857?s=20) -- count:false - [NYC Crash Mapper](http://crashmapper.org/#/?cfat=true&cinj=true&endDate=2019-07&geo=citywide&identifier=&lat=40.763121171621314&lng=-73.94588470458984&lngLats=%255B%255D&mfat=true&minj=true&noInjFat=false&pfat=true&pinj=true&startDate=2019-07&zoom=12) -- count:false - [NeurIPS 2019 Acceptance Stats](https://medium.com/@dcharrezt/neurips-2019-stats-c91346d31c8f) -- count:false - Fake Flower Shop Demo --- class: middle # Questions re DataScience?


Main Header
Contact Us
Get in touch!
If you have any questions or comments about any of our products, please let us know! We will get back to you as soon as we can. Thank you!
If you have any questions or comments about any of our products, please let us know! We will get back to you as soon as we can. Thank you!


Myles Garrett ejected after assaulting QB Mason Rudolph with helmet in the final seconds of Browns vs. Steelers game
by Randy Buffington, John DeikeCLEVELAND, Ohio (WOIO) - Cleveland Browns DE Myles Garrett let his emotions get the best of him in a heated play with just seconds left against the Pittsburgh Steelers.

Baker Mayfield said his conduct was inexcusable following the game:
“We can’t continue to hurt this team.”
Baker Mayfield


Titanic (1997) 194 min.
It's a safe bet that you have by now seen TITANIC. Going by the size of attendances it would seem that everyone is seeing it. Of course, the size of those attendances is probably one reason why many people have been purposefully avoiding it. Understandable, but that is not to say the immediate cinema experience is not without its own quirky merits. Try going when the tickets are half price, for example. I did. In the school holidays. If the mob of passengers that was trying to get to the lifeboats was half as big as the throng trying to get into the cinema then my appreciation of what the survivors of the Titanic went through was well assured. We sat in the queue for an hour and a half, which would have been enough time to see another movie, and the doors opened to admit the rush. It didn't end there, because once inside the cinema our vicarious suffering was augmented further by the incessant sub-polar breeze of the air conditioning system, thus ensuring that by the third hour our empathy for the passengers floating in the Atlantic was at a state approaching Nirvana. By the time the credits rolled I had barely enough circulation left to get out before Celine Dion started singing.
So, how good is TITANIC? Firstly, it comes as no surprise that director James Cameron came to choose it as a project. A glance at his earlier work will tell you why. This man makes the bluest looking movies around. THE ABYSS, ALIENS, THE TERMINATOR. If his next film isn't set in the North Pole I'll eat my hat. Secondly, if you're going to see this movie, then it has to be in a cinema. If you'd rather wait for the video release, then you might as well stick a toy boat in the bath and watch that instead. In the spirit of the old Hollywood epics, TITANIC - no tautology intended - is big.
Cameron is to be applauded for resuscitating the Hollywood epic, but what does he have to offer that's new? I'd like to think it was more than a budget blowout on huge-scale models and state-of-the-art special effects. This story, after all, has been told many times before. His film is definitely more engaging than the turgid 1953 TITANIC with Clifton Webb (after 45 minutes I was rooting for the iceberg) but doesn't have the emotional edge of the classic A NIGHT TO REMEMBER. In fact, it's due to the latter that Cameron's TITANIC failed to hit me at gut level. I'd already seen the class divisions, the injustice, the incompetence, the unlucky coincidences. I was more interested, this time around, to see how Cameron would transport me to the scene of the disaster; how he would make me empathise with that tremendous sense of loss and fear.
But instead, he backs off. All the manipulative moments you would expect never arrive: the panic for the lifeboats, the noble self-sacrifices, the sudden topsy-turvy devaluation and re-evaluation of human lives. When I saw two silky Afghan hounds boarding the ship early on I filed the scene away for later reference: Future Camera Shot - Dogs Struggling Helpless and Bewildered in the Water. A sympathy-grabbing moment for sure. He doesn't let it happen. Cameron is more interested in recreating the disaster, not reliving it, so distils the humanity of the story into two characters. You've seen the promos so you know the rest - TITANIC is a love story between third-class Leonardo DiCaprio and upper-class Kate Winslet. And it would not be a proper love story if it were not a triangle, which is where Billy Zane comes in. We know straight away that Zane is completely wrong for Winslet (let's face it, after DEAD CALM who's ever going to trust this guy on a boat again?) but it takes two hours of screen time before he gets the message, by which time the ship is sinking already, and the real reason we all went to see the movie finally gets underway. But even here the tragedy of the event is absent - the story merely shifts from a romance on a floating ship to an adventure on a sinking ship, and Cameron's throwaway moments of comic relief prevent the terror from properly crystallising.
The sinking itself is certainly a spectacle, and you can see where all the money went, but it seems that the whole thing is just too big for Cameron to really enjoy himself with. He isn't directing so much as orchestrating, and even though he's tipped to win an Oscar for TITANIC it's annoying that it doesn't have the same flair of his other films. A lot of TITANIC isn't original, and the ending, which has been a staple of sentimental finales since the silent days of THE THREE MUSKETEERS, is terribly cliched. But TITANIC is still well worth your time. For three hours running time it has a terrific sense of pace, and there is at least one moment that captures the essence of the disaster perfectly: the camera switches its viewpoint to that of the survivors in the lifeboats, watching the now nearly-vertical Titanic from afar with incredulous horror. By itself, this moment would be nothing. But placed as it is, amid an ocean of 194 minutes of film, those few seconds become the only connection Cameron needs to make. It works because it taps into the one level on which we moviegoers can truly empathise: not as participants in a tragedy, but rather as observers of that tragedy.
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


{% extends "auth/base.html" %} {% block content %}
We've e-mailed you instructions for setting your password to the e-mail address you submitted.
You should be receiving it shortly.


You are going to dispute this transaction:
(You can also dispute this transaction through the service line:<PHONE_NUMBER>)
Transaction time: {{transactionService.disputeOne.time}}
Transaction information: {{transactionService.disputeOne.description}}
Transaction amount: {{transactionService.disputeOne.amount | currency}}


--- layout: default ---
Get started with analysing a project. We guide you through the process in a few easy steps.
Many developers but little progress, some anti patterns or clear sky!
Send the status of the project to the right people. We make it easy with several integrations.


{% extends 'base.html' %} {% block title %}{{ SITE_NAME }}{% endblock title %} {% block scripts %} {% endblock scripts %} {% block beforecontent %}
Explore
Raise money to turn your ideas into reality.
Get Started
Gather support from your community for a greater cause.
Help Out


Calculates the categories of MHWs or MCSs produced by detect_event
in
accordance with the naming scheme proposed in Hobday et al. (2018).
category( data, y = temp, S = TRUE, name = "Event", climatology = FALSE, MCScorrect = F, season = "range", roundVal = 4 )
| data | The function receives the full (list) output from the
|
|---|---|
| y | The column containing the measurement variable. If the column
name differs from the default (i.e. |
| S | This argument informs the function if the data were collected in the
southern hemisphere (TRUE, default) or the northern hemisphere (FALSE) so that it may correctly
output the |
| name | If a character string (e.g. "Bohai Sea") is provided here it will be used
to name the events in the |
| climatology | The default setting of |
| MCScorrect | When calculating marine cold-spells (MCSs) it may occur in some areas that the bottom thresholds for the more intense categories will be below -1.8C, this is physically impossible on Earth, so if one wants to correct the bottom thresholds to not be able to exceed -1.8C, set this argument to TRUE (default is FALSE). |
| season | This argument allows the user to decide how the season(s) of occurrence for
the MHWs are labelled. The default setting of |
| roundVal | This argument allows the user to choose how many decimal places
the outputs will be rounded to. Default is 4. To
prevent rounding set |
The function will return a tibble with results similar to those seen in
Table 2 of Hobday et al. (2018). This provides the information necessary to
appraise the extent of the events in the output of detect_event
based on the
category ranking scale. The category thresholds are calculated based on the difference
between the given seasonal climatology and threshold climatology. The four category levels
are then the difference multiplied by the category level.
The definitions for the default output columns are as follows:
The number of the event as determined by detect_event
to allow for joining between the outputs.
The name of the event. Generated from the name
value provided and the year of the peak_date
(see following) of
the event. If no name
value is provided the default "Event" is used.
As proposed in Hobday et al. (2018), Moderate
events are not given a name
so as to prevent multiple repeat names within the same year. If two or more events
ranked greater than Moderate are reported within the same year, they will be
differentiated with the addition of a trailing letter
(e.g. Event 2001a, Event 2001b).
The date (day) on which the maximum intensity of the event was recorded.
The maximum category threshold reached/exceeded by the event.
The maximum intensity of the event above the threshold value.
The total duration (days) of the event. Note that this includes
any possible days when the measurement value y
) may have dropped below the
threshold value. Therefore, the proportion of the event duration (days) spent above
certain thresholds may not add up to 100% (see following four items).
The proportion of the total duration (days) spent at or above the first threshold, but below any further thresholds.
The proportion of the total duration (days) spent at or above the second threshold, but below any further thresholds.
The proportion of the total duration (days) spent at or above the third threshold, but below the fourth threshold.
The proportion of the total duration (days) spent at or above the fourth and final threshold.
The season(s) during which the event occurred. If the event
occurred across two seasons this will be displayed as e.g. "Winter/Spring".
Across three seasons as e.g. "Winter-Summer". Events lasting across four or more
seasons are listed as "Year-round". December (June) is used here as the start of
Austral (Boreal) summer. If "start", "peak", or "end" was given to the season
argument then only the one season during that chosen period will be given.
The column containing the daily date values.
The numeric event number label.
The daily exceedance (default is degrees C) above the seasonal climatology.
The category classification per day.
An explanation for the categories is as follows:
I Moderate-Events that have been detected, but with a maximum intensity that does not double the distance between the seasonal climatology and the threshold value.
II Strong-Events with a maximum intensity that doubles the distance from the seasonal climatology and the threshold, but do not triple it.
III Severe-Events that triple the aforementioned distance, but do not quadruple it.
IV Extreme-Events with a maximum intensity that is four times or greater than the aforementioned distance. Scary stuff...
Hobday et al. (2018). Categorizing and Naming Marine Heatwaves. Oceanography 31(2).
Robert W. Schlegel
res_WA <- detect_event(ts2clm(sst_WA, climatologyPeriod = c("1983-01-01", "2012-12-31"))) # Note that the name argument expects a character vector cat_WA <- category(res_WA, name = "WA") tail(cat_WA)#> # A tibble: 6 x 11 #> event_no event_name peak_date category i_max duration p_moderate p_strong #> <int> <fct> <date> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 40 WA 2010c 2010-12-02 II Stro… 2.66 15 73 27 #> 2 31 WA 2008a 2008-04-14 III Sev… 3.77 34 62 29 #> 3 22 WA 1999 1999-05-22 II Stro… 3.60 95 59 41 #> 4 58 WA 2014 2014-08-31 II Stro… 2.20 12 58 42 #> 5 61 WA 2015 2015-10-02 II Stro… 2.43 7 57 43 #> 6 42 WA 2011b 2011-02-28 IV Extr… 6.51 60 47 32 #> # … with 3 more variables: p_severe <dbl>, p_extreme <dbl>, season <chr># If the data were collected in the northern hemisphere # we must let the function know this, as seen below res_Med <- detect_event(ts2clm(sst_Med, climatologyPeriod = c("1983-01-01", "2012-12-31"))) cat_Med <- category(res_Med, S = FALSE, name = "Med") tail(cat_Med)#> # A tibble: 6 x 11 #> event_no event_name peak_date category i_max duration p_moderate p_strong #> <int> <fct> <date> <chr> <dbl> <dbl> <dbl> <dbl> #> 1 84 Med 2017a 2017-04-12 II Stro… 2.60 24 58 42 #> 2 28 Med 2003a 2003-06-20 II Stro… 5.02 30 57 43 #> 3 62 Med 2012b 2012-08-20 II Stro… 4.22 18 56 44 #> 4 70 Med 2014 2014-10-18 II Stro… 3.31 144 49 50 #> 5 87 Med 2018a 2018-04-21 II Stro… 3.32 14 43 57 #> 6 44 Med 2007b 2007-04-25 III Sev… 4.02 19 42 53 #> # … with 3 more variables: p_severe <dbl>, p_extreme <dbl>, season <chr># One may also choose to have this function output the daily # category classifications as well by setting: climatology = TRUE cat_WA_daily <- category(res_WA, name = "WA", climatology = TRUE) head(cat_WA_daily$climatology)#> # A tibble: 6 x 4 #> t event_no intensity category #> <date> <int> <dbl> <chr> #> 1 1984-06-03 1 1.56 I Moderate #> 2 1984-06-04 1 1.79 I Moderate #> 3 1984-06-05 1 1.92 I Moderate #> 4 1984-06-06 1 1.67 I Moderate #> 5 1984-06-07 1 1.58 I Moderate #> 6 1984-06-17 2 2.02 I Moderate# Note that this will not return the complete time series, only the # days during which events were detected. # This was done to reduce the size of the output for those working # with gridded data. # Should one want a complete time series, the daily category results # may simply be left_join() with the detect_event() results cat_WA_ts <- dplyr::left_join(res_WA$climatology, cat_WA_daily$climatology)#>#> # A tibble: 6 x 11 #> doy t temp seas thresh threshCriterion durationCriteri… event #> <int> <date> <dbl> <dbl> <dbl> <lgl> <lgl> <lgl> #> 1 1 1982-01-01 20.9 21.6 23.0 FALSE FALSE FALSE #> 2 2 1982-01-02 21.2 21.6 23.0 FALSE FALSE FALSE #> 3 3 1982-01-03 21.4 21.7 23.0 FALSE FALSE FALSE #> 4 4 1982-01-04 21.2 21.7 23.1 FALSE FALSE FALSE #> 5 5 1982-01-05 21.3 21.7 23.1 FALSE FALSE FALSE #> 6 6 1982-01-06 21.6 21.7 23.1 FALSE FALSE FALSE #> # … with 3 more variables: event_no <int>, intensity <dbl>, category <chr>


enter a GITHUB username:
to see all the repo's that person has uploaded, as well as a description of said repos
Go


Demonstration of submit - Compute Service
data _null_; array x{10}; do j = 1 to 100000000; do i = 1 to 10; x{i} = i * 10; end; output; end; run;
Job Count:
Delay(sec):
Report Progress
Report completion
Progress
Completed
Type here to simulate doing something useful :-)
type here...
View Log on Demand