Old desktop programmer wants to create S+S project - php

I have an idea for a product that I want to be web-based. But because I live in a part of the world where the internet is not always available, there needs to be a client desktop component that is available for when the internet is down. Also, I have been a SQL programmer, a desktop application programmer using dBase, VB and Pascal, and I have created simple websites using HTML and website creation tools, such as Frontpage.
So from my research, I think I have the following options; PHP, Ruby on Rails, Python or .NET for the programming side. MySQL for the DB. And Apache, or possibly IIS, for the webserver.
I will probably start with a local ISP provider for the cloud servce. But then maybe move to something more "robust" and universal in the future, ie. Amazon, or Azure, or something along that line.
My question then is this. What would you recommend for something like this? I'm sure that I have not listed all of the possibilities, but the ones I have researched and thought of.
Thanks everyone,
Craig

If you want a 'desktop component' that is available for you to do development on whenever your internet is out, you could really choose any of those technologies. You can always have a local server (like apache) running on your machine, as well as a local sql database, though if your database contains a large amount of data you may need to scale it down.
Ruby on Rails may be the easiest for you to get started with, though, since it comes packaged with WEBrick (a ruby library that provides HTTP services), and SQLite, a lightweight SQL database management system. Ruby on Rails is configured by default to use these.

The languages you list are all serverside components. The big question is whether you can sensibly build a thick client - effectively you could develop a multi-tier application where the webserver sits on the client and uses a webservice as a datafeed if/when its available but the solution is not very portable.
You could build a purely ajax driven website in javascript then deploy it to the client as signed javascripts on the local filesystem (they need to be signed to get around the restriction that javscripts can only connect back to the server where they served from normally).
Another approach would be to use Google Gears - but that would be a single browser solution.
C.

If you wan't to run a version of the server on desktops, your best options would be Python, Rails, or Java servlets, all of which can be easily packaged into small self contained servers with no dependencies.
My recommendation for the desktop would be HTML 5 local storage. The standard hasn't been finalized, but there is experimental support in Google Chrome. If you can force your users to use a specific browser version, you should be OK, until it is finalized.
I would recommend looking at Django and Rails before any other framework. They have different design philosophies, so one of them might be better suited for your application. Another framework to consider is Grails, which is essentially a clone of Rails in the groovy language.

Related

Rendering web content in offline/desktop applications

For a while now, I've been thinking about the question of user interface, with regard to ease of implementation and cross-platform compatibility. I'm primarily interested in developing desktop applications, for things that don't have a server-side storage model, or situations where internet connectivity is intermittent, etc. However, I've started doing some work on my employer's website, and found in that time that web site interfaces are very easy to develop, especially in comparison with the cross-platform UI tools I've used in the past.
With that in mind, I want to know: what are the tools/libraries available that can be integrated into a desktop application to render web content? Could be HTML, PHP, JavaScript, with/without CSS, etc. How easy/difficult are they to use?
You might actually want to check out Microsoft's Windows Presentation Foundation. It takes a lot from how the web works and applies it to desktop application development. It's not exactly HTML/CSS/PHP/JS, but it's not far off, either. It does have a bit of a learning curve, but the markup is XML based, so it's largely just a matter of learning its quirks, and of course, the .Net languages and framework (though, theoretically, you could use PHP on the .Net framework).
You might also be interested in Appcelerator Titanium, which allows you to use HTML/CSS/JS to build desktop applications. I don't know what it's desktop development is like, but I've used it for iPhone development, and it has promise.
If you want to play around with plugin/extension writing, the latest Gnome desktop environment (Gnome 3 - http://www.gnome.org/) actually runs completely off of HTML/CSS/JS and could use people to help build their extension library. It is, literally, writing desktop apps! :) (You would, of course, have to run Linux to play with it, but Fedora 15 uses Gnome 3 by default, and Linux in general comes with a number of powerful text editors, and the community has done a great job writing tutorials and documentations for getting started.)
If I understand the question right, to my knowledge there is nothing truly cross platform for doing this, you would always have to write a different version for each target platform.
Most windows apps that render web content sub the task out to IE, but I don't know how *nix app would handle this.
To use PHP to do anything on the local machine, it would have to be installed on the local machine. You can supposedly build full Windows GUIs in PHP with Winbinder although I have never messed around with it myself.
For windows-only apps, you might find HTA interesting - these are (sort of) self-contained HTML/Jscript apps and you can use links and Jscript to fetch content from remote servers.
I think your best bet would be Java though - the Java mantra is 'Write once, run anywhere' and Java GUIs are extremely portable. I'm sure I remember coming across something whereby you could use HTML to build bits of a Swing GUI as well...
What about Adobe Air? I'm not caught up on its capabilities, but I run Pandora Desktop on my Mac, which goes through Adobe Air - My impression was that it fulfills what the OP is asking.
You should have a look at Adobe AIR:
Adobe AIR with PHP/MySql or SQLite
http://www.vtc.com/products/Adobe-AIR-PHP-Development-Tutorials.htm
Never used it though so I can't really give you details but maybe somebody who has can... hope this helps

BackOffice Database Application FrontEnd - Program in C#/VB.Net or PHP?

I'm working on a project where there will be a MySQL database containing data that will mostly be displayed on the web using PHP. However, there is a need here for a back-office data entry application (linked to the same MySQL database) that is feature rich and easy to use.
what I'm trying to understand is where we are at with web-based frontends. I find that there are still so many events and features that I can make use of in a Windows Desktop GUI written in something like C#, VB.Net or MS Access. I don't have a lot of experience programming UI for web but it's my impression that it's still more difficult and takes longer to get similar or the same functionality using non-MS web technologies (I dislike ASP.net, sorry) as compared to programming the desktop portion in a traditional desktop application language like C#, VB.Net, or MS Access.
jQuery and jQuery UI are definately making things easier. Also, there's very rich online applications like Google Docs and Zoho but it's my impression that these are programmed by some of the top web UI programmers around, not to mention that it takes longer to write it and intensive testing to make it work in all of your target browsers. It also takes extra time and code to "block" browsers that don't meet the requirements.
What programming language would you recommend?
I know I may not have given enough information here but I'm not sure what I'm missing. If you have questions just leave a comment below so I can edit this post and answer the questions.
I think, the important decisive parameter in your case is:
who is going to use the end?
TRUE: almost anything can be implemented as a web application these days and web applications are the future while desktop applications will become the exception
TRUE: the obvious challenges of the web are still the same
In your case, if the end you're talking about is for internal use and just a few selected persons are going to use it plus you are more fluent in desktop application development... the choice seems obvious to me.
If on the other hand there is a chance that a bigger number of people in many locations with different computer systems are going to use the end, make it for the web.
You say you know VB.NET, well where's the problem... you can write your aspx pages in VB.NET, can't you?

php socket programming,Pros and cons and Approach

I am working on a task where it is required to distribute live data (being fetched from some other server) to client using sockets. We user drupal as a framework and thus my choice of PHP.
1)I want to know the major factors that should be taken into consideration while developing this server.Like security,authentication,load etc and how should i approach this.Is there any blog/article that could be of help.
2)Is there a better choice than PHP for this?
3)ALSO is there any drupal module that could assist me in this.
I can think about one issue when you are talking about several servers connecting to you, you may want to conceder a nonblock mode.
Because when you are working with blocking mod, each server can connect at the time, meaning that there will be delay delivering the message.
http://il2.php.net/manual/en/function.socket-set-nonblock.php
I think java would be better choise, multi thread may help here.
from my point of view, this is something that you need to develop your self, socket programming needs a lot of attention.
Drupal is a Web CMS, it can be used as framework for advanced web features or light to medium web application that fits well in the traditional HTTP request paradigm. IMHO, distributing live data from multiple servers to client using sockets doesn't fit with the base assumption behind Drupal's design.
PHP can be used to write socket server. It used to be un-common, but it is becoming more and more available. ReactPHP is a non-blocking I/O library/framework suited for socket programing. Racthet is a websocket server in PHP using ReactPHP.
In any case, this would ne nothing like developing a web application with RoR, Drupal, Django, Symfony, etc.
If integration with a Drupal website is required, the Service module is a nice solution to provides a REST or XML-RPC API. Or course, direct access to Drupal's MySQL database is also an option but will probably require more knowledge of the used Drupal modules since you will have to replicate their behaviors and understand how they manage their data (for instance, how a particular CCK field is stored in your database).
Note: Previous version of this answer included reference to the following solutions in other languages: Twisted (Python), EventMachine (Ruby) and Node.js (JavaScript). These are all valid solutions when PHP is not required.
Previous version of the answer also referenced phpsocketdaemon, but nowadays ReactPHP is a more clean and robust solution.

Python or PHP for small windows administration scripts?

I'm choosing between these two languages, in contrast to another question here. My program going to be set of scripts checking files, free space, checking that apps are running etc. and writing information to database. Then PHP web page will show results.
Python have more examples of winapi calls (at least at StackOverflow) and more attractive to learn and use in different areas of programming, but I didn't use it before. With PHP I have small experience and I will be using it for results web page anyway.
PHP seems to be easier to install on network (to use one network installation for many workstations). Both languages can work with COM objects (I will need ADO).
Scripts will be small, not complex, but their number will grow.
Can someone with experience in similar tasks advise on choice between these two?
Don't shrink from using a language just because you haven't used it before. Learning a new language is one of ways to expand your overall capabilities as a programmer. True, you won't be as productive with it at first but learning how the language tackles common problems (manipulation of data structures, creation and lifetime of objects, etc.) will teach you new ways to think about computing.
That said, I would suggest you use the ActiveState version of Python (http://www.activestate.com/). It has the Windows integration included. I'm not sure about network install with Python. I've installed it across a net by running a remote desktop of the target and running the installer. Windows wants things registered in the registry so running a language is not like running an .exe sitting on a remote file share.
I asked question first time as anonymous so have no other option to reply now except to write an answer.
Thank you verisimilidude for ActivePython advice!
Installed ActivePython at home, reading Dive into Python 3.
Installed RadPHP XE at work (company bought it).
So for work it will be PHP. For me, if have free time (and may be for kids, when grew and if interested) it will be Python.
As someone who uses both on a regular basis, I tend toward using python for windows scripting and php for web apps. It's mostly just my preference, but I think they're each ideally suited toward different things. I love using Python in windows, it is really versatile.
a ) python is a nice alternative because you can generate an executable, otherwise (running as script) php is more suitable because it does not required an installation.
b ) try to not to connect directly to the database. Instead, you can create a web page then the clients can connect to it instead to do a direct connection to the database.
for example in php (in the client)
$fp=fopen("http://192.168.0.200/update?id=mymachine&value=200","r");
fclose($fp);
ps: For api calls, both (php and python) can do the same. Thought, for php and Windows Vista (and higher) exist some restriction when you are running it as a apache-module and apache is running as a service but i don't think it is the case.

Web technologies for an embedded server

I've recently started a new web development project for an embedded device and wanted to solicit some recommendations for technologies to use. The device will serve HTML pages which include AJAX code to retrieve data from a JSON server. We're tentatively using Cherokee as the web server, though we're not tied to it.
Currently, I'm considering the following technologies:
Write it all in PHP. I know it's big, slow, and bloated, but I've got about 10MB available for the web interface (a lot for an embedded system), and we won't be seeing a lot of traffic on any of these devices. It does need to seem responsive for the users, however (pages should load in less than a second).
FastCGI + a C program - We're using an in-memory database, so the C program could interact with the database directly through the API. This would have much better performance than PHP, but development time and reliability is a concern since C isn't very well-suited for web development.
Lua + Kepler - This seems like a nice middle ground between performance and development time. However, I've never worked with Lua, so I'm not really sure how to implement it in an embedded web project. I'm also uncertain as to how well it integrates with the Cherokee web server.
So any opinions or past experiences with the above stated technologies? Any others I should include in the list?
Thanks,
Alex
When I was in this area, I used Lua and a simple FastCGI runner (Luaetta [for I'm sure the latest source would be available if you asked the guy] , though I'm also sure that's not the only one, and there's Kepler of course), spawned by lighttpd.
It performed quite well on an embedded media player, and was used for remotely accessing content and controlling the device. Though I don't maintain it anymore, you can find more about it at http://matthewwild.co.uk/projects/wooble . If you think the source would help just poke me for it, it's currently only available via a package manager but I can fix that given the motivation.
Another (again Lua) project in this area is LuCI. These guys are dedicated to making a web interface for embedded devices (routers specifically), and have produced a nice framework with lots of supporting libraries geared towards that kind of system.
I wouldn't be concerned with not knowing Lua. If you know any language then you can pick up Lua in a day or two, the manual documents the whole language and is quite short.
How about looking at HipHop, Facebook's PHP compiler?
https://github.com/facebook/hiphop-php/wiki
That way you can write your code in PHP and effectively compile it to C++.
ASP.NET. Assuming that you wouldn't be interested in Embedded Windows Server 2008, you could still leverage ASP.NET by incorporating Mono into Cherokee. You could leverage Visual Studio as your RAD development environment and use things like ASP.NET MVC 2. A lot of third party user controls will also 'just work' with Mono (Telerik Announces Support for their ASP.NET controls on Mono!).

Categories