Displaying 20 results from an estimated 6000 matches similar to: "Matrix Indexing"
2010 Jun 08
2
type conversion with apply or not
Folks, i thought it should be straightforward but after a few hours poking around, I decided it's best to post my question on this list.
I have a data frame consisting of a (large) number of date columns, which are read in from a csv file as character string. I want to convert them to Date type. Following is an example, where the first column is of integer type, while the rest are type
2013 Jan 29
2
Count entries in postgresql grouped by date
Hi!
I have a table with visits with a visited_at: attribute which is a datetime
field. They seem to be stored as UTC. Now I want to count all visits each
day and return something like:
{
2013-01-01: 8,
2013-01-02: 4,
2013-01-07: 9,
...
}
So, I did it like this which kind of works...:
def self.total_grouped_by_day(start_date, end_date)
visits = where(visited_at:
2024 Oct 30
2
Extracting wind direction and wind speed from wind rose plot
Dear all;
I am searching for a way to extract wind direction and speed from a wind
rose plot. I have a graph and I want to make a dataframe of 5 years with
hourly intervals.
> start_date <- as.POSIXct("2019-01-01 00:00:00")
> end_date <- as.POSIXct("2023-12-31 23:00:00")
> time_sequence <- seq(from = start_date, to = end_date, by = "hour")
> df
2007 Jul 08
2
datetime_select, is creating an instance of the Time class
Hello
It seems that datetime_select, is creating an instance of the Time
class. Why would that be?
I found this while building a site where people can create vigils
(prayer vigils, peace vigils, etc). When I added a validation method
that compared start_date to created_at, it generated the error:
ArgumentError (comparison of Time with DateTime failed):
I was able to put a breakpoint in the
2008 Nov 11
1
Every other week recurring event
I have the code for computing a weekly event:
(start_date..end_date).select{|d| d.wday == wday}
but I am wondering if anyone has any ideas for using this to figure
out a recurring event for every other week. Is it possible to somehow
specify every other within the .select method? Any other
implementation ideas?
--~--~---------~--~----~------------~-------~--~----~
You received this message
2013 Feb 26
4
3 models, joining and nested queries
I have 3 models,
class Host
ref: string
address: string,
name: string
primary_key=''ref''
has_many :rooms, :class_name=>"Room", :foreign_key=>''host_ref''
Class Room
ref :string
host_ref: string
capacity: integer
primary_key=''ref''
has_many
2024 Oct 30
1
Extracting wind direction and wind speed from wind rose plot
A wind rose plot omits time information. Your request is simply not possible.
On October 30, 2024 3:48:03 AM PDT, javad bayat <j.bayat194 at gmail.com> wrote:
>Dear all;
>I am searching for a way to extract wind direction and speed from a wind
>rose plot. I have a graph and I want to make a dataframe of 5 years with
>hourly intervals.
>
>> start_date <-
2008 Jan 16
4
How to test if one range of dates overlaps another?
Hi all,
I have a situation with a recurring billing application where I need
to test if one range of dates "overlaps" another range of dates. Does
anyone know a rails find or mysql select statement that will test for
this? Here are the details:
* Recurringcharge items have a start_date and an end_date that
represent the period of time that the charges should occur.
* Statement items
2008 Jun 24
10
Question on passing arguments inside a view.
I''m running into an issue undefined local variable or method
`directoryid'' for #<EditorialsController:0x23f1bf8>
I have two Models on a legacy database and only one controller called
editorials with two actions index and display.
I''m trying to pass in a parameter from the results of my search and
getting the above error.
Example:
two tables one is editorial the
2006 Jun 18
4
uninitialized constant Datetime
I am building an application and I have generated the scaffold for a
product.
In the list method I include something like
my_date = Datetime.now
and the result I get from the webrick is an error
uninitialized constant Datetime
Do I have to add a line with a require?
I am new at ruby on rails
thanks in advance
--
Posted via http://www.ruby-forum.com/.
2007 May 01
5
duplicate key violates unique constraint
I''ve run into an interesting issue. When setting up a table with data
from a file (I''m doing this in a block). I find that I can''t create
separate entries manually after the import. It complains about a
duplicate primary key. I''ve tried Schedule.id += 1 but id= either
isn''t defined or accessible in the class
Here is my code:
2008 Oct 07
1
FW: Reading Data
Rahul Agarwal
Analyst
Equities Quantitative Research
UBS_ISC, Hyderabad
On Net: 19 533 6363
hi let me explain you the problem
we have a database which is in this format
Stocks 30-Jan-08 28-Feb-08 31-Mar-08 30-Apr-08
a 1.00 3.00 7.00 3.00
b 2.00 4.00 4.00 7.00
c 3.00 8.00 655.00 3.00
d 4.00 23.00 4.00 5.00
e 5.00 78.00 6.00 5.00
and we have a query
2006 Mar 04
5
has_many and belongs_to example?
Hi!
If i have 2 tables i.e. product and images and product has_many images,
image belongs_to product - how to create _form.rhtml, new/create and
edit/update methods in product controller, so in a single form i can add
one product and MANY (let''s assume for now that this number is fixed)
images for this product?
Pleeeeease help me :)
--
Posted via http://www.ruby-forum.com/.
2013 Mar 25
1
validates presence of foreign key fails in nested form
I''m using accepts_nested_attributes as follows:
class Timesheet < ActiveRecord::Base
attr_accessible :status, :user_id, :start_date, :end_date,
:activities_attributes
has_many :activities, dependent: :destroy
has_many :time_entries, through: :activities
accepts_nested_attributes_for :activities, allow_destroy: true
end
class Activity < ActiveRecord::Base
attr_accessible
2006 Feb 24
2
Model Inheritance?
Hello,
I need some help with designing a model I have in mind. I''m not sure
what the best way to do it in Ruby/Rails is, or even if what I''m
thinking is possible.
Basically, I have a system where I want to treat everything as a
"message." A Message is a basic model object with a title and
message_text. It can stand on it''s own, or it can be
2013 Mar 29
1
Create values based on a table of conditions
Hi R help forum,
I have a simple data frame of four columns - one of numbers (really a
categorical variable), one of dates and one
of data. I have over 500,000 data points to work with, spread over 40
files, each named after a different animal.
These are contact data recorded by proximity loggers over two years
between the animals of the file name and
collars being worn by other animals. The
2013 Mar 15
1
Reassign values based on multiple conditions
Hi all,
I have a simple data frame of three columns - one of numbers (really a
categorical variable), one of dates and one of data.
Imagine:
collar date data
1 01/01/2013 x
2 02/01/2013 y
3 04/01/2013 z
4 04/01/2013 a
5 07/01/2013 b
The 'collar' is a GPS collar that's been worn by an animal for a certain
amount of time, and then may have been worn by a different animal after
2011 Aug 26
2
how to convert Date to this json format
Hi
I have to create a json date like
{"startDate":"\/Date(1291145744713-0700)\/","endDate":"\/Date(1293824144713-0700)\/"}
This is just an example.
My case startdate = Time.now-2.day
enddate = Time.now
I dont know how to convert this to the above format. Please help
Thanks
--
Posted via http://www.ruby-forum.com/.
--
You
2009 Jun 07
17
ActiveRecord Classes
I''m having a little trouble with understanding how to work out the
schematic for some of my classes using ActiveRecord when a file is in my
lib directory:
Brief example:
Here''s the outline of the files in use:
....app
........controllers
............application_controller.rb
............rushing_offenses_controller.rb
........models
............rushing_offense.rb
....lib
2010 Oct 13
10
Rails 2.3.8 - What happens to a datetime field between a form being submitted and the controller receiving the params
I currently have a model that simply contains one datetime field:
class CreateElectricityReadings < ActiveRecord::Migration
def self.up
create_table :clocks do |t|
t.datetime :time_keeper
t.timestamps
end
end
def self.down
drop_table :clocks
end
end
If I enter the date string "13/10/2010" into this field its showing up
in the controller as