Search Results

Search found 8042 results on 322 pages for 'days'.

Page 42/322 | < Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >

  • Whats the significance of named scope in rails?

    - by piemesons
    Before going for details. Question 1:-- Whats the meaning of scope here (ie named scope)? whats the benefits of using named scope? Now:- from agile development with rails book:-- class Order < ActiveRecord::Base named_scope :last_n_days, lambda { |days| {:conditions => ['updated < ?' , days] } } named_scope :checks, :conditions => {:pay_type => :check} end Such a named scope would make finding the last weeks worth of orders a snap. orders = Orders.last_n_days(7) Scopes can also be combined orders = Orders.checks.last_n_days(7) why we are using named_scope here. We can do the same using methods. Whats special thing we got using named_scope.

    Read the article

  • Wireless Network Disappearing From Available Networks (Windows 7)

    - by PeteDaMeat
    I have been using Windows 7 with a BT Voyager wireless adapter to connect to my home wireless network for around the last 6 months or so and until recently have experienced no problems. However, over the last couple of days Windows has been unable to connect to the network and the network name is no longer visible in the list of available wireless networks. The only way I have got round the problem is to reboot the NetGear router and to change the SSID to a network name which has not already been used. I do not believe the problem is with the router as my mobile phone can connect to it without any problems. The BT Voyager wireless adapter detects all other available networks so I presume this is a Windows 7 issue as it seems to occur when the PC is rebooted. This problen has happened twice in the last 2 days and is becoming extremely annoying. Does anyone have any suggestions?

    Read the article

  • Am I immoral for using a variable name that differs from its type only by case?

    - by Jason Baker
    For instance, take this piece of code: var person = new Person(); or for you Pythonistas: person = Person() I'm told constantly how bad this is, but have yet to see an example of the immorality of these two lines of code. To me, person is a Person and trying to give it another name is a waste of time. I suppose in the days before syntax highlighting, this would have been a big deal. But these days, it's pretty easy to tell a type name apart from a variable name. Heck, it's even easy to see the difference here on SO. Or is there something I'm missing? If so, it would be helpful if you could provide an example of code that causes problems.

    Read the article

  • Is it acceptible to expect mentoring to replace many years experience?

    - by Mantorok
    Hi all Just a quick question Here's my situation: I've been maintaining, extending and creating websites against a CMS for the last 18 months In that time I've learnt a LOT more about ASP.Net, javascript, and of course the quirks of the CMS we are using My manager wants to get others involved, and I'm expected to mentor another programmer whilst they work on production code Now, I've got no problem mentoring someone and it would be great for me to not be the only one with the skillset. But what I HAVE got a problem with is mentoring someone within an agreed timescale of the piece of work (10 days in this case) AND expected to deliver the product to the same standard. I guess what I'm getting at is: 18 months experience != a few days mentoring, not to mention the level of C#/.Net/ASP.Net/Javascript required may also not be up to scratch. Am I right to think this is a little, wrong?

    Read the article

  • Conky graph frozen in time

    - by dijxtra
    Is it possible to plot a graph in conky? Give a function a set of values 0-100 and conky plots a graph similar to execgraph? What I want is to visualize how a variable changed in last week. For example, I'd like to make a graph of gold prices in last 14 days. One way I could do that is use "execigraph 86400 python fetch_price_of_gold.py" and keep my box up 24/7 and eventually I'd get a nice graph. But, unfortunately my box isn't up 24/7. Not to mention I'd have to wait 14 days after every reboot ;-) So, any other ideas? :-)

    Read the article

  • Anybody know why the Output of this program is like this?(using iterator in c#)

    - by Babu
    using System; using System.Collections; namespace Iterator_test { class Day { int days_idx = -1; private String[] days = { "mon", "tue", "wed","thu","fri","sat","sun" }; public IEnumerable getdays() { days_idx++; yield return days[days_idx]; } } class Program { static void Main(string[] args) { Day d = new Day(); foreach (string day in d.getdays()) { Console.WriteLine(day); } } } } Actually the output should be, mon tue wed thu fri sat sun but its printing only "mon" as, mon What will be the reason?

    Read the article

  • SQL Select - adding field to Select is changing the results

    - by nycdan
    I'm stumped by this SQL problem that I suspect will be easy pickings for someone out there. I have a table that contains rows representing several daily lists of ranked items. The relevent fields are as follows: ID, ListID, ItemID, ItemName, ItemRank, Date. I have a query that returns the items that were on a list yesterday but not today (Items Off List) as follows: Select ItemID, ListID, ItemName, convert(varchar(10),MAX(date),101) as date, COUNT(ItemName) as days_on_list From Table Group By ItemID, ListID, ItemName Having Max(date) = DATEADD("d",-1,convert(varchar(10),getdate(),101)) and ListID = 1 Order By ListID, ItemName, COUNT(ItemName) Basically I'm looking for records where the max date is yesterday. It works fine and shows the number of days each item was previously on the list (although not necessarily consecutively, but that's fine for now). The problem is when I try to add ranking to see what yesterday's rank was. I tried the following: Select ItemID, ListID, ItemName, ranking, convert(varchar(10),MAX(date),101) as date, COUNT(ItemName) as days_on_list From Table Group By ItemID, ListID, ItemName, ranking Having Max(date) = DATEADD("d",-1,convert(varchar(10),getdate(),101)) and ListID = 1 Order By ListID, ItemName, ranking, COUNT(ItemName) This returns a great deal more records than the previous query so something isn't right with it. I want the same number of records, but with the ranking included. I can get the rank by doing a self-join with a subquery and getting records where the ItemID occurs yesterday but not today - but then I don't know how to get the Count any more. Appreciation in advance for any help with this. ======== SOLVED ============== Select ItemID, ListID, ItemName, ranking, convert(varchar(10),MAX(date),101) as date, COUNT(ItemName) as days_on_list from Table T Where date = DATEADD("d",-1,convert(varchar(10),getdate(),101)) and ListID = 1 and T.ItemID Not In (select T.ItemID from Table T join Table T2 on T.ItemID = T2.ItemID and T.ListID = T2.ListID where T.date = DATEADD("d",-1,convert(varchar(10),getdate(),101)) and T2.date = convert (varchar(10),getdate(),101) and T.ListID = 1) Group by ItemID, ListID, ItemName, ranking Basically, what I did was create a subquery that finds all items that appear in both days, and finds items that appeared yesterday but are not in the set of items that appeared both days. Then I was able to do the aggregate function and grouping correctly. I would NOT be surprised if this is more convoluted than necessary but I understand it and can modify it as needed and performance doesn't seem to be an issue. Thanks everyone for the assist.

    Read the article

  • mysql birthday reminder, leap year

    - by moodh
    Hi, I'm trying to sort out a result set that gives the 5 closest users sorted by upcoming birthday. This works perfectly until leap years comes into play. For example: May 15th - 96 days left May 15th - 97 days left The top result is a birth at 1987 and the lower is from 1988. u_birth is stored as yyyy-mm-dd. Is there a simple way to sort this problem without having to rewrite the entire query? SELECT u_birth, IF( DAYOFYEAR( u_birth ) >= DAYOFYEAR( NOW() ), DAYOFYEAR( u_birth ) - DAYOFYEAR( NOW() ), DAYOFYEAR( u_birth ) - DAYOFYEAR( NOW() ) + DAYOFYEAR( CONCAT( YEAR( NOW() ), '-12-31' ) ) ) AS distance FROM (blog_users) WHERE `s_agehide` = 0 ORDER BY distance ASC LIMIT 5 This query is taken and modified from the mysql manual: http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#c7489

    Read the article

  • dynamiclly schedule a lead sales agent

    - by Josh
    I have a website that I'm trying to migrate from classic asp to asp.net. It had a lead schedule, where each sales agent would be featured for the current day, or part of the day.The next day a new agent would be scheduled. It was driven off a database table that had a row for each day in it. So to figure out if a sales agent would show on a day, it was easy, just find today's date in the table. Problem was it ran out rows, and you had to run a script to update the lead days 6 months at a time. Plus if there was ever any change to the schedule, you had to delete all the rows and re-run the script. So I'm trying to code it where sql server figures that out for me, and no script has to be ran. I have a table like so CREATE TABLE [dbo].[LeadSchedule]( [leadid] [int] IDENTITY(1,1) NOT NULL, [userid] [int] NOT NULL, [sunday] [bit] NOT NULL, [monday] [bit] NOT NULL, [tuesday] [bit] NOT NULL, [wednesday] [bit] NOT NULL, [thursday] [bit] NOT NULL, [friday] [bit] NOT NULL, [saturday] [bit] NOT NULL, [StartDate] [smalldatetime] NULL, [EndDate] [smalldatetime] NULL, [StartTime] [time](0) NULL, [EndTime] [time](0) NULL, [order] [int] NULL, So the user can schedule a sales agent depending on their work schedule. Also if they wanted to they could split certain days, or sales agents by time, So from Midnight to 4 it was one agent, from 4-midnight it was another. So far I've tried using a numbers table, row numbers, goofy date math, and I'm at a loss. Any suggestions on how to handle this purely from sql code? If it helps, the table should always be small, like less than 20 never over 100. update After a few hours all I've managed to come up with is the below. It doesn't handle filling in days not available or times, just rotates through all the sales agents with leadTable as ( select leadid,userid,[order],StartDate, case DATEPART(dw,getdate()) when 1 then sunday when 2 then monday when 3 then tuesday when 4 then wednesday when 5 then thursday when 6 then friday when 7 then saturday end as DayAvailable , ROW_NUMBER() OVER (ORDER BY [order] ASC) AS ROWID from LeadSchedule where GETDATE()>=StartDate and (CONVERT(time(0),GETDATE())>= StartTime or StartTime is null) and (CONVERT(time(0),GETDATE())<= EndTime or EndTime is null) ) select userid, DATEADD(d,(number+ROWID-2)*totalUsers,startdate ) leadday from (select *, (select COUNT(1) from leadTable) totalUsers from leadTable inner join Numbers on 1=1 where DayAvailable =1 ) tb1 order by leadday asc

    Read the article

  • Excel 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

  • SQL to return dates that fall in period and range

    - by Nate
    Hey stackers, I’ve been grinding my head on this for a while… My goal is to return all dates that fall between a start and end date and have a certain period as a factor, from the start date. (hard to explain) For example… Start Date: Nov 20, 1987; End Date: Jan 01, 1988; Period: 10 days; I want these dates: Nov 20, 1987; Nov 30, 1987; Dec 10, 1987; Dec 20, 1987; Dec 30, 1987; I already have a date table with all dates from 1900 to 2099. The period could be by days, months or years. Any ideas? Let me know if you need more info.

    Read the article

  • get next/previous month from a Time object

    - by tcurdt
    I have a Time object and would like to find the next/previous month. Adding subtracting days does not work as the days per month vary. time = Time.parse('21-12-2008 10:51 UTC') next_month = time + 31 * 24 * 60 * 60 Incrementing the month also falls down as one would have to take care of the rolling time = Time.parse('21-12-2008 10:51 UTC') next_month = Time.utc(time.year, time.month+1) time = Time.parse('01-12-2008 10:51 UTC') previous_month = Time.utc(time.year, time.month-1) The only thing I found working was time = Time.parse('21-12-2008 10:51 UTC') d = Date.new(time.year, time.month, time.day) d >>= 1 next_month = Time.utc(d.year, d.month, d.day, time.hour, time.min, time.sec, time.usec) Is there a more elegant way of doing this that I am not seeing? How would you do it?

    Read the article

  • Dot Net Nuke app_offline randomly being generated

    - by chelfers
    We have had multiple DNN sites running for quite a few months now without any issues. Twice in the last 3 days our sites have gone offline by the addition of the app_offline.htm file in the root dir. There is only one developer with access to the sites at a coding / directory viewing level and the file is generated at weird times times when he is NOT accessing our network. We are not publishing anything to the server ( and have not published any .net code in days ), upgrading, changing code, or even modifying content. Has anyone run into this issue?

    Read the article

  • Excel 2003 - ADDRESS() function issues

    - by hairdresser-101
    I finally thought I had found a way to acutally use excel productively but the code that I followed does not appear to work. I'm thinking that the code is very limited and can't do what I want but I thought I'd ask to confirm - maybe it is my function that is the problem. I want to calculate the sum of a row of values for the previous month based on how many days we are into this month (i.e. It is the 20th of April so I want to sum the first 20 days of March to compare against.) =SUM(G4:ADDRESS(ROW(),7+$BR$3,4)) I basically want to SUM(G4:AA4) and have used the address function to return the cell reference AA4 by taking G4 and adding 20 to the column count. ADDRESS(ROW(),7+$BR$3,4) This successfully returns AA7 as expected HOWEVER, when I try to use the returning value in the SUM() function it throws an error... Am I not able to use this reference in my calculation?

    Read the article

  • NSPredicateEditorRowTemplate for date comparison

    - by Dave DeLong
    I'm building an NSPredicateEditor, and I want the ability to do advanced date comparison. I realize that I can build an NSPredicateEditorRowTemplate with a rightExpressionType of NSDateAttributeType, but the predicates I want to build need to be much more advanced than that. For example, I need to basic comparison like: dateKeypath < aDate dateKeypath <= aDate dateKeypath = aDate dateKeypath != aDate dateKeypath > aDate dateKeypath >= aDate These basic comparisons are quite easy to achieve, and I have these working. However, I also need to do comparisons like: dateKeypath isInTheLast n days (or weeks, months, years) dateKeypath isNotInTheLast n days (or weeks, months, years) dateKeypath between aDate and anotherDate How can I achieve these sorts of comparisons? I understand that I'll need to create a custom NSPredicateEditorRowTemplate, but I haven't found any clear documentation on how to achieve something like this. EDIT Bonus points are available for also knowing how to make these comparisons a full date-time (year-month-day-hour-minute-second) comparison (as NSDateAttributeType only has year-month-day granularity).

    Read the article

  • How to make if loop in grails?

    - by user3569696
    I'm beginner in Grails, please help. I have this in my gsp <div class="right66"> <g:select class="time_pick" name="pick_day" placeholder="" from="${['Dani', 'Sati', 'Minute']}" valueMessagePrefix="book.category"/> </div> In translation: Dani=Days, Sati= Hours, Minute= Minutes. I need to save data in minutes but User have privilege to choose will his input be in minutes, days or hours. So i have to do if loop. I now how if loop works but i don't know how to wite it in grails. I was thinking something like this: n=1 if(params.type=Dani){ n= 3600 }else if(params.type=Sati) { n=60 } def minute=params.minute*n but how to call that choosen input "Dani"? I can't write Params.type=Dani. Does if loop go in controller in my case?

    Read the article

  • Unique task queue task names only for active duration

    - by antony.trupe
    I want to guarantee that a task is not in a task queue more then once, so I generate a unique name based on it's payload. But, that task name is reserved for up to 7 days, which is not what I want; I only want it reserved for the duration the task is queued; it could be immediately re-queued. Once a Task with name N is written, any subsequent attempts to insert a Task named N will fail. Eventually (at least seven days after the task successfully executes), the task will be deleted and the name N can be reused. Is there a way to check if the named task is already in the queue then add it if it's not? Or a totally different approach?

    Read the article

  • Desktop application validity

    - by Umesh
    I am creating a desktop application using AIR. In that application user is allowed to download some resources which have life span of 2 days. I am storing the date when the user is downloaded. But how can i check whether the date is passed 2 days or not? Right now I am checking with the current system date.But when the user changes the system date to back, it will start to work which i dont want. How the desktop applications say like flex builder and all having trial period.? How are they tracking the dates remaining? ~Umesh

    Read the article

  • core-plot and NSDate (iPhone)

    - by Urizen
    I wish to plot a line graph where the x-axis is defined as a number of days between two dates and the y-axis is a value that varies on each of the days. I can plot the y values as an NSNumber but I have no idea how to set the ranges and the markup on the x-axis. I have looked at the date example in the "examples" directory of the core-plot distribution but have found it a little confusing. Does anyone know of a tutorial, or code sample, which might asist me in this regard? Thank you in advance.

    Read the article

  • How to send reminder notifications to subscribers for renewal from SQL Server 2005?

    - by codemonkie
    I have a table in SQL DB, namely dbo.subscribers, it contains following columns: -SubscriberID -JoinDateTime The business logic says a subscription last for 2 weeks and a reminder should be sent after 7 days from the JoinDateTime. The way that the system was designed to send reminders are via a URL call, e.g. http://xxx.xxx.xxx.xxx/renew_userid=SubscriberID/ and that can only be called from our webserver which is the only whitelisted IP machines given. Currently there is a windows service written to query the DB once a day at midnight to grab all expiring subscribers and send them reminders, however this batch approach only sends reminders to the nearest date, well, I could have set the interval down from 1 day to 1 hour such that the service can send notifications out closer to the exact JoinDateTime + 7 days requirements. I have heard a stored procedure can be written and perform task like this to a nearly real-time manner, if yes, please give me some hints on how to do it. Another question is - is SSRS bit of an overkill to perform things like this? Please advice. TIA

    Read the article

  • SQL timetable for employee

    - by latinunit-net
    Hi guys, i need to create an employee shift database. so i have 3 tables so far, employee, employee_shift, and shift im suppose to calculate how many shifts an employee has done at the end of the month, my question means, because a month has 30 days some have 28 and 31 days. this means i need to create in the shift table 31 different variations? one for each day of the month? in order to calculate which employee has worked the most? in my business relation it says an employee has either 1 or 2 shifts per day therefore do i have to have 60 different rows of variations? im i right or is there an easy way to work it out

    Read the article

  • Checking date against date range in Python

    - by Flowpoke
    I have a date variable: 2011-01-15 and I would like to get a boolean back if said date is within 3 days from TODAY. Im not quite sure how to construct this in Python. Im only dealing with date, not datetime. My working example is a "grace period". A user logs into my site and if the grace period is within 3 days of today, additional scripts, etc. are omitted for that user. I know you can do some fancy/complex things in Python's date module(s) but Im not sure where to look.

    Read the article

  • Fastest way to check a List<T> for a date

    - by fishhead
    I have a list of dates that a machine has worked on, but it doesn't include a date that machine was down. I need to create a list of days worked and not worked. I am not sure of the best way to do this. I have started by incrementing through all the days of a range and checking to see if the date is in the list by iterating through the entire list each time. I am looking for a more efficient means of finding the dates. class machineday { datetime WorkingDay; } class machinedaycollection : List<machineday> { }

    Read the article

< Previous Page | 38 39 40 41 42 43 44 45 46 47 48 49  | Next Page >