Options for Importing a Database & Displaying a Daily Tip - iphone

I am new to iOS programming and looking for advise for an iPhone app that I am creating.
I have an excel database of about 100 daily tips (which will continue to grow) that I want to import into the app, and have one tip display each day. The user will have access to the current daily tip, plus any prior tips from prior days in the database.
I would like to keep it as a closed app, so if a user feels they want to skip ahead to see new tips by changing their current date - I am not worried about the few who might do that.
From my searches so far, CoreData seems to be the way to go but I was looking for suggestions.
Any help is greatly appreciated.

I'll try to give you some advice to achieve what you want.
First of all, what do you mean with
I would like to keep it as a closed app, so if a user feels they want
to skip ahead to see new tips by changing their current date - I am
not worried about the few who might do that.
I'm not sure about its meaning.
Said this, based on my experience (someone else could give you other advice) I suggest you the following.
About your model you need to create an entity, say Tip, that could have the following attributes:
guid: an identifier that works as an identifier, the type could be a NSString
creation date: the creation date for your tip, the type is a NSDate
text to present: the text to present to the user, the type is a NSString
In addition you can also set a title, etc.
The date has two objectives.
First, it allows you to filter tips based on the current date. To filter you need to create a NSFetchRequest and set a NSPredicate. For example:
[NSPredicate perdicateWithFormat:#"creationDate <= %#", currentDate];
In addition it allows to sync with your service to download data. Based on the max date you find in the core data sql lite file, you could ask a service (if you use one) to give you the tips that are greater than that date.
The guid allows to have only one tip for that identifier (you could just use the date for that but I think is easier to have a guid, say 12345). This could be useful if you decide to download each time the whole data and you don't want to insert the same tips. In addition, you don't want to ricreate the db when you have new tips, but you would add only the new ones. So, you need an identifier that let you to verify if a tip is already there.
Finally, about your service (if you want to set up one) you could download data in JSON format. I think it's simply to set up.
If you are interested, here some links that could make your life easier:
Take a look at importing-and-displaying-large-data-sets-in-core-data in the case the data amount of downloaded data is huge. With iOS 5 new APIs are there, but the concepts you find in the post still remain valid.
A simple intro on Core Data (a question I answered in a previous post)
core-data-on-ios-5-tutorial-getting-started
If you want to know something else, let me know.
Hope it helps.

Related

how to quickly locate which sheets/dashboards contain a field?

I am creating a data dictionary and I am supposed to track the location of any used field in a workbook. For example (superstore sample data), I need to specify which sheets/dashboards have the [sub-category] field.
My dataset has hundreds of measures/dimensions/calc fields, so it's incredibly time exhaustive to click into every single sheet/dashboard just to see if a field exists in there, so is there a quicker way to do this?
One robust, but not free, approach is to use Tableau's Data Catalog which is part of the Tableau Server Data Management Add-On
Another option is to build your own cross reference - You could start with Chris Gerrard's ruby libraries described in the article http://tableaufriction.blogspot.com/2018/09/documenting-dashboards-and-their.html

MS Word - using a date variable without macros

I want to create a Word template which will:
a) prompt user for a date
b) display that date
c) calculate other dates from that date.
I'm using MS Word 2016.
I've never done anything like this in Word but after doing a bit of research I see that there are advanced options in Word which maybe I could use for that. I don't want to use macros for this as I'm thinking that if I can make this work, then I would share this template with the rest of the company and I don't want them to enable macros (we have enough security concerns without that).
I've tried to use a FILLIN field to prompt user for a date. This works, however, I would like this field to be a variable which I can reference later in the document. I haven't found a way to do that with my FILLIN field. Is it possible?
I've seen others mention DocProperties but I'm having a hard time making it work.
For example, if I go to Quick Parts -> Document Property, none of the options are for a custom date. Is there a way to add your own?
And if I go to Quick Parts -> Fields, I see Date, CreateDate, SaveDate which insert "today's date" - not what I want. Again, how do I add my own Field?
I could do this in many ways by using Excel but I wanted to see if I can make it happen with Word. I hope you guys will have an idea.

How do I know all the objects in my entity framework model programatically

I am trying to find out if there is a way we can iterate over all the objects in my entity framework model? I tried looking through intellisense and msdn and stackoverflow but couldn't properly identify anything that matched my query.
Something like the following ...
foreach(var item in entities.Context.getAllObjects())
{
Console.Write(item.Name);
}
The point of this is that I want to be able to write some reports over database objects for our developers and devops teams to better understand what's happening in our production servers. I've already got the data into the tables in a separate database that I want to report on. But instead of writing the specific reports that we may or may not want to see. I'd like to be able to provide some sort of interface that might list the possible report tables. Then have some options that might be group by date, dayOfWeek or Hour from this date to this date.
I don't want there to have to be application changes in order to add new reports. This is my first hurdle in writing this app ... I'm sure there'll be others. Because the application is for our development team I'm not going to worry about someone trying to query the data in a way that doesn't make sense ... and I also want there to be an absolute minimum barrier to entry as we can't write a report for everything that we want to track.
Thanks
You need something like this:
var typesInYourContext = context.GetType()
.GetProperties()
.Where(p => p.PropertyType.IsGenericType && typeof(DbSet<>).IsAssignableFrom(p.PropertyType.GetGenericTypeDefinition())
.Select(p=>p.PropertyType.GetGenericArguments()[0]);
(I havent compiled it and its off the top of my head but it should give you the general idea)
Note: EF may actually pull in more types than those listed in your context, but this will only get the ones you explicitly list in the DbContext.

Connecting nodes to multiple dates

I have company website, with many offices around the world (around 50 offices).
The company want to create a gift giveaway with the employees in a specific company each specific day.
For example:
Office 1: will do the giveaway the days: 1/1/2010, 7/1/2010, 15/1/2010, etc...
Office 2: the days: 2/1/2010, 9/1/2010, 19/1/2010, etc...
Office 3: ....
Office 50: ...
(the days are setup manually to specific offices, no need of an algorithm here)
I have a node per Office, it's a CCK content type with details of each office (location, phone, email, etc), now I need to assign those days to the offices.
But my problem here is that I don't need to create events (or at least node events) because I don't need to store any data in the event. Just need to say: Office 1? Yes, days 1/1/2010, 7/1/2010, etc...
Nothing else, just to know the dates.
And, if possible, make them available to display in the calendar module.
What is your suggestion?
Withs CCK and date module you can create date fields, but if you have many fields you want to add, this might not be the best solution.
You have two general ways of solving this issue. Either you need store each date. This could be done with date field, not sure if it can handle multiple values, node reference or similar. This is inefective it some ways, but will make it easy to generate calendar view.
You could also write a string with as the date info and let php convert it to dates. This route will make it easier to create and store the data, but will make it a lot harder to get things integrated with calendar.
The fatest / easiest solution would probably be node reference with a date module, combined with a script to create all the nodes need. Instead of making them inside Drupal.
You could also create a custom module that stores this info for you. It would be a more longterm solution and require more work to integrate it with views and date/calendar modules.
There are many ways to go about this, but it really depends on your need, skill and time
Why not use a plain old CCK text field with a good clear description of what it's for and how to format it with something in the help section to back it up?
Use a text area (multiple rows) and apply the default input format that converts lines line breaks. I like to use the mark down filter too.
You could also use multiple single line fields in place of a text area...
This assumes your users are smart enough to enter the correct info of course but that's what the help and description are for. If your users can't be trusted to enter the content in correctly then yes, go for something that forces them to do so.
Ok I've found the solution myself and I want to share it with you:
Created three content types:
Office: with data of the office
Days: with a node per day (365 * year)
and Giveaway: with two node-reference fields, one for Office and another for Day.
(Days must be populated manually using a script that fills the upcoming 2 years or so).
So I can fill only Giveaway content type, and that's enough.
And then only the views are remaining.

UITableView: Dynamically determining number of sections

I have a medical app for the iPhone that I'm working on, where a user creates timestamped entries for a series of tests performed, which are stored in sqlite for retrieval and subsequent drilldown. In my model class, I have a property uses an NSArray that is populated with these entries, which gets updated as new additions are made in the app.
One thing I'd like to do is display UI behavior similiar to what the Calendar list view does - for any given day, display a section header, that show the name of the day and the date, ans display the entries made for that day.
From a brute force standpoint, I can see how you could precalculate this - as build your list of entries, you could store the entire list in a dictionary, keyed by date.
This seems pretty inelegant though, so I'm wondering if there are other more efficient ways to accomplish this task.
If Core Data WERE available on the iPhone, you could store your information that way instead of sqlite.
Then, when you wanted data for particular day you could search using NSPredicate with a sort descriptor.
Core Data will then return the relevant data sorted according to your descriptor. Nice and neat.
Maybe visit the Apple Dev Center/Forums for some more info on upcoming software...