GWcatepillar
GWcatepillar:A conceptual animation illustrating how gravitational waves distort space. Created for Nergis' Mavalvala's Kavli lecture.
Parameters
There are several variables to control the appearance and behaviour of this dataset.
- GWcatRadius: the size of the markers
- GWcatWaveFactor: the strength of the gravitational wave effect
- GWcatMarkerAlpha: the opacity of the arkers
- GWcatMarkerType: sets the type of marker.
- Gaussian
- soft circle with outline and center dot
- soft circle with center dot
- ring
- hard circle
- GWcatLength: sets the number of rings in the cylinder. Goes from -25 to 25
The module will appear as "GWcatepillar" in the object tree, under /KavliLecture/Mavalvala.
Version
1.0
Created
10 July, 2016
Created By
Mark SubbaRao
Adler Planetarium
Created with the support of the Kavli Foundation
CC-by


vignettes/profiling.Rmd
profiling.Rmd
This vignette demonstrates how to use the new profiling functionality introduced in CmdStan 2.26.0.
Profiling identifies which parts of a Stan program are taking the longest time to run and is therefore a useful guide when working on optimizing the performance of a model.
However, be aware that the statistical assumptions that go into a model are the most important factors in overall model performance. It is often not possible to make up for model problems with just brute force computation. For ideas on how to address performance of your model from a statistical perspective, see (Gelman et al. 2020).
Consider a simple logistic regression with parameters alpha
and beta
, covariates X
, and outcome y
.
data {
int<lower=1> k;
int<lower=0> n;
matrix[n, k] X;
int y[n];
}
parameters {
vector[k] beta;
real alpha;
}
model {
beta ~ std_normal();
alpha ~ std_normal();
y ~ bernoulli_logit(X * beta + alpha);
}
A simple question is how much time do the prior calculations take compared against the likelihood? To answer this we surround the prior and likelihood calculations with profile
statements.
profile("priors") {
target += std_normal_lpdf(beta);
target += std_normal_lpdf(alpha);
}
profile("likelihood") {
target += bernoulli_logit_lpmf(y | X * beta + alpha);
}
We can then run the model as usual and Stan will collect the profiling information for any sections with profile
statements.
library(cmdstanr) # Compile the model model <- cmdstan_model("profiling-files/profiling_bernoulli_logit.stan") # Generate some fake data n <- 1000 k <- 20 X <- matrix(rnorm(n * k), ncol = k) y <- 3 * X[,1] - 2 * X[,2] + 1 p <- runif(n) y <- ifelse(p < (1 / (1 + exp(-y))), 1, 0) mdata <- list(k = ncol(X), n = nrow(X), y = y, X = X) # Run one chain of the model fit <- model$sample(data = mdata, chains = 1)
The raw profiling information can then be accessed with the $profiles()
method, which returns one data frame per chain (profiles across multiple chains are not automatically aggregated). Details on the column names are available in the CmdStan documentation.
fit$profiles()
[[1]]
name thread_id total_time forward_time reverse_time chain_stack
1 likelihood 0x10ea4bdc0 1.00471000 0.85333200 0.15137400 52821
2 priors 0x10ea4bdc0 0.00732542 0.00603501 0.00129041 35214
no_chain_stack autodiff_calls no_autodiff_calls
1 35214000 17607 1
2 0 17607 1
The total_time
column is the total time spent inside a given profile statement. It is clear that the vast majority of time is spent in the likelihood function.
Stan’s specialized glm functions can be used to make models like this faster. In this case the likelihood can be replaced with
target += bernoulli_logit_glm_lpmf(y | X, alpha, beta);
The profiling information for the new model is collected automatically just like the last one.
model_glm <- cmdstan_model("profiling-files/profiling_bernoulli_logit_glm.stan") fit_glm <- model_glm$sample(data = mdata, chains = 1)
fit_glm$profiles()
[[1]]
name thread_id total_time forward_time reverse_time chain_stack
1 likelihood 0x104ce6dc0 0.60116000 0.5994940 0.00166513 17803
2 priors 0x104ce6dc0 0.00946237 0.0080399 0.00142247 35606
no_chain_stack autodiff_calls no_autodiff_calls
1 0 17803 1
2 0 17803 1
We can see from the total_time
column that this is much faster.
The other columns of the profiling output are documented in the CmdStan documentation.
The timing numbers are broken down by forward pass and reverse pass, and the chain_stack
and no_chain_stack
columns contain information about how many autodiff variables were saved in the process of performing a calculation.
These numbers are all totals – times are the total times over the whole calculation, and chain_stack
counts are similarly the total counts of autodiff variables used over the whole calculation. It is often convenient to have per-gradient calculations (which will be more stable across runs with different seeds). To compute these, use the autodiff_calls
column.
profile_chain_1 <- fit$profiles()[[1]] per_gradient_timing <- profile_chain_1["total_time"]/profile_chain_1["autodiff_calls"] print(per_gradient_timing)
total_time
1 5.706310e-05
2 4.160516e-07
After sampling (or optimization or variational inference) finishes, CmdStan stores the profiling data in CSV files in a temporary location. The paths of the profiling CSV files can be retrieved using $profile_files()
.
fit$profile_files()
[1] "/var/folders/h6/14xy_35x4wd2tz542dn0qhtc0000gn/T/Rtmpih4eEt/profiling_bernoulli_logit-profile-202104151144-1-95018c.csv"
These can be saved to a more permanent location with the $save_profile_files()
method.
# see ?save_profile_files for info on optional arguments fit$save_profile_files(dir = "path/to/directory")


Enjoy Chicago's best fried chicken! Sign up to order and receive special deals and points!
Login Check out the MenuVisit our menu and order your favorite chicken meals.
Order delivery today from our locations all over the city!
We make our chicken fresh and deliver it to you hot!


Bayesian Case Competition is a case competition on financial risk management where 12-15 teams of contestants compete to build a developed solution for an open-ended case on market and investment risk mitigation to be presented to a panel of judges. This year's prize pool will consist of $3,000+ in cash prizes and other gift prizes. Bayesian 2018 will take place on January 27th at the University of Waterloo.
Co-hosted by:
Delegates can register below as a team of 3-4 or as an individual competitor. Individual delegates will be matched 1 day prior to case release.
Team Individual January 1, 2018Introduces the ideas behind Bayesian, and answers any questions from attendees concerning the competition. It will be held at 5pm in the DC Fish Bowl. Free for all UWaterloo students, baos and bubble tea will be served.
RSVP on Facebook January 10, 2018General registration for delegates closes at 11:59 PM EST. Delegates or teams registering after this date and prior to Friday, Jan 19th will be admitted at the discretion of the Bayesian planning committee.
January 12, 2018At 11:59 AM EST, the case will be released to all registered teams. All teams will have 12 days to create a case solution.
January 13, 2018Submission is due at 11:59 PM. All slide decks will be vetted and qualifying teams will be invited to the semifinal round on Jan 27th.
January 24, 2018Taking place at STC, from 8:30 AM to 7:00 PM, the day will consist of the competition, workshops, panels, networking sessions, and a networking dinner with our esteemed judges and sponsors. Lunch and dinner will be served. To all delegates, good luck and happy pitching!
January 27, 2018Peter has spent 15 years working in various risk functions across a diverse range of industries, including rating agency, regulation and now RBC. He currently leads the Risk Innovation team within GRM and is tasked with developing RBC Risk’s innovation strategy, fostering communities that will generate potentially disruptive ideas, providing resources to help employees bring their ideas to life and generally making people uncomfortable by asking a lot of questions.
As Director, he leads two teams supporting Global Risk Management, Group Treasury, Regulatory and Compliance at the Bank. Anjan brings with him over 10 years of experience in Risk Management Technology and over 20 years of experience in banking and financial services. He has consulted with over 70% of the world’s largest banks, insurance companies and regulatory organizations and is a strong advocate and partner to co-op programs at various academic institutions.
Currently oversees I.T. infrastructure support for all Risk, Regulatory & Compliance and Group Treasury systems. Frank has over 10yrs experience with Scotiabank - Capital Markets and Global Risk groups. Additionally 15yrs of banking experiences through CIBC and BMO in Retail/Business/Mortgages groups. He also heads up the coop and graduate program for RMIT.
Responsible for the Scotiabank’s Personal/Consumer and Corporate/Commercial credit portfolio stress testing given various macro-economic scenarios. Jasdev has been with the Scotiabank for over 10 years working in areas such as the Project Management Office, Retail Credit Risk, and Mergers and Acquisitions.
Jeanine graduated from UWaterloo with a BMath, Math/Business degree in 2003, and a MMath, Statistics-Finance degree in 2005. She currently serves as the Global Head of Equity Risk at Manulife and is responsible for providing independent risk management oversight. Prior to joining Manulife, she headed up the Financial Engineering team at NN Life in Japan. She is also a Certified Management Accountant.
Edward is a graduate from the Financial Analysis Risk Management Program, class of 2012. After graduation, he joined CIBC as an analyst for its Risk Management Developmental Program, where he completed rotations in market risk, credit risk, and operational risk. He currently serves as the Market Risk Analyst covering equities and FX businesses.
Grace graduated from the Math/Business double degree program in 2015 with an Actuarial Science – Financial option, and Statistics major from UWaterloo, and a Finance concentration from Laurier. After graduation, she worked in VaR analytics and valuation at Canada's leading banks. She currently serves as the xVA manager in Counterparty Risk Trading (CRT) valuations, covering xVA topics.
Jeremy is a graduate from the Math/BBA double-degree program. He currently serves in a Equity Valuations role at RBC Capital Markets where he specializes in equity and equity derivative valuations. His past experiences include delta-one structured products trading @ RBC Capital Markets, fixed income electronic trading @ BMO Capital Markets, project management, covering risk and trading platform projects @ OTPP, and quantitative/technical equity research @ BMO Capital Markets.
Alana is a graduate from the Math/BBA Double Degree Program, Class of 2015. She joined TD Securities Capital Market Risk Management upon graduation as an Equity Valuation Analyst. She has provided continuous guidance to co-op/associate students in her current role. Her past experiences include credit risk management in BMO and Scotiabank.
Peter Blake has a Bachelor of Mathematics degree (Chartered Accountancy - Co-op) from the University of Waterloo and is a Chartered Professional Accountant. After earning his Chartered Professional Accountancy (CPA) with Deloitte Touche in Toronto, Peter worked in the financial services industry for over 20 years in corporate and investment banking, the last 10 of which were spent with a large international bank, managing their financial institutions group.
For general inquiries, please email us at bayesian.uwaterloo@gmail.com


First Pendulum
Mass:
Length:
Angle:
Second Pendulum
Mass:
Length:
Angle:
General
Gravity:
Start simulation
Reset


Masahiro Sakurai Hosting Smash Bros. Ultimate Terry Bogard Livestream On 6th November
And Version 6.0 will "arrive soon"
by Liam DoolanIt looks like Super Smash Bros. Ultimate fans will soon be able to play as SNK's Terry Bogard – with Nintendo announcing Masahiro Sakurai is hosting a 45-minute "video livestream" on 6th November, featuring an in-depth look at the upcoming fighter.
Below is the official announcement, via the Nintendo Versus Twitter account:
In the same announcement, Nintendo said the Version 6.0 update would "arrive soon" and would include fighter adjustments. This means replay data from the previous version will no longer be compatible. You can convert your replays by going to the Vault -> Replays -> Replay Data -> Convert to Video, before updating.
Although this video presentation will be significantly longer than previous ones, Nintendo says there will be no announcements regarding unrevealed fighters:
Are you pumped to play as Terry Bogard? Comment below.
[via twitter.com]


Home
Explore
Districts
Log In
Sign Up
Search
Log In
Email address
We'll never share your email with anyone else.
Password
Type Password
Remember me
Submit
If you are a new user
Sign Up
here


Shaan
Kastuar
Nice to meet you!
I'm a multi-faceted young professional in the NYC area, currently working for The Coconut Cooperative, a three person industrial organic food supplier.
I've recently completed the Media Managemet Graduate Program at The New School, and am seeking to take the next step in my career. I am never afraid to get my hands dirty and dive into unfamiliar territory - I relish the opportunity to gain new experiences, acquire new skills, and learn from those more experienced than I - and as such, am always open to hearing about any opportunity that comes my way.On a personal note, interpersonal social skills are attributes that are an inherent part of my personality. Forging connections with people, learning from others, and teaching new skills are activities I naturally find enjoyable and energizing. As someone who is naturally extroverted, I love people and making friends, thrive on collaboration, and enjoy absorbing knowledge from others, teaching teammates new skills, and brainstorming to create new ideas.
I strive to exist at the intersection of the left and right hemispheres of the brain, and hone my skills towards the goal of occupying the overlap between, creativity, communication, and technical analysis.
I'm also a diehard New York Rangers and New York Giants fan (#LGR!) and have a lifelong passion for creating music.
Feel free to check out some variants of my resume.
Media Focused Resume Technology Focused Resume Long Form ResumeI've listed some of the projects I've worked on below. Browse around, and if you're so inclined, shoot me an email with some advice. Some of these were for intro classes and of a hobbyist nature, but I'm always looking to improve as much as possible in every facet.
Track 1: Interactive resume created for a class project. The subject of the resume is Andrea Tuccillo, a classmate of mine, for a potential podcast position. As such, the resume is presented in the format of a podcast. Original intro music composition and audio editing performed in Ableton Live 9.
Track 2: Accompaniment to a visual narrative that can be located here.A light-hearted narrative, told through audio and still photographs, about completing a school project. I attempted to capture a quizzical, "thinking" feel by using jazz guitar and freeform drums. Created in Ableton Live 9.
Original music created in Ableton Live 9 with a bevy of VSTs (Maschine, Omnisphere, Sylenth1, Massive). Feel free to check out my personal Soundcloud for more original music.
Original music performed by my old band, Meroki. Music composed by Shaan Kastuar (guitar), AJ Russo (bass), and Brian DePhillis (drums).
UNICEF Magic Box Promotional Video from Shaan Kastuar on Vimeo.
Short promotional video with original music and voiceover for UNICEF's Magic Box program. Completed for a graduate school project at The New School's School of Public Engagement's Media Management program. Original music composed and performed in Ableton Live 9 (with use of Maschine and Omnisphere). Video montage created in Adobe Premiere.
Wallet Mystery from Shaan Kastuar on Vimeo.
The first video project I have put together for my Media Design class, which I had taken to familiarize with Adobe Creative Suite. While video production is not my forte, I was grateful for the opportunity to experience the steps in putting together a short video, and gain some insight into the process. Created with Adobe Premiere and Ableton Live.
Spur of the Moment - Concert Finder
First project from the Rutgers Coding Bootcamp Spring 2016 class. A geolocation based concert finder that allows you to search for an artist, and find concerts by similar artists nearby. Created using HTML, CSS, Booststrap, Javascript, jQuery, Google Maps API, BandsInTown API, and AJAX.
Cross Sport Fantasy Football
Second project from RUCB Spring 2016. A prototype model for cross-sport fantasy sports, allowing players to create a team of players across various sports, with weighted point values for equitable scoring. This presentation focuses on the back-end concepts as opposed to client-facing design, as teh front-end was still in development at the time of filming. Created using Handlebars, Express, Node.js, NPM, Javascript, FantasyData API, ORM/MVC structures, SQL, and Ajax.
I have worked at organizations such as GLO Science and Jetaport in which I have routed numerous business processes through Salesforce CRM, inculding but not limited to: advance rule and formula based field customization, order and payment processing, email marketing, 3rd party warehouse inventory management, invoice creation, automated sales reporting, and record management.These functionalities were created with the use of 3rd party integration, workflow rules, Salesforce process builder, and light APEX development. All new features and integrations were performed with an emphasis on usability and cost effectiveness. However, due to the sensitive nature of internal company records, I unfortunately am unable to show any video or live demonstrations. However, please feel free to contact me for references and furhter information (such as process maps and project requirements).
I'm always looking to learn and collaborate, so whether you'd like to give some feedback on my work, join a project together, or just say hello, I'd love to hear from you!


{% extends 'shared/base.html' %} {% load static %} {% block title %}Log-in{% endblock %} {% block content %}
Your username and password didn't match. Please try again.
Please log-in to access RAPTR:


Crystal 0.29.0 has been released!
This release comes with many fixes in the compiler and some polishing in the std-lib. There is some work-in-progress related to multi-threading in other branches and whiteboards still.
There were 116 commits since 0.28.0 by 24 contributors.
Let’s review some of the most relevant changes in this release. But don’t miss the rest of the release changelog which has a lot of valuable information.
Compiler
In #7758 a bug in the require
file path algorithm was fixed. If your shard of application stops compiling it’s maybe due to an extra pair of ../
or a requirement missing. Keep calm and fix the paths.
Since #7582 the compiler is a bit pickier (as it always should’ve been) with respect name of variables. Shouting and asking is no longer allowed, so !
and ?
are disallowed at the end of variables. They are allowed only in methods name (and in the special $?
).
Deprecation warnings were introduced in 0.28.0, and there were a couple of undetected cases. Since #7724 the analysis covers initialize methods and methods with named args. Remember to build and spec with --warnings=all --error-on-warnings
options since this feature is opt-in for now.
Effective error reporting depends heavily on tracking back an AST node to the original location. More cases are now handled since #7827.
During the last couple of releases, we’ve been introducing a couple of feature toggles to introduce new semantics. We were missing a way to run the existing compiler specs against these toggles when they affect low-level phases of the compiler. Maybe #7837 will only be relevant to the ones that want to dig into the compiler itself.
Language semantics
Since #7818 the compiler is a bit more strict regarding how new/initialize methods are defined when they’ve been included from a module
. All in all it aims for consistency with initialize
methods defined in a hierarchy of types.
In #7801 the behaviour of sizeof
and instance_sizeof
is improved for abstract structs and modules. In some cases it used to compile when it shouldn’t, and there could be some wrong sizes returned.
When declaring an enum
flag type its members are Int32
by default, and you are allowed to change the base type to other numeric types like Int8
, UInt16
, etc. Since #7776 64-bits numeric types can be used also without chances of blowing up if there were more than 32 members. #Internals
Tools
The crystal implementation tool got a really useful feature. Since #7742 the tool can be used to lookup class and module implementations. Although its usage depends on the editor, let’s see a command line example.
In a minion.cr
with the following content:
If the cursor is located at line 6 column 8, it will be in the middle of Minion
of the Minion.new
. We can ask the tool to locate all the places where the constant Minion
is defined.
This search is semantic. If there is a Minion
constant in another namespace it will not be shown as an implementation. And it works across all files included from the main file after the cursor location.
Standard library
The docs are filled with examples, from time to time there is a major update to keep them consistent. Check how an external tool built by the community was used one more time in #7718. #LovelyNewTraditions
Text
There are a couple of refinements in the String
API. In #7633, String#at
is deprecated in favor of #char_at
. A String
is able to contain binary data so it’s better to have no doubts if you are intending to access a char
or a byte
. #UTF8FTW
In case your code parses octals using String#to_i
, they will need to be prefixed with 0o
and not only 0
. So 0777
is 777
(dec) and 0o777
is 511
(dec). Read more at #0o17013. #0o0
String#camelcase
got a new downcase
option in #7717 and some String#to_i
arguments were restricted to Bool
in #7436.
Collections
Slice
got sorting methods in #7597 and the #pointer
was removed in #7581.
Serialization
YAML mappings are now a bit more comfortable for String
. If the mapping states that a String
is expected, and if the YAML source provides a scalar, the value is interpreted as a string. No need to quote it in the YAML, or add #to_s
methods on the code. Read more at #7809
Files
This breaking change can probably be sent to /dev/null
. In #7778 File::DEVNULL
was renamed to File::NULL
.
Networking
Extra! Extra! #7423 added multicast for UDP. Broadcast the news! Extra! Extra!
In case your code needed to handle big files via IO
there was one stopper issue. IO#copy
used to return a 32 bits number, since #7660 that is changed to a UInt64
. We still encourage 32 bits by default, but some use cases demand a bit more, like… 32 more bits.
Crypto
Names are hard, vol. 23425. In Crypto::Bcrypt::Password
the #==
method was deprecated in favor of #verify
in #7790 to better reflect the semantic of the operation.
Next steps
Please update your Crystal and report any issues. We will keep moving forward and start the development focusing on 0.30.
Once again, check your code with --warnings=all
. This will help in the migration of your codebase and will probably push some feedback about that tool. Many of the breaking changes in this release are actually deprecations, so you probably want to check for warnings in order to do a full upgrade to Crystal 0.29.0.
Don’t miss the rest of the release changelog which has a lot of valuable information.
The development is possible thanks to the community’s effort, 84codes’ support, and every supporter.


--- layout: post title: Org-mode to GitHub pages with Jekyll excerpt: Introduce how to use Emacs's Org-mode with Jekyll to generate GitHub Pages categories: - Emacs tags: - [Emacs, org-mode, GitHub, Jekyll] ---
Org mode is considered to be one of the most remarkable modes in Emacs. Basically, it is a lightweight markup language, which is similar as Markdown and Textile, but is far more powerful. The .org files can be exported to many other formats, such as .tex and .html. We will take advantage of the publishing system provided by org-mode to manage the pages of the website.
Here I assume you have already had some basic knowledge of org-mode, Git and Jekyll, and already installed Git and Jekyll on your system. This post is based on these two articles: Using org to Blog with Jekyll and Blogging with Emacs org-mode and Github Pages.
The configuration of the publishing system in org-mode is done by setting the
value of org-publish-project-alist
variable.
(setq org-publish-project-alist '(("jekyll-cute-jumper-github-io" ;; settings for cute-jumper.github.io :base-directory "~/Documents/org-publish/cute-jumper.github.io/org" :base-extension "org" :publishing-directory "~/Documents/org-publish/cute-jumper.github.io/deploy" :recursive t :publishing-function org-html-publish-to-html :with-toc nil :headline-levels 4 :auto-preamble nil :auto-sitemap nil :html-extension "html" :body-only t)))
Note that the :body-only t
is essential because here we only need to
generate the content between
and
, and let Jekyll take care
of the rest.
For convenience, I start my configuration from Jekyll-Bootstrap.
cd ~/Documents/org-publish/cute-jumper.github.io/ # Clone into publishing directory git clone https://github.com/plusjade/jekyll-bootstrap.git deploy cd deploy # Setup upstream to your remote repo in GitHub git remote set-url origin<EMAIL_ADDRESS>cute-jumper/cute-jumper.github.io.git
Then, edit the _config.yml
file under the root directory. Check the
documentation for details.
Here is my directory structure:
/ ├── deploy │ ├── ...other files already in repo │ ├── about.html │ ├── _drafts │ │ └── .html files │ ├── index.html │ ├── _posts │ │ └── .html files │ └── timeline.html └── org ├── about.org ├── _drafts │ └── .org files ├── index.org ├── _posts │ └── .org files └── timeline.org
Note that there is a mapping from the .org
files in org/
to .html
files
in deploy/
. We only need to focus on the org/
directory and write our
posts there, and use org-publish
to convert these .org
files to .html
files and run jekyll serve
under deploy/
, then we can see the results in
http://localhost:4000. All the other configurations, such as changing themes
and setting up comments should be done in the deploy/
directory, and that's
what we use Jekyll for.
In order to make the exported .html
files correctly be processed by Jekyll,
we need to make some changes to our .org
files.
Front-matter. Usually, I put the following snippet at the beginning of every
post. This is called front-matter, which will be handled by Jekyll and is
required if we want the exported .html
understood by Jekyll.
#+BEGIN_EXPORT html --- layout: post title: Org-mode to GitHub pages with Jekyll excerpt: Introduce how to use Emacs's Org-mode with Jekyll to generate GitHub Pages categories: - Emacs tags: - [Emacs, org-mode, GitHub, Jekyll] --- #+END_EXPORT
Name Convention. By the Jekyll convention, we need to puts our posts(org
files) under _posts/
, and the file name should be the format
yyyy-mm-dd-name.org
. The following code, from Blogging with Emacs
Org-mode and Jekyll, can simplify our work. I made some slight
modifications to the original code to fit my own needs.
(defvar jekyll-directory (expand-file-name "~/Documents/org-publish/cute-jumper.github.io/org/") "Path to Jekyll blog.") (defvar jekyll-drafts-dir "_drafts/" "Relative path to drafts directory.") (defvar jekyll-posts-dir "_posts/" "Relative path to posts directory.") (defvar jekyll-post-ext ".org" "File extension of Jekyll posts.") (defvar jekyll-post-template "BEGIN_EXPORT\n---\nlayout: post\ntitle: %s\nexcerpt: \ncategories:\n - \ntags:\n - \n---\n#+END_EXPORT\n\n* " "Default template for Jekyll posts. %s will be replace by the post title.") (defun jekyll-make-slug (s) "Turn a string into a slug." (replace-regexp-in-string " " "-" (downcase (replace-regexp-in-string "[^A-Za-z0-9 ]" "" s)))) (defun jekyll-yaml-escape (s) "Escape a string for YAML." (if (or (string-match ":" s) (string-match "\"" s)) (concat "\"" (replace-regexp-in-string "\"" "\\\\\"" s) "\"") s)) (defun jekyll-draft-post (title) "Create a new Jekyll blog post." (interactive "sPost Title: ") (let ((draft-file (concat jekyll-directory jekyll-drafts-dir (jekyll-make-slug title) jekyll-post-ext))) (if (file-exists-p draft-file) (find-file draft-file) (find-file draft-file) (insert (format jekyll-post-template (jekyll-yaml-escape title)))))) (defun jekyll-publish-post () "Move a draft post to the posts directory, and rename it so that it contains the date." (interactive) (cond ((not (equal (file-name-directory (buffer-file-name (current-buffer))) (concat jekyll-directory jekyll-drafts-dir))) (message "This is not a draft post.")) ((buffer-modified-p) (message "Can't publish post; buffer has modifications.")) (t (let ((filename (concat jekyll-directory jekyll-posts-dir (format-time-string "%Y-%m-%d-") (file-name-nondirectory (buffer-file-name (current-buffer))))) (old-point (point))) (rename-file (buffer-file-name (current-buffer)) filename) (kill-buffer nil) (find-file filename) (set-window-point (selected-window) old-point)))))
Link Syntax. Jekyll supports many kinds of links. For example, by default
this post, named 2013-10-06-orgmode-to-github-pages-with-jekyll.org
, will
finally have a link
/emacs/2013/10/06/orgmode-to-github-pages-with-jekyll/
, which means the
original org-mode's link syntax [[file:/path/to/file][description]]
will not work because the
final URL will change unless you modify the settings to prohibit Jekyll
from doing such a path transformation. Thanks to the high customizability
of org-mode, there is an elegant way to solve this. I stole from this
thread in stackoverflow.
(defun org-jekyll-post-link-follow (path) (org-open-file-with-emacs path)) (defun org-jekyll-post-link-export (path desc format) (cond ((eq format 'html) (format "%s" path desc)))) (org-add-link-type "jekyll-post" 'org-jekyll-post-link-follow 'org-jekyll-post-link-export)
When we want to link to a post, we now use the syntax: [[jekyll-post:filename][description]]
instead.
In order to make use of Jekyll's template system, we sometimes need to embed
the template code into our org files. Thus, we may need
#+BEGIN_EXPORT html...#+END_EXPORT
structure very often.
Following is the current version of my index.org
, most of which is copied
from Using org to Blog with Jekyll.
#+BEGIN_EXPORT html --- layout: page title: cd /home/cute-jumper/ tagline:
$ ls -t blogs.happy.programming/ --- #+END_EXPORT #+OPTIONS: num:nil Hello, welcome to the homepage of cute-jumper. * Posts #+BEGIN_EXPORT html {% raw %}
 {% for post in site.posts %}
{{ post.date | date_to_string }} » {{ post.title }}
 {{ post.excerpt}} {% endfor %}
 {% endraw %} #+END_EXPORT * Timeline #+BEGIN_EXPORT html

Timeline

 #+END_EXPORT * About #+BEGIN_EXPORT html

About

 #+END_EXPORT
To be honest, it is kind of wired to embed so many HTML in org file, but it seems inevitable if we want to use the template system.
Now let us check the whole workflow to publish our web pages after we have done all the settings above.
jekyll-draft-post
to write a draft. (You may want to add
deploy/_drafts
directory into your .gitignore file…That's what I did.)jekyll-publish-post
, which will prepend a
timestamp in front of the original file name and move the file from
_drafts/
to _posts/
.org-publish
, and choose jekyll-cute-jumper-github-io
.deploy/
directory, and run jekyll serve
to see the results locally.It's so easy!
I'm thinking about making my own themes because the official themes in http://themes.jekyllbootstrap.com/ don't fit my needs very well. Maybe someday I will also remove Jekyll-Bootstrap and build my own things from scratch.
Currently this site is just a demo, and much more work needs to be done. I would try to improve this site when I have time.^_^


This email was sent to you by bellemeet.com. To ensure that our updates get to you(not bulk or junk folders), please add our e-mail address to your address book.
If you have any questions regarding your orders or products, please contact us at
service@bellemeet.com.


| GTK+ 2.0 Tutorial using Ocaml | ||
|---|---|---|
| <<< Previous | Range Widgets | Next >>> |
The Range widget class is fairly complicated internally, but, like all the "base class" widgets, most of its complexity is only interesting if you want to hack on it. Also, almost all of the functions and signals it defines are only really used in writing derived widgets. There are, however, a few useful functions that will work on all range widgets.
The "update policy" of a range widget defines at what points during user interaction it will change the value field of its Adjustment and emit the "value_changed" signal on this Adjustment. The update policies, defined as type Gtk.Tags.update_type, are:
This is the default. The "value_changed" signal is emitted continuously, i.e., whenever the slider is moved by even the tiniest amount.
The "value_changed" signal is only emitted once the slider has stopped moving and the user has released the mouse button.
The "value_changed" signal is emitted when the user releases the mouse button, or if the slider stops moving for a short period of time.
The update policy of a range widget can be set by calling this function:
method set_update_policy : Gtk.Tags.update_type -> unit |
Getting and setting the adjustment for a range widget "on the fly" is done, predictably, with:
method adjustment : GData.adjustment method set_adjustment : GData.adjustment -> unit |
adjustment method returns the adjustment to which range is connected.
set_adjustment method does absolutely nothing if you pass it the adjustment that range is already using, regardless of whether you changed any of its fields or not. If you pass it a new Adjustment, it will disconnect the old one if it exists, connect the appropriate signals to the new one, and call the private function gtk_range_adjustment_changed(), which will (or at least, is supposed to...) recalculate the size and/or position of the slider and redraw if necessary.
| <<< Previous | Home | Next >>> |
| Scale Widgets | Up | Key and Mouse bindings |


class UCSchema
#include "ucschema.h"
Overview
The static methods within the UCSchema class provides a means to evaluate a given UniversalContainer and determine if it meets a pre-defined set of criteria. These criteria specify the type of the data held by the container and the possible values it may take on. Two key ideas are helpful in understanding these functions. The first is the notion of a contract, which defines the constraints which a particular UniversalContainer must satisfy. The second is the notion of a schema, which is a contract which has been bound to an identifying name and stored within the global library. To use the UCSchema functions, you define a set of schema using a simple language, and then add them to this global library. You may then check UniversalContainers against these schema by name.
An Example Schema
car ==> { "model" : string "plate" : string("\w\w\w\d\d\d\d") "year" : integer(1900:) "milage" : real(0.0:250000.0) "used" : boolean "smogcode" : character } boat ==> { "length" : real(5.0:), "displacement" : real, "plate" : string("WV \d\d\d\d\d") } owner ==> { "name" : string("[A-Z][a-z]* [A-Z][a-z]*") "age" : integer(16:75) } dmvrecord ==> { "vehicle" : #group car boat #endgroup "owners" : [ #type : owner #size : integer(1:) ] }
Describing a Schema
A schema is described in a block of formated plain text, which is then sent to one of the add_contract_to_library methods to add the schema described to the global library. A schema always has the form:
where schemaname is an identifier and contract is a valid contract. Valid identifiers are formed by an alphabetic character followed by one or more alpha-numeric characters. Contracts are a combination of type information and constraints that must be meet by a UniversalContainer. A contract can specify scalars, dictionaries, or arrays. Contracts may also describe a group of possible contracts, satisfying any one of which will cause the contract to be satisfied. Additional, each contract may have an optional tag, identifying data which must match a provided symbol table.schemaname ==> contract
Schema Contracts
When a valid schema identifier appears in place of a contract, it is interpreted as the contract to mean the contract associated with the schema at the time when the contract is checked. This allows schemas to be referenced from within other schemas or contracts. When the contract parser encounters such an identifier it is not checked, instead a contract is created with a reference to the identifier. Only when that contract is later checked against a UniversalContainer is the global library checked for a matching contract. Consequently, schema names do not have to a be forward declared.
Scalar Contracts
A scalar contract describes a contract on a scalar data type or a string. These contracts consist of a keyword that declares the type, and an optional restriction on the possible values that the data may take on specified in parentheses.
| Contract | Notes |
|---|---|
| integer(MIN:MAX) | The integer keyword specifies that the data under consideration must be of type Integer. If parentheses are present, then one or both of MIN and MAX must be specified. If only one value is specified it is interpreted as the minimum value for the data, unless it is preceded by a colon (:), in which case it is interpreted as a maximum value for the data. |
| real(MIN:MAX) | The real keyword specifies that the data under consideration must be of type Real. If parentheses are present, then one or both of MIN and MAX must be specified. If only one value is specified it is interpreted as the minimum value for the data, unless it is preceded by a colon (:), in which case it is interpreted as a maximum value for the data. |
| character(MIN:MAX) | The character keyword specifies that the data under consideration must be of type Integer. If parentheses are present, then one or both of MIN and MAX must be specified. If only one value is specified it is interpreted as the minimum value for the data, unless it is preceded by a colon (:), in which case it is interpreted as a maximum value for the data. For a character, valid minimum and maximum values are un-escaped characters. |
| boolean(true | false) | The boolean keyword specifies that the data under consideration must be of type boolean. If parentheses are present, then the literal "true" or "false" must also appear to constrain the value to one of those two values. This feature is intended to be used with group contracts (explained below), which allow for a schema to be satisfied if a particular data item conforms to one of several different sub-schema. |
| string(regex) | The string keyword specifies that the data under consideration must be of a string. If parentheses are present, then they must contain a regular expression which the string must match in order to satisfy the contract. The underlying regex checking is done using the system regex routines described in regex.h, see man regex and re_format for a description of the dialect. |
Map Contracts
A map schema contract specifies constraints on a map. Fields where the key value is separated from the contract by a colon are required and must appear in order for the contract to be satisfied. Fields where the key value is separated by the contract by a question mark are optional. They do not have to appear, but if they do they must satisfy the contract. The order in which fields appear does not matter. Key values are double quoted strings. A map schema takes the form :
{ "required_key" : contract, "optional_key" ? contact ... }
Array Contracts
Array contracts allow for a variety of constraints to be placed on an array and its contents, expressed as a series of sub-contracts. The #type contract specifies a contract that all elements must satisfy. The #exists contract specifies a contract that must be satisfied by at least one element of the array. The #size contract must be an integer contract, and it is applied to the number of elements in the array, rather than the contents. It also possible to place constraints on particular elements of an array. Instead of one of the preceding keywords, a contract may be associated with an integer. The contract is then applied to that zero-indexed position in the array.
An array contract takes the form :
[ #type: contract, #size: integer contract, #exists: contract integer : contract ]
Group Contracts
Group contracts provide a mechanism for dealing with UniversalContainers that might be satisfied by one of several possible sub-contracts. It can be used to specify a constrained set of types that will satisfy the constraints. Alternatively, if there are interdependencies between data values in a satisfying object, group contracts can be used to specify the possible variations.
Group contracts take the form :#group contract contract ... #endgroup
Tagged Contracts
Any valid contract may be tagged, by prefixing it with a name enclosed in angle brackets. If the name of the tag is not found in the symbol table, the value of the satisfying object is cloned into a symbol table. If the given name is found in the symbol table, the contract is instead checked for equality with UniversalContainer which previously satisfied that tag. By using the versions of the compare and compare_and_throw that allow for a symbol table to passed in, it is possible to preload the symbol table with the desired values, or to preserve the values across multiple calls to the compare routines. When using the compare routines without a symbol table an internal symbol table is still maintained, filled, and checked for the duration of the call.
UCSchema Static Methods
static void UCSchema::add_contract_to_library(Buffer* buf)
static void UCSchema::add_contract_to_library(char* str)
These functions take a block of plain text that describes one or more schema and parses it, adding the results to the global library.
static unsigned compare(std::string const& contract, const UniversalContainer& uc)
static unsigned compare(std::string const& contract, const UniversalContainer& uc, UniversalContainer& symbol_table)
Compares the container uc against the named contract, and returns 0 if uc matches the contract. A non-zero return value indicates one or more violations of the contract; depending on which bits of the return code are set. Note that in the case of arrays and maps, there is no indication of which element caused a particular flag to be set, and there may be multiple violations of the same type. The following table details the various masks which can be ANDed with the return code to determine which errors occurred.
If symbol_table is provided, it must be a map or null. If any values of the map are set any tagged contracts within the schema are checked against those values. Other tagged values are inserted into the symbol_table, which is turned into a map if it comes in as null.
| ucc_NO_SUCH_TYPE | No type with the name given by contract has been registered with the library. |
| ucc_IMPROPER_TYPE | The container or one or more of its elements has the wrong data type. |
| ucc_CONSTRAINT_VIOLATION | The value of the container violates the constraints specified in the contract. This is also the flag that signals an array that has violated its size constraints, or for which some element has violated that exists constraint. |
| ucc_EXTRA_MAP_ELEMENT | A map contains one or more elements that are not specified in as required or optional. |
| ucc_MISSING_REQUIRED_MAP_ELEMENT | A map is missing an element that is marked as required. |
| ucc_MISSING_REQUIRED_ARRAY_ELEMENT | An array does not contain an element that is specified in the exists constraint. |
| ucc_STRING_DOES_NOT_MATCH | Some string does not match the given regex expression. |
static void compare_and_throw(std::string const& contract, const UniversalContainer& uc, unsigned conditions = 0XFFFFFFFF)
static void compare_and_throw(std::string const& contract, const UniversalContainer& uc, UniversalContainer& symbol_table, unsigned conditions = 0XFFFFFFFF)
These functions operate similar to the corresponding compare functions, but instead of returning a value they will throw an exception. This exception will be a UniversalContainer with a map type, similar to other exceptions thrown by the library. Two additional keys will be present. The key compare_results contains the value that would have been returned by compare. The key violations contains an array of strings explaining the various errors.
The conditions field is ORed with the results of the compare. If the results are non-zero the exception is thrown. This can be used to allow some conditions, such as the presence of extra map elements, to not throw an exception.
Public, non-static methods of UCContract
UCContract contains a number of public, non-static methods. These methods are not documented or supported, but are unlikely to undergo much further evolution. If a new way to specify schema is required, such as with JSONSchema, these methods would be a good place to start.