Search Results

Search found 347 results on 14 pages for 'timestamps'.

Page 9/14 | < Previous Page | 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Active Record Associations:

    - by jmccartie
    I'm brand new to Rails, so bear with me. I have 3 models: User, Section, and Tick. Each section is created by a user. My guess with this association: class Section < ActiveRecord::Base has_one :user end Next, each user can "tick" off a section -- only once. So for each tick, I have a section_id, user_id, and timestamps. Here's where I'm stuck. Does this call for a "has_one :through" association? If so, which direction? If not, then I'm way off. Which association works here? Thanks!

    Read the article

  • Checking if parsed date is within a date range

    - by Brett Powell
    So I am using a scripting language with c++-like syntax, and I am trying to think of the best way to check if a date is within range. The problem I am running into is that if the current day is in a new month, the check is failing. Here is what my code looks like: if(iMonth >= iStartMonth && iMonth <= iEndMonth) { if(iDay >= iStartDay && iDay <= iEndDay) { if(iYear >= iStartYear && iYear <= iEndYear) { bEnabled = true; return; When I have something like this: Start date: 3 27 2010 End Date: 4 15 2010 Current Date: 3 31 2010 The day check fails because if (iDay <= iEndDay) does not pass. The scripting language doesn't have a lot of time related functions, and I can't compare timestamps because I'm allowing users to put like "03:27:2010" and "04:15:2010" as start/end dates in a config file. I'm assuming I am just not thinking straight and missing an easy fix.

    Read the article

  • HBase as a multimap

    - by Ibrahim
    Hi guys, I'm doing some large scale text processing work and I'm trying to get started with Hadoop and HBase. One of the things I need to do is build a multimap of some stuff, which I later use to look up things and get all items with a certain key (in a M/R job). Would it be OK to use HBase and insert many rows with the same key and rely on versions/timestamps to achieve a multimap-like setup or is this a bad idea? The multimap is built up in the reduce phase of a Mapreduce task by the way, or at least in the way I've formulated it on paper. Thanks! If more information is needed, I'd be happy to provide it. Not sure whether this question is clear.

    Read the article

  • Are there Adaptive Replacement Cache patent-free alternatives?

    - by aleccolocco
    An open source high-performance project I'm working on needs to keep a cache of parsed/compiled files. A plain LRU or a plain LFU wouldn't fit. Plain LRU wouldn't work as there will be remote batch/spider processes hitting the service regularly. Plain LFU wouldn't work because content will age. ARC seems like the perfect solution but since IBM holds patents to it at least one open source project dropped it. Are there any (good enough) alternatives? EDIT: I'm not looking for exactly the same thing, just something that could handle those two situations. Perhaps some simple strategy with timestamps and sources. There have to be many programmers who faced this situation before. That's why the "good enough" bit.

    Read the article

  • Different behaviour of browsers while caching the same file.

    - by Amrita
    I am trying to implement mod_disk_caching. i wrote a php code as shown in the example of the tutorial i was following. i fired the following in the terminal a2enmod cache a2enmod disk_cache /etc/init.d/apache2 force-reload then in the php code "; ? now i tried running it using firefox. In the first execution i got the following timestamp. 1308643975 here, when i press refresh, the timestamp changes (as the file is reloaded from the server) and remains the same when i click the link again (as the file is retrieved from the cache). Now i am trying the same with IExplorer. As per my understanding, the timestamp should be the same as the subsequent request for the file will be retrieved only from the cache. But i got a different timestamp. Can anyone explain me the reason for this? Why is it giving separate timestamps when the browsers are different? Thanks and Regards, AMJ

    Read the article

  • Float as DateTime

    - by lp1
    SQL Server 2008 I almost have, I think, what I'm looking to do. I'm just trying to fine tune the result. I have a table that stores timestamps of all transactions that occur on the system. I'm writing a query to give an average transaction time. This is what I have so far: With TransTime AS ( select endtime-starttime AS Totaltime from transactiontime where starttime > '2010-05-12' and endtime < '2010-05-13') Select CAST(AVG(CAST(TotalTime As Float))As Datetime) from TransTime I'm getting the following result: 1900-01-01 00:00:00.007 I can't figure out how to strip the date off and just display the time, 00:00:00:007. Any help would be appreciated. Thank you.

    Read the article

  • Active Record Associations: has_one :through? Or multiple has_one's?

    - by jmccartie
    I'm brand new to Rails, so bear with me. I have 3 models: User, Section, and Tick. Each section is created by a user. My guess with this association: class Section < ActiveRecord::Base has_one :user end Next, each user can "tick" off a section -- only once. So for each tick, I have a section_id, user_id, and timestamps. Here's where I'm stuck. Does this call for a "has_one :through" association? If so, which direction? If not, then I'm way off. Which association works here? Thanks!

    Read the article

  • In CQRS (event-sourced), do you need a global sequence counter in the event store?

    - by Jon M
    In trying to get my head around CQRS (and DDD in general) I have come across situations when two events occur on different aggregates but the order of them has domain meaning. If so then they could happen so close together that a timestamp (as used by the sample implementations I have seen) cannot differentiate them, meaning the event store doesn't contain a 'complete' representation of the domain as there is ambiguity over the order in which events occurred. As an example, the domain could fire a CustomerCreatedEvent which applies to the Customer aggregate, and then a CustomerAssignedToAgent event on the Agent aggregate. The CustomerAssignedToAgent event doesn't make sense if it occurs before the CustomerCreatedEvent, but typically both of these might be fired as a result of one operation which makes it likely that the timestamps would effectively be the same. So am I just modelling things badly? Should there ever be a situation where the sequence of events across different aggregates is important? Or should you keep a global sequence number on your event store, so that you can identify the exact sequence in which events occurred?

    Read the article

  • Get/save parameters to an expected JMock method call?

    - by Tayeb
    Hi, I want to test an "Adapter" object that when it receives an xml message, it digest it to a Message object, puts message ID + CorrelationID both with timestamps and forwards it to a Client object.=20 A message can be correlated to a previous one (e.g. m2.correlationID =3D m1.ID). I mock the Client, and check that Adapter successfully calls "client.forwardMessage(m)" twice with first message with null correlationID, and a second with a not-null correlationID. However, I would like to precisely test that the correlationIDs are set correctly, by grabing the IDs (e.g. m1.ID). But I couldn't find anyway to do so. There is a jira about adding the feature, but no one commented and it is unassigned. Is this really unimplemented? I read about the alternative of redesigning the Adapter to use an IdGenerator object, which I can stub, but I think there will be too many objects.=20 Don't you think it adds unnecessary complexity to split objects to a so fine granularity? Thanks, and I appreciate any comments :-) Tayeb

    Read the article

  • Copy of Access mdb database being updated by live database

    - by James
    I'm trying to compute statistics for data held in an Access .mdb database. In order to avoid interfering with the live database, I'm working from a copy which I made by simply using copy-paste in Windows Explorer. The copy resides in the same directory, but with a different name. I'm using R and RODBC to connect to the copy of the file. The strange thing is that new data that is being updated on the original live database is appearing in my queries. This is despite the file timestamps of the copy not changing at all. It is also causing some slowdown in the live database. My understanding is that the .mdb files are standalone, or is this not the case? Should I have copied the database in a different way?

    Read the article

  • rails db migration, undefined method `to_sym', cant figure out syntax

    - by oelbrenner
    the original migration looks like this: class CreateUsers true do |t| t.string :login, :limit = 40 t.string :name, :limit = 100, :default = '', :null = true t.string :email, :limit = 100 t.string :crypted_password, :limit = 40 t.string :salt, :limit = 40 t.string :remember_token, :limit = 40 t.datetime :remember_token_expires_at t.string :activation_code, :limit = 40 t.datetime :activated_at, :datetime t.string :state, :null = :no, :default = 'passive' t.datetime :deleted_at t.integer :occupation_id, :null = :yes t.datetime :paid_up_to_date, :date t.timestamps end and I am trying to change the default of "state" to be "active" instead of passive so my attempt at a migration looks like this: ( still learning.. be gentle ) class ChangeUserStateDefault < ActiveRecord::Migration def self.up change_column :users, :state, :null = :no, :default = 'active' end def self.down end end

    Read the article

  • Server.Transfer - What could be the issue here?

    - by Younes
    We have implemented a website with the ability for the user to post his actioncode. This then will be checked by the code and when the user has a price the website will Server.Transfer him to another page. The strange thing here is that the user information will be submitted to the database and the actioncode can't be used again. Here we go... I have one user in this database that is inserted twice very fast after the first time he was added. This are the timestamps: 2010-04-23 07:54:41.133 2010-04-23 07:54:41.417 The insert statement is only called once from the code and the user gets Server.Transfered to the Price.aspx page where he sees what price he won. How can it be that this happened? I'm guessing the user hitted F5 but then he had to be very very fast... Thx!

    Read the article

  • Why does DateTime to Unix time use a double instead of an integer?

    - by Earlz
    I'm needing to convert a DateTime to a Unix timestamp. So I googled it looking for some example code In just about all the results I see, they use double as the return for such a function, even when explicitly using floor to convert it to an integer. Unix timestamps are always integers. So what problem is there with using either long or int instead of double? static double ConvertToUnixTimestamp(DateTime date) { DateTime origin = new DateTime(1970, 1, 1, 0, 0, 0, 0); TimeSpan diff = date - origin; return Math.Floor(diff.TotalSeconds); }

    Read the article

  • Exel Question: I need a date and time formula to convert between time zones

    - by Harold Nottingham
    Hello, I am trying to find a way to calculate a duration in days between my, time zone (Central), and (Pacific; Mountain; Eastern). Just do not know where to start. My criteria would be as follows: Cell C5:C100 would be the timestamps in this format:3/18/2010 23:45 but for different dates and times. Cell D5:D100 would be the corresponding timezone in text form: Pacific; Mountain; Eastern; Central. Cell F5 would be where the duration in days would need to be. Just not sure how to write the formula to give me what I am looking for. I appreciate any assistance in advance. Thanks

    Read the article

  • rails: best way to store comments in mysql

    - by ciss
    Hello. Okay i have two models: posts and comments. as you can think comments has column :post_id. My models Comments belongs_to :post Post has_many :comments So, this is pretty simple association but i have some problems with ordering comments. at first time, when i create my comments migration file i just add column :position. This column indicate comment position in the post. But now i think what where is more good way to do this. so i can't make my choise: 1) uses t.column :datatime :created_at, :default = Time.now() 2) or use timestamps? this is undiscovered for me, please tell me about your exp.

    Read the article

  • Most proper way to use inherited classes with shared scopes in Mongo?

    - by Trip
    I have the TestVisual class that is inherited by the Game class : class TestVisual < Game include MongoMapper::Document end class Game include MongoMapper::Document belongs_to :maestra key :incorrect, Integer key :correct, Integer key :time_to_complete, Integer key :maestra_id, ObjectId timestamps! end As you can see it belongs to Maestra. So I can do Maestra.first.games But I can not to Maestra.first.test_visuals Since I'm working specifically with TestVisuals, that is ideally what I would like to pull. Is this possible with Mongo. If it isn't or if it isn't necessary, is there any other better way to reach the TestVisual object from Maestra and still have it inherit Game ?

    Read the article

  • Syncing JS+PHP time

    - by meder
    Since the Date constructor is based on your PC's timezone and server-side is obviously dependent on the server's time settings... What procedures can I do to ensure that the timestamps I generate are consistent on both ends? I have a jQuery datepicker setup and I do a lot of work, I also have my own datepicker that's generated from server-side code which looks up db availability for bookings. I'm saving arrival/departure times on the server-side and the days are off by one because the JS is local timezone ( mine is Eastern ) . Is my only option doing something like making the JS call PHP to grab a timestamp?

    Read the article

  • Javascript split with RegEx

    - by Rohan
    Hey again, I just asked a question about Regex, and received a great answer: http://stackoverflow.com/questions/3047201/javascript-split-without-losing-character Now, I have another question. My current Regex looks like this: var split = text.split(/(?=\w*\d*\d:\d\d)/); Basically, I'm trying to split using the timestamps (eg - 9:30 or 10:30, the difference between them is the extra digit in the latter). How do I go about this? Currently, if I have these two: 9:30 pm The user did action A. 10:30 pm Welcome, user John Doe. The splits are : 9:30 pm The user did action A. ---- 1 ---- 0:30 pm Welcome, user John Doe. How do I add an optional check for the first character in the timestamp? Thanks!

    Read the article

  • How does Git know which Index blob to add to a tree?

    - by drozzy
    In Pro Git Ch9 the author says: Git normally creates a tree by taking the state of your staging area or index and writing a tree object from it. My question is how does git know which of two consequitive index entries to create the Tree object from? For example: $ echo 'First change' > one.txt $ git add one.txt $ find .git/objects -type f .git/objects/1f/755a7fffe4 //first index entry $ echo 'Second change' > one.txt $ git add one.txt $ find .git/objects -type f .git/objects/2d/234asdf2 //second index entry $ git commit -a -m "Initial commit" $ git cat-file master^{tree} 100644 blob 2d234asdf2 one.txt //How did it know not to take 1f755?? Does it just look at the blob timestamps? Also - what happens to the first blob created - no one is referencing it. Does it just get destroyed or forgotten?

    Read the article

  • Objective-C property getter

    - by Daniel
    What is technically wrong with the following: @property(nonatomic, assign) NSUInteger timestamp; @property(nonatomic, readonly, getter = timestamp) NSUInteger startTime; @property(nonatomic, assign) NSUInteger endTime; I am sure I can find a better way to organise this, but this is what I ended up with at one point in my project and I noticed that accessing the startTime property always returned 0, even when the timestamp property was set to a correct timestamp. It seems having set the getter of startTime to an existing property (timestamp), it is not forwarding the value of timestamp when I do: event.startTime => 0 event.timestamp => 1340920893 All these are timestamps by the way. Just a reminder, I know the above should have happened in my project but I don't understand why accessing startTime doesn't forward onto timestamp property. UPDATE In my implementation I am synthesising all of these properties: @synthesize timestamp, endTime, startTime; Please check an example object to use that demonstrates this at my gist on GitHub: https://gist.github.com/3013951

    Read the article

  • How to deal with time zones in a Rails app with events...

    - by Tony
    I have a Rails app for bands. Bands can import their shows which all occur in different time zones. It seems like a ton of work to store these events in UTC. I would have to figure out the time zone for any show created and then convert back to the show's local time zone when displaying to the user. Is there a simple plugin to get a UTC offset based on geolocation? That would probably help, but does anyone see any major reasons why I should store in UTC here? I understand storing timestamps in UTC is probably a good idea...but band event times?

    Read the article

  • expiring image assets referenced from stylesheets

    - by crankharder
    So rails appends timestamps to CSS, JS and image files: image_tag 'foo.png' => <img src="foo.png?123123123123' /> # or somethin like that ...which is really useful for doing far-future expiration, etc. with Apache's help. But what about images referenced from stylesheets? They don't get an appended timestamp. So it seems to me that it's entirely possible to update one of those images, redeploy, and then not see the file change because the browser doesn't think it's been updated. Unless I'm missing something. If I'm not, is there a decent solution to this problem?

    Read the article

  • autosave pattern

    - by Mark
    I'm using localstorage to do gmail-style autosave on a webpage. So I basically save every 30 seconds to local, OK. The problem is recovery. I can't detect whether or not a user has crashed or incorrectly exited. So let's say the user crashed and loads up the form again, I can't just continue saving and overwriting the previous autosaves. I need to restore the previous save. But let's say the user didn't crash. He did everything correctly, but then used a different browser to edit the same file, so no new data to the previous browser's localstorage. He then loads up the file in the previous browser. The localstorage should not be restored in that case. Assuming there's no way to compare timestamps, how can I solve this problem? Thanks.

    Read the article

  • How is Core Data detecting the conflicts, actually?

    - by brainfrog
    Apple says about -detectConflictsForObject: If on the next invocation of save: object has been modified in its persistent store, the save fails. This allows optimistic locking for unchanged objects. Conflict detection is always performed on changed or deleted objects. So what does this mean? If I simply modify an managed object and then save the context, there is always a conflict detection happening? Does this conflict detection simply compare the timestamps of the "records" to see if the "new" data is actually "old"? Is that a conflict?

    Read the article

  • Fusion Table Layer Caching issue

    - by user1854791
    I have created a series of fusion table layers and apply filtering to one of the layers in response to checkbox click events. The base layer of the map contains a gradient applied over county boundaries. When the base layer is unchecked, the filtered layer loses it's styling. I have added unique timestamps to all queries to avoid caching, however I get the feeling that these image tiles are still be cached for this situation. Is there any way to force the google fusion tables api to invalidate a cached image? Test site here: http://map.inquestmarketing.com/new.html Unchecking the Other - Consumer Prospects checkbox reproduces the issue. This is a pure client app, all of the source is in the single page.

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14  | Next Page >