Web technologies for an embedded server - php

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!).

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?

Old desktop programmer wants to create S+S project

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.

Implementation question in web-development

We are testing a DSL modem's web pages (the HTTP server is running on the modem).
We have an automation tool that configures various options on the web pages by sending
POSTS of the respective web pages
We are using TCL (HTTP package) to send POST data on the web pages .
My questions:
Is there a faster way to do this other than TCL ?
When POST method of certain web page changes then the automation code has to be re-written .
Is there a way to write a generic code in some language so that the tool works irrespective of changes in POST or web structure?
If not, What is simple and fastest way to do implement and maintain the automation tool ?
Please suggest programming language.
It will be great if someone can share their ideas.
Regards,
Mithun
Python + web2py
All in one package with no further dependencies. Development, deployment, debugging, testing, database administration and maintenance of applications can be done via the provided web interface. web2py has no configuration files, requires no installation, can be run off a USB drive. web2py uses Python for the Model, the Views and the Controllers, has a built-in ticketing system to manage errors, an internationalization engine, works with MySQL, PostgreSQL, SQLite , Oracle, MSSQL and the Google App Engine via an ORM abstraction layer. web2py includes libraries to handle HTML/XML, RSS, ATOM, CSV, RTF, JSON, AJAX, XMLRPC, WIKI markup. Production ready, capable of upload/download of very large files, and always backward compatible.
Text from python wiki
I am not sure I understand what you are asking, but for testing web frontends, you can use Selenium. And for your backend, you can use PHPUnit. They also work together.
You will have to adjust your tests when your application changes. You run your tests against an interface. When that changes, your tests will have to change.
Selenium is definitely a good option and would be my personal choice.
It can be used on several languages. It is mostly a matter of taste and how familiar you are with the language.
If you do not know any of the ones proposed, I would recommend python or ruby but once again, it a matter of taste.
Selenium can and is meant to indeed be included in an unit tests suite, which is usually bound to the language (JUnit in Java, NUnit for .Net, unittest for python etc.).
Another option is the testing module form Visual Studio 2010, which is very nice and I think , offers this kind of features plus a lot of other ones too (but comes with a cost! and runs on Windows only).

New Website Project Silverlight / Php

Very recently I have been given a facebook like project to develop for a client of mine.
Most of the time when i comes to web development I use php since the solution PHP, apache, MySql which are all freely availble solutions, I have been thinking about using Silverlight to develop the web application, and I would like to hear some pros and cons with develping a web application in silverlight.
what do you use to host the application? its costs and so on compared a LAMP solution.
Thanks,
Eric.
Having not a clue of the type of app you're building, I need to ask: why do you think you need Silverlight? The main problem with walled-garden solutions like Flash and Silverlight is that they do not play very well with the users model of their browser. Things like bookmarks and back button tend to do the wrong thing. You can't easily navigate away and come back to what you were doing. Jeff and Joel have ranted about this in their podcasts.
Nearly everything you can imagine needing Silverlight / Flash for these days can probably be handled by a javascript/jQuery UI kit / plugin of some sort ..
Silverlight especially still has a pretty low penetration rate even with MS holding it up for you to accept during updates.
I do think there are types of applications for which these technologies make sense. Especially if they are very heavily graphically or interactively intensive. I would look at Flex sooner than Silverlight in that case.
I'd say the decision starts off with who needs to access this application. If it's got to run on a wide range of browsers and platforms, you're safer sticking with HTML, CSS & JavaScript as the technologies. If you're happy with PHP as the server side technology, then stick with it. You'll find the learning curve for .NET applications pretty steep.
That said, for larger projects, the slightly better practises that .NET tends to push you towards helps. Some PHP projects start small and then need to scale exposing flaws in the original architecture. The same thing obviously can happen with .NET but less so IMHO as the programmers using it tend to have slightly more disiplined training. There are of course, exceptions to all rules.
The attraction of Silverlight though is big - the ability to develop client side code in familar .NET languages and not JavaScript is appealing. Personally, the whole HTML, CSS and JavaScript (with Ajax) set-up is offensive from an asthetic point of view :-)
Rob.
PS. It will be more expensive for the development environment and back-end compared to LAMP. Only you can decide whether the investment is worthwhile.
Creating a website in SilverLight is as bad of an idea as using Flash:
Users cant print
Users can't bookmark
Search engines can't index specific
"pages"
Silverlight exists for the reason of making apps that aren't possible with traditional HTML/JS and a Facebook like app is not one of them.
If facebook itself uses PHP, why not develop it in PHP?

Categories