php alternatives for standalone web allpications - windows

I need to develop multi-user web site which also should be able to run locally (on Windows) for a single user. I'd like to use the same code for both sites. Local copy should work without installing any software, source code shouldn't be available, and web browser should be integrated into application. I may use SQLite as local database and I want to use ExtJS as front-end.
I'm aware of 2 products for PHP that claim to do this, but I'm not sure yet that they will work with the tools I'm interested in (ExtJS and Kohana PHP).
I know that Haskell provides such option, but I don't want to go that far :).
Flex doesn't seem too promising (at least what I remember), as its UI-building capabilities are limited, and I'd like to have online version in HTML, not in Flash.
Are there any other technologies available (.NET, Ruby, Python, etc.)?

Well, you can use PHP itself. It's not the neatest solution available, but you can use php-win.exe to avoid command-line popping out. You can then use some source obfuscators or byte-code compilers to avoid revealing source code. And AFAIK PHP works without instalation (it can run out of a directory if it has all the required files in it)
As I said, not the neatest solution, but will probably meet your requirements.

Related

Is mod_perl what I'm looking for? FastCGI? PSGI/Plack?

I have exhausted my ability to find answers on the web for this one. I'm trying to install mod_perl on windows and there are many dead ends.
Is mod_perl even what I'm looking for?***
I have a collection of web apps used within my company's local network for database and file system interface. The web server runs Apache 2.2 and ActivePerl 5.16 using DBI, DBD::mysql, and CGI. The clients get their dynamic content via AJAX calls (jQuery.getJSON) to the Perl scripts using CGI parameters. The traffic is extremely light - only 4 or so users and only a few queries at a time here and there.
The issue I'm having is that the latency is unacceptable for the nature of these apps. The delay is typically around 400ms, all waiting time. I have experimented with increasingly simplistic Perl scripts and believe all of the delay is the Perl interpreter. I've looked into FastCGI but as I understand this deals mostly with high traffic which is not my problem: it's the overhead of each low-traffic call. So it seems like an Apache-embedded Perl interpreter (as I understand mod_perl to be) would solve my overhead-related latency issues.
How do you install it in a post Randy Kobes world?
All resources I've found for installing mod_perl for my setup involve a server theory5x.uwinnipeg.ca formerly run by him and now defunct after his passing. ActivePerl ppm does not have any mod_perl built in packages and the website shows all build failed listings.
Here is an ActiveState community post explaining why there is no ppm.
I did find this resource that seems to have all the missing pieces but for Strawberry Perl.
So I'm left to think the only way to do this is to install from source, but I have no understanding of how to do this. I have zero familiarity with Linux and it seems like most of this stuff is geared toward it. Worse yet I have a 64-bit Windows XP and a Windows Server to install it on.
The other thing that crossed my mind is maybe I need to install some kind of distribution like XAMPP instead of putting together all the pieces myself. I'd be quite nervous to change course now and risk breaking my working but slow apps
Is mod_perl even what I'm looking for?
I hope not.
There are issues with mod_perl. Your Apache, mod_perl and perl need to all be built with compatible compilers and architectures so they can all be linked at run time. There will be no running of a 32bit Apache with a 64bit perl when you are using mod_perl. In my experience mod_perl should also be compiled against header files for your specific versions of both Apache and perl. Presuming you get all this secret sauce mixed up correctly, you are now running a web server that can be crashed by a poorly written perl script. But on the bright side, this is more efficient than common CGI.
After a few years of this madness, FastCGI was invented. By running as a persistent, but separate, process, the web server was able to achieve mod_perl (or mod_PHP, or mod_python) efficiency without the need for binary compatibility or the stability risks. Just think of the freedom! An Apache module that cares only about binary compatability with it's Apache host and can farm out tasks to Perl, Python, C or even Visual Basic. ( I just had an evil thought about trying to do web services with Forth or Lisp, but that would just be crazy.)
Running on a linux distro (or other canned XAMPP stack) can make setup and maintenance of mod_perl easier because they will distribute it in a package that has been compiled to work with the packages they supply of both Apache & perl. Unfortunately if you want to run with a version of Apache or perl that is not "official" to your distro, get ready to DIY. Even so, a distro's packages do not mitigate the stability issues inherent in running mod_(language-of-choice).
In any case, before you're up and running in your new configuration, your existing CGI scripts will need to be modified. You can choose to rewrite them to mod_perl, FastCGI, or PSGI/Plack standards. If you choose to rewrite to PSGI/Plack standards, then you can care much less about the specifics of your web server's current or future configuration.
How do you install it in a post Randy Kobes world?
The last link in your question appears to be spot on. Do you have a religious or PHB based reason to prefer ActivePerl over StrawberryPerl? In the end, mod_perl requires that it be built against your specific version of Apache and your specific version of perl. This will either involve compiling it yourself, somebody else wrapping up versions for multiple Apache/perl version combos, or somebody else wrapping up a single version and asking you to use their preferred versions of Apache & perl.
If you choose the mod_perl route and believe even slightly that server software should be kept up to date (XP? Seriously?), then be prepared to either roll your own or trust your 3rd party to keep you up to date. Of course, if you're a hit-and-run developer, well that frees up your choices considerably...
tl-dr:
FastCGI is your friend. Particularly if you are running Windows and like to keep server software up to date.
mod_perl works best when supported by a responsible distro or a responsible developer who is comfortable building it from it's source. ...repeatedly.
It's been an eternity since I've installed mod_perl on Windows so I'm not sure I can help you with that.
But your understanding that FastCGI "deals mostly with high traffic" is not correct. Both FastCGI and mod_perl will offer very similar performance benefits, because both will execute your scripts with a persistent interpreter–eliminating the overhead of starting up perl and compiling your code on each request. Therefore, there is no reason not to give FastCGI a shot.
You might want to look at the PSGI/Plack API which allows you to write code agnostically that can run under vanilla CGI, FastCGI, mod_perl, or with a PSGI-aware server such as Starman, or uwsgi. All of these except for vanilla CGI offer a persistent environment that will reduce the overhead of executing your scripts.

What is the right way to share / reuse Ruby code on different machines?

I have a VPS and usually I write Ruby scripts for daily tasks. Sometimes I want to use the same scripts / methods on my home machine too. How should I share and reuse the already written codes between the too machine? Should I write a gem and install on both machine? Or is there a way to use the "load" method to load Ruby modules from a HTTP or maybe NFS share? HTTP would be preferable like in JavaScript / HTML, I think, however the "load" method seems to be not working with a HTTP url.
I think using github or some other source control software would be the most appropriate idea.
Sharing code via HTTP or NFS seems very weird to me. I can think of problems with loading from external sources according to reliability and security.
I would prefer a Gem or at least a git repo that I can check out when I need the code on a different machine.
Version control system like Github or BitBucket is perfect for this. You'll basically have a central repository (on their server) where you'll store your code. Suppose computer A makes a change and "pushes" it to the server, now you can easily let know computer B, C etc. that there was a change made and they can update the code that's there.
Ruby comes with a powerful package management system called RubyGems that was created for exactly this purpose.
My tool of choice for sharing scripts between various machines is Dropbox - cheap and quick solution. For me works perfectly.

Zero deployment CouchDB embedded in a Windows app?

I'm probably dreaming here, but am wondering if there's any possibility of completely embedding a minimal CouchDB engine within a Windows application, such that the app can be run without requiring installation (of CouchDB/Erlang) on the user's computer.
I already provide this slimmed down / bundled ability - check here https://github.com/dch/couchdb/downloads and specifically the lean bundle at 16MiB erlang + all couch love here https://github.com/downloads/dch/couchdb/couchdb-1.1.0+COUCHDB-1152_otp_R14B03_lean.7z
Some brief notes on bundling and embedding couchdb on windows at wiki.apache.org/couchdb/Quirks_on_Windows including how to hide the erlang window (erl.exe -detached) at startup.
Ask on CouchDB #user mailing list if you want more info or help while you have a crack at this.
While not a code solution, you could use one of the bundling applications that can embed files and other files into one executable. One example would be BoxedApp.
Why bother. It is so easy to install Erlang on Windows. Just bundle up the whole thing including the erl.exe binary and have your installer unzip it into a folder. The only thing that you would need to change would be the batch files, or better yet, discard them and write your own batch file to start up CouchDb. Also, it is a good idea to use a different port that either the normal Erlang port (or the usual CouchDB port) and maybe even get Erlang to use localhost as its "shortname".
The CouchDB wiki does provide at least a few tips for Integrating CouchDB into your Windows Applications. YMMV, from what I can tell it's more or less just tips on creating a relocatable build. You'll want to likely generate a solid random admin user/password into the local.ini file during the install process and set up proper permissions on all created databases (to protect against any potential cross-site scripting vulnerabilities) in addition to ensuring the socket binding only happens on the default localhost interface.

What's the best Cloud Development Platform (if there is such a thing)? (Ruby, CouchDB)

first of all one confession: i hate to run software local. i really do (other than the OS and a browser).
ok, about my question: i'm a pretty sophisticated JS coder and a pretty senior PHP dev. my old school dev. setup basically was: code everything online (via textwrangler and FTP upload) on on dev-(sub)domain. if it works clone (download and upload) it to another domain. works great for one person (or 2 to 3 person teams).
i wanted to leave PHP behind now for many years, non the less i come back to it for my quick and dirty web-apps projects (i.e.: miniqr.com). not because i like it, but because there is no install this, install that, set up this, config that, run that, run this overhead. (it's ugly and compared to other setups - ugly, but it just works (most of the time good enough)).
so what i'm searching for is the same thing but with ruby (framework sinatra - as a db i want to run couchdb)
is there a provider which offers such a thing (maybe even with an useable online code editor)?
i know that there are upsides using run localy, deploy anywhere, git push pull whatever, but for my needs this is just overhead.
how (and where) would you set up such a (dirty) cloud development environment?
The solution is really based upon your needs. I suggest looking into CouchApp with CouchDB. This will allow you to use JavaScript and HTML as your front end and then CouchDB as your web/app/DB server. You can sign up on CouchOne and get started on your project right away. I have worked on a few projects with this combination and I love it.

Transfering ASP Classic Pages from Windows to Linux

Has anyone tried a solution to host ASP classic pages on something else than IIS/Windows? I'm wondering if it would be a good idea to try one of the solutions for that problem. I know about Sun Java System Active Server Pages (or Chilisoft) but haven't tried it. Is there any big problems with those solutions? Does the hosted code need change?
You could try with Apache::ASP in your Linux, but I'll use it just for the meantime until can migrate the application to other language with better support (PHP, Perl, Python, Java, Ruby... even .Net with Mono).
Note that Apache:ASP can't manage classes, so you'll need to recode your classes to just variables and functions. Well, classes in classic ASP aren't so much complicated than just variables and functions...
There is a program that exists called ASP 2 PHP. With that you could migrate your application to PHP. The project leader does not recommend using it continuously as it is not, nor ever will be 100% perfect.
There is also an FAQ and a Notes page to get a glimpse of the problems that you may encounter while using it.
I think you'll get in troubles trying that ... :(
If it was ASP.NET I'd encourage you to use Mono, but for classic ASP I don't think there are that many solutions, but I could be wrong :)
I had client who chose, unknowingly, an ISP with form of ASP emulation under Linux many years ago. The program I installed didn't work properly because filenames in Windows are not case-sensitive, in Unix they are. It was a whole pile if fail. Include files, URLs, form posts, image filenames, you name it.

Resources