I'm not really a server-side person – I generally do iPhone apps, though I've hacked together a few Wordpress sites.
I'm curious as to what web technologies people would use for the back-end of an iPhone app whose front end presents as a basic forum. In other words, people can create new threads, and respond to them - with plain text only.
The forum would not exist as a website.. the only way to access it would be on the phone.
What technology would people recommend I use? Ruby-on-Rails with Amazon S3 storage? Could I even use existing forum software and pass and receive data to and from it? Perhaps even a forum Wordpress plug-in? Or is there a better way?
If you wanted to, you could use existing forum software and/or Wordpress to facilitate what you want, which would be easier than building your own forum from scratch. You could, with that existing framework, set up your own little API to communicate from the iPhone app to the server- for example, send a $_GET request to a PHP script on your server, which would return a list of forum topics. You could have similar PHP scripts that could do similiar functions, like adding a post or deleting topics.
That's pretty much how I've got it set up on an iPhone app I recently made- my server has a basic forum system, and I just wrote a couple of PHP scripts to return information from a MySQL server. However, if you'd particularly prefer to use Wordpress/Amazon S3/whatever else, then I could give more specific instructions relating to those services.
*EDIT*
Here's an example PHP script you could use (after you've created databases):
forumcategories.php
<?php
// insert database connecting logic here
$query = mysql_query("SELECT * from categories");
echo "<categories">;
while($row=mysql_fetch_array($query)){
echo "<category><id>" . $row['id'] . "</id><title>" . $row['title']; . "</title></category>;"
}
echo "</categories>";
?>
This is a really simple script- of course, you would need to add in code to connect to the database (which can be found easily online) and probably some error checking, but other than that, it will do the trick. What you would do in the iPhone app is send a request to http://yourserver/forumcategories.php and it would return XML listing all of the categories, which can easily be parsed with NSXMLParser and placed into a UITableView, for example.
Google App Engine is very good for what you describe. There are a lot of advantages to this approach: choice between Java and Python, access to the Google Accounts API, persistence/datastore APIs,... and you don't have to setup much to start working.
I also recommend that your server app returns responses formatted according to Apple's XML Property List format, instead of any other XML or JSON format. You can avoid NSXMLParser (or any other parser) altogether and save time to use on other important stuff.
Related
I am new to coding and I am very confused in terms of what Firebase can do for me. I don't know how it will integrate with my web application.
My web application is going to be a ecommerce website and it will use the Algolia/Swiftype API, Stripe API and Google Maps. The website will also have 2 types of user accounts.
Just a couple of questions:
1) If I use Firebase, do I still need to use MySQL?
2) Do I need to design the Firebase database?
3) Will using Firebase speed up development time?
4) If I use Firebase, do I still need to use AWS or Rackspace?
Thanks.
No you don't need MySQL if you are using Firebase. But, there are good reasons to use one or the other, or both together. They are very different in how they work and you need to evaluate them independently for your use cases.
Not necessarily, because Firebase is "schema-less", meaning it is based entirely on the JSON data you put into it. In essence, it's a massive JSON object you put data into. (But, I'm not saying you don't need a little planning to make things work right, I'm merely saying you don't need to plan all your data types, columns, etc.)
Maybe, maybe not. It depends on how familiar you are with JSON, working with schema-less data, and working with restful services. I would argue that it all depends on what you're trying to accomplish, and how complex your system is, as to whether it will speed things up or not.
No (but maybe yes). Are you building a Node application? If you're building in Node then you can do everything through Firebase (they can host it for you). If you are delivering the first byte in something else (like PHP), then you would need a different host like AWS or Rackspace. But, you'd always have Firebase hosting your data.
Hope those answers help! Please comment under this answer if you need any clarification.
I am some what a beginner in iOS development, and am beginning to move from the front-end dev to the back-end. I know using JSON with php and MySQL is probably the most common to use for loading table views from databases, but I am wondering if anyone has some insight in where and how to start this process for building a database to load image based user-generated content to TableViews (much like instagram).
I know this is not a programming specific question, just trying to get some direction on where to pin-point my efforts. Appreciate any and all input.
Okay so learning how to build a database(MySQL) . I found some links that can help you.
http://www.wikihow.com/Create-a-Database-in-MySQL
http://dev.mysql.com/doc/refman/5.1/en/database-use.html
It isn't advisable to store images in tables because you'll encounter problems when it comes to backing up. Save images in a folder on the server and store their references in the tables.
To Access this images from your app. You'll need to make a post request to your database through an API written in PHP. You can find a good tutorial on how to write a simple PHP API script on google.
I don't have enough reputation so I wasn't allowed to post more than 2 links. So my answer continues
From your app you hit your API with the necessary parameters you set when writing the PHP script with a POST request. You API should return you the url of the image you seek and you should be able to download the image in your app.
This is a tutorial on how to make a simple NSURL Connection
http://codewithchris.com/tutorial-how-to-use-ios-nsurlconnection-by-example/
Below is another link that might be of good help. Its a simple tutorial that builds a messaging app that hits an API and gets messages from a database. There is a lot of learn from there to fulfill your need.
http://www.ibm.com/developerworks/library/x-ioschat/
As an alternative to the traditional ways I find Parse very useful. Parse can manage your whole backend and they have a very powerful free basic plan.
If you focus on images dive here in, to decide wether Parse fits for you or not: https://parse.com/tutorials/saving-images
I have a client who has a feed of leads which have Name, IP, Address, OptIn Time/Date, and I want them to be able to post the data to my hosted SQL database. If you are familiar with lead generation you will get what Im trying to do.
Id also like to know if its possible to write a script and place it on my server so that when someone posts a CSV file to it I can have the script automatically post the data in the CSV to the SQL server.
Is this possible? And are there any tutorials our reference manuals, sources, etc. I can use to accomplish this?
The answer to your question is Yes.
You can go about this two ways:
Write an API for your database which is consumed by those wishing to search/write/query your database. To do this, you can use any language that you are comfortable with. PHP, XML and Python are not interchangeable. XML is a format specification, it describes what the data should look like when its being transported between two systems. So you can use any programming language that provides XML libraries to write your code. In addition to XML, JSON has emerged as the more popular transport format especially for mobile and web applications.
The second option is to use a service like apigee, google cloud endpoints and mashery which will automate a lot of this process for you. Each requires its own amount of effort (with google cloud endpoints perhaps requiring the most effort). For example apigee will automatically create an API for you as long as you can provide it access to your data source.
I am new to the world of PHP and coding as those have helped me answer a number of questions I have posted know. I have the opportunity to jump into the deep end however seeing I have no clue about PHP and web services, I am seeking your help. I would appreciate it if you could point me in the right direction as I have not been able to find any examples nor detailed information regarding it.
Effectively there is a PHP page that needs to pass certain values to a .NET web service i.e. name, email, mobile number and upon the receipt of such information the web service sends out a text message. This is information I have so far
The Allocation service uses a basic HTTP binding and TransportWithMessageCredential security.
Sample C# code using a reference generated with Visual Studio tooling
Allocation.AllocationServiceV3Client Client = new Allocation.AllocationServiceV3Client();
Allocation.AllocateResult Result;
string VoucherCode;
DateTime ExpiryDate;
string DisplayMessageText;
Client.ClientCredentials.UserName.UserName = ? ;
Client.ClientCredentials.UserName.Password = ? ;
Result = Client.AllocateToConsumerMobileAndSendSMS(out VoucherCode,
out ExpiryDate,
out DisplayMessageText,
ClientID,
ClientReference,
CampaignID,
ActivityID,
MobileNumber);
if (Result != Allocation.AllocateResult.Success)
{
}
I have no clue about PHP and web services
First things first, pick your brain up out of the C# soup and sit it out to dry off for a few hours. PHP is a simple language for simple things. If you're new to it, you don't want to try and make it do complex things, and you certainly don't want to try writing C# style code in PHP.
Let's take "web services" as an example of a "complex" thing. In some circles, this means horribly designed monstrosities like SOAP. VS makes it relatively easy to build SOAP bindings to your existing classes, so it's not a painful solution for you.
SOAP is a very painful solution for PHP.
Effectively there is a PHP page that needs to pass certain values to a .NET web service
It sounds like you have an existing web service set up then, correct?
You could try and use the built in SOAP client, but it's an undebuggable and unconfigurable binary blob of horrors that will make you want to kill someone if it doesn't work for you immediately.
Edit: The section below was written incorrectly assuming that both sides were under your control. As this is not the case, you can disregard the rest of the answer. I'm leaving it up because it may be valuable to others.
I would advise a different approach. Set up an endpoint (URL) in your .NET application that expects the data you've specified as POST values, and have PHP POST the data. This has the distinct advantage of being incredibly simple. Because you're new to PHP, simple is a big win.
(In other words, ditch the "web service" -- or make a parallel copy if other things consume that service already.)
PHP comes with a service called PEAR, a repository of helpful classes. You can use HTTP_Request2 to quickly build the HTTP POST request. Chances are that it's already installed. If it isn't, it's easy to install either at the system level using the pear command, or locally in your project.
Here's some quick example code copied straight out of the reference guide:
$request = new HTTP_Request2('http://www.example.com/your/endpoint/url.foo');
$request->setMethod(HTTP_Request2::METHOD_POST)
->addPostParameter('name', '...')
->addPostParameter('email', '...')
->addPostParameter('mobile', '...');
$response = $request->send();
You can then read the response as needed.
Now, this isn't a perfect solution. Your C# code mentions a username and password, which I suppose could be included in the POST data. You could also use HTTP authentication (supported by HTTP_Request2) instead.
Ok, now from what I understand, C# will make a request to the php page, wich then (in simple html) gives it back some data.
PHP Is made to do some calculation serverside and when it's done it will send the prints and echo's to the client side as html (simple explanation)
If you want to start using php you would be best off getting into the basics by following the tutorials at W3School (http://w3schools.com/php/default.asp)
Then you can use http://php.net as a reference for more functions you might need.
The way you'll want to set it up is for C# to make a request to a page like action.php
And then using a $_GET method to get the data so C# would send a request to
action.php?userid='456'
I am defining out specs for a live activity feed on my website. I have the backend of the data model done but the open area is the actual code development where my development team is lost on the best way to make the feeds work. Is this purely done by writing custom code or do we need to use existing frameworks to make the feeds work in real time? Some suggestions thrown to me were to use reverse AJAX for this. Some one mentioned having the client poll the server every x seconds but i dont like this because it is unwanted server traffic if there are no updates. I was also mentioned a push engine like light streamer to push from server to browser.
So in the end: What is the way to go? Is it code related, purely pushing SQL quires, using frameworks, using platforms, etc.
My platform is written in PHP codeignitor and DB is MySQL.
The activity stream will have lots of activities. There are 42 components on the social networking I am developing, each component has approx 30ish unique activities that can be streamed.
Check out http://www.stream-hub.com/
I have been using superfeedr.com with Rails and I can tell you it works really well. Here are a few facts about it:
Pros
Julien, the lead developer is very helpful when you encounter a problem.
Immediate push of new feed entries which support PubSubHubHub.
JSon response which is perfect for parsing whoever you'd like.
Retrieve API in case the update callback fails and you need to retrieve the latest entries for a given feed.
Cons
Documentation is not up to the standards I would like, so you'll likely end up searching the web to find obscure implementation details.
You can't control how often superfeedr fetches each feed, they user a secret algorithm to determine that.
The web interface allows you to manage your feeds but becomes difficult to use when you subscribe to a loot of them
Subscription verification mechanism works synchronous so you need to make sure the object URL is ready for the superfeedr callback to hit it (they do provide an async option which does not seem to work well).
Overall I would recommend superfeedr as a good solution for what you need.