I will be making a website which will fetch some video data from database.
I am also making a mobile app using React-Native expo. I want the same data (videos) to be accessible from my React-Native mobile App.
My questions:
What is the best way (or best database) to store short videos for website + mobile App?
What is the API or the best method followed in industry to fetch the stored videos into a website?
What is the API or the best method followed in industry to fetch the SAME stored videos into a React-Native (or expo) mobile App?
Let me know if more clarification is needed.
Videos/Photos are usually stored in some file system. Amazon S3 is one option to store such data. You can then save the url to the image/video in your database.
Using that url you can show your video on a website, or mobile app.
For Expo:
https://docs.expo.io/versions/latest/sdk/video/
For web:
https://www.w3schools.com/html/html5_video.asp
I think you should do some research on MySQL and NoSQL both of these servers should run parallel to each other one for storing larger, shorter videos files and another one for storing user data and passing links on request.
Related
i'm working on a basic website using html/css/js and Firebase fire-store to store data along with authentication to authenticate users, my website consists of multiple HTML pages which most of utilise Firebase services, and i'm wondering what would be the best way to allow all the pages (and the scripts within them) to utilise the Firebase?
should i copy the Firebase SDK and configuration code snippet into each and every html page? i believe this wouldn't be a good practice and i doubt it would even work well..
how can i achieve what i want? is there a certain Firebase service that allows me to achieve it?
Firebase comes with a JavaScript SDK for Firestore, that you can use in your scenario.
The most common way to set up such a web app is as a single-page application, so that all HTML, JavaScript and CSS is loaded into a single page without ever reloading an entirely new page. This has the big advantage that you're only loading the Firebase SDKs once.
If you have multiple HTML pages, you will have to load Firebase into each page where you use it. But on all but the first page the SDK will likely be loaded from the user's browser cache, but it'll still be a lesser experience than with a single-page application.
For a good introduction of a single-page application, I recommend taking the Cloud Firestore for web developers codelab. As a more introductory tutorial to building single-page applications with Firebase and Firestore, I'd recommend Get to know Firebase for web and its companion video.
I am building a Bookmarking app using JavaScript and Electron http://electron.atom.io/ to make it a desktop offline app.
Generally I would be building it online as a web app with a PHP and MySQL backend. As a self hosted Electron desktop app I do not have the pleasure of a nice relational database that can handle massive loads of data!
Some info about my data that I need to somehow store on the users computer for the Electron app...
Assuming this was a typical MySQL database it would have these tables...
Bookmark Collection Lists
Bookmark Tags
Bookmarks
website URLs (each URL can have 1 record however a bookmark can have multiple records for the same page as long as they all reference the 1 url record.)
Bookmark Tags relation table to Bookmarks
Bookmarks relation table to website URLs
Potential issues due to size of data collection...
Bookmark Tags table could have anywhere from 1 record up to 5,000 records
Bookmarks and website URL records could easily pass the 10,000 record mark.
My mockup app so far is currently storing the tags and bookmarks in 2 JSON files. Based on the number of records I will have though I do not see the JSON file being a practical solution!
So my question is, what are some possibble solutions to store this amount of relational data for an offline JavaScript Electron desktop app?
My research so far has only resulted in a few JavaScript libraries that act like a database using things like IndexedDB but I am not sure if these will work with my large data set?
Also is there anything relational I can use as I have Bookmmarks which can have multiple Tag records and searching? All articles about using SQLite in Electron have resulted in failure as well as my own attempt at it.
UPDATE
I finally found a working version of SQLite in Electron using SQLJS https://github.com/kripken/sql.js and this test app shows it working E:\Software\ElectronWebApps\electron-sqljs-master
I'm using Localstorage to persist data in my Electron apps. I haven't tried it, but localStorageDB might be what you're looking for.
I need to get images from server side in a Phonegap App. This app uses a Json Web Service to get data from the a .NET application (Server). I need to get images via web services and store in some location of device (temporally). Im asking the first thing. Im thinking what the way to do that is taking via ws the urls of the images, but I need then a way to use the url of image to"download" or get it via url and save to some object or something in Javascript (I guess) for in the case that the device lose the internet connection, the app remains the images getted.
What do you think about this approach and do you know how I can do this way?
Thanks!
As per my understanding for your question you want to download the image... For this you can make use of Cordova file plugin.
Secondly you can keep the image inside your project as well.
I need to ask for some advice regarding offline web applications and database sync.
Offline Scenario
We have a web site (HTML5) that needs to operate in an offline mode for extended periods of time with complex data, the product owner does not want the data put into local storage.
We have two options as I see it;
Use javascript to detect if we are offlline and if so point the urls to a local web server that replicates the stack at the data center and writes to an offline db
◦Biggest stumbling block is how, on the first load if you are offline do you get the location (URL) of the local web server? i.e. user goes to www.xyz.com, but you are offline so
Question 1: how to redirect him to localhost.xyz.com via javascript for that first call
Point all calls at the client , offline or not to a wcf service that checks offline status at the NIC and redirects every web and service call to the correct place
◦seems like a big job,
Question 2: is there any product/ opensource project you guys know off that does this?
Sync Scenario
•They want to use MS sync framework
◦But they have many clients syncing to different database, so you either need 1 sync service per client or some way to identify who the client syncing is and point them to the correct place
◦Need to minimize locking during sync as other clients are using the same tables during sync
Question 3: can the sync framework be extended to even do this
Question 4: What other options exist for database sync on MS platform?
Thanks
If the user puts the URL into their browser, they are going to go that URL. There is no javascript at that point. You would only have Javascript once a page is loaded. You will have to search for a better solution.
Here is an idea: Users ALWAYS go to the local website, and if the remote site is up, then you redirect them.
In terms of MS sync I do not know what it is, so I cannot help you there.
Re What other options exist for database sync on MS platform: there is also SQL Azure Data Sync, a windows azure web service. It is actually built upon the Microsoft Sync Framework you refer to.
There is an example in the book "Programming Microsoft SQL Server 2012" by Leonard Lobel & Andrew Brust (MS Press) - chapter 13 covers building occasionally connected systems that incorporate SQL Azure Data Sync, Windows Azure and the Windows Phone 7 development platform. In the sample solution, on the back end, an on-premise SQL Server database is kept synchronized with a public facing SQL Azure database in the cloud using SQL Azure Data Sync. The cloud database is exposed using WCF Data Services (also hosted in the cloud by deploying to Windows Azure) and consumed via OData by a mobile client application running on a Windows Phone 7 device. The sample solution detailed in the chapter demonstrates how these technologies work to keep data in sync across on-premise SQL Server, SQL Azure databases in the cloud, and local storage on Windows Phone 7 devices.
Sync Framework do not lock tables when synching.
depending on what client database you want to use on the client, you can either use Sync Framework itself which works with MS databases (SQL CE, SQL Express,LocalDB,SQL Server, SQL Azure) or you can use the Sync Framework Toolkit
whichever platform you choose, i would suggest simply writing to the local store and synching it rather than dynamically choosing which store to use when.
for example, if you went offline and you wrote to the local store. then your network monitor detects you are back online and redirects you to the online service, what would you do with the data you stored locally? or you transacted online and you suddenly went offline, how recent/updated is the local store for you to actually starting working agaisnt it?
You could use Service-Workers to make the website work while users are offline. see: Making PWAs work offline with Service workers. This allows your website to work for the users if they are offline (they need to have internet at least once every 24 hours).
Service-Workers also allows you to detect when your user is offline or online, and you can for example use the IndexedDB to store your offline changes and then synchronize them when the user is online again.
I don't know about MS Sync.
I have to create a Windows Phone 7 app as part of a research project. The app needs to:
Allow the user to login by connecting to an sql server database (stored locally for the purpose of this project)
If login successful, return a list of products associated with the user (i.e. in product table where UserID=x)
User can click on an item in the list, and then add photos for that item. This can be done offline as well (using HTML5 offline storage)
When an internet connection is available again, user can click 'Upload' (or automatically synced, but not necessary) and the images are all uploaded to the Images table with the correct ProductID as Foreign key
Since this is the first time I am doing any mobile programming, I am not sure what is the best approach. I am especially unsure of how I am going to connect to the database. I'm not really interested in learning Silverlight, so the app should use mainly HTML5 and javascript, I also am looking into JQueryMobile.
I have already installed PhoneGap and am trying it out, but my main concern is how to connect the app to the database as I am having trouble finding the 'proper' way of doing this e.g. using some kind of web service or directly through javascript (read it can be done but is not recommended). If anyone could recommend or suggest a good approach of doing this that would be great!
SqlServer is only available on the phone via LinqToSql which you need to expose via a service or a DAL. I dont think that its possible to make calls directly from Javascript to LinqToSql on the phone.
If you're not set on the idea that the DB needs to be on the phone, you can just make service calls via ajax to a server and access the db that way. I recently did a blog post exposing a db via a WCF Data service and consuming it on the phone. It doesn't cover calling it via ajax but should help get you started.
http://www.ritzcovan.com/2012/02/building-a-simple-windows-phone-apppart-4/
If you want to store data within the WP7 database, use the PhoneGap storage APIs.