ZTE's Firefox OS Plans Confirmed, ZTE Will Launch Firefox OS Powered Smartphones in Early 2013 | Tech Drive-in
A Firefox OS?
A blog to record helpful tips/hints/tricks/etc. that I come across during my scientific career regarding science, computers, and research. I love learning and disseminating Knowledge.
Saturday, September 22, 2012
Tuesday, September 18, 2012
Avoid integer division when programming
I didn't realize I was doing this but noticed I did have a problem for one of my Python scripts. I was doing 1/2 which is apparently a no-no in programming. I fixed it by doing 0.5*... Other ways include 1.0/2 etc.
Labels:
Programming
Commenting in Python
To comment in Python simply use the pound sign, #, in front of what ever it is you would like to comment. For Spyder users, the shortcut to this in the editor is Crtl+1.
Reserved words in Python
If you've been experimenting with Python, as I have, then you might notice that some words are saved for some certain processes. For example lambda is one of these words. I tried to use it as a variable name. it will usually highlight in blue if it is important. So an alternative is to use lamb_da or lamb_duh etc.
Other words include:
Langtangen, H. P. (2012). A Primer on Scientific Programming with Python (3rd ed.). Heidelberg: Springer. doi:10.1007/978-3-642-30293-0
Labels:
Python
Differences between Python (scripting programming) and traditional programming C/C++/Fortran etc. (system programming)
This post is a summary from Langtangen's (2009) book Python Scripting for Computational Science (Chapter 1 Introduction). Langtangen breaks down the programming languages into scritpting and traditional types. Langtangen comments that these are quite different in programming style and are usually geared towards different goals. The traditional programming languages are also known as system programming and are used for building (usually large, monolithic) applications (systems). These languages include Fortran (77/90/95/2003), C, C++, C#, and Java. Langtangen refers to scripting as programming at a high and abstraction level. These languages include Perl, pythin, Ruby, Scheme, and Tcl.
Langtangen, H. P. (2009). Python Scripting for Computational Science (3rd ed.). Berlin: Springer. doi:10.1007/978-3-540-73916-6
Langtangen, H. P. (2009). Python Scripting for Computational Science (3rd ed.). Berlin: Springer. doi:10.1007/978-3-540-73916-6
Labels:
Programming,
Python
Python 2 vs. Python 3
This is a summary from Langtangen's (2012) latest edition of A Primer on Scientific Programming with Python (found in the preface). Currently, there are two versions of Python generally called Python 2 and Python 3. You may have a version such as Python 2.7 or 3.2, etc. Python 3 is an updated Python language which has some different syntax notation from Python 2. However, some mathematical software for Python has not been ported to use with Python 3. Langtangen provides one suggestion which is to use the latest 2, 2.7, and then use the translation tool 2to3 to obtain the code for version 3.
Langtangen also suggests to use the latest syntax and modules which will make the differences between 2 and 3 small. This is the format Langtangen uses for his book. He lists two distinct differences in the book's programs:
1. a/b implies float division in version 3 if a and b are integers
2. print 'Hello' in version 2 must be converted to a function for 3 such as print('Hello')
Langtangen states that users using version 3 should have any major issues studying the books version 2.7 program codes.
Langtangen, H. P. (2012). A Primer on Scientific Programming with Python (3rd ed.). Heidelberg: Springer. doi:10.1007/978-3-642-30293-0
Langtangen also suggests to use the latest syntax and modules which will make the differences between 2 and 3 small. This is the format Langtangen uses for his book. He lists two distinct differences in the book's programs:
1. a/b implies float division in version 3 if a and b are integers
2. print 'Hello' in version 2 must be converted to a function for 3 such as print('Hello')
Langtangen states that users using version 3 should have any major issues studying the books version 2.7 program codes.
Langtangen, H. P. (2012). A Primer on Scientific Programming with Python (3rd ed.). Heidelberg: Springer. doi:10.1007/978-3-642-30293-0
Labels:
Python,
Python 2.7.x,
Python 3.x
Thursday, September 13, 2012
Saturday, September 8, 2012
X-51A Hypersonic Flight Cancelled at Last Minute | Defense Tech
X-51A Hypersonic Flight Cancelled at Last Minute | Defense Tech
I know this is old. I am just archiving it.
I know this is old. I am just archiving it.
Tuesday, September 4, 2012
How can I edit/create new launcher items in Unity by hand? - Ask Ubuntu
Labels:
Ubuntu,
Ubuntu 11.10,
Ubuntu 12.04,
Unity
Subscribe to:
Posts (Atom)