Pages

Sunday, March 31, 2013

The Viscosity of Liquids and Gases

Pipe Flow Rate (Q) :
  • is the rate (ie: volume per unit time) at which a fluid flows through a pipe.  

Equation for calculating Pipe Flow Rate (Q) :
Q = uA = u(πR2) = u((πD2)/4)
  
where
  •  u is the flow average velocity (m/s)
  • A is the cross sectional area of the pipe (m2)
  • R is the radius of the pipe (m)
  • D is the diameter of the pipe (m) 

Reynold's Number (Re):  
  • is a number (dimensionless) which can be used to determine the flow regime within a pipe.
Equation for calculating Reynold's Number (Re) :

 Re = ρuD/μ

where:
  •  ρ is the density of the fluid (kg/m3)
  •  μ is the viscosity of the fluid (kg / m*s)
  • D is the diameter of the pipe (m)
  • u is the average velocity in the pipe (m/s) 

  


Tuesday, December 11, 2012

GIT Commands

Setting up the environment :

Configuration files exist in three places :

(Windows)

System (all users of the same machine) wide, typically located in
  • C:\Program Files\git\etc\gitconfig
  • Configuration command: git config --system
User specific (Global), typically located in :
  • C:\users\*user*\.gitconfig
  • Configuration command:  git config --global
Project specific, located in :
  • Working project directory ie: C:\development\.git\config
  • Configuration command: git config
Modifying specific configuration files via the command line :

As a brief run through, we'll focus on manipulating a user specific configuration file (global configuration) to outline some of the rudimentary configuration steps.

git-bash> git config --global user.name "W Wright"
git-bash> git config --global user.email ""wemail@dne.com"" (single quotes)
git-bash> git config --global core.editor "notepad.exe" (Google for neat configurations for this)
git-bash> git config --global color.ui true
git-bash> git config --list
git-bash> git init
git-bash> git add .
git-bash> git add <filename>
git-bash> git status
git-bash> git rm <filename>  *permanent, unix like rm*
git-bash> git mv <filename> <filename>
git-bash> git diff
git-bash> git diff <filename>
git-bash> git checkout <branch name>
git-bash> git checkout -- <filename/folder>
git-bash> git commit --ammend -m "message" * ammends changes to HEAD pointer commit*
git-bash> git log
git-bash> git checkout <10-30 numbers from SHA-1> -- <filename> *checkout from a revision puts it into staging tree*
git-bash> git diff --staged
git-bash> git reset HEAD <filename> *removes an item from the staging tree*
git-bash> git revert <10-30 characters from SHA-1> * complete mirror reversal of commit, done using the last HEAD pointer commit value*

Undoing multiple commits *dangerous*


git-bash> git reset --soft <SHA-1 to reset to>
  • resets the version in the repository, does not affect the updated versions contained in either the staging index or the working directory. diff will show all the differences between the files in repo versus working/staging dir.
 git-bash> git reset --mixed (default) <SHA-1 to reset to>
  • moves head pointer to specified commit, also changes staging index, but does not affect the working directory.  
 git-bash> git reset --hard <SHA-1 to reset to>
  • moves pointer of repository but also makes staging and working directory match the affects of the reset.  (All updated files in the staging & working) will be changed.
--------------------
git-bash> git clean -n (test run for removing untracked files contained in working directory)
git-bash> git clean -f (removes untracked files contained in working directory)

.gitgnore file - to avoid git from complaining about untracked specific file types, etc.

git-bash> git config --global core.excludesfile ~/.gitignore (Global ignore file - specify location)

git-bash>  git rm --cached <filename>  to remove a file from the staging index after ignoring it.  (a method to ignore already tracked files)






GIT - DVCS (Distributed Version Control System)


For example:


Developer A logs into the server and "check's out" an updated copy of the project file. Simultaneously, Developer B also logs into the server and "check's out" a copy of the project file also. Developer A is quick to make a few changes to the files and "commits" or "checks in" the changes to the server to update the server copy. Shortly after, Developer B has finalized changes to his/her local copy and attempts to "commit / check-in" his completed work.


However ! The server will only accept changes to the most updated files. Hence, beca

The Goal :


To establish and maintain a GIT environment for the purpose of project collaboration, primarily in C.


What is GIT ?


GIT is a DRCS (Distributed Revision Control System) also commonly known as Distributed Version Control and or DVCS (Decentralized Version Control System).


GIT vs. Traditional CVS (Concurrent Versions System)



CVS:


First let's start off by exploring the traditional CVS setup:

CVS uses a client - server architecture, where-in current versions of the "project" and it's associated history of changes are stored on a server. Client(s)/developers then connect to the server in order to "check out" a complete copy of the project. Once checked out, the developer is able to modify this copy of the project, and once completed "check-in" their changes.

Multiple developers are able to collaborate/work on the same project concurrently (occuring simultaneously or side by side). However, there are limitations.
use Developer A has already submitted changes and updated the server side files, the copy that has been modified by Developer B is no longer associated with the most "updated" version of the files. This is where manual intervention is required to accommodate the conflict in the CVS repository.

"Clients can also compare versions, request a complete history of changes, or check out a historical snapshot of the project as of a given date or as of a revision number."


GIT:

Git adopts a peer - to - peer style of version control as opposed to the client - server (centralized) approach. Therefore, each local copy stored on the machines of contributors to the "project" are all considered official respositories. Syncronization of the core files (Project) occur through a process of patch updates (change-sets) amongst developers/peers.

Must Read: http://git-scm.com/book/en/Getting-Started-About-Version-Control

Introduction to Linear Algebra

"Algebraic Method" of solving linear equations using Matrices.

Consider the following system:

3x1 + 2x2 - x3 + x4-1
2x1          - x3 + 2x4 = 0
3x1 + x2 - 2x3 + 5x4 = -1
Augmented Matrix :

[ 3 2 -1 1 | -1 ]
[ 2 0 -1 2 |   0 ]
[ 3 1   2 5 |   2 ]

Coefficient Matrix :

[ 3 2 -1 1 ]
[ 2 0 -1 2 ]
[ 3 1   2 5 ]

Constant Matrix :

-1 ]
[   0 ]
[   2 ]

Thursday, March 3, 2011

Linux Commands to get you started

'man'
  • Command mode accessible through ESC
  • /<search string>  - use 'n' to continue search
  • 'b' to go up a page
'info'
  • Control-S used to search
  • 'control-s' to continue the search
  • Control-G to end that task
  • Set up cursor on index points and hit enter to be taken to that section
  • Use 'l' to return to previous position with relation to indexed point
'man -k <keyword>' looks for keyword one-line synoposis entries
'apropos <keyword>' identical to above

'vi'
  • vi editor, command mode accessible through ESC
  • 'dd' - deletes a line
  • '/' search, similar to man pages
  • :wq - write and quit
  • :q! - quit without writing
'rm <file>' remove a file
'rm -i <file>' , interact flag for rm - prompt for confirmation on file deletion
'mkdir <name>' , create a directory
'rmdir <name>', remove an empty directory

'ls' - list the contents of current location
'ls -a' - list the contents of current location including all files beginning with a period (.)
'ls -l' - long listing format, includes DAC layout, along with other properties.

'cp' - copy
'mv' - rename/move

Terms to be aware of:  Absolute path - begins with a '/'
Relative path: - relative to the current directory inwhich the command is executed

Special files for easy configuration.

.bash_profile, easily modify the path to search for programs!
.bashrc , easily modify aliases surrounding common commands you may use.
example:  alias rm='rm -i'

source <file> , ie: source .bashrc
implement changes/take effect the current changes made, without exit/relogging.

nroff input for man pages is kept in /usr/share/man/manX, compressed with gzip to save space.  'man' knows how to uncompress on the fly.

Formatted versions of the manuals are kept in /var/cache/man/catX.  Should the directory be writable, man will also deposit the formatted pages as they are created, generating a cache of commonly read man pages.

'manpath' will display the path 'man' utilizes when searching for manual pages as per your request.  The system wide default can be configured in /etc/man.config (on some distributions)  The PAGER environment variable controls the way inwhich the listing of the man pages is utilized, typically using 'less'.

Monday, February 21, 2011

Properties of Real Numbers

Commutative Properties

  • a + b = b + a
  • Example: 7 + 3 = 3 + 7
  • When we add two numbers, order doesn't matter.

  • ab = ba
  • Example: 3 * 5 = 5 * 3
  • When we multiply two numbers, order doesn't matter.

Associative Properties
  • (a + b) + c = a + (b + c)
  • Example: (2 + 4) + 8 = 2 + (4 + 8)
  • When we add three numbers, it does not matter which two we add first.

  • (ab)c = a(bc)
  • Example: (3 * 7) * 5 = 3 * (7 * 5)
  • When we multiple three numbers, it does not matter which two we multiple first.

Distributive Property
  • a(b + c) = ab + ac
  • Example: 2 * (3 + 5) = 2 * 3 + 2 * 5
  • When we multiply a number by a sum of two numbers, we get the same result as multiplying the number by each of the terms and then adding the products.
  • (b + c)a = ab + ac
  • Example: (4 + 5) * 2 = 2 * 4 + 2 * 5