A friend and I would like to create a website to manipulate Facebook data.
The structure is:
a PHP web role (contains the web page, user OAuth login, interacts with queues, and interacts with SQL Azure database)
an F# worker role (does statistics and quite heavy data extractions)
The process is (assuming a new user):
user arrives on the web page and logs onto Facebook via OAuth, the PHP web role then posts a message in a worktodo queue with the login info and token.
F# worker role reads the message off the worktodo queue and starts doing data crunching (using the Facebook API) and stats, then it writes the results to a SQL Azure database. Finally it posts a message to the workdone queue stating it has succeeded in doing the data processing for the user.
Finally the PHP web role reads the workdone queue and notices the work is done, and displays the algorithm results.
I have two questions:
Is there a big flaw in this design?
What is the best way to collaborate: one person will write the PHP and another the F#, is there a way to use development storage from two different machines?
Thanks a lot! (Apologies if some find this stuff too basic, I am very much a beginner in all these matters).
If you wanted to follow a bit more experimental path, you could also try looking at Phalanger. This is a project that compiles PHP code to .NET, so it may be possible to run it directly on Azure and nicely collaborate with F# (Phalanger has a few language extensions that allow you to call any .NET objects and some API for calling Phalanger objects from C#).
I was involved in the project some time ago, but it is now beign developed by other people (and as you can see from the check-ins, it is quite active again and they would surely be interested in collaborating to resolve possible Azure issues). If you were interested, let me know - I can give you some contacts, so that you can discuss the Phalanger status on Azure with them.
I don't see anything wrong with this plan.
I don't think there's a way to have two machines pointing at the same development storage, but you can just use cloud storage (even when running locally). I do that all of the time; you will pay for bandwidth and storage transactions, but for most apps in testing, this cost is trivial.
Related
I want to create following project :
Server application hosted on Azure - it connects to databse via Entity framework and gives and API for anyone who want to connect (but with account stored in SQL database)
WPF application - it consumes server methods, objects etc.
Web app (php & javascript) - also consumes server methods and object etc.
IMPORTANT : I have only azure student's subscription and I want to hold onto it - buying anything else is out of the question unless it has strong argumentation.
I figured that to do this I have to create REST Web API because I have no other choice to connect to server than via HTTPWebRequest (because I want to have the same API for WPF nad web app).
My question is : does better solution exists?
I think I can create different API's for desktop client than web app but I have no idea how to do that. Whould you be so kindly to show me other way?
Why dont I want to have this solution?
Reason is simple. For big databases and slow internet connection it would take ages to download whole data in few seconds. As far as my knowledge goes there is no lazy loading in REST thus my WPF application's thread reponsible for downloading database would freeze for a big period of time.
If my question is too broad please leave a comment before you put up a flag.
Also, any tips regarding my project design are well appreciated.
Different APIs for Desktop and Web: this can be done easily enough. Assume you have a class library to contain your business logic (domain stuff). Create a web api project that makes use of it, then create yet another web api project separately that also makes use of the core models. When you deploy, deploy each separately to a different domain/subdomain (I'm unsure if you'll require further Azure resources for this, but consider api.desktop.myapp.com and api.web.myapp.com... no real technical reason why you can't do it that way, though for architecture reasons I'd avoid it (it's really coming close to if not definitely is duplication of code).
Same API for Desktop and Web: you stated that you thought you'd have to do this differently for the desktop and web, specifically because of the resource usage on the server. I disagree here, and think you should implement some standardized rate limiting into your API. Typically this is done by allowing only X amount of resources to be returned in a single call. If the initial request asks for more than X limit, an offset/nextID is returned by the API, and the client submits a new request noting that offset/nextID. This means you have subsequent calls from the client to get everything it needs, but gives your server a chance to handle it in smaller chunks (e.g., check for rate limits, throttling, load balancing, etc). See the leaky bucket algorithm for an implementation that I prefer, myself: https://en.wikipedia.org/wiki/Leaky_bucket)
I'm currently developing an iOS app and have reached the point where I need to implement a server back-end in order to support the core functionality.The app is built in a way to store certain questions locally (Within the app) and pose the questions to the app user. I need to tweak it such that it retrieves the question from a remote server. Furthermore, the question will reside in a specific folder within the remote DB. So the app will have to fetch the questions from the appropriate folder based on user login.
I have zero server experience and am need of some advise as to where I should begin with this. I would like to know if there is a template spec for this kind of task. With a template spec, I can hire a programmer and talk intelligently. Please help!
Here is a number of solutions:
1) You can use other services that provide backend functionality with REST API (as #Niklas Hein mentioned), it calls BAAS - backend as a service, such as Parse (but Parse is closing his service in one year), BaasBox, etc.
2) You can use CloudKit. This is service created by Apple, where you can store app data in the cloud, with authorization, requests, admin panel, etc.
3) Create you own back end. Here is a large number of languages and web frameworks, so php is not the only one solution. Ruby on Rails, Python Django, NodeJS, and many others on your choice.
There are plenty of BAAS (Backend as a service) provider, like Parse or Firebase. You might want to have a look into them. (Although Parse is going to shut down.)
Another simple way is to look into PHP Laravel.
Laravel is a great Framework which makes it really easy to set up a backend.
Have a look at Laracast
Currently building a hybrid app. using Ionic Framework with PHP for backend services
I am having a case where a user has got his profile in Web app and Mobile App as well.
If the user adds two stories as favourites (Its kind of a reading app) from his mobile app or Web app,how do I sync that?
Here are the scenarios:
1) User marks the stories favourites from web app and when I come online through mobile app, display it.
2) User marks the stories favourites from mobile app when he is offline(Now this will be stored in LocalDB). So again when he comes online sync with the server?
I know there are services like Firebase which provides syncing service.
But What If I would want to develop a Custom Syncing service on my own for my application? Is that an extremely complicated process?
If yes and it can be developed ,then how should I proceed ? A basic idea? What are the best practices that I should consider?
Any links would be appreciated?
I know some of the comments recommended CouchDB in combination with PouchDB. That is a much better solution than trying to implement your own synchronization service with MySQL.
However, since you're using Ionic Framework you can also use Couchbase. Take the following example application:
https://github.com/couchbaselabs/TodoLite-Ionic
If you chose this solution you would have three moving parts. You would be replacing MySQL with Couchbase Server and running the Couchbase Sync Gateway to orchestrate any data between the device and the server. You can still keep your PHP backend if you have a web version of your application as there is a PHP SDK for Couchbase.
Two write-ups on this can be found here:
http://blog.couchbase.com/using-couchbase-in-your-ionic-framework-application-part-1
http://blog.couchbase.com/using-couchbase-in-your-ionic-framework-application-part-2
In the long term, you're going to find NoSQL much more pleasant to work with when it comes to APIs and mobile than MySQL.
Can be useful to write a POST method on the backend that receives the data from your local from the app and some user data (session, access tokens and other thing you considered neceasary). On the body for the request you include the data needed to be synced. The backend takes the body. Parse it and rreturn a result (http code) Based on that you can decide if the app should delete the local data or only mark it as synced on the local database
We have built an electronic ticketing system using plain PHP and MySQL. After learning this system needs to be accessed on portable Android devices we hired an app developer to build us a simple app.
What is interesting is the app (from screenshots) functions almost identical to the web system we created. The app developer said after it's completed it will not rely on our system but communicate directly with the database. In the future if we update our PHP system he said we can update the app.
I'm just now learning how to develop Android apps. From what the app developer is saying it appears he's simply translating (compiling?) our code into an app. Is this possible? I'm aware there's a new method in building Android apps with PHP, but I seriously doubt he's doing that. Am I missing something, or did we just waste funds when we could have done something ourselves?
It isn't possible to run a PHP application on an Android device, no. However it could be running a lightweight browser inside an app, which accesses your website. Try making a small modification to your live site and then access the site again from your mobile device, to see if it changes.
The app developer said after it's completed it will not rely on our system but communicate directly with the database.
You don't want to communicate directly with the database - that sounds like it would require MySQL to be left open to the internet. That's not ideal from a security perspective (I don't know if Android has the drivers for it anyway). Instead, you should run an AJAX web front end and send commands (but not SQL commands) to the database that way, cleaning/untainting the input data thoroughly. Indeed, maybe that is what he is referring to?
or did we just waste funds when we could have done something ourselves?
It's difficult to answer that. If you discover something useful as a result of employing him, perhaps it was worthwhile? Of course, this illustrates that it is important to know the technical environment thoroughly when hiring someone, and perhaps when you hire someone in the future you'll discuss their technical solution prior to implementation. If you decide to pull out at that stage, pay them for the R&D and the technical spec, and do it yourself.
In any case, why wonder about it? As part of completing this item of work, ask for technical details of his implementation on both the mobile and server side. And of course don't forget to ask for the source code - hopefully it was written into the contract that you own this intellectual property.
I have a Windows Azure subscription.
My requirement is to run a PHP script on my server. This PHP script will create a JSON file.
This JSON file will be downloaded by my iOS app. (Some kind of authentication is an added bonus)
How would I go about doing this? Should I create a "Mobile Service" or should I create a "Website" or something else like "Cloud Services"?
As far as I have researched, I think the only way to do this would be the old school website way. Any input on this will be really helpful. Thanks.
Mobile services are great if you want to create a quick CRUD layer for an app with a backend cloud storage such as Azure SQL DB. It also provides support for scheduled tasks and push notification. But for what you're after (producing a JSON file), you may find it easier to go with Azure Web Sites or Azure Cloud Services (PaaS). Azure Web Sites has a model that you'll likely find easier and with the free/shared tiers, provides a lower cost point for many models. If you want something that gives you a bit more control, then Cloud Services might be a good alternative as well. But given the simple example you've provided, you should be able to accomplish this fairly quickly using Web Sites.