Doc Ernie's Adventures in the Web
Applied Mathematics, Science and Computing
Saturday, January 21, 2012
Learn chinese in five minutes or less!
It is sort of "natural" onomatopaeiclearning, it mimics the English well!
Src: From a facebook wall photo.\
Labels:
Humor
Wednesday, January 18, 2012
Tuesday, December 6, 2011
Looking for a cheap personal wifi router?
I knew our favorite cheap gadget store, CDRKing, should have one. And after thirty minutes of browsing for such products in its online catalog, I could not pinpoint a battery powered, personal 3G wifie router as there were so many devices described! Googling, I stumbled merrily into this site:
technoolding.net
According to this site, this gadget will set us back for PH 2,180 pesos! and the battery will give us a decent 3 hour life. But the site also tell us that we may have suffer from dropped connections and unexpected 3G to 2G switching. Well at least we are warned.
Going back to the online catalog, I got the following information (information from
SDRKing):
Plug & Go
Just plug in 3G modem (USB) and surf Internet easily
Play & Share
High-Speed Internet access for up to 30 devices. Simultaneously with a single mobile broadband account
Supports wireless N standard with data speeds up to 150 mbps on local area network
Dual CPU solutions powered by 3G modem processor and Ralink Technology
One-stop setting. Auto network detection & auto APN setting
Both way for WAN & LAN, WAN mode for hotel/office/home Internet, LAN for PC access
Compact size fit in every pocket
And here is a close up view:
Labels:
cdrking,
personal 3G wifi router,
Technology
Monday, November 14, 2011
Man's Inhumanity to man.
At the risk of alienating some of our readers, I am enclosing a link to a Yahoo Youtube video
about kidnapper brigands in Mindanao beheading their captives.
It is not for the faint of heart. Here is the link: Youtube
about kidnapper brigands in Mindanao beheading their captives.
It is not for the faint of heart. Here is the link: Youtube
Labels:
execution,
helplessness.,
inhumanity,
Massacre
Thursday, November 10, 2011
Why I did not watch Wowowie tv show
It seems that the overall level of intelligence will be lowered when you watch this tv show. If I did catch it public places or buses, I only do intently focus on it when the sexily clad dancers do their thing. Anyways, here is a series of questions and the funny or smart answers the emcee participants have dissed out. (Translated from Tagalog.)
- If those who eat greens are called vegetarians, what do you call those who eat humans? Ans. humanitarian!
- What are Michael and Raphael?
Ans. Ninjas
- In what country most Hindus come from?
Ans. Hindunesia!
- What do you take out from an egg before you cook them?
Ans. Hair! (expecting the "shell")
- If H20 is water, what is CO2?
Ans. Cold water!
Complete the sentence: Beauty is in the eye of the ____? Ans. Tiger! (Beholder is the right answer!)
Labels:
Humor
Wednesday, November 9, 2011
R quick reference
- Help and demos.
The home page of R is http://www.r-project.org
type help.start() to use a browser to view standard documentation
type demo() to view demos of the capabilities of R.
type ?topic to view manual pages of an R function or library.
- To recover last computed expression in R:
Use the special variable .Last.value
- How do I display floating point number to a specified number of digits?
options(digits = 10)
when you want finer control, you may use sprintf("%.nf", value) where n must be replaced by
the numerical value of the number of digits.
- Creating sequences.
X <- seq(1,100) X <- seq(1, 100, by = 3) X <- seq(1, 100, length=5) Note that the spacing in sequence X is given w = (endvalue, startvalue)/(length - 1). - What are the elementary operations on sequences or vectors.
All variables in R are vectors! Two vector operands are first set to the same length,
recycling elements if necessary.
Arithmetic operations +, -, *, / works pairwise.
Functions or operations applied to a vector result in new vector.
X^2 gives a new vector with the square of the elements in original X.
X*X gives the same results!
- To determine the number of elements in a vector
length(X)
- To extract the kth element(indexing starts at 1)
X[k]
- To return a vector with the kth element deleted.
X[-k]
- To return a vector with some elements deleted.
X[-c(1,3, 5)] will delete the elements at the first, third and fifth position.
To repeat a vector.
rep(X, ntimes) will return a new vector repeated ntimes.
X <-c(1,2) rep(X, 5) will display [1] 1 2 1 2 1 2 1 2 1 2 - To concatenate two or more vectors
c(X,Y, Z)
- To compute the product of all elements in a vector.
prod(X)
- To assign an element v at a specific position k.
X[k] <- v Not that if k is greater than length of X, X will be enlarged! To filter elements of X meeting a condition. X[condition] For example, X[X > 5] will display a new vector with element values > 5.
To sum all elements in a vector
sum(X)
To sort a vector
sort(X)
- How do you mark lines as comments in R?
Start each line (leading spaces are ignored) with a #.
- How do I edit a user defined function definition?
Method 1. use fix(function_name)
You mispelled length(X):
gm <- function(X){ exp(sum(log(X))/lenggth(X)) } use fix(gm). edit the offending line and save file. Now type gm. The erroneous definition now has been saved! Method 2. use edit(function_name) Type gm <- edit(gm) This has the same behavior as fix. Method 3. body(function_name)) for one line definitions, this may work out well from the command line. body(gm) <- expression({exp(sum(log(X))/length(X))}) Method 4. as.list(body(function_name))) for multiline definitions, use as.list, taking into note that the line 1 is always the starting {. Hence the first line of the function is body(function_name[[2]]. To change a specific line, body(function_name[[line#+1]] <- substitute(newexpression). Reference:http://stackoverflow.com/questions/2458013/what-ways-are-there-to-edit-a-function-in-r - What are reserved variables in R?
Do not use c, t, q, F, T
- In conditional tests, what are the available comparison operators?
!expr NOT
>,<, != inequalities = equality - Does R provide bitwise operators?
bitAnd(a, b)
bitOr (a, b)
bitXor(a, b)
All functions above works on 32 bitwide unsigned integers
- What are the available programming control structures in R?
conditional if
if (condition) expr
conditional if-else
if (cond) expr1 else expr2
switch
switch(expr, ...)
ifelse
ifelse(test,yes,no)
looping constructs and cotrol statements:
for (var in seq) expr
while (cond) expr
repeat expr
break
next
- How do I input a program or data file to R?
source(filename)
- How do I redirect output to a file from R?
sink(outfilename)
- What are the functions for handling libraries or packages?
library() # list all available packages
library(lib.loc = .Library) # list all packages in the default library
library(help = splines) # documentation on package 'splines'
library(splines) # load package 'splines'
require(splines) # the same
search() # "splines", too
detach("package:splines")
- How do I install contributed packages?
install.packages() interactive install
install.packages(pkgname) install a specified package.
remove.packages(pkgname) removes a package
library() # list all available packages
library(lib.loc = .Library) # list all packages in the default library
library(help = splines) # documentation on package 'splines'
library(splines) # load package 'splines'
require(splines) # the same
search() # "splines", too
detach("package:splines")
Standard repositories are "http://cran.r-project.org"and its mirror site
http://lib.stat.cmu.edu/R/CRAN.
You should be root to install the libraries systemwide.
Labels:
R quickref
Tuesday, October 18, 2011
Testing code highlighter for blogger.
import math printf "the square root of 2 is ", math.sqrt(2)
This is good! The code highlighter is from http://heisencoder.net/2009/01/adding-syntax-highlighting-to-blogger.html.
This is not the first time we applied this highlighter. It is used for example in our other blog , My Other Life as a Programmer.
Because Google is always trying to find ways to make blogs interesting, the CSS code should be inserted after any template css.
The code should be inserted as escaped html, and in case you need an HTML escaper, you can use the online tool at
http://www.accessify.com/tools-and-wizards/developer-tools/quick-escape/default.php
Labels:
Code Syntax Highlighter.
Subscribe to:
Posts (Atom)


