Tuesday, May 21, 2013

R - Part 1

A start with R (to be cont'd)

  • Get the RStudio at here
  • install.packages("devtools")
  • library(devtools)
  • install_github("slidify","ramnathv")
  • install_github("slidifyLibraries","ramnathv")



Approaches of Efficient Academic Reading

Sometimes it is easier to say than done. Follow by the following points which I got inspired from Michael Hanson and Dylan McNamee version of "Efficient Reading of Papers in Science and Technology". Stick to these principles for a while, progress will be accumulated and ideas will be inspired.

Skim Reading

  • Abstract is a good way to get the general idea of what the paper is about.
  • Introduction is a good way to know the background of the proposed solution to a current problem.
  • Algorithm gives the analysis of the justification of the proposed theoretical idea and implementation shows the validation of the proposed idea.
  • Conclusion shows the merits and some drawbacks maybe for further research. 

Thorough Reading

  • Pay attention to the proposed approach.
  • Be aware of the limitation and challenges.
  • Examine the assumption, methods, statistics, reasoning and conclusion.
  • Take notes while reading and Highlight major points.
  • Think through the conclusion by yourself.

Another thing to bare in mind is that always examine the credibility of the paper before the thorough reading. Typical approach can be a look on the abstract, the conference and the bibliography.

I DO believe there is no shortcut when it comes to critical study. Absorb other's fruit before make a further step upon other's contribution.

Friday, May 17, 2013

Python - Part 2 Playing with Twitter API


Install Python if never installed before:
bowen@bowen:~$ sudo apt-get install python-pip python-dev build-essential

bowen@bowen:~$ sudo pip install python-twitter

Run Python
bowen@bowen:~$ python
>>> import twitter
>>> api = twitter.Api()
>>> api = twitter.Api(consumer_key='consumer_key',consumer_secret='consumer_secret', access_token_key='access_token', access_token_secret='access_token_secret')

#Replace all ' ' into your own key.

Some functionality that we can play with:
>>> users=api.GetFriends()
>>> print [u.name for u in users]

>>> statuses = api.GetUserTimeline()
>>> print [s.user.name for s in statuses]

>>> status = api.PostUpdate('Test Twitter message via Python')


And acquiring more information even without third party package:

import urllib
import simplejson

def searchTweets(query):
 search = urllib.urlopen("http://search.twitter.com/search.json?q="+query)
 dict = simplejson.loads(search.read())
 for result in dict["results"]: # result is a list of dictionaries
  print "*",result["text"],"\n"

# we will search tweets about "gator game" 
searchTweets("gator+game&rpp=50") # &rpp here is to offer arbitrary results that is more than 15.

Just list a few results here:
* RT @colebutler787: Great game tonight guys! @eLEMONator17 @BrandonMoz89 @JonathanW37 @JustenKinder @sirtwinksalots @khumphries734 @gator_dav15 @TheDaveMaster0

* RT @colebutler787: Great game tonight guys! @eLEMONator17 @BrandonMoz89 @JonathanW37 @JustenKinder @sirtwinksalots @khumphries734 @gator_dav15 @TheDaveMaster0

* @BrandtSnedeker at a Florida Gator football game, duh

* RT @colebutler787: Great game tonight guys! @eLEMONator17 @BrandonMoz89 @JonathanW37 @JustenKinder @sirtwinksalots @khumphries734 @gator_dav15 @TheDaveMaster0

* RT @colebutler787: Great game tonight guys! @eLEMONator17 @BrandonMoz89 @JonathanW37 @JustenKinder @sirtwinksalots @khumphries734 @gator_dav15 @TheDaveMaster0

* RT @colebutler787: Great game tonight guys! @eLEMONator17 @BrandonMoz89 @JonathanW37 @JustenKinder @sirtwinksalots @khumphries734 @gator_dav15 @TheDaveMaster0

* RT @CHCAWarriors: Awesome crowd at tonight's game.
 Final CHCA 6 St. Luke's 6
Good jobs guys, time to hit the weight room and get ready for the fall.

* Great game tonight guys! @eLEMONator17 @BrandonMoz89 @JonathanW37 @JustenKinder @sirtwinksalots @khumphries734 @gator_dav15 @TheDaveMaster0

* I liked a @YouTube video from @iheartmakeup92 http://t.co/Tflm5sFnt4 Get Ready With Me│GATOR GAME STYLE

* You can't have a conscience in the pimp game. #gator

* RT @Jhalapio33: Had a lot of tackles today with two assist tackles and 2 sacks ! Blessed with a good game !

* @0hMelissaRegan yay Zoey!!!!! Man I might have to go to a Gator game to see her cheer... Eeeeee.... We will have to make it the FSU/UF game

* If Gametracker is tracking the UGA-UF game in real time, then it took Gator reliever Parker Danciu 12 minutes to throw to one batter.

* I can't belive that was my last game as a gator, I'm going to miss it so much 😭

* RT @DoubleO_55: Pumped for the the blue and gold game.🏈 #blueteamswag @AlRoberts16 @J_Flinno @gator_68 @T_sully42 @JaredEidson6 @CadenRicketts


Thursday, May 16, 2013

Data Structure and Algorithm Study Notes 1

For object-oriented design approach, the three FUNDAMENTAL TO OO-DESIGN list below is important:
  • Abstraction
  • Encapsulation
  • Modularity
The main idea of abstraction is to distill a complicated system down to its most fundamental parts and describe these parts in a simple, precise language. (Example: "edit" menu in a text-editor GUI, copy or paste will not appear unless click the menu)
Encapsulation, or information hiding, states that different components of a software system should implement an abstraction, without revealing the internal details of that implementation. (Example: "edit" menu itself tells the functionality very well)
Modularity refers to an organizing structure, in which the different components of a software system are divided into separate functional units. (Example: organized architect designed house - electrical, heating and cooling, plumbing and structural [interact in well-defined ways: In doing so, he or she is using modularity to bring a clarity of thought that provides a natural way of organizing functions in to distinct manageable units]) 

Notation:
The "Big-Oh" Notation
f(n) is O(g(n)) if there is a real constant c>0 and an integer constant m>=1 such that f(n)<=cg(n) for every integer n>=m.
//NOTE: Usually, g(n) is the highest order of f(n).

The "Big-Omega" Notation
f(n) is Ω(g(n)) if there is a real constant c>0 and an integer constant m>=1 such that f(n)>=cg(n) for every integer n>=m.

The "Big-Theta" Notation
f(n) is Θ(g(n)) if f(n) is O(g(n)) and Ω(g(n)) at the same time.

Monday, May 13, 2013

Python - Part 1

Install Python and run the Python Shell.

The command line offers the functionality that you can directly input the arithmetic calculations and string inputs. For example, type "3<4" and get the "True" results.
Another example, type
>>> three = str('3')
The results will be '3' if you type three

There are also other special arithmetic calculations apart from normal add, subtract, multiplication, and division such as // (integer division), not (as opposed to), and (both statement has to be in order to get "True"), or (either one of the statement is true to make the result "True"), etc.

Now consider
>>> num = int(input('give me a number'))
if you input number like 500, the num can be compared as a number.
>>> num2 = 400
>>> num > num2
True