Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
For one of my simple appplications, all the routing is handled by nginx. I just put the php files in the directory referenced and they are serve requests: no framework is used. I am trying to migrate this scheme to Scala: I want to do it by gradually replacing each php script with one in Scala.
Is there a Scala counterpart of a php server that can automatically compile and serve all scala files under a directory? So that when I put code in /book/new.scala, /book/buy.scala, /user/login/auth.scala, etc, the server would compile and serve all of them for corresponding requests?
In the strictest technical sense, Scala can be used as a "scripting language," but it's rather limited in what can be reasonably done that way.
As others have commented, you should make a proper server for or out of you Scala application. There are many options from simple and lightweight to big and fancy. Most use the Java Servlet Container, but some implement their own HTTP server side.
You have many options to choose from, but "scripting" really is not among the viable ones.
You might look at the Lift Framework, and aim to only use the endpoint/RESTful part of the framework. In this way you can identify key requests to the webserver and pass them off to Scala-based code. Lift would manage the webserver part of everything.
That said, this is a very strange way to manage a web application, and harkens back to the 90s-era CGI-script based architectures. Ask yourself why you're attempting to model things this way before proceeding, and ask if the difficulty of running two containers (php and Scala) is really worth the trouble in order to 'ease' migration.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm wondering if it is possible to create a web application where a user can sign up,login, and make payments without using a framework like Rails or Node.js, but rather html,css,php,mysql etc.
Is this even possible?
Yes, it is entirely possible to write any web application without framework. Keep in mind that frameworks are also written in their respective programming languages - therefore, you can achieve same results without one, but it will be more time-consuming and will need more work to "reinvent the wheel". A framework usually delivers many useful functionalities that are ready to use, but in the exchange you must comply to its standards, semantics and rules.
Many programmers of high-end applications choose to develop without a framework, because they don't want to be bound by those boundaries. Also, there are performance reasons - if you can fine tailor your application to your business requirements, it will probably run faster.
Also, please keep in mind that Node.js isn't a framework - it is a toolset that allows running JavaScript applications in OS enviroment instead of the browser.
It will take a lot of time but it sure is possible. These 'frameworks' are here to speed things up for you. I recommend you to take a look at a couple of MVC frameworks. For example: Laravel, Codeigniter and Symfony. These frameworks will do a lot for you(Think about security and routing) but you still have to write the biggest part of the logic yourself.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I made a NGO website that has customer service in it, means that clients are able to chat directly to the admin. I've built 30% of it with PHP. But, I thought it's difficult to make a chat application with PHP. I've been told that Node.js is the best web development to make chat application. Can I mix PHP with Node.js ?
Generally, people name files depending on what language the code inside is written in. For example, the .php extension is run by a PHP interpreter. Certain files can have other languages mixed in. For example, a .html file can contain CSS and Javascript. Another example is the .html.erb extension in a Rails app, which can contains both Ruby and HTML/CSS/JS code. This is accomplished by something known as a preprocessor.
You could use a preprocessor to mix mostly any language together, but I'm not sure that will make your life any easier making an app. It's probably a better idea to separate your app into microcomponents, which can all be written in different languages.
For example, a chat server could be written in Node and a REST API written in Rails. They might be hosted on separate servers and communicate with each other by sending HTTP requests.
As far as Node being "the best" for making a chat server, that's a totally subjective point and StackOverflow discourages opinion-based conjectures.
It's also worth considering whether an open-source chat project could be integrated with your existing code. I.e. something already made.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I do quite large project for a client and I would like (somehow) to secure code form event that mid dishonest client was not going to pay me for the work. :)
The contract is written that the project must provide application with a sources.
So far I mostly been writing in .NET where I was protecting myself against such an eventuality in way that I was creating class witch get POST some parameters with shutdown application. This class was thrown into a dll witch was already compiled, so no one could change the source.
Is there a similar possibility in PHP? I can do the same thing (as in .NET case) but clever customers with access to PHP can find above class and I just cut it.
Maybe it is some other way to secure myself?
Suturing of the database also eliminated for similar reasons as above.
PHP is an interpreted language; as a result, it doesn't compile your code. Your best bet is to stick with .NET, where you can compile the functional part of the application into a .dll, or use Java and compile it into a bytecode.
PHP wasn't built for compiling.
What you can do is probably host the application on your server till the client has made a payment, and then upload it to the client's server.
Or you can make it downloadable from your server (only after payment), along with configuration scripts that is configurable by anyone with a few clicks of the button; something similar to the way some of the PHP frameworks (e.g. WordPress) work.
You can protect your code with Zend Guard (http://www.zend.com/en/products/guard/).
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 months ago.
Improve this question
I wrote a web service API which services REST requests in php. It didn't take much time to actually setup this on apache. But, I am more comfortable writing python code rather than php code. Can python be used as a server-side scripting language like php? What changes are necessary to make it work with apache?
Thanks
Bala Mudiam
For a REST full API I would suggest that you take a look at Tornado. It's what Facebook uses. It's fast, efficient and easy to work with (written i Python). You may use nginx as a proxy in front of it to server static content and allow more Tornado services for scaling.
Python is a very capable server-side language. Large sites (such as AG Interactive) use Python for server-side programming and have had great results. mod_python and mod_wsgi are 2 popular modules for Apache that allow you to serve Python.
Yes Python can be used as server-side language (as well as Perl, Ruby or even C/C++). Just use mod_python for Apache http://www.modpython.org/
I'll dare to say that mod_wsgi is probably closer to the de-facto choice (vs. mod_python) if you're stuck with Apache as your web server these days. One benefit is that you'll find a wide range of active frameworks and libraries that are WSGI compatible. Please don't read too deeply into "framework" - some things I'd lump in there are quite minimal, providing a few nice conveniences on top of raw WSGI to help you organize your code. Imagining that you're not looking to invest into a web framework itself just to get a REST interface up, you might check out restish as an option.
In my opinion python which is a popular language is better.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
I have a LAMP (PHP) web app which need to interface with programs on an IBM 3270 mainframe (via Microsoft SNA Server). One solution I'm looking at is screen-scraping via 3270. (I'm integrating the present with the past!)
Many years ago, I wrote C code which used HLLAPI as the basis for such a task.
Is HLLAPI still the best way to approach this task?
If so, would I be best off just writing a C app to undertake the work necessary and exec() this C app from php?
Are there any open source HLLAPI providers for Linux? (In the past I used commercial solutions such as Cleo.)
I haven't used it but maybe look at http://x3270.bgp.nu/ which says has a version:
s3270 is a displayless version for
writing screen-scraping scripts
I'm currently trying to do a similar thing but with a command line Python script.
I open a pipe to the s3270 (on Windows the exe name is ws3270) to connect to the server and send all commands.
Read carefully those part of the documentation for scripting:
http://x3270.bgp.nu/wc3270-man.html#Actions
http://x3270.bgp.nu/x3270-script.html#Script-Specific-Actions
While I have no experience with 3270, I would expect that finding and calling on an outside application or library is your best bet. PHP is not an all-purpose tool, hacking into a non-web communications protocols is best left to languages like C or Java that can handle that well.
Screen scraping 3270 applications is a perfectly valid way of getting at data. Many of these applications haven't changed for years, or decades in some cases. Sometimes there is simply no API or other programmatic way of getting at the necessary data.
Nighthawk: You could always learn CORBA, that monstrosity of a system was designed to let C programs talk to remote COBOL systems or random stuff written in PL/I or something.
But seriously, if the old app has no API, 3270 screen scraping is fine. There's a lot of similarities between 3270 screens and HTML forms (unlike character mode terminals).