close Warning: Error with navigation contributor "AccountModule"

Opened 11 years ago

Last modified 11 years ago

#6 new task

Contribute code: SMTP client, HTTP server, Database drivers, Web app framework

Reported by: ben Owned by:
Priority: minor Milestone:
Component: box libraries Version: 0.10
Keywords: Cc:

Description

Here's some code!

This may be useful as we move forward. Only one issue; it's written for the old build system so will need autoconfification before being used.

If it ends up in trunk, the distribution generation system will not include it in Box Backup (unless we as it to), and gives us another distribution, 'boxwaf'.

There is documentation for everything in the usual place.

SMTP client

A simple interface for sending emails. Might be useful for sending notifications directly, instead of via scripts.

HTTP server

Basic forking HTTP server, which does the job. Supports multiple requests in one connection. If you want to use it for actually serving a high traffic site, you'll want to put something in front of it to make sure the forking isn't a problem. Squid works nicely.

However, it's most likely of use for creating simple UIs as it makes it easy to do standalone web servers.

Database interface

Quite a nice database interface, if I say it myself. It allows you to talk to databases with the minimum of code, but does it efficiently. Abstracts out differences between databases, to the extent of having the ability to modify special markers in the SQL to use the SQL required for your database. (Case in point: Auto increment fields.) Drivers for sqlite, mysql, and postgres.

Code generation is used for readability of code: When defining a query, you include a query definition in comments in your .cpp file. This is picked up by a parser, which generates a class which encapulates it. You can then refer to columns by name, and use parameters in the Execute() command. It's not necessary to do this though, there's a Generic query class which does almost everything this does, including safe inserting of parameters into query strings.

Minor issue: The postgres driver uses the binary interface for efficiency, if available, but can have problems with some data types it doesn't understand. It can be forced to use the text interface if this is a problem.

Web application framework

Yet another web app framework. This one's major difference is that it builds a standalone web server. A complex load of perl is used to generate C++ which does the actual handling. Everything which could be done at compile time is done at compile time. The business logic is written in C++.

Some features:

  • Form handling, obviously
  • Database integration
  • Templating
  • Much better i18n support than anything else I've seen
  • Very efficient when behind squid, can handle 1000s of connections fairly weedy server.

Some problems, all developer friendlyness issues:

  • The build system is dodgy, and you often have to do recompilation of everything
  • Slow to see changes because of recompilation
  • Possibly a little difficult to get to grips with
  • Difficult to see where errors are, as line numbers in compiler output don't correspond to line numbers in the perl

I have now built two large web applications with it, one of which had two other developers, and both of which have translations. Both succeeded, are in production, and work well. But I'm now using Ruby on Rails, which may tell you a little about the fun with development. Still, it's much more productive than PHP any day!

It might be useful for writing a cross-platform web based interface for end users, as it can use all the Box libraries (including the Protocol ones!), and outputs a single executable which contains everything. Installation would be very easy, with no dependencies.

Also, someone commented that it would be good for embedded systems.

Change History (1)

comment:1 Changed 11 years ago by ben

(In [926]) Contribute code: SMTP client, HTTP server, Database drivers, Web app framework, refs #6

Note: See TracTickets for help on using tickets.