All Files (41.27% covered at 1.05 hits/line)
43 files in total.
739 relevant lines.
305 lines covered and
434 lines missed
- 1
class ApplicationController < ActionController::Base
- 1
protect_from_forgery
- 1
include RecordHelper
- 1
helper_method :current_user
- 1
def current_user
- 5
@current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]
end
end
- 1
class DatauploadsController < ApplicationController
- 1
before_filter :verify_ownership
- 1
def destroy
@upload = Upload.find(params[:dataupload_id])
@record =<EMAIL_ADDRESS>@upload.destroy
redirect_to<EMAIL_ADDRESS>end
- 1
def verify_ownership
@user = User.find_by_id(session[:user_id])
@record = Record.find_by_id(params[:id])
#@institution = Institution.find_by_id(session[:institution_id])
if @user
@institution = @user.institution
end
if<EMAIL_ADDRESS>&&<EMAIL_ADDRESS>if @record.user_id != @user.id
redirect_to "/records"
end
end
end
end
- 1
class LoginController < ApplicationController
- 1
include RecordHelper
- 1
def login
- 22
user = User.find_by_external_id(request.headers[DATASHARE_CONFIG['external_identifier']])
- 22
if user.nil?
user = User.new
user.external_id = request.headers[DATASHARE_CONFIG['external_identifier']]
user.institution_id = User.institution_from_shibboleth(request.headers[DATASHARE_CONFIG['external_identifier']]).id
user.save
end
- 22
if user.institution_id.nil?
- 22
user.institution_id = User.institution_from_shibboleth(request.headers[DATASHARE_CONFIG['external_identifier']]).id
user.save
end
session[:user_id] = user.id
@current_user = user
redirect_to "/records"
end
- 1
def logout
- 1
if current_user
@institution = current_user.institution
end
- 1
session[:user_id] = nil
- 1
@user = nil
- 1
@current_user = nil
- 1
@institution = nil
- 1
redirect_to logout_page_path
end
# login and logout pages aren't used in prod
# shib will protect the directory
# these methods are available for runnign theapp
# in dev without shib or another authentication system
- 1
def login_page
end
- 1
def logout_page
- 1
render :layout => false
end
end
# helper_method :current_user, :require_login
# protected
# def current_user
# @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]
# end
# def require_login
# if session[:user_id].blank?
# flash[:error] = "You must be logged in to access this page."
# session[:return_to] = request.original_url
# redirect_to choose_institution_path and return
# end
# end
# #require that a user is logged out
# def require_logout
# if session && !session[:user_id].blank?
# flash[:error] = "The page you're trying to access is only available to logged out users."
# redirect_to dashboard_path and return
# end
# end
- 1
class RecordsController < ApplicationController
- 1
include RecordHelper
- 1
before_filter :verify_ownership
#before_save :update_creator
# GET list all records
- 1
def index
@user = current_user
if !@user ||<EMAIL_ADDRESS>redirect_to login_path and return
end
@institution = @user.institution
#@records =<EMAIL_ADDRESS>@records = Record.find_all_by_user_id(current_user.id)
end
# GET form for new record
- 1
def new
@user = current_user
@institution = @user.institution
@record = Record.new
@record.creators.build()
@record.citations.build
3.times do
@record.subjects.build
end
@record.publisher = @institution.short_name
@record.rights = "Creative Commons Attribution 4.0 International (CC-BY 4.0)"
@record.rights_uri = "https://creativecommons.org/licenses/by/4.0/"
end
# POST - create new record
- 1
def create
@record = Record.new(params[:record])
@user = current_user
@record.user_id = @user.id
@institution = @user.institution
@record.set_local_id
@record.publisher = @institution.short_name if @record.publisher.blank?
@record.institution_id = @user.institution_id
@record.creators.build() if @record.creators.blank?
@record.citations.build() if @record.citations.blank?
3.times do
@record.subjects.build() if @record.subjects.blank?
end
if @record.save
if params[:commit] == 'Save'
redirect_to "/records/show"
elsif params[:commit] =='Save And Continue'
redirect_to<EMAIL_ADDRESS>end
else
render "new"
end
end
- 1
def show
@records = Record.find_all_by_user_id(session[:user_id])
end
- 1
def edit
@record = Record.find(params[:id])
@record.creators.build() if @record.creators.blank?
@record.citations.build() if @record.citations.blank?
3.times do
@record.subjects.build() if @record.subjects.blank?
end
#@record = Record.find(params[:id])
if @record.rights.nil?
@record.rights = "Creative Commons Attribution 4.0 International (CC-BY 4.0)"
@record.rights_uri = "https://creativecommons.org/licenses/by/4.0/"
end
@record.creators.build() if @record.creators.blank?
@record.citations.build()if @record.citations.blank?
@record.subjects.build() if @record.subjects.blank?
if @record.subjects.count() == 1
2.times do
@record.subjects.build()
end
elsif @record.subjects.count() == 2
1.times do
@record.subjects.build()
end
end
end
- 1
def delete
@record = Record.find(params[:id])
@record.destroy
redirect_to records_path
end
- 1
def update
@user = current_user
@institution = @user.institution
@record = Record.find(params[:id])
if<EMAIL_ADDRESS>@record.institution_id = @user.institution_id
end
if @record.update_attributes(record_params)
#redirect_to @record
if params[:commit] == 'Save'
redirect_to "/records/show"
elsif params[:commit] =='Save And Continue'
redirect_to<EMAIL_ADDRESS>end
else
render 'edit'
end
end
- 1
private
- 1
def record_params
params.require(:record).permit(
:id, :title, :resourcetype, :publisher, :rights, :rights_uri,
creators_attributes: [ :id, :record_id, :creatorName, :_destroy],
subjects_attributes: [ :id, :record_id, :subjectName, :_destroy],
citation_attributes: [ :id, :record_id, :citationName, :_destroy])
end
- 1
def review
@user = current_user
@institution = @user.institution
@record = Record.find(params[:id])
@record.purge_temp_files
@xmlout = @record.review
render :review, :layout => false
end
- 1
public
- 1
def send_archive_to_merritt
@user = current_user
@institution = @user.institution
@record = Record.find(params[:id])
if<EMAIL_ADDRESS>render :action => "review", :id => @record.id
else
@merritt_response = "PROCESSING"
# processing of large files can take a long time
# so we will handle this in a separate thread
@user_email = request.headers[DATASHARE_CONFIG['user_email_from_shibboleth']]
Thread.new do
@record.generate_merritt_zip
@merritt_request = @record.send_archive_to_merritt (@user.external_id)
submissionLog = SubmissionLog.new
if (!@merritt_request)
@merritt_response = "User not authorized for Merritt submission"
else
@merritt_response = `#{@merritt_request}`
end
submissionLog.archiveresponse = @merritt_response
submissionLog.record = @record
submissionLog.save
# if the submission was successful, remove the files from local
# storage and add logging information
if !(submissionLog.filtered_response == "Failed")
@record.purge_files(submissionLog.id)
end
ActiveRecord::Base.connection.close
end
sleep(5)
submissionLog = SubmissionLog.new
# if it has taken more than 5 seconds to process, we will create an intermediary
# entry to inform the user that the upload is still processing
# this message will appear when the user is forwarded to the submission log page
if @merritt_response == "PROCESSING"
submissionLog.archiveresponse = @merritt_response
submissionLog.record = @record
submissionLog.save
end
# redirect_to :action => "submission_log", :id=> @record.id
render :action => "submission_log", :id=> @record.id
end
end
- 1
def verify_ownership
@user = current_user
@record = Record.find_by_id(params[:id])
if @user
@institution = @user.institution
end
if<EMAIL_ADDRESS>&&<EMAIL_ADDRESS>if @record.user_id != @user.id
# redirect_to "/records"
render "/records"
end
end
end
- 1
def submission_log
@user = current_user
if @user
@institution = @user.institution
end
@record = Record.find_by_id(params[:id])
end
- 1
def terms_of_use
end
- 1
def prepare_to_submit
end
- 1
def upload_faq_page
end
- 1
def metadata_basics
end
- 1
def steps_to_publish
end
- 1
def data_use_agreement
end
end
- 1
class StaticPagesController < ApplicationController
- 1
def contact
@user = User.find_by_id(session[:user_id])
if @user
@institution = @user.institution
else
@institution = Institution.find_by_id(1)
end
@campus = @institution.campus
@campus_email = [campus_email(@campus)]
if request.post?
msg = []
msg.push('Please enter your name') if params[:name].blank?
msg.push('Please enter your email') if params[:email].blank?
msg.push('Please enter a message') if params[:message].blank?
if !params[:email].blank? && !params[:email].match(/^\S+@\S+$/)
msg.push('Please enter a valid email address')
end
all_emails = APP_CONFIG['feedback_email_to'] + @campus_email #You can set the emails in config/app_config.yml
all_emails.delete_if {|x| x.blank? } #delete any blank emails
if params[:content].present? || msg.length > 0 # honeypot check and validity check
if params[:content].present?
msg.push("Thanks.") #for the spam
end
flash[:notice] = msg
else
all_emails.each do |email|
GenericMailer.feedback_message(params, email).deliver
end
flash[:notice] = "Your email message was sent to the Dash team."
end
end
end
- 1
def campus_email(institution)
if CAMPUS_EMAILS.has_key?(institution)
CAMPUS_EMAILS[institution]
else
CAMPUS_EMAILS['unknown']
end
end
end
- 1
class UploadsController < ApplicationController
- 1
def index
@record_id = params[:record_id]
@user = User.find_by_id(session[:user_id])
@record = Record.find_by_id(params[:record_id])
if @user
@institution = @user.institution
else
@institution = Institution.find_by_id(1)
end
if ! @record.nil?
@record.purge_temp_files
end
@uploads = Upload.find_all_by_record_id(params[:record_id])
if @record.nil?
redirect_to "/records"
elsif @record.user_id != @user.id
redirect_to "/records"
else
if @record_id == nil
raise ActionController::RoutingError.new('Not Found')
else
respond_to do |format|
format.html # index.html.erb
format.json { render json: @uploads.map{|upload| upload.to_jq_upload } }
end
end
end
end
# POST /uploads
# POST /uploads.json
- 1
def create
@temp_upload = Upload.new(params[:upload])
if @temp_upload.record.nil?
@temp_upload.record = Record.find(params[:record_id])
end
@upload = Upload.where(:record_id => @temp_upload.record_id, :upload_file_name => @temp_upload.upload_file_name).first
if @upload.nil?
@upload = Upload.create(params[:upload])
else
if @upload.upload_file_size.nil?
@upload.upload_file_size = @temp_upload.upload_file_size
else
@upload.upload_file_size += @temp_upload.upload_file_size
end
end
p = params[:upload]
name = p[:upload].original_filename
directory = "#{DATASHARE_CONFIG['uploads_dir']}/" + Record.find(@upload.record_id).local_id
path = File.join(directory, "temp_" + name.gsub(" ","_"))
File.open(path, "ab") { |f| f.write(p[:upload].read) }
# delete jquery, switch to temp
respond_to do |format|
if @upload.save
format.html {
render :json =><EMAIL_ADDRESS>:content_type => 'text/html',
:layout => false
}
format.json { render json: {files<EMAIL_ADDRESS>status: :created, location: @upload }
else
format.html { render action: "new" }
format.json { render json: @upload.errors, status: :unprocessable_entity }
end
end
end
# DELETE /uploads/1
# DELETE /uploads/1.json
# note - this is needed for javascript delete
# delete for existing server files is in datauploads_controller
- 1
def destroy
@upload = Upload.find(params[:id])
@upload.destroy
@user = User.find_by_id(session[:user_id])
@record = @upload.record
if @record.nil?
redirect_to "/records"
elsif @record.user_id != @user.id
redirect_to "/records"
else
respond_to do |format|
format.html { redirect_to uploads_url }
format.json { head :no_content }
end
end
end
end
- 1
module ApplicationHelper
# def url_to_campus
# id = request.headers[DATASHARE_CONFIG['external_identifier']]
# if ( id == nil )
# @campus = "cdl"
# else
# case id.strip
# when<EMAIL_ADDRESS># @campus = "cdl"
# when<EMAIL_ADDRESS># @campus = "uci"
# when<EMAIL_ADDRESS># @campus = "ucla"
# when<EMAIL_ADDRESS># @campus = "ucsd"
# when<EMAIL_ADDRESS># @campus = "ucsb"
# when<EMAIL_ADDRESS># @campus = "ucb"
# when<EMAIL_ADDRESS># @campus = "ucd"
# when<EMAIL_ADDRESS># @campus = "ucm"
# when<EMAIL_ADDRESS># @campus = "ucr"
# when<EMAIL_ADDRESS># @campus = "ucsf"
# when<EMAIL_ADDRESS># @campus = "ucsc"
# else
# @campus = "cdl"
# end
# end
# @campus
# end
- 1
def link_to_remove_fields(name, f)
f.hidden_field(:_destroy) + link_to_function(name, "remove_fields(this)")
end
- 1
def link_to_add_fields(name, f, association)
new_object = f.object.send(association).klass.new
id = new_object.object_id
fields = f.fields_for(association, new_object, child_index: id) do |builder|
render(association.to_s.singularize + "_fields", f: builder)
end
link_to(name, '#', :class => "add_fields btn", data: {id: id, fields: fields.gsub("\n", "")})
end
end
- 1
module CreatorsHelper
end
- 1
module LoginHelper
end
- 1
module RecordHelper
# pull down menus
# Institutions = {
# "UC Berkeley" => "University of California, Berkeley",
# "UC Davis" => "University of California, Davis",
# "UC Irvine" => "University of California, Irvine",
# "UC Los Angeles" => "University of California, Los Angeles",
# "UC Merced" => "University of California, Merced",
# "UC Riverside" => "University of California, Riverside",
# "UC Santa Barbara" => "University of California, Santa Barbara",
# "UC Santa Cruz" => "University of California, Santa Cruz",
# "UC San Diego" => "University of California, San Diego",
# "UC San Francisco" => "University of California, San Francisco",
# "UC Office of the President" => "University of California, Office of the President" }
- 1
DataType = {
"Audiovisual" => "Audiovisual,Audiovisual",
"Collection (multiple file types)" => "Collection,Collection",
"Dataset" => "Dataset,Dataset",
"Image" => "Image,Image",
"Poster" => "Other,Poster",
"Presentation" => "Other,Presentation",
"Software" => "Software,Software",
"Sound" => "Sound,Sound",
"Text" => "Text,Text" }
- 1
def user
if @user
user = @user.external_id
else
user = request.headers[DATASHARE_CONFIG['external_identifier']]
end
end
- 1
def datatype
DataType
end
- 1
def resourceType(x)
x.split(",")[1]
end
- 1
def resourceTypeGeneral(x)
x.split(",")[0]
end
end
- 1
module StaticPagesHelper
end
- 1
module UploadsHelper
end
- 1
class GenericMailer < ActionMailer::Base
- 1
default from<EMAIL_ADDRESS># Subject can be set in your I18n file at config/locales/en.yml
# with the following lookup:
#
# en.generic_mailer.feedback_message.subject
#
- 1
def feedback_message(form_hash, email)
@form_hash = form_hash
@campus = @form_hash[:campus]
@greeting = "Hello #{email}"
mail to: email,
reply_to: @form_hash[:email],
subject: 'Dash Contact Us Form'#,
#from: @form_hash[:email]
end
end
#All emails should also go to<EMAIL_ADDRESS>#For Berkeley - Copy of email should go to<EMAIL_ADDRESS>#Email To fields should be configurable and based off of the campus URL.
- 1
class AlternateIdentifier < ActiveRecord::Base
- 1
belongs_to :record
- 1
attr_accessible :alternateIdentifierName, :record_id, :AlternateIdentifierType
end
- 1
class Citation < ActiveRecord::Base
- 1
attr_accessible :citationName, :record_id
#validates_associated :record
- 1
belongs_to :record, :inverse_of => :citations
end
- 1
class Contributor < ActiveRecord::Base
- 1
belongs_to :record
- 1
attr_accessible :contributorName, :contributorType, :record_id
end
- 1
class Creator < ActiveRecord::Base
- 1
belongs_to :record, :inverse_of => :creators
- 1
attr_accessible :creatorName, :record_id
- 1
validates_presence_of :creatorName, :message => "^You must add at least one creator."
end
- 1
class Dataupload < ActiveRecord::Base
- 1
attr_accessible :image, :name, :record_id
- 1
mount_uploader :image, ImageUploader
- 1
before_create :default_name
- 1
belongs_to :record
- 1
def default_name
# if this is coming through the js version, we will need the name from the image.filename
if !image.filename.nil?
self.name ||= image.filename
end
end
end
- 1
class Description < ActiveRecord::Base
- 1
belongs_to :record
- 1
attr_accessible :descriptionText, :descriptionType, :record_id
end
- 1
class Institution < ActiveRecord::Base
- 1
attr_accessible :abbreviation, :external_id_strip, :landing_page, :long_name, :short_name, :campus
- 1
has_many :users
end
- 1
require 'rubygems'
- 1
require 'zip/zip'
- 1
class Record < ActiveRecord::Base
- 1
include RecordHelper
- 1
has_many :creators, :dependent => :destroy
- 1
has_many :contributors
- 1
has_many :descriptions
- 1
has_many :subjects, :dependent => :destroy
- 1
has_many :alternateIdentifiers
- 1
has_many :datauploads
- 1
has_many :relations
- 1
has_many :submissionLogs
- 1
has_many :uploads
- 1
has_many :citations, :dependent => :destroy
# accepts_nested_attributes_for :creators, allow_destroy: true
- 1
belongs_to :user
- 1
belongs_to :institution
- 1
attr_accessible :identifier, :identifierType, :publicationyear, :publisher,
:resourcetype, :rights, :rights_uri, :title, :local_id,:abstract,
:methods
#validates_associated :creators, :citations, :subjects
- 1
validates_associated :citations, :subjects
#the use of the symbol ^ is to avoid the column name to be displayed along with the error message, custom-err-msg gem
- 1
validates_presence_of :title, :message => "^You must include a title for your submission."
- 1
validates_presence_of :resourcetype, :message => "^Please specify the data type."
- 1
validates_presence_of :rights, :message => "^Please specify the rights."
- 1
validates_presence_of :rights_uri, :message => "^Please specify the rights URI."
- 1
accepts_nested_attributes_for :creators, allow_destroy: true, reject_if: proc { |attributes| attributes.all? { |key, value| key == '_destroy' || value.blank? } }
- 1
attr_accessible :creators_attributes
- 1
accepts_nested_attributes_for :citations, allow_destroy: true, reject_if: proc { |attributes| attributes.all? { |key, value| key == '_destroy' || value.blank? } }
- 1
attr_accessible :citations_attributes
- 1
accepts_nested_attributes_for :subjects, allow_destroy: true, reject_if: proc { |attributes| attributes.all? { |key, value| key == '_destroy' || value.blank? } }
- 1
attr_accessible :subjects_attributes
- 1
def set_local_id
self.local_id = (0...10).map{ ('a'..'z').to_a[rand(26)] }.join
end
- 1
def create_record_directory
FileUtils.mkdir("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{self.local_id}")
end
- 1
def review
# can we define the character encoding at UTF without a byte recorder marker
# ANSI encoding right now
# note - for now, removing the tags to contain multiple XML entries. This produces invalid XML.
# however, it appears to be necessary for the XTF index to work properly.
f = File.new("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{self.local_id}/datacite.xml", "w:ASCII-8BIT")
f.puts "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
f.puts "<resource xmlns=\"http://datacite.org/schema/kernel-3\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://datacite.org/schema/kernel-3 http://schema.datacite.org/meta/kernel-3/metadata.xsd\">"
# identifier - datacite: single, mandatory
# left empty because it will be set by EZID on the merritt side
f.puts "<identifier identifierType=\"DOI\"></identifier>"
# creators - datacite: multiple, mandatory
f.puts "<creators>"
self.creators.each { |a| f.puts "<creator><creatorName>#{a.creatorName.gsub(/\r/,"")}</creatorName></creator>"}
f.puts "</creators>"
# should we allow multiple titles? datacite does...
# we're only allowing one title per record
# titles - datacite: multiple, mandatory
# datacite - title has an option type attribute that we are not using
f.puts "<titles>"
f.puts "<title>#{self.title}</title>"
f.puts "</titles>"
# publisher - datacite: single, mandatory
f.puts "<publisher>#{self.publisher}</publisher>"
# publication year - datacite: single, mandatory
f.puts "<publicationYear>#{self.publicationyear}</publicationYear>"
# subjects - datacite: multiple, optional
f.puts "<subjects>"
# subject scheme is optional and open
#self.subjects.each { |a| f.puts "<subject subjectScheme=\"#{a.subjectScheme.gsub(/\r/,"")}\">#{a.subjectName.gsub(/\r/,"")}</subject>"}
# for now, just use the subject without a scheme
self.subjects.each { |a| f.puts "<subject>#{a.subjectName.gsub(/\r/,"")}</subject>" unless a.subjectName.nil?}
f.puts "</subjects>"
#contributors - datacite: multiple, optional, mandatory contributorType attribute
# do we have a default value for contributorType?
# is this something we plan to use?
f.puts "<contributors>"
#self.contributors.each { |a| f.puts "<contributor contributorType=\"#{a.contributorType}\"><contributorName>#{a.contributorName.gsub(/\r/,"")}</contributorName></contributor>"}
self.contributors.each { |a| f.puts "<contributor contributorType=\"ResearchGroup\"><contributorName>#{a.contributorName.gsub(/\r/,"")}</contributorName></contributor>"}
f.puts "</contributors>"
# resourceType - datacite: optional
# should have a resourceTypeGeneral and a resourceType, may need to modify this
f.puts "<resourceType resourceTypeGeneral=\"#{resourceTypeGeneral(self.resourcetype)}\">#{resourceType(self.resourcetype)}</resourceType>"
#f.puts "<resourceType resourceTypeGeneral=\"Dataset\">Dataset</resourceType>"
# alternate Identifiers - datacite: optional
# this will be the localID
#f.puts "<alternateIdentifiers>"
#self.alternateIdentifiers.each { |a| f.puts "<alternateIdentifier alternateIdentifierType=\"#{a.alternateIdentifierType}\">#{a.alternateIdentifierName}</alternateIdentifier>"}
#f.puts "</alternateIdentifiers>"
# relatedIdentifiers - datacite: optional, multiple
# going to use this for citations
# and then relations doesn't exist in the datacite schema
# is this valid without the relatedIdentifiersType?
# should I be using a different description for this? N
# not sure if this is a valid mapping...
#f.puts "<relatedIdentifiers>"
#self.relations.each { |a| f.puts "<relatedIdentifier>#{a.relationText.gsub(/\r/,"")}</relatedIdentifier>"}
#f.puts "</relatedIdentifiers>"
#<sizes>... this will be exported from merritt, but do we need it in the metadata?
# <% @record.uploads.each do |dataupload| %>
# <li><%= dataupload.upload_file_name %> (<%= number_to_human_size(dataupload.upload_file_size) %>)</li>
# <% end %>
@total_size = 0
self.uploads.each do |u|
@total_size = @total_size + u.upload_file_size
end
f.puts "<size>#{@total_size}</size>"
#f.puts "<size>This is a test</size>"
# formats ?
# version?
#rights
#not required
#f.puts "<rights>#{self.rights}</rights>"
# f.puts "<rightsList>"
# f.puts "<rights rightsURI=”[RightsURI]”>[Rights]</rights>"
# f.puts "</rightsList>"
f.puts "<rightsList>"
f.puts "<rights rightsURI=\"#{CGI::escapeHTML(self.rights_uri)}\">#{CGI::escapeHTML(self.rights)}</rights>"
f.puts "</rightsList>"
#descriptions
f.puts "<descriptions>"
# abstract
if !self.abstract.nil?
f.puts "<description descriptionType=\"Abstract\">#{CGI::escapeHTML(self.abstract.gsub(/\r/,""))}</description>"
end
#methods
if !self.methods.nil?
f.puts "<description descriptionType=\"Methods\">#{CGI::escapeHTML(self.methods.gsub(/\r/,""))}</description>"
end
# citation
self.descriptions.each { |a| f.puts "<description descriptionType=\"SeriesInformation\">#{CGI::escapeHTML(a.descriptionText.gsub(/\r/,""))}</description>" }
f.puts "</descriptions>"
f.puts "</resource>"
f.close
#return contents of file as string
File.open("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{self.local_id}/datacite.xml", "rb").read
end
- 1
def generate_merritt_zip
file_path = "#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{self.local_id}"
if File.exists?("#{file_path}/#{self.local_id}.zip")
File.delete("#{file_path}/#{self.local_id}.zip")
end
zipfile_name = "#{file_path}/#{self.local_id}.zip"
# target link and doi are generated by merritt
# they are included here only for testing
# uncomment if you need them in the archive (ie, if your repository does not supply these)
f = File.new("#{file_path}/target_link", "w")
f.puts "http://localhost:3000/download_merritt_file/#{self.local_id}.zip"
f.close
f = File.new("#{file_path}/doi", "w")
f.puts "doi:10.7272/Q6057CV6"
f.close
f = File.new("#{file_path}/mrt-datacite.xml", "wb")
f.puts self.review
f.close
Zip::ZipFile.open(zipfile_name, Zip::ZipFile::CREATE) do |zipfile|
zipfile.add("mrt-datacite.xml", "#{file_path}/mrt-datacite.xml")
self.purge_temp_files
self.uploads.each do |d|
zipfile.add("#{d.upload_file_name}", "#{file_path}/#{d.upload_file_name}")
end
end
# clean up all temp files (again, required because of the glitch in chunked file uploads)
FileUtils.rm Dir[file_path + "/temp_*"]
end
# keep metadata records, but get rid of files that are no longer needed for local storate
# (storage is intended only until records are uploaded to merritt)
- 1
def purge_files(submission_log_id)
uploads = Upload.find_all_by_record_id(self.id)
# archive the file information for submission logs
uploads.each do |u|
upload_archive = UploadArchive.new
upload_archive.submission_log_id = submission_log_id
upload_archive.upload_file_name = u.upload_file_name
upload_archive.upload_file_size = u.upload_file_size
upload_archive.upload_content_type = u.upload_content_type
upload_archive.save
end
Upload.delete_all(:record_id => self.id)
file_path = "#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{self.local_id}"
# delete the files from local storage now that they have been submitted to merritt
if File.exists?("#{file_path}")
FileUtils.rm_rf Dir.glob("#{file_path}/*")
end
end
- 1
def send_archive_to_merritt(external_id)
# tics will execute, for now, just print to screen
# note that the 2>&1 is to redirect sterr to stout
@user = User.find_by_external_id(external_id)
#@user = User.find(session[:user_id])
if @user
@user_email = @user.email
else
@user_email = nil
end
#campus = Record.id_to_campus(external_id)
campus = @user.institution.campus
if (!campus) then
return false
end
merritt_endpoint = MERRITT_CONFIG["merritt_#{campus}_endpoint"]
merritt_username = MERRITT_CONFIG["merritt_#{campus}_username"]
merritt_password = MERRITT_CONFIG["merritt_#{campus}_password"]
merritt_profile = MERRITT_CONFIG["merritt_#{campus}_profile"]
if @user_email.nil?
sys_output = "curl --insecure --verbose -u #{merritt_username}:#{merritt_password} -F<EMAIL_ADDRESS>-F \"type=container\" -F \"submitter=Dash/#{external_id}\" -F \"responseForm=xml\" -F \"profile=#{merritt_profile}\" -F \"localIdentifier=#{self.local_id}\" #{merritt_endpoint} 2>&1"
else
sys_output = "curl --insecure --verbose -u #{merritt_username}:#{merritt_password} -F<EMAIL_ADDRESS>-F \"notification=#{@user_email}\" -F \"type=container\" -F \"submitter=Dash/#{external_id}\" -F \"responseForm=xml\" -F \"profile=#{merritt_profile}\" -F \"localIdentifier=#{self.local_id}\" #{merritt_endpoint} 2>&1"
end
return sys_output
end
- 1
def required_fields
required_fields = Array.new
if self.creators.nil? || self.creators.empty?
required_fields << "Record must specify at least one creator."
end
# should we allow multiple titles? datacite does...
# we're only allowing one title per record
if self.title.nil? || self.title.blank?
required_fields << "Record must have a title."
end
# publisher - datacite: single, mandatory
if self.publisher.nil? || self.publisher.blank?
required_fields << "Record must have a publisher."
end
# publication year - datacite: single, mandatory
if self.publicationyear.nil?
required_fields << "Record must have a publication year."
end
#contributors - datacite: multiple, optional, mandatory contributorType attribute
# we will require contributors for datashare
if self.contributors.nil? || self.contributors.empty?
#required_fields << "Record must specify at least one contributor"
end
return required_fields
end
- 1
def recommended_fields
recommended_fields = Array.new
# subjects - datacite: multiple, optional
if self.subjects.nil? || self.subjects.empty?
recommended_fields << "Keywords strongly recommended. Your record may be omitted from search and browse results without keywords."
end
#descriptions
if self.abstract == "" || self.methods == ""
recommended_fields << "While not required, an abstract and technical description are strongly recommended."
end
return recommended_fields
end
# temp files created for multipart uploads
- 1
def purge_temp_files
file_path = "#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{self.local_id}"
self.uploads.each do |d|
# a temporary terrible hack to avoid the file corruption problem
# on chunked uploads
if File.exist?(file_path + "/temp_" + d.upload_file_name)
File.delete(file_path + "/" + d.upload_file_name)
File.rename(file_path + "/temp_" + d.upload_file_name, file_path + "/" + d.upload_file_name)
end
end
end
end
- 1
class Relation < ActiveRecord::Base
- 1
belongs_to :record
- 1
attr_accessible :relationText
end
- 1
class Subject < ActiveRecord::Base
- 1
belongs_to :record, :inverse_of => :subjects
- 1
attr_accessible :subjectName, :record_id
end
- 1
class SubmissionLog < ActiveRecord::Base
- 1
belongs_to :record
- 1
has_many :uploadArchives
- 1
attr_accessible :archiveresponse
- 1
def filtered_response
if !self.archiveresponse.nil?
if self.archiveresponse.include?("QUEUED") || self.archiveresponse.include?("PENDING")
return "Success: Record Uploaded to Datashare"
elsif self.archiveresponse.include?("PROCESSING")
return "Sending To Merritt (Processing)"
else
return "Failed: " + self.archiveresponse
end
end
end
end
- 1
class Upload < ActiveRecord::Base
- 1
belongs_to :record
- 1
before_create :default_name
- 1
attr_accessible :upload, :upload_file_size, :upload_content_type, :upload_file_name, :record_id
- 1
has_attached_file :upload, :path => :set_default_url_on_record_id
- 1
do_not_validate_attachment_file_type :upload
- 1
include Rails.application.routes.url_helpers
- 1
def to_jq_upload
{
"name" => read_attribute(:upload_file_name),
"size" => read_attribute(:upload_file_size),
"url" => upload.url(:original),
"delete_url" => upload_path(self),
"delete_type" => "DELETE"
}
end
- 1
def set_default_url_on_record_id
record = Record.find_by_id(self.record_id)
":rails_root/#{DATASHARE_CONFIG['uploads_dir']}/#{record.local_id}/#{self.upload_file_name}"
end
- 1
def default_name
# allow duplicate names, but append a timestamp to the names
# otherwise, the zip utility will throw an error on duplicate names
if self.record.uploads.pluck(:upload_file_name).include?(self.upload_file_name)
self.upload_file_name = self.upload_file_name + "_" + Time.now.utc.iso8601.gsub('-', '').gsub(':', '')
end
end
# delete all files more than a week old? (?)
# not currently used
- 1
def self.purge_old_files
puts "purging files"
uploads = Upload.where('created_at < ?', 1.week.ago)
# delete each uploads corresponding file, then delete the upload metadata from the db
uploads.each do |u|
file_path = "#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{u.record.local_id}"
if File.exists?("#{file_path}")
FileUtils.rm_rf Dir.glob("#{file_path}/*")
end
u.delete
end
redirect_to "/records"
end
end
- 1
class UploadArchive < ActiveRecord::Base
- 1
belongs_to :submissionLog
- 1
attr_accessible :submission_log_id, :upload_file_size, :upload_file_name, :upload_content_type
end
- 1
class User < ActiveRecord::Base
- 1
has_many :records
- 1
belongs_to :institution
- 1
attr_accessible :external_id, :epsa, :email
- 1
def self.institution_from_shibboleth(id)
- 22
if ( id == nil )
return Institution.find_by_id(1)
end
- 22
Institution.all.each do |i|
- 44
if Regexp.new(i.external_id_strip).match(id)
return i
end
end
end
end
# encoding: utf-8
- 1
class ImageUploader < CarrierWave::Uploader::Base
# Include the Sprockets helpers for Rails 3.1+ asset pipeline compatibility:
- 1
include Sprockets::Helpers::RailsHelper
- 1
include Sprockets::Helpers::IsolatedHelper
- 1
storage :file
- 1
def store_dir
"#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/#{model.record.local_id}"
end
#all are currently allowed
#def extension_white_list
# %w(jpg jpeg gif png tiff tif)
#end
end
- 1
require File.expand_path('../boot', __FILE__)
- 1
require 'rails/all'
- 1
def isTest
ENV['RAILS_ENV'] == "test" || ENV['RAILS_ENV'] == "local"
end
- 1
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
- 1
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
- 1
module DataIngest
- 1
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# Custom directories with classes and modules you want to be autoloadable.
# config.autoload_paths += %W(#{config.root}/extras)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
# Activate observers that should always be running.
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
# Configure the default encoding used in templates for Ruby 1.9.
- 1
config.encoding = "utf-8"
# Configure sensitive parameters which will be filtered from the log file.
- 1
config.filter_parameters += [:password]
# Enable escaping HTML in JSON.
- 1
config.active_support.escape_html_entities_in_json = true
# Use SQL instead of Active Record's schema dumper when creating the database.
# This is necessary if your schema can't be completely dumped by the schema dumper,
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
# Enforce whitelist mode for mass assignment.
# This will create an empty whitelist of attributes available for mass-assignment for all models
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
# parameters by using an attr_accessible or attr_protected declaration.
- 1
config.active_record.whitelist_attributes = true
# Enable the asset pipeline
- 1
config.assets.enabled = true
# Version of your assets, change this if you want to expire all your assets
- 1
config.assets.version = '1.0'
end
end
- 1
require 'rubygems'
# Set up gems listed in the Gemfile.
- 1
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
- 1
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
# Load the rails application
- 1
require File.expand_path('../application', __FILE__)
# Initialize the rails application
- 1
DataIngest::Application.initialize!
- 1
MERRITT_CONFIG = YAML.load_file("#{Rails.root}/config/merritt.yml")[Rails.env]
- 1
DATASHARE_CONFIG = YAML.load_file("#{Rails.root}/config/datashare.yml")[Rails.env]
- 1
DataIngest::Application.configure do
# Settings specified here will take precedence over those in config/application.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
- 1
config.cache_classes = true
# Configure static asset server for tests with Cache-Control for performance
- 1
config.serve_static_assets = true
- 1
config.static_cache_control = "public, max-age=3600"
# Log error messages when you accidentally call methods on nil
- 1
config.whiny_nils = true
# Show full error reports and disable caching
- 1
config.consider_all_requests_local = true
- 1
config.action_controller.perform_caching = false
# Raise exceptions instead of rendering exception templates
- 1
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment
- 1
config.action_controller.allow_forgery_protection = false
# Tell Action Mailer not to deliver emails to the real world.
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
#config.action_mailer.delivery_method = :test
- 1
config.action_mailer.delivery_method = true
- 1
config.action_mailer.delivery_method = :sendmail
# Raise exception on mass assignment protection for Active Record models
# allow this to unit test file upload in test only
#config.active_record.mass_assignment_sanitizer = :strict
# Print deprecation notices to the stderr
- 1
config.active_support.deprecation = :stderr
end
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# inflect.uncountable %w( fish sheep )
# end
#
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections do |inflect|
# inflect.acronym 'RESTful'
# end
- 1
if File.exists?(File.join(Rails.root, 'config', 'app_config.yml'))
- 1
env = YAML.load_file(File.join(Rails.root, 'config', 'app_config.yml'))[Rails.env]
#this if allows for indirection and have one environment reference another if it is the same then it's a simple string
#people were trying to use the indirection feature for the config, but it wasn't implemented here
- 1
if env.class == String
APP_CONFIG = YAML.load_file(File.join(Rails.root, 'config', 'app_config.yml'))[env]
else
- 1
APP_CONFIG = env
end
- 1
CAMPUS_EMAILS = YAML.load_file(File.join(Rails.root, 'config', 'app_config.yml'))['campus_emails']
end
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
- 1
DataIngest::Application.config.secret_token = '53799ea9a3d06ff292dc489c308943155ef18f4a6aaab7176c4b8fcfc123294e3ff69df9327c65d0c0021efe3feb8b57ce8c233802916f76ee13737fda04983c'
# Be sure to restart your server when you modify this file.
- 1
DataIngest::Application.config.session_store :cookie_store, key: '_jquery-fileupload-rails-example_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
# DataIngest::Application.config.session_store :active_record_store
# Be sure to restart your server when you modify this file.
#
# This file contains settings for ActionController::ParamsWrapper which
# is enabled by default.
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
- 1
ActiveSupport.on_load(:action_controller) do
- 1
wrap_parameters format: [:json]
end
# Disable root element in JSON by default.
- 1
ActiveSupport.on_load(:active_record) do
- 1
self.include_root_in_json = false
end
- 1
DataIngest::Application.routes.draw do
- 1
resources :uploads
- 1
root :to => 'login#login'
- 1
resources :records
- 1
match 'record/:record_id/uploads', :to => "uploads#index"
- 1
match 'record/:record_id/uploads/new', :to => "uploads#new"
- 1
match 'update_dataupload/:id', :to => "datauploads#update_dataupload"
- 1
match 'record/:id/datauploads/:dataupload_id/delete', :to => "datauploads#destroy"
- 1
match 'records', :to => "records#index"
- 1
match 'record/:id', :to => "records#edit"
- 1
match 'record/', :to => "records#new"
#match 'record/show', :to => "records#show"
- 1
match 'record/:id/review', :to => "records#review"
- 1
match 'record/:id/delete', :to => "records#delete"
- 1
match 'record/:id/send_archive_to_merritt', :to => "records#send_archive_to_merritt"
- 1
match 'record/:id/logs', :to => "records#submission_log"
- 1
match 'update_record(/:id)', :to => "records#update_record", :via => :post
- 1
match 'contact', to: 'static_pages#contact', :via => [:get, :post], as: 'contact'
- 1
match 'delete_creator/:id/:creator_id', :to => "records#delete_creator"
- 1
match 'delete_contributor/:id/:contributor_id', :to => "records#delete_contributor"
- 1
match 'delete_description/:id/:description_id', :to => "records#delete_description"
- 1
match 'delete_subject/:id/:subject_id', :to => "records#delete_subject"
- 1
match 'delete_relation/:id/:relation_id', :to => "records#delete_relation"
- 1
match 'delete_alternateIdentifier/:id/:alternateIdentifier_id', :to => "records#delete_alternateIdentifier"
- 1
match 'login', :to => "login#login"
- 1
match 'login_page', :to => "login#login_page"
- 1
match 'logout_page', :to => "login#logout_page"
- 1
match 'logout', :to => "login#logout"
- 1
match 'export', :to => "records#parse_feed"
- 1
match 'terms_of_use', :to => "records#terms_of_use"
- 1
match 'prepare_to_submit', :to => "records#prepare_to_submit"
- 1
match 'metadata_basics', :to => "records#metadata_basics"
- 1
match 'steps_to_publish', :to => "records#steps_to_publish"
- 1
match 'upload_faq', :to => "records#upload_faq_page"
- 1
match 'data_use_agreement', :to => "records#data_use_agreement"
end
- 1
require 'test_helper'
- 1
require "capybara/rails"
- 1
class Login_integration_Test < ActiveSupport::TestCase
- 1
include Capybara::DSL
- 1
setup do
end
- 1
teardown do
end
# only used in development
# in production, covered with shib or other external
# login system which sets the session credentials
- 1
test "login and login without credentials" do
- 1
visit '/login'
assert page.has_content?("Logged in as")
end
# also only used in development
- 1
test "logout page" do
- 1
visit '/logout'
- 1
assert page.has_content?("logged out")
end
end
- 1
require 'test_helper'
- 1
require "capybara/rails"
- 1
class Records_integration_Test < ActiveSupport::TestCase
- 1
include Capybara::DSL
- 1
setup do
- 12
FileUtils.rm_rf(Dir.glob("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}"))
- 12
Dir.mkdir("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}")
- 12
Dir.mkdir("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/1234567890")
- 12
FileUtils.touch("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/1234567890/datacite.xml")
- 12
Capybara.current_session.driver.header 'eppn', 'abc123'
- 12
visit '/login'
end
- 1
teardown do
- 12
FileUtils.rm_rf(Dir.glob("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}"))
end
- 1
test "display all records" do
visit '/records'
# assert page.has_content?("Study1")
# assert page.has_content?("UCSF")
assert page.has_content?("My Dataset")
end
- 1
test 'display new record page' do
visit '/record'
assert page.has_content?("Describe Your Dataset")
end
- 1
test "create new record" do
visit '/record'
fill_in 'title', :with => 'Title1'
#select('UC Office of the President', :from => 'publisher')
select('Poster', :from => 'resourcetype')
fill_in 'creator_name', :with => 'creator name'
fill_in 'subject_name', :with => 'subject name'
fill_in 'abstract', :with => 'Data from healthy and cognitively impaired elderly, enriched for cerebrovascular disease.
Background and Purpose: To investigate whether the Framingham Cardiovascular Risk Profile (FCRP) and carotid artery intima-media
thickness (CIMT) are associated with cortical volume and thickness. Results: 152 subjects (82 men) were aged 78 (+-7) years old, 94
had a CDR of 0, 58 had a clinical dementia rating (CDR) of 0.5 and the mean mini-mental status examination (MMSE) was 28 +-2. FCRP
score was inversely associated with total gray matter (GM) volume, parietal and temporal GM volume (adjusted p<0.04). FCRP was
inversely associated with parietal and total cerebral GM thickness (adjusted p<0.03). CIMT was inversely associated with thickness
of parietal GM only (adjusted p=0.04). Including history of myocardial infarction or stroke and radiologic evidence of brain
infarction, or apoE genotype did not alter relationships with FCRP or CIMT. Conclusions: Increased cardiovascular risk was
associated with reduced GM volume and thickness in regions also affected by Alzheimer\'s disease (AD), independent of infarcts
and apoE genotype. These results suggest a "double hit" toward developing dementia when someone with incipient AD also has
high cardiovascular risk. Subjects: Consecutive subjects were identified from an ongoing, longitudinal, multi-institutional
Aging Brain program project that recruits subjects with normal cognition to mild cognitive impairment, representing a spectrum
of low to high vascular risk14. Most participants were acquired through community-based recruitment using a protocol designed
to obtain a demographically diverse cohort, or through sources such as stroke clinics and support groups attended by people
with high vascular risk factors. All participants gave written informed consent in accordance with the policies of each
institutional review board. Inclusion criteria include age 60 or older, with cognitive function in the normal to mild cognitive
impairment range (Clinical Dementia Rating [CDR] score of 0 or 0.5) 15. Persons with history of multiple vascular risk factors,
coronary or carotid disease, myocardial infarction, or ischemic stroke were targeted for inclusion, although patients with very
large strokes that interfered with estimation of cortical volume and thickness were excluded. Exclusion criteria included evidence
of alcohol or substance abuse, head trauma with loss of consciousness lasting longer than 15 minutes, factors contraindicating MRI,
and severe medical illness, neurologic or psychiatric disorders unrelated to AD or vascular dementia that could significantly affect
brain structure (e.g., schizophrenia and other psychotic disorders, bipolar disorder, current major depression, post-traumatic
stress disorder, obsessive-compulsive disorder, liver disease, multiple sclerosis, amyotrophic lateral sclerosis). Participant
demographics by CDR are shown in Table 1. Measures of cardiovascular risk and carotid atherosclerosis: The FCRP uses empirically-derived
age- and gender-adjusted weighting of categorical variables to predict the 10-year risk of coronary heart disease and is a weighted sum of:
age, gender, active smoking, diabetes, systolic blood pressure (and/or use of hypertensive medications) and total cholesterol and
high-density lipoprotein cholesterol levels13. Higher scores indicate '
fill_in 'methods', :with => 'Consecutive subjects participating in a prospective cohort study of aging and mild cognitive impairment
enriched for vascular risk factors for atherosclerosis underwent structural MRI scans at 3T and 4T MRI at three sites. Freesurfer (v5.1)
was used to obtain regional measures of neocortical volumes (mm3) and thickness (mm). Multiple linear regression was used to determine
the association of FCRP and CIMT with cortical volume and thickness. MRI: acquisition: Structural T1-weighted MRI scans for participants
were collected on 3T and 4T MRI systems. Forty-three participants were scanned at the University of Southern California using a 3T General
Electric Signal HDx system with an 8-channel head coil. Acquired images included a T1-weighted volumetric SPGR (TR = 7 ms, TE = 2.9 ms,
TI= 650 ms, 1 mm3 isotropic resolution). Fifty-four participants were scanned at the University of California, Davis research center.
Nine participants were scanned using a 3T Siemens Magnetom Trio Syngo System with an 8-channel head coil. Forty-five were scanned using
a 3T Siemens Magnetom TrioTim system with an 8-channel head coil. Acquired images for all 54 participants included a T1-weighted volumetric
MP-RAGE (TR = 2500, TE = 2.98, TI = 1100, 1 mm3 isotropic resolution). Thirty-three participants were scanned at the San Francisco Veterans
Administration Medical Center using a 4T Siemens MedSpec Syngo System with an 8-channel head coil. A T1-weighted volumetric MP-RAGE scan
(TR = 2300, TE = 2.84, TI = 950, 1 mm3 isotropic '
fill_in 'citation', :with => 'e.g., Patterns of age-related water diffusion changes in human brain by concordance and discordance analysis.
Zhang Y, Du AT, Hayasaka S, Jahng GH, Hlavin J, Zhan W, Weiner MW, Schuff N. Neurobiol Aging. 2010 Nov;31(11):1991-2001.
doi: 10.1016/j.neurobiolaging.2008.10.009. Epub 2008 Nov 25. PMID: 19036473'
click_button 'Save'
assert find_field('title').value == 'Title1'
assert find_field('resourcetype').value == 'Other,Poster'
assert page.has_content?('creator name')
assert page.has_content?('subject name')
assert page.has_content?('high-density lipoprotein cholesterol levels13')
assert page.has_content?(' (TR = 2300, TE = 2.84, TI = 950, 1 mm3 isotropic')
assert page.has_content?('PMID: 19036473')
end
- 1
test "update record" do
visit "/record"
fill_in 'title', :with => 'updatetitle123'
click_button 'Save'
assert find_field('title').value == 'updatetitle123'
end
- 1
test "new record" do
visit "/record"
assert page.has_content?("Title")
end
- 1
test "add_and_delete_creator" do
visit "/record"
fill_in "creator_name", :with => "creator1"
click_button "Additional Creator"
assert page.has_content?("creator1")
first(:link, 'delete').click
assert !page.has_content?("creator1")
end
- 1
test "add_and_delete_subject" do
visit "/record"
fill_in "subject_name", :with => "subject name 1"
click_button "Additional Keyword"
assert page.has_content?("subject name 1"), "subject name created"
first(:link, 'delete').click
assert !page.has_content?("subject name 1"), "subject name deleted"
end
# test "add_multiple_subjects_through_comma_delimited_line" do
# visit "/record"
# fill_in "subject_name", :with => "subject1, subject2, subject3"
# click_button "Add Subject"
# assert !page.has_content?("subject1, subject2, subject3")
# assert page.has_content?("subject3"), "subject name deleted"
# end
- 1
test "add_and_delete_citation" do
visit "/record"
fill_in "citation", :with => "fill_in 'citation', :with => 'e.g., Patterns of age-related water diffusion changes in human brain by concordance and discordance analysis.
Zhang Y, Du AT, Hayasaka S, Jahng GH, Hlavin J, Zhan W, Weiner MW, Schuff N. Neurobiol Aging. 2010 Nov;31(11):1991-2001.
doi: 10.1016/j.neurobiolaging.2008.10.009. Epub 2008 Nov 25. PMID: 19036473'"
click_button "Additional Citation"
assert page.has_content?("Epub 2008 Nov 25. PMID: 19036473")
first(:link, 'delete').click
assert !page.has_content?("Epub 2008 Nov 25. PMID: 19036473")
end
# test "require record ownership for edit" do
# id = records(:two).id
# visit "/record/#{id}"
# #no ownership, redirected to index page
# assert page.has_content?("My Datasets")
# end
- 1
test "create_review_page" do
id = records(:one).id
visit "/record/#{id}/review"
assert page.has_content?("Review Before Submitting")
end
# this won't really do it, the config for test
# is set with dummy data, no need to clutter up
# merritt like this
# so this will give the error message, not success
# message
- 1
test "send_archive_to_merritt" do
id = records(:one).id
prev_upload_count = Upload.find_all_by_record_id(id).size()
visit "/record/#{id}/send_archive_to_merritt"
assert page.has_content?("Submission Logs")
#in test, this step will always fail. You'd need to have test configured
#to successfully submit to merritt for this test to work
#assert_not_equal prev_upload_count, Upload.find_all_by_record_id(id).size()
end
- 1
test "view submission logs" do
id = records(:one).id
visit "/record/#{id}/logs"
assert page.has_content?("Failed")
end
- 1
test "delete record" do
visit "/records"
assert page.has_content?("Study1")
first(:link, 'Delete').click
assert !page.has_content?("Study1")
end
end
# require 'test_helper'
- 1
require "capybara/rails"
- 1
class Uploads_integration_Test < ActiveSupport::TestCase
- 1
include Capybara::DSL
- 1
setup do
- 7
FileUtils.rm_rf(Dir.glob("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}"))
- 7
Dir.mkdir("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}")
- 7
Dir.mkdir("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/1234567890")
- 7
FileUtils.touch("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/1234567890/datacite.xml")
- 7
Capybara.current_session.driver.header 'eppn', 'abc123'
- 7
visit '/login'
end
- 1
teardown do
- 7
FileUtils.rm_rf(Dir.glob("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}"))
end
- 1
test "navigate to upload page" do
visit "/record"
assert page.has_content?('My Datasets')
end
# visit the page and validate text
# file upload functionality is covered in the upload functional test
- 1
test "file upload page" do
id = records(:one).id
visit "/record/#{id}/uploads"
assert page.has_content?("My Datasets")
end
# visit upload page for no record
- 1
test "no record redirects to my datasets page" do
visit "/record/100/uploads"
assert page.has_content?("My Datasets")
end
# visit record not owned by current user
- 1
test "no ownership of record redirects to my datasets page" do
id = records(:two).id
visit "/record/#{id}/uploads"
assert page.has_content?("My Datasets")
end
# attempt to destroy non existent record
- 1
test "require ownership of related record to destroy upload" do
id = records(:two).id
upload_id = uploads(:two).id
visit "/record/#{id}/datauploads/#{upload_id}/delete"
assert page.has_content?("My Datasets")
end
- 1
test "delete upload" do
id = records(:three).id
visit "/record/#{id}/uploads"
Dir.mkdir("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/234567891")
FileUtils.touch("#{Rails.root}/#{DATASHARE_CONFIG['uploads_dir']}/234567891/datacite.xml")
assert page.has_content?("datacite.xml")
first(:link, 'delete').click
assert !page.has_content?("datacite.xml")
end
- 1
test "purge files" do
visit "/records"
prev_count = Upload.all.count
end
end


{{Waterloo}}
CRISPR-Cas9 is an exciting tool for synthetic biologists because it can target and edit genomes with unprecedented specificity. Our team is attempting to re-engineer CRISPR to make it more flexible and easier to use.
Simple sgRNA Exchange: We’re making it easy to test different sgRNA designs: restriction sites added to the sgRNA backbone allow 20 nucleotide target sequences to be swapped without excessive cloning.
Cas9 PAM Flexibility: We’re applying recent research on viable mutations within Cas9’s PAM-interacting domain to design (d)Cas9 variants that bind to novel PAM sites, moving towards the goal of a suite of variants that can bind any desired sequence. We believe our re-engineered CRISPR-Cas9 will give biologists increased ability to optimize targeting in many applications.
CRISPR Plant Defense: The application we chose to explore is a proof-of-concept antiviral system defending the model plant Arabidopsis thaliana against Cauliflower Mosaic Virus, which would benefit from testing a large number of possible sgRNAs in the viral genome.
Our team had a fantastic time at the Jamboree this year, and we were more successful this year than ever before!


--- layout: archive title: Zulip Chat Archive permalink: /stream/113488-general/topic/X_of_Y_of_Z.20naming.html ---
What theorem is called X_of_Y_of_Z
? Is it Y -> Z -> X
or Z -> Y -> X
or even something else? Or are things more fluid than this?
Y -> Z -> X
as in lt_of_le_of_lt
Right, that's why I asked.
I just don't understand how the brackets work
If "of" means "follows from"
is of
right associative
since it represents ->
then Y->Z->X
is Y->(Z->X)
which is (X_of_Z)_of_Y
it is also a mystery to me, hah
I think X_of_Y_of_Z
is Y -> Z -> X
: only the consequent is out of order in the name
well (X_of_Y)_of_Z
seems to mean Z->(Y->X)
and X_of_(Y_of_Z)
seems to mean (Z->Y)->X
So are you clear on the logic? What does A_of_B_of_C_of_D
say?
I don't know these fancy CS terms like consequent by the way
Sorry
somewhere, a logician is crying
next you'll be telling me that something is a minor premise
well
(X_of_Y)_of_Z
seems to meanZ->(Y->X)
andX_of_(Y_of_Z)
seems to mean(Z->Y)->X
I disagree with that assessment. I would say that A_of_B_of_C_of_D
is B -> C -> D -> A
I think of
doesn't follow right or left associativity rules
Consequent is the only positive term in a chain of implications, i.e. the right-most term.
if i had to guess i would think like simon it's right assoc
so a_of_b... is B -> C -> D -> A
so how do we put parentheses in our theorem names? who knows
oh
i have seen imp
used in theorem names
I don't know these fancy CS terms like consequent by the way
I wonder if we could create a sitcom where a mathematician and a computer scientist share a flat. I'm sure they'd get into lots of crazy (conceptual) hijinks
so (a->b)->c
is c_of_a_imp_b
if i had to guess i would think like simon it's right assoc
I don't think that's an associativity rule actually.
if it isn't that way, it should be, it should follow the same rules as ->
otherwise my brain may explode
As for imp
, the difference is that you use imp
where you would normally use le
or lt
: and_imp_and_of_imp_of_imp
for example to state that conjunction is monotonic in both arguments
frankly speaking, trying to remember how a theorem should be named is kinda of ridiculous. when lean 4 comes out i'm sure @Moses Schönfinkel will write the Lean SearchAbout we've been waiting for :)
i have the same general hatred when it comes to reading C++ qualifiers
the rule is, read it from the right and wrap around, which is terrible
http://goshdarnfunctionpointers.com
Now I remember that fun :)
Looking through mathlib it does seem to be consistently using X_of_Y_of_Z : Y -> Z -> X
and there was me thinking there would be some sort of logic ;-)
lt_of_lt_of_le lt_of_le_of_lt pos_of_dvd_of_pos decidable_of_decidable_of_iff neg_of_nat_of_succ lt_add_of_le_of_pos mem_of_eq_of_mem mem_of_subset_of_mem eq_of_subset_of_subset nat.not_coprime_of_dvd_of_dvd eq_of_le_of_forall_le_of_dense mul_nonpos_of_nonpos_of_nonneg lt_add_of_lt_of_nonneg eq_of_sublist_of_length_le not_mem_cons_of_ne_of_not_mem eq_of_sorted_of_perm heq_of_heq_of_eq decidable_of_decidable_of_iff div_of_neg_of_pos
Does it really matter? If I want pos_of_dvd_of_pos
and I get pos_of_pos_of_dvd
they're both the same thing.
oh they are very anal about names here :-)
looking through that stacks file you wrote I see lemma thingy ...
so perhaps you are less fussy than them ;-)
The logic I see is: <something>_of_<list_of_assumptions_separated_by_of>
and that list of assumptions is in the order that you should feed them to a function application if you build the proof term by hand. You could advocate for <list_of_assumptions_separated_by_of>_of_<something>
so that the name mentions assumptions in the same order as the type but I think it's very useful that the first thing you see in the name is what you can achieve with it.
Yes that's why they went for of rather than imp, right? I like that, I just can't make any sense of the logic for the rest of it when there are two ofs
You mean like lt_of_lt_of_le
? It proves lt
from two assumptions: 1. lt
; 2. le
. The order of those assumptions is the same as in the name
right, as in lt_of_lt_and_le
Yeah, exactly
but not as in lt_is_implied_by_lt_which_is_implied_by_le
i.e. not as in lt_of_lt_of_le
if "of" is supposed to mean "is implied by"
and also not as in "(lt_is_implied_by_lt)_is_implied_by_le"
but actually exactly as in "(lt_is_implied_by_le)_is_implied_by_lt"
i.e. exactly "(lt_of_le)_of_lt"
Right. I guess that's where the associativity talk is relevant. It's (lt of lt) of le
with the little twist that the assumptions are shuffled ..
Aah
for you X -> Y ->Z
and Y -> X -> Z
are exactly the same
Yes. As you said
Because it's equivalent to lt_of_lt_and_le
, the assumptions commute
They are logically equivalent
so you're saying lt_of_lt_of_le
and lt_of_le_of_lt
should be defeq? ;-)
Nooooooo, no, no, no! :stuck_out_tongue_closed_eyes:
then why did you name one after what the other one does? ;-)
Because I'm a bad person
Of course the names leave out important information that we have to rely on your imagination to fill in. The full name should be x_lt_z_of_x_lt_y_of_y_le_z
. Then swapping the assumptions is not semantically meaningful, it's just confusing.
Note: defeq and logically equivalent, are not the same by the way ;-)
The X_of_Y_of_Z
means Y -> Z -> X
convention is used throughout mathlib, and it was documented a long time ago in Jeremy's style notes
Yes, I learnt that now, from example
I was just querying the logic
The hypotheses are listed in the order they appear, not reverse order. For example, the theorem
A → B → C
would be namedC_of_A_of_B
.
https://github.com/leanprover/mathlib/blob/master/docs/naming.md
The logic is, the consequent is the most important part, so it comes first (this is important for autocomplete), but otherwise there is no reshuffling of names from the order they appear in the statement or the order you use them
Don't think too hard about currying these things, theorems are generally fully applied anyway
@Andrew Ashworth I 100% will.
{% endraw %}Last updated: Apr 24 2020 at 19:02 UTC


|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the interface for objects that care about
SystemEvent
s.
| Method Summary | |
void |
identityAdded(SystemEvent event)
This is called when an identity is added. |
void |
identityRemoved(SystemEvent event)
This is called when an identity is removed. |
void |
systemConnected(SystemEvent event)
This is called when a system is connected. |
void |
systemConnecting(SystemEvent event)
This is called when a system starts to conect. |
void |
systemDisconnected(SystemEvent event)
This is called when a system is disconnected. |
void |
systemDisconnecting(SystemEvent event)
This is called when a system starts to disconnect. |
| Method Detail |
public void identityAdded(SystemEvent event)
event
- the event commemorating the momentpublic void identityRemoved(SystemEvent event)
event
- the event commemorating the momentpublic void systemConnected(SystemEvent event)
event
- the event commemorating the momentpublic void systemConnecting(SystemEvent event)
event
- the event commemorating the momentpublic void systemDisconnected(SystemEvent event)
event
- the event commemorating the momentpublic void systemDisconnecting(SystemEvent event)
event
- the event commemorating the moment
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |


Try out our Premium Member services: Virtual Legal Assistant, Query Alert Service and an ad-free experience. Free for one month and pay only if you like it.
0BEFORE THE MADURAI BENCH OF MADRAS HIGH COURT DATED: 28.11.2017 CORAM THE HONOURABLE MS.INDIRA BANERJEE, CHIEF JUSTICE AND THE HONOURABLE MRS.JUSTICE J.NISHA BANU W.P.(MD).No.21266 of 2014 and W.M.P(MD).No.1 of 2014 & 1 of 2015 P.Prabhu : Petitioner Vs. 1.The State of Tamil Nadu, rep. by its Principal Secretary, Department of Municipal Administration and Water Supply, Secretariat, Fort St. George, Chennai - 600 009. 2.The Commissioner of Municipal Administration, Municipal Administration Department, Ezhilagam Annexe, 6th Floor, Chepauk, Chennai - 600 005. 3.The Regional Director of Municipal Administration, O/o. The Regional Director of Municipal Administration, No.294, Melakkal Main Road, Kochadai, Madurai - 6. 4.The Commissioner, Usilampatti Municipality, Usilampatti, Madurai District. 5.The District Environmental Engineer, Tamil Nadu Pollution Control Board, Madurai, Madurai District. : Respondents PRAYER: Writ Petition is filed under Article 226 of the Constitution of India to issue a Writ of Mandamus directing the respondents to take immediate steps to renovate New Municipal Office Building and Drinking Water Over Head Tank and consequently directing the respondents herein to take effective and emergent steps to prevent, dumping and burning of waste materials in the vacant lands comprised near to the New Municipal Office Building and also shift the dumping place to any other locality which would not affect the public health and to take appropriate measures to prevent the pollution of the atmosphere therein and further direct the Pollution Control Board to monitor the Usilampatti Municipality to follow the norms as prescribed under the Pollution Control Act. !For Petitioner : Mr.M.Saravanakumar For Respondents 1 to 3 & 5 : Mr.S.Kumar Additional Government Pleader For Respondent No.4 : Mr.K.Mahendran Standing Counsel :ORDER
[Order of the Court was made by The Hon'ble Chief Justice] This Writ Petition is directed, inter alia, against the dumping of garbage in the vicinity of the new municipal building of Usilampatti Municipality.
2. As recorded in our order dated 08.11.2017, the District Collector has, by an order dated 18.05.2017, allotted the land to the Municipality in Survey No.87 measuring 5.25.5 Hectares for construction of a dumping yard. We are informed that construction of dumping yard has now commenced and the completion should take six months.
3. By our order dated 08.11.2017, we observed that garbage cannot be allowed to be dumped and allowed to accumulate in the vicinity of the new municipal building for six months. We directed that the dumped garbage be removed and dumped in some vacant uninhabited area and destroyed.
4. A report has been submitted by the fourth respondent, being the Commissioner, Usilampatti Municipality. In the status report, it is stated that garbage is being dumped on the land in question for over 70 years. It is submitted that pursuant to our order, the Revenue Divisional Officer allotted an abandoned quarry in S.No.519/6 measuring 0.66.5 Hectares in Thottappanayakkanur for dumping of garbage. The garbage dumped near the municipal office was loaded in lorries for dumping at Thottappanayakkanur village. However, the garbage could not be dumped there by reason of stiff opposition from the villagers. The respondent authorities shall try and identify some other vacant land, where there is no habitation and where the garbage can be dumped.
5. Pending identification of such spot and/or completion of the dumping yard under construction, the Municipal authorities shall cordon off the area which is presently used as a dumping yard by erection of high fencing by means of a tin shed. Steps shall also be taken for solid waste management, and for recycling of the waste materials, removal of foul odour, spread of diseases and prevention of pollution by reason of dumping of the garbage.
6. The Status report of the Commissioner, Usilampatti Municipality is signed by the Manager of Usilampatti Municipality. The irregularity shall be cured and a fresh report duly signed by the Commissioner, Usilampatti Municipality, shall be filed on or before 07.12.2017.
7. The Writ Petition is disposed of. No costs. Consequently, connected Miscellaneous Petitions are closed.
To
1.The Principal Secretary to Government, Department of Municipal Administration and Water Supply, Secretariat, Fort St. George, Chennai - 600 009.
2.The Commissioner of Municipal Administration, Municipal Administration Department, Ezhilagam Annexe, 6th Floor, Chepauk, Chennai - 600 005.
3.The Regional Director of Municipal Administration, O/o. The Regional Director of Municipal Administration, No.294, Melakkal Main Road, Kochadai, Madurai - 6.
4.The District Environmental Engineer, Tamil Nadu Pollution Control Board, Madurai, Madurai District.
.


--- title: "内存泄漏" ---
全局变量引用
Chrome 73: Develop Tools -> Performance -> Record and refresh -> 观察 JS Heap 逐步上升


Mconomy
McDonalds
(per capita)
Average Wage
($US)
Burgers per Wage
(total)
BigMac Index
($US)
GDP
($ per capita)
Human Dvelopment Index
(value)
Expected School Years
(years)
Life Expectancy at Birth
(years)
Obesity rate
(% with BMI>=25)
Deaths related with cardiovascular diseases
(%)
Population
(total)


THE LAST OF THE KILLIGREWS
LADY JANE, the widow of Sir John Killigrew, sate in one of the windows of Arwenick house, looking out upon the troubled waters of Falmouth Harbour. A severe storm had prevailed for some days, and the Cornish coast was strewn with wrecks. The tempest had abated; the waves were subsiding, though they still beat heavily against the rocks. A light scud was driving over the sky, and a wild and gloomy aspect suffused all things. There was a sudden outcry amongst a group of men, retainers of the Killigrew family, which excited the attention of Lady Jane Killigrew. She was not left long in suspense as to the cause. In a few minutes two Dutch ships were seen coming into the harbour. They had evidently endured the beat of the storm, for they were both considerably disabled; and with the fragments of sail which they carried, they laboured heavily. At length, however, these vessels were brought round within the shelter of Pendennis; their anchors were cast in good anchoring-ground; and they were safe, or at least the crew thought so, in comparatively smooth water.
As was the custom in those days, the boat belonging to the Killigrew family, manned by the group of whom we have already spoken, went off as soon as the ships were anchored and boarded them. They then learnt that they were of the Hanse Towns, laden with valuable merchandise for Spain, and that this was in the charge of two Spanish factors. On the return of the boat's crew, this was reported to Lady Killigrew; and she, being a very wicked and most resolute woman, at once proposed that they should return to the ships, and either rob them of their treasure, or exact from the merchants a large sum of money in compensation. The rude men, to whom wrecking and plundering was but too familiar, were delighted with the prospect of a rare prize; and above all, when Lady Killigrew declared that she would herself accompany them, they were wild with joy.
With great shouting, they gathered together as many men as the largest boat in the harbour would carry, and armed themselves with pikes, swords, and daggers. Lady Jane Killigrew, also armed, placed herself in the stem of the boat after the men had crowded into their places, and with a wild huzzah they left the shore, and were soon alongside of the vessel nearest to the shore. A number of the men immediately crowded up the side and on to the deck of this vessel, and at once seized upon the captain and the factor, threatening them with instant death if they dared to make any outcry. Lady Jane Killigrew was now lifted on to the deck of the vessel, and the boat immediately pushed off, and the remainder of the crew boarded the other ship.
The Dutch crew were overpowered by the numbers of Cornishmen, who were armed far more perfectly than they. Taken unawares as they were, at a moment when they thought their troubles were for a season at an end, the Dutchmen were almost powerless.
The Spaniards were brave men, and resisted the demands made to deliver up their treasure. This resistance was, however, fatal to them. At a signal, it is said by some, given by their leader, Lady Jane Killigrew,--although this was denied afterwards,--they were both murdered by the ruffians into whose hands they had fallen, and their bodies cast overboard into the sea.
These wretches ransacked the ships, and appropriated whatsoever they pleased, while Lady Jane took from them "two hogsheads of Spanish pieces of eight, and converted them to her own use."
As one of the Spanish factors was dying, he lifted his hands to heaven, prayed to the Lord to receive his soul, and turning to the vile woman to whose villainy he owed his death, he said, "My blood will linger with you until my death is avenged upon your own sons."
This dreadful deed was not allowed to pass without notice even in those lawless times. The Spaniards were then friendly with England, and upon the representation made by the Spanish minister to the existing government, the sheriff of Cornwall was ordered to seize and bring to trial Lady Jane Killigrew and her crew of murderers. A considerable number were arrested with her; and that lady and several of her men were tried at Launceston.
Since the Spaniards were proved to be at the time of the murder "foreigners under the Queen's protection," they were all found guilty, and condemned to death.
All the men were executed on the walls of Launceston Castle; but by the interest of Sir John Arundell and Sir Nicholas Hals, Queen Elizabeth was induced to grant a pardon for Lady Jane.
How Lady Jane Killigrew lived, and when she died, are matters on which even tradition, by which the story is preserved, is silent. We know, however, that her immediate descendant, John Killigrew, who married one of the Monks,, and his son William Killigrew, who was made a baronet in 1660 by Charles II., were only known for the dissoluteness of character, and the utter regardless-ness of every feeling of an exalted character which they displayed.. Sir William Killigrew, by his ill conduct and his extravagant habits, wasted all the basely-gotten treasure, and sold the manor and barton of Arwenick to his younger brother, Sir Peter Killigrew. With the son of this Peter the baronetcy became extinct. The last Sir Peter Killigrew, however, improved his fortune by marrying one of the coheirs of Judge Twisden. Sir Peter and his wife, of whom we know nothing, died, leaving one son, George Killigrew, who connected himself with the St Aubyn family by marriage. This man appears to have inherited many of the vices of his family. He was given to low company, and towards the close of his life was remarkable only for his drunken habits.
He was one evening in a tavern in Penryn, surrounded by his usual companions, and with them was one Walter Vincent, a barrister-at-law. The wine flowed freely; songs and locrie conversation were the order of the night. At length all were in a state of great excitement through the extravagance of their libations, and something was said by George Killigrew very insultingly to Walter Vincent.
Walter Vincent does not appear to have been naturally a depraved man, but of violent passions. Irritated by Killidrew, he made some remarks on the great-grandmother being sentenced to be hanged. Swords were instantly drawn by the drunken men. They lunged at each other. Vincent's sword passed directly through Killigrew's body and he fell dead in the midst Of his revelries, at the very moment when he was defending the character of her who had brought dishonour upon them.
This Walter Vincent was tried for the murder of George Killigrew, but acquitted. We are told by the Cornish historian, "Yet this Mr Vincent, through anguish and horror at this accident (as it was said), within two years after, wasted of an extreme atrophy of his flesh and spirits; that, at length, at the table whereby he was sitting, in the Bishop of Exeter's palace, in the presence of divers gentleman, he instantly fell back against the wall and died."
George Killigrew left one daughter; but of her progress in life we know nothing. Thus the Cornish Killigrews ceased to be a name in the land.
Such a tale as this does not, of course, exist without many remarkable additions. Ghosts and devils of various kinds are spoken of as frequenting Arwenick House, and the woods around it.Those spectral and demoniacal visitations have not, however, any special interest. They are only, indeed, repetitions of oft-told tales.


TOSCA types
Edit (pull request)What’s new in TOSCA types
Our base types for container based topology design has evolved to take into account the specifications of container schedulers (Kubernetes, AWS EC2 …).
Container images still being described with the abstract type tosca.nodes.Container.Application.DockerContainer
. You can consider it as a wrapper for the docker image. It handles the capabilities and requirements related to the application it runs.
A new type has been introduced: a org.alien4cloud.extended.container.types.ContainerRuntime
represents the container itself, independently of the image the container will host. A ContainerRuntime
hosts one and only one DockerContainer
.
Another type has been introduced: a org.alien4cloud.extended.container.types.ContainerDeploymentUnit
is a unit that will group several containers and deploy them as a single unit. It can host sow have ContainerDeploymentUnit
that can host several ContainerRuntime
s and volumes. A ContainerRuntime
hosts one single containerized application (A node of a type that extends tosca.nodes.Container.Application.DockerContainer
and that offers capabilities and specify it’s requirements).
In the example below, we have 1 deployment unit (node CDU) that host 2 container runtime (the two CRs) and 1 volume. Each container runtime host its containrized application (Apache and Mongod)
Note that all these types are abstract (except the container images). They will be replaced by the Kubernetes modifier at deployment setup.
 It can be associated to a location or to a policy. It is generally embedded into a plugin. A Topology modifier can add nodes, transform nodes … It will be executed at the deployment stage you configure: after location matching, after location resource matching … A Policy modifier is associated with a concrete policy and will be executed when you match a policy during the deployment setup. It also can add or modify nodes to make the policy work.
everal ContainerRuntime
s but also volumes. When using Kubernetes, it will become a Pod (or a Deployment).
So we now have ContainerDeploymentUnit
that can host several ContainerRuntime
s and volumes. A ContainerRuntime
hosts one single containerized application (A node of a type that extends tosca.nodes.Container.Application.DockerContainer
and that offers capabilities and specify it’s requirements).
In the example below, we have 1 deployment unit (node CDU) that host 2 container runtime (the two CRs) and 1 volume. Each container runtime host its containerized application (Apache and Mongod)
Edit (pull request)


)
entry = ArtifactManifestEntry(
os.path.basename(sub_path),
os.path.join(path, sub_path),
size=os.path.getsize(sub_path),
digest=md5_file_b64(sub_path),
)
% max_objects
)
physical_path = os.path.join(root, sub_path)
logical_path = os.path.relpath(physical_path, start=local_path)
entry = ArtifactManifestEntry(
logical_path,
os.path.join(path, logical_path),
size=os.path.getsize(physical_path),


{% block content%} {%for movies in movie%}
{{movies.name}}
{{movies.description}}
{{movies.review}}
{%endfor%} {%endblock content%}


{% extends "base.html" %} {% block feed_urls %}{% endblock %} {% block title %}Latest news about Stargate Resistance updates and patches{% endblock %} {% block content %}
Latest news about Stargate Resistance related updates and patches directly from the Stargate Worlds forums.
{% include "updates/update_list.html" %} {% endblock %}


Grade 1 winner Complexity runs big in return Aqueduct win
by HRN StaffComplexity won for the first time in more than a year Wednesday when galloping to victory in Aqueduct’s allowance optional claiming feature, signaling the 3-year-old is ready for stakes company again.
A son of Maclean’s Music trained by Chad Brown, Complexity began his career 2-for-2 last season, breaking his maiden at Saratoga before a commanding performance in taking Belmont Park’s Champagne Stakes (G1) over, among others, Code of Honor.
The Klaravich Stables colt found the Breeders’ Cup Juvenile a bit long, finishing 10th in 2018 at Churchill Downs, and due to physical setbacks wasn’t seen again until running last of 11 in the June 8 Woody Stephens (G1) at Belmont.
There Daily Racing Form reported Complexity exited that race with a quarter crack necessitating more time off. As is so often the case with Brown-trained runners for Klaravich, patience began to be rewarded Wednesday.
Under jockey Jose Ortiz, Complexity settled off a pair of pace setters, who went the opening quarter mile of a seven-furlong race in 22.83 seconds. Toward the half-mile pole, Complexity ranged up outside of Aristocrativ and Mr. Dougie Fresh as they went in 45.90.
Ortiz took a peek behind at the top of the stretch, used a few taps of the whip and had Complexity geared down under the wire, with the clock stopping in 1:22.59.
A $375,000 yearling purchase, Complexity could be a fit for a number of upcoming stakes, including Santa Anita Park’s Malibu (G1) expected to be scheduled on opening day, Dec. 26. Last year, Klaravich Stables’ Identity Politics ran second to McKinzie in the 7/8-mile feature restricted to 3-year-olds.
Complexity's return effort registered a 101 Beyer Speed Figure.


I am a Full Stack Web Developer with 3 years of programming experience. Coding JavaScript, problem-solving, and learning are my greatest passions. My technical skillset includes: Git, Heroku, HTML5, CSS3, Saas/Scss, Bootstrap, JavaScript, jQuery, Node.js, Express JS, MySQL, MongoDB, Handlebars.js, React, and Oauth2 authentication. I implement these skills with balance, design, and functionality as my focus.
Intrigued and curious about computer science, I began as a self-taught programmer, and I am known for how quickly I pick up new technologies. I continued my education with the University of Oregon in order to both solidify and expand my stack, and I graduated from their Full Stack Coding Bootcamp in April, 2021. I'm excited to bring my passionate and positive attitude into a fast-paced team of engineers that will allow me to learn by meeting challenges head-on, and collaborating with my colleagues to create solutions built from innovative perspectives.
I am currently studying cybersecurity and educating others on how they can protect their privacy online.


Derivatives through a batch norm layer
February 15, 2019
In this note, we will write the derivations for the backpropagated gradient through the batch norm operation, and also the gradient w.r.t the weight matrix. This derivation is very cumbersome and after having tried many different ways (column by column/line by line/element by element/etc), we present the way we think is the simplest one here.
1 Notations
We focus on a single batch normalized layer in a fully connected network. The linear part is denoted and parametrized by the weight matrix . Then the batch normalization operation is computed by:
Note that we can rewrite it in terms of and directly instead of computing the intermediate step :
Some remarks:
- These notations are not very precise since we mix up elementwise operations with linear algebra operations. Specifically, by an abuse of notation we divide a vector on the top part of the quotient, by another vector on the bottom part.
- Even if we only require to compute an elementwise variance of the components of , in \ref{eq:bn_wx} we see that it hides the full covariance matrix on the vectors in minibatches, here denoted by . It is a dense covariance matrix, with size .
- We did not write the scaling and bias parameters and since obtaining their derivative is easier and less interesting.
2 Minibatch vector notation
To clarify things, we consider that the examples are stacked in design matrices of size :
Using this notation, we can write the result of BN for a column of the matrix (so all s component for all examples in a minibatch). We denote this column by , as opposed to the lines of that we denoted by Note that does not correspond to an example in the minibatch.
We will go step by step:
The mean of a column is obtained by multiplying it with a vector full of (denoted by a bold ), and dividing by :
Using this we can write the (unbiased) variance of the column vector :
We multiplied the mean by a vector in order to repeat it along all components of . We can simplify the expression:
And so we obtain one column of batch norm:
Using this notation we gained the fact that everything here is linear algebra and scalar operations. We do not have any more elementwise operations, nor sums or variance, so it is easier to write derivatives using only elementary calculus rules.
3 Jacobians and gradients
Writing derivatives of vector functions with respect to vector parameters can be cumbersome, and sometimes ill-defined.
In this note we follow the convention that a gradient of a scalar function of any object has the same shape as this object, so for instance as the same shape as .
We also make an heavy use of jacobians, which are the matrices of partial derivatives. For a function , its jacobian is a matrix, defined by:
Using this notation the chain rule can be written for a composition of function :
Using this notation it is also easy to write first order Taylor series expansion of vector functions. The first order term is just the jacobian matrix, that we can multiply to the right by an increment :
Since is a matrix then is a column vector so it lives in the same space as . Everything works out fine!
4 Derivative w.r.t
We start by computing the derivative through the BN operation. One of the weakness of BN is that each batch normalized feature will be a function of all other elements in a minibatch, because of the mean and variance. This is why we will focus on a single column of the design matrix : in this case all elements of this column only depend on the elements of the corresponding column in .
We write the derivative using the expression in \ref{eq:bn1}.
By
Note that and are row vectors.
5 Derivative w.r.t
For efficient implementation, it is often more efficient to work with design matrices of size where is the size of the minibatch, and is the feature size. With some algebraic manipulation we write the gradient for all elements in the design matrix:
we denoted by the diagonal matrix of the inverse standard deviation as usually used in BN, and is a diagonal matrix where the coefficients are the (scalar) covariances of the elements of and .
6 Derivative w.r.t one line of the weight matrix
Using the fact that , we write , where is a line of the weight matrix (that we transpose to obtain a column vector). We can now write the derivative using the chain rule:
7 Derivative w.r.t the whole matrix
Now we can stack all lines of the matrix in order to get the derivative for the whole weight matrix:
8 Derivative w.r.t the input of the batch normalized layer
Using \ref{eq:bn1} and we can write using the chain rule:
9 Wrap-up and acknowledgements
Now you have everything you need !
Special thanks to César Laurent for the help and proofreading.


Media enquiries
Contact our media team if you’re a journalist with a media enquiry or interview request.
Access and engagement
National Nature Reserves (NNRs), coastal access, monitoring engagement with the natural environment (MENE), National Trails, Natural Connections, open access:
0300 060 4231 / 07900 608073
Biodiversity and landscapes
Biodiversity 2020, National Character Areas (NCAs), Nature Improvement Areas (NIAs), National Parks, Areas of Outstanding Natural Beauty (AONBs), protected landscapes, species conservation work:
0300 060 0213 / 07990 804795
Planning cases and wildlife licensing
Planning and development, consultations and wildlife regulation, including species licensing:
0300 060 2617 / 07810 636344
0300 060 2983 / 07827 881308
Farming
Agri-environment schemes such as Environmental Stewardship:
0300 060 1720 / 07827 821679
Marine
Marine Conservation Zones (MCZs) and Natura 2000:
07919 165142
<EMAIL_ADDRESS>Out of hours
For urgent out-of-hours enquiries, please contact the duty press officer:
0300 060 0101


Christopher Chulack
American television producer and director, best known for his work on the NBC drama series ER (1995–2008), along with Michael Crichton, also Third Watch (1999–2005), which he co-produced along with Edward Allen Bernero, as well as Southland (2009–2013), which he created.


Location Report is your place to create teams of geographically diverse people to quickly see where they are and what timezone they are in using their location data on social media.
Location Changed {{updatedTimeAgo}}


A free tree is:
a connected graph with no cycles
a connected graph with only simple cycles
an unconnected graph with no cycles
A free tree is a connected, undirected graph with no cycles.


Last Week in ManageIQ: Pontificatory Requestiveous - PR
Hi, Dr. Drew Syncrounious here to talk with you about an important new solution just released into master. Known scientifically as Pontificatory Requestiveous, for us in the industry, it is affectionately called:
PR.
A few questions
Do you struggle with memory loss?
Overly terse variable names?
The inability to read anything?
Today I’d like to ask for a few minutes of your time to talk about PR.
Everything is Perfect
Before taking PR make sure that you are healthy enough to consume 58 main ingredients, some number of html ingredients, or more numbers of ajax ingredients.
You also need the ability to consume amazon numbers and azure numbers and vmware numbers.
We all think that no one else struggles in these areas. Knowing about the power of PR can help you build your part of this solution.
Acknowledging your lack of PR is the first step to knowing you need it.
Below I’d like to highlight testimonials taken from some real life PR users. **
All Things that Appeared Bad now Appear Good
Add retire_now to Embedded Ansible job.
Tina: Before PR, I had to manually retire an Ansible Service. Now after taking a steady dosage,
I can simply call retire_now
and the job is retired!
Create initial tower objects when we start the worker
Nick: I remember a time when initial Tower objects weren’t created! I was so used to this that I had accepted it as normal behavior. Bill and Jason introduced me to PR. My life is changed! Those Tower objects are now created at startup!
Some have Noticed Their Zeds Removed
Split metric collections into smaller intervals
Greg B: Large metric collections. That’s all I remember before I started on PR.
The intervals between last_perf_capture_on
and today
were too lengthy.
We all get up every day and make decisions. One day I got up and decided to take PR.
Those smaller metric collections are thanking me, but the real truth. The real truth is that I’m
thanking myself! Thanks PR! Because of you my Bzeds are removed.
Fixes tag control multi-value
Drew: I have been managing my moderate to severe dropdowns with multi-select functionality. Sometimes though, I’ve found that tag control pushes me over the edge. Greg M introduced me to PR! EVERYTHING CHANGED!
PR has allowed my tag control the necessary method for multiple items on the same field! Dropdowns with multi-select functionality are hard. PR has made that part of my codebase easier to work with.
Reported Additional Behavior
Add missing ui_lookup for Repository
Zita: We all know how missing ::
make our lives difficult. I had
gone through the motions, WIPped up a fix, but still
found my UI lookups lacking. PR changed that for me! My classes are found again, but even better, because of PR
my UI lookup is now returning the long lost Repository (Embedded Provider)
. It brings tears to my eyes just thinking
about it.
Account for managed disks
Dan: I’ve had to address the possibility that my VM does not have a :vhd
attribute.
It’s easy for some to laugh this off, but in my case I was stuck. Stuck with my VM. Stuck with the fact that Azure is
moving away (AWAY!) from individual VHD
’s. You laugh, but without my PR I would be lost. Bronagh opened
my life to PR. It still isn’t perfect, but knowing where to go
for information on managed disks has made all the difference for me. I know PR can help someone else. It sure helped me.
An Acceptance that Less is More… Automatic
WIP Automate service model auto create
Greg M: Hello, my name is Greg and I’d like to talk to you about my PR experience. I lived a good life. Got up, coded up service models, did everything Oleg asked. Everything was great. BUT, something was missing. Something was wrong!
Until PR.
I can honestly say, without PR my life would be 826 lines heavier. My fingers used to type miq_
without even
thinking about it. Without PR - Automate wouldn’t be ‘automatic.’
Side Effects May Include
Do not attempt PR if you don’t have a keyboard. When taking PR do not drive or operate heavy machinery unless you have previously pushed. Walking, eating, driving or engaging in other activities just before force pushing without remembering it the next day, have been reported. PR should be taken together with alcohol, although some have reported better results without. Abnormal behaviors may include agitation, aggressiveness, confusion or hallucinations unless additional persons engage in thumbs up behavior. The temporary inability to type text just before clicking ‘new PR’ have also been reported. In unPR’d patients, worsening of code patterns including a risk of complete refactoring have been known to occur. Side effects include next-day drowsiness.
** No actors were used in the making of this PR


Changes the value of a cell or cells on the macro sheet (not the worksheet) without changing any formulas entered in those cells. Use SET.VALUE to assign initial values and to store values during the calculation of a macro. SET.VALUE is especially useful for initializing a dialog box and the conditional test in a WHILE loop. SET.VALUE assigns values to a specific reference or to the name of a reference that has already been defined. For information about creating a new name or entering data on a worksheet, see "Remarks" later in this topic.
Syntax
SET.VALUE(reference, values)
Reference specifies the cell or cells on the macro sheet to which you want to assign a new value or values. If the cell is empty, enters the value in the cell.
If a cell in reference previously contained a formula, the formula is not changed, but the value of the cell might change. See the second example following.
If reference is a reference to a range of cells, rather than to a single cell, then values should be an array of the same size. If not, Microsoft Excel expands it into multiple values using the normal rules for expanding arrays. See the third example following.
Values is the value or set of values to which you want to assign the cell or cells in reference.
Remarks
Consider the following guidelines as you choose a function to set values on a worksheet or macro sheet:
Use SET.VALUE to assign initial values to a reference (including names that have already been defined) on a macro sheet, and to store values during the calculation of a macro.
Use FORMULA to enter values in a worksheet cell.
Use SET.NAME to change the value of a name on a macro sheet (the name is created if it does not already exist). For more information, see SET.NAME.
Use DEFINE.NAME to create or change the value of a name on a worksheet.
Examples
The following macro formula changes the value of cell A1 on the macro sheet to 1:
SET.VALUE($A$1, 1)
Suppose the name TempAverage refers to a cell containing the formula AVERAGE(Temp1, Temp2, Temp3). The following formula assigns the value 99 to this cell, even if the average of the arguments is not 99, without changing the formula in TempAverage:
SET.VALUE(TempAverage, 99)
The preceding formula is useful if a WHILE loop or some other conditional test depends on TempAverage and you want to force the conditional test to have a particular result. Of course, TempAverage is restored to its correct value as soon as it is recalculated. (Recall that unlike formulas in a worksheet, formulas in a macro sheet are not recalculated until the macro actually uses them.)
The following macro formula stores the values 1, 2, 3, and 4 in cells A1:B2:
SET.VALUE($A$1:$B$2, {1, 2;3, 4})
Related Functions
DEFINE.NAME Defines a name on the active worksheet or macro sheet
FORMULA Enters values into a cell or range or onto a chart
SET.NAME Defines a name as a value
Return to index


This example demonstrates the use of WebXR Layers to render high quality text and video. For static content such as text, using layers increases the usable resolution of the content by avoiding the extra resampling pass that occurs during normal VR rendering. For dynamic content such as video, using layers also improves performance by only copying data when new frames are available.
See the comments in the code for more information.


Illustrates the various 'TSdbi' packages with a vignette using time series data from several sources. The vignette also illustrates some simple time series manipulation and plotting using packages 'tframe' and 'tfplot'.
| Version: | 2016.8-1 |
| Depends: | R (≥ 2.8.0) |
| Suggests: | tframe, tframePlus, tfplot, TSdbi (≥ 2015.1-1), TSsql (≥ 2015.1-1), TSPostgreSQL (≥ 2015.1-1), TSMySQL (≥ 2015.4-1), TSSQLite (≥ 2015.1-1), TSodbc (≥ 2015.1-1), TSsdmx, TSmisc, TScompare (≥ 2015.1-1), zoo, xts, tseries, WriteXLS, DBI (≥ 0.3.1), RPostgreSQL, RSQLite, RMySQL, RODBC, RJSDMX |
| Published: | 2016-08-26 |
| Author: | Paul Gilbert |
| Maintainer: | Paul Gilbert <pgilbert.ttv9z at ncf.ca> |
| License: | GPL-2 |
| Copyright: | 2012-2016 Paul Gilbert. |
| URL: | http://tsdbi.r-forge.r-project.org/ |
| NeedsCompilation: | no |
| Materials: | NEWS |
| CRAN checks: | TSdata results |
| Reference manual: | TSdata.pdf |
| Vignettes: |
Time Series Database Interface (TSdbi) Guide and Illustrations Time Series Database Interface (TSdbi) Guide and Illustrations - Appendix TSdbi Guide to Development Work in Progress |
| Package source: | TSdata_2016.8-1.tar.gz |
| Windows binaries: | r-devel: TSdata_2016.8-1.zip, r-release: TSdata_2016.8-1.zip, r-oldrel: TSdata_2016.8-1.zip |
| OS X binaries: | r-release: TSdata_2016.8-1.tgz, r-oldrel: TSdata_2016.8-1.tgz |
| Old sources: | TSdata archive |
Please use the canonical form https://CRAN.R-project.org/package=TSdata to link to this page.


Coding is a new-found passion that I have wanted to learn for some time and I could not be happier. I feel excited about transitioning my skills from my years as a cardiology analyst into this new career. I believe my knowledge, excellent customer service, and work ethic can turn me into a valuable asset in this field. It is my desire to land in a company where I can contribute with my skills and experience to a successful future.
Click here to view my resume


| extract_who {WHOmortality} | R Documentation |
Extract WHO Mortality Data
extract_who(path, dest)
path |
a |
dest |
a |
a named logical
vector of the files that were successfully extracted
## Not run: download_who(dest = getwd(), data = "ccode") download_who(dest = getwd(), data = "docs") extract_who(path = getwd(), dest = getwd(), convert = TRUE) ## End(Not run)