Create a News feed from a database as the source - mysql

I have a database that I would like to poll and post data from similar to a newsfeed. I have already generated the queries, mysql is the db, to provide the data that I require. What I am not certain about is how to use rails to access the DB and provide updates, based upon 3 minute intervals.
I have worked with tutorials and created the opposite effect, where a user enters a feed and it is posted, along with stored in a database. Being fairly new I am not certain how make the app talk to the db on regular intervals and post it to the site.
To sum it up it would be like this:
Web app polls DB --> Web App looks for specific criteria(like customer name and code) -->Data posted in news feed on web site. -->old news scrolls down the page

You may benefit from reading this question and answers:
How do I create a facebook style news feed in ruby on rails?

Related

How to architect an API first multi app platform?

I am trying to build an API first web app that has two parts:
Part A: The Project Management App. This would be built using php/mysql. One of the table in the mysql DB will be the users table where all users information will be stored viz username, password, email etc.
Part B: The online chat App. The users of the project management system will be able to chat among themselves. This will be built using nodejs/mongo. The mongodb DB would store the chat transcripts of each users and so would have a users collection containing the user details. The users collection would contain the same user information that the mysql users table has viz username, password, email etc.
Now, i have a couple of questions in terms of the architecture of this app.
Question 1: Is it at all a wise idea to maintain two different sources to store the user's information? The reason why I wanted to have a replica of the users table in the MongoDB as well is because since there will be too many reads and writes happening in the chat app so its best we use a nosql DB. (Lets assume here that my app will be used heavily going forward)
Question 2: If the answer to Question 1 is "Yes", how do we make sure of data consistency? I have thought of two approaches to achieve this:
Option A: Since we are using the API first approach, so during the registration of a user when the CREATE user api call is made, it will add the user in both mysql and mongodb databases.
Option B: I setup a cron that will sync the data between the mysql users table and the mongodb users collection periodically.
Can someone please throw some light on this and tell me if my approaches are right and that if I am going towards the right direction.
Many thanks

HTML(Offline) Query Data table and provide links

Hi I am about to start a new project of mine; create an offline HTML page that will provide a table that can be queried using keywords using multiple terms and based on the result will provide the user the ability use hyperlinks to receive further information.
I started a "database" using excel in the past which did not prove helpful.
So i was hoping to get some advice on where to create the database so that it can be queried through the HTML page.
Cheers
Manny

Suggestion About Creating a Web Database Application

I am new in web developers world. I have created a website (www.formsify.in) on Wordpress all by learning on internet. I know the basics of coding and programming languages, etc. and the interest so I learn quickly. Now my objective is to let users search and download documents (.pdf). The way I dl it now is by uploading the documents in Media and use buttons to navigate to the page which displays documents in a tabular form.
Now, this works if the documents are less in numbers. But I know the number of documents will increase and it will be very difficult for me to deal with uploading them one by one and creating tables all the time. So I thought to create
(1). Database of documents
(2). Uploading interface
(3). User interface
I want suggestions whether I am thinking in the right direction or can there be a better way to accomplish this. And if this is a right way to do
What database shall I use keeping in mind that I the documents to be stored online so the database should be online.
How should I go about creating the uploading interface keeping in mind that I am not a code-geek.
How shall I be going to design the user interface.
I know these are very wide and open questions. Also because stalwarts here will give me a non-commercial, non-biased view. I just need directions. I was able to create a decent website (as per my standards) when I didn't know much the only thing drove me to do that was that I was hellbent. I will be thankful for any suggestions.
Thanks,
.farhan
So, basically, you should have 2 tables:
User
Upload
User hold an ID and whatever information you want to have on the user and the upload table holds a unique ID, a user ID (of the uploader) and a path to the document
This way, you can select the uploads (add filters if needed) and you can construct the tables and views using the database results
The uploading is a simple html form that will send the file to a php script that will upload the file to a folder (rename it as well) and insert the new path in the dB.
The user interface just needs to hold a bit of html, with a form element and an action to a php script to handle the upload.
You can find the upload script on w3schools, just add the mysql insert to the database.

HTML: How to design profile page that is used for different users

I want to make a website for my Android social networking app and need some assistance with a basic concept regarding user profile pages. So right now I have a native Android app where users have their own profile page displaying their profile stats, e.g. followers etc. and I would like to do something similar in HTML. My question is how can I design a generic profile.html page that displays the current user's username/stats and that can be used for different users? For example, see how Facebook are using the same profile page for each user but they replace the name/bio/stats fields with the data for the current user, how is that done - at the server side (by replacing the appropriate fields with the data for the current user), or at the client side (by loading them with a separate script after the page has loaded)?
Also, I am using a Tomcat servlet to deal with the requests if anyone is interested.
Thanks for any assistance and sorry if the question is silly :)
You would have to use PHP. Think of webpages as a mathmatical equation where HTML is 3+4=12 but PHP is 3+X=12. HTML is already defined, you can't change it. Where PHP you can code the entire page but get the bio or username from a database.
But you should be warned that this is no simple task, you would have to create a large mySQL database, possibly more to handle logging in and out and use the PHP to define what you are calling for form the mySQL database.
It is possible, but not in a day.

Uploading large amounts of data via a csv into mysql Wordpress database?

I have a large data set in Excel that I want to import into my mysql database for Wordpress.
The current data in Wordpress is made up of two important parts - the users and the posts (with custom data). Each is registered on the site (via the front end) and has to fill in some custom data about their company - that then creates a post and puts all the custom data into the custom fields.
I've used the plugin Advanced Custom Fields to input the custom fields on a post.
How can I upload this list straight into the mysql database? It seems that the current data in Wordpress involves linking the user mysql table with the usermeta table and the posts with the post meta table... but all this seems to be in rows rather than columns, which would take a huge amount of work to reorder.
Isn't there an easier way?
If I have to do it in 3 stages then (1. the users. 2. the posts. 3. the post meta), then I'll have to do it that way. But surely there's a quicker more reliable solution!
There are a few plugins that can do this for you, such as these:
http://wordpress.org/extend/plugins/csv-importer/
http://wordpress.org/extend/plugins/wp-ultimate-csv-importer/
You'll need to set up a blank copy of WordPress, install the plugin, and go from there.