rodrigoaraujo + python   147

SSL Error on pip installations Win7 x64
python -m pip install --trusted-host --trusted-host --trusted-host --upgrade pip
python  windows 
june 2018 by rodrigoaraujo
19 Essential Snippets in Pandas
or maybe you want to see the count of a certain value
python  pandas 
february 2018 by rodrigoaraujo
SpinboxDelegate Example
SpinboxDelegate Example on github
python  qt 
may 2017 by rodrigoaraujo
Custom Homescreen Icons with Pythonista
I can think of a couple of use cases for this:

Use a custom icon for a web app if you don't like its default one (or it doesn't specify an icon at all).

Launch a web app in full-screen mode that normally wouldn't (I find this especially useful for some shops, like Audible).

Dial a contact's number (using a tel: URL) or create a new email (mailto:) by tapping on the photo of a person (the icon is cropped/resized automatically, so you don't have to create a square image first).

Launch a Pythonista script directly from the home screen, or open an often-used document in Editorial.

Open the maps app with navigation directions to a favorite location, perhaps using a Maps screenshot or a photo as the icon.
ios  python 
april 2017 by rodrigoaraujo
Intro to Flask: Signing In and Out - Tuts+ Code Tutorial
Many web applications require users to sign in and out in order to perform important tasks (like administration duties). In this article, we'll create an authentication system for our application.
flask  programming  python  tutorial 
february 2015 by rodrigoaraujo
The Flask Mega-Tutorial, Part I: Hello, World! -
This is the first article in a series where I will be documenting my experience writing web applications in Python using the Flask microframework.
tutorial  flask  programming  python 
february 2015 by rodrigoaraujo
Data animations with Python and MoviePy - __del__( self )
Python has some great data vizualization librairies, but few can render GIFs or video animations. This post shows how to use MoviePy as a generic animation plugin for any other library.
python  programming  data-visualization 
december 2014 by rodrigoaraujo
Django and Flask: Why and When To Use Each
In this video Eric Schles, Dev evangelist at Syncano, gives a compare and contrast talk on Django and Flask frameworks. Eric walks through some strengths of Flask: low overhead, easy to set up, good for prototyping etc., and some weaknesses: poor built-in debugging tools, not built to scale well, not strongly object-oriented. On the Django side of things, Eric points to strengths: object oriented, production level code under a deadline, and the benefits of the admin panel. However, Eric cautions viewers about the high overhead of set up and warns beginners about challenges.
flask  python 
december 2014 by rodrigoaraujo
Lenscap is a static site generator for creating beautiful photo narratives

Write your stories in markdown and insert small snippets of code to add small groups of images.
python  photography 
october 2014 by rodrigoaraujo
PySide: QVBoxLayout with QScrollArea - Neal's Stuff
To add Scrollbars to a QVBoxLayout is rather simple, however not really straightforward.
You need to create a Widget explicitly for the QScrollArea.
python  pyqt 
october 2014 by rodrigoaraujo
How to toggle editing to QTableWidgetItem?
void enableEdit(QTableWidgetItem* pItem)
Qt::ItemFlags eFlags = pItem->flags();
eFlags |= Qt::ItemIsEditable;

void disableEdit(QTableWidgetItem* pItem)
Qt::ItemFlags eFlags = pItem->flags();
eFlags &= ~Qt::ItemIsEditable;
pyqt  python 
october 2014 by rodrigoaraujo
Making a Little Planet Panorma using Python and Scikit Image
Recently I shared a post on G+ which had a Google “photosphere” transformed into the “little planet” projection. This post (and associated IPython notebook) will walk you through the way I created the planet image using scikit-image. This was my first steps with scikit-image since previously I had been using OpenCV. Unfortunately OpenCV is a bit of a pain to install and so I was looking for a pip-installable library with the functionality I required.
python  photography 
october 2014 by rodrigoaraujo
PlotDevice: a Python-based graphics environment for the Mac
PlotDevice is a Macintosh application that lets you write Python scripts to generate 2D graphics using simple drawing commands.
   Under the hood, your code drives the system's Quartz imaging engine, giving your scripts the same graphical power as a full-fledged Cocoa app. Your code can combine basic geometric shapes, typography, freeform Bézier curves, and a panoply of image formats. This omnivorousness makes PlotDevice ideal for both workaday tasks like image-processing as well as more exotic
uses ranging from procedural texture generation to data visualization.
osx  python 
august 2014 by rodrigoaraujo
Latexify your matplotlib plots for publishing - Nipun Batra
Every time I would prepare a matplotlib graph for a paper, I would iteratively adjust the figure size, the font size, scaling in LaTeX. This turns to be a tedious process. Fortunately, when along with Jack and Oliver, I was writing our nilmtk paper, Jack demonstrated a function to "latexify" plots. This function would take care of font sizes and scaling, so that in one go one could generate a plot and stick in LaTeX. In this post I'll illustrate this technique to save all that iterative effort and make plots look nicer.
python  science  programming 
august 2014 by rodrigoaraujo
Toga: A Python native, OS native GUI toolkit.

Part of the BeeWare logoBeeWare suite.

A Python native, OS native GUI toolkit.
python  ui-design 
august 2014 by rodrigoaraujo
python - Very simple text classification by machine learning? - Stack Overflow
You are indeed describing a classification problem, which can be solved with machine learning.

In this problem, your features are the words in the description. You should use the Bag Of Words model - which basically says that the words and their number of occurances for each word is what matters to the classification process.
python  machine-learning 
august 2014 by rodrigoaraujo
textract — textract 0.1.0 documentation
As undesireable as it might be, more often than not there is extremely useful information embedded in Word documents, PowerPoint presentations, PDFs, etc—so-called “dark data”—that would be valuable for further textual analysis and visualization. While several packages exist for extracting content from each of these formats on their own, this package provides a single interface for extracting content from any type of file, without any irrelevant markup.
august 2014 by rodrigoaraujo
Welcome to Bokeh — Bokeh 0.5.1 documentation
Bokeh is a Python interactive visualization library that targets modern web browsers for presentation. Its goal is to provide elegant, concise construction of novel graphics in the style of D3.js, but also deliver this capability with high-performance interactivity over very large or streaming datasets. Bokeh can help anyone who would like to quickly and easily create interactive plots, dashboards, and data applications.
python  statistics  data-visualization 
july 2014 by rodrigoaraujo
Eli Bendersky's website » matplotlib with PyQt GUIs
The demo features:
* Using the maplotlib navigation toolbar
* Adding data to the plot dynamically
* Dynamically modifying the plot’s properties
* Processing matplotlib events in the GUI
* Saving the plot to a file from a menu
python  pyqt 
july 2014 by rodrigoaraujo
Replicating 538's plot styles in Matplotlib | Data Origami — bite-sized data screencasts
Nate Silver's FiveThirtyEight site has some aesthetically pleasing figures, ignoring the content of the plots for a moment:
statistics  python 
july 2014 by rodrigoaraujo
Hough Line Transform — OpenCV-Python Tutorials 1 documentation
Hough Transform is a popular technique to detect any shape, if you can represent that shape in mathematical form. It can detect the shape even if it is broken or distorted a little bit. We will see how it works for a line.
image-processing  python 
may 2014 by rodrigoaraujo
Introduction — SciPy v0.13.0 Reference Guide
SciPy is a collection of mathematical algorithms and convenience functions built on the Numpy extension of Python. It adds significant power to the interactive Python session by providing the user with high-level commands and classes for manipulating and visualizing data. With SciPy an interactive Python session becomes a data-processing and system-prototyping environment rivaling sytems such as MATLAB, IDL, Octave, R-Lab, and SciLab.
python  science  mestrado 
april 2014 by rodrigoaraujo
[Numpy-discussion] Numerical Recipes (for Python)?
There is no Numerical Recipes for python. The main reason there isn't a NR for python is that practically everything they discuss is already implemented as python libraries, and most of it is in numpy and/or scipy. (Their algorithms are also not suitable for pure-python implementation, but that's a whole other discussion.)
python  mestrado  science 
april 2014 by rodrigoaraujo
An introduction to Numpy and Scipy
NumPy and SciPy are open-source add-on modules to Python that provide common mathematical and numerical routines in pre-compiled, fast functions. These are growing into highly mature packages that provide functionality that meets, or perhaps exceeds, that associated with common commercial software like MatLab. The NumPy (Numeric Python) package provides basic routines for manipulating large arrays and matrices of numeric data. The SciPy (Scientific Python) package extends the functionality of NumPy with a substantial collection of useful algorithms, like minimization, Fourier transformation, regression, and other applied mathematical techniques.
python  mestrado  science 
april 2014 by rodrigoaraujo
Detecting duplicate images using Python
A frequently used solution to identify if a given file already exists in a large collection of files is to calculate a hash for each individual file in the dataset, store the hashes in a database and then when we want to locate a particular file calculate the hash for that file and look up to see if it’s hash value exists in the database.
algorithm  programming  python 
april 2014 by rodrigoaraujo
Bleach is an HTML sanitizing library that escapes or strips markup and attributes based on a white list. Bleach can also linkify text safely, applying filters that Django's urlize filter cannot, and optionally setting rel attributes, even on links already in the text.

Bleach is intended for sanitizing text from untrusted sources. If you find yourself jumping through hoops to allow your site administrators to do lots of things, you're probably outside the use cases. Either trust those users, or don't.

Because it relies on html5lib, Bleach is as good as modern browsers at dealing with weird, quirky HTML fragments. And any of Bleach's methods will fix unbalanced or mis-nested tags.

The version on GitHub is the most up-to-date and contains the latest bug fixes. You can find full documentation on ReadTheDocs.
django  html  html5  python 
april 2014 by rodrigoaraujo
nathangrigg/dayone_export · GitHub
Export Day One journal entries into html, text, or another format using a Jinja template.
python  programming  day-one 
march 2014 by rodrigoaraujo
Probabilistic Programming and Bayesian Methods for Hackers
Welcome to Bayesian Methods for Hackers. The full Github repository is available at github/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers. The other chapters can be found on the project's homepage. We hope you enjoy the book, and we encourage any contributions!
statistics  python 
march 2014 by rodrigoaraujo
Steven Loria | Python Best Practice Patterns by Vladimir Keleshev (Notes)
These are my notes from Vladimir Keleshev’s talk entitled “Python Best Practice Patterns”, given on May 2, 2013 at the Python Meetup in Denmark. The original video is here (about 38 minutes long).
patterns  programming  python 
february 2014 by rodrigoaraujo
Retina display support for Mac OS, iOS and X11 | Qt Blog
Qt 5.0 added basic support for retina reasonable resolution displays. The upcoming Qt 5.1 will improve the support with new API and bug fixes. Qt 4.8 has good support, and backports of some of the Qt 5 patches are available.

While this implementation effort is mostly relevant to Mac and iOS developers, it is interesting to look at how other platforms handle high-dpi displays. There are two main approaches:
python  pyqt 
november 2013 by rodrigoaraujo
Open Sourcing a Python Project the Right Way
Most Python developers have written at least one tool, script, library or framework that others would find useful. My goal in this article is to make the process of open-sourcing existing Python code as clear and painless as possible. And I don't simply mean, "create GitHub repo, git push, post on Reddit, and call it a day." By the end of this article, you'll be able to take an existing code base and transform it into an open source project that encourages both use and contribution.
python  programming  github  cairoplot-inspiration 
august 2013 by rodrigoaraujo
Steven Loria | Hosting static Flask sites for free on Github Pages
This past weekend, I released, a website with guides for installing and using various tools. It’s a static site powered by Flask and hosted for free on Github Pages.

Static Flask sites are a big win because:

They’re fast.
If you need your site to be dynamic in the future, the transition will be easy.
There are well-developed extensions for doing this. Here I’ll demonstrate Frozen-Flask (for building static content) and Flask-FlatPages (for writing pages in Markdown).
Source for the example site here: sloria/flask-ghpages-example. Live site here:
flask  github  python  blog-inspiration 
august 2013 by rodrigoaraujo
TextBlob: Simplified Text Processing
TextBlob is a Python (2 and 3) library for processing textual data. It provides a simple API for diving into common natural language processing (NLP) tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, translation, and more.
python  programming 
august 2013 by rodrigoaraujo
Envelopes — Envelopes 0.2 documentation
Envelopes is a wrapper for Python’s email and smtplib modules. It aims to make working with outgoing e-mail in Python simple and fun.
python  programming 
august 2013 by rodrigoaraujo
Gmail bindings for python
A Pythonic interface to Google's GMail, with all the tools you'll need. Search, read and send multipart emails, archive, mark as read/unread, delete emails, and manage labels.
python  programming 
august 2013 by rodrigoaraujo
3.9. Ensemble methods — scikit-learn 0.13.1 documentation
3.9.2. Gradient Tree Boosting

Gradient Tree Boosting or Gradient Boosted Regression Trees (GBRT) is a generalization of boosting to arbitrary differentiable loss functions. GBRT is an accurate and effective off-the-shelf procedure that can be used for both regression and classification problems. Gradient Tree Boosting models are used in a variety of areas including Web search ranking and ecology.
machine-learning  python  programming 
july 2013 by rodrigoaraujo
Navigating the Postmodern Python World
If there is one defining feature of modern Python, it’s simply that is that the definition of Python itself is becoming increasingly blurred. Many projects over the last few years have taken larger and larger leaps to extend Python and reconstruct what “Python” itself means.

At the same time on there are variety of technologies encroaching on Python’s niche, each bringing a variety of advantages:

Go - ( Goroutines, Types, Interfaces )
Rust - ( Traits, Speed, Types )
Julia - ( Speed, Types, Multiple Dispatch )
Scala - ( Traits, Speed, Types )
Clojure ( Metaprogramming, DSLs, Protocols )
This is a short field-guide to the various Python responses to these technologies and new libraries and models:
python  programming 
july 2013 by rodrigoaraujo

As is traditional, we are first going to write a Small "Hello, world" application. Here is the code:

1 #!/usr/bin/env python
2 import wx
4 app = wx.App(False) # Create a new app, don't redirect stdout/stderr to a window.
5 frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
6 frame.Show(True) # Show the frame.
7 app.MainLoop()
programming  python 
july 2013 by rodrigoaraujo
OpenCV-Python: Contours - 1 : Getting Started
Hi, this article is a tutorial which try to cover all relevant functions in OpenCV dealing with Structural Analysis and Shape Descriptors, which are mainly related to contours.
python  programming  augmented-reality 
july 2013 by rodrigoaraujo
Python - Khan Academy Docs
We follow the PEP8 style guide for Python.  Docstrings follow PEP257.  The rest of the document describes additions and clarifications to the PEP documents that we follow at Khan.

You can use make lint from the top level of the website source tree to run a pep8 check over all the source code. You should aim to not introduce any new violations, before checking in code.
programming  python 
july 2013 by rodrigoaraujo
PEP 8 -- Style Guide for Python Code
This document gives coding conventions for the Python code comprising the standard library in the main Python distribution. Please see the companion informational PEP describing style guidelines for the C code in the C implementation of Python [1].

This document and PEP 257 (Docstring Conventions) were adapted from Guido's original Python Style Guide essay, with some additions from Barry's style guide [2].
programming  python 
july 2013 by rodrigoaraujo
Time Warp - Modifying Time Machine's behavior
Time Machine has been an integral component of my backup system since its inception in OS X 10.5. Despite its utility, I dislike how backup snapshots are handled when Time Machine’s hard drive is full. To make efficient use of hard drive space, Time Machine keeps hourly backups for a single day, daily backups for a month, and finally weekly backups until the backup drive is full. Once full, Time Machine operates as a First-in, First-out queue (FIFO)—the oldest snapshot is dequeued to allow an incoming snapshot to be enqueued. This post is about my backup tool called Time Warp and how I use it to modify Time Machine’s backup behavior using weighted reservoir sampling. I built Time Warp to preserve important backup snapshots and prevent Time Machine from deleting them.
backup  inspiration  python  programming 
july 2013 by rodrigoaraujo
Python Descriptors Demystified
Hopefully, however, this example gives you an idea of what descriptors can be useful for -- they provide a way to organize property logic into isolated classes. If you find yourself repeating the same logic across several properties, that should be a clue to consider whether refactoring that code into a descriptor is worthwhile.
programming  python 
june 2013 by rodrigoaraujo
Sublime Text Ctrl+P Like Fuzzy Matching In Few Lines of Python
There were a few people curious in the ST forums on how Sublime Text’s fuzzy matching works.
In reality, I don’t know either. There were some interesting solutions given, but I haven’t researched their methods and workability.
I needed to implement this for a small project I’m working on. I went with a solution that worked decently (I think I saw this within a JS fuzzy searching library). I’m not claiming it to be the best or the fastest (far from it, actually).
However, just in case you need to implement something like this, this might come in handy.
regex  programming  python 
june 2013 by rodrigoaraujo
« earlier      
per page:    204080120160

Copy this bookmark: