A few of my friends and I were in the car on the way to smoke a few bowls at another friend's house. We stopped at a gas station to get drinks, and k decided to buy some yellow jackets. I'd had bad experiences with yellow jackets in the past, but I decided to pop one anyway, just to see how the ephedra extract would react with the weed. By the time we lit up our first bowl, about 25 minutes after dosing, I was already starting to feel the effects of the yellow jacket. My scalp was tingling a little, and I was beginning to get really fidgety.
After the four of us had finished off two or three bowls, I was feeling fantastic. I was very high, and it felt wonderful to move around. This was one of the longest highs that I have ever experienced. I didn't slip into the relaxed, silently contemplative part of the high for hours; I laughed with my friends, and we went outside to play football, pausing our game occassionally to smoke a bowl.
Eventually, we went back inside and k and I played gran tourismo 3, a racing game. This was one of the strangest, most exhilirating and terrifying experiences I've ever had. When I was playing the game, I felt my peripheral vision diminish, I felt the force of the car behind me, I really felt like I was behind the wheel of the vehicle. I reached the point where it was no longer fun, but it was as if something was making me play. I couldn't bring myself to turn away from it, even though the game was beginning to make my head spin. All I could do was laugh like a madwoman, and grip the controller until my fingers ached. I could feel myself clenching my teeth, and I was beginning to shiver, even though the room was not cold by any means. I had to beg k to get up and turn off the game, because I really felt that it was going to make me vomit and/or go completely insane.
After the video game nightmare, we were all sitting around, pretty wired and still very high, and I began to feel like I was rolling, although the sensation wasn't very intense. That was probably the high point of the experience.
It was all downhill from there. About 7 or 8 hours (no lie!) into the experience, I reached a point where I no longer wanted to be stoned, and this coincided with the yellow jacket crash. My heart had been pumping extraordinarily fast/hard the whole night, and I was beginning to experience chest pain. I was also shaking uncontrollably; I'd sit down with my feet on the ground, and put a little weight on the ball of my foot, and my whole leg would start quivering, as if it couldn't sustain its own weight. Every time I stood up, I'd have these terrible head-rushes, along with some diziness. I didn't want to talk to anyone; I just wanted to lay down. It took me at least 3 hours to fall asleep that night, and I woke up the next morning feeling awful. My body was exhausted and my head felt like it weighed a ton.
All in all, it was not a bad experience, and I'll probably do it again. The benefit of an extremely prolonged high is worth the unpleasant come-down. Next time, however, I'll make sure I can stay in bed the following day.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


Interactive Video Player
Original video source:
The Problem with Time & Timezones
by
Computerphille
.


User Guide 1 - Getting Started
Prerequisites
- REDCap 7.0+. You need to have an account for a REDCap version 7.0 or greater site. The version of your REDCap site should be listed on the bottom of the page after you log in.
- Your REDCap API URL. You need to know the URL of your REDCap's API (Application Programming Interface). You can see this from within REDCap by using the following steps:
- Select a project.
- Click on the API link on the left.
- On the API page, click on the REDCap API documentation link toward the the top of the page.
- Select one of the methods in the left, such as Export Arms.
- Your REDCap API URL should be displayed in the page for the method under URL.
- REDCap Project with API Token. You need to have an API token for a project in REDCap. You would typically get this
by creating a project in REDCap and then requesting an API token. To request an API
token, from your project's page in REDCap:
- Click on the API link on the left.
- On the API page, click on the Request API token button.
-
PHP 5.6+ with cURL and OpenSSL. You need to have a computer (with Internet access) that has PHP version 5.6 or greater installed. And you need to have the following PHP modules enabled:
- cURL
- OpenSSL
If you use Composer to install PHPCap (see below), it will automatically check that the above modules are enabled, and generate an error message if they are not. If you don't use Composer, you can use the following command to check which modules are enabled:
php -m
Example PHP Setup on Ubuntu 16:
sudo apt-get install php php-curl composer
Information on installing PHP on Windows: http://php.net/manual/en/install.windows.php
Creating a PHPCap Project
Create a project directory
Create a directory for your project, and cd to that directory:
mkdir phpcap-project
cd phpcap-project
Get PHPCap
If you have Composer installed, you can get PHPCap using:
composer require iu-redcap/phpcap
If you have Git installed, you can use the following:
git clone https://github.com/iuredcap/phpcap
If you don't have Composer or Git installed, you can get a Zip file of PHPCap from GitHub by clicking on this link:
https://github.com/iuredcap/phpcap/archive/master.zip
Or go to this page and click on the "Clone or download" button, and then click on "Download ZIP":
https://github.com/iuredcap/phpcap/
Then unzip the file to your project directory.
You should now have the following directory structure:
| Composer | Git |
|---|---|
phpcap-project/ composer.json composer.lock vendor/ autoload.php composer/ phpcap/ |
phpcap-project/ PHPCap/ ... autoloader.php ... docs/ ... |
You will need to include the PHPCap autoloader (shown in bold above) in your code to access the PHPCap classes. And the location and name of the autoloader to use will depend on whether you used Composer to download PHPCap, or downloaded it from GitHub (using Git or directly).
Create your first test program
Create a file test.php in your project directory:
| Composer | Git |
|---|---|
phpcap-project/ composer.json composer.lock test.php vendor/ autoload.php composer/ phpcap/ |
phpcap-project/ PHPCap/ ... autoloader.php ... docs/ ... test.php |
Enter the following into the test.php file, modifying the API URL and token to match those for your REDCap project:
<?php
# Use only one of the following requires:
require('vendor/autoload.php'); # For Composer
require('PHPCap/autoloader.php'); # For Git
use IU\PHPCap\RedCapProject;
$apiUrl = 'https://redcap.xxxxx.edu/api/'; # replace this URL with your institution's
# REDCap API URL.
$apiToken = '11111111112222222222333333333344'; # replace with your actual API token
$project = new RedCapProject($apiUrl, $apiToken);
$projectInfo = $project->exportProjectInfo();
print_r($projectInfo);
Run the test program using the following command in your project directory:
php test.php
You should see output generated with information about your project. It should look similar to the following, although some of the values will probably be different:
Array
(
[project_id] => 9639
[project_title] => PHPCap Basic Demography Test
[creation_time] => 2017-03-31 13:40:53
[production_time] =>
[in_production] => 0
[project_language] => English
[purpose] => 1
[purpose_other] => PHPCap testing
[project_notes] =>
[custom_record_label] =>
[secondary_unique_field] =>
[is_longitudinal] => 0
[surveys_enabled] => 1
[scheduling_enabled] => 0
[record_autonumbering_enabled] => 0
[randomization_enabled] => 0
[ddp_enabled] => 0
[project_irb_number] =>
[project_grant_number] =>
[project_pi_firstname] =>
[project_pi_lastname] =>
[display_today_now_button] => 1
)
Making your test program secure
The program above is not secure, because it does not use SSL verification to verify that the REDCap site accessed is the one actually intended. To make the program more secure, it should use SSL verification.
To do this you need to add the SSL verify flag and set it to true:
...
$sslVerify = true;
$project = new RedCapProject($apiUrl, $apiToken, $sslVerify);
...
If you can successfully run the test program with the change above, then it should mean that your system is set up to do SSL verification by default. However, if the above change causes an SSL certificate error, you will need take additional steps to get SSL verification to work.
One approach to getting SSL verification to work is to create a certificate file for this, and add specify it in your program. Information on creating the file can be found here: CA Certificate file
Assuming the file was created with the name 'USERTrustRSACertificationAuthority.crt' and is in you top-level project directory, the project creation would now be modified to the following:
...
$sslVerify = true;
$caCertificateFile = 'USERTrustRSACertificationAuthority.crt';
$project = new RedCapProject($apiUrl, $apiToken, $sslVerify, $caCertificateFile);
...
So, at this point, your project directory should look as follows (without the .crt file if it is not needed):
| Composer | Git |
|---|---|
phpcap-project/ composer.json composer.lock test.php USERTrustRSACertificationAuthority.crt vendor/ autoload.php composer/ phpcap/ |
phpcap-project/ PHPCap/ ... autoloader.php ... docs/ ... test.php USERTrustRSACertificationAuthority.crt |
And your test program should look similar to the following:
<?php
# Use only one of the following requires:
require('vendor/autoload.php'); # For Composer
require('PHPCap/autoloader.php'); # For Git
use IU\PHPCap\RedCapProject;
$apiUrl = 'https://redcap.xxxxx.edu/api/'; # replace this URL with your institution's
# REDCap API URL.
$apiToken = '11111111112222222222333333333344'; # replace with your actual API token
$sslVerify = true;
$caCertificateFile = 'USERTrustRSACertificationAuthority.crt';
$project = new RedCapProject($apiUrl, $apiToken, $sslVerify, $caCertificateFile);
$projectInfo = $project->exportProjectInfo();
print_r($projectInfo);
If everything is working correctly, the test program should (still) output information about your project.
Checking for errors
In general, when an error occurs in PHPCap, it throws a PhpCapException. These exceptions can be checked and handled using "try" and "catch". For example, to handle exceptions in the sample program, it could be modified as follows:
<?php
# Use only one of the following requires:
require('vendor/autoload.php'); # For Composer
require('PHPCap/autoloader.php'); # For Git
use IU\PHPCap\RedCapProject;
use IU\PHPCap\PhpCapException;
$apiUrl = 'https://redcap.xxxxx.edu/api/'; # replace this URL with your institution's
# REDCap API URL.
$apiToken = '11111111112222222222333333333344'; # replace with your actual API token
$sslVerify = true;
$caCertificateFile = 'USERTrustRSACertificationAuthority.crt';
try {
$project = new RedCapProject($apiUrl, $apiToken, $sslVerify, $caCertificateFile);
$projectInfo = $project->exportProjectInfo();
print_r($projectInfo);
} catch (PhpCapException $exception) {
print "The following error occurred: {$exception->getMessage()}\n";
print "Here is a stack trace:\n";
print $exception->getTraceAsString()."\n";
}
Note that in addition to the "try" and "catch" that were added, an additional use statement was added for the PhpCapException class:
use IU\PHPCap\PhpCapException;


Alcohol, A. muscaria & Smoking Blend (K2)
I had purchased an ounce of Amanita Muscaria at a local headshop about a month ago. I had just been waiting for the right time and place to experience them as I know the importance of set and setting. However, upon reading a few reports of smoking the skin, I decided that it would be a good way to test them out.
So a few hours after MSU lost the Final Four game to Butler, I gave it a shot. I was already pretty buzzed at this point; having drank about 5 beers over the course of the game.  The process was as follows: I peeled a 2cm x 2cm piece of the red skin off the cap.  I smoked it all gone and felt no major effects, other than increased salivation.
I then decided to smoke a little K2 (that I had around to avoid dropping dirty on drug tests) hoping that it would calm my stomach in case of nausea. I used a different pipe for this but for some reason the smoke tasted just like cinnamon sugar.
About an hour later I found myself defecating and constantly reminding myself that I wasn't going to die.  So I decided to drink some water and lay down for a while and try to go to sleep. The negative vibe continued and although I had no nausea whatsoever, I had the urgent sensation of vomit pulsing up my throat and lots of mucus collecting in my sinuses. The water helped stop the vomit sensation and I rode the trip out successfully without purging. The trip was very very weird though. Unlike nothing I've experienced. I saw a few scary faces on my ceiling but decided to close my eyes and try to sleep instead because of the negativity. I must have fell asleep soon because the next thing I remember was waking up to my wife coming to bed and when I opened my eyes everything was fine.
Experience Reports are the writings and opinions of the individual authors who submit them.
Some of the activities described are dangerous and/or illegal and none are recommended by Erowid.


{template header.html} {list catid=25 uid=$member[id] num=1 iaeweb=1 return=con}{/list} {php $age = empty($con['age']) ? birthday($con['birthday']) : $con['age'];} {php $sex = $con['sex'] ? $con['sex'] : $member['sex'];} {php $age = $age ? $age : $member['age'];} {php $avatar = !empty($member['avatar']) ? $member['avatar'] : "/assets/images/avatar.png";} {php $title = $member[name];} {php $age_old = !empty($member['age'])? birthday($con[birthday]) : $member['age'];} {php $phone = $member[phone];} {php $thumb = !empty($con[thumb]) ? $con[thumb] : $avatar;} {php $thumb = !empty($thumb) ? $thumb : "/assets/images/avatar.png";} {php $title = !empty($con['title']) ? $con['title'] : $member['name'];} {php $message_num=0;} {list table=diy_message order=id_desc userid=$member[id] status=0} {php $message_num++;} {/list}


My Neighbour Bakes
Cakes
Action
Another action
Something else here
About US
Contact US
Triple Chocolate Layered Cake
$45.30
Some quick example text to build on the card title and make up the bulk of the card's content.
View
White chocolate and strawberry
$75.30
Some quick example text to build on the card title and make up the bulk of the card's content.
View
Confetti Mess Cake
$57.30
Some quick example text to build on the card title and make up the bulk of the card's content.
View


You can use the form below to generate a video sitemap either for your own account or for a sample Brightcove account.
If you do not enter account information, a Brightcove sample account will be used.
Account id:
Client id:
Client secret:
Internal name of the custom field:
Page URL:
URL parameter for id:
URL parameter value is the:
How often are videos updated? Don't include the update frequency always hourly daily weekly monthly yearly never
Videos are family-friendly
Number of videos to include: 25 50 100 1000 10,000 50,000 Note: if you have less than 50,000 videos and want to include all, just select a number higher than your total count.
Search string to select videos (optional - see Search for Videos)
Sort by: Date last updated Date added descending ascending
Generate the Sitemap
Waiting for input...
Current API request
api request will appear here...
Generated sitemap


Review Manuscript
Please upload your submission PDF file for the review. Make sure that its format and content fits the conference requirements.
Please note that all uploaded papers are subject for double-blind review. It means that neither authors know the reviewers, nor the reviewers know whose papers they score. You need to remove all information that can be used to identify you or your co-authors from the manuscript. In particular, you should remove authors names, funding sources and any references to your previous work. You will be able to add this information in your final manuscript after the review.
{% if not submission.can_edit_review_manuscript %}Review manuscript can not be changed any longer. Please, contact organizing committee if you need to update it.
{% endif %}Current document: {{ submission.get_review_manuscript_name }}
{% endif %}


POSTED ON 15 DEC 2013 / DESSERTS
For the fig-swirl: Melt butter over medium heat in a saucepan. Add brown sugar and stir to dissolve. Halve all of the figs and toss in the saucepan with water and lemon juice. Cook over medium heat, stirring frequently, until you have a chunky-jammy mixture. Add salt with one or two stirs, set aside and let cool completely.
Ice cream: In a small pot over medium heat, combine milk, and granulated sugar until sugar is completely dissolved and the milk is just barely lukewarm. Whisk in the egg yolks. Set mixture in the fridge and wait until the fig mixture is cooled.
Using an ice cream machine, pour liquids into the frozen basin and process according to manufacturer instructions, i.e., let spin and thicken for 20 minutes before adding mascarphone fig jam mixture, and the nuts. Continue to process for +/- 10 minutes. Pour semi-frozen mixture into pyrex dish or glass tupperware. Freeze for at least two hours before serving.
Vanessa Stevenson
Food enthusiast, photography fan. Add a pinch of raw foodism and that's pretty much who I am.
Delicious © 2013 All Rights Reserved.
Proudly published with Ghost.


{% extends "base.html" %} {% block title %}Snips - Device Manager{% endblock %} {% block page_content %}
Saving changes, write all text out to the snips.toml file, then restarts snips services.
Tick the box to create a backup of the current TOML file before saving changes. This will overwrite any previous backup file.


Mooloolaba Harbour lies north of Moreton Bay at the mouth of the Mooloolaba River. The harbour is protected from the offshore swell by nearby Point Cartwright. It is a popular tourist resort as well as home to a large fishing fleet.
Nearby coverage includes: Scarborough and northern Moreton Bay,Tin Can Bay and Bundaberg.
Position 26°40′55″S, 153°07′05″E.
Mooloolaba is not a clearance port.
The entrance is well-buoyed and lit and provides an all-weather harbour,
Visiting boats are permitted to anchor in the lagoon at the western end of the harbour. The shelter is excellent and the holding good in a mud bottom.
There are several marinas here.
Redcliffe/Scarborough to Mooloolaba - beware of sandbar entering Mooloolaba because it does move and has to be dredged - check VMR/VCP on current condition.
Mooloolaba to Wide Bay Bar - check Tin Can Bay VMR for bar conditions and the latest GSP waypoints.
The latest information on the river bar at Mooloolaba can be found at www.mooloolabamarina.com.au/mooloola-river-bar-survey
Last updated May 2015.
Mooloolaba Marina © www.mooloolabamarina.com.au


Tua Tagovailoa Reportedly Leaves Mississippi State Game In Ambulance
by Andrew HolleranTua Tagovailoa left this afternoon’s Alabama-Mississippi State game with an apparent injury. The Crimson Tide’s standout quarterback has now reportedly left the stadium in an ambulance.
ESPN showed footage of Tagovailoa getting placed into an ambulance late in the third quarter of this afternoon’s game.
A large Mississippi State banner was placed in front of the ambulance’s doors to give Tagovailoa some privacy.
Tagovailoa is believed to have suffered a hip injury.
Saban, who is facing some criticism for keeping Tagovailoa in the game for too long, said at halftime that he doesn’t know much about the injury yet.
“He hurt his hip. I don’t know anything else more than that. That was going to be his last series of half. Certainly I don’t want to see anybody get hurt, especially not him,” Saban said at halftime.
Saban added that Tagovailoa was only going to play one more series.
“That was going to be his last series. We were going to put Mac in and we said ‘Let’s put Tua in before the half for 2-minute (drill) just for practice,” he told ESPN.
Alabama has suffered a couple of major injuries against Mississippi State so far today. The Crimson Tide should have updates following the contest.


$treeview $search $mathjax
$extrastylesheet
C++ Actor Framework
Issue
Watch
Star
Fork
Follow @isndev
$searchbox


--- layout: page title: Lean Prover Zulip Chat Archive permalink: archive/113488general/84699Heisenbug.html ---
I just found a Heisenbug: a proof that doesn't typecheck correctly, but if you add tactic.result >>= tactic.trace
at the end, it does!
those are fun
I suspect that pretty printing either does some type checking (forcing some unification) or resolves some meta variables. You can try and see what is the smallest some term of the proof that you can print and which will fix the proof
I'm in the midst of further changes that will affect how my metavariables get handled, so I think I'm going to defer diagnosing this bug, hoping that if I don't look at it it will disappear permanently. :-)
{% endraw %}


© {{ now.Format "2006" }} {{ $.Site.Author.name }}.{{ if .Site.Params.licence }} {{ $.Site.Params.licence | markdownify }}{{ end }}
Powered by Hugo & Simplicity.


{% csrf_token %} Username First name Last name Branch Choose... {% for store in stores %} {{store}} {% endfor %} Create password Confirm password Register By clicking the 'Sign Up' button, you confirm that you accept our Terms of use and Privacy Policy.


"Humans are allergic to change. They love to say, 'We've always done it this way.' I try to fight that. That's why I have a clock on my wall that runs counter-clockwise." - Grace M. Hopper


# Nix(OS) - Revolutionizing packaging and configuration management! ![NixOS logo](img/nixos-white.svg) The Purely Functional Linux Distribution
# Before we begin (FYI) - Ask questions at any time - Please ask lots of questions :) - The slides contain some redundancy - There are a few optional slides at the end - Please give me feedback (louder, faster/slower, more/less details, etc.) Notes: - Try to ask longer questions after the presentation - I might postpone some questions until the corresponding slide - All questions are awesome! (even if I forget to mention this)
# About me - Michael Weiss aka. primeos - Computer science student at the University of Tübingen - I love free software, etc. - First `nixpkgs` commit: 2016-10-05 - I maintain ~44 packages and ~4 modules (2018-09-18) - Email: [dev.primeos<EMAIL_ADDRESS>Notes: - First commit: 8268f0a759597bfdf07f2cc48b265215040b5c5e (pgpdump: init at v0.31) - 2018-06-08 - Maintaining ~41 packages - Wrote ~4 modules (2 active, 1 WIP, 1 disabled) - Maintaining 3 modules
# Main components - Nix (package manager) - Nixpkgs (Nix packages collection) - NixOS (operating system) - NixOps (DevOps / cloud deployment tool) Notes: - Entries correspond to GH repos - Only read out slide (details will follow later, e.g. on the next slide)
# Nix* ISO/OSI model ![Nix* ISO/OSI model](img/nix-iso-osi.svg) Notes: - Nix ~ dpkg, pacman, portage - Nixpkgs ~ apt/deb sources, PKGBUILD - NixOS ~ Arch, Ubuntu, Gentoo - NixOps ~ Puppet, Ansible, Chef - Configuration Management - Infrastructure as Code - DevOps - Derivations and store paths
# Other tools - Hydra (Nix based continuous build system) - Disnix (distributed services deployment) - PatchELF (change dynamic linker and RPATH) - {cabal,go,node,pip,python,pypi,composer,hex, bower,vim,...}2nix Notes: - Disnix: Deploying (micro)services - nixcrates, cargo2nix, elm2nix, ...
# History - Started as a **research project** (with funding) - First paper in 2004 (many will follow) - Nix package manager developed by **Eelco Dolstra** as part of his PhD research (~2003) - First NixOS prototype developed by Armijn Hemel as his master's thesis project - Hydra developed as part of the LaQuSo Buildfarm project
# Timeline ![Nix project logo](img/nix-snowflake.svg) - 2003: init (research begins) - 2007: NixOS becomes usable + x86_64 support - 2008: Website moved to nixos.org - 2009: Nix logo + Nix(OS) build on Hydra - 2011: Migration from Subversion to Git(Hub) - 2013: Switch from Upstart to systemd + NixOps 1.0 release - 2015: NixOS Foundation + First NixCon (Berlin) - 2017: Second NixCon (Munich) - 2018: Third NixCon (London) Notes: - https://nixos.org/news.html - 2007: NixOS is not an [April Fools’ Joke](https://www.osnews.com/comments/17601) - www.osnews.com post on 1st April 2017 (introduces NixOS, focus on purely functional) - Nix logo: - Nix is Latin for snow (-> snowflake) - Was initially created for the Haskell logo competition
# Repology (2018-06-08) ![Repology statistics](img/map_repo_size_fresh-2018-06-08.svg) Notes: - Is Nix production ready? - Yes (at least definitely beyond a PoC) - Don't trust these numbers too much
# Problems of classical package managers - Upgrades/configuration changes destructively update the system state (overwriting files in sequence -> temporary inconsistency) - State -> nondeterministic builds -> not reproducible - Different versions of a binary - Package conflicts - No rollbacks - No configuration management Notes: - Apps might have an undefined behaviour or crash when launched during an upgrade + possibility of permanent damage when interrupted (e.g. even unbootable!). - Incomplete dependency specifications (no isolated build environment) - Nominal dependency specifications (only name and optionally version) - Configuration files not controlled by the package manager. - Upgrading modified configuration files is problematic. - Binaries = global variables (e.g. /bin/bash)
# Nix(OS) - Atomic upgrades/rollbacks (software & configuration) - Multiple versions of a package (side-by-side, e.g. testing a new Apache version) - Deterministic & Reproducible builds - Reliable upgrades (and rollbacks - configuration bound to correct software version + service reloads/restarts) - Reliable channel upgrades/rollbacks (e.g. 17.03 -> 17.09) - Unprivileged users can securely install software Notes: - Next slide: Declarative configuration management
# Being functional - Classically: Imperative configuration - Stateful changes (-> dependency hell, inconsistent states, etc.) - NixOS: Declarative configuration - Packages/Configuration = immutable values - (Complete) rebuilds instead of destructive updates - Referential transparency (~an expression always evaluates to the same result) Notes: - Referential transparency: An expression always evaluates to the same result in any contex (no side effects like (uncontrolled) imperative updates).
# Problems - Lacking manpower/workforce (e.g. for better testing/security/documentation) - Not all packages are reproducible (2016: 12.8%) - Running pre-compiled binaries - Scripts with hard-coded paths don't work - No GUI for package/configuration management - No LTS releases or super stable (i.e. old :P) branches - Not all use-cases or configuration options supported - Some tricks available + PRs welcome ;) Notes: - 13 Dec 2016: "Currently, out of 36550 build steps in a full NixOS evaluation, only 4699 (12.8%) were detected as non-deterministic. (Note that Hydra can only detect the presence of non-determinism, not its absence)." - Eelco
# Nix - A purely functional package manager (transparent source/binary deployment) - Secure multi-user support - Stores packages in the Nix store (`/nix/store` by default) - Each package has it's own unique identifier/directory - E.g. `qn96dbgqdryaw38zw6v08da34q5v4qz3-git-repo-1.12.37` (cryptographic hash, name, version) - Enables multiple versions & binary substitutes - "Forces" complete dependencies Notes: - Hash captures all dependencies (160-bit truncations of SHA-256 encoded in base-32 (i.e. 32 characters)) - src/libstore/store-api.cc Store::makeStorePath + comment above - Version: Digit after a dash - Garbage collection (nix-collect-garbage) - Similar to Content Addressed Storage (CAS) - Nothing is ever overwritten!
# Nix expressions / Nix expression language - A DSL (not a GPL!) - Describes graphs of build actions ("derivations") - Packages, compositions of packages, configurations, ... - Dynamically typed ~~("Nix won't be complete until it has static typing." @edolstra)~~ - https://typing-nix.regnat.ovh/ - Lazy (a very important feature!) - Purely functional (no side-effects, immutable store) - Turing complete (e.g. Dhall is not -> [dhall-nix](https://github.com/dhall-lang/dhall-nix)) Notes: - DSL vs GPL: MD5 collisions by @Azlig (Chromium updater) :D - "Config files shouldn't be Turing complete" (-> always terminate) - Dhall is explicitly typed, evaluated, and configuration files can be reduced to a normal form - TODO: - Bad evaluation errors? :D - Missing typing - Error in anonymous function at unknown file? - Evaluated vs interpreted? - Bugs? :D (e.g. a-b)
# nix-repl - **Demo**
# Nixpkgs (the Nix packages collection) - Main GitHub repository (permissive MIT/X11 license) - Contains definitions of packages (Nix) and modules (NixOS) - Also contains tests, library functions, etc. - Different branches (rolling: master, stable: release-YY.MM) - Build and tested by Hydra (+ uploaded to binary cache) - Distributed through (nixpkgs-)channels (nixpkgs-unstable, nixos-unstable(-small), nixos-YY.MM(-small)) Notes: - Stable: MM = 03 or 09 (end of month, branch off one month before) - Talk about codenames, release schedule, freezing, etc.?
# An example Nix package (pgpdump) ```nix pgpdump = callPackage ../tools/security/pgpdump { }; ``` ```nix { stdenv, fetchFromGitHub , supportCompressedPackets ? true, zlib, bzip2 }: stdenv.mkDerivation rec { name = "pgpdump-${version}"; version = "0.32"; src = fetchFromGitHub { owner = "kazu-yamamoto"; repo = "pgpdump"; rev = "v${version}"; sha256 = "1ip7q5sgh3nwdqbrzpp6sllkls5kma98kns53yspw1830xi1n8xc"; }; buildInputs = stdenv.lib.optionals supportCompressedPackets [ zlib bzip2 ]; meta = with stdenv.lib; { description = "A PGP packet visualizer"; longDescription = '' pgpdump is a PGP packet visualizer which displays the packet format of OpenPGP (RFC 4880) and PGP version 2 (RFC 1991). ''; homepage = http://www.mew.org/~kazu/proj/pgpdump/en/; license = licenses.bsd3; platforms = platforms.linux; maintainers = with maintainers; [ primeos ]; }; } ```
# Dependency graphs pgpdump's runtime dependencies: ```bash nix-store -q --graph $(nix-store --realise $(nix-instantiate -A pgpdump)) | dot -Tpdf | zathura - ``` ![Pgpdump runtime dependencies](img/pgpdump-rdeps.svg) Notes: - Build time dependencies available as well (but graph way too large) - E.g. CVE patches as build inputs
# nix-env (manipulate or query Nix user environments) ![User environments](img/user-environments.png) https://nixos.org/nix/manual/figures/user-environments.png
# nix-shell - **Demo**
# NixOS - Implements a declarative and purely functional system configuration model - Based on Nix (package + configuration management) - NixOS modules (separation of concerns) - Form the full "system configuration" ```nix { config, pkgs, ... }: { options = { nested attribute set of option declarations using mkOption }; config = { nested attribute set of option definitions }; } ``` Notes: - modules = functions - { config } -> config = full system configuration
# An example NixOS module ```nix { config, lib, pkgs, ... }: with lib; let cfg = config.programs.vim; in { options.programs.vim = { defaultEditor = mkOption { type = types.bool; default = false; description = '' When enabled, installs vim and configures vim to be the default editor using the EDITOR environment variable. ''; }; }; config = mkIf cfg.defaultEditor { environment.systemPackages = [ pkgs.vim ]; environment.variables = { EDITOR = mkOverride 900 "vim"; }; }; } ```
# Another example NixOS module ```nix { config, lib, pkgs, ... }: with lib; let cfg = config.services.monetdb; in { meta.maintainers = with maintainers; [ StillerHarpo primeos ]; ###### interface options = { services.monetdb = { enable = mkEnableOption "the MonetDB database server"; package = mkOption { type = types.package; default = pkgs.monetdb; defaultText = "pkgs.monetdb"; description = "MonetDB package to use."; }; user = mkOption { type = types.str; default = "monetdb"; description = "User account under which MonetDB runs."; }; group = mkOption { type = types.str; default = "monetdb"; description = "Group under which MonetDB runs."; }; dataDir = mkOption { type = types.path; default = "/var/lib/monetdb"; description = "Data directory for the dbfarm."; }; port = mkOption { type = types.ints.u16; default = 50000; description = "Port to listen on."; }; listenAddress = mkOption { type = types.str; default = "<IP_ADDRESS>"; example = "<IP_ADDRESS>"; description = "Address to listen on."; }; }; }; ###### implementation config = mkIf cfg.enable { users.users.monetdb = mkIf (cfg.user == "monetdb") { uid = config.ids.uids.monetdb; group = cfg.group; description = "MonetDB user"; home = cfg.dataDir; createHome = true; }; users.groups.monetdb = mkIf (cfg.group == "monetdb") { gid = config.ids.gids.monetdb; members = [ cfg.user ]; }; environment.systemPackages = [ cfg.package ]; systemd.services.monetdb = { description = "MonetDB database server"; wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; path = [ cfg.package ]; unitConfig.RequiresMountsFor = "${cfg.dataDir}"; serviceConfig = { User = cfg.user; Group = cfg.group; ExecStart = "${cfg.package}/bin/monetdbd start -n ${cfg.dataDir}"; ExecStop = "${cfg.package}/bin/monetdbd stop ${cfg.dataDir}"; }; preStart = '' if [ ! -e ${cfg.dataDir}/.merovingian_properties ]; then # Create the dbfarm (as cfg.user) ${cfg.package}/bin/monetdbd create ${cfg.dataDir} fi # Update the properties ${cfg.package}/bin/monetdbd set port=${toString cfg.port} ${cfg.dataDir} ${cfg.package}/bin/monetdbd set listenaddr=${cfg.listenAddress} ${cfg.dataDir} ''; }; }; } ```
# An example NixOS configuration ```nix { config, pkgs, ... }: { system.nixos.stateVersion = "18.03"; nix.useSandbox = true; boot.kernelPackages = pkgs.linuxPackages_latest; i18n = { consoleFont = "Lat2-Terminus16"; consoleKeyMap = "de"; defaultLocale = "en_US.UTF-8"; }; time.timeZone = "Europe/Berlin"; environment = { systemPackages = with pkgs; [ # Core vim_configurable gitAndTools.gitFull wget # Monitoring htop python3Packages.glances # Tools time file tree lsof pciutils hdparm zip unzip # Network inetutils bind.dnsutils tcpdump ]; variables = { EDITOR = "vim"; }; }; programs.bash.enableCompletion = true; } ```
# Nixpkgs overlays ```nix self: super: # self: Final package set / fixed-point result (use as dependencies) # super: Previous evaluation result { nix = super.nix.override { storeDir = "${
}/store"; stateDir = "${
}/var"; }; boost = super.boost.override { python = self.python3; }; rr = super.callPackage ./pkgs/rr { stdenv = self.stdenv_32bit; }; } ```
# NixUP & co. - Nix User Profile - Manage $HOME
# Community - A great & kind community ([overview](https://nixos.org/nixos/community.html)) - [nix-devel mailing list](https://groups.google.com/forum/#!forum/nix-devel) - Discourse (Forum): [discourse.nixos.org](https://discourse.nixos.org/) - Bugs and PRs via GitHub ([Nixpkgs](https://github.com/NixOS/nixpkgs)) - [#nixos](irc://irc.freenode.net/#nixos) on irc.freenode.net - Blogs ([NixOS planet](https://planet.nixos.org/)) - Local meetups (e.g. in [Stuttgart](https://hackmd.shackspace.de/NixOS-meetup)) - NixCon - Commercial support via consulting companies
# Learning - [Learn X in Y minutes, where X=nix](https://learnxinyminutes.com/docs/nix/) - [A tour of Nix](https://nixcloud.io/tour/) - By Joachim Schiele & Paul Seitz from Tübingen ;) - [Unofficial user's wiki](https://nixos.wiki/wiki/Main_Page) - Manuals ([Nix](https://nixos.org/nix/manual/), [Nixpkgs](https://nixos.org/nixpkgs/manual/), [NixOS](https://nixos.org/nixos/manual/), and [NixOps](https://nixos.org/nixops/manual/))
# Nix Pills - A ported version of the Nix Pills (a series of blog posts) - A tutorial introduction into the Nix package manager and Nixpkgs package collection - In the form of short chapters called 'pills' - https://nixos.org/nixos/nix-pills/
# Trying out Nix* - Use Nix side-by-side with your regular package manager: ```bash curl https://nixos.org/nix/install | sh ``` - Experiment with nix-env, nix-shell, nix-repl, etc. - Try out NixOS (e.g. VirtualBox demo appliance) - Install NixOS
# Thank you :) ![Nix project logo](img/nix-snowflake.svg) - Questions? - Feedback - Discussion Notes: - Feedback - Possible improvements? - Do or do not, there is no try. - Q&A - Hacking - Summary
# License - For the content of these slides - Public domain - CC0 1.0 Universal (CC0-1.0) - Doesn't apply to external sources like images - Some quotes, notes, etc. are from other sources (this can hopefully be considered fair use) - Framework: reveal.js - MIT (see https://github.com/hakimel/reveal.js)


License Copyright 2018-2023 David Pilger
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Description Methods for interacting with NdArrays


START
Input house number
Input Amount Paid
PAYMENT VERIFICATION PROCESS
IF Payment = Paid AND Yes Debt
Display Reject notice
ELSE IF Payment = Paid AND no Debt
THEN DATE PROCESS
IF Date = Early
Set Discount = amount*0.1
Display Acknowledgement notice
ELSE IF Date = Late
Set Penalty = amount*0.2
Display Penalty Fee
ELSE IF Date = Due
THEN WATER DISTRIBUTION PROCESS
IF Rent Payment = Full Payment
Set Water = 24/7
Display List
ELSE IF Rent Payment = Half Payment
Set Water = Morning and Evening hours only
Display List
ELSE IF Rent Payment = No Payment
Set Water = Morning hours only
Display List
END


3 Little Pigs
Once upon a time there were three little pigs and the time came for them to leave home and seek their fortunes. Before they left, their mother told them. Whatever you do, do it the best that you can because that's the way to get along in the world.


@INPROCEEDINGS{7247388,
author={S. Chatterjee and S. Sarkar and S. Misra},
booktitle={2015 IEEE International Conference on Communication Workshop (ICCW)},
title={Quantification of node misbehavior in wireless sensor networks: A social choice-based approach},
year={2015},
volume={},
number={},
pages={1479-1484},
keywords={wireless sensor networks;metric of misbehavior;node misbehavior quantification;social choice-based approach;theory of social choice;wireless sensor networks;Measurement;Method of moments;Nickel;Protocols;Sensors;Standards;Wireless sensor networks;Misbehavior;Quantification;Theory of Social Choice;Wireless sensor networks (WSNs)},
doi={10.1109/ICCW.2015.7247388},
ISSN={2164-7038},
month={June}
}


Let us focus first!
On your way from rags to riches, you will make extensive use of vectors. Vectors are one-dimension arrays that can hold numeric data, character data, or logical data. In other words, a vector is a simple tool to store data. For example, you can store your daily gains and losses in the casinos.
In R, you create a vector with the combine function c()
. You place the vector elements separated by a comma between the parentheses. For example:
numeric_vector <- c(1, 2, 3)
character_vector <- c("a", "b", "c")
Once you have created these vectors in R, you can use them to do calculations.
Complete the code such that boolean_vector
contains the three elements: TRUE
, FALSE
and TRUE
(in that order).
numeric_vector <- c(1, 10, 49)
character_vector <- c("a", "b", "c")
# Complete the code for boolean_vector
boolean_vector <-
numeric_vector <- c(1, 10, 49)
character_vector <- c("a", "b", "c")
# Complete the code for boolean_vector
boolean_vector <- c(TRUE, FALSE, TRUE)
msg <- "Do not change the code that defined `numeric_vector` and `character_vector`!"
test_object("numeric_vector", undefined_msg = msg, incorrect_msg = msg)
test_object("character_vector", undefined_msg = msg, incorrect_msg = msg)
test_object("boolean_vector",
incorrect_msg = "Make sure that you assign the correct values to `boolean_vector`. Use `c(TRUE, FALSE, TRUE)`. Don't place quotes around `TRUE` and `FALSE`! Also, make sure to adopt the same order as listed in the instructions.")
success_msg("Perfect! Notice that adding a space behind the commas in the `c()` function improves the readability of your code. Let's practice some more with vector creation in the next exercise.")
Assign c(TRUE, FALSE, TRUE)
to the variable boolean_vector
with the <-
operator.


[gecode-users] data structure for effiency
Christian Schulte
cschulte at kth.se
Thu Mar 15 15:42:19 CET 2007
Hi,
the problem is inherent in the two dimensional structure! Besides of the
performance problems you describe it will give poor propagation.
Suppose you have an x coordinate from {1,2,3,4} and a y coordinate from
{1,2,3,4}. Then the two coordinates can denote 16 different cells, so very
little information. In that case using an element constraint for accessing
cells will offer poor propagation whatever you use to organize the data
structure!
So if possible avoid two dimensional structures with variable-variables
access.
If one of the coordinates is a constant as in your example, you should
transpose the matrix to change row and column and not use a mult constraint.
For simple uses with matrices, check the Matrix class in the Minimodel. Some
of the examples use this.
Christian
--
Christian Schulte, http://www.imit.kth.se/~schulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Serdar Kadioglu
Sent: Thursday, March 15, 2007 2:43 PM
To: users at gecode.org
Subject: [gecode-users] data structure for effiency
Hi!
I would like to keep variables in a matrix data structure.
Array of arrays like VarArray<VarArray<IntVar>> did not work.
My aim is to reach a cell with an unknown row_IntVar , and known column_int
If I flatten everything in one dimensional VarArray
then to reach a cell I call;
element(Intvar_row * #of columns + column_int).
This multiplication and addition is just an index arithmetic but forces me
to call two linear() operations and create many redundant IntVar's for every
j.
Is there an efficient way of reaching these cells,
(may be a 2D structure that I am unaware of probably)
because this bottleneck really slows down the model.
Regards,
serdar
_______________________________________________
Gecode users mailing list
users at gecode.org https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list


From June through November 2010 in the People’s Republic of China, a disease characterized by a sudden onset was observed on many egg-laying and breeder duck farms. Egg production in affected ducks dropped severely within 1–2 weeks after disease onset. Other consistent signs included acute anorexia, antisocial behavior, rhinorrhea, diarrhea, ataxia, and paralysis. Rate of illness was usually high (up to 90%), and mortality rates varied from 5% to 30%. From affected ducks we isolated and identified a Tembusu virus (TMUV).
During the outbreak, we examined 11 diseased ducks (7 Pekin ducks, 3 Cherry Valley Pekin ducks, and 1 Shaoxing duck) from 5 duck farms in 4 provinces. At necropsy, viscera samples (e.g., brain, heart, liver, spleen, lung, theca folliculi) were collected and placed in 10% buffered formalin. Sections were embedded in paraffin and stained with hematoxylin and eosin. The theca folliculi from each duck were also used for virus isolation or detection by PCR.
The main pathologic changes observed consistently in almost all diseased ducks were found in the ovaries: hyperemia, hemorrhage, degeneration, distortion, macrophage and lymphocyte infiltration, and hyperplasia; in the liver, interstitial inflammation was found in the portal area ( Figure 1, panels A–C). On the basis of these changes, the disease was designated duck hemorrhagic ovaritis.
Pathologic changes in diseased Pekin ducks. A) Ovary with hyperemia, hemorrhage, and distortion. B) Ovary with hemorrhage (gold arrow), macrophage and lymphocyte infiltration and hyperplasia (green arrow). C) Liver with interstitial inflammation in the portal area (gold arrow). D and E) Ovaries from healthy ducks. F) Liver from healthy duck. A, C) Original magnification ×40; B, C, E, F) scale bars = 90 μm.
After samples underwent several rounds of screening and identification attempts, we concluded that a new virus infection was the most likely cause of the disease. One virus strain, designated YY5, was isolated from the Shaoxing duck after inoculation of clarified theca folliculus suspension into the allantoic cavities of 9-day-old specific pathogen–free chicken embryos. The embryos died 72–120 hours after inoculation, and severe cutaneous hemorrhages were observed.
Because eastern equine encephalitis (EEE) virus has been shown to cause paralysis in Pekin ducks ( 1 ), we performed EEE virus–specific nested reverse transcription PCR (RT-PCR) ( 2 ) to detect the isolate. RNA was extracted by using the TranZol RNA Extraction Kit (TransGen Biotech, Beijing, China). The primer pairs used to amplify the E2 gene of EEE virus (EEE-4 and cEEE-7, EEE-5 and cEEE-6) have been described ( 2 ). A clear PCR product (268 bp) resulted and was then sequenced; the deduced amino acid sequence was compared with other sequences by using a BLASTP ( http://blast.ncbi.nlm.nih.gov/Blast.cgi) search in GenBank. Unexpectedly, a 221-nt sequence (GenBank accession no. HQ641388) was shown to encode the nonstructural (NS) 1 protein of flavivirus, which exhibited 73%–85% identity to flaviviruses in the Ntaya virus and Japanese encephalitis virus groups, such as Bagaza virus (GenBank accession no. ACG60714 [ 3 ],) and St. Louis encephalitis virus (GenBank accession no. ABN11829 [ 4]). The result demonstrated the possible presence of a flavivirus in ducks.
To further confirm flavivirus as the causative agent of duck hemorrhagic ovaritis, we used PCR to test the isolate and clinical samples with forward primer Usu5454f (5′-ATGGATGAAGCYCATTTCAC-3′) ( 5 ) and a newly designed reverse primer 5861R (5′-CCAAAGTTGGCYCCCATCTC-3′). The primers were located in the conserved regions of the NS3 sequences of Bagaza virus, St. Louis encephalitis virus, and Usutu virus ( 3 – 5 ) and were predicted to produce an ≈400-bp amplicon. The reaction conditions were as follows: 5 min at 94°C; followed by 38 cycles of denaturation at 94°C for 40 s, annealing at 47°C for 35 s, and extension at 72°C for 1 min; and a final extension of 72°C for 10 min. RT-PCR was optimized by using the following controls, including nucleic acids extracted from theca folliculi of healthy Pekin ducks: avian influenza virus, Newcastle disease virus, egg drop syndrome virus, anatid herpesvirus 1, Muscovy duck parvovirus, goose parvovirus, duck reovirus, goose reovirus, duck hepatitis A virus, duck astrovirus, duck circovirus, and goose hemorrhagic polyomavirus.
All 11 theca folliculus samples and the isolate were positive for flavivirus by RT-PCR, which was confirmed by amplicon sequencing. The 367-nt sequence (GenBank accession no. HQ641389) of part of the NS3 genomic region obtained from the isolate was 66%–77% identical to the corresponding sequence of viruses in the Ntaya virus and Japanese encephalitis virus groups. The amplicon sequences from the 11 theca folliculus samples shared 98%–100% identity with the YY5 isolate. PCR testing of another 52 samples from diseased ducks from the 4 provinces detected flavivirus-specific RNA in 29 samples. Overall, 40 (63.5%) of 63 samples were positive for flavivirus. Flavivirus-specific RNA was most frequently detected in theca folliculi, followed by intestinal mucosa, uterus, spleen, trachea, cloaca (swab), and liver ( Table).
| Sample | No. (%) flavivirus positive | No. flavivirus negative |
|---|---|---|
| Theca folliculi, n = 15 | 14 (93.3) | 1 |
| Intestinal mucosa, n = 4 | 3 (75.0) | 1 |
| Uterus, n = 7 | 5 (71.4) | 2 |
| Spleen, n = 9 | 6 (66.7) | 3 |
| Trachea, n = 2 | 1 (50.0) | 1 |
| Cloacal swab, n = 17 | 8 (47.1) | 9 |
| Liver, n = 9 | 3 (33.3) | 6 |
Subsequently, the YY5 isolate was injected intramuscularly into nine 55-week-old Pekin ducks and ten 30-week-old Shaoxing ducks. At day 4 postinoculation, the pathologic changes were reproduced in these experimentally infected ducks. The flavivirus RNA was detected by NS3-based RT-PCR, and the virus was again isolated from theca folliculi.
To investigate the genetic relationship of the isolate with flaviviruses, we obtained the genomic sequence of a 1,035-bp segment at the 3′ terminus of the NS5 gene (GenBank accession no. HQ641390) from strain YY5 by RT-PCR and primers FU1 and cFD3 as described ( 6 ). Phylogenetic analysis showed that YY5 was more closely related to TMUV than to other flaviviruses ( Figure 2). Comparative sequence analysis showed that YY5 was 87%–91% identical to different strains of TMUV; therefore, we classified the flavivirus isolated from ducks as a new genotype of TMUV, a mosquito-borne flavivirus of the Ntaya virus group.
Phylogenetic analysis of isolate YY5 (in boldface) from an ill Shaoxing duck in the People’s Republic of China and selected other flaviviruses obtained by using an ≈1-kb nt sequence in the nonstructural 5 genomic region. The tree was constructed by the neighbor-joining method of MEGA ( 7 ). Numbers at nodes indicate bootstrap percentages obtained after 1,000 replicates; only bootstrap values >70% are shown. Scale bar indicates genetic distance.  The nucleotide sequence of isolate YY5 used in the phylogenetic analysis has been deposited in GenBank under accession no. HQ641390.
We have demonstrated the presence of a mosquito-borne flavivirus in ducks. On the basis of criteria for species of the members of the genus Flavivirus ( 6 ) and phylogenetic analysis, we consider the isolate to belong to a new genotype of TMUV.
In this study, we found TMUV-specific RNA in 63.5% samples from diseased ducks in different provinces. In particular, it was found in 14 (93.3%) of 15 theca folliculus samples, suggesting that reproductive tissues may be a major site for viral persistence, replication, or both. Experimental infections further confirmed that TMUV can be reisolated from theca folliculi. These results suggested that TMUV may be the causative agent of duck hemorrhagic ovaritis.
Because TMUV belongs to the mosquito-borne virus cluster of flaviviruses, mosquitoes might be involved in the spread of this virus. Detection of the virus in cloacal swab samples suggests probable horizontal transmission through ingestion or inhalation of feces-contaminated material.
TMUV was originally isolated from mosquitoes of the genus Culex, but the disease associated with TMUV infection was not known. However, a chick-origin TMUV isolate, originally named Sitiawan virus, can cause encephalitis and retarded growth in broiler chicks ( 8 ). In conclusion, this study shows that duck-origin TMUV is highly pathogenic for Pekin ducks, Cherry Valley Pekin ducks, and Shaoxing ducks.
Suggested citation for this article: Cao Z, Zhang C, Liu Y, Ye W, Han J, Ma G, et al. Tembusu virus in ducks, China. Emerg Infect Dis [serial on the Internet]. 2011 Oct [ date cited]. http://dx.doi.org/10.3201/eid1710.101890
These authors contributed equally to this article.
This work was supported by China Agriculture Research System (CARS-43) and the China Mega-Project for Infectious Disease (2008ZX10004-001).
Ms Cao is a graduate student at College of Veterinary Medicine, China Agricultural University in Beijing, in the Modern Agro-industry Technology Research System. Her research focuses on the identification and characterization of novel viruses found in waterfowl.


public class SecurityServerType
extends java.lang.Object
Java class for SecurityServerType complex type.
The following schema fragment specifies the expected content contained within this class.
<complexType name="SecurityServerType"> <complexContent> <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> <sequence> <element name="owner" type="{http://www.w3.org/2001/XMLSchema}IDREF"/> <element name="serverCode" type="{http://www.w3.org/2001/XMLSchema}string"/> <element name="address" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> <element name="authCertHash" type="{http://www.w3.org/2001/XMLSchema}base64Binary" maxOccurs="unbounded" minOccurs="0"/> <element name="client" type="{http://www.w3.org/2001/XMLSchema}IDREF" maxOccurs="unbounded" minOccurs="0"/> </sequence> </restriction> </complexContent> </complexType>
| Constructor and Description |
|---|
SecurityServerType() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAddress()
Gets the value of the address property.
|
java.util.List<byte[]> |
getAuthCertHash()
Gets the value of the authCertHash property.
|
java.util.List<javax.xml.bind.JAXBElement<java.lang.Object>> |
getClient()
Gets the value of the client property.
|
java.lang.Object |
getOwner()
Gets the value of the owner property.
|
java.lang.String |
getServerCode()
Gets the value of the serverCode property.
|
void |
setAddress(java.lang.String value)
Sets the value of the address property.
|
void |
setOwner(java.lang.Object value)
Sets the value of the owner property.
|
void |
setServerCode(java.lang.String value)
Sets the value of the serverCode property.
|
public java.lang.Object getOwner()
Object
public void setOwner(java.lang.Object value)
value
- allowed object is Object
public java.lang.String getServerCode()
String
public void setServerCode(java.lang.String value)
value
- allowed object is String
public java.lang.String getAddress()
String
public void setAddress(java.lang.String value)
value
- allowed object is String
public java.util.List<byte[]> getAuthCertHash()
This accessor method returns a reference to the live list, not a snapshot. Therefore any
modification you make to the returned list will be present inside the JAXB object. This is why
there is not a set
method for the authCertHash property.
For example, to add a new item, do as follows:
getAuthCertHash().add(newItem);
Objects of the following type(s) are allowed in the list byte[]
public java.util.List<javax.xml.bind.JAXBElement<java.lang.Object>> getClient()
This accessor method returns a reference to the live list, not a snapshot. Therefore any
modification you make to the returned list will be present inside the JAXB object. This is why
there is not a set
method for the client property.
For example, to add a new item, do as follows:
getClient().add(newItem);
Objects of the following type(s) are allowed in the list JAXBElement
<
Object
>
JAXBElement


Chuck Norris does not depend on anybody, but everybody depends on Chuck Norris
NOTE This document is accurate as of norris-ioc v0.0.1
NORRIS IoC is an inversion-of-control container whose aim is to make it easy to define dependencies in your Node.JS application's modules. It is originally written for the NORRIS project, but it can be used as a general purpose container for any projects as long as they conform to certain design constraints.
What is Inversion-of-control? In your application, each individual module has a list of dependencies. They can look like this:
var fs = require('fs');
var path = require('path');
module.exports.run = function run() {
// Code here ...
}
In the above example, "fs" and "path" are dependencies towards two Node.JS core modules, which in turn is dependant on your computer's file system. If you have written your module in this manner, it will make unit testing difficult because then it'll be hard to control the unit testing environment.
To allow your unit test suite to "inject" a virtual file system as a fixture into your module would be difficult, if not impossible. The most sensible way of doing so would be to add a inject() function to your code to replace your current dependencies.
var fs = require('fs');
var path = require('path');
module.exports.run = function run() {
// Code here ...
}
module.exports.inject = function inject(deps) {
fs = (undefined !== deps.fs) ? deps.fs : fs;
path = (undefined !== deps.path) ? deps.path : path;
}
The problem with this approach is that there're too much code to write for something so simple, not to mention that maintenance of your service locator/factory would soon snowball out of hand if you're not careful.
NORRIS IoC aims to solve this by providing a novel way of defining your dependencies.
Installation is simple. If you have NPM, just type this in your working directory:
$ npm install norris-ioc
Once installation is complete, you can use NORRIS IoC anywhere in your project simply by requiring it:
var ioc = require('norris-ioc').make(); // Don't forget the make() call!
NORRIS IoC is written to work asynchonously. There is no way to use it synchronously (will be added in the next version).
To use NORRIS IoC in your project, first you include the module, then you define a dependency definition, and the finally call the load() function:
var ioc = require('norris-ioc').make();
var deps = module.exports.deps = {
fs : '[node] fs',
npm : '[npm] npm'
}
ioc.load(deps, function onLoad(err, loaded) {
console.log(loaded.fs); // result should be the same as require('fs');
console.log(loaded.npm); // result should be the same as require('npm');
});
"Signatures" are specialized functions in NORRIS IoC that is responsible for loading modules of a certain type. Currently, it only supports two signatures: "node" and "npm".
In the dependency definition object, the signature definition uses this syntax:
var deps = { object_key : "[type] module_name" }
Thus, if you want to load a node core module, simply type:
var deps = { events : "[node] events" }
Which would be equivalent to:
var events = require('events');
NORRIS IoC comes supporting npm module signatures as well. Unlike node core modules however, NORRIS IoC will automatically install the npm module for you if it doesn't exists, eliminating the need to manually define a package.json file and then remembering to run "npm install" everytime you clone your project form your repository.
var deps = { module_key : "[npm] module_name" }
Which is equivalent to:
$ npm install module_name
var module_key = require('module_name');
Two birds with one stone. :)
The true purpose of signatures however, is to allow you to replace dependant modules with your own, which is a very common case in unit testing where you would want to replace concrete modules with mocks.
Doing this with NORRIS-IoC is extremely simple. Just call attach() before load():
var ioc = require('ioc').make();
ioc.attach('norris', function loadNorris(key, module, callback) {
try {
var norrisMod = require('./norris/' + module);
callback(null, key, norrisMod);
} catch (err) {
callback(err);
}
});
This will allow you to use the "norris" signature by doing this:
var deps = { roundhouse : "[norris] kick" }
Which would be equivalent to:
var roundhouse = require('./norris/kick');
Installation:
$ npm install norris-ioc
Importing the ioc container:
var ioc = require('ioc').make();
Loading a node module using the callback style:
var ioc = require('ioc').make();
var deps = {
file_system : "[node] fs"
}
ioc.load(deps, function onLoad(err, loaded) {
console.log(loaded.file_system);
});
Loading a node module using the promise style:
ioc = require('ioc').make();
var deps = {
file_system : "[node] fs"
}
var promise = ioc.load(deps);
promise.on('success', function onSuccess(loaded){
console.log(loaded.file_system);
});
Adding/Replacing a signature:
var ioc = require('ioc').make();
var deps = {
file_system : "[node] fs"
}
function mockNode(key, module, callback) {
var success = true;
if (success) {
var mock_fs = {
readdir : function() { console.log('mock readdir called'); }
};
callback(null, key, mock_fs);
} else {
callback(new Error('Loading failed!'));
}
});
ioc.attach('node', mockNode)
.load(deps, function onLoad(err, loaded) {
console.log(loaded.file_system); // Should only have "readdir" function defined
});
You can fork my repo on github if you want to contribute to this project:
Alternatively, look up and right. Click on that orange ribbon.
NORRIS IoC is licensed under the MIT license, which basically means you can use NORRIS IoC in any projects (both non-profit and commercial) or modify it as you see fit as long as you retain the copyright header in the source files. And no, you do not need to credit me for anything, just as long as you don't claim it as being your own.
Copyright (C) 2011 by Ruben L Z Tan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Shell scripting¶
Introduction¶
Instead of typing all the UNIX commands we need to perform one after the other, we can save them all in a file (a “script”) and execute them all at once. Recall from the UNIX and Linux Chapter that the bash shell (or terminal) is a text command processor that interfaces with the Operating System. The bash shell provides a computer language that can be used to build scripts (AKA shell scripts) that can be run through the terminal.
What shell scripts are good for¶
It is possible to write reasonably sophisticated programs with shell scripting, but the bash language is not featured to the extent that it can replace a “proper” language like C, Python, or R. However, you will find that shell scripting is necessary. This is because as such, as you saw in the previous chapter, UNIX has an incredibly powerful set of tools that can be used thorugh the bash terminal. Shell scripts can allow you to automate the usage of these commands and create your own, simple utility tools/scripts/programs for tasks such as backups, converting file formats, handling & manipulating files and directories). This enables you to perform many everyday tasks on your computer without having to invoke another language that might require installation or updating.
Your first shell script¶
Let’s write our first shell script.
\(\star\) Write and save a file called boilerplate.sh
in CMEECourseWork/week1/code
, and add the following script to it
(type it in your code editor):
#!/bin/bash
# Author: Your Name<EMAIL_ADDRESS># Script: boilerplate.sh
# Desc: simple boilerplate for shell scripts
# Arguments: none
# Date: Oct 2019
echo -e "\nThis is a shell script! \n" #what does -e do?
#exit
The .sh
extension is not necessary, but useful for you and your programing IDE (e.g., Visual Studio Code, Emacs, etc) to identifying the file type.
The first line is a “shebang” (or sha-bang or hashbang or pound-bang or hash-exclam or hash-pling! – Wikipedia). It can also can be written as
#!/bin/sh
. It tells the bash interpreter that this is a bash script and that it should be interpreted and run as such.The hash marks in the following lines tell the interpreter that it should ignore the lines following them (that’s how you put in script documentation (who wrote the script and when, what the script does, etc.) and comments on particular line of script.
Note that there is a commented out
exit
command at the end of the script. Uncommenting it will not change the behavior of the script, but will allow you to generate a error code, and if the command is inserted in the middle of the script, to stop the code at that point. To find out more, see this and this in particular.
Next, let’s run this script.
Running shell scripts¶
There are two ways of running a script:
Call the interpreter bash to run the file:
bash myscript.sh
(You can also use sh myscript.sh
)
This is the right way if the script is does something specific in a given project.
Make the script executable and execute it:
chmod +x myscript.sh
./myscript.sh # the ./ is needed
Use this second approach for a script that does something generic, and is likely to be reused again and again (Can you think of examples?)
The generic scripts of type (2) can be saved in username/bin/
, and made easily accessible by telling UNIX to look in /home/bin
for commands
mkdir ~/bin
PATH=$PATH:$HOME/bin
So let’s run your first shell script.
\(\star\) cd
to your code
directory, and run it (here I am assuming you are in sandbox
or data
, continuing where you left off in the Unix and Linux Chapter):
cd ../code
bash boilerplate.sh
This is a shell script!
A useful shell-scripting example¶
Let’s write a shell script to transform comma-separated files (csv) to tab-separated files and vice-versa. This can be handy — for example, in certain computer languages, it is much easier to read tab or space
separated files than csv (e.g., C
)
To do this, in the bash we can use tr
(abbreviation of tr
anslate or tr
ansliterate), which deletes or substitute characters. Here are some examples.
echo "Remove excess spaces." | tr -s " "
Remove excess spaces.
echo "remove all the a's" | tr -d "a"
remove ll the 's
echo "set to uppercase" | tr [:lower:] [:upper:]
SET TO UPPERCASE
echo "10.00 only numbers 1.33" | tr -d [:alpha:] | tr -s " " ","
10.00,1.33
Now write a shell script to substitute all tabs with commas called tabtocsv.sh
in week1/code
:
#!/bin/bash
# Author: Your name<EMAIL_ADDRESS># Script: tabtocsv.sh
# Description: substitute the tabs in the files with commas
#
# Saves the output into a .csv file
# Arguments: 1 -> tab delimited file
# Date: Oct 2019
echo "Creating a comma delimited version of $1 ..."
cat $1 | tr -s "\t" "," >> $1.csv
echo "Done!"
exit
Now test it (note where the output file gets saved and why). First create a text file with tab-separated text:
echo -e "test \t\t test" >> ../sandbox/test.txt # again, note the relative path!
Now run your script on it
bash tabtocsv.sh ../sandbox/test.txt
Creating a comma delimited version of ../sandbox/test.txt ...
Done!
Note that
$1
is the way a shell script defines a placeholder for a variable (in this case the filename). See next section for more on variable names in shell scripts.The new file gets saved in the same location as the original (Why is that?)
The file got saved with a
.txt.csv
extension. That’s not very nice. Later you will get an opportunity to fix this!
Variables in shell scripts¶
There are three ways to assign values to variables (note lack of spaces!):
Explicit declaration:
MYVAR=myvalue
Reading from the user:
read MYVAR
Command substitution:
MYVAR=\$( (ls | wc -l) )
Here are some examples of assignments (try them out and save as a single week1/code/variables.sh
script):
#!/bin/bash
# Shows the use of variables
MyVar='some string'
echo 'the current value of the variable is' $MyVar
echo 'Please enter a new string'
read MyVar
echo 'the current value of the variable is' $MyVar
## Reading multiple values
echo 'Enter two numbers separated by space(s)'
read a b
echo 'you entered' $a 'and' $b '. Their sum is:'
mysum=`expr $a + $b`
echo $mysum
And also (save as week1/code/MyExampleScript.sh
):
#!/bin/bash
msg1="Hello"
msg2=$USER
echo "$msg1 $msg2"
echo "Hello $USER"
echo
Some more examples¶
Here are a few more illustrative examples (test each one out, save in week1/code/
with the given name):
Count lines in a file¶
Save this as CountLines.sh
:
#!/bin/bash
NumLines=`wc -l < $1`
echo "The file $1 has $NumLines lines"
echo
The <
redirects the contents of the file to the stdin (standard input) of the command wc -l
. It is needed here because without it, you would not be able to catch just the numerical output (number of lines). To see this, try deleting <
from the script and see what the output looks like (it will also print the script name, which you do not want).
Concatenate the contents of two files¶
Save this as ConcatenateTwoFiles.sh
:
#!/bin/bash
cat $1 > $3
cat $2 >> $3
echo "Merged File is"
cat $3
Convert tiff to png¶
This assumes you have done apt install imagemagick
(remember sudo
!)
Save this as tiff2png.sh
:
#!/bin/bash
for f in *.tif;
do
echo "Converting $f";
convert "$f" "$(basename "$f" .tif).png";
done
Practicals¶
Instructions¶
Along with the completeness of the practicals/exercises themselves, you will be marked on the basis of how complete and well-organized your directory structure and content is.
Review (especially if you got lost along the way) and make sure all the shell scripts you created in this chapter are functional.
Make sure you have your weekly directory organized with
data
,sandbox
,code
with the necessary files, underCMEECourseWork/week1
.All scripts should run on any other Unix/Linux machine — for example, always call data from the
data
directory using relative paths.Make sure there is a
readme
file in every week’s directory. This file should give an overview of the weekly directory contents, listing all the scripts and what they do. This is different from thereadme
for your overall git repository, of whichWeek 1
is a part. You will write a similarreadme
for each subsequent weekly submission.Don’t put any scripts that are part of the submission in your
home/bin
directory! You can put a copy there, but a working version should be in your repository.
Improving scripts¶
Note that some of the shell scripts that you have created in this chapter above requires input files. For example, tabtocsv.sh
needs one input file, and ConcatenateTwoFiles.sh
needs two. When you run any of these scripts without inputs (e.g., just bash tabtocsv.sh
), you either get no result, or an error.
The goal of this exercise is to make each such script robust so that it gives feedback to the user and exits if the right inputs are not provided.
A new shell script¶
Write a
csvtospace.sh
shell script that takes ac
ommas
eparatedv
alues and converts it to a space separated values file. However, it must not change the input file — it should save it as a differently named file.This script should be able to handle wronmg or missing inputs (similar to the previous exercise (a)).
Save the script in
CMEECourseWork/week1/code
, and run it on thecsv
data files that are inTemperatures
in the master repository’sData
directory.
Readings & Resources¶
Plenty of shell scripting resources and tutorials out there; in particular, look up http://www.tutorialspoint.com/unix/unix-using-variables.htm
Some shell scripting examples


Hey! I've created a project for you. This is what you've got
Technologies
- Gulp.js
- Babel
- Sass
- HTML
- Flexboxgrid
Happy Coding!
Getting Started
The starterkit allows you to create and build awesome sites without worrying about anything else. To get started, just run the default gulp task.
$ gulp
Don't forget to star the generator-starterkit project on GitHub!
Exploring Starterkit Features
Starterkit comes with a lot of tasks that can be runned with:
$ gulp taskname
Let's take a look at them. There are 4 main tasks that groups a bunch of other subtasks. You can run directly a group of tasks using the main one, or just a specific one by their name.
- gulp : Default dev task, watch and serves your code, compiling on change and injecting them into the browser.
- build : Compiles styles and templates, transpiles scripts, optimizes images and beautifies prepro files.
- optimize : Clean unused CSS, extract critical path, compress images.
- deploy : Upload your /dist folder into your server.
To see with more detail the subtasks runned, please take a look at the starterkit documentation on GitHub.
Documentation


blood testing tests risk United virus transmission {border-style hepatitis px;} #ffffff;} []. approach infectious transfusion donor disease used donors agent infection test infections development early however, implementation known outbreak safety specific viral However, Zika antibodies based emerging sensitive States cases impact infection. number prior px; questions tests. use {font-family HIV Nile States, West agents available effective font-size human methods outbreaks platelet potential questioning rapid recognition reduce usually HBV NAT additional appropriate areas bacterial cases, concern diseases double; efforts infections. led measures particularly pathogen serologic transfusion-transmitted HBV, HCV, HIV. States. agents. antibody antigen border-color border-width case detect different form generally identified implemented important information presence reduction safety. significant solid; surrogate time travel tropical years {font-style {font-weight AIDS Blood HIV, Health Indeed, Safety Tests WNV accepted appearance arboviruses asymptomatic bacteria, bold case, chapter chronic circulating concentrates countries courier; detectable develop did donation donations em; essentially given interventions level levels likely little long matter order period phase place possible product pt;} question readily resources result routinely sample situation spread symptoms threat transfusion-transmissible transfusion. transmitted viruses window


DO NOT READ THIS FILE ON GITHUB, GUIDES ARE PUBLISHED ON https://guides.rubyonrails.org.
Classic to Zeitwerk HOWTO
This guide documents how to migrate Rails
applications from classic
to zeitwerk
mode.
After reading this guide, you will know:
- What are
classic
andzeitwerk
modes - Why switch from
classic
tozeitwerk
- How to activate
zeitwerk
mode - How to verify your application runs in
zeitwerk
mode - How to verify your project loads OK in the command line
- How to verify your project loads OK in the test suite
- How to address possible edge cases
- New features in Zeitwerk you can leverage
What are classic
and zeitwerk
Modes?
From the very beginning, and up to Rails
5, Rails
used an autoloader implemented in Active Support. This autoloader is known as classic
and is still available in Rails
6.x. Rails
7 does not include this autoloader anymore.
Starting with Rails
6, Rails
ships with a new and better way to autoload, which delegates to the Zeitwerk gem. This is zeitwerk
mode. By default, applications loading the 6.0 and 6.1 framework defaults run in zeitwerk
mode, and this is the only mode available in Rails
7.
Why Switch from classic
to zeitwerk
?
The classic
autoloader has been extremely useful, but had a number of issues that made autoloading a bit tricky and confusing at times. Zeitwerk was developed to address this, among other motivations.
When upgrading to Rails
6.x, it is highly encouraged to switch to zeitwerk
mode because it is a better autoloader, classic
mode is deprecated.
Rails
7 ends the transition period and does not include classic
mode.
I am Scared
Don't be :).
Zeitwerk was designed to be as compatible with the classic autoloader as possible. If you have a working application autoloading correctly today, chances are the switch will be easy. Many projects, big and small, have reported really smooth switches.
This guide will help you change the autoloader with confidence.
If for whatever reason you find a situation you don't know how to resolve, don't hesitate to open an issue in rails/rails
and tag @fxn
.
How to Activate zeitwerk
Mode
Applications Running Rails 5.x or Less
In applications running a Rails
version previous to 6.0, zeitwerk
mode is not available. You need to be at least in Rails
6.0.
Applications Running Rails 6.x
In applications running Rails
6.x there are two scenarios.
If the application is loading the framework defaults of Rails
6.0 or 6.1 and it is running in classic
mode, it must be opting out by hand. You have to have something similar to this:
# config/application.rb
config.load_defaults 6.0
config.autoloader = :classic # DELETE THIS LINE
As noted, just delete the override, zeitwerk
mode is the default.
On the other hand, if the application is loading old framework defaults you need to enable zeitwerk
mode explicitly:
# config/application.rb
config.load_defaults 5.2
config.autoloader = :zeitwerk
Applications Running Rails 7
In Rails 7 there is only zeitwerk
mode, you do not need to do anything to enable it.
Indeed, in Rails 7 the setter config.autoloader=
does not even exist. If config/application.rb
uses it, please delete the line.
How to Verify The Application Runs in zeitwerk
Mode?
To verify the application is running in zeitwerk
mode, execute
bin/rails runner 'p Rails.autoloaders.zeitwerk_enabled?'
If that prints true
, zeitwerk
mode is enabled.
Does my Application Comply with Zeitwerk Conventions?
config.eager_load_paths
Compliance test runs only for eager loaded files. Therefore, in order to verify Zeitwerk compliance, it is recommended to have all autoload paths in the eager load paths.
This is already the case by default, but if the project has custom autoload paths configured just like this:
config.autoload_paths << "#{Rails.root}/extras"
those are not eager loaded and won't be verified. Adding them to the eager load paths is easy:
config.autoload_paths << "#{Rails.root}/extras"
config.eager_load_paths << "#{Rails.root}/extras"
zeitwerk:check
Once zeitwerk
mode is enabled and the configuration of eager load paths double-checked, please run:
bin/rails zeitwerk:check
A successful check looks like this:
% bin/rails zeitwerk:check
Hold on, I am eager loading the application.
All is good!
There can be additional output depending on the application configuration, but the last "All is good!" is what you are looking for.
If the double-check explained in the previous section determined actually there have to be some custom autoload paths outside the eager load paths, the task will detect and warn about them. However, if the test suite loads those files successfully, you're good.
Now, if there's any file that does not define the expected constant, the task will tell you. It does so one file at a time, because if it moved on, the failure loading one file could cascade into other failures unrelated to the check we want to run and the error report would be confusing.
If there's one constant reported, fix that particular one and run the task again. Repeat until you get "All is good!".
Take for example:
% bin/rails zeitwerk:check
Hold on, I am eager loading the application.
expected file app/models/vat.rb to define constant Vat
VAT is an European tax. The file app/models/vat.rb
defines VAT
but the autoloader expects Vat
, why?
Acronyms
This is the most common kind of discrepancy you may find, it has to do with acronyms. Let's understand why do we get that error message.
The classic autoloader is able to autoload VAT
because its input is the name of the missing constant, VAT
, invokes underscore
on it, which yields vat
, and looks for a file called vat.rb
. It works.
The input of the new autoloader is the file system. Given the file vat.rb
, Zeitwerk invokes camelize
on vat
, which yields Vat
, and expects the file to define the constant Vat
. That is what the error message says.
Fixing this is easy, you only need to tell the inflector about this acronym:
# config/initializers/inflections.rb
ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.acronym "VAT"
end
Doing so affects how Active Support inflects globally. That may be fine, but if you prefer you can also pass overrides to the inflectors used by the autoloaders:
# config/initializers/zeitwerk.rb
Rails.autoloaders.main.inflector.inflect("vat" => "VAT")
With this option you have more control, because only files called exactly vat.rb
or directories exactly called vat
will be inflected as VAT
. A file called vat_rules.rb
is not affected by that and can define VatRules
just fine. This may be handy if the project has this kind of naming inconsistencies.
With that in place, the check passes!
% bin/rails zeitwerk:check
Hold on, I am eager loading the application.
All is good!
Once all is good, it is recommended to keep validating the project in the test suite. The section Check Zeitwerk Compliance in the Test Suite explains how to do this.
Concerns
You can autoload and eager load from a standard structure with concerns
subdirectories like
app/models
app/models/concerns
By default, app/models/concerns
belongs to the autoload paths and therefore it is assumed to be a root directory. So, by default, app/models/concerns/foo.rb
should define Foo
, not Concerns::Foo
.
If your application uses Concerns
as namespace, you have two options:
- Remove the
Concerns
namespace from those classes and modules and update client code. - Leave things as they are by removing
app/models/concerns
from the autoload paths:
# config/initializers/zeitwerk.rb
ActiveSupport::Dependencies.
autoload_paths.
delete("#{Rails.root}/app/models/concerns")
Having app
in the Autoload Paths
Some projects want something like app/api/base.rb
to define API::Base
, and add app
to the autoload paths to accomplish that.
Since Rails adds all subdirectories of app
to the autoload paths automatically (with a few exceptions), we have another situation in which there are nested root directories, similar to what happens with app/models/concerns
. That setup no longer works as is.
However, you can keep that structure, just delete app/api
from the autoload paths in an initializer:
# config/initializers/zeitwerk.rb
ActiveSupport::Dependencies.
autoload_paths.
delete("#{Rails.root}/app/api")
Beware of subdirectories that do not have files to be autoloaded/eager loaded. For example, if the application has app/admin
with resources for ActiveAdmin, you need to ignore them. Same for assets
and friends:
# config/initializers/zeitwerk.rb
Rails.autoloaders.main.ignore(
"app/admin",
"app/assets",
"app/javascripts",
"app/views"
)
Without that configuration, the application would eager load those trees. Would err on app/admin
because its files do not define constants, and would define a Views
module, for example, as an unwanted side-effect.
As you see, having app
in the autoload paths is technically possible, but a bit tricky.
Autoloaded Constants and Explicit Namespaces
If a namespace is defined in a file, as Hotel
is here:
app/models/hotel.rb # Defines Hotel.
app/models/hotel/pricing.rb # Defines Hotel::Pricing.
the Hotel
constant has to be set using the class
or module
keywords. For example:
class Hotel
end
is good.
Alternatives like
Hotel = Class.new
or
Hotel = Struct.new
won't work, child objects like Hotel::Pricing
won't be found.
This restriction only applies to explicit namespaces. Classes and modules not defining a namespace can be defined using those idioms.
One File, One Constant (at the Same Top-level)
In classic
mode you could technically define several constants at the same top-level and have them all reloaded. For example, given
# app/models/foo.rb
class Foo
end
class Bar
end
while Bar
could not be autoloaded, autoloading Foo
would mark Bar
as autoloaded too.
This is not the case in zeitwerk
mode, you need to move Bar
to its own file bar.rb
. One file, one top-level constant.
This affects only to constants at the same top-level as in the example above. Inner classes and modules are fine. For example, consider
# app/models/foo.rb
class Foo
class InnerClass
end
end
If the application reloads Foo
, it will reload Foo::InnerClass
too.
Globs in config.autoload_paths
Beware of configurations that use wildcards like
config.autoload_paths += Dir["#{config.root}/extras/**/"]
Every element of config.autoload_paths
should represent the top-level namespace (Object
). That won't work.
To fix this, just remove the wildcards:
config.autoload_paths << "#{config.root}/extras"
Decorating Classes and Modules from Engines
If your application decorates classes or modules from an engine, chances are it is doing something like this somewhere:
config.to_prepare do
Dir.glob("#{Rails.root}/app/overrides/**/*_override.rb").sort.each do |override|
require_dependency override
end
end
That has to be updated: You need to tell the main
autoloader to ignore the directory with the overrides, and you need to load them with load
instead. Something like this:
overrides = "#{Rails.root}/app/overrides"
Rails.autoloaders.main.ignore(overrides)
config.to_prepare do
Dir.glob("#{overrides}/**/*_override.rb").sort.each do |override|
load override
end
end
before_remove_const
Rails 3.1 added support for a callback called before_remove_const
that was invoked if a class or module responded to this method and was about to be reloaded. This callback has remained otherwise undocumented and it is unlikely that your code uses it.
However, in case it does, you can rewrite something like
class Country < ActiveRecord::Base
def self.before_remove_const
expire_redis_cache
end
end
as
# config/initializers/country.rb
if Rails.application.config.reloading_enabled?
Rails.autoloaders.main.on_unload("Country") do |klass, _abspath|
klass.expire_redis_cache
end
end
Spring and the test
Environment
Spring reloads the application code if something changes. In the test
environment you need to enable reloading for that to work:
# config/environments/test.rb
config.cache_classes = false
or, since Rails 7.1:
# config/environments/test.rb
config.enable_reloading = true
Otherwise, you'll get:
reloading is disabled because config.cache_classes is true
or
reloading is disabled because config.enable_reloading is false
This has no performance penalty.
Bootsnap
Please make sure to depend on at least Bootsnap 1.4.4.
Check Zeitwerk Compliance in the Test Suite
The task zeitwerk:check
is handy while migrating. Once the project is compliant, it is recommended to automate this check. In order to do so, it is enough to eager load the application, which is all zeitwerk:check
does, indeed.
Continuous Integration
If your project has continuous integration in place, it is a good idea to eager load the application when the suite runs there. If the application cannot be eager loaded for whatever reason, you want to know in CI, better than in production, right?
CIs typically set some environment variable to indicate the test suite is running there. For example, it could be CI
:
# config/environments/test.rb
config.eager_load = ENV["CI"].present?
Starting with Rails 7, newly generated applications are configured that way by default.
Bare Test Suites
If your project does not have continuous integration, you can still eager load in the test suite by calling Rails.application.eager_load!
:
Minitest
require "test_helper"
class ZeitwerkComplianceTest < ActiveSupport::TestCase
test "eager loads all files without errors" do
assert_nothing_raised { Rails.application.eager_load! }
end
end
RSpec
require "rails_helper"
RSpec.describe "Zeitwerk compliance" do
it "eager loads all files without errors" do
expect { Rails.application.eager_load! }.not_to raise_error
end
end
Delete any require
Calls
In my experience, projects generally do not do this. But I've seen a couple, and have heard of a few others.
In Rails application you use require
exclusively to load code from lib
or from 3rd party like gem dependencies or the standard library. Never load autoloadable application code with require
. See why this was a bad idea already in classic
here.
require "nokogiri" # GOOD
require "net/http" # GOOD
require "user" # BAD, DELETE THIS (assuming app/models/user.rb)
Please delete any require
calls of that type.
New Features You Can Leverage
Delete require_dependency
Calls
All known use cases of require_dependency
have been eliminated with Zeitwerk. You should grep the project and delete them.
If your application uses Single Table Inheritance, please see the Single Table Inheritance section of the Autoloading and Reloading Constants (Zeitwerk Mode) guide.
Qualified Names in Class and Module Definitions are Now Possible
You can now robustly use constant paths in class and module definitions:
# Autoloading in this class body matches Ruby semantics now.
class Admin::UsersController < ApplicationController
# ...
end
A gotcha to be aware of is that, depending on the order of execution, the classic autoloader could sometimes be able to autoload Foo::Wadus
in
class Foo::Bar
Wadus
end
That does not match Ruby semantics because Foo
is not in the nesting, and won't work at all in zeitwerk
mode. If you find such corner case you can use the qualified name Foo::Wadus
:
class Foo::Bar
Foo::Wadus
end
or add Foo
to the nesting:
module Foo
class Bar
Wadus
end
end
Thread-safety Everywhere
In classic
mode, constant autoloading is not thread-safe, though Rails has locks in place for example to make web requests thread-safe.
Constant autoloading is thread-safe in zeitwerk
mode. For example, you can now autoload in multi-threaded scripts executed by the runner
command.
Eager Loading and Autoloading are Consistent
In classic
mode, if app/models/foo.rb
defines Bar
, you won't be able to autoload that file, but eager loading will work because it loads files recursively blindly. This can be a source of errors if you test things first eager loading, execution may fail later autoloading.
In zeitwerk
mode both loading modes are consistent, they fail and err in the same files.


Wallux
Wallux is a collection of wallpapers that this repo author's thought
looks cool
.
Want to add something you think as cool? Create a
Pull Request!
Enter the Wallux ID of the wallpaper you like in the
script to set as wallpaper.


Scripts for reproducing the the plots from the manuscript [New]
Please follow the notebooks in terminus-scripts for producing the plots from the manuscript. This includes detailed steps from running salmon
and mmcollapse
along with specific parameters used in terminus
.
A challenge for accurate RNA-seq analysis
RNA-seq analysis is most often carried out at the gene level, which can provide robust estimates of the total transcriptional output of a set of related transcripts, but which can mask differences in differential isoform usage between conditions. Moreover, in the presence of highly-sequence-similar gene families, these estimates may not be accurate. On the other hand, transcript-level analysis provides exquisite biological resolution, but is often beyond the bounds of robust inference for some fraction of the transcriptome. In such cases, maximum likelihood estimation (MLE)-based models are prone to return a high-likelihood but likely incorrect solution. Such ambiguity is inherent in the RNA-seq data and in the inference challenge it poses, and results chiefly from multi-mapping reads induced by sequence similarity between transcripts due either to alternative splicing or to sequence-similarity among related genes within larger gene families.
What is Terminus?
Terminus is a program that implements a new method for analyzing transcript-level abundance estimates from RNA-seq data. Terminus works downstream of salmon, and collapses individual transcripts into groups whose total transcriptional output can be estimated more accurately and robustly.
Approach of Terminus
Terminus attempts to solve this problem of grouping transcripts by using information drawn from the posterior distribution of transcript abundance estimates (i.e. Gibbs samples), not just the point estimate. The groups computed by terminus represent abundance estimation reported at the resolution that is actually supported by the underlying experimental data. In a typical experiment, this is neither at the gene level nor the transcript level. Some transcripts, even from complex, multi-isoform genes, can have their abundances confidently estimated, while other transcripts cannot. Rather than pre-defining the resolution at which the analysis will be performed, and subjecting the results to unnecessary uncertainty or insufficient biological resolution, terminus allows the determination of transcriptional groups that can be confidently ascertained in a given sample, and represents, in this sense, a data-driven approach to transcriptome analysis.
How to build terminus
Terminus uses the cargo build system and package manager. To build terminus from source, you will need to have rust (ideally v1.40 or greater) installed. Then, you can build terminus by executing:
cargo build --release
How Terminus works
At this moment Terminus works on the output of salmon. Additionally
salmon should be run with --numGibbsSamples <number of samples>
so that it writes the posterior Gibbs samples. Additionally there is also -d
command that needs to be provided for for writing the equivalence classes to the output, that is later used by Terminus. Terminus
works with two subcommands, group
and collapse
.
terminus group -m <float> --tolerance <float> -d <salmon_dir> -o <out_dir>
For collapsing,
terminus collapse -c <float> -d <salmon_dir> -o <out_dir>
Note that terminus first writes some auxiliary files in the <out_dir>
and afterwards in the collapsing phase writes down the final collapsed quantification values along with other metadata files.
How to use DESeq2 in the downstream to identify differentially expressed groups
Currently the transcript to group mapping can be used as a proxy for finding out gene level differentially expressed groups. The trick is to use the tximport
module originally intended for converting transcript level expression to gene level expression.
To create the transcript to group csv file (as a proxy to the transcript to gene csv file)
python scripts/python/extract_txp_group.py <salmon_quant_file> <terminus_out>/cluster.txt txp.group.csv
This txp.group.csv
can be then used in DESeq2
as follows. Given the 4x4 polyester samples discussed in the manuscript a typical pipeline for DE analysis would go as follows,
The required packages are,
library(tximport)
library(DESeq2)
library(readr)
Check the existence of files
csv.dir <- "/mnt/scratch1/hirak/ASE_Analysis/simulation/deseq2"
samps <- read.csv(file.path(csv.dir,"samples.csv"))
files <- file.path("/mnt/scratch1/hirak/ASE_Analysis/simulation/quant_witohut_decoy", samps$sample_id, "quant.sf")
names(files) <- samps$sample_id
all(file.exists(files))
tx2gene <- read_csv(
file.path("/mnt/scratch1/hirak/ASE_Analysis/simulation/deseq2/txp2group.csv"),
col_names = c("TNAME","GNAME")
)
head(tx2gene)
txi <- tximport(files, type = "salmon", tx2gene = tx2gene, countsFromAbundance="lengthScaledTPM")
dds <- DESeqDataSetFromTximport(txi, samps, ~condition)
dds <- DESeq(dds)
dres <- DESeq2::results(dds)
dds
and dres
are general DESeq2 objects that can further be analyzed as described in Analyzing RNA-seq data with DESeq2.


Your file has downloaded.
This file has {{maxViews - views}} {{maxViews - views === 1 ? 'view' : 'views'}} remaining.
The file will be destroyed on {{expiration}} or when the views are exhausted, whichever comes first.
0}}" class="fileInfo alert-info alert">
Your file has downloaded.
The download count has expired; the file will be deleted from our
servers after you close this page.
If this is your file, you must re-upload it if you want
it to be available.
Incorrect password. The file cannot be decrypted. Refresh the page to try again.