Search Results

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

Page 17/322 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Sending emails based on intervals using Ruby on Rails

    - by Angela
    Hi, I would like to be able to send a string of emails at a determined interval to different recipients. I assign to each Contact this series of Emails called a Campaign, where Campaign has Email1, Email2, etc. Each Contact has a Contact.start_date. Each Email has email.days which stores the number of days since a Contact's start-date to send the email. For example: Email1.days=5, Email2.days=7, Email3.days=11. Contact1.start_date = 4/10/2010; contact2.start_date = 4/08/2010 IF today is 4/15, then Contact1 receives Email 1 (4/15-4/10 = 5 days) IF today is 4/15, then Contact2 received Email 2 (4/15 - 4/8 = 7 days). What's a good action to run every day using a cron job that would then follow these rules to send out emails using ActionMailer? Thanks.

    Read the article

  • SQL COUNT records in table 2 JOINS away

    - by Fred K
    Using MySQL, I have three tables: projects: ID name 1 "birthday party" 2 "soccer match" 3 "wine tasting evening" 4 "dig out garden" 5 "mountainbiking" 6 "making music" batches: ID projectID templateID when 1 1 1 7 days before 2 1 1 1 day before 3 4 2 21 days before 4 4 1 7 days before 5 5 1 7 days before 6 3 5 7 days before 7 3 3 14 days before 8 5 1 14 days before templates: ID message 1 "Hi, I'd like to invite ..." 2 "Dear Sir, Madam, ..." 3 "Can you please ..." 4 "Would you like to ..." 5 "To all dear friends ..." 6 "Does any of you guys ..." I would like to display a table of templates and the number of projects they're used in. So, the result should be: templateID projectCount 1 3 2 1 3 1 4 0 5 1 6 0 I've tried all kinds of SQL queries using various JOINs, but I guess this is too complicated for me. Is it possible to get this result using a single SQL statement?

    Read the article

  • How can I use edit_in_place on three different models from a View for a model those three belong_to?

    - by Angela
    I have a model called Campaign. In the controller, I do the following to list, in order, the three Models that belong_to a Campaign: <% @campaign_events = campaign_events %> <% @campaign_events.each do |campaign_event| %> <% model_name = campaign_event.class.name.tableize.singularize %> <p> <%= link_to campaign_event.title, send("#{model_name}_path", campaign_event) %> <span class='model_name'>(<%= model_name.capitalize %>)</span> <%= campaign_event.days %> Days </p> <% end %> campaign_event is a campaign_helper defined as: module CampaignsHelper def campaign_events return (@campaign.calls + @campaign.emails + @campaign.letters).sort{|a,b| a.days <=> b.days} end end I want to be able to click on the numerical value for Days when looking at the view/campaign/show and edit the value for :days (in this case, displayed as campaign_event.days

    Read the article

  • Calculation of Milestones/Task list

    - by sugar
    My project manager assigned me a task to estimate the development time for an iPad application. Lets assume that I gave estimation of 15 working days. He thought that the number of days where too many and client needed the changes to the application urgently (as in most of cases). So, he told me: "I am going to assign two developer including you and as per my understandings and experience it won't take more than seven working days." Clarifications I was given the task of estimating development time for an individual. How could I be sure that 2 developers are going to finish it within 7 days? (I am new to team & I hardly know the others abilities) Questions Why do most of project managers / team leaders have understandings like: If one developer requires N days, Then two developers would require N/2 days, Do they think something like developer = s/w production machines? Should a team member (developer, not team lead or any higher post) estimate other developers work? I didn't deny anything in the meeting and didn't said, but what should be the appropriate answer to convince them that N/2 formula that they follow is not correct?

    Read the article

  • if_attribute on declarative authorization. STUCK FOR DAYS!!!

    - by Victor Martins
    I can't seem to find a solution for this problem :s I have a many to many relationship like this: A user has_many organizations through affiliations and vice versa. I'm using declarative organizations and I only want a user to edit a particular organization if he is affiliated and the affiliationtype attribute of affiliation is a particular value. So affiliations has 3 columns , user_id, organization_id and affiliationtype_id I can do: o = Organization.find(:first) o.affiliatons[0].user and get the user now I wish to do this: has_permission_on [:organizations], :to => :edit do if_attribute (...) end That if_attribute should see if the current user is the organization.affiliation[?].user and if the organization.affiliation[?].affiliationtype_id = "3" I hope this is syntax issue ... I really need to get this working. Thanks in advance.

    Read the article

  • JavaScript: jQuery Datepicker - simple highlighting of specific days, who can help? (source inside)

    - by Klicker.eu
    Hi guys, i want to use the Datepicker for highlighting specific dates. Here is my latest code: <script type="text/javascript"> var dates = [30/04/2010, 01/05/2010]; $(function(){ $('#datepicker').datepicker({ numberOfMonths: [2,3], dateFormat: 'dd/mm/yy', beforeShowDay: highlightDays }); function highlightDays(date) { for (var i = 0; i < dates.length; i++) { if (dates[i] == date) { return [true, 'highlight']; } } return [true, '']; } }); </script> my CSS is: #highlight, .highlight { background-color: #cccccc; } Well the calendar comes up, but there is nothing highlighted. Where is the problem in my code? If anyone could help that would be great. Another option/solution could be: disable all dates, but make available only dates in an array. Thanks!

    Read the article

  • Converting timestamp to time ago in php e.g 1 day ago, 2 days ago...

    - by cosmicbdog
    hi everyone, i am trying to convert a timestamp of the format: 2009-09-12 20:57:19 and turn it into something like '3 minutes ago' with php. I found a useful script to do this, but I think its looking for a different format to be used as the time variable. The script I'm wanting to modify to work with this format is: function _ago($tm,$rcs = 0) { $cur_tm = time(); $dif = $cur_tm-$tm; $pds = array('second','minute','hour','day','week','month','year','decade'); $lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600); for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]); $no = floor($no); if($no <> 1) $pds[$v] .='s'; $x=sprintf("%d %s ",$no,$pds[$v]); if(($rcs == 1)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= time_ago($_tm); return $x; } I think on those first few lines its trying to do something that looks like this (different date format math): $dif = 1252809479 - 2009-09-12 20:57:19; How would I go about converting my timestamp into that (unix?) format?

    Read the article

  • How do I select the number of distinct days in a date range?

    - by isme
    I'm trying to use the T-SQL function DATEDIFF to select the number of distinct dates in a time period. The following query: SELECT DATEDIFF(DAY, '2012-01-01 01:23:45', '2012-01-02 01:23:45') selects 1, which is one less than I want. There are two distinct dates in the range: 2012-01-01 and 2012-01-02. It is not correct to add one to the result in the general case. The following query: SELECT DATEDIFF(DAY, '2012-01-01 00:00:00', '2012-01-02 00:00:00') selects 1, which is correct, because there is only one distinct date in the range. I'm sure there is a simple bit of arithmetic that I'm missing to calculate this. Can someone help me?

    Read the article

  • Why do people still use C these days? [closed]

    - by Joshua
    C++ is clearly a far superior language than C, since it has many features that C lacks (although, C++'s object model isn't as ideal as say C#'s). With the coming off the new C++0x standard, why hasn't C been phased out to obscurity? C++ has been around for so long, since the '80s. The Linux kernel has already been ported to C++ with negligible performance differences. I believe, with no evidence, that larger program structures benefit in performance if written in C++ than in C, if only because of object interaction. Don't get me started on "objects-in-C!" libraries, which are all a terrible hack. (Not that C++'s object model is the most ideal, but it is almost up to snuff with C# using common ad-hoc techniques.)

    Read the article

  • Code Golf: Print the entire "12 Days of Christmas" song in the fewest lines of code.

    - by fizzer
    Print all 12 verses of the popular holiday song. By 12 verses I mean the repetition of each line as is sung in the song, ie Verse One: On the first day of Christmas my true love gave to me a partridge in a pear tree. Verse Two On the second day of Christmas my true love gave to me two turtle doves and a partridge in a pear tree. ... Verse N: On the nth day of Christmas my true love gave to me (Verse N-1 without the first line) (line added in verse N)

    Read the article

  • SQL to display an event on start date, end date and any days in between.

    - by Tim
    Hello, This should be fairly simple, but I can't get my head around it. I have an event in my database with a startDate and an endDate. I need to display this event (based on the current date) on every day the event occurs. So if the event starts on the 3rd of May and finishes on the 7th of May, the SQL query must find it on every single day. How can I achieve this? SELECT * FROM events WHERE startDate ??? Thanks, Tim

    Read the article

  • Should I invest time in learning Java language these days? (question from a greenhorn)

    - by dave-keiture
    Hi experts, Assuming you've already had a chance to look through the lambda syntax proposed for Java7 (and the other things that have happened with Java, after Oracle has bought Sun + obvious problems in Java Community Process), what do you think is the future of Java language? Should I, as a Java greenhorn, invest time in learning Java language (not talking about the core JVM, which definitely will survive anything, and worth investments), or concentrate on Scala, Groovy, or other hybrid languages on the JVM platform (I've came into Java world from PHP/Ruby). Thanks in advance.

    Read the article

  • Sprint to the finish: how to keep all team-members busy in the final days of a Scrum sprint?

    - by sdg
    Given that the tasks in a specific sprint will not divide perfectly into the team, and all finish on the same date, what do you do to keep everyone working as the sprint moves into its final stages? Inevitably it seems like there will be one or two people freed-up. If all the other tasks are done-done, and the remaining tasks are already underway, then what? Do those team-members pick up items from the top of the product backlog, as they are likely to be needed in the next sprint anyways to get a head start? What do you or your teams do?

    Read the article

  • How to influence linebreak in Android Textview

    - by Lord Flash
    I have an Appwidget displaying days until an event like: eventname (-231 days) If possible I want to display this String in one line. If the eventname is too long I want to display the full term in braces into a new line. So that it is like: longeventname (-231 days) instead of: longeventname (-231 days) (or anything similar) Is there a way to archive this? Can I make (-231 days) "atomic"? string.getLength won't work since the size of the widget will vary by device.

    Read the article

  • Why is there so much XML in Java these days?

    - by BD at Rivenhill
    This is really more of a philosophy/design issue. I did some work in Java back in the middle 90's and again in the early 2000's and now I'm coming back to it after spending a lot of time in C/C++ and it seems like there was an explosion of XML dependency while I was gone. Major build system tools like ant and maven depend on XML for their configuration, but I'm actually more concerned with all the frameworks, such as Spring, Hibernate, etc. My experience is that powerful supporting libraries like these are where a developer can really get leverage for building programs with lots of features without writing a lot of code, but it really seems like I'm getting one language for the price of two here. I write a bunch of Java classes, but then I also write a bunch of XML files to glue them together. The things that get done in the XML are things that I can see reasonable ways of doing in straight code without the middleman, and they don't really seem to be treated exactly like configuration files: they change rarely and they end up getting committed to source code control like the Java code itself, but they are distributed with the resulting application and need to be unpacked and installed in the classpath in order to get the application to work. I'm working with server applications that are not web-based, so maybe the domain is a bit different from what most people are doing, but I just can't help feeling that I must be doing something wrong here. Can someone point me to a good source of information for why these design choices were made and what problems they are meant to solve so that I can analyze my own experiences in this context?

    Read the article

  • Writing a batch script to perform differently on different days?

    - by Tom
    I am in the process of setting up a batch script to do a specified action if the script was run on a weekday, and an alternate action if run on the weekend. I am almost completely unfamiliar with writing batch scripts, but I know how to write my entire script except the logic I describe above. Can someone please answer both if it is possible, and if it is at least a framework of how to implement it. Thanks in advance.

    Read the article

  • How to delete files with a Python script from a FTP server which are older than 7 days?

    - by Tom
    Hello I would like to write a Python script which allows me to delete files from a FTP Server after they have reached a certain age. I prepared the scipt below but it throws the error message: WindowsError: [Error 3] The system cannot find the path specified: '/test123/*.*' Do someone have an idea how to resolve this issue? Thank you in advance! import os, time from ftplib import FTP ftp = FTP('127.0.0.1') print "Automated FTP Maintainance" print 'Logging in.' ftp.login('admin', 'admin') # This is the directory that we want to go to directory = 'test123' print 'Changing to:' + directory ftp.cwd(directory) files = ftp.retrlines('LIST') print 'List of Files:' + files # ftp.remove('LIST') #------------------------------------------- now = time.time() for f in os.listdir(directory): if os.stat(f).st_mtime < now - 7 * 86400: if os.directory.isfile(f): os.remove(os.directory.join(directory, f)) #except: #exit ("Cannot delete files") #------------------------------------------- print 'Closing FTP connection' ftp.close()

    Read the article

  • Calculate difference in days ActiveSupport:TimeWithZone in the most "rubyish" style?

    - by Nick
    I have a feeling someone is going to point me to another question that answers this but I've been searching with no luck over this simple issue. I have a Activerecord with a datetime property. It returns as an ActiveSupport:TimeWithZone. I know I can't compare that to DateTime.now because that doesn't include a zone so I need to use Time.zone. Makes sense. What I'm wondering is stylewise is there a "cleaner" way to do this than subtracting and dividing the result by 86400? Here's what I do: ((Time.zone.now - myActiveRecord.visit_date)/86400).to_i Works but seems un-rubyish and I feel like I'm missing something. Should I be casting, comparing or converting some other route or is this really the typical way to do this in rails? Appreciate any tips or a link to a question that already covers this. Thank you

    Read the article

  • PHP: How to get the days of the week?

    - by fwaokda
    I'm wanting to store items in my database with a DATE value for a certain day. I don't know how to get the current Monday, or Tuesday, etc. from the current week. Here is my current database setup. menuentry id int(10) PK menu_item_id int(10) FK day_of_week date message varchar(255) So I have a class setup that holds all the info then I was going to do something like this... foreach ( $menuEntryArray as $item ) { if ( $item->getDate() == [DONT KNOW WHAT TO PUT HERE] ) { // code to display menu_item information } } So I'm just unsure what to put in "[DONT KNOW WHAT TO PUT HERE]" to compare to see if the date is specified for this week's Monday, or Tuesday, etc. The foreach above runs for each day of the week - so it'll look like this... Monday Item 1 Item 2 Item 3 Tuesday Item 1 Wednesday Item 1 Item 2 ... Thanks!

    Read the article

  • LINQ. Grouping by days. How to do this easily?

    - by punkouter
    I can't seem to find any god reference on this. I have alot of data in SQL with dates. So I wanted to make a line chart to show this data over time. If I want to show it over a perioud of days then I need to group by days.. But the LOGDATE is the full date.. not the DAY.. So I have this below.. but LINQ doesnt know what 'DayOfYear' property is.. HELP var q = from x in dc.ApplicationLogs let dt = x.LogDate group x by new { dayofyear = dt.Value.DayOfYear } into g select new { iCount = g.Count(), strDate = g.Key };

    Read the article

  • Excel 2010 - more than 1 calculation within an IF() statement

    - by Da Bajan
    I have a situation where I need to calculate shipping values based on the length of the supply chain. Easy, however I need to have instances where an increased amount is required based on specific date criteria. My example is as follows: Shipvalue = 100 Date1 = 1/1/2013 (Jan) - ship 50% more than usual Date2 = 2/1/2013 (Feb) - ship 25% more than usual Date3 = 3/1/2013 (Mar) - ship 25% more than usual Supply chain length is: June - October 100 days November - March 140 days April - June 100 days The issue I have is that as there is an increase in the number of days, my formula: IF( Date1-(Supply chain length + any extra days)=today's date, shipvalue+(shipvalue X 50%), IF( Date2-(Supply chain length + any extra days)=today's date, shipvalue+(shipvalue x 50%) IF( Date2-(Supply chain length + any extra days)=today's date, shipvalue+(shipvalue x 50%), IF( preceding cell<>0,shipvalue, 0) ) ) ) Now the problem with this is that if the length of the supply chain increases then the formula misses all but the 1st increase. So, I thought of adding a variable that would be incremented and checked every time you made an increased shipping amount. So, how do I do both the calculation for the increased shipping value, and set the variable in one part of the IF statement?

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >