similar to: Complex sorting question, or not?

Displaying 20 results from an estimated 6000 matches similar to: "Complex sorting question, or not?"

2006 Mar 01
2
Validating that a foreign key is present and ok
How do I validate that a model object''s attribute is a valid foreign key? The problem is, I can''t check if the attribute is a valid foreign key if the attribute doesn''t even exist. For example, every employee must be in a department. In the following code, if an employee''s department_id is not present then Department.find_by_id(department_id) might cause
2006 Nov 08
4
writing SQL query WHERE.. IN.. anArray ?
I have an array @dpt_ids ex : @dpt_ids = ["43", "48", "49", "50", "51"] I try to insert it into my sql query to be used in a ''find_by_sql'' query = "SELECT * , #{kms} AS km FROM cities" query << " WHERE department_id IN ( #{dpt_ids} ) " but this transform my array into a unique string :
2006 Mar 13
3
validates_associated problem
Hello, I have a situation where an ''employee'' belongs to a ''department'' and have setup the relationship as follows. class Employee < ActiveRecord::Base belongs_to :department, :foregin_key => "department_id" validates_associated :department_id end class Department < ActiveRecord::Base has_many :employees def validate_on_update
2006 Feb 23
4
MySQL Duplicate Key Error
I am a newbie and I am running into a problem which I cant understand. I have a table called ''privileges'' which has the following fields CREATE TABLE `sdqualplanner`.`privileges` ( `id` int(10) unsigned NOT NULL auto_increment, `name` varchar(20) NOT NULL default '''', `description` varchar(100) NOT NULL default '''', `section_id`
2005 Dec 21
3
How to make a drop-down automatically submit an AJAX form
Hi, I know that to make a dropdown box automatically submit when you change the value, you do this: <select ..... onchange="this.form.submit();"> BUT i''ve got an ajax form, and if i do the above trick, it simply reloads the ajax partial into the whole screen, rather than into the div where it is meant to go. I''ve already got it all working so that if you click
2006 Mar 12
3
Newbie: using find like a sql join query
I have a working Rails app with several related tables, but can''t find an answer to this question in the Dave Thomas Rails book. Imagine for example: table departments with columns: id, department_name table employees with columns: id, department_id, employee_name and of course the employees table has a constraint foreign key (department_id) references departments(id) So this is
2006 Apr 26
2
two layers of has_many
Hi, There are many companies. Each company has many departments. Each department has many employees. The following find_by_sql method seems awful. What is the best way to get all the employees of a company? class Company < ActiveRecord::Base has_many :departments def employees Employee.find_by_sql("SELECT employees.* FROM companies, departments, employees
2010 Aug 02
7
Complex associations
I am working on a project that has some complex table associations, and I am having a hard time declaring this association in a Model, and fear it can''t be done. Here is an example of my issue... class StoreType < ActiveRecord::Base; end class Store < ActiveRecord::Base; end class Department < ActiveRecord::Base; end class Product < ActiveRecord::Base; end A StoreType has
2008 Mar 08
1
analysing mixed effects/poisson/correlated data
I am attempting to model data with the following variables: timepoint - n=48, monthly over 4 years hospital - n=3 opsn1 - no of outcomes total.patients skillmixpc - skill mix percentage nurse.hours.per.day Aims To determine if skillmix affects rate (i.e. no.of.outcomes/total.patients). To determine if nurse.hours.per.day affects rate. To determine if rates vary between
2012 Aug 24
2
(no subject)
I'm very new to R and just finding my way, so be gentle! I've hit a swift halt doing some summary statistics on a simple continuous data field, divided into two categories. I'm getting the following error message. I am unclear why length(names(tth$Mins.to.hospital)) is zero and how to alter this. This is preventing me from carrying the summary data forward to any further analyses,
2011 May 08
1
Syntax for iter.max in rms
Hello, I would like to increase the number of iterations for running a Buckley-James regression model in the rms package, but something is apparently syntactically wrong. The following code initially is exactly as it appears in the help page (which runs successfully), then a "failure to converge" message (resulting from specifying an 'identity' link argument, the error message
2008 Feb 18
2
R graphics question: "binary" bar chart
Hello! I would like to visualize the hospitalization within one year of several patients using a bar chart. For each patient the stay in a hospital should be illustrated with a dark colour a if there is a stay at home between 2 hopital stays, it should be illustrated with a bright colour. e.g. P1 |//////| |///| |////////| P2 |//////////| P3 |//|
2006 Mar 22
0
Another Problem with params
I am trying to do a similar thing for some spares that I am trying to manage... My spare.rb file is as under class Spare < ActiveRecord::Base belongs_to :department, :class_name => ''department'', :foreign_key => ''department_id'' belongs_to :subequipment, class_name => ''subequipment'', :foreign_key =>
2012 Dec 13
1
Migrate to samba 4 in ( relatively ) complex openLDAP environment
Hello, we, a public hospital, would like to migrate to samba4 from our samba3.x environment. According to the documentation samba4 does use a internal ldap server. We use openLDAP as directory for samba horde Oracle name resolution zope user authentication, Checkpoint Firewall authentication (only few users ), squid proxy authentication, logon authentication to our linux servers, logon
2004 Jul 26
1
qcc package & syndromic surveillance (multivar CUSUM?)
Dear R Community: I am working on a public health early warning system, and I see that the qcc package allows for CUSUM and other statistical quality tests but I am not sure if my project is a good match for qcc functions as written. Any advice you may have is very much appreciated. I have four years worth of daily counts of emergency room admissions for different conditions (e.g. respiratory,
2008 Jun 09
2
converting a data set to a format for time series analysis
I currently have a data set describing human subjects enrolled into an international clinical trial, the name of the hospital enrolling this human subject, the date when the subject was enrolled, and a vector with variables representing characteristics of the site (e.g., number of beds in a hospital). my data sets looks like this: subject hospital date_enrollment hospital_beds 1 hospitalA
2003 May 14
2
number of patients in a hospital on a given date
Dear R-users! I am using R 1.7.0, under Windows XP. Having some hospital discharge data (admission date and discharge date for each patient), I want to get the number of patients in the hospital on a given date. My data look like (simple example): > x <- data.frame(patid=c("pat1", "pat2"), adm.date = c("15.03.2002", "16.03.2002"),
2014 Jul 18
1
Difference btw. Dovecot Director and Dovecot Proxy
Hello, For a few days I try to understand what program (Dovecot Director or Dovecot Proxy) I should use for my email architecture. We are a hospital, and for security reasons, we must host ourselves our emails, and we must leave Google Apps... I wish to make a Dovecot backend for each department of the hospital. Each backend Dovecot has a local storage. Server 01: cardiology Server 02:
2007 Jul 09
3
NoMethodError when using find_by_sql
I''m try to verify users on login. Here is my code: def self.authenticate(username,password,account_code) employee = self.find(:all, :select => "e.id, e.first_name, e.last_name, e.username, e.account_id, e.department_id, o.pay_type_id, o.admin_yn, o.payroll_yn, o.files_yn, o.dept_report_yn,e.salt, e.hashed_password", :conditions => ["e.deleted_yn=0 and
2010 Mar 22
2
using reorder in "dotplot"
Hi , Name rate HEALTHALLIANCE HOSPITALS, INC -1.06211747 MOUNT AUBURN HOSPITAL 0.50960291 STURDY MEMORIAL HOSPITAL 2.64233232 LAWRENCE GENERAL HOSPITAL 2.15628558 CAMBRIDGE HEALTH ALLIANCE 1.23623144 I would like use