Categories
Technology and Internet

Django Resources

As I said in earlier posts in this blog, when i build websites or webapps where there are no technology impositions, i usually choose to do it in Python and in most of the cases, that’s the equivalent to say i choose to do it in Django.

Over the last year, since i started using Bundlr,  I’ve been aggregating some resources like blog entries, tutorials and videos that i found useful and that could become handy in the future.

Today I’m sharing the collection here, since it might helpful to someone else. I hope you like it and if you know more references that should be included in the list, please share it in the comments or send me an email.

The list can be found here.

Edit July 2016: Since I removed my account, the list is not longer available on Bundlr. Check recent posts, it will be published again soon.

Categories
Technology and Internet

Starting out with Meteor.js

For some time now, I’ve this urge to try to build something using meteor.js just for test purposes and to check what i can do with this framework that everybody is talking and writing about. So a few days ago i decided to give it a go, i installed meteor and I have put everything into place to start developing (and learning, while doing it of course).

The problem was that i was short in ideas for a small project, the ones that came to my mind were a bit too complex for my first app and specially for the time i wished to spend on it. After a while, the solution came in the form of an eureka moment and decided to build the most original piece of software ever, a To-Do List.

Ok, that wasn’t my brightest moment but at least i had something. To increase the difficulty of the task a little bit, i tried to build a simple clone of flask.io (without the good look), a tool that as Lifehacker says, lets you “create shareable To-Do lists on the fly, no account required”. Plus i added for each task a “progress feed” that lets you know what’s going on and what recently changed in it (good for shared tasks).

So in the next “few” lines i will describe the most important steps i took to build this thing (summed) and since this was a discovery project probably you will find some stuff that could be done in a better way. The git repository with the code can be found here.

To try it out, an instance of this application is running at rapido.ovalerio.net.

Categories
Old Posts

Recovering your bookmarks

Some time ago, while cleaning stuff in my computer, I decided to switch my browser to Opera and delete the version of Firefox that I was using at the time. While doing that and removing all the Firefox folders that are left behind, I accidentally erased all my bookmarks and I didn’t had them synced with some on-line service. Well that wasn’t good, I had references stored there that I wanted to keep.

When trying to recover the file ‘places.sqlite’ I found an bookmark backup generated by Firefox. When I opened the file I found that it was a mess, basically it was bunch of big JSON objects stored in one line containing lots of garbage (I only needed the urls).

I kept that file until today, when I finally decided that I would put those bookmarks again in my browser. As Opera doesn’t import this kind of files, I made a little python script that extracts the names and urls of the backup and generates a single file that opera can import, while keeping the folder structure.

Well, it worked, so I tought it might be usefull to someone else and pushed it to github. If any of you ever have the same problem give it a shoot and use this “quick fix”. You can find it here with some instructions on how to use it. If you find any problem, use the comments and github issues.

Categories
Old Posts

Time to start coding

codeyearlogoIn last months of 2011 one fever started throughout the web, specially in the tech blogs and aggregators, about whether or not people should have some programing skills. It’s true that in the technological society that we live in, the ability to code and automate some tasks is very useful.

So, like in any other time when there was a need, a bunch of startups appeared trying to fill that gap. This time that need is to teach the general public how to code and one of companies in the race is Codecademy, which describe itself like this:

“Codecademy was created out of the frustrations Zach and Ryan felt with learning how to program. Tired with less effective text and video resources, Ryan and Zach teamed up to create Codecademy, a better, more interactive way to learn programming by actually coding. This is just the beginning. Join us as we make it easy for everyone to love and learn how to code.”

I’m writing about this company because they had the great idea (for their business) to declare 2012 as the  “Code Year”. So every Monday during this year they will give the participants one interactive lesson, with one simple objective in mind, that until the end of 2012 the people who accepted the challenge will be able to create their own apps and websites.

I already know some programing languages and last year I decided that I would learn the Python‘s web framework “Django”, so I could be able to build my web apps (I have had one workshop about Rails but I sticked with this one for now). The problem is that this framework is mostly for the backend/server-side and now I need some knowledge about one client-side technology, so I can be able make the interaction with the user more pleasant and fluid.

This is where the “Code Year” is being very useful to me. They are teaching JavaScript and that was precisely what I needed. So every week since the beginning of 2012 I’m taking the lessons.  Until now it has been like “1+1=2”, because I already knew some of the basic stuff but the difficulty will rise in the next few weeks.

You can follow my progress here and I recommend, if you want to start programing and have no hurries, to try the Code Year lessons.

Categories
Old Posts

Simple Ceaser-Cypher

Some weeks ago i found this website called “Programming Praxis“, where you can find exercices to practice your programming skills. So every week they post a new problem and a possible resolution (it’s better if you only see it after you’ve done yours), and people try to solve and add a comment with their solution which is fun because you can see diferent ways of thinking in diferent languages.

So i will try once in a while (when time isn’t short) to solve some problems and post here my solutions (generally in python, but i will try other languages too). For this first time i have picked an old and simple problem posted in 2009 (here) about the Ceaser-Cypher which is basically an ancient, simple an totally insecure encryption method, where you add 13 to every letter in the sentense (example: “a” + 13  =  “n”) and when it reaches “z” you return to “a” (example: “t” + 13 = “h”).

So here is the function and the answer to their question:

def ROT13(string):
	new_string=""
	for i in string:
		letter=ord(i)
		if (letter>=65 and letter<=90) or (letter>=97 and letter<=122):
			if letter<=90 and letter+13>90:
				new_string += chr(64+(letter+13-90))
			elif letter<=122 and  letter+13>122:
				new_string+=chr(96+(letter+13-122))
			else:
				new_string+=chr(letter+13)
		else:
			new_string+=i
	return new_string 

Question: What is the meaning of “Cebtenzzvat Cenkvf vf sha!”?
Answer: Programming Praxis is fun!

P.S: I know that the solution could be more elegant but for now this one does the job

So i will try once in a while (when time isn

Categories
Old Posts

E-mails: hours to seconds

I remember those old times when i didn’t know nothing about computer programming and i was a member of the organization of the National Meeting of students of physiotherapy and after a conference about physiotherapy and spine related problems. At that time when we had to send some hundreds or even thousands of emails for other students and professional on that field, we spent hours or even days.

One of the problems was that our email provider (Gmail) didn’t allow to send a single email for more than ‘x’ people or send more than ‘y’ emails a day,if you had exceeded the limit they would block your account for the next 24 hours. For that problem the solution is don’t use Gmail for what it isn’t intended for. There are plenty other services to do that.

The other problem was the use of large files, full of emails adresses that we had to split through many emails. For this one, here is a possible solution, a script that connects to a SMTP server and sends the message to every contact in the “.txt” file.

import smtplib
from email.MIMEText import MIMEText

def send_to_all(server,login,passwd,subject,msg, cfile):
	contacts=open(cfile, 'r')
	email=MIMEText(msg)
	email['Subject']=subject
	email['From']=login
	
	smtp=smtplib.SMTP(server, 465) #change for 587 if doesnt work
	smtp.ehlo()
	smtp.starttls() #comment this line if the server doesnt support TLS
	smtp.login(login,passwd)
	
	for item in contacts:
		smtp.sendmail(login,item,email.as_string())
		
	smtp.close()

def main():
	#Asks the info to the user
	print "Server: "
	server=raw_input()
	print "Login: "
	login=raw_input()
	print "Password: "
	passwd=raw_input()
	print "Subject: "
	subject=raw_input()
	print "Message: "
	msg=raw_input()
	print "Contacts file: "
	cfile=raw_input()
	#sends the message to all contacts in the file
	send_to_all(server, login, passwd, subject, msg, cfile)
	return 0

if __name__ == '__main__':
	main()

With this script you can only send simple text messages, but it might be usefull for someone anyway.