www.archive-net-2013.com » NET » C » CAFFEINELAB

Choose link from "Titles, links and description words view":

Or switch to "Titles and links view".

    Archived pages: 75 . Archive date: 2013-10.

  • Title: Caffeine Lab
    Descriptive info: .. Caffeine Lab.. Home.. Blog.. Contact.. Twitter.. I make software.. I drink coffee.. You can address me in English, French or Japanese.. Caffeine Lab 2012.. ×.. Support for my Android applications.. Send support requests to support at caffeinelab dot net.. Other inquiries.. Other emails should go to me at caffeinelab dot net.. I can speak English, French and Japanese.. Close..

    Original link path: /
    Open archive

  • Title: Caffeine Lab
    Descriptive info: Selection.. 12 Jul 2011.. LessCss and Rhino.. 01 Jul 2009.. Simple Tips to Build Scalable Websites.. All.. 18 Jul 2011.. hacking.. 02 Mar 2011.. Phones turning to netbooks are obsolete.. tech.. 08 Feb 2011.. Cross-Domain Requests, State of the Browsers.. ajax.. browsers.. cors.. http.. 01 Feb 2011.. New domain name.. life.. 29 Jun 2010.. Asynchronous HTTP Client in Play Framework.. api.. play framework.. 11 Mar 2010.. Testing in Play's Eclipse Plugin.. eclipse.. Misc.. 23 Feb 2010.. Deploy a Play Application on Gandi Cloud.. cloud.. gandi.. web.. 23 Jan 2010.. Going to FOSDEM, talking about Play.. conference.. fosdem.. 30 Nov 2009.. What I've been up to: Zenexity, Play.. java.. 23 Sep 2009.. Japanese Input now built-in in Android.. android.. input.. japanese.. mobile.. phone.. 16 Sep 2009.. Building Chrome/Chromium Extensions.. extension.. 03 Aug 2009.. Kiyoshiro Imawano.. kiyoshiro imawano.. north korea.. song.. 28 Jul 2009.. Search Engine Optimization Basics.. google.. pagerank.. seo.. scalability.. 23 Jun 2009.. Facebook's Bugzilla and Open Source Code.. bugzilla.. facebook.. opensource.. 26 May 2009.. Thoughts on Google App Engine.. 28 Apr 2009.. OpenID to break the web 2.. 0?.. myspace.. openid.. 15 Apr 2009.. Thank you, AMO!.. firefox.. 02 Apr 2009.. There's a New Gang in Paris.. homies.. posse.. 23 Mar 2009.. Will Never Happen in US.. 16 Mar 2009.. SMS in Japanese, in France.. nokia.. 05 Mar 2009.. Flock switching to Chrome: opinion of an ex-Flocker.. flock.. 03 Mar 2009.. Interview by a French blogger.. 23 Feb 2009.. Getting  ...   2008.. Kappa.. 21 Jul 2008.. Felt Rabbits.. 17 Jul 2008.. Getting more media sites in Flock's mediabar, with Media RSS.. 15 Jul 2008.. Theming GTK+ in CSS? Hell yeah!.. 10 Jul 2008.. Flock in Japanese.. 06 Jul 2008.. Week-End Hacking.. 03 Feb 2008.. Flock on Firefox 3.. browser.. firefox3.. 26 Dec 2007.. What happened with wiki.. flock.. com.. 17 Dec 2007.. The API release is approaching.. 09 Jul 2007.. Dailymotion in Flock.. 01 Jul 2007.. Google Desktop and Flock.. 07 Jun 2007.. Various Web Platforms.. 16 May 2007.. Flock photo interfaces.. 01 May 2007.. Theremin.. 28 Mar 2007.. Mozilla Developer Day.. 20 Mar 2007.. Virtual Console - Wikipedia, the free encyclopedia.. 15 Mar 2007.. Mangling TinyMCE (again).. 27 Feb 2007.. Introducing the Planet Flock.. 26 Feb 2007.. Nintendo DS Mainframe.. 20 Feb 2007.. mp2 player.. 15 Feb 2007.. Mixi extension.. 06 Feb 2007.. Social Bookmarks in the Next Flock.. 21 Jan 2007.. LowerBlog Extension: Blog in the Bottom.. 08 Oct 2006.. Status of the Blog Module.. 23 Aug 2006.. Geotagging Photos with Flock.. 21 Aug 2006.. Blogger Status.. 17 Jul 2006.. The Maps Topbar is Back.. 07 Jun 2006.. Cardinal and the Conversation Topbar.. 02 May 2006.. Guided Tour of Flock's Code.. 26 Apr 2006.. The Blog Editor's Story.. 15 Apr 2006.. Flock + Dotclear.. 12 Apr 2006.. New Blog Editor.. 09 Mar 2006.. Indexing Asian languages.. 15 Feb 2006.. The Shelf: Topbar or Classic.. 18 Jan 2006.. Flock's Mini Mapper..

    Original link path: /blog/
    Open archive

  • Title: LessCss and Rhino
    Descriptive info: Published on 18 July 2011.. LessCss.. My colleague front designer is using.. less.. js.. It s a tool to improve CSS with variables, mixins, and other goodness.. I really like it because unlike.. SASS.. , the syntax stays close to CSS (and my old habits and editor don t go crazy) but also because you can use it just by include it a Javascript file in your page.. On the other hand, SASS requires Ruby so unless you re already working with Rails, each developer needs to configure its environment for that and it s a pain.. Get ready for production!.. This is all good for development: you include your less stylesheet, your Javascript file and you re good to go.. But for production it s kind of stupid to render the page on every user s browser: it takes precious loading time.. You re better off generating the CSS file once from your Less file, and serve it compiled to your users.. Less actually provides a way to do that, using.. Node.. Indeed, LessCss being written in Javascript, it s easy to understand why they chose Node.. But Node.. js poses the same problem as SASS with Ruby: more work to setup a dev environment.. I  ...   and Rhino, but they all involved either integration with some framework I don t care, servlets, maven Not what I wanted.. I already have less.. js included in the page for development mode, all I want is to be able to generate the CSS in command line or in an ant task.. I ve also found an.. ant task.. but that relies on the Node version of lesscss, so it kind of defeats the purpose.. Here comes my code.. So here it is:.. rhino compatibility for LessCss.. I did a pull request to ask for inclusion.. The file you need is.. less-rhino-x.. y.. z.. You can use it in command line:.. java -jar rhino.. jar style.. less.. Or in ant (make sure tool.. rhino and tool.. less point to rhino.. jar and less-rhino.. js):.. macrodef name= lessjs attribute name= input / attribute name= output / sequential java jar= ${tool.. rhino} fork= true output= @{output} arg path= ${tool.. less} / arg path= @{input} / /java echo Lessjs: generated @{output} /echo /sequential /macrodef target name= compilecss lessjs input=.. /public/stylesheets/main.. less output=.. css / /target.. That s all, folks! Now I have one more task to include to my pre-deployment task, along with JsHint checks and Closure Compiler minification.. TAGS:..

    Original link path: /blog/2011/07/18/lesscss-and-rhino.html
    Open archive

  • Title: Simple Tips to Build Scalable Websites
    Descriptive info: Published on 01 July 2009.. A few days ago I ve been invited to a launch party for a web product in Paris.. While the product was nice and polished, it seems like the developers didn t understand anything about scalability.. They didn t even understand my question when I asked them if the product could scale.. It s probably not a big deal for them: they were presenting a CMS, so most of the time it will be installed for a limited user base.. I guess most people will be happy to use it on a single server, so it s probably OK for them not to be able to scale.. However I noticed that while scalability is now a fairly solved problem, there are not that many articles explaining how to prepare to scalability on the web.. So here I go.. I will not try to replace a.. good book.. , but just to give the very basics.. What is scalability?.. It s important to get that out of the way.. Scalability is not performance: it s not about making good use of CPU and bandwidth, and it s not about having the page being loaded quickly in the user s browser.. It s about being able to balance the load between several servers.. So when the load increases (more users creating accounts, more visitors, more page views) you can add additional servers to balance the load.. You don t just throw in a server, you need to design your software to work on a cluster of servers.. An other point is that you will rarely create a cluster of machines from scratch: when you launch a new website you will have few users so few machines (one or two), and as your load increase you will increase the number of servers.. You will have to scale different parts of your system one after the other.. #1: the web front-end.. Most of the time you start with a front-end (PHP, Python, Ruby, Java ) and a data layer (MySQL, PostgreSQL, CouchDB ).. As your load increase, the front-end will be the first to break.. Of course server-side caching will help, but at some point you will need several front-end servers.. The key for that is to ensure you don t store any data on the front-end.. The problem sometimes arise with sessions: a lot of PHP libraries store session information locally on the server, and that prevents from balancing the load.. The idea is that in a session a user may hit a server for a given page, then an other for the next page.. If the session is only accessible to the first server, you re screwed.. You want it to be somewhere else.. That can be in the data layer or in a special sessions server.. If you write a Facebook app you don t need to care, because Facebook takes care of the session.. Now can have as many front-ends as we want, but we have a unique database server.. #2:  ...   the new version on an other one is not great; what if some users see an old version of your post and others see the most recent one ?.. There are various strategies to divide data in a safe and consistent way, including:.. Depending on the userid (or blogid, or whatever makes sense in your application), put the data on one server on an other.. For example, all users with an even id go to server1 and all users with an odd id go to server2.. Hint: make sure your algorithm lets you add more servers later, which is not the case with my example where you will be stuck at 2 servers :).. Put some tables on a server, some others on an other.. It doesn't help you when a table is growing too much, but it can be combined with the previous point.. Conclusion.. Here you go, the basics for building a scalable website.. That s not all you have to do, if your website continues growing you will face more problems such as having to scale your network.. I m not talking about outgoing bandwidth but communication between your servers (front-end and data layers).. But if your code is efficient, those simple recommendation will get you to a server that can handle a fairly big load.. I really recommend.. Building Scalable Websites.. , from O Reilly if you want to know more.. FAQ.. Q: Language X doesn t scale, but language Y does! /em /strong.. A: Bullshit.. It s not the language that scales, it s your code.. Some languages may not perform as good as others, so you will have to add boxes more often but the way you scale is still the same.. Q: What about cloud computing? Virtualization? All these fancy buzzwords?.. Virtualization means you run on virtual machines rather than on physical ones.. The benefit is that you can easily add or remove machines.. For example, using.. Amazon EC2.. you can add as many machines as you want in a few minutes, and then remove them in no more time.. With a classical hosting company, you need to make a phone call, ask for the machines and you get them in maybe one week.. They ll charge you for the set-up too, and if you no longer want it you still have to pay for a full term.. So cloud computing offers are generally more flexible.. Q: Does Google App Engine make it easier to scale?.. In short, yes.. By not letting you access the machines, Google App Engine constrain you into writing scalable code.. You also don t have to request new machines when you need them or release when you no longer need them; you just pay what you use depending on the load of your application.. I am a big fan on Google App Engine but be careful, since it s programmed in a particular way it s not easy to move your project out of it.. You may feel locked in after you project started..

    Original link path: /blog/2009/07/01/scalable-websites.html
    Open archive

  • Title: Phones turning to netbooks are obsolete
    Descriptive info: Published on 02 March 2011.. I ve read.. Ars review on the Motorola Axis.. While it seems to be a really cool phone, the whole your phone turns into a laptop thing seams completely obsolete to me.. It comes from a time when your data was on one device and couldn t be transfered easily to an other.. The.. future.. present is all about having your data on the cloud.. If not purely on the cloud, at least synchronized: contacts/calendar in Google, files in Dropbox, todo list in Flow, RTM or other.. If your data is on the cloud, you can access it  ...   into a netbook, compared to buying a separate netbook? Nothing (same price, same size), but you loose a lot.. You can t use both at the same time.. You re limited in the choice of the netbook.. You re sucking battery life from your phone when you use the netbook.. I have to say, however, that having the phone work as a media center just by plugging it by HDMI is purely genius: it doesn t take more space in your bag, but it sounds awesome to bring your movies to a hotel or to a friends place not equipped with a media center..

    Original link path: /blog/2011/03/02/phones-turning-to-netbooks-are-obsolete.html
    Open archive

  • Title: Cross-Domain Requests, State of the Browsers
    Descriptive info: Published on 08 February 2011.. But the web browsers can t just let web pages do XMLHttpRequest calls to different domains: that would open security holes.. They explicitly forbid pages from requesting a resource from a different domain, forcing the web developers to tunnel request through their server or use a trick such as JSONP.. Luckily, browser vendors and the w3c are preparing a standard for access control letting developers do cross-domain requests in a controlled way.. This will be important for the following so note that there are 3 parties involved in a cross-domain request:.. The user.. The consumer page.. The producer page.. The problem with cross-site scripting.. The reason why web browser don t allow cross-site scripting by default is that it could be used to steal users information.. The scenario is the following :.. User visits a malicious page.. The page pulls user's information from a different website, for example the email feed from the webmail (works because the user is authenticated).. Data is sent to the malicious server through another XMLHttpRequest (not cross-domain this time) and user data is stolen.. Cross-domain requests is a real security issue, which is why browser couldn t just open the gates.. A imperfect workaround: JSONP.. JSONP.. See for example how it works for Twitter:.. script src= http://twitter.. com/status/user_timeline/erwan.. json?count=10 callback=onResponse /script.. With the code above, my local function onResponse will be called with the result in parameter.. So the Javascript is not your usual static file, but is a response to a query.. jQuery and other libraries can even manage that for  ...   add headers to explicitly allow cross-domain calls either to some domains or everyone.. Mozilla has a good documentation on.. HTTP access control.. This works well for public pages, that don t require the user to be logged in.. For page that do require login, more work is needed:.. The provider needs to add a header explicitly allowing requests with cookies /li.. The consumer needs to set a credentials flag to its XHR asking for cookies to be sent.. with IE.. First, the good news: IE provides access control to do cross-domain requests.. Now the bad news: as usual, IE can t do like the others and they have their own non-standard way to provide it.. Instead of a regular XMLHttpRequest, you need to do a.. XDomainRequest.. ! Moreover, it works only for public pages, not for authenticated pages.. So if you need to send he cookies and you want your application to work in IE, you re pretty much screwed.. Doing a cross-request using standard ways is still a pain.. It s especially a pain because libraries like jQuery don t do anything to help you: they don t use an XDomainRequest on IE when it s needed, so you ll have to do the switch manually.. JSONP will probably still be useful for a while.. If you want to pull public information that is not available in JSONP, here is a trick: use.. YQL.. It can transform any source (feed, rest api call, HTML page ) into JSONP.. That way you can get any data to your page in pure Javascript..

    Original link path: /blog/2011/02/08/cross-domain-requests-state-of-the-browsers.html
    Open archive

  • Title: New domain name
    Descriptive info: Published on 01 February 2011.. As you can see, I just changed the domain name of this blog from erwan.. jp to caffeinelab.. net.. That means that if you're using my feed to read this, you should update your reader to the new feed.. Currently and for the 2 months left on erwan.. jp there is a redirect on each page so no link is broken (yet).. So, why the change? Several reasons, mostly due to the fact that.. jp domain are a major PITA.. It was cool to have Japanese tld but:.. It s expensive: more than €70 a year vs €12 for a generic tld.. Even the change of owner is expensive (€50 just to change the name of the owner!).. You need an address in Japan.. It s fine for me because I have inlaws there, but that s relevant for the next point.. The policy of.. JP requires you  ...   Google thinks my blog is in Japanese, and this affect my rank on English queries.. /ul.. Finally, I realized having a generic domain name like Caffeine Lab is more convenient than having a my real name domain.. A domain is supposed to be a place, not a person.. So if I want to roll out a service on a subdomain, it looks better with a generic domain name than with my name.. And if I want an email address on this domain, having the person name in the right part of the address is plain weird - what I am supposed to put in the left part?.. So here we go - my blog URL is.. http://caffeinelab.. I will keep a.. JP domain for my wife.. Unlike this blog it makes sense because hers is in Japanese, and she got her usual nickname on the tld of her country so that s pretty cool..

    Original link path: /blog/2011/02/01/new-domain-name.html
    Open archive

  • Title: Asynchronous HTTP Client in Play Framework
    Descriptive info: Published on 29 June 2010.. I just finished migrating Play s http client to.. Ning's own asynchronous library.. What does it mean? A lot.. When you want to retrieve data from a different server, your web application behaves like a web client.. Rather than serving a resource to a client, it requests one from a different server.. For example, that s what you would do if you want to interact with the Twitter API or if you want to build a web based feed reader.. HTTP Client Calls in Play 1.. 0.. Play has a pretty cool http client library - pretty cool in the sense that it s very simple to use compared to what you usually get in Java.. I can get the content of a resource by calling:.. String body = WS.. url( http://erwan.. jp/ ).. get().. getString();.. In the same fashion, I can do a post and retrieve the JSON result:.. JsonElement response = WS.. url( http://api.. server.. tld/new ).. body( content ).. post().. getJson();.. As a comparison,.. see how it works.. with Apache HttpClient.. However there s a big flaw in this API: it can only be used synchronously.. That means that your Java thread will be blocked until the response from the server is received.. Depending on the server it could take several seconds, so it is a real issue.. If you need to do 5 calls then work on the result, you will have to wait for the previous call to be done before you can launch the second.. In Play you can use jobs to have your calls executed in a separate thread, but it s a burder to have to create jobs for that and kind of defeats the purpose of using play.. libs.. WS.. Play 1.. 1: Introducing Asynchronous Calls.. Since a commit I did last week, additional methods are available on the request object.. Now you can do:.. Future HttpResponse response = WS.. getAsync();.. Now your call is done in a thread - you can manipulate your.. Future.. object to test if the result is available, to cancel the call or to block the thread until the result is ready.. Let s say you need to do 3 API calls, and then use the results together.. With the synchronous library you have to serialize the calls, but now you can do the calls in parallel:.. // Launch all three calls in parallel Future HttpResponse future1 = WS.. url( http://server/api/one ).. getAsync(); Future HttpResponse future2 = WS.. url( http://server/api/two ).. getAsync(); Future HttpResponse future3 =  ...   s response is slow, and your users are unhappy.. So here is how you can free the thread while you wait for the remote server to respond.. The following code is an action, within a controller:.. private static Future HttpResponse response; public static void mirrorFeed() throws Exception { if (request.. isNew) { response = WS.. url( http://planet.. playframework.. org/feed ).. getAsync(); waitFor(response); } else { renderXml(response.. getXml()); } }.. This can be tricky to understand at a first glance, so here is the process.. Your action gets called a first time: request.. isNew is true.. An asynchronous HTTP call is made to the playframework.. org server.. The waitFor(Future.. )" (static method on the Controller class) tells Play to wait until the response is received.. ?>.. When the answer is ready, Play will call the action again.. This time, request.. isNew is false.. We know that the Future is ready so we can do a get() to retrieve the HttpResponse instance.. Here we re just serving it to the user, but you see how we could parse the feed to use just some information in our response.. So here you go: the use of an asynchronous call prevents to block an execution thread, and the performance of your application will not be affected by the response time of the remote server.. When you should still use a job.. While the waitFor trick prevents you from blocking a Play thread, your user still has to wait for the web service call to be back before he gets his response.. In other words, your application may feel slow to the user.. When the information you need is general enough, for example when it comes from a public feed, it can still be a better approach to keep the information up-to-date using a job.. At the time the user will fetch the information it will not be the most recent, but the page will be served to the user much quicker.. This is what I am doing for the Twitter box on.. Planet Play.. : I don t pull it for each visitor at request time (that would be insane), but I have a Job refreshing the information every 5 minutes.. Any page rendered will never get anything older than 5 minutes.. @Every( 5mn ) public class TwitterJob extends Job { public void doJob() { try { TwitterSearch.. refresh( playframework ); } catch (UnsupportedEncodingException e) { Logger.. error( Error refreshing Twitter search ); } } }.. The information is then stored in cache and retrieved to render the front page..

    Original link path: /blog/2010/06/29/asynchronous-http-client-in-play-framework.html
    Open archive

  • Title: Testing in Play's Eclipse Plugin
    Descriptive info: Published on 11 March 2010.. In.. Play.. s.. Eclipse plugin.. , I just added a simple integration with the test framework.. Currently, all it does is opening the test page directly within Eclipse.. The obvious next step would be that, in case of a failure typically, links from the page brings you directly to your code at the correct line.. That would be also very useful for error pages, just like.. Guillaume.. did in his.. Textmate integration.. So I did some research, what is it possible to do with Eclipse?.. I found a.. very old bug, opened in 2001.. , to support opening files directly from the command line.. After nearly 10 years the bug is finally fixed: it s in the not-yet-released 3.. 6 version of Eclipse.. It s such a basic feature it s surprising they couldn t do it earlier, but at least they eventually did it.. So with a nightly build of Eclipse, you  ...   t want to have to search in your code for the line responsible for the error.. So I opened.. bug 305336.. Looking at the patch for bug 4922, adding the line number seems trivial to do.. I ll probably submit a patch and cross my fingers to have it in 3.. 6 before it s released.. The last piece we would need is Eclipse registering itself as a protocol handler.. That would allow us to insert URLs such as:.. eclipse://open?url=file:// qualified file name.. Again, I opened a bug (.. #305345.. ).. It s not as critical as the other items because this one can be created manually.. For Windows there s a key to add to the registry, for Gnome it s a key in gconf and for OSX I m sure there is something similar.. Of course, it would be better if it Eclipse registered itself so the user won t have to mess with his registry..

    Original link path: /blog/2010/03/11/testing-in-plays-eclipse-plugin.html
    Open archive

  • Title: Deploy a Play Application on Gandi Cloud
    Descriptive info: Published on 23 February 2010.. Gandi Cloud.. Note that, just like EC2, it s not free hosting - you have to pay for it.. But they have fairly reasonable prices.. 1.. Create a server on Gandi.. Make sure you choose a solution that gives you root access to the machine, expert mode.. In the rest I ll assume you choose Ubuntu, but any distribution would work.. 2.. Install the Requirements.. ssh to your server, and su to get root access.. Now:.. apt-get install openjdk-6-jre unzip /pre.. See how fast is the download, I bet they have a local proxy!.. 3.. Download Play.. exit to get back to regular user mode, then:.. wget http://download.. org/releases/play-1.. 1.. zip unzip play-1.. 4.. Run It!.. Now you re ready to run your app! Copy your app to your server by  ...   app.. In this case, just configure Play to run on port 80 and you re done.. But if one Gandi server part is too big for one application and you can t afford buying too many parts, you can run a web front-end to host several Play apps on the same server.. See the Play documentation about.. running in production.. for instructions on how to do it.. For the database, you could configure one manually on the same server, but it s much easier to create a separate MySQL server.. You can create a server in Gandi AI mode, where the server is managed by Gandi and you don t have direct access to it.. That way, you can create a MySQL servers in a few clicks and point your Play app(s) to that separate server..

    Original link path: /blog/2010/02/23/deploy-a-play-application-on-gandi-cloud.html
    Open archive

  • Title: Going to FOSDEM, talking about Play
    Descriptive info: Published on 23 January 2010.. I will be at.. FOSDEM.. in Bruxelles on Saturday 6 February.. I will make a talk about the Play framework in the.. Free Java session.. , at 17:15..

    Original link path: /blog/2010/01/23/going-to-fosdem-talking-about-play.html
    Open archive

  • Archived pages: 75