Fecha: June 8th, 2010 | Categoría: Internet | 1 Comment »
It wastes a lot of space and looks ugly!
This is how it is now:

This is how I think it should be:

UPDATE 13/06/2010: Wikipedia has recently changed the name of one of the divs, now this should be working again.
Here is a javascript line to solve it (you can bookmark it if you liked it):
Solve Wikipedia bad Layout
-
right = document.getElementById("right-navigation");
-
right.style.setProperty("margin-right", "270px", "");
-
right.style.setProperty("margin-top", "0px", "");
-
document.getElementById("mw-head-base").style.setProperty("height", "40px", "");
-
document.getElementById("left-navigation").style.setProperty("top", "0px", "");
-
document.getElementById("p-personal").style.setProperty("top", "10px", "");
Fecha: February 5th, 2010 | Categoría: Internet | 12 Comments »
As my mother tongue is not english, I’ve been always appreciative of things like Ted Translations, because it allows me to share my findings on the web with people from my country, where not everybody is as fluent in english as to hear and understand every word of a TED Talk. But I’ve found annoying that you could watch the video with subtitles online, but you couldn’t download them in a appropriate format (I generally use the ‘.srt’ format).
I did some research, created a python script that lets you download the subtitles, and parse them from JSON to the ‘.srt’ format; but in these days a black-and-white command-line script is not acceptable. So I made it my first web-app, a TED Talk Subtitle Downloader.
http://tedtalksubtitledownload.appspot.com/
(online implementation of http://estebanordano.com.ar/ted-talks-download-subtitles/)
Fecha: January 5th, 2010 | Categoría: Internet | 13 Comments »
Go to the Online version
This is what I’ve been working on today. It’s a simple console-based script to download subtitles for TED Talks – since I haven’t found a way to download them directly from the web in a compatible format (I generally use ‘.srt’ subtitles). Here is the script made in python. TEDTalkSubtitles.py
Key parts of the program:
A simple function to parse the value in miliseconds to something like “00:34:32,334″:
-
def getFormatedTime(intvalue):
-
mils = intvalue%1000
-
segs = (intvalue/1000)%60
-
mins = (intvalue/60000)%60
-
hors = (intvalue/3600000)
-
return "%02d:%02d:%02d,%03d"%(hors,mins,segs,mils)
With this recursive function, fetch available languages for the talk
-
def availableSubs(subs):
-
a = subs.find("LanguageCode")
-
if a == -1:
-
return []
-
subs = subs[a+len("LanguageCode"):]
-
return [re.search("%22([^A-Z]+)%22", subs).group(1)] + availableSubs(subs)
Get information about the video
-
def getVideoParameters(urldirection):
-
ht = urllib.urlopen(urldirection).read()
-
var = re.search(‘flashVars = {\n([^}]+)}’, ht)
-
if var:
-
var = var.group(1)
-
else:
-
return None
-
var = [a.replace(‘\t‘, ”) for a in var.split(‘\n‘)]
-
for a in range(len(var)):
-
if var[a]:
-
var[a] = var[a][:var[a].rfind(‘,’)]
-
resultado = []
-
for a in var:
-
l = a.find(‘:’)
-
if l != -1:
-
resultado.append((a[:l], a[l+1:]))
-
return dict(resultado)
Getting it all together:
-
def downloadSub(idtalk, lang, timeIntro):
-
print("Downloading subtitles for language %s"%lang)
-
c = simplejson.load(urllib.urlopen(‘http://www.ted.com/talks/subtitles/id/%s/lang/%s’%(idtalk, lang)))
-
salida = file(’subs_%s_%s.srt’%(idtalk,lang), ‘w’)
-
conta = 1
-
c = c[‘captions’]
-
for linea in c:
-
salida.write("%d\n"%conta)
-
conta += 1
-
salida.write("%s –> %s\n"%(getFormatedTime(timeIntro+linea[’startTime’]), getFormatedTime(timeIntro+linea[’startTime’]+linea[‘duration’])))
-
salida.write("%s\n\n"%(linea[‘content’].encode(‘utf-8′)))
-
salida.close()
Related to:
Parsing and Converting TED Talks JSON Subtitles
Download subtitles from TED talks for offline viewing
Fecha: October 7th, 2008 | Categoría: Internet | No Comments »
Dos cosas “locas”:
“Mail Goggles” de GMail
Bueno, esta funcionalidad nueva que tiene gmail es para “evitar mandar mails que vas a lamentar”. Básicamente, es para que no mandes mails borracho. Al apretar Send, hay que resolver unas operaciones matemáticas básicas antes de que gmail nos permita mandar el mail.
Dead Man’s Switch
Escribí mensajes que quisieras que otras personas leyeran en caso de que mueras. Si durante cierto tiempo no respondés los mails, se disparan los mensajes a las direcciones de correo que hayas seleccionado.