The new Fashion Blogging: Markdown + Dropbox

A new blogging style is surfacing at internet.

A new fashion that combine Hosting engine + Markdown style documents + Dropbox cloud storage.

You can tell it's not new, probably you are right.

But only because, a lot of people were using Markdown as their document format for blogging to Wordpress, Blogger, Octopus, LiveJournal and many more.

They key here, is that, those people was doing in the hard way:

They were converting their Markdown documents to HTML for pasting into traditional blogging system.

Actual system:

1) Write your plain text document with Markdown style

2) Render to HTML

3) Paste into Wordpress,Blogger,etc

for updates run step 1)
--- you got a draft

4) Publish

What about a backup of my posts ?

 It varies depending on the services, but one thing is shared : the format is not "standard", so, for :

Moving from WordPress to Blogger ?

You will need to use some tool that recognize those formats to be able to migrate data.

The blog will be self-hosted? Will be on a hosting provider ? I will have access to my data ? Will i be able to use my favorite text editor like Sublime Text for easy blogging ? My followers will be able to read me, outside my blog ? What about if i want to move to another blogging system? I will be able to migrate all my posts ?

See the problem ?

But we are lucky because a new fashion that combine Hosting engine + Markdown style documents + Dropbox cloud storage is surfacing at internet.

How it works ?

1) Write your plain text document with Markdown style and save in your Dropbox folder X for automatic synchronization

for updates run step 1)

-- you got a draft

2) Publish

And that's all.

You don't need to render to html for pasting.

You just write in simple plain text, and that will be your format, no more posts on inaccessible databases, no rare format for storing posts.  No more tools for rendering to HTML, no more limited possibilities for your posts.

Your posts are in plain text and you own your data!

Need more? Just give a try to the new fashion xD


http://scriptogr.am and my example :D  http://scriptogr.am/yeradis

There are alternatives available, but use Google xD 

Enhanced by Zemanta


WebP - A new image format for the Web by Google

I haven't performed a scientific analysis :D

But, based on sample images...

I must confess, that, i'm overall high surprised at how well WebP preserves image quality and keeps file size small.

This post is only about thinking in WebP to, possibly, replace JPEG. At less, as a trial. I will take the risk xD.

[1] The format was first announced in 2010 and is supposed to be a new open standard for lossily compressed true-color graphics on the web, thereby being presented as a direct competitor to the older JPEG scheme, to which it is meant to compare favorably with the production of smaller files for comparable image quality.

[2] WebP is a new image format that provides lossless and lossy compression for images on the web. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller in size compared to JPEG images at equivalent SSIM index. WebP supports lossless transparency (also known as alpha channel) with just 22% additional bytes. Transparency is also supported with lossy compression and typically provides 3x smaller file sizes compared to PNG when lossy compression is acceptable for the red/green/blue color channels.
Seems great right ?

But as every new thing, we need codecs, so, for watching WebP Images, our browser must support it.

What about some samples?

JPEG sample - 1024 x 752 -120.78 Kb

WebP sample - 1024 x 742 - 80.76 Kb

JPEG sample - 2592 x 1944 - 972 Kb
JPEG sample - 2592x 1944 - 972Kb

WebP sample - 2592x 1944 - 280 Kb
WebP sample - 2592x 1944 - 280Kb

Nice right ?

If you want to watch more samples, go to :


1. http://en.wikipedia.org/wiki/WebP
2. https://developers.google.com/speed/webp/


Check Fragmentation on SQL Server

In the database life cycle, the fragmentation is something common.

When the database is frequently updated via INSERT, UPDATE, or DELETE statements we can expect it to become fragmented over the time.
The problem is, that, when database indexes are fragmented, the query optimizer will not do optimal decisions when using indexes to resolve a query, so, overall performance will be affected.

How to ask to SQL Server wich indexes are fragmented?

       b.name AS [INDEX],
       ps.avg_fragmentation_in_percent AS FRAGMENTATION
FROM   sys.dm_db_index_physical_stats (@db_id, NULL, NULL, NULL, NULL) AS ps
       INNER JOIN sys.indexes  AS b
            ON  ps.OBJECT_ID = b.OBJECT_ID
            AND ps.index_id = b.index_id
       JOIN sys.objects        AS o
            ON  o.object_id = ps.object_id
WHERE  ps.database_id = @db_id
AND PS.avg_fragmentation_in_percent > 5 AND b.name IS NOT NULL

The query result, as you can see, will provide you:


Now, you can evaluate and decide de-fragmentation strategy.

Just remember that depending on the fragmentation value, for the index de-fragmentation operation you will need to REBUILD or to REORGANIZE.

What Microsoft  recommend is:

FRAGMENTATION AVG PERCENT valueCorrective statement
> 5% and < = 30%
> 30%


Hello Red Hat OpenShift !!! Bye bye Google App Engine!

OpenShift is an enterprise-class Platform-as-a-Service (PaaS).

But, unlike Google App Engine....

OpenShift provides enterprise developers with a wide selection of programming languages and frameworks including Java, Ruby, PHP, Perl, Python, and Node.js.

OpenShift uses an open source ecosystem to provide key platform services for mobile applications (Appcelerator), NoSQL services (MongoDB), SQL services (Postgres, MySQL), and provides an enterprise-class middleware platform for Java applications with JBoss (JBoss Enterprise Application Platform,JBoss Application Server), providing support for Java EE6 and integrated services such as transactions and messaging, which are critical for enterprise applications.

It also provides integrated developer tools to support the application lifecycle, including Eclipse integration, JBoss Developer Studio, Jenkins, Maven, and GIT.

OpenShift enables you to create, deploy and manage applications within the cloud. It provides disk space, CPU resources, memory, network connectivity, and an Apache or JBoss server. Depending on the type of application you are building, you also have access to a template file system layout for that type (for example, PHP, Python, and Ruby/Rails). OpenShift also generates a limited DNS for you.

Compared to Google AppEngine solution, OpenShift is closer to a VPS rather than traditional PaaS solutions.

So, why i love OpenShift over AppEngine ?

Because OpenShift takes a No-Lock-In approach to PaaS and you can code "anything" on there.

We don't have to develop for a specific box, using specific libraries, avoiding locking our code to that PaaS solution.

You can run on OpenShift a simple code or something bigger like Wordpress,Magento,Joomla,Zend Server, etc.

Here a simple example:

//Create App
rhc app create –a twt -t python-2.6

//Add MongoDB NoSQL Database
rhc app cartridge add -a twt -c mongodb-2.0

//Add Upstream Repo
cd twt
git remote add upstream -m master git://github.com/openshift/openshift-twt-mongo-demo.git
git pull -s recursive -X theirs upstream master

//Push Repo
git push


So, lets give it a try ;)



Standalone Flask WSGI running under Tornado , Twisted or Built-in server

Make your Flask Microframework stuff "portable" and ready for "production" with Tornado or Twisted. 
And if necessary, you can turn on the development server.

Is true that “Micro” does not mean that your whole web application has to fit into a single Python file, but this sample goes in that way.

I writing this, because the built-in server provided by Flask is great but just for development, can be tuned, still not good enough, so, what about if you want your flask ready for "production", something like serving 1000 request/s ?

In this sample, you will find how to run your Flask WSGI under Tornado and Twisted, but in the embedded way.

Just to remember:

Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed.

Twisted is an event-driven networking engine that supports many common network protocols, including SMTP, POP3, IMAP, SSHv2, and DNS.

So, here you go:

import optparse
from flask import Flask
app = Flask(__name__)

def hello():
    return 'Hello World!!! A Flask WSGI under Twisted/Tornado/Built-in development server...'

__port = 701

def getPort(value):
    return (__port, value)[value > 0]

def tornado(option, opt_str, value, parser):
    print 'Tornado on port {port}...'.format(port=getPort(value))
    from tornado.wsgi import WSGIContainer
    from tornado.httpserver import HTTPServer
    from tornado.ioloop import IOLoop

    http_server = HTTPServer(WSGIContainer(app))

def twisted(option, opt_str, value, parser):
    print 'Twisted on port {port}...'.format(port=getPort(value))
    from twisted.internet import reactor
    from twisted.web.server import Site
    from twisted.web.wsgi import WSGIResource

    resource = WSGIResource(reactor, reactor.getThreadPool(), app)
    site = Site(resource)

    reactor.listenTCP(getPort(value), site, interface="")

def builtin(option, opt_str, value, parser):
    print 'Built-in development server on port {port}...'.format(port=getPort(value))

def main():
    parser = optparse.OptionParser(usage="%prog [options]  or type %prog -h (--help)")
    parser.add_option('--tornado', help='Tornado non-blocking web server', action="callback", callback=tornado,type="int");
    parser.add_option('--twisted', help='Twisted event-driven web server', action="callback", callback=twisted, type="int");
    parser.add_option('--builtin', help='Built-in Flask web development server', action="callback", callback=builtin, type="int");
    (options, args) = parser.parse_args()

if __name__ == "__main__":


JSON Schema Document

JSON Schema = A JSON Media Type for Describing the Structure and Meaning of JSON Documents

A standard which provides a coherent schema by which to validate a JSON data against.

JSON (JavaScript Object Notation) Schema defines the media type "application/schema+json", a JSON based format for defining the structure of JSON data, providing a contract for what JSON data is required for a given application and how to interact with it.

JSON Schema is intended to define validation, documentation, hyperlink navigation, and interaction control of JSON data.

Having a JSON Schema Document  is something very useful, because right now, is a mess when you try to consume JSON data or publish an API to clients.

Why ? Because you don't know the correct structure,types and all possibilities of a JSON Document.

I mean, having a JSON like this:

2. "address":{
3. "streetAddress": "21 2nd Street",
4. "city":"New York"
5. },
6. "phoneNumber":
7. [
8. {
9. "type":"home",
10. "number":"212 555-1234"
11. }
12. ]

Seems correct right ? Yeah! Sure!

But, you don't know:

  • Required/mandatory items: so you dont know whats is missing.
  • Item types: The value received will be a String, Integer,Float,Double,Decimal,Currenty,etc ? will be another Item ?
  • Item size/length: The value will be 5 chars max? 3 minimum?
  • Item structure: This item will be a complex one, having nested structures?
  • Items data constraint/format: Item just accept 5 chars but for a specify pattern, or specific values from a list(constants), will be a string but just accepting data in Date format like dd/MM/yyyy
  • Item Arrays: How many elements ? just 1?  max 5? min 2? 
  • etc :D
Do you understand what i mean ?


Read more about JSON Schema at : http://tools.ietf.org/html/draft-zyp-json-schema-03

Tip: JSON Schema means for JSON data what XML Schema (XSD) means for XML data.


Create a Calendar event from web page info - Bookmarklet

Someone asked me if I knew how to create an event in Google Calendar using the address of a contact.

To be honest, I did not know if this was possible.
But after a little searching, I found it was something many were asking.

So i set this challenge: Make a Bookmarklet to create events using information from a web page.

Mainly contact information, but , I gave up this idea after trying to understand the page code of Google Contacts xDDDD

So, for the event i will use two sources of information:

1) The web page title
2) The text you select/mark on the web

This Bookmarklet will create a Google Calendar event with this info:

title            :  the title from the current web page.
where        : here will appear the selected text    
description : here will appear the selected text 

Here is the code, feel free to use it or improve it

var title=document.title;
var url='';
var space=' ';
var body, popw;
if(document.selection) {
} else if (window.getSelection) {
} else if (document.getSelection) {
function buildCalendarURL(eventDetails) {
    return "http://www.google.com/calendar/event?action=TEMPLATE&trp=false" +
    "&text=" + eventDetails.title +
    "&location=" + eventDetails.location +
    "&details=" + eventDetails.details +
    "&sprop=" + eventDetails.url;
var eventDetails = new Object();
eventDetails.title = escape(title);
eventDetails.location = escape(body);
eventDetails.details = escape(body);
eventDetails.url = escape(location.href);
url = buildCalendarURL(eventDetails);
popw = window.open(url,'gcal','scrollbars=yes,width=1000,height=600,top=175,left=75,status=no,resizable=yes');
if (!document.all) T = (setTimeout('popw.focus()',50));

Creative Commons License This page is powered by Blogger. Isn't yours?