ese dia fue para mi hoy :)
algunas fotos y un video
el album completo aca








var page = $("html");
page.html($(".l"));
$('.l').wrap('<li></li>');
page.wrapInner('<ul></ul>');



import os
import sys
import gtk
# https://bugs.launchpad.net/bugs/480398
gtk.gdk.threads_init()
import webkit
class Webless(object):
def __init__(self, url=''):
self.view = webkit.WebView()
self.open(url)
def inject_file(self, path):
'''run a script in a file'''
if os.path.isfile(path) and os.access(path, os.R_OK):
self.inject_script(file(path).read())
return True
return False
def inject_script(self, script):
'''run a script'''
self.view.execute_script(script)
def get_code(self):
'''return the text of the widget'''
self.view.execute_script('oldtitle=document.title;document.title=document.documentElement.innerHTML;')
html = self.view.get_main_frame().get_title()
self.view.execute_script('document.title=oldtitle;')
return html
def open(self, url):
if not url.startswith('http://') and not url.startswith('https://'):
self.url = 'http://' + url
else:
self.url = url
self.view.open(self.url)
class Browserless(gtk.Window, Webless):
def __init__(self, url=''):
gtk.Window.__init__(self)
Webless.__init__(self, url)
self.add(self.view)
class Browser(gtk.Window, Webless):
def __init__(self, url=''):
gtk.Window.__init__(self)
Webless.__init__(self, url)
self.set_title('Browser')
self.set_default_size(640, 480)
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroll.set_shadow_type(gtk.SHADOW_IN)
scroll.add(self.view)
vbox = gtk.VBox()
hbox = gtk.HBox()
entry = gtk.Entry()
entry.connect('activate', self._on_url_changed)
if self.url:
entry.set_text(self.url)
code = gtk.Entry()
code.connect('activate', self._on_run_code)
getcode = gtk.Button("html to clipboard")
getcode.connect('clicked', self._on_get_code)
hbox.pack_start(code, True, True)
hbox.pack_start(getcode, False)
vbox.pack_start(entry, False)
vbox.pack_start(scroll, True, True)
vbox.pack_start(hbox, False)
vbox.show_all()
self.add(vbox)
self.connect('delete-event', lambda *args: sys.exit(0))
def _on_get_code(self, button):
'''copy the content of the html window to the clipboard'''
code = self.get_code()
gtk.clipboard_get().set_text(code)
def _on_url_changed(self, entry):
'''called when the url changes'''
url = entry.get_text()
self.open(url)
def _on_run_code(self, entry):
'''called when the url changes'''
code = entry.get_text()
self.inject_script(code)
def process_events():
while gtk.events_pending():
gtk.main_iteration(True)
if __name__ == '__main__':
browser = Browser('www.google.com/search?q=emesene')
def inject_fun(view, frame):
browser.inject_file('js/jquery.js')
browser.inject_file('js/json2.js')
browser.view.connect('load-finished', inject_fun)
browser.show()
gtk.main()

import sys
import gtk
# https://bugs.launchpad.net/bugs/480398
gtk.gdk.threads_init()
import webkit
class Browser(gtk.Window):
def __init__(self, url=''):
gtk.Window.__init__(self)
self.set_title('Browser')
self.set_default_size(640, 480)
self.url = url
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroll.set_shadow_type(gtk.SHADOW_IN)
self.view = webkit.WebView()
scroll.add(self.view)
vbox = gtk.VBox()
entry = gtk.Entry()
entry.connect('activate', self._on_url_changed)
if self.url:
entry.set_text(self.url)
entry.activate()
vbox.pack_start(entry, False)
vbox.pack_start(scroll, True, True)
vbox.show_all()
self.add(vbox)
self.connect('delete-event', lambda *args: sys.exit(0))
def _on_url_changed(self, entry):
'''called when the url changes'''
self.url = entry.get_text()
if not self.url.startswith('http://') and not self.url.startswith('https://'):
self.url = 'http://' + self.url
self.view.open(self.url)
if __name__ == '__main__':
browser = Browser('www.google.com')
browser.show()
gtk.main()
Algunos saben, otros no, pero con mi hermano y un amigo estamos trabajando en un proyecto llamado travlr in hace ya casi un año..
Si bien no esta 100% completo, ya se puede usar, asi que pensamos que es hora de empezar a pasar verguenza! :P
El proyecto se llama travlr.in (traveler in - viajero en) y pueden encontrarlo en www.travlr.in
Travlr.in pretende responder a las típicas preguntas: que hacer? donde? cuando? y tambien mostrarte que cosas hay a tu alrededor, que puede ser desde negocios, plazas, bares y hospitales hasta fiestas para el fin de semana y eventos historicos que sucedieron en cualquier parte del mundo.
Si sos de Córdoba vas a ver que el centro de la ciudad esta lleno de informacion, ya que nos tomamos el trabajo de salir y tomar nota de todos los negocios, telefonos publicos, puestos de diarios y revistas, paradas de colectivos y un largo etcetera (faltan un par de cuadras y el centro estaria completo).
El sistema no tiene mucha informacion actualmente, ya que la idea es que cada uno ponga lo que le interese de su alrededor para compartirlo con el resto. Algo así como una wikipedia de lugares y eventos, mantenida por la comunidad..
Si tenes un negocio podes cargarlo en travlr.in, si haces una fiesta tambien! cualquier cosa es posible, no pretendemos imponer ninguna estructura sobre lo que se puede poner en el mapa y lo que no, simplemente queremos que les sea una herramienta util a cada uno de ustedes, sin importar si estan marcando todos los arboles de córdoba o quizas puntos de avistamiento de ovnis, no nos importa! a mas información y mas variada mejor!
Como se usa?
Cualquiera puede buscar contenido en travlr.in sin necesidad de una cuenta, pero si deseas crear contenido, solo tenes que entrar a travlr.in, clickea en “ingresar” y luego en “Registrarse”, create una cuenta y ya podes crear cualquier cosa!
Para buscar, solo tenes que posicionar el mapa en donde sea que te interese buscar algo, escribir en la barra de busqueda y darle click a la lupa.
Para crear, solo tenes que clickear en + y luego hacer click en donde sea que esto se encuentre para localizar lo que sea que estes creando, luego agrega informacion sobre el elemento creado y listo! Ya podes crear eventos sobre ese lugar, agregar fotos, videos, comentarios, etc
Mucha mas informacion y en mas detalle en www.wiki.travlr.in
Se aceptan criticas de cualquier tipo, a no abstenerse que las necesitamos!
<div id="upload">
<form id="upload-form" method="POST" action="" enctype="multipart/form-data">
<p id="upload-msg"></p>
<label for="_attachments">Archivo</label>
<input type="file" name="_attachments" id="image-file"/>
<div class="buttons">
<input type="hidden" value="" name="_rev"/>
<button onclick="return ui.upload();">Adjuntar</button>
</div>
</form>
</div>
</div>
// en algun lado del init correr esto
$('#upload-form').ajaxForm();
ui.upload = function () {
var id = $("input[name='_id']").val(), form = $('#upload-form'), field = $('#image-file');
if (field.val().trim() === '') {
ui.error("Archivo no seleccionado");
return false;
}
else {
form.ajaxSubmit({
url: req.base + id,
success: function(resp) {
field.val('');
ui.message('Imagen adjuntada');
}});
}
};
[httpd_global_handlers]
/ = {couch_httpd_misc_handlers, handle_welcome_req, <<"Welcome">>}
favicon.ico = {couch_httpd_misc_handlers, handle_favicon_req, "/usr/share/couchdb/www"}
_utils = {couch_httpd_misc_handlers, handle_utils_dir_req, "/usr/share/couchdb/www"}
[snip]
editor = {fresita, redirect_editor}
_export = {fresita, export_document}
_style = {fresita, export_style}
-module(fresita).
-export([redirect_editor/1, export_document/1, export_style/1]).
redirect_editor(Req) ->
couch_httpd:send_redirect(Req, "/fresita/_design/fresita/index.html").
export_document(Req) ->
"/" ++ UrlPath = couch_httpd:path(Req),
[_Export, Database, InputId, Output, StyleId, Format, _FileName] = string:tokens(UrlPath, "/"),
Command = "python /var/lib/fop/export.py --type id --input " ++ InputId
++ " --output /tmp/" ++ Output ++ " --style " ++ StyleId ++ " --format "
++ Format ++ " --url http://localhost:5984/" ++ Database ++ "/",
log(UrlPath),
log(Command),
os:cmd(Command),
couch_httpd:serve_file(Req, Output ++ "." ++ Format, "/tmp/").
export_style(Req) ->
"/" ++ UrlPath = couch_httpd:path(Req),
[_Style, Database, StyleId] = string:tokens(UrlPath, "/"),
os:cmd("python /var/lib/fop/export.py --type style --style " ++
StyleId ++ " --url http://localhost:5984/" ++ Database ++ "/>/tmp/" ++
StyleId),
couch_httpd:serve_file(Req, StyleId, "/tmp/").
log(Text) ->
{ok, Device} = file:open("/tmp/fresita.log", [append]),
file:write(Device, Text ++ "\n").
{
"_id": "_design/search-docs",
"fulltext": {
"documents": {
"index": "function(doc) { /* algo */ }"
},
"repos": {
"index": "function(doc) { /* algo */ }"
}
"authors": {
"index": "function(doc) { /* algo */ }"
}
}
}
fulltext/
|-- authors
| `-- index.js
|-- documents
| `-- index.js
`-- repos
`-- index.js
test() ->
0 = calc:solve("1 + 2 - 3"),
6 = calc:solve("1 + 2 + 3"),
-4 = calc:solve("1 - 2 - 3"),
0.0 = calc:solve("1.0 + 2 - 3"),
6.0 = calc:solve("1 + 2.0 + 3"),
-4.0 = calc:solve("1 - 2.0 - 3"),
3.1 = calc:solve("1.0 + 2.1"),
7 = calc:solve("1 + 2 * 3"),
10 = calc:solve("2 * 3 + 4"),
7.1 = calc:solve("1.1 + 2 * 3"),
10.2 = calc:solve("2 * 3.1 + 4"),
1 = calc:solve("11 % 2"),
2 = calc:solve("1 + 11 % 2"),
11 = calc:solve("11 % 2 + 10"),
ok.
$ erl
Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [kernel-poll:false]
Eshell V5.6.5 (abort with ^G)
1> c(build_calc).
{ok,build_calc}
2> build_calc:build().
Old inliner: threshold=0 functions=[{yeccpars2_7_,1},
{yeccpars2_6_,1},
{yeccpars2_3_,1},
{yeccpars2_2_,1},
{yeccpars2_7_,1},
{yeccpars2_6_,1},
{yeccpars2_3_,1},
{yeccpars2_2_,1}]
ok
3> rl(calc).
ok
4> rl(calc_parser).
ok
5> rl(calc_lexer).
ok
6> build_calc:test().
ok
wget http://cloud.github.com/downloads/rnewson/couchdb-lucene/couchdb-lucene-0.4-jar-with-dependencies.jar.gz
unpack200 couchdb-lucene-0.4-jar-with-dependencies.jar.gz couchdb-lucene-0.4-jar-with-dependencies.jar
sudo mkdir /usr/local/var/lib/lucene
sudo cp couchdb-lucene-0.4-jar-with-dependencies.jar /usr/local/var/lib/lucene
chown -R couchdb:couchdb /usr/local/var/lib/lucene
chmod -R 0770 /usr/local/var/lib/lucene
sudo vim /usr/local/etc/couchdb/local.ini
; CouchDB Configuration Settings
; Custom settings should be made in this file. They will override settings
; in default.ini, but unlike changes made to default.ini, this file won't be
; overwritten on server upgrade.
[couchdb]
;max_document_size = 4294967296 ; bytes
[httpd]
;port = 5984
;bind_address = 127.0.0.1
[log]
;level = debug
[couch_httpd_auth]
;secret = replace this with a real secret
[external]
fti=/usr/bin/java -Dcouchdb.lucene.dir=/usr/local/var/lib/lucene -jar /usr/local/var/lib/lucene/couchdb-lucene-0.4-jar-with-dependencies.jar -search
[update_notification]
indexer=/usr/bin/java -Dcouchdb.lucene.dir=/usr/local/var/lib/lucene -jar /usr/local/var/lib/lucene/couchdb-lucene-0.4-jar-with-dependencies.jar -index
[couchdb]
os_process_timeout=60000 ; increase the timeout to 60 seconds.
[httpd_db_handlers]
_fti = {couch_httpd_external, handle_external_req, <<"fti">>}
; To create an admin account uncomment the '[admins]' section below and add a
; line in the format 'username = password'. When you next start CouchDB, it
; will change the password to a hash (so that your passwords don't linger
; around in plain-text files). You can add more admin accounts with more
; 'username = password' lines. Don't forget to restart CouchDB after
; changing this.
[admins]
marianoguerra = mysecretpassword
;admin = mysecretpassword
sudo -i -u couchdb couchdb -b
firefox http://localhost:5984/_utils/
{
"_id": "_design/search-docs",
"fulltext": {
"by_title": {
"index": "function(doc) { var ret=new Document(); ret.add(doc.title); return ret }"
},
"by_content": {
"index": "function(doc) { var ret=new Document(); ret.add(doc.body); return ret }"
}
}
}
curl http://localhost:5984/fresita/_fti/search-docs/by_title?q=ficticio
{"q":"default:ficticio","etag":"1244bf34b28","view_sig":"7368cf7d6f68ec4c60f40c52303de534","skip":0,"limit":25,"total_rows":1,"search_duration":14,"fetch_duration":0,"rows":[{"id":"9ed8514725e1dca56c57471286f5f389","score":2.556901454925537}]}
-module(build_calc).
-export([build/0, test/0]).
build() ->
leex:file(calc_lexer),
yecc:file(calc_parser),
compile:file(calc_lexer),
compile:file(calc_parser),
compile:file(calc),
ok.
Definitions.
D = [0-9]
AOP = (\+|-)
WS = ([\000-\s]|#.*)
Rules.
{AOP} : {token,{add_operator,TokenLine,list_to_atom(TokenChars)}}.
{D}+ : {token,{integer,TokenLine,list_to_integer(TokenChars)}}.
{WS}+ : skip_token.
Erlang code.
$ erl
Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [kernel-poll:false]
Eshell V5.6.5 (abort with ^G)
1> leex:file(calc_lexer).
{ok,"calc_lexer.erl"}
2> c(calc_lexer).
{ok,calc_lexer}
3> {ok, Tokens, _Endline} = calc_lexer:string("1 + 2 - 3 # esto es un comentario").
{ok,[{integer,1,1},
{add_operator,1,'+'},
{integer,1,2},
{add_operator,1,'-'},
{integer,1,3}],
1}
Nonterminals
predicate.
Terminals
add_operator integer.
Rootsymbol predicate.
Left 300 add_operator.
predicate -> predicate add_operator predicate : {unwrap('$2'), '$1', '$3'}.
predicate -> integer : unwrap('$1').
Erlang code.
unwrap({_,_,V}) -> V.
$ erl
Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [kernel-poll:false]
Eshell V5.6.5 (abort with ^G)
1> yecc:file(calc_parser).
{ok,"calc_parser.erl"}
2> c(calc_parser).
{ok,calc_parser}
3> {ok, Tokens, _Endline} = calc_lexer:string("1 + 2 - 3").
{ok,[{integer,1,1},
{add_operator,1,'+'},
{integer,1,2},
{add_operator,1,'-'},
{integer,1,3}],
1}
4> {ok, Tree} = calc_parser:parse(Tokens)
4> .
{ok,{'-',{'+',1,2},3}}
[1]> (- (+ 1 2) 3)
0
-module(calc).
-export([solve/1]).
solve(String) ->
{ok, Tokens, _Endline} = calc_lexer:string(String),
{ok, Tree} = calc_parser:parse(Tokens),
matches(Tree).
matches(A) when is_integer(A) -> A;
matches({'+', A, B}) -> matches(A) + matches(B);
matches({'-', A, B}) -> matches(A) - matches(B);
matches(_) -> error.
$ erl
Erlang (BEAM) emulator version 5.6.5 [source] [async-threads:0] [kernel-poll:false]
Eshell V5.6.5 (abort with ^G)
1> c(calc).
{ok,calc}
2> calc:solve("1 + 2 - 3 # deberia dar 0").
0
3> calc:solve("1 + 2 - 3 - 4").
-4
$ mkdir pshb
$ cd pshb
$ wget http://googleappengine.googlecode.com/files/google_appengine_1.2.4.zip
$ unzip google_appengine_1.2.4.zip
$ svn checkout http://pubsubhubbub.googlecode.com/svn/trunk/ pubsubhubbub
$ python2.5 google_appengine/dev_appserver.py pubsubhubbub/hub/
type http://localhost:8080 on your browser, you should see something like:
Welcome to the demo PubSubHubbub reference Hub server!

# we will need to fetch the tubes library and the example that we will be using.
$ git clone git://github.com/marianoguerra/tubes.git
# now we will start the example
$ cd tubes/ihasfriendz/
$ python main.py
* Running on http://0.0.0.0:8081/
* Restarting with reloader...
go to the following URL on your browser: http://localhost:8080/publish
on the Topic field enter: http://localhost:8081/atom/stream/_MYUSER_ and click publish

go to the following URL on your browser: http://localhost:8080/subscribe

go to the following URL on your browser: http://localhost:8081/files/index.html
post some content on the form, use the user you used as MYUSER


click on the feed-pulls link, there click on the run button.
when we run the feed pulls task, we tell pshb to fetch the feeds that have new content (the ones that did a post to the hub to inform that there is new content)

! on production hubs this tasks are done automatically
now we go again to the Task Queues page, there the event-delivery queue should have a number different than 0 (the number of messages that are pending to be sent to the subscribers), we click on the event-delivery and then we click on the run button.


#!/usr/bin/env sh
# create the example directory
mkdir pshb
cd pshb
CWD=$(pwd)
EXAMPLE=$CWD/tubes/ihasfriendz
wget http://googleappengine.googlecode.com/files/google_appengine_1.2.4.zip
unzip google_appengine_1.2.4.zip
svn checkout http://pubsubhubbub.googlecode.com/svn/trunk/ pubsubhubbub
# we will need to fetch the tubes library and the example that we will be using.
git clone git://github.com/marianoguerra/tubes.git
# now we will start the example
echo "run \"cd $EXAMPLE; python main.py\" on a shell to run the example"
echo "run \"cd $PWD; python2.5 google_appengine/dev_appserver.py pubsubhubbub/hub/\" on a shell to run the hub"
[ -d fresita ] && rm -rf fresita
mkdir fresita
cd fresita
echo "test" > README.txt
import os
from mercurial import ui
from mercurial import commands
from mercurial import localrepo
ui_ = ui.ui()
create = 1
path = os.path.abspath('./fresita')
def repo_initialized(path):
'''return True if the repo is already initialized'''
return os.path.isdir(os.path.join(path, '.hg'))
if repo_initialized(path):
create = 0
repo = localrepo.localrepository(ui_, path, create)
repo.add(['README.txt'])
modified, added, removed, deleted, unknown, ignored, clean = repo.status()
print 'modified', modified
print 'added', added
print 'removed', removed
print 'deleted', deleted
print 'unknown', unknown
print 'ignored', ignored
print 'clean', clean
repo.commit(text="my first commit")