Displaying 3 results from an estimated 3 matches for "oldtimestamp".
2010 Jul 22
1
Updating a Data Frame
...unction.
The function looks like this:
# get events data. This populates a global event data frame in the R-script
events <- getEvents(con, eventsFilePath)
# events has columns eventid, timeStamp, isSynchronized, timeDiff; with
millions of rows
updateDB <- function(eventid, newTimeStamp, oldTimeStamp){
timeDiff <- newTimeStamp - oldTimeStamp
#Update the events Data Frame
events[events$eventid == eventid, "timestamp"] <<- newTimeStamp
events[events$eventid == eventid, "isSynchronized"] <<- 1
events[events$eventid == eventid, "timeDiff"] <<-...
2006 Jun 05
0
migration to be called inside others migrations
...olumns will be the same for many (but not
all) tables I was thinking... can I write a Migration that sounds like
that
class AddRailsFields < ActiveRecord::Migration
def self.up(tbname)
add_column tbname, "lock_version", :integer, :default => 0
rename_column tbname, "oldtimestamp", "updated_at"
end
def self.down(tbname)
remove_column tbname, "lock_version"
rename_column tbname, "updated_at", "oldtimestamp"
end
end
And call it inside other migrations as
AddRailsFields.up("tablename")
I''ve trie...
2008 Feb 27
2
Unix-like touch to update modification timestamp of file?
...current time. The best I can do for now is:
touchFile <- function(pathname, ...) {
if (!file.exists(pathname))
stop("No such file: ", pathname);
info <- file.info(pathname);
if (info$isdir)
stop("Cannot change the timestamp of a directory: ", pathname);
oldTimestamp <- info$mtime;
con <- NULL;
on.exit({
if (!is.null(con))
close(con);
});
# Zero-sized files have to be treated specially
if (info$size == 0) {
con <- file(pathname, open="w");
} else {
con <- file(pathname, open="r+b");
seek(con=co...