Should I store emails in my database? [closed] - ruby-on-rails

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
In theory, I'm looking to integrate email into a CRM I'm building. I'd like for each contact with an email address to have those sent and received emails fetched when viewing that contact with a connected IMAP account.
Would one store these emails in the database or would it be faster/more efficient to fetch these emails on the fly? (when the contact page is accessed via a GET request).

Would one store these emails in the database or would it be faster/more efficient to fetch these emails on the fly?
Have you measured the performance to find out? Don't prematurely optimize, actually identify bottlenecks. Set up some tests (large-scale, repeatable... don't just test one email one time) to retrieve emails from the CRM system vs. retrieving them from the database. See if there's a significant difference. Include that information in your decision-making process.
Additionally, there are other things to consider when making this decision. Namely:
Will these emails be modified in the scope of a transaction? Databases are good at participating in a transaction scope for a unit of work in your code, third-party services and APIs not so much. You might want to put them in the database if they're needed as part of such a scope. (Though given the description, that's unlikely.)
Duplicating data between multiple systems (multiple "sources of truth") and keeping it synchronized is hard. It introduces a lot of unexpected complexity into a system. You may see a performance gain, but is it worth it? Maybe some application-level caching will yield just as much of a gain without duplicating the data and introducing another dependency into the mix?

Related

IOS Backend for User Data [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 months ago.
Improve this question
I am brand new to ios development and am looking for some advice on the best way to structure my user data and access it throughout my app.
Data is retrieved via HTTPS requests that query a database for the desired information. There are separate calls for the different tables containing information of interest. The returned data is formatted as nested dictionaries where the outermost key is the column and the subsequent dictionary is key-value pairs of the index and the table value. Example:
{"column1":{"0":"value1-1", "1":"value1-2", "2":"value1-3"},"column2":{"0":"value2-1", "1":"value2-2", "2":"value2-3"}...}
My primary requirement is that I will need to be able to filter this data by the innermost values (some will be dates, some will be numbers, etc). I would like to have the data in a format that will make this simple to do and will not cause delays as there is no limit on the number of possible rows.
I have looked into reconstructing a user-specific SQLite database with the information and querying that throughout the app as necessary. I have also explored dataframes as this app was originally developed in python - don't ask - and relied on pandas dataframes.
I know this decision will impact me heavily and am trying to do my best to make an informed decision. I appreciate any feedback and am happy to give more useful context that might be missing.
TIA
You can use SQLite database for persistent storage. This is ideal for your main requirement of filtering the data. You should also create a structure or a class modelled on your data to store and use during runtime. You can refer this for deciding between a class or structure.

How to model common information for Rails application [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm a bit new in rails development I'm modeling a website with few resources and so far so good. But here is my question:
I would like to allow the admin users to manage information show in most of the pages: Application name, telephone number, address, default email and this kind of things.
My current idea is make a model Property with name and value, but somehow I'm not convinced about this approach because I'll need to access the database to get this values for every request.
Thanks everyone for your time! :D
This seems like an OK approach. If you implement caching, it no longer will hit the db with every request, and honestly it probably isn't really that big of a deal even without the caching. Build it the way you need, and optimize afterward, if necessary.
With all this being said, it may be worth considering how much things like the phone number are going to change, and balance the cost of developing a dynamic solution against the time it would take to change once, 3 years from now (if the number ever does change), in a partial.

How to store data on the internet for an iOS App [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
So I know this is a pretty simple question, but I've looked through all of my iOS textbook and can't seem to find out how people do this. I just want to store and edit an array on the internet. That is, let's say all of the data for my application is stored in an NSMutableArray. Ignoring the complications that occur with people editing the array at the same time, how would I allow multiple people to go into my app and then through that app access and edit the NSMutableArray for others to see?
There are a ton of options here, some of which were listed by #Zaph. The most common scenario to share data between a ton of random users is to setup your own server to run an API that you app will be able to communicate with. This is commonly referred to as the "Backend". The solutions here are vast, written in many different languages and sometimes even provided by third parties services. My advice is to pickup a simple, easy to learn server-side setup like Ruby-on-Rails, then deploy test app on Heroku as they provide free accounts to play with.
In addition to the options #coneybeare provided some others include DropBox, Parse and Azure.
Dropbox requires each user so setup an account.
Parse and Azure have rather easy APIs but you will be paying past the free tier.

I have heard that we can validate incoming data from a source using stored procedures. can so one explain this in a broader way? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
How to validate incoming data using stored procedures in real time? can some one explain this ?
You can, but I think this is a bad idea. Business logic does not belong in a database. It belongs in service code (middle tier of an application). The role of a database is to retrieve and save data, not validate it. At least not in the sense of applying business rules.
Now, you can do 'validation' in the database in the sense of check constraints and foreign key validation, but this would not be done in stored procedures. This is native support built into most modern database systems.
So, in my opinion, forget about doing data validation in a stored procedure. As I said, validation doesn't belong there, and, it's going to be much slower than putting that logic in a middle tier using C++, C# etc.

Requests (as simple as Grap API /me) too often result in exception, what is the best practice to deal with this? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
We've built an app using Facebook PHP SDK. Quite often (too often to count it negligible) requests result in exception (obviously timeout). What is the best way to deal with this? Are there any options we could tweak to decrease the frequency at least?
I'm searching information about this topic too.
A couple of things to keep in mind:
1) your server, if your hosting plan is cheap (let's face it), it will probably fail with a considerable amount of requests.
2) Optimize your api calls and if it's possible, change it for FQL queries. This happened to me yesterday, my app needed to extract the name (via php sdk api call) of four friends selected by the user. For each friend I was asking facebook for the complete profile [$this->api('ID')].
You might think "well, at the end the profile is just 4 or 5 data fields". I really don't know the impact of this query, but I was getting a lot of timeouts. Then I changed the query for a FQL query (using the SDK, but only selecting the name field). The timeouts are gone.
As I said, I'm still looking for information about optimizing api calls, but I hope you can start with this.
Regards.

Resources