My learning notes on Restlet


This blog helped me write helloworld example using a container. I used JBOSS container btw.

http://vatsalad.wordpress.com/2010/01/13/how-to-setup-a-servlet-based-restlet-webservice/

Log level increasing in Restlet :

Add this to jboss vm params

"-Djava.util.logging.config.file="/home/myApp/config/myLogging.properties"


URI:
you need to think about 
1. jboss-web.xml
2. web.xml 
3. Application adding url specifications

Here app is from jboss-web.xml, helloWorld is from Application*.java code. And I have kept "/*" in web.xml
http://localhost:8080/app/helloWorld/


How do I get Maven to use the correct repositories


Answer by romaintaz in stockoverflow..

By default, Maven will always look in the official Maven repository, which is http://repo1.maven.org.

When Maven tries to build a project, it will look in your local repository (by default ~/.m2/repository but you can configure it by changing the <localRepository> value in your ~/.m2/settings.xml) to find any dependency, plugin or report defined in your pom.xml. If the adequate artifact is not found in your local repository, it will look in all external repositories configured, starting with the default one, http://repo1.maven.org.

You can configure Maven to avoid this default repository by setting a mirror in your settings.xml file:

<mirrors>
    <mirror>
        <id>repoMirror</id>
        <name>Our mirror for Maven repository</name>
        <url>http://the/server/</url>
        <mirrorOf>*</mirrorOf>
    </mirror>
</mirrors>

This way, instead of contacting http://repo1.maven.org, Maven will contact your entreprise repository (http://the/server in this example).

If you want to add another repository, you can define a new one in your settings.xml file:

<profiles>
    <profile>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>foo.bar</id>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <url>http://new/repository/server</url>
            </repository>
        </repositories>

You can see the complete settings.xml model here.

Concerning the clean process, you can ask Maven to run it offline. In this case, Maven will not try to reach any external repositories:

mvn -o clean 

Sep 17 2013 reading


Becoz of nearby planets/stars, a dying star becomes a nebula easily. Stars takes only decades to form nebulae

human touch is nano scale level.

human creativity depends on neural network

earth core is solid iron core and is rotating very fast, outercore is liquid and is slow rotating. sometimes inner core is eastwardly or westwardly rotating – controlled by magnetic waves.

wide faced men are aggressive. Due to this, narrow faced men act selfishly.

kids needs fish, soya oil., walnut, spinach, brussel sprouts – omega fatty acid 3 for better reading.  Eat at least thrice a week

Large plankton carry CO2 to ocean floor but not the small planktons.. Cold ocean places absorb more CO2. Tropical places gets more acidity in ocean since less cO2 absorbtion. The increasing acidity is known to affect some calcifying organisms in the Arctic, including certain sea snails, mussels and other molluscs. But scientists did not know until now how ocean acidification alters both the base of the marine food web and carbon transport in the ocean.

Wounding and rubbing exemplify how plants can react to a situation that in principle could cause them to become more vulnerable. Instead, they react to touch by deploying a carefully-orchestrated defence response, an evolutionary skill that that presumably boosts survival.

It turns out we really do like the sound of our own voice. We just may not realize it.

Studying globular clusters is critical to understanding the early, intense star-forming episodes that marked galaxy formation. The Hubble observations also confirm that these compact stellar groupings can be used as reliable tracers of the amount of dark matter locked away in immense galaxy clusters.Globular clusters, dense bunches of hundreds of thousands of stars, are the homesteaders of galaxies, containing some of the oldest surviving stars in the universe. Almost 95 percent of globular cluster formation occurred within the first 1 billion or 2 billion years after our universe was born in the big bang 13.8 billion years ago.

Remember your dream more often? Perhaps you react to your environment more


Probably, yes, a new study suggest that people who react much to any happening to their environment are more likely to remember the dream more often in a month or two than others.

“In response to first names, the high and low recallers produced different waves,” Perrine Ruby, the study’s lead author, told PopularScience.com. “The high recallers seem to be much more reactive to the environment. Low recallers seem to be much more resistant,” she says. This high reactivity could be related to why the high recallers woke up more often during their sleep, a process that probably explains why they remember more in the morning. “There is a strong hypothesis that awakening during sleep facilitates [encoding a] dream in memory,” she explains.

 

source : popsci

Researcher : Perrine Ruby

Useful Commands in Unix


Easy navigation of commands

~ Moves to the user’s home directory.
!! Repeats the line last entered at the shell. See history command for previous commands.
!$ Repeats the last argument for the command last used. See history command for previous commands.
reset Resets the terminal if terminal screen is not displaying correctly.

CTRL + B Moves the cursor backward one character.
CTRL + C Cancels the currently running command.
CTRL + D Logs out of the current session.
CTRL + F Moves the cursor forward one character.
CTRL + H Erase one character. Similar to pressing backspace.
CTRL + P Paste previous line(s).
CTRL + S Stops all output on screen (XOFF).
CTRL + Q Turns all output stopped on screen back on (XON).
CTRL + U Erases the complete line.
CTRL + W Deletes the last word typed in. For example, if you typed ‘mv file1 file2’ this shortcut would delete file2.
CTRL + Z Cancels current operation, moves back a directory or takes the current operation and moves it to the background. See bg command for additional information about background.

 
Diff two folders and list files with difference :
diff -arq folder1 folder2

Diff two folders and list all difference in each file – recursive diff that
ignore spaces, with a unified context.
diff -bur Interfaces/ ~myusername/Interfaces/

My learnings from few geeks


WORK — IN — PROGRESS

Attended sessions:
Jun 12:
Keynote : New york times – CTO Rajiv Pant – api, nodejs, open source

1. Lesson from building and scaling in Linkedin – Jay kreps
– yahoo design, one DB one table
– monolith to SOA
– expresso – (will be open sourced) DB built by Linkedin
– Kafka
– writing new API for every new thing is a mistake- understand the granularity of the API first and then refactor it if make sense than writing a new one
– when you have to explain history of a system to explain current state of a system, then some primary thing is wrong in the system.
– Dont pass serialized java objects over http
– multiple data services wont help – example – writing profileserv which contacts profiledataserv
– selenium –

2. Architecture unconference
1. graph database
2. monitoring – appdynamics
3. jvm tweaks – google – “high frequency trading in java” – heaptrasher
Java GC tuning for High Frequency Trading apps
GC-Less, sqlfire, lockless, off heap memory

3. E pluribus Unum : A survey of multi paradigm programming – Paul Snively
– OPA framework containing NodeJS, MongoDB and JS
– Ur/Web language
– SLICK – framework in scala – Slick
– OCAML – OPAM – cross compiler
opalang
– Functional reactive programming – Flapjax
– Delimited continuation

4. A continous delivery Maturity Model – Eric Minick

5. Facebook Messages : backup and replication : system on HBase – Nicolas Spiegelberg

6. Decomposing Twitter : Adventures in SOA : Jeremy Cloud

– Finagle – rpc for async and to maintain concurrency between java servers.  (like atlas)
– Thrift – like Payments 2 fuel..it has TDL – thrift definition language.
– Redis – Introduction to Redis  – like a cache – Key value store.
– Zookeeper curator
flockdb – twitters DB – opensourced
Key note : First, kill all the product owners – read Daniel H.Pink’s “Drive” book

Jun13:
Keynote :Surviving in a Feudal Security World – Bruce Schneier
1. How Netflix Leverages (“the cloud” + the Netflix Platform) for Rapid Development and Easy Operations
Jeremy Edberg

2. Java Unconference

3. Deep Dive into G1 Garbage Collector  – Charlie Hunt and Monica Beckwith
Getting Started with the G1 Garbage Collector

4. Bringing Java to On-Device iOS & Android Apps  – Frédéric Desbiens
5. Lean Engineering: Applying lean startup principles at Paypal – Bill Scott
 
Jun14:
Keynote : Ted Codd was not a Developer, or a Universal Theory for Big Data – Erik Meijer
1. High performance CPU/GPU clusters – Increasing throughput and decreasing latency by leveraging mechanical sympathy
 – Clive Saha

2. Financial Services Unconference – Amr Elsamadisy

3. Building Modern Web Sites : A Story of Scalability and
Availability – Sid Anand (linked-in, who worked in eBay also)

4. A little graph theory for the busy developer – Jim Webber

5. The past, present, and future of web apps – Erik Bryn &
Facilitating High Availability Via Systematic Capacity Planning – Arun Kejariwal  & Bryce Yan

6.  The Art of Information Refinery at Cue
Daniel Gross
– lucene as database
– interesting – execute “curl -L http://cueup.com/jobs
– @Danicgross
Tornado Web Server – Tornado 3.1 documentation
– Since lucene, Cue company wrote lotta code in Java
systemd-journald.service
– Crash-only software

Trello – todo list

 

Mongo DB commands


windows 7
1) httpd-2.2.22-win32-x86-openssl-0.9.8t
2) mongo php 5.3 vc6 TS
3) php-5.2.17-Win32-VC6-x86
4) mongo driver dll – mongo-1.1.4-php5.2vc6ts

 

MONGODB Win7 installation
apache download :
1) httpd-2.2.22-win32-x86-openssl-0.9.8t

2) php-5.2.17-Win32-VC6-x86
http://www.php.net/manual/en/install.windows.apache2.php – u just need below nothing else.. CGI is not safe. and u need a Thread safe binary .. note the VC6 – u need this particular one..

LoadModule php5_module “c:/php/php5apache2.dll”
AddHandler application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir “C:/php”

 

3) just save the file it gives..its mongo db win 32 (x86) version – dont bother that yours is win8 or win7 – it works http://www.mongodb.org/dr/downloads.mongodb.org/win32/mongodb-win32-i386-2.0.5.zip/download
follow this http://www.mongodb.org/display/DOCS/Quickstart+Windows

4) mongo php driver dll – mongo-1.1.4-php5.2vc6ts (attached the dll already in this email) (see windows section – http://www.mongodb.org/display/DOCS/PHP+Language+Center )

php should be x86 though win7/8 is used

phpinfo() should show mongo installation too

###############################################

 

Start Mongod.exe
C:\Workspace\mongodb-win32-i386-2.0.5\bin>mongod.exe –journal –dbpath=c:\data

 

Start mongo.exe (client)
C:\Workspace\>cd mongodb-win32-i386-2.0.5\bin

C:\Workspace\mongodb-win32-i386-2.0.5\bin>mongo.exe
MongoDB shell version: 2.0.5
connecting to: test
> 3+3
6
> db.foo.insert({a:1})
> db.foo.find()
{ “_id” : ObjectId(“4fc9b8de89f72ecdfcb9a3bd”), “a” : 1 }
>
>
> showdbs
Fri Jun 01 23:56:02 ReferenceError: showdbs is not defined (shell):1
> show dbs
local (empty)
test 0.03125GB
>
> show collection
Fri Jun 01 23:56:13 uncaught exception: don’t know how to show [collection]
> show collections
foo
system.indexes
>
>
> db.items.insert({ name: ‘eggs’, quantity: 10, price: 1.50 })
> show collections
foo
items
system.indexes
>
>
> db.items.find()
{ “_id” : ObjectId(“4fc9bbb589f72ecdfcb9a3be”), “name” : “eggs”, “quantity” : 10
, “price” : 1.5 }
>
> db.items.insert({ id:1, name: ‘bacon’, quantity: 3, price: 3.50 })
> db.items.insert({ id:2, name: ‘tomatoes’, quantity: 30, price: 0.50 })
>
> db.items.find()
{ “_id” : ObjectId(“4fc9bbb589f72ecdfcb9a3be”), “name” : “eggs”, “quantity” : 10
, “price” : 1.5 }
{ “_id” : ObjectId(“4fc9bbcf89f72ecdfcb9a3bf”), “name” : “bacon”, “quantity” : 3
, “price” : 3.5 }
{ “_id” : ObjectId(“4fc9bbd789f72ecdfcb9a3c0”), “name” : “tomatoes”, “quantity”
: 30, “price” : 0.5 }
>
>

 

> db.User.drop()
true

db.users.find({last_name: ‘Smith’}, {‘ssn’: 1});

##########################

Document.where(somecriteriahere: “criteriavaluehere”).update_all(
updated_at: Time.now.to_s)

##############################
original_id = ObjectId()
db.places.insert({
“_id”: original_id,
“name”: “Broadway Center”,
“url”: “bc.example.net”
})

db.people.insert({
“name”: “Erin”,
“places_id”: original_id,
“url”: “bc.exmaple.net/Erin”,
})

#############################

 

VIM Shortcuts


 

VIM block Selection and Editing

VIM has the ability to select text in rectangular blocks in VISUAL BLOCK mode. Hit CTRL-V and you can extend the selection column by column. This doesn’t allow you to have 0 width selections or to move and extend the selection into columns that do not exist on disk however (huge drawback!). I’m still not sure how to then insert text on each line either. A work in progress… if you know how, please let me know. Thank you Jonathan Lee! – Here’s what I know: After selecting a block with Ctrl-v, press I (shift-i) to insert text in front of the block. While you are editing, it will only show the insertion on the first row. Once you are done, press ESC and the insertion will be done on all of the other rows. To append data after a block, press A (shift-a), type in the text you want then press ESC. If you want to insert data at the end of a block of rows, select the rows you want vertically then press $. This will select everything to the right of the column you were on. Now press A (shift-a) as before, enter the text you want then press ESC.

source : http://dave.thehorners.com/tech-talk/programming/227-rectangular-selection-or-column-mode-the-best-text-editor-feature-ever

VIMRC shortcuts
set autoindent                ” always set autoindenting on
set nocompatible        ” Use Vim defaults (much better!)
set bs=2                ” allow backspacing over everything in insert mode
set autoindent                  ” always set autoindenting on
set si                        ” than 50 lines of registers
set bg=dark
set incsearch
set ic
set hlsearch
set cindent
set tags=$BUILDTOP/tags
” setlocal spell spelllang=en_us
set nospell
“set diffopt=iwhite
” Use following to highlight in Vim.
” :highlight Normal ctermbg=black ctermfg=white
” In text files, always limit the width of text to 78 characters
“autocmd BufRead *.txt set tw=78 

” Don’t use Ex mode, use Q for formatting
“map Q gq

” Switch syntax highlighting on, when the terminal has colors
” Also switch on highlighting the last used search pattern.
 syntax on

” F2 to sort/align/intend a xml blob
map #1 o<table>^M  <tr>^M    <td>^M    </td>^M  </tr>^M</table>
map #2 o<ul>^M  <li></li>^M</ul>
map #3 o<ul>^M  <li><a href=”“></a></li>^M</ul>
map <F2> <Esc>:1,$!xmllint —format -<CR>

Working in Windows Console


 

1. Need something like alias ?

Example: doskey vi=”C:\Program Files\Sublime Text 2\sublime_text.exe” $*

2. install rubydev tool kit to your windows : it has grep, ls, find, awk, sed and so many useful commands for windows

3. Call another bat from a cmd file: 

“call c:\rubyToolKit\devkitvars.bat”

4. Current pwd from a cmd file

set EDE_HOME=%CD%

Regex Keywords


 Checkout : http://www.fon.hum.uva.nl/praat/manual/Regular_expressions_1__Special_characters.html

http://www.zytrax.com/tech/web/regex.htm

1. finding link with “.gz>”

http[:][/]+[a-z]+.[a-z]+.*[.gz]>

[] – matches that character

* – till end of line

. – any character – counts only one.

[.gz] > – till it finds first “.gz>” in the line.

+ – the plus is the match-one-or-more quantifier.

actualy i dont need [a-z] two times and * would do, but anyway..