Number | Format | Output | Description |
3.1415926 | {:.2f} | 3.14 | 2 decimal places |
3.1415926 | {:+.2f} | 3.14 | 2 decimal places with sign |
-1 | {:+.2f} | -1 | 2 decimal places with sign |
2.71828 | {:.0f} | 3 | No decimal places |
5 | {:0>2d} | 5 | Pad number with zeros (left padding, width 2) |
5 | {:x<4d} | 5xxx | Pad number with x’s (right padding, width 4) |
10 | {:x<4d} | 10xx | Pad number with x’s (right padding, width 4) |
1000000 | {:,} | 1,000,000 | Number format with comma separator |
0.25 | {:.2%} | 25.00% | Format percentage |
1000000000 | {:.2e} | 1.00E+09 | Exponent notation |
13 | {:10d} | 13 | Right aligned (default, width 10) |
13 | {:<10d} | 13 | Left aligned (width 10) |
13 | {:^10d} | 13 | Center aligned (width 10) |
Sunday, November 10, 2013
Python str bracket format summary
Tuesday, August 13, 2013
Installing Oracle JDK JRE on Debian / Ubuntu
To install it, you just need to execute the following commands in order. I am assuming a new clean installation.
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
Friday, June 14, 2013
Matlab/Octave commands in Python using Numpy
Here I share a website with translation of commands between languages (in this case Matlab/Octave and their corresponding synonyms in Python with Numpy) with their respective syntax.
There are HTML and PDF formats available for download.
Monday, May 13, 2013
Video on Developing Maintainable Code with focus on HTML, JavaScript, CSS - Lessons Learned
A very nice video on developing sustainable and maintainable code, with examples focusing on JavaScript and web, but touching concepts applicable on any software development project and any technology.
Wednesday, May 8, 2013
LinkedIn Family Design - Technologies and Implementations being used on LinkedIn
Lately I had some available time to catch up on various subjects I was away from due to my day-to-day tasks and technologies.
I found this video interesting due to its contents, how useful it is for real applications, and the available information on how a company such as LinkedIn is currently working.
Installing Ruby on Rails - DevKit and JSON - RubyGems override
After some time I went and installed again Ruby and Ruby on Rails. You can find the installers on the official website here for Ruby and DevKit, and for Ruby on Rails, the installers are here.
ruby dk.rb install --force
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
ruby dk.rb install
[INFO] RubyGems override already in place for <ruby_path>, skipping.
[WARN] DevKit helper library already exists for <ruby_path>, skipping.
General Steps to install Ruby DevKit
- Extract downloaded DevKit to a folder inside the main Ruby folder
- Go inside the extracted DevKit folder
- ruby dk.rb init
- ruby dk.rb review
- ruby dk.rb install
To install JSON
gem install json -v '1.7.7'To install DevKit - This will also write over any previous config and omit any warnings
ruby dk.rb install --force
These solve the error messages I received while trying to install everything on Windows:
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.
ruby dk.rb install
[INFO] RubyGems override already in place for <ruby_path>, skipping.
[WARN] DevKit helper library already exists for <ruby_path>, skipping.
Sunday, May 5, 2013
Object Oriented Programming vs Functional Programming - Nouns vs Verbs - Analysis
If you are a developer, programmer or interested in these subjects, the following is a very good read to analyze and think about regarding OOP and Functional Programming. Shows a comparison between different languages and paradigms.
I use many languages, and believe that every one of them has advantages and disadvantages, and it always depends the type, size, group of the project to find the right technologies/languages to build it upon.
Having said that, here's the link to the article, "Execution in the Kingdom of Nouns" dated 2006.
Subscribe to:
Posts (Atom)