Friday, August 30, 2013

Effect of Indexes (on a database table's Size)

sp_spaceused
-----------------
sp_spaceused in Sql Server can be used to find a table's size.
Comparing a table's size before & after creating an index can be done using it.

Thursday, August 29, 2013

Google - search by specifying Time

Append the following to the URL -

&tbs=qdr:h   -- past Hour
&tbs=qdr:d   -- past Day
&tbs=qdr:m  -- past Month
&tbs=qdr:y   -- past Year

Sunday, August 25, 2013

Rails - disable sql logging (to not show in "rails server" terminal)

"rails server" log, to become useful, should not have sql lines showing up in between "rendered", "redirected", "Start GET", "Processing by" lines (which are very important at the time of development).

http://stackoverflow.com/questions/7759321/disable-rails-3-1-sql-logging
To turn it off:
old_logger = ActiveRecord::Base.logger
ActiveRecord::Base.logger = nil
To turn it back on:
ActiveRecord::Base.logger = old_logger
(We can do the above in "rails console")

Friday, August 23, 2013

tail & grep

1. search for 1 word

http://stackoverflow.com/questions/7161821/how-to-grep-a-continuous-stream
Turn on grep's line buffering mode.
tail -f file | grep --line-buffered   my_pattern

tail -f /home/saiponduru/dev/pyr/pyr-greenzone/log/development.log | grep --line-buffered Rendered

2. search for multiple words

http://www.cyberciti.biz/faq/searching-multiple-words-string-using-grep/
$ grep 'warning\|error\|critical' /var/log/messagesTo just match words, add -w swith:
$ grep -w 'warning\|error\|critical' /var/log/messagesegrep command can skip the above syntax and use the following syntax:
$ egrep -w 'warning|error|critical' /var/log/messages
I recommend that you pass the -i (ignore case) and --color option as follows:
$ egrep -wi --color 'warning|error|critical' /var/log/messages

tail -f /home/saiponduru/dev/pyr/pyr-greenzone/log/development.log | egrep -wi --line-buffered 'rendered|account'
OR
From pyr-greenzone directory -
tail -f ./log/development.log | egrep -wi 'rendered|account'


Thursday, August 22, 2013

Rails - pass additional parameters while using redirect_to

http://stackoverflow.com/questions/5599698/rails-passing-parameters-in-a-redirect-to-is-session-the-only-way
redirect_to(new_user_path(:notice => 'Please register as a new user', :uid => 'ABCD'))
The params you want to pass are arguments to the new_user_path method, not the redirect_tomethod.

Thursday, August 15, 2013

1 PC -> Multiple PCs

New concepts - Mob Programming, No Estimates

Mob Programming:
http://codebetter.com/marcushammarberg/2013/08/06/mob-programming/
http://mobprogramming.org/

No Estimates:
https://twitter.com/search?q=%23noestimates
http://zuill.us/WoodyZuill/category/estimating/

Mob Programming & No Estimates:
http://mobprogramming.org/how-does-the-mob-get-away-with-no-estimates/


TeamViewer for Mob Programming
- can be used for paired programming (i.e. 2 persons).
- in Meeting mode, we can give control to meeting-participants. This works in the free version also, so TeamViewer can be used for 'mob programming'.

Windows Phone App Studio

http://www.kunal-chowdhury.com/2013/08/windows-phone-app-studio.html
http://www.kunal-chowdhury.com/2013/08/how-to-build-rss-feed-reader-using.html
Microsoft has recently launched a tool called “App Studio” which will allow you to build a Windows Phone app without any programming skill. 
....
Windows Phone App Studio lets you easily build apps for immediate publishing, testing and sharing with clients, co-workers, and friends. When you're ready to add advanced programming features or UI changes, the Windows Phone App Studio also generates source code for you to download. 
 

Javascript Design Patterns

(Have to read this)
http://www.codeproject.com/Articles/636699/JavaScript-Design-Patterns

Talks about :

  • Simulated Classes
  • Module Pattern
  • Revealing Module Pattern
  • Lazy functions

Thursday, August 8, 2013

git - see commits in a branch (that are not in another branch .e.g. master)

To see commits that are there in mybranch but not in master:
git  log  master..mybranch  --oneline

To see commits that are there in master, but not in mybranch:
git  log  mybranch..master  --oneline

git - copy a file from another branch

http://stackoverflow.com/questions/2364147/how-to-get-just-one-file-from-another-branch
git checkout master               # first get back to master
git checkout experiment -- app.js # then copy the version of app.js 
                                  # from branch "experiment"
Basically, if we are copying a file, say file1.js from FROM-B branch to TO-B, then:

git  checkout  TO-B
git  checkout  FROM-B  --  file1.js

git - diff files between 2 branches

To diff a single file in 2 branches:
git diff mybranch master -- myfile.cs
To diff all files in 2 branches:
    git diff mybranch master 

Learn HTML using a game

Sunday, August 4, 2013

HTML, CSS related: Show Div on 'hover' with only CSS

I have seen empty <a> followed by div elements sometimes (like below):
<a>Menu Item</a>
<div>
   some stuff
</div>

The reason for the empty <a> elements is probably the below: 
http://stackoverflow.com/questions/5210033/show-div-on-hover-with-only-css
Assuming HTML4, with this markup:
<a>Hover over me!</a>
<div>Stuff shown on hover</div>
You can do something like this:
div {
    display: none;
}

a:hover + div {
    display: block;
}
This uses the adjacent sibling selector, and is the basis of the suckerfish dropdown menu.
HTML5 allows anchor elements to wrap almost anything, so in that case the div element can be made a child of the anchor. Otherwise the principle is the same - use the :hover pseudo-class to change thedisplay property of another element.

jsfiddle example:

Followers

Blog Archive