To seek, to find and not to be blown away

my Friends, I want to tell you about our service Sdmca.Russian and some details of its manufacture. Under the cut is the article about the balloons, CouchDB, Lisp and a couple of pictures.
KDPW
On the nose the holidays and, perhaps, some of you will find a gift idea.

Many saw as balloon clowns make dogs. Very cute and very funny. Someone may even have tried to twist the balls on their own.

Today of balloons is an incredible amount of beautiful pieces. Are festivals and interesting activities.

We made a website directory of aerodesigners (but gradually designers were called that way), and the main thing on the website is photographs of works of aerodesigners. From other web directories, we offer a Notepad that is a simple user fills and sends to the designer in your city/region. The designer, however, also can send the customer a letter with the filled notebook.



Talk about the technical aspects of the website, because in the process of developing we found a few interesting things, or poorly described in the documentation or this description had gleaned on the forums.

Lisp


The website is written in Common Lisp (SBCL implementation). Language choice due to the ease of coding and great a number of libraries. Fit your needs was corrected only two libraries, and very slightly, the rest worked out of the box.

The site code is compiled directly to native code, thus the performance of the website is high. I want to believe that this statement will stand the test of garraffello :)

CouchDB


As a data store is CouchDB. It stores the photos and thumbnails for them, as well as user information.

CouchDB includes a fairly easy data management environment Futon, which has one drawback — all the code in JS, which is used to control the database (views, functions list, etc.) is serialized to a string, and it is almost impossible to correct in the medium itself.

To resolve this problem, use the utility couchapp.

CouchApp

It's a small utility in python that allows you to create an independent (standalone) apps on CouchDB. Utility template generates the code and, most importantly, allows a single command to load the application in CouchDB. The app itself is in the file system tree structure, where in different folders is the code different elements, such as views or auxiliary code. In a normal human form.

The utility also allows as to add different elements couchapp-application — views, lists, etc.

For example:

the
couchapp generate view check-user

Here check-user — is the name of the generated view. The utility creates the directory views/check-user, which will be the templates for the map and reduce functions.

Update function

Because in CouchDB the data are never overwritten, but only added to the database, a very important element is the availability of the audit document. Almost any reference to the document in the record requires a knowledge audit document. It's not always convenient.

CouchDB is there functions (update functions) that allow you to manipulate documents on the server side (not fetched them on the client), without knowing their revision. In the documentation this moment is described as something quite modest, however, the update function allow you to do interesting things:

the
function(doc, req) {
if (!doc) {
doc = {
_id: req.id

count: 0
};
}
doc.count++;
return [doc, '"' + doc.count + '"'];
}

A code snippet for every function call increases the count field of the document. Thus is implemented a generator of sequential numbers to CouchDB.
A function call, by the way, is the following:

the
curl -X POST http://localhost:5984/database/_design/view-doc/_update/generateOrderNo/counterDoc

View here-doc is a design document in the database, generateOrderNo — update function, counterDoc document in the database.

Calling the given function every time we incrementorum field in the document and immediately get the value of this number. Analog field autoincrement for SQL.

CouchApp, however, is not able to generate update functions, however, if you manually create the updates directory and put in it the function of the above content, the application safely loaded to CouchDB.

inline code

In CouchDB there is no possibility in views to use whatever library code. This problem solves very CouchApp, in my opinion, elegant.

You can use the code function (or the reduce function)

the
function (doc) {
...
// !code vendor/myapp/common.js
...
}

and the place in the code where this string is found, it will paste the contents of the file common.js located in the appropriate application folder. Though not the most beautiful solution, but it allows you to write shared code once.

Framework


As the basis for the interface were chosen framework Ink. It has an interesting internal structure and comprehensive functionality. In addition, the framework is developing quite rapidly.

Opinion


In General, when you want a holiday, think about balloons. Especially in the Friday the Thursday evening before the holiday.

Well, aerodesigners that can organize this event can be found on our website. On the main there is a link to the page with the designers from your region. If you find that nobody is there, you can press the button "Want!" and we would invite aerodesigners of your cities after your interest.

The picture to attract the attention of the FreeBSD mascot, is made of balloons, logo CouchDB and one of the logos Lisp, made coffee.



Finally, a few holiday links:

the FreeBSD Mascot of the balls
Geeklatte.com it drawings on coffee

Thank you for your attention!

Criticism and suggestions are welcome.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

The release of the new version of the module modLivestreet 0.3.0-rc

mSearch: search + filter for MODX Revolution

Emulator data from GNSS receiver NMEA