Erlang & Yaws installation - web

I want to apologize about my English. It's not very good.
So, I want to make a chat application (pretty much like Facebook's), and after reading a lot I decided to make this chat app with Erlang. After more reading I found out that I can use Yaws server to make a web application with Erlang, but that's all. I still can't even install and configure it well. So my questions are:
Is this information correct? Do I need Erlang / Yaws to create this chat app?
If it's correct, how do I install and configure it under Windows 7? I've tried to simply install "OTP 17.0 Windows 32-bit Binary File" from here http://www.erlang.org/download.html and "Yaws-1.98-windows-installer.exe" from http://yaws.hyber.org/download/, but I think something went wrong, because after I "configure it" at localhost port 8001/8080 or others still nothing happens. So what's next? Do I have to install my code in special directories and/or what do I have to do next ?
In case I finally get a Chat application in Erlang ready, how can It interface with my PHP code? I mean, I already have the PHP project. It is a normal web project with PHP/HTML/Javascript, etc. so my question is, how do I glue these two elements together?(I would like to stress one more time that I have to make something like the Facebook chat).
I'll be thankful for all kind of information, tutorials, books, videos, anything.

I agree with you, Erlang is an excellent option for a chat server. If you want to go for Yaws, check the documentation, it support external scripts via CGI and Websockets. All the information you need to communicate your PHP application with your chat Application is on chapter 9 of yaws' pdf documentation.
There are many ways to create a web application in Erlang. Here are some old examples that use mochiweb:
http://pragprog.com/screencasts/v-kserl/source_code
http://www.chrismoos.com/2009/09/28/building-an-erlang-chat-server-with-comet-part-1/
and a nice example from erlang central
Regarding the PHP integration,there are again, several ways to communicate both. You can integrate the chat with your PHP code using a PHP Erlang bridge
or using websockets
or probably you could try to send your data encoded in JSON from mochiweb using mochijson2.erl and communicate both by HTTP using curl from PHP.
All in all, I would probably also use yaws since is well documented and easy to use. Good luck

Related

Why all those new languages have their own web server?

I am kinda old school and the first programming language for web I saw was PHP, and everybody uses it with Apache. At that time, I also knew ASP, which were used along with Microsoft IIS and, later, ASP.NET, that runs over IIS, as well.
The time passed, I went to the ERP world and, when I came back (few months ago), I knew Golang and Node.js and for my surprise they have their own web servers.
I can see many advantages in the builtin web servers, but, every application needs to rewrite their web server rules (I faced that recently when I needed to setup a HTTPS server using Express.js).
After some hard work to understand all the nuances of the HTTP protocol, I asked myself: and if I am doing it in the wrong way? If all the permissive rules that I created in my dev server go to production? Maybe this is an useless concern. But maybe I am creating a fragile server that could be exploited by a naive hacker.
Using a server like Apache it is harder to misuse security rules, because there are settings for development and production environments that are explicit. If the rules are hardcoded (as they are in Node or Go), an unaware developer can use development rules in production and nobody is going to see it before the stuff happens.
Any thoughts?
web server focuses on the speed capacity and the caculating capacity. No matter how good java or php web is or how many old companies put them in use, as long as a new language can provides a faster speed and better capacity such as go, more programmer would go for it.
by the way, to run a web server in go is really such an easy thing.It's faster building and slightly running.And the routine in go helps the web server beter serves milions of client requests,Which old web language can hardly do it.
You can still use nginx or apache in front of your golang gateway for many reasons including tls termination.
But service to service communication might be nice to communicate directly to services and the golang http webserver is fast. It also supports http2 out of the box. Go leverages its "goroutines" to reduce overhead from the os to handle many requests at once.
Node.js and Golang do not have their web server, these are just some lib packages implement http-protocols and open some ports to provide services.
Like Spring web.
Nginx/IIS/Apache are true server, web server just a component of them.
I think Spring should meet the full application scenarios, include /gateway/security/route/package/runtime manage/ and so on.
But when we has some different language platform, then we need nginx/apache/spring gateway/zuul/or others to route them.

How to run and display the results from a program running on a server?

I have coded an algorithm that will give a numerical value.
I want any client browser to access this software running it in a server, execute it, and display the results on the web page - how do I do it?
- what special requirements for the software on the server?
- how to make sure that a client from www will go to the server where the program is running?
- there might be multiple clients accessing at the same time?
- different browers and OSs and possibly tablets?
I am a newbie and I am looking for tutorial, examples etc?
Thanks
Update:
What is the preferred language for the program, python, C or C++?
My responsibility is just giving the program details - the party who does the web will hook it. So my questions are will giving simple executable is sufficient not an API? How do I set it up on a server? How my partner knows how to access my server?
PHP is fun and easy:
echo exec("myscript.exe");
http://www.tuxradar.com/practicalphp/4/12/0
you can use WCF restful service if you are a .Net developer
http://www.codeproject.com/Articles/803409/REST-enabled-WCF-service

Connecting Node.js and openFrameworks

What is the best way to connecting Node.js code and openFrameworks(oF) code?
I though zmq would be nice, because it seemed easy to use (has many wrappers), and light and fast. ofxZmq, the zmq addon for openFrameworks, however, just didn't work well. It crashes when receiving messages.
I want something as easy to use as possible.
I have done a simple communication from an open frameworks client to a node.js server via OSC protocol. It is very popular in the OF world, and it can be read by a bunch of similar software and frameworks (processing.org, PureData, VVVV, Max/MSP, etc)
Here you have some different chooses for OSC implementation via UDP:
https://nodejsmodules.org/tags/osc
Check out ofxNodejs, it comes with a couple of examples to get you started.
In general, most "connecting X to openFrameworks" questions can be answered by checking out ofxAddons.com, which keeps a list of openFrameworks addons accessible by github (updated daily).

Can any Haskell web server run Python CGI apps?

I need a web server developed using Haskell to run an old Python CGI application.
Any suggestion is appreciated!
Kazu Yamamoto wrote Mighttpd, a web server built on top of Warp, which has support for running CGI scripts. It will probably do what you're looking for. He also wrote wai-app-file-cgi, which essentially provides the CGI-hosting behavior (as well as static files) as a library.
http://www.mew.org/~kazu/proj/mighttpd/en/
http://hackage.haskell.org/package/mighttpd2
http://hackage.haskell.org/package/wai-app-file-cgi
I'm pretty sure there's no such thing. I can name several web servers written in Haskell, and several frameworks to build web applications using Haskell, but I just checked the general purpose Haskell web servers for whether they host CGI, and none of them seem to so far.
CGI is a pretty simple protocol. It shouldn't be too hard to write a plugin for, say, Warp that supports it, but no one seems to have done so. A good number of Haskell web developers seem to be investing in a thing called WAI. But WAI sort of works in the reverse way to what you're asking it to do. WAI gives Haskell web applications a way to be hosted in almost any web server architecture, much like WSGI does for Python.
You'll notice that there are WAI back ends that enable an appropriately written application to be hosted by a CGI or FastCGI web server. But that allows Haskell to run on CGI, not CGI to run on Haskell.
Without knowing more about the reasons behind your scenario, I have trouble imagining what you're really looking to do. It's a little bit unusual, and I suspect that the unusualness is why there doesn't seem to be any existing solutions to your specific problem.
Perhaps if you tell us more about what you're after, we can suggest alternative approaches that will solve your problem?

Web programming language

I want to go learn web programming,but besides names and a little of html I don't know anything.So I ask you what programming languages you recommend,why,what can be done with it,tools to learn ,etc.I don't know if it matters but I program in a Linux enviroment(Ubuntu).
I don't want to do hardcore web programming ,I only want to be able to develop complete websites and understand network concepts.
Well, most cheap/free web hosts support PHP, MySQL, and most browsers support Javascript.
Target those and you'll be on a reasonably good path.
Some support Ruby and Python, and you might choose that path if you want to learn those languages.
Good luck!
-Adam
Definitely start with HTML, and basic CSS. These are the core of web programming, and you need to understand them well to do anything of consequence.
Once you've got those down, you'll want to move on to a server-side language. The easiest is PHP, but be careful of picking up bad habits, since it's a loose environment; if you stick with PHP, you'll eventually want to use it with an MVC framework such as CodeIgniter, which encourage separating presentation and logic. To get a little more advanced, you can also try Python or Ruby. Get yourself some server space to mess around with; most shared hosting plans are $5-10/month.
For Javascript/AJAX, you'll probably want to start by using Firebug or Firefox's DOM inspector to learn the relationship between the HTML of a page and the DOM object which Javascript uses to interact with it. Once you understand how the DOM works, toy around with jQuery to start doing useful (and fun!) stuff.
You'll also eventually want to learn MySQL (or a similar SQL variant), but that can probably wait, since you can do lots of interesting things without tackling database stuff.
Above all, be patient and persistent, and make use of every resource at your disposal: books, Google, Stack Overflow, and cheat sheets.
Ruby all the way. It's exactly what you need if you're interested in web dev and completely starting from scratch programming-wise. From the basics of Ruby it's pretty easy to get into Rails, which is a very beginner-friendly web framework.
Many great books on Amazon (look for the highest rated of course) on both Ruby and Rails.
Great starting point for links:
http://www.ruby-lang.org/en/documentation/
As well check out Learn to Program
Now get learnin'.
Google App Engine offers free hosting for applications that do not exceed the specified limits. The server-side language is Python, the client-side language is JavaScript inside Django templates. Everything has worked nicely for me in Ubuntu 8.10.
GREAT Question,
a couple of years ago I was in the same place -
What HONESTLY Helped me was using Dreamweaver, I set it in split mode and started watching the code
I used this and started delving into the PHP Application world and could see what was going on (sort of)
I know you can use dreamweaver with wine on the linux, and it can help you do a TON
granted if you continue it has the potential to limit you to the dreamweaver world... but can help you learn and create at the same time
(I build full php apps from scratch now with a notepad... but I started with DW)
The question I'd have is what kind of scale on web programming are you wanting to do? If it is small stuff then the LAMP stack would be my suggestion while if you want to get more into 3-tier architecture then Java or ASP.Net may be worth getting into for middleware or business logic code.
With the exception of the reference to the LAMP stack above, there has been no Perl recommendations. I like Perl as it is easy enough to build a fairly full featured web application (using CGI, or mod_perl). Of course, you are going to have to learn HTML/CSS if you are going to do anything on the web. I feel Perl is a good choice for web development as it is fairly robust and full featured with all of the modules available on CPAN. Combine with an application framework like CGI::Application or Catalyst and you can build sophisticated web apps in a short amount of time. Also, using a tool like XAMPP can help as you won't have to worry about web server or database cofigurations to get started.

Resources