Learning Python and Django – PT I

A month ago I subscribe to a course from a Brazilian friend, Henrique Bastos, an awesome guy that knows a lot about Python and Entrepreneurship.
My goal with this course is to learn others programming languages, and in this case, Django is the Python framework for the Web, and I think that would be a good skill to have.
I don’t know anything about Python, the only skill that I have is with C++ and Qt, and isn’t an advanced skill. And here in Brazil, a lot of my friends knows Python, and always happen a discussion about wich programming is better and why. But for me build arguments like that I need to learn the language. To see its weakness and strengths.

I’m finishing the second module of the course. And in the last lessons, Henrique focus on the test. Everything that we need to implement to handle requests and a subscription form of our app, need to have a test first. Is the TAFT method: Test all the fucking time!

In a first moment I got pissed, why not go directly to implementation? But with the development of the app and the tests that I was writing, I started to see the importance of the tests. Funny is, that in college I’m doing a class called Software Engineer II, the current topic is about tests, and how the concept of the software tests is defined and wich kind of tests we need to do in a software.

This is an example of a class inside my test.py, to check if a Post on the subscription form is valid or not:


class SubscribeInvalidPost(TestCase):
def setUp(self):
self.resp = self.client.post('/inscricao/', {})

def test_post(self):
"""Invalid POST should not redirect"""
self.assertEqual(200, self.resp.status_code)

def test_template(self):
self.assertTemplateUsed(self.resp, 'subscriptions/subscription_form.html')

def test_has_form(self):
form = self.resp.context['form']
self.assertIsInstance(form, SubscriptionForm)

def test_form_has_errors(self):
form = self.resp.context['form']
self.assertTrue(form.errors)

I’m having some difficulties on the Python syntax. Since in all my short life like a programmer was using C/C++ or even Pascal(in the very beginning), I’m used to using the syntax of them. I got kind of upset after an if() that I forgot to add the ‘:’ in the end. >.<

However, so far, I like it a lot of this course, Henrique usually says that “Python comes with batteries”, that mean, Python has all the support on the API that you need, without the need to worry about what is happening below or to implement a new class to handle some specifications. And I’m learning that.

Django has an API called Forms, it’s a library only to handle formulary data. You can clean the data and have a dictionary returned with the cleaned data, you can validate all the data from the forms: If the data is an email, the Django already checks if is a valid email. Click here for the doc.

We are using Heroku, like the platform of deploy. And damn, it’s a hell of a tool. I hope in the future create more projects and update them to Heroku. You can work on everything on your localhost, and they configure Heroku, after that you can push to a branch inside Heroku platform, and it will install everything that you need for your project to run, build and put on the air. Easy like plug and play =D

A good thing to make clear is that Django is an API for backend in Python. To front-end, you can use everything that you like it. =D

Until the end of the course, I will finish a website with all database behind to handle subscriptions and manage of a hypothetical event.

I will continue to post about it, see you in the next post!

That’s all folks! =D

 

 

g4180

From Br-Print3D to Atelier

Yeah. It changed. A new beginning for a good project.

One year ago, Me and two friends got together with the purpose to make a new printer host for the 3D Printing world.

One year passed, and we had some issues. Different opinions and different ways to do things and make the basis for the project. In the end, we didn’t come up with a solution that would please everyone.

Now, I’m working with Patrick Pereira(Florian√≥polis – SC – Brazil) and Chris Rizzitello(Cairo – NY- USA).

Chris is the first foreigner on the project and he is doing a great job on AtCore, that is sort of a kernel of Atelier. It will manage the serial communication and protocols necessary for the printer host.

Soon, it will be set up the KDE repositories for this project and more news is coming.

If you want to help us, please join the IRC #kde-atelier channel. We are needing people that have 3DPrinters and time available to test AtCore.

That’s all for now!

Thanks!

 

Summer of Code: I passed!

Well, in this past week, the edition of Google Summer of Code 2016 ended.

Even knowing that my mentor would pass me in the Final Evaluation, I was anxious to see the green light on my dashboard saying that I passed.

My project was work on Umbrello, the UML Editor of KDE. In my last blog post, you can find a summary of my work.

One more time I want to thank the KDE Community, especially Jonathan Riddel and Valorie, that had my back during this Summer(Winter for me…) of Code.

Now I will continue some personal projects, and soon you will see more news about it. I just need to set up some things here.

Screenshot_20160831_161458

That’s all folks!

IMG_20160818_134235

Isn’t the end, it’s just the beginning – Google Summer of Code 2016

Well, in October of 2015, I meet KDE in Latinoware. Latinoware is one of the big events about free software in latin america. Since them I had the opportunity to join KDE, to meet the Brazilian and international community and this crazy guy called Tomaz Canabrava.

Tomaz hassled me into submitting a project to Google Summer of Code, a project that until then I had never heard of in my life. KDE was chosen to be one of the communities to be able to host students and projects for KDE entire environment be improved.

(more…)

Cross-Compile: Configure QtCreator for Intel Edison

A few months ago a new friend gave to me an Intel Edison board to play =)

IMG_20160813_180658

When I got back home I mounted the board and start to configure. Download from Intel the environment necessary to programming using Node.Js and others frameworks.

Since the Intel XDK environment is too heavy, and I like to use QtCreator, I will configure the Cross-Compile environment to use QtCreator like my editor. I will try in the future write Qt Applications and run them on the Edison, but that is a subject for an another post.

(more…)

Almost there… – Google Summer of Code

In two weeks the Google Summer of Code 2016 will end.

I’m planning to finish my project in the next week, leaving the final week to clean code and write some documentation. I’m currently working on the development of the Object Diagram, and this work is on review. There’re some things missing to implement, and¬† Oliver Kellog and Jonathan Riddel are helping me to solve the issues and finish this task.

In the beginning of this month, I stopped to work on my project. I was traveling a lot and not having time to sit down in front of my laptop and work. After I come back to my home, I started to have a lot of difficulties to go back to work like before.

I reached the guys on the Facebook group to see if they could cheer me up. And they did. Also, I’m in a phase of my life that my depression is on my way, and is being really fucking hard go through this. I’m sharing this here, because I’m not the only one with depression, and I won’t be the last one. And it’s good for me put some things out.

I’m happy that in Lakademy(May) and Randa Meetings(June), I worked a lot on my project, and that will allow me to finish the project until the beginning of the final evaluation.

I had a lot of issues with my mentor, I was lost most of the time, but the community that I’m in, KDE, had my back, and now I’m having someone to review my work, and that is giving me a new breath to continue my work and finish the project.

I learned a lot with my project, and programming to me is like a puzzle, I need to solve it, but sometimes the puzzle gets too hard to solve, so I give a break and read a book or watch some series to clean my head to go back to work later with my mind refreshed.

Join KDE was one of the best things that happened in my life lately. All the experience that I had since I join the community, let me grew up personally and professionally.

Well, when I finish my project, I will share with you all the things that I did, the difficulties and the challenges of this work. But for now, I leave you with…

That’s all folks!