Instructions for using the github desktop software
in conjunction with the Journal Backup project for Ken and Mae Browning
Instructions were created using github desktop for windows version 1.4.2
Instructions for regular use
- Launch the github desktop software: Windows Key, type "github", click on the github desktop icon
- Make sure the "current repository" is davidbrowning.github.io
- BEFORE DOING ANY WORK: Pull any changes that have been made. Repository => Pull
- Open the directory of the files you wish to change. Repository => Show in Explorer
- Locate and edit files you wish to change, or add additional files
- When you are ready to backup your work:
- Open the github desktop software
- Make sure the "current repository" is davidbrowning.github.io
- Enter a Summary and Description of the changes you have made
- Click the "Commit to master" button
- Click the "Push origin" button
- Email Dave to let him know that the updates are ready Send dave an email
Instructions for setting up gitihub for journal edits (You should only have to do the following once)
- Github Software: Download Link
- Make sure github desktop software is installed
- Make sure you have a github user account: https://github.com/join?source=header-home
- Launch the github desktop software: Windows Key, Type "github", Locate the github desktop icon, press Enter
- Clone davidbrowning.github.io.git: From the github software:
- File => Clone Repository
- Click "URL"
- Enter the following: git@github.com:davidbrowning/davidbrowning.github.io.git
- Click "Clone"
- You should be ready to go!


---
sort_order: 111
tei_id: rdx_191dd.p.idp18463344
annotation_count: 0
images:
small-thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgxt/mini-thumbnail/
json: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgxt/info/
full: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgxt/fs/
page: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgxt/single-page/
thumbnail: https://readux.ecds.emory.edu/books/emory:191dd/pages/emory:rfgxt/thumbnail/
title: Page 111
number: 111
---
{% raw %}beady for the sacrifice.{% endraw %}
{% raw %}CHAPTER XV{% endraw %}
{% raw %}the lost found.{% endraw %}
{% raw %}113{% endraw %}
{% raw %}The appearance of Mrs. Wyman's parlor betokened prepa¬{% endraw %}
{% raw %}rations for a journey. Siuce Mr. Mauvais' return from St.{% endraw %}
{% raw %}Louis, these preparations had been very active, and now they{% endraw %}
{% raw %}had come to a conclusion. Tfunks were strapped aud{% endraw %}
{% raw %}labeled, shawls laid ready, and all the little paraphernalia{% endraw %}
{% raw %}of travel put iu order for immediate departure '\vhen tho{% endraw %}
{% raw %}steam-whistle should announce that the packet was at the{% endraw %}
{% raw %}landing on the next morning. Alicia's few friends had{% endraw %}
{% raw %}bidden her farewell, and the orphan girl, clad iu mourning-{% endraw %}
{% raw %}weeds, sat gazing at the mild October moon through the open{% endraw %}
{% raw %}window. She was taking her last leave, in her thoughts, of{% endraw %}
{% raw %}scenes and a country where she had suffered and grieved so{% endraw %}
{% raw %}much—more than she could ever suffer or grieve again, for{% endraw %}
{% raw %}grief seemed to her to have lost its sting, aud pain of heart{% endraw %}
{% raw %}was now only a dull echo to which she was accustomed.{% endraw %}
{% raw %}Since her father's funeral, the bitterness of grief had passed{% endraw %}
{% raw %}away, and was succeeded by a sorrow so serene that it had{% endraw %}
{% raw %}no occasion even for tears. " I feel that I am reconciled with{% endraw %}
{% raw %}my father," she often said to Mrs. Wyman, who wanted to see{% endraw %}
{% raw %}her less composed at times; " because," she said, " it vias not{% endraw %}
{% raw %}natural for a young person to hide her feelings." On this{% endraw %}
{% raw %}last evening she had shrunk from conversing even with her{% endraw %}
{% raw %}kind friend, who, finding how sUent and sad she w.as, had{% endraw %}
{% raw %}finally left her to herself, as Alicia evidently desired. Per¬{% endraw %}
{% raw %}haps she was thinking of one who had not yet taken leave of{% endraw %}
{% raw %}her—thinking of him, and wondering if he would forget to{% endraw %}
{% raw %}say farewell. He had not forgotten—he was only waiting to{% endraw %}
{% raw %}be the last.{% endraw %}
{% raw %}" AUcia!"{% endraw %}
{% raw %}"Oh, is that you, Frederick?  I was wait¬{% endraw %}
{% raw %}ing for you to be alone. Do you realize how hard it wouk'{% endraw %}
{% raw %}be for me not to see vou this one time more alone ?"{% endraw %}


JS SDK Test page
Scope:
Connect Account
Test request
API Version:
v2
v1
GET
POST
PUT
PATCH
DELETE
{}
Make request
Log
Object data


Before Change
// Test that dropping all channels a projector applies to will lead to the
// removal of said projector.
raw = read_raw_fif(fif_fname).apply_proj()
n_projs = len(raw.info["projs"])
raw.drop_channels(raw.info["projs"][-1]["data"]["col_names"]) // EEG proj
assert len(raw.info["projs"]) == n_projs - 1
After Change
// Test that dropping all channels a projector applies to will lead to the
// removal of said projector.
raw = read_raw_fif(fif_fname)
n_projs = len(raw.info["projs"])
eeg_names = raw.info["projs"][-1]["data"]["col_names"]
with pytest.raises(RuntimeError, match="loaded"):
raw.copy().apply_proj().drop_channels(eeg_names)
raw.load_data().drop_channels(eeg_names) // EEG proj
assert len(raw.info["projs"]) == n_projs - 1


Principles of Good Design
Is beauty objectively true? Are there principles you can use to guide you to it in your work? Can designers from both the sciences and the arts look at each others work and find beauty? These are important questions for all designers.
For those of us who design things … we need to be able to recognize it. We need good taste to make good things. Instead of treating beauty as an airy abstraction, to be either blathered about or avoided depending on how one feels about airy abstractions, let’s try considering it as a practical question: how do you make good stuff?
Read More


Contains some tools for testing, analyzing time series data and fitting popular time series models such as ARIMA, Moving Average and Holt Winters, etc. Most functions also provide nice and clear outputs like SAS does, such as identify, estimate and forecast, which are the same statements in PROC ARIMA in SAS.
| Version: | 3.1.2 |
| Published: | 2015-07-08 |
| Author: | Debin Qiu |
| Maintainer: | Debin Qiu <debinqiu at uga.edu> |
| License: | GPL-2 | GPL-3 |
| NeedsCompilation: | no |
| CRAN checks: | aTSA results |
| Reference manual: | aTSA.pdf |
| Package source: | aTSA_3.1.2.tar.gz |
| Windows binaries: | r-devel: aTSA_3.1.2.zip, r-release: aTSA_3.1.2.zip, r-oldrel: aTSA_3.1.2.zip |
| OS X binaries: | r-release: aTSA_3.1.2.tgz, r-oldrel: aTSA_3.1.2.tgz |
Please use the canonical form https://CRAN.R-project.org/package=aTSA to link to this page.


HIV PWID infections data sexual incidence number partners injecting prevalence epidemic PMID: ART coverage estimated drug sharing model transmission MENA current use people ;():–. PWID, inject risk Iran Pakistan countries reducing year East Middle North incident {border-style AIDS Central PMCID: rate UNAIDS collab: px;} #ffffff;} (Table drugs estimates infected infection estimations ex�?PWID levels population sex increasing new reduction size total Increasing Morocco epidemiological frequency study condom Table Tunisia epidemics group optimistic partners. prevalent recent review used PMCPMC. Programme analysis antiretroviral behaviour impact modelling needles/syringes parameters studies treatment users Africa Available Mar Nations PMC. United World [cited avert country heterosexual mathematical ppy uncertainty //. Epub Global HIV/AIDS Joint Libya countries, distribution high px; {font-family (%) Abu-RaddadLJ. Afghanistan Africa: Epidemiology Geneva, HIV�? Health Libya, MumtazGR, National Organization Reducing Switzerland. cohort contributed estimate font-size global harm including injections input interventions mortality national respectively seven systematic target Afghanistan, Africa. Emerging Figure HIV/AIDS, Int Iran, Number Others: PWID. Proportion Research acquired analyses analysis. available based conducted double; groups include injection needed partners, past quality survey times (C) (Figure (PWID) AIDS. Concentrated Cornell Disease Eastern Egypt Infect. Ira: MENA, MENA. Pak: Qatar Regional Sexual UI)c and/or border-color border-width coital different ex�?PWID. findings gamma happened highest included level lowest mainly observed pathways potential programmes reach representative scenario solid; start syringe therapy use. virus years {font-style {font-weight ART, Average AwadSF, Egypt; Estimated International Iran. Medicine Morocco. NAa Office Pakistan, Pakistan: Policy RiednerG, Sex Transm Transmission Tropical UI: Wiley access adherence annual assumed average averted baseline behaviour, bio�?behavioural bold comparison comprehensive consistent country�?level country�?specific courier; daily drugs. em; example example, from: half hepatitis hidden higher https://doi.org/./sextrans--. includes informed injecting, integrated limited living measured men meta�?analysis needle/syringe non�?regular onward package population, populations possible prevention probability provide pt;} region regular reported scale�?up share similar substantial sub�?Saharan sufficient surveillance synthesis. time track using values variation work year) year, year.


I started writing today. I didn’t gethaven’t gotten very far. Today I’ll add more and you’ll see how different things are.


- Move Cursor on to the chart item or its properties to view the customization options like
- Click to change Chart Title.
- Click options to add new item.
- Click options to add new actor to the selected chart item.
- Select Type[Begin/Actor/Activity/End] to convert to Actor, Activity or End.


Simply click every orange square that you see below (you may need to scroll). Doesn't work with script blockers. Click "done" when you are done.
By TinSnail (Conlectus on HN)


@(projectName : String, table1Name : String, table2Name : String, table1Tuples : List[com.walmart.productgenome.matching.models.data.Tuple], table1Attributes : List[com.walmart.productgenome.matching.models.data.Attribute], table2Tuples : List[com.walmart.productgenome.matching.models.data.Tuple], table2Attributes : List[com.walmart.productgenome.matching.models.data.Attribute], pairsTableName : String, pairIds : List[Object], scores : List[String], statusMessage : String)
@statusMessage}
@if(table1Tuples == null || table1Tuples.isEmpty()) {
See rules learned from seed training data. The learned model has an average confidence of @scores.get(0)% on the monitoring set. } @if(table1Tuples != null && !table1Tuples.isEmpty()) {
See rules learned from seed training data. The learned model has an average confidence of @scores.get(0)% on the monitoring set. } @if(scores.size() > 1){ @for(i <- 1 to scores.size()-1) { @if(table1Tuples == null || table1Tuples.isEmpty()) {
See rules learned from round @i of active learning. The learned model has an average confidence of @scores.get(i)% on the monitoring set. } @if(table1Tuples != null && !table1Tuples.isEmpty()) {
See rules learned from round @i of active learning. The learned model has an average confidence of @scores.get(i)% on the monitoring set. } } }
No more pairs to be labeled.
Active learning stopped. See rules.


--- layout: default footer: false footer_thin: true introduction: true ---
Hi—I’m Simone Vittori, a software developer based in London. I’m passionate about good software design and I use this blog to write about anything programming related that I find interesting. You can subscribe to the feed or follow my activity on GitHub. Happy reading!{% endif %}
Featured article
{% assign post = site.posts | find: "title", "One request" %}


Skills & Proficiency
Software Craftmanship / Agility / Lean
Code Languages: Javascript, Typescript, Java, Python
Cloud Platforms: Google Cloud, Amazon Web Services, MS Azure
Microservices platforms: Kubernetes, Cloud Foundy
Frontend Frameworks: Angular, React, React-native
Backend: NodeJS, Java Spring, Firebase, Electron, Django
Machine Learning: TensorFlow


| Platform | Since |
|---|---|
| iPhone | 3.4.0 |
| iPad | 3.4.0 |
Allows a Titanium application to use the iOS Touch ID authentication mechanism.
Touch ID is a security mechanism that uses a fingerprint to authenticate the user. The fingerprint sensor is located in the Home button of the device. Users can use their fingerprint instead of entering their passcode for authentication.
The Touch ID module is available with the Titanium SDK starting with Release 3.4.0. This module only works with devices running iOS 8. You can only test the Touch ID module on a device.
The device must have a Touch ID sensor in the Home button and Touch ID must be setup in order to use the Touch ID authentication mechanism. You can set up Touch ID in iOS Setup Assistant or by tapping Touch ID & Passcode from Settings.
For information on setting up Touch ID, see iPhone 5s: Using Touch ID.
Add the module as a dependency to your application by adding a <module>
item to the
<modules>
element of your tiapp.xml
file:
<ti:app>
...
<modules>
<module platform="iphone">ti.touchid</module>
</modules>
...
</ti:app>
Use require()
to access the module from JavaScript:
var TouchId = require("ti.touchid");
The TouchId
variable is a reference to the module. Make API calls using this reference:
TouchId.authenticate({
reason: "Need to modify personal settings.",
callback: authCB
});
The module contains a sample application in the
<TITANIUM_SDK_HOME>/modules/iphone/ti.touchid/<VERSION>/example/
folder.
Constant indicating that the authentication was not successful.
Constant indicating that the passcode is not set for the device.
Constant indicating that iOS cancelled authentication, for example, if another application enters the foreground.
Constant indicating that Touch ID is not available on the device.
Constant indicating that Touch ID does not have any enrolled fingerprints.
Constant indicating that the user canceled authentication.
Constant indicating that the user tapped the fallback button to enter their passcode.
The name of the API that this proxy corresponds to.
The value of this property is the fully qualified name of the API. For example, Button
returns Ti.UI.Button
.
Indicates if the proxy will bubble an event to its parent.
Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window. Other common parents are table sections to their rows, table views to their sections, and scrollable views to their views. Set this property to false to disable the bubbling to the proxy's parent.
Adds the specified callback as an event listener for the named event.
Name of the event.
Object
>
Callback function to invoke when the event is fired.
Applies the properties to the proxy.
Properties are supplied as a dictionary. Each key-value pair in the object is applied to the proxy such that myproxy[key] = value.
Dictionary
A dictionary of properties to apply.
Initiates the Touch ID authentication process.
Dictionary
Dictionary containing two properties:
reason
(String): Message displayed in the authentication dialog describing why the
application is requesting authentication.callback
(Function): Callback function executed after the authentication
completes. The callback function is passed a dictionary with three properties:
success
(Boolean): Set to true if authentication succeeded.error
(String): System error message.code
(Number): Module ERROR_*
constant indicating the reason for the failure.Fires a synthesized event to any registered listeners.
Name of the event.
Dictionary
A dictionary of keys and values to add to the Titanium.Event
object sent to the listeners.
Gets the value of the apiName property.
Gets the value of the bubbleParent property.
Removes the specified callback as an event listener for the named event.
Multiple listeners can be registered for the same event, so the
callback
parameter is used to determine which listener to remove.
When adding a listener, you must save a reference to the callback function in order to remove the listener later:
var listener = function() { Ti.API.info("Event listener called."); }
window.addEventListener('click', listener);
To remove the listener, pass in a reference to the callback function:
window.removeEventListener('click', listener);
Name of the event.
Object
>
Callback function to remove. Must be the same function passed to addEventListener
.
Sets the value of the bubbleParent property.
New value for the property.


<<<<<<< 219d4f2a1af8bef503bd7948dbc5f0331b8fcb1d
This is a todo list progressive web app that intend to be simple and modern. I am using Preact Redux Bundler PWA Kit scaffold.
``` bash
yarn
yarn dev
yarn build
yarn start ```
For detailed explanation on how things work, checkout the CLI Readme.
first commit


--- title: "Canada: Possible post-Thanksgiving Outbreak" output: blogdown::html_page: dev: "svg" author: "Houston Haynes" date: '2020-11-13T14:59:43+05:30' featuredpath: img featured: COVID-19.png ogfeatured: H3_og_wide_covid19.png emblem: health.png description: COVID-19 in Motion - a preamble to a Thanksgiving outbreak in the US? draft: false tags: - COVID-19 - R - highcharts categories: - Sidebar weight: editor_options: chunk_output_type: inline ---
Having taken a turn with the data following Israel’s increase in mask-wearing compliance, I decided to look at the data in Canada after someone warned me about their Thanksgiving showing an ominous trend. Again, here I’m using Our World In Data as a source. I decided to map cases and deaths per million on separate axes in order to see them scaled separately. And it’s just as scary as I thought. That lagging indicator is frightening on two levels:
{{% fancybox-iframe "/post/COVID-19-Canadian-Case-Study_files/figure-html/widgets/widget_Canada_COVID_Cases_per_Million.html" %}}
MIT has just completed a range of studies of COVID-19 along with other SARS/MERS events and found that super-spreader events (where more than 6 people are infected by one person) are more common than original estimated.
“Super-spreading events are likely more important than most of us had initially realized. Even though they are extreme events, they are probable and thus are likely occurring at a higher frequency than we thought. If we can control the super-spreading events, we have a much greater chance of getting this pandemic under control,” says James Collins, the Termeer Professor of Medical Engineering and Science in MIT’s Institute for Medical Engineering and Science (IMES) and Department of Biological Engineering and the senior author of the new study.
There are many rural medical systems that are already on the brink in the US. To have a massive surge of cases after Thanksgiving would be a disaster. I hope people see this and realize they need to stay put and hunker down.


Next: file-author, Previous: ensure-directories-exist, Up: Files Dictionary
truename
filespec ⇒ truename
filespec—a pathname designator.
truename—a physical pathname.
truename tries to find the file indicated by filespec and returns its truename. If the filespec designator is an open stream, its associated file is used.
If filespec is a stream, truename can be used whether the stream is open or closed. It is permissible for truename to return more specific information after the stream is closed than when the stream was open.
If filespec is a pathname it represents the name used to open the file. This may be, but is not required to be, the actual name of the file.
;; An example involving version numbers. Note that the precise nature of ;; the truename is implementation-dependent while the file is still open. (with-open-file (stream ">vistor>test.text.newest") (values (pathname stream) (truename stream))) ⇒ #P"S:>vistor>test.text.newest", #P"S:>vistor>test.text.1" OR⇒ #P"S:>vistor>test.text.newest", #P"S:>vistor>test.text.newest" OR⇒ #P"S:>vistor>test.text.newest", #P"S:>vistor>_temp_._temp_.1" ;; In this case, the file is closed when the truename is tried, so the ;; truename information is reliable. (with-open-file (stream ">vistor>test.text.newest") (close stream) (values (pathname stream) (truename stream))) ⇒ #P"S:>vistor>test.text.newest", #P"S:>vistor>test.text.1" ;; An example involving TOP-20's implementation-dependent concept ;; of logical devices -- in this case, "DOC:" is shorthand for ;; "PS:<DOCUMENTATION>" ... (with-open-file (stream "CMUC::DOC:DUMPER.HLP") (values (pathname stream) (truename stream))) ⇒ #P"CMUC::DOC:DUMPER.HLP", #P"CMUC::PS:<DOCUMENTATION>DUMPER.HLP.13"
An error of type file-error is signaled if an appropriate file cannot be located within the file system for the given filespec,
or if the file system cannot perform the requested operation.
An error of type file-error is signaled if pathname is wild.
pathname, logical-pathname, File System Concepts,
truename may be used to account for any filename translations performed by the file system.
Next: file-author, Previous: ensure-directories-exist, Up: Files Dictionary


Resource
Online
Official Website
Wikipedia Ruby on Rails
Download
Ruby on Rails Cheat Sheet [.png, pdf]
Ruby on Rails Cheat Sheet [backup]
RubyOnRails-Cheatsheet [.pdf]
RubyOnRails-Cheatsheet [backup]
Ruby on Rails cheat sheet guide [.pdf]
Ruby on Rails cheat sheet guide [backup]
What Goes Where a Ruby on Rails cheat sheet [.pdf]
What Goes Where a Ruby on Rails cheat sheet [backup]
Flexible Rails: Flex 3 on Rails 2 [.pdf]
Related
Ruby
<<<<<<< HEAD
HOME
=======
HOME
>>>>>>> faa6aaf237eae4895460e74eebaa130feb27079a


title = "Our Team" url = "/our_team" layout = "default" is_hidden = 0 [ourteam] team = 2 results = 100 sortOrder = "name asc" [ourteam ourteam2] team = 3 results = 100 sortOrder = "name asc" == {{"Our team"|_}}


The Magnus Archives Browser
A simple website for searching through episode transcripts
Latest transcript: Mag 178 - The Processing Line
On the left, set your current episode to only show results from previous episodes.
After you search, a list of all (case insensitive) results will appear on the left. Selecting a snippet will display the full transcript here with the occurrence highlighted.
Transcript Source zjmulder/magnus-archives-browser


ML-Utils Demo
The large map area has been created using the mlMap directive and has been given the name "main". Other elements can manipulate this map by it's name. The div itself is styled by CSS before the map is loaded:
Add Maps hide other maps
You can add maps using the ml-utils directive anywhere on the site
Add Markers
You can add markers to any exiting map via the mlMapService
Add KML
You can add KML data via a public URL to any existing map by name
Layers
Google offers a few default layers that are included in the mlMapService. By abstracting this functionality out it should be possible to implement the same behavior even with different map providers in the future.
Transit
Traffic


{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block head %}
{{ super() }}
{% endblock head %}
{% block synopsis %}
This site provides reports on various aspects of the data recorded in the
Wait Wait... Don't Tell Me! Stats and Show Details
database that don't really fit neatly into the main Stats and Show Details
site.


welcome to pizza shop!!
Select size
lager
medium
small
ex-lager
Select topping
bacon
pepperoni
beef
mushrooms
onions
green peppers
blcak olives
banana peppers
Add to Cart
Clear
the total price of your ordered is: $


#assign impedenceMismatch="active"> <#assign subtitle = "ORM impedance mismatch">
If you try to look at ORM from the viewpoint of trying to cover the entire feature set of Relational Databases then yes there is absolutely a large mismatch.
Certainly for Ebean ORM and I'd suggest in general ORM is a poor abstraction for a large
feature set of Relational Databases and specifically ORM is not well placed to be a
good abstraction for Reporting
and Data Warehouse
features.
Ebean ORM is orientated towards OLTP with reasonably normalised schemas and well known relationships but Relational Databases can do much more than this.
Lets continue to look into the ORM impedance details with the view that we are restricting ourselves to OLTP Databases.
Ted makes the point that there can be a conflict if DBA's control the database schema (and thus it is not under control of the development team). This seems like an organisation structure point as opposed to some fundamental issue with ORM.
Ted's point about a schema being "frozen" by denormalisation and reporting requirements seems a stretch. Denormalisation on an OLTP DB design should be additive and non-breaking and a good DB design should be well placed to allow it to be extended by adding columns and tables etc.
Ultimately if the schema is designed well and then there should no major mapping issue.
I think Ted makes a reasonable point about inheritance and reporting though. His point there is that typical SQL reporting tools are not often not well placed to handle "discriminator column" and inheritance in general.
For me the mitigation of this issue is to provide views as needed to flatten inheritance schemas for reporting tools.
Ted's first point is that there is now effectively an Object model (entity beans) and DB model (tables) and there is a issue that these need to be kept in sync.
This issue is reasonably addressed by DB Migration
where Ebean generates a DIFF
to the DB schema and either FlywayDB
or Ebean's own DB Migration runner applies that as an
application task.
Ted's second point is that the DB is typically a shared resource and that means you can't just refactor the DB design without breaking other applications.
The argument against that is that IF
the DB design got to 4NF
then the only
changes to it should be non breaking changes. That is, Normalization
has the properties that
it can be proven correct and DB multiple designers will get to the same design at 4NF by following the
normalisation rules.
Unlike programming DB design via normalisation is somewhat strict and deterministic.
I completely disagree with Ted's point regarding identity and that is based on the fact that an ORM
is fundamentally presenting the application with a SNAPSHOT
view of part of the database.
That is, what we are doing with ORM is exactly the same as what we were doing with client/server
tools in terms of presenting a snapshot
of part of the database at a given time
via a transaction
at a particular isolation level
.
The issues with identity (Id value to Primary key) and concurrency (optimistic locking via @Version property) are exactly the same as they were with client server tools of old and there is no ORM mismatch issue here with Ebean.
However, an ORM that NEEDS to put unsaved beans that don't yet have an Identity into some "PersistenceContext" and relies on hashCode()/equals() has created a problem for themselves (but that isn't an ORM problem that is an implementation mistake).
Ebean solves this well and this IMO a massively important feature for an ORM.
Ebean solves this well via query language and also provides profiling and automatic query tuning to optimise this per use case.


Cron component supports both approaches ngModel and reactive form.
{{nonFormUsingValue}}
{{ngModelExpression}}
Use activeTab input to manualy activate tab you want.
activeTab
Use disabled input to control component's state.
disabled
{{disabled}}


--- title: Red Butte Photo of the Day August 27, 2009 date: 2009-08-27 00:00:00 -06:00 categories: - whats-blooming layout: post blog-banner: whats-blooming-now-summer.jpg post-date: August 27, 2009 post-time: 12:04 PM blog-image: wbn-default.jpg ---
This cactus is protected under the Endangered Species Act and is listed as federally threatened. It is endemic to Utah and grows in the harsh dry climate of the Uintah Basin. Red Butte Garden and the BLM salvaged the cacti in our collection in 2002 from a site prior to their loss due to habitat destruction resulting from oil extration.


PHP, JS; Technically Full Stack, but more Front End Dev
Curious Facts:
Was obsessed with building 2000 piece jigsaw puzzles when i was 4.
Went to Space Camp and witnessed my first tornado at 11. I didn't fly away, Thank God.
Took hiatus to dance professionally. Went on tour dancing with Madonna.
Dancing Coder
Basics
Elements
Inspect Element. Settings Dark or Light Theme.
"Select Element to inspect it." View attributes
Styles
Computed Styles
Box Model with spacing
Click arrow to take you to class
View css parents and overridden classes
Event Listeners
Tells you events associated with element
Click to go to declaration of listener in file
Toggle Framework and parent listeners
Debugger DOM breakpoints
Lists all breakpoints added on chrome debugger
Object Properties: All js properties associated with element
Drag and drop and delete elements.
Add Attribute, Edit HTML
Scroll to bring into view
Styles
Disable rules for active elements
Edit rules for pseudo classes
Link to css source
Live CSS edit. Add CSS class with '+'
Cool Style Editors
CSS transitions editor
Color Picker. Pick any color from anywhere on the page.
Text Shadow Editor
Responsive Views
Toggle Device Views. Preset mobile devices + Responsive.
View Media Queries
Capture Screenshot
Add Network Throttling
Device Emulation Sensors
Coverage
See unused js and css for your app.
Only available in Chrome Canary
Sources
Edit File
Command Save to Browser cache.
Local Modifications history
Apply Revision content
Revert
'Save as' to original file
Workspaces
Add Folder to Workspace. You can just drag and drop and automatically matches your local
folder to browser.
It will detect other file types like typescript ans sass.
Now you'll be able to save your changes locally and use the browser like an IDE.
Search
Search all files. (Command + P)
Go to Line: (Command + L)
Find in file. (Command + F)
Console
Console Window
'Esc' to open and close
Bling selection
$() – Short for document.querySelector(). Returns the first element, matching a CSS
selector ( e.g. $(‘div’) will return the first div element in the page).; If using
jQuery returns array: $('#title')[0]
$$() – Short for document.querySelectorAll(). Returns an array of elements that
match the given CSS selector.
$0 – $4 – A history of the five most recent DOM elements that you’ve selected in the
elements panel, $0 being the latest.
Autocompletion. Substring Completions.
ES6 Ready - try new features here
Read line smart enter.
Multiple Cursors (Hold Command)
Syntax Highlighting
Select Next/Prev (Command + D)
Preserve Log
Console Debug
Use 'debugger' to start Chrome debugger.
Handy console methods
console.log()
console.error(msg)
console.assert()
console.trace()
console.group(); console.groupCollapse()
console.time(label); console.timeEnd(label)
Snippets
Sources->Snippets. Add new snippets and save them to your browser. Handy to ckeep
around.
Command + enter to play your snippet.
For available snippets google 'Devtools snippets.'
JS errors
Display error
Stack Trace
Network
Resources
See resource's attributes:
Name
Status Code
File Type
What initiated the request
Size
How long it took. (When it was requested)
Waterfall
Colored by the file type
Hover to see TTF (Time to First Byte)
Hover to see how long it took to download
Zoom into area
Simulate Throttling
Simulate Offline
Time
Check to see total bytes on page
(Purple Line) When the browser finished parsing your html.
(Red Line) When all the resources have finished loading.
Disable cache (Also in settings)
Resources Detail
Click on file to see information about request:
Headers
Preview
Response
Cookies
Timing
Screenshots
Click on on camera and reload with Command + R
Debugging JS
Pretty Print
Click on brackets to expand minified code
Pause on Exceptions
Click pause to have debugger stop on refresh
Hover over var to see value
Click Play to continue
Click Step Over/Step Into/Step Out function call
Call Stack - see js stack trace
Breakpoints
Add breakpoints to JS
Inline breakpoints will automatically be detected.
Blackbox Scripts
Break on... (Break on non-js actions)
Subtree modifications
Attribute modifications
Node Removal
Local Storage
Under Application manage your local storage variables
Cookies
Under Application manage your cookies
Profiles
Profiler
Go to Performance click record button or just reload with command + R. Interact with
page. Click stop
View FPS (Frames per second). Anything below 60fps is considered non-performant
Zoom in to get more details
Click to record screenshots. Hover to view.
CPU JS Profiler
Check how long js function operations are taking.
Go to Javascript Profiler. Click record and reload or interact with page. Stop.
Tree or Chart format.
Expand down to function calls to see what's responsible for slowing down your
function. Chart format, zoom in to view, and hover for details.
Try again and record new profile.
Save profile locally.
Timeline View
All in 1 profiler. Just click record button and zoom into area.
View Summary of everything:
Info on network request.
FPS of section
Under Main, chart view of browser procedures color coded.
Parsing HTML - blue
JS Execution - yellow
Loading - light blue
Rendering - purple
Memory Allocation
Summary
Summary- chart with summary of browser procedures.
Bottom up- List of js function calls, longest at the top.
Call Tree- Tree view of how each browser procedure is being executed.
Event Log
Memory
Identify and manage memory leaks
Narrow down into your code and see if there are any memory leaks. Go to Memory Panel.
Click on object to see memory size.
Expand down the function calls to see what's causing the function delay.
Memory Profile Types
Heap Sanpshots
Make a few Profiles
Choose Comparison view
Record Allocation Profile - memory used by functions
Record Allocation Time -heap allocation over time
Layouts
Layers
Inspect if your dom elements are being placed in separate layers (which is better for
DOM
rendering)
3D view with panning and zoom.
Paint Profiler
Narrow down exactly what is being painted when and how much work the browser is doing.
Rendering
Paint Flashing - Check what's being repainted.
Layer Borders - Outline the layer area.
FPS Meter - Check the frames per second live.
Scrolling Performance Issues - Tells you which elements can slow down scrolling.
Emulate things like "print" media.
Performance
Audits
Audit your site.
Get page speed recommendations for improving your site.
Network Throttling
Test how your site performs in different network situations.
Simulate a mobile experience.
Simulate Offline Experience.
Choose specific User Agent.
Sensors tab for motion sensitive debugging.
HTTPS
View certificate information on Security Panel.
Errors on your certificate and other details
Lighthouse
Chrome Extension to check performance on your page.
Made to debug PWA (Progressive Web Apps).
Score
It will score your app according to the PWA
Checklist


About SQLFiddle.com
A tool for easy online testing and sharing of database problems and their solutions.
What am I supposed to do here?
If you do not know SQL or basic database concepts, this site is not going to be very useful to you. However, if you are a database developer, there are a few different use-cases of SQL Fiddle intended for you:
You want help with a tricky query, and you'd like to post a question to a Q/A site like StackOverflow. Build a representative database (schema and data) and post a link to it in your question. Unique URLs for each database (and each query) will be generated as you use the site; just copy and paste the URL that you want to share, and it will be available for anyone who wants to take a look. They will then be able to use your DDL and your SQL as a starting point for answering your question. When they have something they'd like to share with you, they can then send you a link back to their query.
You want to compare and contrast SQL statements in different database back-ends. SQL Fiddle easily lets you switch which database provider (MySQL, PostgreSQL, MS SQL Server, Oracle, and SQLite) your queries run against. This will allow you to quickly evaluate query porting efforts, or language options available in each environment.
You do not have a particular database platform readily available, but you would like to see what a given query would look like in that environment. Using SQL Fiddle, you don't need to bother spinning up a whole installation for your evaluation; just create your database and queries here!
How does it work?
The Schema DDL that is provided is used to generate a private database on the fly. If anything is changed in your DDL (even a single space!), then you will be prompted to generate a new schema and will be operating in a new database.
All SQL queries are run within a transaction that gets immediately rolled-back after the SQL executes. This is so that the underlying database structure does not change from query to query, which makes it possible to share anonymously online with any number of users (each of whom may be writing queries in the same shared database, potentially modifying the structure and thus -- if not for the rollback -- each other's results).
As you create schemas and write queries, unique URLs that refer to your particular schema and query will be visible in your address bar. You can share these with anyone, and they will be able to see what you've done so far. You will also be able to use your normal browser functions like 'back', 'forward', and 'reload', and you will see the various stages of your work, as you would expect.
What differences are there between the various database options?
Aside from the differences inherent in the various databases, there are a few things worth pointing out about their implementation on SQL Fiddle.
MySQL only supports queries which read from the schema (selects, basically). This is necessary due to some limitations in MySQL that make it impossible for me to ensure a consistent schema while various people are fiddling with it. The other database options allow the full range of queries that the back-end supports.
Versions of various databases that are either older or newer than the current stable release for that product are hosted by Jack Douglas in his server environment. This means that some of the schema building / query execution actions may be a bit slower for these options, as there is more network latency between my web server and his VMs.
SQLite runs in the browser; see below for more details.
What's up with that [ ; ] button under each panel?
This obscure little button determines how the queries in each of the panels get broken up before they are sent off to the database. This button pops open a dropdown that lists different "query terminators." Query terminators are used as a flag to indicate (when present at the end of a line) that the current statement has ended. The terminator does not get sent to the database; instead, it merely idicates how I should parse the text before I execute the query.
Oftentimes, you won't need to touch this button; the main value this feature will have is in defining stored procedures. This is because it is often the case that within a stored procedure's body definition, you might want to end a line with a semicolon (this is often the case). Since my default query terminator is also a semicolon, there is no obvious way for me to see that your stored procedure's semicolon isn't actually the end of the query. Left with the semicolon terminator, I would break up your procedure definition into incorrect parts, and errors would certainly result. Changing the query terminator to something other than a semicolon avoids this problem.
Why are there two strange-looking options for SQLite?
SQLite is something of a special case amongst the various database types I support. I could have implemented it the same way as the others, with a backend host doing the query execution, but what fun is that? SQLite's "lite" nature allowed for some interesting alternatives.
First, I found the very neat project SQL.js, which is an implementation of the engine translated into javascript. This means that instead of using my servers (and my limited memory), I could offload the work onto your browser! Great for me, but unfortunately SQL.js does have a few drawbacks. One is that it taxes the browser a bit when it is first loaded into memory. The other is that it doesn't work in all browsers (so far I've seen it fail in IE9 and mobile Safari).
The other option is "WebSQL." This option makes use of the SQLite implementation that a few browsers come with built-in (I've seen it work in Chrome and Safari; supposedly Opera supports this too). This feature was considered part of the W3C working draft for HTML5, but they depricated it in favor of IndexedDB. Despite this, a few browsers (particularly mobile browsers) still have it available, so I figured that this would be a useful feature to grab onto. The advantage over SQL.js is that it is quite a bit faster to load the schema and run the queries. The disadvantage is that it isn't widely supported, and likely not long for this world.
Together, these two options allow SQLite to run within any decent browser *cough*IE*cough*. If someone links you to a SQLite fiddle that your browser doesn't support, just switch over to the other option and build it using that one. If neither works, then get a better browser.
Who should I contact for help/feedback?
There are two ways you can get in contact:
- Email : admin<at>sqlfiddle<dot>com
- Twitter: @sqlfiddle
Who built this site, and why?
SQLFiddle.com was built by me, Jake Feasel, a web developer originally from Anchorage, Alaska and now living in Vancouver, WA. I started developing the site around the middle of January, 2012.
I had been having fun answering questions on StackOverflow, particularly related to a few main categories: ColdFusion, jQuery, and SQL.
I found JS Fiddle to be a great tool for answering javascript / jQuery questions, but I also found that there was nothing available that offered similar functionality for the SQL questions. So, that was my inspiration to build this site. Basically, I built this site as a tool for developers like me to be more effective in assisting other developers.
Ramon Roche helped me to get the UI moved to Bootstrap, and just generally helped to make it look a lot better. This has been my first time using Bootstrap, and without his assistance getting started I'm sure it would have been a lot rougher. Thanks Ramon!
How is the site paid for?
Originally, my costs for operating this site were very low - basically, I had a free ride on the cloud hosting environment purchased by my former employer, GeoNorth. However, as I moved on to different employment, I knew I would no longer have this luxury. Fortunately, the site has had enough usage since it's initial rollout to gain a sponsor's interest. So, thanks to the very good folks at SQL Sentry, I am able to cover the costs of running this site.
Sponsorship aside, server memory is still tight and I would like to expand. If you would like to help me run this site, then you have several options to do so. First, you could visit SQL Sentry by clicking on the ad on the bottom of the main page, and try out their products. Second, you can click on the Flattr link at the top of the page and kick me a little micro-donation. Flattr is a new service so I know a lot of people haven't started using it yet; if you're more comfortable with PayPal, and would like to help me out with running the site that way, I'd really love to have your support. My admin at sqlfiddle dot com address is hooked up with PayPal, so please feel free to help me out that way.
One of the biggest contributors I have for the site is Jack Douglas, from dba.stackexchange.com. Jack has provided many of the VPS instances that I'm using to run the non-primary versions of various databases. Thanks Jack!
Source Code
If you are interested in the fine details of the code behind SQL Fiddle, it is all available on github
What platform is it running on?
This site uses many different technologies. The primary ones used to provide the core service, in order from client to server are these:
| Title | Description |
|---|---|
| RequireJS js | JavaScript module loader and code optimizer. |
| CodeMirror js | For browser-based SQL editing with text highlighting. |
| Bootstrap css | Twitter's CSS framework (v2). |
| LESS css | CSS pre-processor. |
| Backbone.js js | MV* JavaScript framework. |
| Handlebars.js js | JavaScript templating engine. |
| Lodash.js js | Functional programming library for Javascript. |
| Date.format.js js | Date formatting JavaScript library. |
| jQuery js | AJAX, plus misc JS goodness. (Also jq plugins Block UI and Cookie). |
| html-query-plan js | XSLT for building rich query plans for SQL Server. |
| OpenIDM backend | Open Source Java-based Application Server. |
| Varnish backend | Content-caching reverse proxy. |
| PostgreSQL db | Among others, of course, but PG is the central database host for this platform. |
| Ubuntu os | Linux distribution. |
| Amazon AWS hosting | VPS Cloud Hosting Provider. |
| Grunt devops | Javascript task runner, config and frontend build automation. |
| Maven devops | Dependency management, backend build automation. |
| Vagrant devops | VM management. |
| GitHub devops | Git repository, collaboration environment. |
This list doesn't include the stacks used to run the database engines. Those are pretty standard installs of the various products. For example, I'm running a Windows 2008 VPS running SQL Server 2014 and Oracle, and various Ubuntu VPS instances running the others.


--- layout: page permalink: /about/ title: About ---
My name is Quoc Tin Phan (Phan Quốc Tín in Vietnamese), the 3rd-year PhD student in ICT Doctoral School, University of Trento, Italy.
I am working under the joint supervision of Prof. Giulia Boato and Prof. Francesco G. B. De Natale. My expected year of graduation is 2019.
My research focuses on multimedia forensics which refers to analyses on the semantic level or pixel level of images for legality matters. Data representation, feature extraction and unsupervised learning techniques are three main themes in my research.
Please find my CV here.
Contact me by email quoctin.phan@unitn.it


---
layout: post
title: "FluentValidation 3.4 available"
---
FluentValidation 3.4 is now available to download.
This release contains the following changes:
- Work around for a bug in .NET 4.5 that causes a VerificationException at runtime
- Make ValidationResut.IsValid virtual
- Add private no-arg ctor to ValidationFailure to help with serialization
- Add Turkish error messages
- Added a Silverlight 5 build
- Assemblies are now unsigned by default (although signed versions are also available via NuGet)
You can download binaries from the project site or by using NuGet. Package IDs are:
- FluentValidation (for .NET, Silverlight 4, Silverlight 5)
- FluentValidation-signed (signed binaries for .NET, SL4 and SL5)
- FluentValidation.MVC4 (ASP.NET MVC 4 integration)
- FluentValidation.MVC4-signed (signed binaries for MVC4 integration)
- FluentValidation.MVC3 (ASP.NET MVC 3 integration)
- FluentValidation.MVC3-signed (signed binaries for MVC3 integration)


StubResponse
open class StubResponse
StubResponse
is the base response to simulate URLResponses
.
It defines the HTTP Status code, the Responder Header and Body.
It can also define a delay in seconds, simulating delayed server responses.
-
Base initializer. Keep all the default properties’ values.
Declaration
Swift
public init()
-
Initializes the response with a given data for the body.
Declaration
Swift
public init(data: Data)
Parameters
data
A Data object to be used as is in the body.
-
Initializes the response with a given JSON as the body data.
Declaration
Swift
public init(json: [String : Any])
Parameters
json
A Dictionary using JSON standards.
-
Initializes the response with a given UTF8 string as the body data.
Declaration
Swift
public init(string: String)
Parameters
string
A String in UTF8 format.
-
Initializes the response with the content of a given file.
Declaration
Swift
public init(filename: String, ofType type: String, bundle: Bundle = .main)
Parameters
filename
A String with the file name only, no extension.
type
A string with the file extension only.
bundle
The bundle where the file is localed. By default it’s
.main
.
-
Returns the same response object with a new delay.
Declaration
Swift
open func withDelay(_ time: Double) -> Self
Parameters
time
A Double representing the delay in seconds.
Return Value
The same response with a new delay.
-
Returns the same response object with a new body.
Declaration
Swift
open func withBody(_ data: Data?) -> Self
Parameters
data
A Data as the new body.
Return Value
The same response with a new body.
-
Returns the same response object with a new status code.
Declaration
Swift
open func withStatusCode(_ code: Int) -> Self
Parameters
code
A String as the new status code.
Return Value
The same response with a new status code.
-
Returns the same response object with a new headers.
Declaration
Swift
open func withHeaders(_ httpHeaders: [String : String]) -> Self
Parameters
httpHeaders
A Dictionary with the new headers.
Return Value
The same response with a header.


Creates a new Graph
instance with the same shape but with a reduced
number of nodes and edges. Each instance of multiple nodes and edges in a
chain with no forks is converted into a single edge, where the removed
nodes are converted into inner locations of the new edge. In particular,
the new graph will have no nodes of degree 2 except for nodes with only
one edge connecting to themselves. This may significantly increase the
speed of certain calculations, such as getShortestPath.
A newly created edge will have the lowest ID of the edges which were combined to form it, where numbers are considered lower than strings.
A new coalesced Graph
instance.
All the edges present in this graph, in the order that they were originally provided to Graph.create.
All the nodes present in this graph, in the order that they were originally provided to Graph.create.
Returns the closest point on the graph to a given location. This requires the graph to have a spatial index. To enable this, first use withClosestPointMesh to obtain a new graph instance with an index enabled. Calling this method on a graph with no index will throw.
A location.
The point on the graph closest to the given location, up to a precision determined by the graph's mesh.
A list of new Graph
instances, each representing a single
connected component of this instance.
An edge ID.
The Edge
associated with the given ID, or undefined
if none
exists. Note that the type signature is a lie (it claims to be
non-nullable). This is for convenience. Lookup will usually be of known
edge IDs, and this is consistent with the typings for index lookup in
objects.
Returns the Cartesian coordinates of the point a certain distance along an edge. Does not throw on out-of-bounds distances. Instead negative distances return the start of the edge and distances greater than the length return the end of the edge. This is to avoid unexpected behavior due to floating-point imprecision issues.
A point specified as a certain distance along an edge.
The Cartesian coordinates of the given point.
A node ID.
The Node
associated with the given ID, or undefined
if none
exists. Note that the type signature is a lie (it claims to be
non-nullable). This is for convenience. Lookup will usually be of known
node IDs, and this is consistent with the typings for index lookup in
objects.
Given an edge and one of its endpoints, return the other endpoint. Throws if either of the IDs is nonexistent, or if the node is not an endpoint of the edge.
The node which is the other endpoint of the edge with the given ID.
Does preprocessing to enable getClosestPoint by creating a spatial index of points along the graph.
How fine the mesh should be. Lower precision is more
accurate but takes more time to precompute and more memory. As a
rule-of-thumb, getClosestPoint will be accurate to within precision
distance.
A new Graph
instance with a spatial index enabled.
Helper function for computing progress down a path after advancing along it for a given distance. If the distance is greater than the total length of the path, then advances to the end of the path. Throws on negative distances.
A list of locations representing a path.
A distance down the path.
A new list of locations representing the remaining part of
locations
after advancing distance
along the path.
Returns a new path obtained by truncating the given path by the provided distance. That is, the start point of the path moves forward, and any nodes and edges that it passes are dropped. Throws an error if distance is negative.
A path.
A distance to travel along the path.
The remaining portion of path
after traveling distance
along
it.
A list of nodes.
A list of edges.
A new Graph
instance with the specified nodes and edges.
Generated using TypeDoc
A graph composed of Nodes and Edges, representing 2-D spatial points and links between them. Provides methods for reading and analyzing its data.
The graph and all its data are immutable. No method will modify the
Graph
instance on which it is called, although some will return new instances.New
Graph
instances are created using Graph.create, which takes SimpleNodes and SimpleEdges as arguments. Upon construction, the graph creates corresponding Node and Edge instances which contain additional information. AllGraph
methods will return theseNode
s rather than the originalSimpleNode
s, and likewise for edges.Example usage:
import Graph from "graphs-and-paths"; const nodes = [ { id: "A", location: { x: 0, y: 0 } }, { id: "B", location: { x: 3, y: 0 } }, { id: "C", location: { x: 0, y: 4 } } ]; const edges = [ { id: "AB", startNodeId: "A", endNodeId: "B" }, { id: "BC", startNodeId: "B", endNodeId: "C" }, { id: "CA", startNodeId: "C", endNodeId: "A" } ]; const graph = Graph.create(nodes, edges); graph.getNode("A"); // { id: "A", location: { x: 0, y: 0 }, edgeIds: ["AB", "CA"] } graph.getLocation("AB", 2); // { x: 2, y: 0 } graph.getShortestPath( { edgeId: "CA", distance: 3 }, { edgeId: "BC", distance: 1 } ).locations; // [ // { x: 0, y: 1 }, // { x: 0, y: 0 }, // { x: 3, y: 0 }, // { x: 2.4, y: 0.8 } // ]


The check list provides a similar functionality to the “Multi” ListDiaog, although you can adjust its initial check states with an object structure.


Bite Size Bayes¶
Copyright 2020 Allen B. Downey
License: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
Review¶
In the previous notebook we started with Bayes’s Theorem, written like this:
\(P(A|B) = P(A) ~ P(B|A) ~/~ P(B)\)
And applied it to the case where we use data, \(D\), to update the probability of a hypothesis, \(H\). In this context, we write Bayes’s Theorem like this:
\(P(H|D) = P(H) ~ P(D|H) ~/~ P(D)\)
And give each term a name:
\(P(H)\) is the “prior probability” of the hypothesis, which represents how confident you are that \(H\) is true prior to seeing the data,
\(P(D|H)\) is the “likelihood” of the data, which is the probability of seeing \(D\) if the hypothesis is true,
\(P(D)\) is the “total probability of the data”, that is, the chance of seeing \(D\) regardless of whether \(H\) is true or not.
\(P(H|D)\) is the “posterior probability” of the hypothesis, which indicates how confident you should be that \(H\) is true after taking the data into account.
We used Bayes’s Theorem to solve a cookie-related problem, and I presented the Bayes table, a way to solve Bayesian problems more generally. I didn’t really explain how it works, though. That’s the goal of this notebook.
I’ll start by extending the table method to a problem with more than two hypotheses.
More hypotheses¶
One nice thing about the table method is that it works with more than two hypotheses. As an example, let’s do another version of the cookie problem.
Suppose you have five bowls:
Bowl 0 contains no vanilla cookies.
Bowl 1 contains 25% vanilla cookies.
Bowl 2 contains 50% vanilla cookies.
Bowl 3 contains 75% vanilla cookies.
Bowl 4 contains 100% vanilla cookies.
Now suppose we choose a bowl at random and then choose a cookie, and we get a vanilla cookie. What is the posterior probability that we chose each bowl?
Here’s a table that represents the five hypotheses and their prior probabilities:
import pandas as pd
table = pd.DataFrame()
table['prior'] = 1/5, 1/5, 1/5, 1/5, 1/5
table
| prior | |
|---|---|
| 0 | 0.2 |
| 1 | 0.2 |
| 2 | 0.2 |
| 3 | 0.2 |
| 4 | 0.2 |
The likelihood of drawing a vanilla cookie from each bowl is the given proportion of vanilla cookies:
table['likelihood'] = 0, 0.25, 0.5, 0.75, 1
table
| prior | likelihood | |
|---|---|---|
| 0 | 0.2 | 0.00 |
| 1 | 0.2 | 0.25 |
| 2 | 0.2 | 0.50 |
| 3 | 0.2 | 0.75 |
| 4 | 0.2 | 1.00 |
Once we have priors and likelihoods, the remaining steps are always the same. We compute the unnormalized posteriors:
table['unnorm'] = table['prior'] * table['likelihood']
table
| prior | likelihood | unnorm | |
|---|---|---|---|
| 0 | 0.2 | 0.00 | 0.00 |
| 1 | 0.2 | 0.25 | 0.05 |
| 2 | 0.2 | 0.50 | 0.10 |
| 3 | 0.2 | 0.75 | 0.15 |
| 4 | 0.2 | 1.00 | 0.20 |
And the total probability of the data.
prob_data = table['unnorm'].sum()
prob_data
0.5
Then divide through to get the normalized posteriors.
table['posterior'] = table['unnorm'] / prob_data
table
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| 0 | 0.2 | 0.00 | 0.00 | 0.0 |
| 1 | 0.2 | 0.25 | 0.05 | 0.1 |
| 2 | 0.2 | 0.50 | 0.10 | 0.2 |
| 3 | 0.2 | 0.75 | 0.15 | 0.3 |
| 4 | 0.2 | 1.00 | 0.20 | 0.4 |
Two things you might notice about these results:
One of the hypotheses has a posterior probability of 0, which means it has been ruled out entirely. And that makes sense: Bowl 0 contains no vanilla cookies, so if we get a vanilla cookie, we know it’s not from Bowl 0.
The posterior probabilities form a straight line. We can see this more clearly by plotting the results.
import matplotlib.pyplot as plt
table['posterior'].plot(kind='bar')
plt.xlabel('Bowl #')
plt.ylabel('Posterior probability');
Exercise: Use the table method to solve the following problem and plot the results as a bar chart.
The blue M&M was introduced in 1995. Before then, the color mix in a bag of plain M&Ms was (30% Brown, 20% Yellow, 20% Red, 10% Green, 10% Orange, 10% Tan).
Afterward it was (24% Blue , 20% Green, 16% Orange, 14% Yellow, 13% Red, 13% Brown).
A friend of mine has two bags of M&Ms, and he tells me that one is from 1994 and one from 1996. He won’t tell me which is which, but he gives me one M&M from each bag. One is yellow and one is green. What is the probability that the yellow M&M came from the 1994 bag?
Hint: If the yellow came from 1994, the green must have come from 1996. By Theorem 2 (conjunction), the likelihood of this combination is (0.2)(0.2).
# Solution
table = pd.DataFrame(index=['1994', '1996'])
table['prior'] = 1/2, 1/2
table['likelihood'] = (0.2 * 0.2), (0.14 * 0.1)
table['unnorm'] = table['prior'] * table['likelihood']
prob_data = table['unnorm'].sum()
table['posterior'] = table['unnorm'] / prob_data
table
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| 1994 | 0.5 | 0.040 | 0.020 | 0.740741 |
| 1996 | 0.5 | 0.014 | 0.007 | 0.259259 |
# Solution
table['posterior'].plot(kind='bar')
plt.xlabel('Year')
plt.ylabel('Posterior probability');
Why does this work?¶
Now I will explain how the table method works, making two arguments:
First, I’ll show that it makes sense to normalize the posteriors so they add up to 1.
Then I’ll show that this step is consistent with Bayes’s Theorem, because the total of the unnormalized posteriors is the total probability of the data, \(P(D)\).
Here’s the first argument. Let’s start with Bayes’s Theorem:
\(P(H|D) = P(H) ~ P(D|H)~/~P(D)\)
Notice that the denominator, \(P(D)\), does not depend on \(H\), so it is the same for all hypotheses. If we factor it out, we get:
\(P(H|D) \sim P(H) ~ P(D|H)\)
which says that the posterior probabilities are proportional to the unnormalized posteriors. In other words, if we leave out \(P(D)\), we get the proportions right, but not the total.
Then how do we figure out the total? Well, in this example we know that the cookie came from exactly one of the bowls. So the hypotheses are:
Mutually exclusive, that is, only one of them can be true, and
Collectively exhaustive, that is, at least one of them must be true.
Exactly one of the hypotheses must be true, so the posterior probabilities have to add up to 1. Most of the time, the unnormalized posteriors don’t add up to 1, but when we divide through by the total, we ensure that the normalized posteriors do.
That’s the first argument. I hope it makes some sense, but if you don’t find it entirely satisfying, keep going.
Rolling the dice¶
Before I can make the second argument, we need one more law of probability, which I will explain with a new example:
Suppose you have a 4-sided die and a 6-sided die. You choose one at random and roll it. What is the probability of getting a 1?
To answer that, I’ll define two hypotheses and a datum:
\(H_4\): You chose the 4-sided die.
\(H_6\): You chose the 6-sided die.
\(D\): You rolled a 1.
 So we can write the conditional probabilities:
\(P(D|H_4) = 1/4\)
\(P(D|H_6) = 1/6\)
And if the probability of choosing either die is equal, we know the prior probabilities:
\(P(H_4) = 1/2\)
\(P(H_6) = 1/2\)
But what is the total probability of the data, \(P(D)\)?
At this point your intuition might tell you that it is the weighted sum of the conditional probabilities:
\(P(D) = P(H_4)P(D|H_4) + P(H_6)P(D|H_6)\)
Which is
\(P(D) = (1/2)(1/4) + (1/2)(1/6)\)
Which is
(1/2)*(1/4) + (1/2)*(1/6)
0.20833333333333331
And that’s correct. But if your intuition did not tell you that, or if you would like to see something closer to a proof, keep going.

Using math notation, \(D\) is true if:
\((H_4 ~and~ D) ~or~ (H_6 ~and~ D)\)
We’ve already seen the \(and\) operator, also known as “conjunction”, but we have not yet seen the \(or\) operator, which is also known as “disjunction”?
For that, we a new rule, which I’ll call Theorem 4:
\(P(A ~or~ B) = P(A) + P(B) - P(A ~and~ B)\)
To see why that’s true, let’s take a look at the Venn diagram:
What we want is the total of the blue, red, and purple regions. If we add \(P(A)\) and \(P(B)\), we get the blue and red regions right, but we double-count the purple region. So we have to subtract off one purple region, which is \(P(A ~and~ B)\).
Exercise: Let’s do a quick example using disjunction.
A standard deck of playing cards contains 52 cards;
26 of them are red,
12 of them are face cards, and
6 of them are red face cards.
The following diagram shows what I mean: the red rectangle contains the red cards; the blue rectangle contains the face cards, and the overlap includes the red face cards.
If we choose a card at random, here are the probabilities of choosing a red card, a face card, and a red face card:
p_red = 26/52
p_face = 12/52
p_red_face = 6/52
p_red, p_face, p_red_face
(0.5, 0.23076923076923078, 0.11538461538461539)
Use Theorem 4 to compute the probability of choosing a card that is either red, or a face card, or both:
# Solution
p_red_or_face = p_red + p_face - p_red_face
p_red_or_face
0.6153846153846154
Total probability¶
In the dice example, \(H_4\) and \(H_6\) are mutually exclusive, which means only one of them can be true, so the purple region is 0. Therefore:
\(P(D) = P(H_4 ~and~ D) + P(H_6 ~and~ D) - 0\)
Now we can use Theorem 2 to replace the conjunctions with conditonal probabilities:
\(P(D) = P(H_4)~P(D|H_4) + P(H_6)~P(D|H_6)\)
By a similar argument, we can show that this is true for any number of hypotheses. For example, if we add an 8-sided die to the mix, we can write:
\(P(D) = P(H_4)~P(D|H_4) + P(H_6)~P(D|H_6) + P(H_8)~P(D|H_8)\)
And more generally, with any number of hypotheses \(H_i\):
\(P(D) = \sum_i P(H_i)~P(D|H_i)\)
Which shows that the total probability of the data is the sum of the unnormalized posteriors.
And that’s why the table method works.
 You choose one at random and roll it. What is the probability of getting a 1?
We can use a Bayes table to compute the answer. Here are the priors:
table = pd.DataFrame(index=['H4', 'H6'])
table['prior'] = 1/2, 1/2
table
| prior | |
|---|---|
| H4 | 0.5 |
| H6 | 0.5 |
And the likelihoods:
table['likelihood'] = 1/4, 1/6
table
| prior | likelihood | |
|---|---|---|
| H4 | 0.5 | 0.250000 |
| H6 | 0.5 | 0.166667 |
Now we compute the unnormalized posteriors in the usual way:
table['unnorm'] = table['prior'] * table['likelihood']
table
| prior | likelihood | unnorm | |
|---|---|---|---|
| H4 | 0.5 | 0.250000 | 0.125000 |
| H6 | 0.5 | 0.166667 | 0.083333 |
And the total probability of the data:
prob_data = table['unnorm'].sum()
prob_data
0.20833333333333331
That’s what we got when we solved the problem by hand, so that’s good.
 You choose one at random and roll it, what is the probability of getting a 1?
Do you expect it to be higher or lower than in the previous example?
# Solution
table = pd.DataFrame(index=['H4', 'H6', 'H8'])
table['prior'] = 1/3, 1/3, 1/3
table['likelihood'] = 1/4, 1/6, 1/8
table['unnorm'] = table['prior'] * table['likelihood']
table
| prior | likelihood | unnorm | |
|---|---|---|---|
| H4 | 0.333333 | 0.250000 | 0.083333 |
| H6 | 0.333333 | 0.166667 | 0.055556 |
| H8 | 0.333333 | 0.125000 | 0.041667 |
# Solution
prob_data = table['unnorm'].sum()
prob_data
0.18055555555555555
Prediction and inference¶
In the previous section, we use a Bayes table to solve this problem:
Suppose you have a 4-sided die and a 6-sided die. You choose one at random and roll it. What is the probability of getting a 1?
I’ll call this a “prediction problem” because we are given a scenario and asked for the probability of a predicted outcome.
 You choose one at random, roll it, and get a 1.
I’ll call this an “inference problem” because we are given the outcome and asked to figure out, or “infer”, which die was rolled.
Here’s a solution:
table = pd.DataFrame(index=['H4', 'H6'])
table['prior'] = 1/2, 1/2
table['likelihood'] = 1/4, 1/6
table['unnorm'] = table['prior'] * table['likelihood']
prob_data = table['unnorm'].sum()
table['posterior'] = table['unnorm'] / prob_data
table
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| H4 | 0.5 | 0.250000 | 0.125000 | 0.6 |
| H6 | 0.5 | 0.166667 | 0.083333 | 0.4 |
Given that the outcome is a 1, there is a 60% chance the die you rolled was 4-sided.
As this example shows, prediction and inference closely-related problems, and we can use the same methods for both.
 You choose one at random and roll it. What is the probabily of getting a 1?
Now suppose the outcome is a 1.  And what are the posterior probabilities for the other dice?
# Solution
table = pd.DataFrame(index=['H4', 'H6', 'H8', 'H12'])
table['prior'] = 1/4, 1/4, 1/4, 1/4
table['likelihood'] = 1/4, 1/6, 1/8, 1/12
table['unnorm'] = table['prior'] * table['likelihood']
prob_data = table['unnorm'].sum()
prob_data
0.15625
# Solution
table['posterior'] = table['unnorm'] / prob_data
table
| prior | likelihood | unnorm | posterior | |
|---|---|---|---|---|
| H4 | 0.25 | 0.250000 | 0.062500 | 0.400000 |
| H6 | 0.25 | 0.166667 | 0.041667 | 0.266667 |
| H8 | 0.25 | 0.125000 | 0.031250 | 0.200000 |
| H12 | 0.25 | 0.083333 | 0.020833 | 0.133333 |
Summary¶
In this notebook, I introduced a new law of probability, so now we have four:
Theorem 1 gives us a way to compute a conditional probability using a conjunction:
\(P(A|B) = \frac{P(A~\mathrm{and}~B)}{P(B)}\)
Theorem 2 gives us a way to compute a conjunction using a conditional probability:
\(P(A~\mathrm{and}~B) = P(B) P(A|B)\)
Theorem 3 gives us a way to get from \(P(A|B)\) to \(P(B|A)\), or the other way around:
\(P(A|B) = \frac{P(A) P(B|A)}{P(B)}\)
Theorem 4 gives us a way to compute a disjunction using a conjunction.
\(P(A ~or~ B) = P(A) + P(B) - P(A ~and~ B)\)
Then we used Theorems 2 and 4 to show that the sum of the unnormalized posteriors is the total probability of the data, which we wrote like this:
\(P(D) = \sum_i P(H_i)~P(D|H_i)\)
This conclusion is useful for two reasons:
It provides a way to compute the probability of future data using prior probabilities and likelihoods, and
It explains why the Bayes table method works.
In the next notebook we will explore a famously useful application of Bayes’s Theorem, medical testing.


Class Credentials
Holds the core primitives that make up the authentication and authorization token of a Smartcrypt identity. This object is not thread safe.
Inherited Members
Namespace: PKWARE.Smartcrypt.MetaClient
Assembly: MetaClient.dll
Syntax
public sealed class Credentials
Remarks
At it's very core, a Smartcrypt identity is a RSA key pair. We use a username as a front to this identity, and the user uses a password to gain access to the identity. We generate an AES key from the password using PBKDF2 and use this AES key to encrypt the private key before storing it on MDS. We use the Sid to track the private key, Pid to track the public key and the username (in the form of an email address), and User to track the PBKDF2 parameters.
Properties
LoginRounds
The number of rounds used for PBKDF2.
Declaration
public int LoginRounds { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
LoginSalt
The salt used for PBKDF2.
Declaration
[CanBeNull]
public string LoginSalt { get; }
Property Value
| Type | Description |
|---|---|
| String |
LoginUrn
URN of the identity.
Declaration
[CanBeNull]
public string LoginUrn { get; }
Property Value
| Type | Description |
|---|---|
| String |
PrivateKey
DER encoded RSA private key.
Declaration
[CanBeNull]
public byte[] PrivateKey { get; }
Property Value
| Type | Description |
|---|---|
| Byte[] |
PrivateKeyV6
The V6 encrypted RSA private key.
Declaration
[NotNull]
public string PrivateKeyV6 { get; }
Property Value
| Type | Description |
|---|---|
| String |
Methods
CalculateSHash(String)
Calculates the SHash for these credentials given a SID locator.
Declaration
[NotNull]
[Pure]
public string CalculateSHash([NotNull] string sidLocator)
Parameters
| Type | Name | Description |
|---|---|---|
| String | sidLocator | The locator to decrypt and produces the SHash from. |
Returns
| Type | Description |
|---|---|
| String | The SHash. |
Exceptions
| Type | Condition |
|---|---|
| MetaClientException | With Category of CategoryUpgrade if the data are newer than understood by this software. With Category of CategoryInternal if the data are in an invalid format. |
ForExistingAccount(ICryptoProvider, String, String, String, Int32)
Creates a new Credentials and initializes it with the parameters of an existing Smartcrypt identity.
Declaration
[NotNull]
public static Credentials ForExistingAccount([NotNull] ICryptoProvider cryptoProvider, [NotNull] string password, [NotNull] string urn, [NotNull] string salt, int rounds)
Parameters
| Type | Name | Description |
|---|---|---|
| ICryptoProvider | cryptoProvider | The ICryptoProvider to use for cryptographic primitives. |
| String | password | The user's password. |
| String | urn | The URN of the identity. |
| String | salt | The salt used for PBKDF2 during login. |
| Int32 | rounds | The number of rounds with which to run PBKDF2. |
Returns
| Type | Description |
|---|---|
| Credentials | A initialized instance ready to decrypt the RSA private key. |
GetLoginToken(String)
Retrieves the optionally encrypted login token.
Declaration
[NotNull]
public string GetLoginToken([CanBeNull] string publicKey = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | publicKey | An optional V2-formatted public RSA key. If provided, the login token is encrypted for this key. |
Returns
| Type | Description |
|---|---|
| String | The login token in either plaintext or in the V2 format. |
Exceptions
| Type | Condition |
|---|---|
| MetaClientException | With Category of CategoryUpgrade if the data are newer than understood by this software. With Category of CategoryInternal if the data are in an invalid format. With Category of CategoryClient if all required parameters were not provided. |
GetLoginTokenHash(String)
Retrieves the optionally encrypted login token hash.
Declaration
[NotNull]
public string GetLoginTokenHash([CanBeNull] string publicKey = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | publicKey | An optional V2-formatted public RSA key. If provided, the login token hash is encrypted for this key. |
Returns
| Type | Description |
|---|---|
| String | The login token hash in either plaintext or in the V2 format. |
Exceptions
| Type | Condition |
|---|---|
| MetaClientException | With Category of CategoryUpgrade if the data are newer than understood by this software. With Category of CategoryInternal if the data are in an invalid format. With Category of CategoryClient if all required parameters were not provided. |
LoadPrivateKey(String)
Decrypts an encrypted private key using the password-derived AES key.
Declaration
public bool LoadPrivateKey([NotNull] string privateKey)
Parameters
| Type | Name | Description |
|---|---|---|
| String | privateKey | The private key to decrypt. Must be in the V6 format. |
Returns
| Type | Description |
|---|---|
| Boolean |
|
Exceptions
| Type | Condition |
|---|---|
| MetaClientException | With Category of CategoryUpgrade if the data are newer than understood by this software. |


Trying out Box2d
What is Box2D? It’s a free and open source 2D physics engine. It is developed with C++, and has fortunately been ported to many other languages, including Actionscript and Java. I was eager to try it out.
At the same time, I was eager to get more familiar with the new C++11 standard I’ve been hearing about (a.k.a. C++0x). So I made a small program to get a taste of Box2D and C++11 features. You can view and download the program here.
To use it, drag out a rectangle with your mouse. When you release the mouse, the rectangle becomes a object in the world. It is affected by gravity, and interacts realistically with other objects. If you happen to own a touch screen, you can press space to hide the mouse cursor. You’re welcome.
Mixing Box2D with SFML graphics was a quite tricky. To keep track of the objects, I created an std::vector of this struct:
typedef struct {
shared_ptr graphic;
shared_ptr body;
} PhysicsObject;
There was a problem though: The Box2D world’s coordinates are 1 unit = 1 meter, and the Y-axis increases upwards. SFML coordinates, however, are more conventional computer graphics coordinates: 1 unit = 1 pixel, and the Y-axis increased downwards. To add to these troubles, the SFML view (sf::view) has to be able to scale (zoom) and move around the world.
To overcome this issue, I did two things. First, I made the Environment class update an internal static sf::view during each render, representing what view should be rendered to the window. However, I always keep the window’s view the default view. The internal sf::view is only for the second thing I did: I made two static functions in the Environment for translating world coordinates to screen coordinates, and vice versa.
/*
* Translate screen coordinates into world coordinates
*/
b2Vec2 Environment::ScreenToWorldPosition(b2Vec2 vec) {
vec.x /= pixelsPerMeter;
vec.y /= -pixelsPerMeter;
vec.x -= (view.GetCenter().x + view.GetHalfSize().x);
vec.y -= (-view.GetCenter().y + view.GetHalfSize().y);
return vec;
}
/*
* Translate world coordinates into screen coordinates
*/
b2Vec2 Environment::WorldToScreenPosition(b2Vec2 vec) {
vec.x += (view.GetCenter().x + view.GetHalfSize().x);
vec.y += (-view.GetCenter().y + view.GetHalfSize().y);
vec.x *= pixelsPerMeter;
vec.y *= -pixelsPerMeter;
return vec;
}
With that, all I had to do to render them is iterate through all PhysicsObject elements in the vector, update the scale of the sf::Shape, update the position and rotation (while converting radians to degrees), and draw it to the supplied sf::RenderTarget:
/* Render objects */
for (shared_ptr &obj : objects) {
b2Vec2 pos = WorldToScreenPosition(obj->body->GetPosition());
obj->graphic->SetScale(
pixelsPerMeter * zoomFactor,
pixelsPerMeter * zoomFactor);
obj->graphic->SetPosition(pos.x, pos.y);
obj->graphic->SetRotation(rad2deg(obj->body->GetAngle()));
target.Draw(*obj->graphic);
}
And voilà!
As for C++11, I got a pretty nice taste of it. My favorite feature is the smart pointer, which owns and manages pointers and object instances. In particular, shared_ptr allows you to easily set a custom destroy function in the form of a lambda — another C++11 feature I love. Here’s one line of my program that uses both of these features nicely, and even uses auto — another syntactical gift provided by the new standard):
// Will be automatically destroyed by world
auto body = shared_ptr(world->CreateBody(&blockDef),
[this](b2Body *ptr) { world->DestroyBody(ptr); });
The line above creates a shared_ptr containing a b2Body — a rigid body in the Box2D engine. It also sets and implements a custom destroy function. You can’t simply delete a b2Body instance; you must pass it to the b2World’s DestroyBody method instead.  I can now continue to write code worry-free, knowing that as soon as body is no longer in use, the world will be asked to destroy it!
I’m might be misusing some smart pointers in my code. I’m still learning how to appropriately use them.
The project is found here.
You can download a Windows binary here.


Moderator: Karl G.
Joe M. wrote:Heroes of Might and Magic III.
Joe M. wrote:Best game I've ever played. Fun, plenty of strategy, difficult campaigns, endless replayability.
Rabit561 wrote:I mean only games you STILL play not previously..
sourceofprovidence wrote:Starcraft, Diablo, Xenimus of course. I was a big addict of WOW, but thank god that's over haha.
T&C Surf
Earthbound
Final Fantasy 7
marzuku wrote:sourceofprovidence wrote:Starcraft, Diablo, Xenimus of course. I was a big addict of WOW, but thank god that's over haha.
T&C Surf
Earthbound
Final Fantasy 7
im also a member of AWA(anonymous Wow Addicts)
Btw had a laugh at your signature:P
Forlorn wrote:Everquest hands down.. but back 6-7 years ago when it was fun...
Joe M. wrote:I think it's fair to say EQ at an earlier time: the way online games change it'd be silly to rule out everything but the current incarnation. After all, Evidyon got started to try to capture what made old Xen fun.
Joe M. wrote:newer isn't always better, even with computer games.
Users browsing this forum: No registered users and 1 guest