Text files not displaying according to date

Hi
I am developing an app that has 365 text files in my local folder, the essence of the app is to display each content of the text file according to the day of the year e.g for feb 3 2015 it will display Devotion34.txt but when i run it on the emulator
is displaying May 14 which is Devotion134.txt i.e it jumps 100 days ahead of the year
This my code below kindly help
xaml.cs
public partial class MainPage : PhoneApplicationPage
        List<String> devotions = new List<string>();
        // Constructor
        public MainPage()
            InitializeComponent();
            AddDevotions();
            int index = DateTime.Now.DayOfYear;
            textblock.Text = devotions[index];
            // Sample code to localize the ApplicationBar
            //BuildLocalizedApplicationBar();
        protected override void OnNavigatedTo(NavigationEventArgs e)
            DateTime dt = DateTime.Now;
            int month = dt.Month;
            int year = dt.Year;
            int index;
            if (DateTime.IsLeapYear(year) || (month <= 2))
                index = dt.DayOfYear - 1; // list is indexed from 0
            else
                index = dt.DayOfYear; // add a day
            textblock.Text = devotions[index].ToString(); // or some other property
        private void AddDevotions()
            for (int i = 1; i <= 366; i++)
                string filePath = Path.GetFullPath("Devotions/Devotion1" + i.ToString() + ".txt");
                if (File.Exists(filePath))
                    devotions.Add(ReadTextFile(filePath));
                else
                    devotions.Add(string.Format("Devotions file '{0}' was not found.", i));
        public string ReadTextFile(string textFilePath)
            string text = null;
            using (StreamReader r = new StreamReader(textFilePath))
                text = r.ReadToEnd();
            return text;
Reply soon and thank you in advance
Jayjay john

Seems like in AddDevotions you have a bug:
       private void AddDevotions()
            for (int i = 1; i <= 366; i++)
                string filePath = Path.GetFullPath("Devotions/Devotion1"
+ i.ToString() + ".txt");
Shouldn't the Path be "Devotions/Devotion" + i.ToString()?  You have a Devotion1 there which would
explain the 100 days added.
Bret Bentzinger (MSFT) @awehellyeah

Similar Messages

  • Hi i am new to labview. i want to extract data from a text file and display it on the front panel. how do i proceed??

    Hi i am new to labview
    I want to extract data from a text file and display it on the front panel.
    How do i proceed??
    I have attached a file for your brief idea...
    Attachments:
    extract.jpg ‏3797 KB

    RoopeshV wrote:
    Hi,
    The below code shows how to read from txt file and display in the perticular fields.
    Why have you used waveform?
    Regards,
    Roopesh
    There are so many things wrong with this VI, I'm not even sure where to start.
    Hard-coding paths that point to your user folder on the block diagram. What if somebody else tries to run it? They'll get an error. What if somebody tries to run this on Windows 7? They'll get an error. What if somebody tries to run this on a Mac or Linux? They'll get an error.
    Not using Read From Spreadsheet File.
    Use of local variables to populate an array.
    Cannot insert values into an empty array.
    What if there's a line missing from the text file? Now your data will not line up. Your case structure does handle this.
    Also, how does this answer the poster's question?

  • View the .rtf file not display the data in BI Publisher Enterprise.

    Hi,
    Platform: OBIEE 10g in NT XPsp2
    View the .rtf file not display the data in BI Publisher Enterprise.
    Step 1, I created Answer-request, create .rtf file with Word and add the request name, Add bar chart and table, preview PDF is working fine with data, Upload this template to Answers, View Template from Answer is working fine with data.
    Step 2, Answers – More Products > BI Publisher > My Folders > Create a new report > Edit > Data Model > New > Type: SQL Query > Data Source: Oracle BI EE > Query Builder > from SupplierSales assign Customer, Periods, Sales Facts (select Region, state, Year, Units Shipped) > Results > Save > Save
    Click Layouts > New > enter Name ….. > Click Layouts > borrows .rtf file in Manage T file > Upload > Save > Click View
    It is showing only the .rtf file without data. Why there is no data?
    Please guide me to solve this issue.
    Thanks,
    Jo

    Thanks for you reply,
    Our scenario is this report is basically a dissconnected mode report... we are developing these reports for mobile clients.
    We dint face this kind of issue while developing other reports.
    So please let us know if you have any idea on why we are facing this issue.
    Regards,
    Maneesh

  • I need to read data from a text file and display it in a datagrid.how can this be done..please help

    hey ppl
    i have a datagrid in my form.i need to read input(fields..sort of a database) from a text file and display its contents in the datagrid.
    how can this  be done.. and also after every few seconds reading event should be re executed.. and that the contents of the datagrid will keep changing as per the changes in the file...
    please help as this is urgent and important.. if possible please provide me with an example code as i am completely new to flex... 
    thanks.....  

    It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
    [http://java.sun.com/docs/books/tutorial/essential/io/]
    *Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Why is RoboHelp not displaying the required data content of .chm when linked as Help in my App ?

    Gorgeous Hello All,
    Has anyone encountered the below-said show- stopper. Another BIG TIME help required, will help me in tremendous fashion.
    Am using Adobe RoboHelp, Version 10 and IE version being 10.
    In my local machine :
    1.)I have completed my technical writing courtesy Design editor
    2.)Generating chm File : View -> Pods –> Single Source Layouts -> Right Click on Microsoft HTML Help -> Tagged Set as Primary Layout
    3.)Generating Primary Layout : File -> Generate -> Primary Layout (Microsoft HTML Help)…
    4.)Viewing Primary Layout : File -> View -> Primary Layout
    Everything works FANTASTICALLY till here with the required output (as Hide, Back, Refresh, Home, Print, Options, Contents, Index, Search, Glossary and with the data contents)
    Show Stopper, At my Application Server :
    5.)I copy the entire robohelp project folder from my local machine to my application Server path
    6.)My Application has been developed in ASP .NET, Version 4.0.
    7.)Help link has been created in this application wherein here the file name of < >.chm has been linked in the code to be read from the  Server’s RoboHelp project folder\!SSL!\ Microsoft_HTML_Help\
    8.)I login into my above-said application -> click on the Help page -> Displays the required structure /buttons as Hide, Back, Refresh, Home, Print, Options, Contents, Index, Search, Glossary
    a.)Clicking on any of the Books or Topics appearing beneath Contents : The System prompts out with error cautionary message called “ Navigation to the webpage was cancelled. What you can try: Retype the address ”
    *** This is a huge SHOW-STOPPER. I spent plenty of hours on this, but unable to deciper with a solution at all) ***
    ( Note : Am able to directly open and read the required data contents by Clicking on any of the Books or Topics appearing beneath Contents from Server’s RoboHelp project folder\!SSL!\ Microsoft_HTML_Help\ < >.chm )
    Why is the RoboHelp not displaying the required data contents of <>.chm when linked as Help in my Application ?
    Cheese – Vipin Nambiar

    If you looked at the error message and searched the forum, you should find the answer as this is a problem that started in 2005. You should not run CHM files from a server and cannot without editing the users registry. See the page below.
    http://www.grainge.org/pages/authoring/chm_mspatch/896358.htm
    All along your questions have been based on webhelp, why suddenly are we going go CHMs.
    See Snippets on my site for the correct form of help to use in different scenarios.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • ICO file not displaying at run time?

    Hello Experts,
    I an using fusion 11.1.2.1 32 bit. I have Copied the Icons as well as GIF files in C:\Oracle\Middleware\Oracle_FRHome1\forms\java folder.
    At button property i set Iconic to yes
    and file = addrow
    Icon not display at run time.
    but when i set file = abc.GIF
    image is displaying at run time.
    My doubt is that ICO file not displaying at run time while GIF file are displaying.
    Do i need to change configuration ?
    Please do the needful.
    Thanks
    Yash

    Hi Yash,
    First Try this steps
    To resolve this issue, follow these steps:
    Double-click My Computer, and then click Options on the View menu.
    Verify that the Icon file type appears on the File Types tab. If the Icon file type does not appear in the Registered File Types box, skip to step 10.
    Click Icon in the Registered File Types box, and then click Edit.
    Verify that the following settings exist, and then click OK:
    The Description Of Type box contains Icon.
    If there is a Confirm Open After Download check box, it should be selected.
    If the settings do not appear exactly as listed in step 4, click Remove, click Yes, and then click OK. If the settings do appear as listed in step 4, skip to step 10.
    Click New Type.
    In the Description Of Type box, type Icon.
    In the Associated Extension box, type ICO.
    Click OK, and then click Close.
    Use Registry Editor to view theHKEY_CLASSES_ROOT\.icokey, and then verify that the default string contains the following value:icofileIf the .ico key does not exist, create it, and then insert the value listed above. If any other values exist in the .ico key, delete them.
    Use Registry Editor to view theHKEY_CLASSES_ROOT\icofilekey, and then verify that the default string contains the following value:iconIf the icofile key does not exist, create it, and then insert the value listed above. If any other values exist, delete them.
    Create a new key in the icofile key called DefaultIcon , and type %1 as this key's default value.
    Quit Registry Editor, and then restart your computer.
    Second Try this
    Simple way
    Copy your images to:
    1
    c:\Oracle\Middleware\as_1\forms\java\ 
    Notes:
    - Icon files may not be supported.
    - In case of a Java security issue when using gif images, you will need to create a jar file and sign it with oracles sign-tool (see below, point 6).
    - In case you having trouble with oracle’s sign-tool, do it directly with java’s
    Recommended way
    1. Create a “icons” folder and place all your gifs in there
    i.e. “c:\Oracle\Middleware\as_1\forms\java\<icons>”
    2. From within icons folder make a jar file of all the gif images:
    1
    jar -cvf frmicons.jar *.gif 
    3. Copy this new jar into “c:\Oracle\Middleware\as_1\forms\java\”
    4. Edit/update formsweb.cfg file:
    path = c:\Oracle\Middleware\user_projects\domains\<my_domain>\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_11.1.1\config\formsweb.cfg  …to update/include:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    # Forms applet parameter 
    codebase=/forms/java
    # Forms applet parameter
    imageBase=codebase
    # Forms applet archive setting for other clients (Sun Java Plugin...etc)
    archive=frmall.jar,frmicons.jar
    # Forms applet archive setting for JInitiator
    archive_jini=frmall_jinit.jar,frmicons.jar
    5. Edit/update Registry.dat file:
    path = c:\Oracle\Middleware\user_projects\domains\<my_domain>\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_11.1.1\config\forms\registry\oracle\forms\registry\Registry.dat
    1
    2
    default.icons.iconpath=icons/ 
    default.icons.iconextension=gif
    At this point your icons should work normally, but if you get a security check of Java for gif files then proceed to the next step to fix this. TIP: May need to restart the weblogic/forms server for changes to take effect.
    6. Sign your jar file with oracles sign_webutil.bat sign-tool.
    path = c:\Oracle\Middleware\asinst_1\bin\sign_webutil.bat
    Firstly, you need to edit the sign_webutil.bat as follows:
    1
    2
    3
    SET KEYSTORE_PASSWORD=my_password 
    SET JAR_KEY=webutil2 # will need to change for every run
    SET JAR_KEY_PASSWORD=my_password
    Secondly, set the environment path and finally run the command:
    1
    2
    3
    set path=c:\Oracle\Middleware\as_1\jdk\bin 
    cd c:\Oracle\Middleware\asinst_1\bin\
    sign_webutil c:\Oracle\Middleware\as_1\forms\java\my_icons.jar
    This will create your signed jar file. Once initialized from the web-app it should ask the user to “Trust” the certificate and never prompt again.
    Other issues you may encounter and may need to edit/update the following files/registry entries as well:
    formsweb.cfg
    path = c:\Oracle\Middleware\user_projects\domains\<my_domain>\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_11.1.1\config\formsweb.cfg
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    # Forms applet parameter 
    codebase=/forms/java
    # Forms applet parameter
    imageBase=codebase
    # Forms applet archive setting for other clients (Sun Java Plugin, ...etc)
    archive=frmall.jar, my_icons.jar
    ...or
    # Forms applet archive setting for JInitiator
    archive_jini=frmall_jinit.jar, my_icons.jar
    Registry.dat
    path = c:\Oracle\Middleware\user_projects\domains\<my_domain>\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_11.1.1\config\forms\registry\oracle\forms\registry\Registry.dat
    1
    2
    default.icons.iconpath=/forms/java 
    default.icons.iconextension=gif
    Registry entries:
    1
    2
    UI_ICON:<path_to_icons_dir> 
    UI_ICON_EXTENSION: "gif": ".gif" "ico": ".ico"
    Credits and further information can be tracked for icons issue here and for jar file creation here.
    Hope this will help.

  • Reading from a text file and displaying the contents with in a frame

    Hi All,
    I am trying to read some data from a text file and display it on a AWT Frame. The contents of the text file are as follows:
    pcode1,pname1,price1,sname1,
    pcode2,pname2,price2,sname1,
    I am writing a method to read the contents from a text file and store them into a string by using FileInputStream and InputStreamReader.
    Now I am dividing the string(which has the contents of the text file) into tokens using the StringTokenizer class. The method is as show below
    void ReadTextFile()
                        FileInputStream fis=new FileInputStream(new File("nieman.txt"));
                         InputStreamReader isr=new InputStreamReader(fis);
                         char[] buf=new char[1024];
                         isr.read(buf,0,1024);
                         fstr=new String(buf);
                         String Tokenizer st=new StringTokenizer(fstr,",");
                         while(st.hasMoreTokens())
                                          pcode1=st.nextToken();
                               pname1=st.nextToken();
              price1=st.nextToken();
                              sname1=st.nextToken();
         } //close of while loop
                    } //close of methodHere goes my problem: I am unable to display the values of pcode1,pname1,price1,sname1 when I am trying to access them from outside the ReadTextFile method as they are storing "null" values . I want to create a persistent string variable so that I can access the contents of the string variable from anywhere with in the java file. Please provide your comments for this problem as early as possible.
    Thanks in advance.

    If pcode1,pname1,price1,sname1 are global variables, which I assume they are, then simply put the word static in front of them. That way, any class in your file can access those values by simply using this notation:
    MyClassName.pcode1;
    MyClassName.pname1;
    MyClassName.price1;
    MyClassName.sname1

  • Text does not display in address bar or any windows I open

    Text does not display when typing in address bar. When I open a window (eg Edit > Preferences) no text is displayed within that either.
    Problem has persisted through Ubuntu 12.04 (possibly 11.10) to 13.04. Has also remained after re-installs, both through use of Software Centre, and through Terminal commands, and after running purge of all firefox content.
    Running Firefox as root using gksu command also doesnt help.

    Have finally solved,
    1st checked default system fonts available using unity-tweak
    Then went to ~.mozilla/firefox and found prefs.js file, deleted everything to do with fonts and families, saved and restarted.
    The odd thing is how this file persisted despite removing and purging firefox.

  • In PO print text is not displaying?

    Hi all,
    IN PO printout text which i maintained in PO item text is not displaying, how to enable the same?
    regards,
    Sanjana

    You have to make changes in the print program to pick the same.
    Texts are not stored in any table directly. They are stored in STXH Header texts and STXL Item texts in an encrypted formats. You have to use Function module FM READ_TEXT to read the same.
    Please contact your programmer.

  • HT4157 I have an iPad 2 and it does not display the cellular data button under settings

    I have an iPad 2 and it does not display the cellular data button under settings.  It does display a Bluetooth button in its place. I have tried the reset but no luck

    Is the iPad the Cellular version? Does it have an active Data plan? Does it have a Sim card installed in inside it?

  • Some .htm file not displaying in Topic List, but displaying in RH11 folder

    Hi All,
    We are running a project using RH 11, team consist of 3 person (include me)
    But we have problem with many  .htm file from my 1st coworker, file not displaying in Topic List in my Robohelp and 2nd coworker.
    Although we already get the latest file again and again
    But .htm file displaying in all our RH11 folder.
    In my 1st coworker RH, all file displaying in Topic List also RH11 folder, but when file generated then
    Many files from 1st coworker, hyperlink is not working well (broken link / file not found)
    Does anyone have experience about this problem
    Thanks

    First of all, make sure you do not have the following files in source control: .cpd, .pss, .ldb.
    These files contain local information that can cause problems when in source control.
    Then try this:
    Everyone deletes the .cpd file.
    Everyone gets the latest files for the whole project from source control.
    Open the project.
    Does everything now display correctly?
    If yes, you need to make sure you delete the cpd file before opening the project each day, and also during the day if you know a co-worker has made changes that you need. This file is a database which includes a list of all the files Robohelp knows about. When other people are adding and removing files, this information no longer matches properly. I recommend doing a Get Latest in these situations as well, just to make sure Robohelp can find the correct information.
    If you are still not seeing the correct files repeat the above process, but at step 2, pick the options to Overwrite local files. I can't say where you will see these options - they may be two checkboxes in a dialog box when you select Get Latest - it will depend on your source control application.
    Hope this helps.

  • Files not displaying in list view?

    I recently upgraded my MacPro (early 2008 8core) from Snow Leopard (10.6.8)  to Lion.
    At first i wanted to do a fresh install on my machine but soon realised it wasnt possible to import old accounts from another internal drive so i opted to upgrade the system instead.
    After doing so I was faced with an odd problem of files not displaying in my finder windows when switching through internal drives or changing from 'file view' to 'list view' or 'column view' etc...
    The attached screenshots were taken in sequence youll also note that the path bar & top window name dont update either.
    The relevant drives are in healthy condition with several tests run over them to ensure their healthy(Disk Utility & Drive Genius). I have also run permissions repair, and a utility to empty cahces etc (OnyX). From what i can see its possibly something to do with the Finder not updating or refreshing the window? The issue seems to be isolated to the drives however intermittently the problem exists deeper into the directory on 'TerraTank' Volume.
    The finder also crashes semi-frequently and the problem seems to dispaear for a while and revealing the contents of these volumes for a few mins.
    I have also checked activity monitor to see if any particular process was going haywire and all seemed relativly normal.
    Has anyone else experienced this problem?
    Regards,
    JP

    Onyx may be causing problems.  Don't use it on a non-backed up system, as cleaning caches may damage them, and make things not work.    Make sure your Spotlight indexes all drives you wish to be searchable.  Go to Apple menu -> System Preferences -> Spotlight and add each hard drive to the Privacy section, and then remove it again.  Then click on the Spotlight menu every half hour to see when it stops saying that it is indexing.  It might take a few hours.  But once done, it should be fixed.

  • Flash files not displaying in Firefox, Safari, and Opera. Most recent Shockwave installed, private b

    Flash files not displaying in Firefox, Safari, and Opera. Most recent Shockwave installed, private browsing active in Firefox?  Works perfectly in Chrome and Internet Explorer.  HELP!!!!

    I suppose it would have helped if you knew what it was supposed to look like!   I'm using Shockwave Flash 11.7.700.169  and the version of Firefox I'm on is 20.0
    When you see it in Firefox  - do the thumbnail populate the grid?  See attached populated and un-populated.
    Populated grid is with Chrome.
    Thanks!
    Thanks in advance!

  • .nef files not displayed in my content window!

    .nef files not displayed in my content window. I just want to work, not screw around fixing thing. How come the .nef files won't display anymore? The new .nef files don't display.
    Thanks for your help.
    --max

    Well, I'm afraid I'm not going to be a lot of help. From what I see, if everything is installed correctly it should be working. I know that there has been a few challenges associated with Vista, but I don't know enough about that aspect to really comment. I'm still using Windows XP.
    As far as Camera Raw is concerned, there have been four updates since CS3 was released. If you haven't done any updates you are probably in for a pleasant surprise. New controls have been added that most people have found to be quite valuable. The most current version of Camera Raw is 4.3.1. The first thing I would suggest is for you to download that update and get it installed and see it that makes a difference.
    I know you indicated that you don't want to have to do a lot of fine tuning of the program. But Adobe Camera Raw (ACR) is updated frequently, and you always want to make sure you have the most current version. If the new version of ACR doesn't resolve your issues the problem "might" be related to Vista. And I'm afraid I cannot help you with that at all.

  • Downloading  pipe delimited text file on to desktop  with data in internal

    hi all,
    how  to download pipe delimited text file on to desktop  with data in internal
    table with an example plz.

    hi,
    u can use the FM GUI_DOWNLOAD.
    here is the sample code.
    *Internal table to hold the employee details
    DATA: it_details TYPE STANDARD TABLE OF x_details,
          wa_details TYPE x_details.
    *Internal table for file
    DATA: BEGIN OF  it_details_txt OCCURS 0,
            line(700),
          END OF  it_details_txt.
    *Employee details for the file
      CLEAR wa_details.
      LOOP AT it_details INTO wa_details.
        CLEAR it_details_txt.
        CONCATENATE
            wa_details-var1
            wa_details-var2
            wa_details-var3
            wa_details-var4
          INTO it_details_txt-line SEPARATED BY '|'.
        APPEND it_details_txt.
        CLEAR wa_details.
      ENDLOOP.
    *Download file in .TXT format to local desktop
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                = 'data.txt'
          filetype                = 'ASC'
        TABLES
          data_tab                = it_details_txt
        EXCEPTIONS
          file_open_error         = 1
          file_write_error        = 2
          invalid_filesize        = 3
          invalid_type            = 4
          no_batch                = 5
          unknown_error           = 6
          invalid_table_width     = 7
          gui_refuse_filetransfer = 8
          customer_error          = 9
          no_authority            = 10
          OTHERS                  = 11.
      IF sy-subrc = 0.
        MESSAGE 'Data downloaded successfully' TYPE 'S'.
      ENDIF.

Maybe you are looking for

  • Not Working: BlackBerry Link Remote File Access Remove Old BlackBerry from BB ID

    I have: removed my blackberry q10 from blackberry link, wiped my q10, uninstalled and reinstalled blackberry link, have link version 1.1.1.32, blackberry q10 os version 10.1.0.2309 - which whenever I plug in the q10 after removing the device from lin

  • Identify UTF-8 and UTF-16 formats

    hi, Clients submit there unicode messages (arabic,telugu etc langs) in hex format then our application accepts that message and process it. But there are many tools in the market which will convert the unicode to UTF-8 and UTF-16 formats. so i need t

  • C# and JNI

    Are there any plans for JNI support of C#?

  • How to check network providor

    OK, I recently bough a second hand iPhone off ebay which was locked, i was fine with that knowing I could just buy a SIM from the carrier. But I can't seem to find what carrier this iPhone is using. Is there a way to find out which network, from the

  • BUG:  Expression Language not supported (JDeveloper 10.1.3.0.4(SU1))

    Hi! I have the following code in a jspx page: <c:if test="${!empty bean.genericErrorMessages}"> <h:outputText styleClass="texto_red" value="#{bean.genericErrorMessages}" id="applicationErrorMessages" escape="false"/> </c:if> All code compile well, bu