Wednesday, July 30, 2014

POP and IMAP Python email parsing;

After some investigation and coding with these methot I found that IMAP is the preffered solution to do searches and actions (like marking as read), you can do that with POP but after downloading the INBOX, and then you have to unravel the result, using REGEX for example, interpret etc.
with IMAP  (https://docs.python.org/2/library/imaplib.html) you have handy all the RTFC email commands.

The code I made can be used as an example of a simple email client reader and filterer:
https://github.com/RafaelOrtiz/imap-pop, that is a request of some forum users and programmers.



Wednesday, May 28, 2014

Python-Msql connection

I've gathered some python-mysql simple connection scripts on:

https://github.com/RafaelOrtiz/python-mysqlcon

You can desing a mysql db with the available graphic tools and then use these kind of scripts, purpose can be simple apps or tests.



Tuesday, December 10, 2013

Tastypie filtering

Tastypie is a django restful api

Here is a little recipe to show only the last resource of eache model exposed as WS:



class RequestResource (ModelResource):
    """ Request webservice
    """
    class Meta:
        queryset1 = Request.objects.order_by('-id')
        queryset = queryset1.all()[:1]
        resource_name = 'requestresource'
        authorization = Authorization()

Another recipe to show also a foreing key in a given resource:

class EmployeeResource (ModelResource):
    """ Employee webservice
    """
    user = fields.ForeignKey(UserResource,'user',full=True,null=False,blank=False)

    class Meta:
        queryset = Employee.objects.all()
        resource_name = 'employeeresource'
        authorization = Authorization()

Friday, May 13, 2011

Sugar / Olpc / Google and OpenHardware

Now we have Google interested in Open Hardware,

http://blog.makezine.com/archive/2011/05/why-google-choosing-arduino-matters-and-the-end-of-made-for-ipod-tm.html

This developing platform [Android Open Accessory Kit] based on Arduino, basically enables hardware and software developers to adapt devices to Android phones and in general to Android apps.

Reading this news I remembered some efforts that We have been doing since more than three years with olpc and sugar in this sense:

http://wiki.laptop.org/go/Open_Hardware
http://wiki.laptop.org/go/Peripherals

At the software front people of the sugar community have worked on Arduino connections to Turtle Art , Turtle Blocks and Etoys.

http://wiki.sugarlabs.org/go/Development_Team/Arduino

There is now a thoughtful plan to have different software for various educational robotics kits like Lego Wedo in olpc builds.

http://wiki.laptop.org/go/11.2.0/Robotics_plan

Mostly we have been focusing on platforms for robotics learning, but I think we can move forward and make a real physical computing integration, making easy to develop both software and hardware than can talk with the XO and Sugar, taking advantage or ideas from the Google open accessory kit and its possible integrations with different industries that work with hardware devices.

We must bring these physical computing innovation to
a more wide base of people and learners (This kit is very costly), and we have this opportunity because the already begun efforts are based on the low cost platform Arduino; the combination with free software can make this a reality!.

Imagine the same quality of Google developer platforms but for lower costs and accessible for the almost two millions children that use Sugar.

Would be anyone interested in founding such an effort?.

Maybe Google ? Nahh..I'm too optimistic :).





Tuesday, April 05, 2011

Git for Sugar

One of the firsts walls or obstacles to enter Sugar development is learn our favourite control version system [git http://git-scm.com/], although somewhat counter-intuitive at the beginning, git is a very powerful tool, I wish there could be another way to have a collaborative way of development for kids, but we are not yet there.(could be other ways?)

For starters you would have to go to our web-ui git instance called [gitorious
http://gitorious.org/],

http://git.sugarlabs.org

you can clone

git clone git://git.sugarlabs.org/yourproject/mainline.git

or make a personal clone of a project of your election on the web-ui.

keep your project up-to-date with

git pull

you can also make a patch and sent it ot the developer

git format-patch HEAD^

Note: is preferable that you generate your patch from the root directory of your project.

if you want more visibility or reviews you can also send your patch to sugar-dev mail list.

git format-patch -s -1
git send-email --to maintainer --cc mailing-list filename
For example:

git send-email --to=sugar-devel@lists.sugarlabs.org 0001*.patch

as a maintainer you can apply patches, sent by others, in this case you have
a file called sugar_fixes.patch

git apply --stat sugar_fixes.patch
git apply --check sugar_fixes.patch
git apply --apply sugar_fixes.patch or git am --signoff

o make merge requests using gitorious ui.

Some commands may seem very hard, but it's a matter of practice, and the combination of command line interface and gitorious ui, could be very practical both for development in terms of code maintain and for coordinated and collaborative development between various people.




References
http://wiki.sugarlabs.org/go/Activity_Team/Git_FAQ
http://ariejan.net/2009/10/26/how-to-create-and-apply-a-patch-with-git/


Tuesday, February 01, 2011

Developing Sugar inside Sugar

I've always aproached the problem of developing in sugar but working on non-native sugar solutions for example virtualization, sugar-jhbuild [1], but never imagined to approach the problem using a native installed sugar laptop like the xo of OLPC, as it's natural one must think that having sugar installed the laptop has all the necesary tools to develop, this was almost truth for me.

bundlebuilder it's the part of sugar that manipulates .xo bundles (.zip files for activities)
and it needs git that it is not installed by default.

so all you have to do is:

yum install git


then vi [2]. (installed by default on the XO). Emacs or another editor and possibly in a near future an activity like develop [3] (still unfinished)
or similar allowing to have a python-IDE inside sugar

[1]http://en.flossmanuals.net/Sugar/Overview
[2]http://dancingpenguinsoflight.com/2009/02/python-and-vim-make-your-own-ide/
[3]http://activities.sugarlabs.org/en-US/sugar/addon/4058




Wednesday, January 05, 2011

Sugar-OLPC Woes.

In a recent mail to IAEP, Bernie Innocenti asks for self criticism in Sugar and OLPC, communities, I'll give my points of view in this post.

firstly, I want to say that for me volunteer communities that work for OLPC and Sugar in every day basis are the real underlying motor that impulse the growth of technologies applied to education yet communities are attracted by openness of discussion and ''free-ness'' of software, this is an advantage that we can't afford to lose and sometimes we are failing to give real value to it spreading the word: FLOSS.

I must say that technical growth can be achieved, although i know that we lack of resources to maintain crucial members of our development core, and there is a empty or interrogation space regarding economical opportunities of Sugar, somewhat selling machines is easier but ''selling'' pedagogy or software services is not so.

I'm now more concerned about education and pedagogical impact of our work,
and hey! my field is not pedagogy, that must be why I'm concerned (because i don't understand it :)); i feel that what OLPC and Sugar are trying to do is revolutionary, but the concepts are being applied in a damaged base, the damaged base is School, School (and more over Universities) must be re-thinked
and re-modeled, (I really like uruguay's experiments working with XOs in schools) , anyway i don't want to go deeper on this idea, because other writers are more indicated to do it. and it's not the intention of this blog.

So this re-modeling or re-thinking of schools is not going to happen anytime soon, let's focus on what we can control now: intersections between pedagogic an technological approaches.
The key process to our future improvement could be understanding these intersections and interactions, for instance we have development cycles, but we don't have pedagogical cycles, we can review easily changes in code but not how and why changes are happening in classrooms, we are adapting Sugar and XOs to technological constraints but not for pedagogical concepts or questions and this is mostly due to lack of feedback, we need people reviewing pedagogical outcomes the same way we have people reviewing quality and performance of code. There is a divergence of times between technological development and education development, but it's necessary to shorten this divergence. although it's difficult to set times i propose we must have a 6-month state of the project discussion where we take into count not only tecnological or pedagogical outcomes but rather interseptions between these two. For lack of resources if we cannot do it physically we must do it virtually. This state of the project discussions (could be associated to sugar camps), should say to us how and why to correct mistakes and in short give us better understanding of our paths and objectives.