Links for calendar algorithms.?

i am looking for algorithms that can answer questions such as: Xth day of a month M in year Y(third monday of january 2003 for ex).
Any tips or links?
Thanks.

Sorry - I made a couple of blunders in my last example. Check this instead:
import java.util.*;
public class CalendarTest {
    public static void main(String[] a) {
        Calendar c= new GregorianCalendar();
        int d= Calendar.MONDAY;
        c.set(Calendar.YEAR, 2003);
        int x= 3; // 3 for 3rd occurence
        int m= Calendar.JANUARY;
        if(a.length > 0)
            c.set(Calendar.YEAR, Integer.parseInt(a[0]));
        if(a.length > 1)
            m= Integer.parseInt(a[1])-1;
        if(a.length > 2)
            x= Integer.parseInt(a[2]);
        c.set(Calendar.MONTH, m);
        c.set(Calendar.DAY_OF_WEEK, d);
        if(c.get(Calendar.MONTH) > m)
            c.add(Calendar.DAY_OF_YEAR, -(c.get(Calendar.DAY_OF_MONTH)+7)/7*7);
        int add= (x-(c.get(Calendar.DAY_OF_MONTH)+6)/7)*7;
        if(add != 0) {
            c.add(Calendar.DAY_OF_MONTH, add);
        System.out.println(c.getTime());
}Compile the program, and enter parameters as:
$java CalendarTest <year> <month> <week>
or
$java CalendarTest <year> <month>
or
$java CalendarTest <year>
or simply
$java CalendarTest
Year defaults to 2003, month to January (1), and week to 3.
Kind regards

Similar Messages

  • BB Link does not recognize Outlook as a source for calendar and contact sync

    When setting up BB Link for my BB Classic it does not recognize Outlook 2013 (on Windows 7) as a source for calendar and contacts.

    I know there are people who can and many who cannot, never saw a resolution yet, I hope someone who can will reply to your post so that is why I am replying this sends your post back up to the top. Here is a recent user who can but does have a issue: http://supportforums.blackberry.com/t5/BlackBerry-Link/Duplicate-Calendar-Entries/td-p/3108949 I wish I could do more but I do not use Outlook or BB Link.

  • Have problem setting Email alerts for Calendar events. Warning message says I need to set up a card in Contacts with my email. I do but it doesn't recognize it. How do I indicate the email I want alerts sent to?

    The system of setting up email alerts for Calendar events worked fine in Snow Leopard but since I upgraded to Mt. Lion Calendar won't let me set email alerts. When I try, I get an error message saying I need to set up a card in Contacts for my email. I have a card set up in Contacts for both of my email addresses but it doesn't recognize them. Perhaps the name I have on the card doesn't match a name that Calendar is looking for. Calendar doesn't seem to have a way in Preferences or elsewhere to indicate the email I want alerts sent to. Any ideas how I can get this system working again? Thanks for your help.

    You might want to consider starting a new discussion. Since this one is marked solved, less people are likely to look at it. You can link to this one.
    See if another contact is marked as this is my card.

  • How do you link Google calendar to iCal in Maverick?

    Just downloaded Maverick (great) to my late 2008 aluminium laptop but cannot link Google Calendar with iCal.  In iCal tried deleting old account and re-entering but still iCal does not sync, although it still does on iPad and iPhone.  Any ideas?

    Hi there,
    I have tested this out on my backup disk and there is a slight modification to the method. Will highlight this with quotation.
    ================================================================================ ==
    It appears that once upgraded to Mavericks, the calendar folders are no longer compatible with the latest version of iCal. Hence why it crashes.
    To remediate,
    Close the iCal App
    Duplicate the folder (For Backup reason)     /Users/YOURPROFILE/Library/Calendar
    Delete all content with in      /Users/YOURPROFILE/Library/Calendar
    Go to:-
    System Prefences | Internet Account | iCloud
    Uncheck Calendars, Recheck Calendars
    Select the iCloud profile
    Press "-" to delete the whole iCloud profile.
    Recreate the iCloud profile by select "+" then iCloud
    Enter your iCloud Username and Password
    It will asked you if you wish to merge the database. (You may have to do this more then once)
    For every other google calendar
    Uncheck Calendars (if already checked), Recheck Calendars
    Hopefully this will recreate all the calender folders within /Users/YOURPROFILE/Library/Calendar and start re-syncing.
    Once you are satified that all your calender are syncing, delete the /Users/YOURPROFILE/Library/Calendar copy
    Good Luck.
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++

  • I Need Java code for following Algorithm

    * I Need Java code for following algorithm. Kindly any one help.
    1. Read the contents (ideas and its corresponding scores) from two files named as 'a' and 'b'.
    2. Stored the file 'a' contents in array a[].
    3. Stored the file 'b' contents in array b[].
    4. compare both files like
    if(a.equals(b[j])
    Writing the common idea and add the score from file 'a' and 'b'.
    else
    write the uncommon idea and its score..
    For example :
    Form Agents.txt
    action,65
    architecture,85
    eco-,15
    essay,30
    form,85
    form,85
    link,40
    tangent,25
    Form Agents1.txt
    Black holes,69
    essay,78
    Herewith i have above mentioned two files named as Form Agents and Form Agents1.
    Form Agents has eight fields
    Form Agents1 has two fields
    --> 'essay' is common in two files, so store the idea 'essay' and add the score from Form Agents score is '30' and Form Agents1 has 78 (essay 108).
    Finally it stores idea in another file with uncommon fields also.
    Please help us.

    We have tried with following code.
    But we cant add the scores.
    For Example:
    Form Agents.txt --> has "essay,30"
    Form Agents1.txt --> has "essay,78"
    Result is: essay,108
    Finally it stores idea in another file with uncommon fields also.
    So Any one pls correct the following code.
    try
    DataOutputStream o1=new DataOutputStream(new
    FileOutputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
    World\\Project\\Material\\art\\System Agents\\Form Agents\\CandidateResponses\\Form
    Agents.txt"));
    //Reading the contents of the files
    BufferedReader br= new BufferedReader(new InputStreamReader(new
    FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
    World\\Project\\Material\\art\\System Agents\\Form Agents\\Ideological\\Form
    Agents.txt")));
    BufferedReader br1= new BufferedReader(new InputStreamReader(new
    FileInputStream("C:\\Interfaces\\interfaces\\temp\\BlackBoard\\My Design
    World\\Project\\Material\\art\\System Agents\\Form Agents\\Related\\Form
    Agents.txt")));
    while((s=br.readLine())!=null)
    s1+=s+"\n";
    while((s2=br1.readLine())!=null)
    s3+=s2+"\n";
    int numTokens = 0;
    StringTokenizer st = new StringTokenizer(s1);
    String[] a = new String[10000];
    String[] br_n=new String[10000];
    int i=0;
    while (st.hasMoreTokens())
    s2 = st.nextToken();
    a=s2.substring(0,s2.length()-3);
    s6=s2.substring(s2.length()-2);
    br_n[i]=s6;
    i++;
    numTokens++;
    int numTokens1 = 0;
    StringTokenizer st1 = new StringTokenizer (s3);
    String[] b = new String[10000];
    String[] br1_n=new String[1000];
    int j=0;
    while (st1.hasMoreTokens())
    s4 = st1.nextToken();
    b[j]=s4.substring(0,s4.length()-3);
    s7=s4.substring(s4.length()-2);
    br1_n[j]=s7;
    j++;
    numTokens1++;
    int x=0;
    for(int m=0;m<a.length;m++)
    for(int n=0;n<b.length;n++)
    if(a[m].equalsIgnoreCase(b[n])){
    int sc=Integer.parseInt(br_n[m]);
         int sc1=Integer.parseInt(br1_n[n]);
    int score=sc+sc1;
         o.writeBytes(a[m]+","+score+"\n");
    break;
    else
    o.writeBytes(a[m]+","+br_n[m]+"\n");
    break;
    }catch(Exception e){}

  • The download of icloud control  panel v2.0 does not work. I have no box to check for calendar and contaks. Whats wrong?

    The download of icloud control panel v2.0 does not work. I habe no box to check for calendar and contacts. Whats wrong?
    Thanks Chris

    Hi, I came across the same problem and was not able to open any iCloud folders on Outlook, and iCloud was continusly asking to repair the iCloud Control Panel. Got the issue fixed by following the steps on the link http://somanytips.com/fix-icloud-error-repair-the-icloud-control-panel-to-use-ic loud-with-outlook/

  • Mathematic​a Link for LabVIEW Integrates Design Models and Measuremen​ts

    Mathematica Link for LabVIEW, a new technical computing
    application created by BetterVIEW Consulting, is now available.
    This software bridges National Instruments LabVIEW graphical
    development environment and Wolfram Research Mathematica
    technical computing software to help engineers and scientists
    more easily acquire and analyze measurements throughout all
    phases of the design process.
    Mathematica Link for LabVIEW combines the data acquisition,
    analysis, and graphical user interface capabilities of LabVIEW
    and the modeling and analysis algorithms of Mathematica to speed
    development of custom applications in hundreds of industries,
    from quantum mechanics to automotive. With this software,
    engineers can control a LabVIEW application (Virtual Instrument
    or VI) from Mathematica or access Mathematica from within a
    LabVIEW VI.
    Mathematica Link for LabVIEW features built-in, high-level
    functions for creating a communication path between LabVIEW and
    Mathematica to achieve seamless integration throughout the
    design flow, from the first mathematical model to validating the
    final design. For example, engineers and scientists can easily
    send numeric computations to the Mathematica kernel and return
    results to LabVIEW, visualize LabVIEW data using native
    Mathematica data visualization functions, and create simple, yet
    flexible simulation and control VIs that take advantage of the
    symbolic programming capabilities of Mathematica.
    Integrating two leading technical computing systems like
    Mathematica and LabVIEW brings technical professionals one step
    closer to having the ideal, start-to-finish work environment.
    With Mathematica Link for LabVIEW, entirely new, hybrid
    workflows become possible, thus enabling users to quickly and
    easily find solutions to complex problems--solutions that would
    be difficult, if not impossible, to realize using only one of
    the component packages.
    Mathematica Link for LabVIEW requires Mathematica 4.1 or later
    and LabVIEW 6i or later, and is available for Windows and
    Macintosh platforms. For more information about Mathematica Link
    for LabVIEW, visit:
    http://www.wolfram.com/products/applications/labvi​ew

    Socalledvita-
    What functionality are you looking from the Amplitude and Level Measurement Express VI?  There is not one-one replacement you can use.  However, there are definitely ways of calculating the DC and RMS values of a signal as well as finding the max and min points, etc.  Please be more specific in what you are trying to accomplish.
    Regards,
    Mike S
    NI AE

  • HT5622 My wife and I both have MacBooks and both are associated with my apple ID since I bought them. However, this means that Safari is linked for both her and I as well as our contacts etc. Can I still use mine for apps for her but associate hers with h

    My wife and I both have MacBooks (I have MacBook Pro and she has Air) and both are associated with my apple ID since I bought them. However, this means that Safari is linked for both her and I as well as our contacts etc. Can I still use mine ID for apps for her but associate hers with her own ID that I have yet to make?

    Well with the MS Hotmail/Outlook.com account that is hard. But she should be able to link all of it to the iCloud system using her Apple ID.
    I suggest you do a Google search for "link contacts, Calendars, iMessage with iCloud".
    For some stupid reason MS has limited the syncing/linking of only emails and Notes with the Hotmail/Live Mail/Outlook.com system.
    They have not included any Exchange features for syncing all that info. That is unless you are using Outlook 2013 and that is only for Windows.

  • Prompt for calendars

    hi all,
    we have a requirement, actually we have 3 types of Time periods(Calendar, Fiscal, Operational) those are from different tables. our client wants a prompt to select a Time period(it may be any of the above) and according to that the report data should show according to that calendar. how can we create prompt for this? please give me reply as soon as possible.
    thanks in advance.

    hi,
    can you send me any documentation or link for setting variables in prompts. here is my email id
    [email protected]
    regards,
    Mimran

  • Java beans for calendar utility

    Hii Javaities
    I need to have calendar in my jsp for choosing dates
    Earlier i was uisng javascript for calendar but now i want to use Java beans .
    Can i use Java beans for calendar ?
    Are there any tag libraries for tht ?

    PDAs ? hmm...sounds interesting
    what technology have u thought of using for your application ?
    java microedition ...[certainly not c++ or .net] ?
    Is it going to be a stand alone application on a PDA .
    OR
    Are you thinking of wireless internet connectivity to the PDA? In this case your application might have to be designed strickly so that it fits the screen size.
    How about a tablet PC? It good for mobile computing and is handy too.
    See this link for tablet PC
    http://www.motioncomputing.com/

  • Setting up GMAIL Account only for calendar access

    I wanted to ask the Board Members if they had any experience with this, before I mess up my Z10.
    I need to access a Google Calendar, and add its contents to my calendar on the Z10 constantly updated. Otherwise I use the Link software with USB with Outlook 10 and use the BBLink Calendar account on my device. Right now I don't link Gmail with my Z10 and I don't intend to.
    As I tried to set it up, it seems that Google wants to access my device, set up an email account, sync my contacts. I stopped the setup and did not move forward.
    I have the leaked OS 10.2.0.1371, which is awesome, BTW and and I have the add Subscribed Calendar option in the add new account settings, but I was unable to do so after I tried www.google.com as the server address or the link google provides in the calendar setting option..
    Is there any way to add a GMAIL account with syncing the mail, contacts, just getting a 1-way sync of a calendar?
    Alex
    Solved!
    Go to Solution.

    During the setup process, you may be (depends on your OS level) presented with several different screens, some will appear to come from GMail, and others from BlackBerry. One of those may make statements about wanting to authorize the set up calendar, contacts, and emails...but that particular screen will not provide any options but to accept or cancel. This screen is actually just informative...saying that you must accept if you wish to be able to use ANY of those, but that screen does not actually configure any of them. When you accept this first screen, it will proceed to other screens, one of which is where you will actually choose which of the functions you wish to integrate (calendar, contacts, and/or email)...simply slide to OFF those you do not wish to enable.
    Good luck!
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • How do you link hotmail calendars to mac?

    how do you link hotmail calendars to mac?

    Hi there Janevl,
    You may find the information in the article below helpful.
    Configuring Mail for your email account
    http://support.apple.com/kb/ht1277
    -Griff W. 

  • Is there bulk pricing available for calendars?

    I found an old link during a search referring to bulk pricing of photo print products, but I can't find anything current.  Does anyone know if I can get a discount if I order 50 or 100 calendars? Thanks in advance!

    The list of prices is here - it does not state any bulk pricing options for calendars:  http://www.apple.com/mac/print-products/
    Only the shipping cost is a flat rate, regardless of the quantity.
    http://store.apple.com/uk/help/print_products

  • Idea for calendar.

    Hi, really I just have a suggestion... I notice each update there's improvements in all areas for iPad &amp; would like to suggest one for calendar.
    Alot of the times I book customers in on more than one occasion, but many dates apart &amp; find myself copying all the information &amp; numbers via copy &amp; paste.
    So really the suggestion is to copy an actual whole calendar event to any other date required without repeating it consecutively.
    Can this be helpful to anyone, or am I missing something already available....

    This is a user-to-user forum. You're not addressing Apple here. Submit your suggestions using the appropriate link on the Feedback page:
    http://www.apple.com/feedback
    Meanwhile, you might want to search around the App Store to see if there might be a calendar app that already does what you want.

  • Remove link for uploaded files in application

    Hi all,
    I've been following the tutorial on how to upload and download files in application at http://download-uk.oracle.com/docs/cd/B32472_01/doc/appdev.300/b32469/up_dn_files.htm. I have now created my own table which stores the uploaded files and can download them successfully. I would now like to add the ability to delete these files within the application and was wondering what the best way of doing this was?
    I would like to add another column to the displayed report with a 'Remove file' link for each listed file, which when clicked would delete the file from the table. I've already tried using a similar method to the one used to upload the files (instead of uploading the file, the called procedure deletes it from the table using the specified ID), but this causes the application to display a blank page when the link is clicked, which I dont want (but does delete the file).
    I would appreciate any suggestions.
    Regards,
    Dave

    Dave,
    See the login page:
    http://htmldb.oracle.com/pls/otn/f?p=31517:101
    There are details on how to access the application builder, where you can see how the
    setup of that download, delete, upload application has been done.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

Maybe you are looking for