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.



Sunday, November 21, 2010

Testing New Sugar and OLPC Images.

For i time now, I've been focusing in other projects, and left some of sugar and OLPC,

After going back I've found that community is always improving and development Sugar and OLPC, together :). In my spare time i managed to test new builds on an Xo 1.5

the documentation is here:

  • http://wiki.laptop.org/go/Release_notes/10.1.2
But the fun part is to test latest builds...

  • http://build.laptop.org/F14/os2/xo-1.5/
  • http://wiki.sugarlabs.org/go/Dextrose

The last one, refers to F14 images for all XOs, the dextrose part refers to
Sugarlabs work to bring latest Sugar to all types of XO.
The great opportunity here is to unite these efforts to launch a Dextrose version
together with OLPC, Sugar Labs, Activity Central..and other parties working on this.

Anyways these images still need a lot of testing, but there are many people out there working on it.




Sunday, May 23, 2010

Sugar Love

I'm beginning to spend some time working on sugar, my focus of interest is making improvements in bugs or procedures in order to have latest versions of Sugar available for deployments, Bernie Innocenti has been taking great steps in doing so all work is grouped here:

  • http://wiki.sugarlabs.org/go/Deployment_Team/Sugar-0.88_Notes

This is the Spanish translation that I've made:

  • http://wiki.sugarlabs.org/go/Deployment_Team/Sugar-0.88_Notes/lang-es
Great people from Paraguay and Uruguay are merging their code work (fixing deployment issues), to upstream, this coordinated work will have tremendous impact in Sugar's future evolution and will strength the community.

I've been helping also uploading latest versions of Scratch by Jhon Maloney to our activities library.

  • http://activities.sugarlabs.org/es-ES/sugar/addon/4249
  • http://wiki.laptop.org/go/Scratch


These are concrete development goals to tackle.

0) Activities and overall Bugs

=== Sugar Critical Goals ===
1) Clear and complete error messages (even for crashes)
http://bugs.sugarlabs.org/ticket/1366
http://bugs.sugarlabs.org/ticket/630

2) Checks to prevent installation of incompatible activities
http://bugs.sugarlabs.org/ticket/1442

3) Keyboard navigability of the shell and activity toolbars
http://bugs.sugarlabs.org/ticket/1969
(gonzalo)

4) Make activities work in Gnome without Sugar (CONTROVRSIAL)

5) Make Gnome applications work seamlessly within Sugar

6) Webkit integration
(lucian)

7) Faster activity startup / memory savings
(quozl?)

8) Integration with social networks
(lfaraone?)

9) Bidirectional Journal gateway for Gnome
(torello, jasg)

10) Memory management
Idea: show memory icon in the frame with free memory

11) OS: "Panic key" to restore default settings for GNOME and Sugar