Skip to content

Instantly share code, notes, and snippets.

View marcellodesales's full-sized avatar

Marcello DeSales marcellodesales

View GitHub Profile
@marcellodesales
marcellodesales / output.txt
Created April 25, 2012 06:07
Sqrt function (Newton's method) using the Google's GO language... Exercise 43...
http://tour.golang.org/#43
As a simple way to play with functions and loops, implement the square root function using Newton's method.
In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating:
To begin with, just repeat that calculation 10 times and see how close you get to the answer for various values (1, 2, 3, ...).
The approximation function for the SQRT function returns the given values for the SQRT(4)...
@marcellodesales
marcellodesales / build.gradle
Created April 24, 2012 10:55
This is a structure of a gradle project that uses a version-controlled Maven repository.
/*
* The plugins used for this build.
*/
/*
* Provides the compile, test, jar, etc tasks
*/
apply plugin: 'java'
/*
* Generates the Eclipse project files.
> db.SondeDataContainer.find( {"observation.pH":4.52, "observation.Battery":1.4} ).explain()
{
"cursor" : "BasicCursor",
"startKey" : {
},
"endKey" : {
},
"nscanned" : 2419200,
> db.SondeDataContainer.stats()
{
"ns" : "netbeams.SondeDataContainer",
"count" : 2419200,
"size" : 1170892976,
"storageSize" : 1358632416,
"nindexes" : 20,
"ok" : 1
}