8 errores que todo programador novato comete

1. Escribir código sin planear

Este es el primero, cuando nos cuentan de un proyecto lo primero que hacemos es empezar a divagar, es mas, ni bien nos estan terminando de contar los requerimientos y ya hemos escogido el lenguaje, el framework y a veces hasta el pilón.

Siempre es importante pensar el proyecto, ¿es viable?, hay que investigar y planear, entonces, escribe, valida los resultados y modifica.

2. Planear demasiado las cosas

También este es un error, a veces sobrepasamos demasiado las cosas y terminamos creando un monstruo porque “en el futuro puede que llegue a necesitar esta característica”, es mejor implementar algo simple y que logre el propósito aunque despues tengamos que reescribr parte del código. read more

Yay! PyCharm 2018.3 !!

I’ve been using PyCharm for professional use since about 1 ½ years now ( I mean paying for the Pro license, I have more time using the Community Edition), and I like a lot what PyCharm help me to do, the Django support is pretty awesome and is super fast even when my computer is a 2012 model.

So, I’m pretty happy with every new version of PyCharm, there are several new features and improvements, you can see them here: What’s New in PyCharm

Podría la popularidad de Python ser superior a la de JavaScript en 5 años?

Respuesta corta: NO

La cuestión es que JavaScript está presente como bien dice el articulo, en cerca del 95% de los sitios web en el mundo, es un lenguaje de programación que domina la forma en la que las paginas web tienen cierto dinamismo, vaya, para nadie es raro escuchar de la tripleta HTML5+CSS+JavaScript, sin embargo otras tecnologias como Flash o Java decayeron tanto que solo un par de navegadores lo soportan aún.

Python por otro lado es un lenguaje de uso general, muy popular en el backend y en aplicaciones de Machine Learning y computo científico, es su sencillez y madurez lo que le da su popularidad, sin embargo no cuenta con esa exclusividad que tiene JavaScript.

Es JavaScript un mejor lenguaje que Python?. Lo dudo mucho, hay muchos ejemplos de lo que está roto en JavaScript, tanto que hasta juegos sobre sus patrones de igualdad hay. Incluso hay lenguajes que se compilan a JavaScript para hacer las cosas mas “sencillas” y menos susceptibles a errores. Sin embargo, como dije en el párrafo anterior, JavaScript cuenta con esa exclusividad en la web que hace casi imposible que otro lenguaje de programación sea tan popular como él. Si vas a aprender a hacer sitios web tienes por fuerza que aprender a usar JavaScript, incluso si usas algún framework. Otro punto fuerte de JavaScript son los dispositivos móviles, para muchos el tener que mantener la misma app en diferentes plataformas los ha llevado a tener un framework con un lenguaje de programación común, ahí es donde JS ha sido el que ha triunfado, es común encontrarse frameworks que usan JS y “convierten” estas instrucciones a una app nativa, o en el peor de los casos a una especie de web-view con el dinamismo dado por JS.

Como podría Python ganarle terreno a JavaScript?, lo está haciendo muy bien sirviendo desde el backend (como de costumbre), muchos sitios web estan construidos sobre Django, APIs que se han construido sobre Flask, en el computo científico es muy pero muy popular, pero seria genial que Python fuera la base para alguna plataforma móvil, te imaginas escribir apps para dispositivos móviles usando Python de forma nativa? es decir, que el dispositivo use Python directamente, que no se compile a JS, Java/Kotlin u ObjectiveC/Swift.

Cuál es tu predicción a 5 años?, Python será mas popular que JavaScript?.

JavaScript and Python are two influential programming languages for building a wide range of applications.

Source: Could Python’s Popularity Outperform JavaScript in the Next Five Years?

Buenas practicas en Django

Aquí no hay mucho que decir, estamos hablando de Python y por lo tanto aplican las reglas de estilo de Código de Python, debes escribir siguiendo la PEP8. Django también tiene sus propias convenciones para escribir código, estas las puedes encontrar aquí , coteja con las de Python, verás que son complementarias.

Tips and tricks: Django – Mostrar cierto contenido seleccionado en un ChoiceField

Si hemos usado Django seguro nos hemos enamorado de su forma de hacer formularios, sobre todo los que están relacionados con un modelo, puesto que son simplísimos. Hay que reconocer lo simple de Django, y gracias a esta simplicidad que no busca satisfacer completamente todas las necesidades podemos encontrarnos con situaciones que pues, no se apegan a lo que queremos hacer.

Python is growing up, you know that because tools are getting better 

Microsoft, a company that have their very own tools  and programming languages is now making it easier for developers to use their favorite language. This time Python have better support in the Visual Studio Code, more specifically in the IntelliSense autocomplete System.

Visual Studio Code is the source code editor that Microsoft released as Open Source and is available in Linux, Windows and MacOS. and thanks to the Python Language Server now have better support for Python. I mean, Python support has been there for a while, but is greatly improved by the PLS.

Do you use Python or Visual Studio?, leave your thoughts in the comment section.

Python Language Server an option for those that code

Source: Microsoft Visual Studio Code replumbed for better Python taming • The Register

GitHub adds Python support for security alerts – Help Net Security

This is good, as a developer is a PITA to follow all the dependencies your app have. There are several tools to keep them up to date (updating your requirements.txt file) for future builds/updates of your app. But sometimes we just don’t follow the security flaws.

GitHub’s Security Alerts now also work for Python projects, notifying developers about vulnerabilities in software packages that their projects depend on.

Source: GitHub adds Python support for security alerts – Help Net Security

Java, JavaScript, C#? No, Python is the fastest growing programming language | ZDNet

There is a reason for that. Python is

  • Simple, easy to read, easy to write; then, easy to learn
  • Powerful with all that bunch of packages/modules included and all others created by the community freely accesible with a simple pip  call.
  • All purpose, use to automize something, use it to run a web site, an API, even to create desktop apps.
  • Multi-platform, Windows, Linux, Mac, BSD’s, even in embedded systems.
  • Fast enough,

You can find some of those in another languages, but not all achieve that.

Python is now the fastest-growing major programming language, according to Stack Overflow. read more

Java vs. Python: Which One Is Best for You? | @DevOpsSummit #APM #Java #Python | news.sys-con.com

So, basically, both are fine but it depends on what you need (as with most tools).

In my opinion a less verbose language is better, also, python have tons of packages installable via pip, is C++ extensible (for those scenarios where speed matters) and is present in most platforms.

Also, although there is an Open Source Java implementation, not all the “core” libraries are, I mean, you can’t just replace Oracle’s Java with the Open Source and expect everything will run just fine, probably will, but slower.

 

Language affiliations are sometimes spread more loosely and broadly across different codebases, frameworks, and platforms

Source: Java vs. Python: Which One Is Best for You? | @DevOpsSummit #APM #Java #Python | news.sys-con.com

Businesses stick with Java, Python, and C

Java has a strong user base and while new developers are using new programing languages/technologies like Swift, the user base is lowering quite slow. Many companies have their software built on Java and is unlikely that they will rewrite it in another programming language.

I do like the fact that Python, being a mature language is still one of the most loved one and used in financial field/startups. It’s one of the top that is growing super fast, which is good.

A recent survey found that while developers are into newer languages like Swift, Rust, and Scala, businesses prefer the stalwarts — and Python can bridge the gap between the two

Source: Businesses stick with Java, Python, and C

(Reblog) HotKeys on Windows using Python

This post comes  from the old blog.

A few weeks ago, I have to write a program in PyGTK that was supposed to be all the time in the background. This application needs to run over Microsoft Windows, and hide in the notification area, wich in Windows is near to the clock.

One of challenges for me in this application is that as it must run in the background there must be a way to raise it, the most easy way to do it is by force the user to click on the small icon in the notification area, but in this case, that was impossible because the computer don’t have any mouse, everything is done with the keyboard.

Image as background in a Gtk Application.

(Reposted from the old blog)

This time I’m going to talk about putting an image as the application background in Gtk. In Gtk we are used to leave the colors of the application to the theme, but sometimes we will need to use an image as background. I already wrote how to draw a pixbuf in a gtk.DrawingArea (Esp), we could use that, but we will “draw” directly on the widget window instead.

Yes, I said the widget’s window instead the widget itself. You should know that every widget that has been packed in a container has a gtk.gdk.window object and is the responsible for containing your widget. Well, we can draw on that object.

What we need is to create a simple gtk.gdk.Pixbuf and call the gtk.gdk.window.draw_pixbuf method using your widget.window object on the expose-event.

The code should look like this:

#!/usr/bin/env python
import gtk

def draw_pixbuf(widget, event):
path = '/home/markuz/wallpapers/WMwall1024x768.gif'
pixbuf = gtk.gdk.pixbuf_new_from_file(path)
widget.window.draw_pixbuf(widget.style.bg_gc[gtk.STATE_NORMAL], pixbuf, 0, 0, 0,0)

window = gtk.Window()
window.set_title('Drawing Test')
window.set_size_request(640,480)
window.connect('destroy',gtk.main_quit)
hbbox = gtk.HButtonBox()
window.add(hbbox)
hbbox.connect('expose-event', draw_pixbuf)
button = gtk.Button('Press Me!')
hbbox.pack_start(button, True, False, 10)
window.show_all()

gtk.main()

read more

Kivy

The last couple of days I’ve been working with Kivy. For those that don’t know is a framework to create applications in graphical environments and in multiple platforms, all of these in the most easy to use programming language: Python, (And I mean programming language, JavaScript doesn’t count).

Well, its interesting to work with it, basically because I have the influence of GTK+ and having no windows but calling to widgets creates some confusion. Also, there is this Kivy language which is something like what Glade is In GTK but a lot easier to read (actually everything is easier to to read than XML).

I’m just starting to do this, this post is not a “how to do things in Kivy”, but I hope I can write some of those in the next weeks.