Kanapes IDE http://blog.kanapeside.com News and Announcements about Kanapes IDE and .NET CouchDB API posterous.com Thu, 24 May 2012 05:17:00 -0700 Introducing the Couchbase ASP.NET SessionState Provider http://blog.kanapeside.com/introducing-the-couchbase-aspnet-sessionstate http://blog.kanapeside.com/introducing-the-couchbase-aspnet-sessionstate

Source: Couchbase

One question I'll often ask developers on a phone screen for an ASP.NET developer position is to discuss the different options for managing session state in an ASP.NET application.  I like this question because it gives me quick insight into what types of applications that developer has been working on and what role that developer has played on his or her team.

The memorization part of the question is clearly to know the different out-of-the-box providers.  Developers who work on smaller sites or who don't have a production support role often know about in-process session state, but are unfamiliar with the out-of-process providers and the problems they solve. 

Over the years, I've found that a state server was often sufficient for a reasonably high traffic site.  But that has a single, and obvious, point of failure.  Managing session state with SQL Server is durable, but clearly it's going to be slower.  I've never been comfortable with increasing disk I/O on the database server for session management. 

The right answer seems to be to use a backing store that isn't I/O bound and doesn't depend on the uptime of a single server.  That description is one that applies to Couchbase Server.  So if you want the speed of using an in-memory session state server with the durability of a SQL Server instance, you now have the option of using the Couchbase ASP.NET session state provider.

Freshly posted to the CouchbaseLabs projects on GitHub, is a port of the former Enyim Memcached session state provider.  There's also a sample application included to get you up and running quickly. 

Using the new provider is very simple.  Assuming you have your cluster configured, all you need to do is update your web.config with the settings for the Couchbase .NET Client Library and update the sessionState config section.

<section name="couchbase"type="Couchbase.Configuration.CouchbaseClientSection, Couchbase"/>  
<couchbase>
    <servers bucket="default" bucketPassword="">
    <add uri="http://127.0.0.1:8091/pools/default"/>    
    </servers>
</couchbase>
<sessionState customProvider="Couchbase" mode="Custom">
  <providers>
    <add name="Couchbase"type="Couchbase.AspNet.SessionState.CouchbaseSessionStateProvider, Couchbase.AspNet" />
  </providers>
</sessionState>

Once these settings are in place, simply use the Session object (or ViewData, ViewBag and TempData in MVC) as you always have. 

Session["Message"] = "Couchbase is awesome!";

Don't forget that you'll need to mark your own classes as Serializable in order to persist them into Couchbase Server.

[Serializable]
public class SessionUser
{
    public string Username { get; set; }

    public string Email { get; set; }
}

Please note that this provider is included as part of Couchbase Labs and is not an officially supported product.  You're free to use the code however you'd like as it's licensed under Apache License 2.0. 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Thu, 15 Mar 2012 05:12:00 -0700 Improving CouchDB Performance http://blog.kanapeside.com/improving-couchdb-performance http://blog.kanapeside.com/improving-couchdb-performance

Source: SafariBooksOnline

In a previous piece titled The Technology Behind Couchbase I described the technology that underpins the functionality of the Couchbase Server 1.8 and the forthcoming Couchbase Server 2.0. In this post, I will show you how to improve the performance of CouchDB.

Within CouchDB, there is a one-to-one relationship between the design documents that you create, and the indexes that are produced in the process.

That’s important because if you put all 20 view definitions into one design document, all 20 views will be updated at the same time the next time someone accesses the view. The index is created when the view is accessed, and if there are lots of views to update then the time between sending the request and getting the reply can be significant.

One simple way to improve your performance is to reduce the number of view definitions in a single design document.

Using stale views

Another way is to make use of the stale parameter to your view. For example:

GET http://couchbase:5984/recipes/_design/recipes/_view/by_recipe?stale=ok

This tells CouchDB to return the view information based on the current index without forcing an update before the results are returned.

Obviously this is much quicker, because there’s no update occurring before the info is returned. But it runs the risk of returning old information, hence the stale moniker. Using this method for all your requests will mean your index is never updated.

Updating after

One solution to this is to continue to use stale views, but instead of specifying ok use the term update_after. This returns the index result as quickly as possibly by still using the stale view, but then asks CouchDB to update the index after the results have been returned:

GET http://couchbase:5984/recipes/_design/recipes/_view/by_recipe?stale=update_after

This updates the index after the results are returned, but may also delay queries made by other clients until the view update has been completed.

Using the _changes feed

CouchDB includes a _changes feed that outputs information when the database changes. You set a process to watch the changes feed and then trigger a view update when a specific number of changes have taken place. For example, the Python script below (which uses the couchdb module from http://code.google.com/p/couchdb-python/) monitors the changes feed for the recipes database, and requests the view (causing an update) when 10 changes have been received:

from couchdb import
Server                                                                                                                

cdbs = Server('http://localhost:5984/')
db = cdbs['recipes']
# the since parameter defaults to 'last_seq' when using continuous feed
ch = db.changes(feed='continuous',heartbeat='1000')                                                                                       

counter = 0                                                                                                                               

for line in ch:
    counter=counter+1
    if (counter > 10):
       db.view('recipes/by_name')
       counter = 0

You can now set all of your clients to use stale views, because this background process will update the view as changes are made to the DB, and you are no longer relying on your client requests to control your index updates.

About the Author

  A professional writer for over 15 years, Martin ‘MC’ Brown is the author and contributor to over 26 books covering an array of topics, including the recently published Getting Started with CouchDB. His expertise spans myriad development languages and platforms Perl, Python, Java, JavaScript, Basic, Pascal, Modula-2, C, C++, Rebol, Gawk, Shellscript, Windows, Solaris, Linux, BeOS, Microsoft WP, Mac OS and more. He is a former LAMP Technologies Editor for LinuxWorld magazine and is a regular contributor to ServerWatch.com, LinuxPlanet, ComputerWorld and IBM developerWorks. As a Subject Matter Expert for Microsoft he provided technical input to their Windows Server and certification teams. He draws on a rich and varied background as founder member of a leading UK ISP, systems manager and IT consultant for an advertising agency and Internet solutions group, technical specialist for an intercontinental ISP network, and database designer and programmer and as a self-confessed compulsive consumer of computing hardware and software. MC is currently the VP of Technical Publications and Education for Couchbase and is responsible for all published documentation, training program and content, and the Couchbase Techzone.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Fri, 03 Feb 2012 03:36:00 -0800 BigCouch 0.4 moved in http://blog.kanapeside.com/bigcouch-04-moved-inc http://blog.kanapeside.com/bigcouch-04-moved-inc

Source: H-Online

BigCouch, the highly available, fault-tolerant, clustered version of Apache's CouchDB NoSQL JSON document database, has been updated to version 0.4. BigCouch appears to users as if it were a single instance of CouchDB, when, behind the scenes, it is actually an elastic cluster of nodes working to store, index and retrieve views of the data. BigCouch is developed and maintained by Cloudant and released under an Apache 2.0 licence. Cloudant have also restated their intent to donate and integrate the core functionality of BigCouch into the Apache CouchDB project.

Version 0.4 brings BigCouch up to date, in API terms, with CouchDB 1.1.1 and now features "zones", which offer more control over where documents are persisted in the cluster. For example, Cloudant uses the feature to ensure that a copy of a customer's data exists in both of their geographically separate data centres. The developers have also added the functionality of CouchDB's replicator DB for better control of data replication. Other changes in 0.4 include the addition of native SSL support and FreeBSD support. A full list of the changes is available in the change log. BigCouch 0.4 is available to download from the project's github repository.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Thu, 19 Jan 2012 06:36:00 -0800 Business Model change by CouchDB founder http://blog.kanapeside.com/business-model-change-by-couchdb-founder http://blog.kanapeside.com/business-model-change-by-couchdb-founder

Source: XWiki

In an article on Business Insider I found out that Damien Katz, the founder of CouchDB, decided to move away from the Apache project and to the Couchbase project, leaded from the VC backed company Couchbase.

What he is doing is what I described in my previous blog articles:

First Damien Katz should be recognized and respected for his incredible Open Source contribution with the work he did with CouchDB.

Now one can understand that he might want to control more the future of his product and/or that he wants/needs to earn money out of his innovation and the success of it and/or that he wants to build up this innovation as fast as possible.

But in his article there are a few things that are not acceptable from my point of view:

  1. Not respecting his own project CouchDB and your own contributors by using the title that he used. The title basically say that whatever he does will be better and dismisses what the Open Source Community could make out of the code he contributed to. He might be right in the end if his model works out better, but it's a plain lack of respect
  2. He is not mentioning the Couchbase is built out of the Couchbase startup and that it's company funded by investors. He is indeed not mentionning that currently the couchbase code is Open Source (although it is now at the end of his post after Chris Anderson has mentionned it). Obvisouly many people understood that the move was about money. He might put some doubts in the head of people by stating that "everything" couchbase is open source at this moment. Now can he tell us that he can guarantee that in the FUTURE, "everything" couchbase does will be open source ? I'm pretty sure he won't, mostly because I'm pretty sure his investors would not agree with that and that it won't be the case in the future.

He should be honest about the real reasons of the move. It's because he is in a business oriented company, and wants to control the direction of the technology that is build, and he plans with his investors to make significant profits out of this work and that in the future his creations might not be open sourced.

It is very sad, that it seems that many Open Source companies are using the business model of gathering a community with the open source code, and then progressively close whatever they do in order to make more money out of it. I specifically mention "more money" out of it, because I personally believe that in most cases you can make money out of a respectfull open source strategy, but there are a few constrains there and probably one of them is to not need outside investors. This is what we try to do at XWiki SAS where we have a manifesto which explains the way we plan to behave and where we have commited ourselves to stick to our model.

Ludovic Dubost
Creator of XWiki Open Source Software and Open Source company XWiki SAS

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Fri, 06 Jan 2012 15:12:00 -0800 Cloudant Plans to Wind Down BigCouch Development, Merge Features into Apache CouchDB http://blog.kanapeside.com/cloudant-plans-to-wind-down-bigcouch-developm http://blog.kanapeside.com/cloudant-plans-to-wind-down-bigcouch-developm

Source: SiliconAngle by Klint Finley

The drama regarding the future of Apache CouchDB is winding down and looks to have a happy ending. Following Couchbase’s announcement that it is discontinuing its own distribution of CouchDB, Cloudant announced that it is now in the process of merging its fork of CouchDB, called BigCouch, into the main CouchDB project. In an interview today, Cloudant CTO Adam Kocoloski confirmed to me that Cloudant will then wind down development of BigCouch after the merge and there will be just one major version of the NoSQL document database. Cloudant will then concentrate on developing CouchDB.

To recap the recent history: in February of 2011, CouchOne, a company co-founded by CouchDB creator Damien Katz as Couchio in 2009, merged with Membase to form Couchbase. The newly formed company announced its own distribution of CouchDB calledCouchbase Server Single. The company also began integrating features from CouchDB, such as peer-to-peer replication, into Membase to create the main Couchbase Server offering.

Cloudant, founded in 2008, has been developing BigCouch, which improves CouchDB’s clustering and scale-out abilities by adapting technologies from Amazon Dynamo, Amazon.com’s distributed database system. “At the time, we built BigCouch we decided to make it open source but keep it in its own repository because we were uncertain about how to make it work in the main Apache CouchDB project,” says Cloudant co-founder and President Alan Hoffman.

Last November, a poster on Hacker News noticed that according to Google Trends, CouchDB was declining in search popularity. Cloudant employee Tim Anglade speculated that it might have something to do with the fracturing of the CouchDB project between Couchbase Single Server, BigCouch and the original Apache project and the fact that neither Couchbase nor Cloudant were evangalising CouchDB.

Later that month, following the announcement that Canonical would replace CouchDB in Ubuntu One as its solution for syncing structured data, Couchbase SVP of Product James Phillips told me that the company no longer had any business interest in CouchDB. Shortly after, the company announced that it was ending its Couchbase Server Single offering. And yesterday, Katz announced that he will no longer contribute to CouchDB and will focus entirely on Couchbase Server.

Cloudant followed Katz’ announcement by announcing that it is contributing its BigCouch features into CouchDB. Since Couchbase Server is very much not CouchDB, there will be at last only one version of CouchDB. That means that moving forward Cloudant’s developement and evangalizing efforts can go fully towards the CouchDB.

Since CouchDB is an Apache project, there has never been an official corporate sponsor, but CouchOne was seen as the “go to” company for CouchDB. Since the merger with Membase (which many refer to as an acquistion of CouchOne by Membase), there’s been a leadership vacuum. And the end of support for CouchDB on the part of Couchbase has also led to uncertainty on the part of enterprise customers.

Couchbase gets to focus on its primary product, CouchDB gets a new sugar daddy, enterprise customers have a new company for support and Cloudant has a bright future ahead. It seems like wins all around.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Wed, 04 Jan 2012 15:27:00 -0800 Developing with .NET and Couchbase Server Webinar http://blog.kanapeside.com/developing-with-net-and-couchbase-server-webi http://blog.kanapeside.com/developing-with-net-and-couchbase-server-webi

Friday, January 27, 2012, 10AM PT, San Francisco 

6pm - London | 1pm - New York | Sat, Jan 28th at 5am - Sydney | Sat, Jan 28th at 3am - Tokyo | Sat, Jan 28th at 2am - Beijing | 11:30pm - Mumbai

Presented by: John Zablocki

Duration: Approximately 60 minutes.

Cost: Free

Couchbase Server 2.0, currently in Developer Preview, is a distributed key/value store database offering rich querying by way of views created using map/reduce. Those versed with Memcached or CouchDB will find reuse in their skills as Couchbase Server incorporates the best features from these two platforms.

In this webcast John Zablocki, Developer Advocate at Couchbase, will introduce the .NET client library for Couchbase Server. Topics covered will include:

  • Configuring the client
  • Persisting and retrieving key/value data and querying views

 

If you plan to attend this webcast please click the Register button below and we'll send you a reminder email.

Price: Free

Register Now

 

About John Zablocki

John Zablocki is a Developer Advocate at Couchbase, located in the Boston area. Couchbase develops and supports Couchbase Server, which can be found behind the some of the Web's largest applications. He is the organizer of Beantown ALT.NET, a monthly Meetup focusing on .NET and open source. John is also currently authoring a book on Orchard CMS for O'Reilly.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Fri, 23 Dec 2011 02:19:00 -0800 Jelastic Makes Java Hosting Easy and More Powerful with Apache CouchDB http://blog.kanapeside.com/jelastic-makes-java-hosting-easy-and-more-pow http://blog.kanapeside.com/jelastic-makes-java-hosting-easy-and-more-pow
Addition of fast growing, open source database CouchDB to Jelastic increases reliability and speed.

Palo Alto, CA, December 23, 2011 --(PR.com)-- Jelastic, the next-generation Java hosting platform, today announced the addition of Apache CouchDB, one of the fastest and most reliable distributed databases available – giving customers more choice and control over how they store their data. CouchDB makes replication and scaling across multiple data centers easy and reliable.

Apache CouchDB is a NoSQL, document-oriented database that is growing in popularity due its replication strengths, reliability and speed. CouchDB provides a RESTful JSON API that can be accessed from any environment that allows HTTP requests. Its “B-Tree” approach to data storage means that querying the database is really fast, regardless of the amount of data stored. CouchDB offers a masterless, simple and efficient replication, allowing an application to be run across multiple Jelastic hosting providers, providing redundancy against downtime. CouchDB’s reliability is increased by the fact that database file can’t be corrupted.

Jelastic makes it easy to upload Java applications. Jelastic eliminates the need to make changes to code or programming language. Jelastic users are not locked in to any one way of doing things and are free to choose what stacks they want. The Jelastic platform makes it easy to run and scale Java applications.

“We are really excited about making CouchDB available as a software stack in Jelastic,” said Ruslan Synytsky, CEO, Jelastic. “CouchDB is reliable and offers database replication that is unmatched. Pairing CouchDB with Jelastic gives developers greater freedom and choice, while providing a cutting edge solution to Java application hosting.”

Jelastic supports any JVM-based application, including Java 6, Java 7, JRuby, Scala and Groovy. Currently, Jelastic offers support for following SQL databases: MariaDB, MySQL and PostgreSQL. It also supports the MongoDB and CouchDB NoSQL databases. Jelastic supports a number of application servers, including Tomcat 6, Tomcat 7, GlassFish and Jetty. Jelastic provides load balancing and caching through the integration of NGINX, and developer tools integration via Maven and Ant plug-ins.

Jelastic has been in beta since mid-2011 and has more than 5,000 registered developers and continues to receive positive feedback. This online tutorial shows how fast and easy it is to build and deploy a Java application in Jelastic.
To sign up for a free beta of Jelastic, or to learn more, go to http://jelastic.com.

About Jelastic
Jelastic, Inc., a startup company based in Palo Alto, Calif., makes the Java server hosting platform for developers and hosting service providers. Jelastic is the only PaaS offering designed specifically for hosting service providers to deploy and make available to their customers. Jelastic automatically scales Java applications and allocates server resources required by applications, thus delivering the true next generation Java cloud computing. Learn more at http://jelastic.com.

Contact:

Judah Johns
281-940-4270
media@jelastic.com

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Wed, 21 Dec 2011 11:28:00 -0800 Discontinuation of Couchbase Single Server http://blog.kanapeside.com/discontinuation-of-couchbase-single-server http://blog.kanapeside.com/discontinuation-of-couchbase-single-server

Source: Couchbase

..., Couchbase Single Server, our CouchDB distribution, will be discontinued effective in January. We have come to believe the Apache Software Foundation is a better place for the continued development of CouchDB and frankly it is clear to us that having our own packaging only served to confuse the market. We plan to contribute the packaging and documentation we built to the Apache CouchDB project where it can be put to good use by the community. Our developers, particularly those originally with CouchOne, will continue to be big contributors to CouchDB. But, as I said earlier, our singular company focus will be on Couchbase Server...

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Tue, 20 Dec 2011 01:04:00 -0800 Using CouchDb as a filesystem with PHP http://blog.kanapeside.com/using-couchdb-as-a-filesystem-with-php http://blog.kanapeside.com/using-couchdb-as-a-filesystem-with-php

Source: DZone

One of the problems I need to solve in my clustered PHP applications is where to store files. When I say files I’m not speaking about source code. I’m speaking about additional data files, such as download-able pdfs, logs, etc. Those files must be on every node of the cluster. One possible approach to the solution is to use a distributed filesystem, rsync or maybe use a file-server mounted on every node. Another solution may be the usage of CouchDb. CouchDb has two great features to meet or requirements with this problem. It allows us to store files as attachments and it also allows to perform a great and very easy multi-master replica system.

The usage of CouchDB is pretty straightforward. It implements a RESTfull interface to perform every operations. So the only thing we need is a REST client. Zend Framework has a great one. We dont’t really need a library. We can easily perform REST requests with the PHP’s Curl’s extension. I’ve created two libraries for working with CouchDb one is a low-level HTTP client (with curl) and another is higher level one (it uses the HTTP Client) for CouchDB operations. You can read two post about those libraries here and here.

Now I want to extend the features of my library. I want to use CouchDB as file storage in PHP. Instead of using file functions (fopen, fwrite, fread, …) I want to use another ones and store/read files in CouchDB. For doing this I’ve refactored those two libraries into another one called Nov. I also have embraced namespaces so I will use them in the library. This means it’s only available with PHP 5.3.

Here you are a summary of the library. That’s not a complete UML graph. It’s only a diagram with the main features only with educational purpose.

summary

The best to show the library is with an example:

First I’m going to start with the basic usage of Nov\CouchDb library:

01 // Starting up the loader
02 require_once("Nov/Loader.php");
03 Nov\Loader::init();
04  
05 use Nov\CouchDb;
06 $cdb new CouchDb('localhost', 5984);
07 $cdb->db('users');
08 $nombre $cdb->db('ris_users')->select('gonzalo')->asObject()->name;
09 $apellido $cdb->db('ris_users')->select('gonzalo')->asObject()->surname;
10 echo "Hello {$nombre} {$apellido}.
11 ";

To allow me the use of different CouchDb Databases and to put the Database configuration in one file. I use the following configuration class:

01 class NovConf
02 {
03     const CDB1 = 'CDB1';
04     const PG1  = 'PG1';
05  
06     public static $_dbs array(
07         self::PG1  => array(
08             'driver'   => 'pgsql',
09             'dsn'      => 'pgsql:dbname=pg1;host=localhost',
10             'username' => null
11             'password' => null,
12         ),
13         self::CDB1  => array(
14             'driver'   => 'couchdb',
15             'host'     => 'localhost',
16             'port'     => 5984,
17             'protocol' => 'http',
18             'username' => null,
19             'password' => null,
20         ),
21     );
22 }

As you can see I use the same configuration file for my PDO drivers and CouchDb.

Now I can use:

01 require_once("Nov/Loader.php");
02 Nov\Loader::init();
03  
04 use Nov\CouchDb;
05 $cdb = CouchDb::factory(NovConf::CDB1)->db('users');
06  
07 try {
08     $cdb->insert('xxx'array('name' => 'xxx'));
09 } catch (CouchDb\Exception\DupValOnIndex $e) {
10     echo "Already created\n";
11 }
12  
13 $data $cdb->select('xxx')->asObject();
14 $cdb->update('xxx'array('name' => 'xxx1'));
15 $cdb->delete('xxx')->asObject();

And now finally the file storage part:

For storing the files I’ve taken one design decision. Every files will be stored into separate CouchDb document. That’s means one file, one document. There’s another possible approach. One CouchDb document can be one folder and store every files as attachments of this folder in the same document. But I prefer the idea of not to track folders. Only files. So each CouchDb document will have only one attachment.

That’s an example of one document in CouchDb

01 {
02    "_id""/home/gonzalo/aasa.txt",
03    "_rev""2-48b501a81c38fd84a3e0351917e64135",
04    "path""/home/gonzalo",
05    "_attachments": {
06        "aasa.txt": {
07            "stub"true,
08            "content_type""application/octet-stream",
09            "length": 12,
10            "revpos": 2
11        }
12    }
13 }

There’s another usage script. Here we can see all the features together. We create files, update and delete them. Internally Nov\CouchDb\Fs uses a predefined CouchDb database called fs.

01 use Nov\CouchDb\Fs;
02 use Nov\CouchDb\Fs\Exception;
03 require_once ("Nov/Loader.php");
04 Nov\Loader::init();
05  
06 echo "<pre>";
07 // create an instance from a factory method
08 $fs = Fs::factory(NovConf::CDB1);
09 // Now we're going to delete a file. If it doesn't exists will throw a FileNotFound exception
10 try {
11     $fs->delete("/home/gonzalo/aaa.txt");
12 } catch (Exception\FileNotFound  $e) {
13     echo $e->getMessage() . "\n";
14 }
15 // Now we are going to create a file.
16 // the second parameter 'true' means if the file doesn't exist will be created. Similar than 'r+'
17 try {
18     $fs->open("/home/gonzalo/aaa.txt", true)
19     ->write("asasasasasas""application/octet-stream");
20 } catch (Exception\FileNotFound $e) {
21     echo $e->getMessage() . "\n";
22 } catch (Exception\WriteError $e) {
23     echo $e->getMessage() . "\n";
24 } catch (Exception $e) {
25     echo $e->getMessage() . "\n";
26 }
27 // We open the file
28 $res $fs->open("/home/gonzalo/aaa.txt");
29  
30 // we can get the length and the content type
31 echo $res->getLenght() . "\n";
32 echo $res->getContentType(). "\n";
33 // We move it to another location
34 $to "/another/location";
35 $res->move($to);
36  
37 $res $fs->open($to);
38 // we flush the file to the browser
39 echo $res->raw();
40  
41 // finally we delete it
42 $res->delete();
43 echo "</pre>";

I’ve also created an extra class to allow to dump files from filesystem to CouchDb and vice-versa.

1 require_once ("Nov/Loader.php");
2 Nov\Loader::init();
3 echo "<pre>";
4 // from filesystem to couchdb
5 \Nov\CouchDb\Fs\Utils::fs2cdb("/path/from/", NovConf::CDB1);
6 // from couchdb to filesystem
7 \Nov\CouchDb\Fs\Utils::cdb2fs(NovConf::CDB1, "/path/to/");
8 echo "</pre>";

And that’s all. You can download the source code with the examples here. The examples are under document_root/tests/couchdb/ folder. Remember you will need PHP5.3.

About the author

 

Gonzalo Ayuso is a Web Architect with more than 10 year of experience in the web development, specialized in Open Source technologies. Experienced delivering scalable, secure and high performing web solutions to large scale enterprise clients.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Tue, 20 Dec 2011 00:55:00 -0800 Cloudant claims $2M funding http://blog.kanapeside.com/cloudant-claims-2m-funding http://blog.kanapeside.com/cloudant-claims-2m-funding

Cloudant Inc., a cloud data analytics software developer, has raised $2.1 million in an equity and stock funding indicated in a regulatory filingtoday. 

The Boston startup is focused on developing data tools to address web and mobile applications. Its CouchDB is a NoSQL document database that uses a querying and indexing engine. The company also offers an open-source version of CouchDB in BigCouch. NoSQL is a catch-all term for developers who reject the popular open-source database software MySQL.

Cloudant was not immediately available to discuss the $2.1 million funding, and the U.S. Securities and Exchange Commission filing did not disclose the backers of the financing. The company’s website noted Cambridge-based Avalon Ventures as a current investor.

Cloudant was founded in 2008 by three MIT physicists – CEO Alan Hoffman, CTO Adam Kocoloski and chief scientist Mike Miller. The company is backed by Avalon Ventures

In October, Cloudant entered into a joint agreement with agriculture giant Monsanto Co. to develop a next-generation platform that could speed up genome sequencing analysis in crops. The data integration and visualization platform is expected to be based on Cloudant’s BigCouch. 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Thu, 08 Dec 2011 15:09:00 -0800 Webinar: How 2600hz Does Cloud-based Telephony using CouchDB http://blog.kanapeside.com/webinar-how-2600hz-does-cloud-based-telephony http://blog.kanapeside.com/webinar-how-2600hz-does-cloud-based-telephony

Please join us on Wednesday, December 14 to hear Darren Schreiber, CEO of 2600hz, present a detailed account of his company’s CouchDB experience. Written in Erlang running on Cloudant BigCouch, 2600hz’s Whistle™ is an open-source telephony platform for delivering carrier-grade VoIP, SMS, and Video services. 

Webinar: How 2600hz Does Cloud-based Telephony using CouchDB

Date: Wednesday December 14, 2PM Eastern/11AM Pacific

Topics:

  • About the 2600hz project – overview & architecture
  • Why 2600hz replaced MySQL with Cloudant BigCouch (an extended CouchDB distribution)
  • Faster iterative development
  • Easier scaling
  • Migrating from MySQL to BigCouch
  • Using BigCouch – design & implementation considerations
  • Overview of BigCouch

Register: https://www1.gotomeeting.com/register/434660649

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Thu, 08 Dec 2011 13:56:00 -0800 Why I choose CouchDB over MongoDB http://blog.kanapeside.com/why-i-choose-couchdb-over-mongodb http://blog.kanapeside.com/why-i-choose-couchdb-over-mongodb

Source: Chris Allnutt

Theres a lot of discussion lately over NoSQL databases for high-performance distributed web apps. Actually thats an understatement, theres been a lot of discussion about NoSQL for the past few years. NoSQL removes the need to a schema, in favor of non-relational data being stored in “documents” (and then theres some really cool magic that happens to keep track of them all).

Currently there are 2 main contenders; CouchDB and MongoDB, and if you care about your data saving, and alway having your data available MongoDB is not a good fit. The marketing engine behind MongoDB is huge, and they have very good writers doing the content for their website. You get Examples like below:

Use Cases
It may be helpful to look at some particular problems and consider how we could solve them.

  • if we were building Lotus Notes, we would use Couch as its programmer versioning reconciliation/MVCC model fits perfectly. Any problem where data is offline for hours then back online would fit this. In general, if we need several eventually consistent master-master replica databases, geographically distributed, often offline, we would use Couch.
    mobile
  • Couch is better as a mobile embedded database on phones, primarily because of its online/offine replication/sync capabilities.
    we like Mongo server-side; one reason is its geospatial indexes.
    if we had very high performance requirements we would use Mongo. For example, web site user profile object storage and caching of data from other sources.
  • for a problem with very high update rates, we would use Mongo as it is good at that because of its “update-in-place” design. For example see updating real time analytics counters
    in contrast to the above, couch is better when lots of snapshotting is a requirement because of its MVCC design.

Generally, we find MongoDB to be a very good fit for building web infrastructure.

There are a log of magic words and phrases in here “MVCC”, “update-in-place design”. Heres what they really mean.

MVCC (Multi-version concurrency): If you go to write something and it fails you don’t lose your data. The new data get’s added to the system, and then when that is successfull the old data, is either forgot, versioned, or thrown away.

“update-in-place design”: We write over the old data right where it was stored, so if something goes wrong you’re hosed. So instead of leaving the last working copy alone before writing, it writes directly on top of it. If this write fails for any reason your data is gone.

In general, if we need several eventually consistent master-master replica databases, geographically distributed, often offline, we would use Couch.

This is really my biggest issue, what’s described here in my opinion is what being “web-scale” is all about. Read/Write your data everywhere and distribute it. The point about data “offline” is actually one of the BEST things about CouchDB, and is kind of tossed aside here. You can maintain your CouchDB database on a mobile device and then synchronize it with one on a server. The web is more than just websites, its data going between places. Arguably anytime your not synching data actively your offline.

In short, if your server crashes, someone trips over the powercord, etc… MongoDB is more than likely going to lose data, while CouchDB will wake back up, see what it was last doing and will lose only the write that was happening at the time of failure. All the benchmarks of performance in the world can’t outweigh that. The biggest saddness about this is that MongoDB won’t even let you know that it failed to write the data. A perfect storm being, the user “saves” their data from their app, the save fails, and they leave their session. When they come back the document is gone.

Use MongoDB only if you don’t care about the state of the data, but want to sling it out distributed as fast as possible. If you’re willing to wait an extra millisecond to ensure that that save and replication actually happens, and when it fails you just use the last valid version use CouchDB.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Thu, 08 Dec 2011 13:52:00 -0800 CouchDB "Joins" http://blog.kanapeside.com/couchdb-joins http://blog.kanapeside.com/couchdb-joins

Source: cmlenz

I’ve been playing more and more with CouchDB lately. After putting together a Python library, I worked on a brand new included HTML/AJAX interface. Now I’m starting to dive into the Erlang code, which is my first serious encounter with Erlang. In particular, I started a branch that aims to replace the HTTP server underpinnings with Bob Ippolito´s MochiWeb library.

Despite all that activity (and past experience with the conceptually similar Lotus Notes), the correct approach to designing applications “the CouchDB way” isn’t always obvious to me at this point. Just today, there was a discussion on IRC how you’d go about modeling a simple blogging system with “post” and “comment” entities, where any blog post might have N comments. If you’d be using an SQL database, you’d obviously have two tables with foreign keys and you’d be using joins. (At least until you needed to add some denormalization.)

But what would the “obvious” approach in CouchDB look like?

Read full article

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Thu, 01 Dec 2011 13:35:00 -0800 Apache CouchDB developers respond to UbuntuOne issue http://blog.kanapeside.com/apache-couchdb-developers-respond-to-ubuntuon http://blog.kanapeside.com/apache-couchdb-developers-respond-to-ubuntuon

Source: h-online

Jan Lehnardt, Chairman of the Apache CouchDB Project Management Committee (PMC), writing on behalf of the CouchDB developers, shed some light on why Canonicaldropped its use of the CouchDB NoSQL database from the cloud synchronisation service Ubuntu One. The announcement by Canonical had created some uncertainty about CouchDB and its capabilities. The message from the developers is "Do not worry, the project is alive and well" said Lehnardt.

According to Lehnardt, although the planned use case in Ubuntu One "seemed perfect for CouchDB" there were issues which meant that "at some point in the past" Ubuntu developers developed patches to adapt CouchDB to their Ubuntu One use cases. This divergence made it harder and harder to manage the code and also made it harder to merge new CouchDB features into Ubuntu One's version of the code. It is presumed by Lehnardt that at some point in the recent past Canonical gave up on this effort and switched to developing their own U1DB; he wished Canonical "the best with their development".

The PMC did take issue with Canonical's description of CouchBase as "The company behind CouchDB". Couchbase was formed from a merger of MemBase and CouchOne, the latter being the company formed by Damian Katz, founding author of CouchDB. CouchOne, and later CouchBase, had some dealings with Canonical over Ubuntu One's use of CouchDB. As with all Apache projects there are no corporate project sponsors; however, "We are fortunate to have a number of companies who employ our committers or sponsor individual people to work on the project" said Lehnardt, who goes on to point out that these people contribute as individuals, not as representatives of corporate entities.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Tue, 22 Nov 2011 10:36:00 -0800 Canonical Drops CouchDB From Ubuntu One http://blog.kanapeside.com/canonical-drops-couchdb-from-ubuntu-one http://blog.kanapeside.com/canonical-drops-couchdb-from-ubuntu-one

via Slashdot

"Since the Ubuntu One desktop synchronization service was launched by Canonical it has always been powered by CouchDB, a popular document-oriented NoSQL data store with a powerful master-master replication architecture that runs in many different environments (servers, mobile devices, etc.). John Lenton, senior engineering manager at Canonical, announced that Canonical would be moving away from CouchDB due to a few unresolvable issues Canonical ran into in production with CouchDB and the scale/requirements of the Ubuntu One service. Instead, says Lenton, Canonical will be moving to a custom data storage abstraction layer (U1DB) that is platform agnostic as well as datastore agnostic; utilizing the native datastore on the host device (e.g. SQLite, MySQL, API layers, 'everything'). U1DB will be complete at some point after the 12.04 release."

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Sat, 05 Nov 2011 08:57:00 -0700 krowder - CouchDB powered startup http://blog.kanapeside.com/krowder-couchdb-powered-startup http://blog.kanapeside.com/krowder-couchdb-powered-startup

Logan Powell, Co-Founder of krowder, posted few notes today about their startup:

I have an idea that's gaining some momentum and am looking for a CTO and equity-based co-founder. We're currently using couchdb and couchapp. Here's some alpha stuff: http://test.krowder.com

krowder intro video from The Hyperlocals on Vimeo.

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Thu, 03 Nov 2011 08:38:00 -0700 Kanapes IDE build 1.3.4324 is out http://blog.kanapeside.com/kanapes-ide-build-134324-is-out http://blog.kanapeside.com/kanapes-ide-build-134324-is-out

We just released new build of our IDE for CouchDB, this time we added support for uploading and managing attachments in Data and Design documents within your database.

Kanapeside_with_attachments

Free download available at http://kanapeside.com/downloads.aspx

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Tue, 01 Nov 2011 10:20:00 -0700 Location Aware Applications and GeoCouch http://blog.kanapeside.com/location-aware-applications-and-geocouch http://blog.kanapeside.com/location-aware-applications-and-geocouch

In this video from CouchConf SF Volker Mische will introduce you to GeoCouch, a geospatial extension for CouchDB. With the help of examples and a live demonstration you should have a good understanding of the capabilities of GeoCouch by the end of the video.

Location Aware Applications and GeoCouch from Couchbase on Vimeo.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Fri, 28 Oct 2011 09:41:00 -0700 CommonJS modules in CouchDB http://blog.kanapeside.com/commonjs-modules-in-couchdb http://blog.kanapeside.com/commonjs-modules-in-couchdb

Found great post by Caolan McMahon about Common JS Modules on CouchDB...

You may not realise that CouchDB actually supports CommonJS modules in design documents. This can be very useful when you want to share code across different list, show, update or validation functions.

Read more...

 

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos
Fri, 28 Oct 2011 09:02:00 -0700 Couchbase’s J. Chris Anderson on How P2P Changes Business as Usual http://blog.kanapeside.com/couchbases-j-chris-anderson-on-how-p2p-change http://blog.kanapeside.com/couchbases-j-chris-anderson-on-how-p2p-change

J. Chris Anderson is chief architect of mobile technology at Couchbase, a company dedicated to developing and commercializing the open source projects Apache CouchDB and Membase. I interviewed Anderson at Contact, an unconference dedicated to the peer-to-peer culture, decentralizing the Web, routing around Internet censorship, building new digital currencies and more. We talked about how CouchDB and Couchbase fit into this agenda and how the peer-to-peer Web changes business as usual.

Source: http://servicesangle.com/blog/2011/10/24/video-interview-couchbases-j-chris-anderson-on-how-p2p-changes-business-as-usual/?angle=services

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/661700/gravatar-100x100.jpg http://posterous.com/users/3sOea532LHot Evgenios Skitsanos skitsanos Evgenios Skitsanos