Wednesday, November 5, 2014

BIG-DATA-TECH BLOGS

It's been long long time I have blogged and wanted to get heads up on things.
Below are the few technical blogs that I follow on everyday basis to improve my BIG DATA knowledge in the field that I work:


http://techblog.netflix.com/
https://blog.twitter.com/engineering
https://developers.facebook.com/


You are always welcome to comment if you feel I missed few amazing blog. Would surely add them to the list.

Monday, October 15, 2012

Setting up HBase on Windows x64 VM



Yes, there is an “official” guide to HBase installation for Windows, but it seems to be written for older versions of HBase. Some steps are not necessary anymore, but on the other hand, there are some steps that weren’t mentioned, but are crucial (like the ZooKeeper stuff).
This tutorial will guide you through the HBase installation which is based on the Cygwin in a way that is similar to the official guide. I have tested this on Windows 7, 64bit.

Downloading Cygwin

  1. download cygwin setup.exe and run it
  2. choose an appropriate mirror
     I will assume that Cygwin will be installed into C:\Programs\CygwinDo not install Cygwin into a folder that contains a space character (C:\Program Files). If you do so, you will face many random and unexpected troubles.
  3. from packages, choose the following:
    • OpenSSH,
    • tcp_wrappers,
    • diffutils [this should be pre-selected],
    • zlib
  4. proceed with installation until it is finished.

Configuring Cygwin

  1. run CygWin Bash Shell with Administrator privileges (C:\cygwin\Cygwin.bat)
  2. from this Bash shell run ssh-host-config
    • say “yes” to privilege separation
    • say “yes” to create the sshd account
    • say “yes” to install sshd as a service
    • press to enter an empty value of CYGWIN for the daemon
    • Now Cygwin needs to create a new account that will be used as a “proxy”/setuid origin account. Say “no” to use the default name (cyg_server).
    • say “yes” to create a new privileged account cyg_server.
    • create a password for this new privileged account and confirm it
  3. synchronize Windows user accounts with Cygwin user accounts:
    mkpasswd -cl > /etc/passwd
    mkgroup --local > /etc/group
    
  4. start SSH server with net start sshd
  5. test connection with ssh localhost from Cygwin Bash Shell.
    • say “yes” to check and store server fingerprint
    • put your Windows account password to authenticate
    • issue a few test commands in the remote session
    • close session with exit.
  6. alternatively: test your SSHD with putty.

Configuring HBase

  1. I assume that you have Java JDK installed (if not, it’s time to do that now.) However, I assume that Java is installed into a file without spaces in the name. (Again, noC:\Program Files\Java.). If you have a previous Java installation with a space-using filename, reinstall it now.
  2. Download HBase from Apache Site. Unpack it into an appropriate folder. I assume this should be C:\java\hbase.
  3. Open ./conf/hbase-env.sh in HBase directory
    • uncomment and modify this line so it reads:
      export JAVA_HOME=/cygdrive/c/java/jdk7
      
    • uncomment and modify this line so it reads:
      export HBASE_CLASSPATH=/cygdrive/c/java/hbase/lib/zookeeper-3.4.3.jar 
      
  4. Copy ./src/main/resources/hbase-default.xml to ./conf
  5. Open ./conf/hbase-default.xml in HBase directory
    • Change hbase.rootdir to /tmp
       This will resolve into C:\tmp on Windows. We will create it later.
    • Change hbase.tmp.dir to C:/programs/cygwin/root/tmp/hbase/tmp
       This also assumes that Cygwin is installed intoC:\programs\cygwin.
    • If you have a computer that has no domain name, then determine your hostname: either by running hostname from shell or from System Properties | Computer Name tab. For example, my PC has hostname rn-PC.
    • Change hbase.zookeeper.quorum to rn-PC instead of localhost
       Windows 64-bit seems to have trouble resolving localhost to127.0.0.1.
    • Change hbase.defaults.for.version.skip to true instead of false
       This will disable weird version warnings. We are actually running HBase from “uncompiled” source tree, therefore some config files get unprocessed. Despite the fact that HBase is being built by Maven, it is heavily depending on Linux tools and building requires lots of hacking. Fortunately, it is not necessary.
  6. Create the appropriate directories. Execute this from Cygwin Bash Shell:
    mkdir -pv /root/tmp/hbase/data
    mkdir -pv /cygdrive/c/tmp
    
  7. Grant the appropriate rights
    chmod 777 /root/tmp/hbase/data
    chmod 777 /cygdrive/c/tmp
    

Running HBase

  1. Within Bash, change dir to
    cd /cygdrive/c/java/hbase
    
  2. Run
    ./bin/start-hbase.sh/
    
  3. Enter password twice and HBase should start. On the first run, you may be prompted for the SSH fingerprint mismatch — in that case, just confirm with “yes”. Ideally, the console should show:
    $ ./bin/start-hbase.sh
    rn@127.0.0.1's password:
    127.0.0.1: starting zookeeper, logging to /cygdrive/c/java/hbase/bin/../logs/hbase-rn-zookeeper-rn-PC.out
    starting master, logging to /cygdrive/c/java/hbase/bin/../logs/hbase-rn-master-rn-PC.out
    rn@localhost's password:
    localhost: starting regionserver, logging to /cygdrive/c/java/hbase/bin/../logs/hbase-rn-regionserver-rn-PC.out
    
  4. In case of failure, check the log files (see the C:\java\hbase\log).
  5. HBase can be stopped with
    ./bin/stop-hbase.sh.
    
    Note that you should wait for the stopping of the server (it may take a long time), otherwise you risk data corruption.

Using HBase

  1. Start Hbase server.
    ./bin/start-hbase.sh/
  2. Start Bash and start the HBase Shell:
    ./bin/hbase shell
    
  3. Create a simple table:
    create 'test', 'data'
    
  4. Verify that the table has been created
    list
    
  5. Insert some data:
    put 'test', 'row1', 'data:1', 'value1'
    
  6. List all rows in the table
    scan 'test'
    
  7. Optionally, drop table
    disable 'test'
    drop 'test'
    
  8. You can leave the HBase shell with exit.

Tuesday, October 2, 2012

Big Data Had Ooop!!!

If your a beginner and planning to learn more about big data and hadoop below are the few tutorials I recommend and I found interesting:

Books :
Hadoop: The Definitive Guide

Links:
++ Beginner Hadoop ++ 
http://www.cloudera.com/protected/?resource=introduction-to-apache-mapreduce-and-hdfs

http://nosqltapes.com/video/understanding-mapreduce-with-mike-miller



++ MapReduce Framework ++ 
Great 1 hour video introduction: http://nosqltapes.com/video/understanding-mapreduce-with-mike-miller

Read the famous 2004 paper from Google that kicked off the MapReduce revolution. This is a very readable paper that can be digested in about 2 - 3 hours:http://research.google.com/archive/mapreduce.html

Here's a 33 minute video on what kinds of simple things you can do with MapReduce: 
http://www.cloudera.com/videos/mapreduce_algorithms

Google's MapReduce course: 
http://code.google.com/edu/parallel/mapreduce-tutorial.html


These are few I have read, I will keep adding links to this as and when I get a good article that catches my wink.

Thursday, April 12, 2012

MACRUBY--- It's just ruby mac.. :)

Recently I read when I saw "MACRUBY" in hacker's shelf, I couldn't resist myself to pick one of these books.Have look about in the link below:
http://hackershelf.com/book/69/macruby/
  
When I started going through this book I felt , I was reading Nu Language details one more time... but it's different trust me. Don't loose me here.I love to code in ruby. I have used Ruby cocoa in the past. Mac Ruby is better in other words as u have the best of Ruby 1.9 + Objective C. Its the best for native OS problems.Learning MacRuby does not require you to rem Object C(Atleast I saw the last Object C code in year 2007!!! so i was like OBJECT C.. I don't think I rem anything)

Best things about MacRuby is it uses YARV(Yet Another Ruby VM) which is a byte code interpreter.. performance time is great in this VM and not MAtz ruby interpreter.Time difference is like 16 sec : 5 sec. 

MacRuby Threads implementation is way beyond ruby as they are native thread and unlike ruby which was impossible to call back from p-threads.This can be done pretty easily using MacRuby.So where is Object C popping in... :) When We look into the performacnec scale of the garbage collector of ruby it is veryyyyy slow, Mac Ruby uses Object C for the rescue.The new Objective-C garbage collector engine, due to its generational nature, performs fast collections. It also doesn't stop the world while collecting memory, because collections are done in a separate thread.In MacRuby, all Ruby classes and objects are actually Objective-C classes and objects. There is no need to create costly proxies, convert objects, and cache instances. A Ruby object can be cast (toll-free) at the C level as an Objective-C object. The Ruby VM can also handle incoming Objective-C objects without conversion.
In MacRuby, the primitive Ruby classes (e.g., String, Array, and Hash) have been re-implemented on top of their Cocoa equivalents (respectively, NSString, NSArray, and NSDictionary). As an example, all strings in MacRuby are Cocoa strings, so they can be passed directly to underlying C or Objective-C APIs. It is also possible to call any method of the String interface on any Cocoa string, subclass Objective-C methods, etc.Need to test with audio codecs and image processing implementations.
Will post my video aggregation in twitter using MACRuby 0.10 shortly in My GIT account, keep following it.
Mac Ruby is nothing but RUBY 1.9 with MACOSX Framework On Mac






and it ROCKS!!!! 

Monday, September 5, 2011

RUBY ON RAILS Interview Questions

I wanted to post some interesting very few questions and answers on occasion of teachers day today!!!! Some the mandatory and interesting questions clubbed together in an interview Here I go... :). This is just not for jobs for your interest toooooo
1. Why Ruby on Rails?
Ans: There are lot of advantages of using ruby on rails(check the meaning of this in the book.)
  • DRY Principal(Dont Repeat Yourself)
  • Convention over Configuration
  • Gems and Plugins
  • Scaffolding
  • Pure OOP Concept
  • Rest Support
  • Rack support
  • Action Mailer
  • Rpc support
  • Rexml Support etc..

2. Explain about the programming language ruby?
Ans:Ruby is the brain child of a Japanese programmer Matz. He created Ruby. It is a cross platform object oriented language. It helps you in knowing what your code does in your application. With legacy code it gives you the power of administration and organization tasks. Being open source, it did go into great lengths of development.
.Ruby is a Dyanmic-type programming language and mainly referred to as Duck-typing.

3. Explain about ruby names?
Ans:Classes, variables, methods, constants and modules can be referred by ruby names. When you want to distinguish between various names you can specify that by the first character of the name. Some of the names are used as reserve words which should not be used for any other purpose. A name can be lowercase letter, upper case letter, number, or an underscore, make sure that you follow the name by name characters.

4. What is the Difference between Symbol and String?
Ans: Symbol are same like string but both behaviors is different based on object_id, memory and process time (cpu time) Strings are mutable , Symbols are immutable.But, testing two symbol values for equality (or non-equality) is faster than testing two string values for equality,

Mutable objects can be changed after assignment while immutable objects can only be overwritten.
For example:
p "string object jak".object_id #=> 22956070
p "string object jak".object_id #=> 22956030
p "string object jak".object_id #=> 22956090

p :symbol_object_jak.object_id #=> 247378
p :symbol_object_jak.object_id #=> 247378
p :symbol_object_jak.object_id #=> 247378

p " string object jak ".to_sym.object_id #=> 247518
p " string object jak ".to_sym.object_id #=> 247518
p " string object jak ".to_sym.object_id #=> 247518

p :symbol_object_jak.to_s.object_id #=> 22704460
p :symbol_object_jak.to_s.object_id #=> 22687010
p :symbol_object_jak.to_s.object_id #=> 21141310

Note : Each unique string value has an associated symbol

5. What is Session and Cookies?
Ans:
Session: are used to store user information on the server side.
Cookies: are used to store information on the browser side or we can say client side
Example: Session : say session[:user] = “jyotsnac” it remains when the browser is not closed

6. Difference between render and redirect?
Ans:
render example:
    render :partial
    render :new

  It will render the template new.rhtml without calling or redirecting to the new action.

redirect example:

 redirect_to :controller => ‘users’, :action => ‘new’

  It forces the clients browser to request the new action.
7. What is the Difference between Static and Dynamic Scaffolding?
Ans:
The Syntax of Static Scaffold is like this:
ruby script/generate scaffold User Comment
Where Comment is the model and User is your controller, So all n all static scaffold takes 2 parameter i.e your controller name and model name, whereas in dynamic scaffolding you have to define controller and model one by one.
8. How you run your Rails Application without creating database ?
Ans:
You can run application by uncomment the line in environment.rb

Path => rootpath conf/ environment.rb
# Skip frameworks you're not going to use (only works if using vendor/rails)

    config.frameworks -= [ :action_web_service, :action_mailer,:active_record ]

9. How to use sql db or mysql db. without defining it in the database.yml
Ans:
You can use ActiveRecord anywhere!

require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection({
:adapter => 'postgresql',
:user => 'foo',
:password => 'bar',
:database => 'whatever'
})

class Task <>
set_table_tame "a_legacy_thingie"

def utility_methods
update_attribute(:title, "yep")
end

end

Task.find(:first)

It’s ActiveRecord, you know what to do. Going wild:
ActiveRecord::Base.establish_connection(:adapter => "sqlite3",:dbfile => ":memory:")
ActiveRecord::Schema.define(:version => 1) do
create_table :posts do |t|
t.string :title
t.text :excerpt, :body
end

end

class Post <>
validates_presence_of :title
end

Post.create(:title => "A new post!")
Post.create(:title => "Another post",
:excerpt => "The excerpt is an excerpt.")
puts Post.count

10. What are helpers and how to use helpers in ROR?
Ans:
Helpers (“view helpers”) are modules that provide methods which are automatically usable in your view. They provide shortcuts to commonly used display code and a way for you to keep the programming out of your views. The purpose of a helper is to simplify the view. It’s best if the view file (RHTML/RXML) is short and sweet, so you can see the structure of the output.

11. What is Active Record?
Ans: Active Record are like Object Relational Mapping(ORM), where classes are mapped to table , objects are mapped to columns and object attributes are mapped to data in the table

12. Ruby Support Single Inheritance/Multiple Inheritance or Both?
Ans:
Ruby Supports only Single Inheritance.
You can achieve Multiple Inheritance through MIXIN concept means you achieve using module by including it with classes. A good blog to understand Mix-in concepts http://juixe.com/techknow/index.php/2006/06/15/mixins-in-ruby/

13. What is the naming conventions for methods that return a boolean result?
Ans:
Methods that return a boolean result are typically named with a ending question mark. For example: def active? return true #just always returning true end


14. What is the naming conventions for methods that return a boolean result?
Ans:
Methods that return a boolean result are typically named with a ending question mark. For example: def active? return true #just always returning true end

15. How do the following methods differ: @my_string.strip and @my_string.strip! ?
Ans:
The strip! method modifies the variable directly. Calling strip (without the !) returns a copy of the variable with the modifications, the original variable is not altered.
16. What's the difference in scope for these two variables: @name and @@name?
Ans:
@name is an instance variable and @@name is a class variable, where it is a single variable for all the instances of a class

17. What is the log that has to seen to check for an error in ruby rails?
Ans:
Rails will report errors from Apache in log/apache.log and errors from the Ruby code in log/development.log. If you're having a problem, do have a look at what these logs are saying. On Unix and Mac OS X you may run tail -f log/development.log in a separate terminal to monitor your application's execution.

18. What is the use of global variable $ in Ruby?
Ans:
A class variable starts with an @@ sign which is immediately followed by upper or lower case letter. You can also put some name characters after the letters which stand to be a pure optional. A class variable can be shared among all the objects of a class. A single copy of a class variable exists for each and every given class.
To write a global variable you start the variable with a $ sign which should be followed by a name character. Ruby defines a number of global variables which also include other punctuation characters such as $_ and $-k.

For example: If you declare one variable as global we can access any where, where as class variable visibility only in the class Example
class Test
def h
 $a = 5
 @b = 4

while $a > 0
puts $a
$a= $a - 1
end
end
end
test = Test.new
test.h
puts $a                    # 5
puts @b                   #nil

19. Default access specifier of default constructor in ruby?
Ans:Default access specifier is the same as the access specifier of the class. default constructor means the constructor with out arguments.

20. What is the use of super in ruby rails?
Ans:
Ruby uses the super keyword to call the superclass implementation of the current method


21. What is the difference between nil and false in ruby?
Ans:
False is a boolean datatype, Nil is not a data type it have object_id 4

22. How is class methods defined in Ruby?
Ans:
A:def self.methodname
--------
--------
end
or
def classname.methodname
--------
--------
end
or

class >> self {
def methodname
end
}

23. How is object methods defined in Ruby?
Ans:

class jak

def method1

--------
--------
end

end

obj=jak.new

It is single object
def obj.object_method_one
--------
--------
end

obj.Send(object_method_every)

It will be created every for every object creation

24. What are the operators available in Ruby?
Ans:
Something that’s used in an expression to manipulate objects such as + (plus), - (minus), * (multiply), and / (divide). You can also use operators to do comparisons,such as with <, >, and &&. 

25. What are the looping structures available in Ruby?
Ans: for..in
untill..end
while..end
do..end

Note: You can also use each to iterate a array as loop not exactly like loop
26. What are the object-oriented programming features supported by Ruby?

Ans:
Classes,Objects,Inheritance,Singleton methods,polymorphism(accomplished by over riding and overloading) are some oo concepts supported by ruby.

27. What is the scope of a local variable in Ruby?
Ans:
A new scope for a local variable is introduced in the toplevel, a class (module) definition, a method defintion. In a procedure block a new scope is introduced but you can access to a local variable outside the block.
The scope in a block is special because a local variable should be localized in Thread and Proc objects.

28. How is an iterator handled in Ruby?

Ans: Iterator is handled using keyword 'each' in ruby.
For example
number=[1,2,3]
then we can use iterator as
number.each do |i|
puts i
end
Above prints the values of an array $no which is accomplished using iterator.

29. How is visibility of methods changed in Ruby?
Ans: By applying the access modifier : Public , Private and Protected acces Modifier


30. What is the use of load and require in Ruby?
Ans: A method that loads and processes the Ruby code from a separate file, including whatever classes, modules, methods, and constants are in that file into the current scope. load is similar, but rather than performing the inclusion operation once, it reprocesses the code every time load is called.

31. Explain about class libraries in ruby?
Ans: Ruby has a strong set of class libraries and it covers from a variety of domains such as thread programming, domains and data types. Also ruby is a new language and it also has additional libraries coming every day. Many of the new languages which do exist have huge libraries because of their age.

32. Explain about portability?
Ans: Ruby language can be ported to many platforms. Ruby programs can be ported to many platforms without any modification to the source code. This feature made the language very useful and highly used by many programmers worldwide. Some of the platforms used are DOS, UNIX, WINDOWS, etc.

Tuesday, April 19, 2011

Great Indian Developer Summit 2011

I registered for the developer summit at 9a.m on 20th of april, everything started on time. Nice to see everything (sessions/breaks/meeting) absolutely going on time.
Add caption

The first talk was on user experiences on the user visual, sound and think is taken care of by Arijit Chaterjee.Things like attention, focus, beauty and trust are major parts things to put in mind while creating the website. Jazzy is never in, keep that in mind. His major concern was peep into the mind of the user. If you wanna sell a colorful website to a enterprise company. They wont go ahead with the purchase thinking this is just not what we see in out daily life.

Small chat on  Building trust on website which actually explains why is trust such an important entity to come back to the website. Few ailments where the popularity about the website can come down due to data-centers crash and mainly if the site is even hacked once.

In go in depth I was more interested in the HTML5 session overall.When all browsers are HTML5 compatible then why not our websites, this was my basis of interest in today's blog

Scott Davis.... OMG I have been reading his book Groovy recipes, really nice to see the person in here.He gave a talk on the HTML5  owns a company called ThristyHead.com. It was majorly a talk on HTML5 than hands on.Doctype from HTML5 wont have version types and all the browsers are forward compatible.He kept his base on the statement "Semantics Over Markup"
continued with this was Mr. Venkat Subramainyam which is more of the hands on project about HTML5 can be viewed in the below given link.
Next session was by Harish Vaidyantath on the beauty of the websites using HTML5. There was a basic talk on how IE9 is far better than google chrome in CPU performance, which is given above.Standards of html5 are being update at html5labs

FACTS about HTML5: This is a small brief of incite on HTML5 I got from the summit, wait for my future post on HTML5... :)
1)This brings new elements like email , canvas ans many more.
2)If it doesnt understand the input type then it comes as default text.
3)Custom qwerty key can be created by input texts given.
4)Cache Manifest: to work offline , Resource: To work online and Fallback: both offline and online
5)Semantics app is for browser information and local storage is storage of the data.
6)New video support is amazing but support by browsers with one codec will take time.
7) It is 2D but there are 3D applications that can be made so.
8) This is a standard of HTMl5 which needs to be followed by all the browsers

There was an illusionist show at the GIDS 2011 and it was 1 hour of amazing illusion happening.

End of the day attended 2 sessions from Scott Davis and Tim. Scott Davis gave a lecture on micro-formats which actually says usage of semantics help you improvise search by SEO(Search Engine Optimization). Napster gave free music but iTunes gave the same song for 99 cents giving metadata of the song. To date iTunes is a great hit.Meta-data always gain points. A List Part is the best site that should be used was pointed by him. Social Graph should be used for testing SEO. Tim gave a tutorial on Gaelyk and app built on this , amazing for a small business.

Major disappointment was playbook was not available at the blackberry counter. I expected at least the same advertisement shown in the you toube they ll b showcase more than that. It was absolute 30 min waste of time.It could much interesting session by Andrew.

Of all in my favorite speaker of the day is Scott Davis

Saturday, September 18, 2010

Pairing algorithm

I cam across a very good question, I posted my anwser in java, If any one interested can post it in any other languages also.

Write a function, Brackets(n), where n is an integer, which will print all valid pairings of parenthesis. For example, Brackets(3) should print
()()()
(())()
()(())
(()())
((()))

Try not to use brute force and generate 2^n combinations.

My solution to the above question in JAVA is

package solved200;

import java.util.Stack;

public class Brackets {

private final int n;

String open = "(";
String close = ")";
String[] tokens = new String[]{open, close};

Stack mainStack;
int count;

public Brackets(int n) {
this.n = 2*n;
mainStack = new Stack
();
}

public void printBrackets(){
printBracketsHelper(this.n, 0, 0);
}

private void printBracketsHelper(int k, int numCloseBrackets, int numOpenBrackets){

if(k == 0){
if( numOpenBrackets == numCloseBrackets) {
count++;
printStack();
}
return;
}
for(int i = 0; i < tokens.length; i++){ boolean addToStack = false; String curToken = tokens[i]; if(mainStack.size() == 0) { if( curToken.equals(close)) { push(curToken); numCloseBrackets++; addToStack = true; } } else { if( curToken.equals(open)){ if( numOpenBrackets + 1 <= numCloseBrackets) { push(curToken); numOpenBrackets++; addToStack = true; } } else if( curToken.equals(close)){ if( numOpenBrackets <= numCloseBrackets + 1) { push(curToken); numCloseBrackets++; addToStack = true; } } } if( addToStack ) { printBracketsHelper(k-1, numCloseBrackets, numOpenBrackets); String popStr = mainStack.pop(); if( popStr.equals(close)) numCloseBrackets--; else if (popStr.equals(open)) numOpenBrackets--; } } } private String push(String curToken) { // System.out.println("PUSH " + curToken); return mainStack.push(curToken); } private void printStack() { System.out.print(count + ": "); for(int i = mainStack.size() - 1; i>=0; i--){
System.out.print(mainStack.get(i));
}
System.out.println();
}

public static void main(String[] args) {
Brackets b = new Brackets(15);
b.printBrackets();
System.out.println("Total : " + b.count);
}

}

Monday, September 13, 2010

Worst Journey's

I know I am diverting from my topic of giving only technology content in this blog but I really need a space to express my anger and need a solution to this.

sep12 hyd -> bang
Small suggestion to all those people who travel by bus frequently for outstations. then read this blog. Yesterday due to heavy festive season rush I got a private bus ticket(OMER travels) before a month. My travel starts like this: I was taken to afzal gunj(charminar area) in a van, pushed me in a small compact room, above all it was raining. I waited there from 9-11:30 for my bus to arrive, few ppl got furious, there was a fight n every person in that room was pushed outside the room. Everyone got drenched, there was no conclusion for the fight at all. I paid Rs 1550/- for the ticket to travel which is a double the cost of the whole journey. There were people who paid more than 2K for the same travel. 2 buses arrived after a long wait which didn't even seem like a volvo. I went and sat in my seat, I saw a guy in my next seat. I just asked him, Sir this is ladies seat. He said this fellow gave me the ticket an hour back.When I went down of the bus to ask him about my seat, I could see he had lot of ppl shouting at him as he sold one seat to 2 ppl. I went and asked him that my next seat is not given to ladies. His answer was so wat? I really want to thank the guy next to me for his co-operation and sensibility he asked few ladies to exchange with his seat. They didn't give blankets, bus was freezing.Topping to all, bus stopped in the middle of a forest. A guy comes shouting sab log utaro, Yeah bus abhi mumbai jayegi. For a while I thought bus got hijacked... :) But the guy said u need to go n sit in the other bus. All of the passengers started a fight with the driver and his answer was , Ur luggage is already kept in other bus, How early you go n sit there v ll start early. There was no way out so we started moving to other bus. I saw few people were coming from other bus and moving to our old bus. I asked one girl where r u going/destination. She said she need to go to Hyderabad. Then it clicked me that these people hired a bus from repective location, exchanged the passengers from the buses and brought back to where they started. I just felt some person feels he is too intelligent, and I want to teach that intelligent jerk who played with 120 people in the whole journey. Please suggest what can I do. I took the ticket from my fellow passenger, thinking i could do sumthin

Thursday, April 30, 2009

DATA-BASic

A DATABASE MODEL or DATABASE SCHEMA is the structure or format of a database(It is a structured collection of records or data that is stored on a server), described in a formal language supported by the DATABASE MANAGEMENT SYSTEM(Software to manage databases). Schemas are generally stored in a data dictionary(centralized repository of information about data such as meaning, relationships to other data, origin, usage, and format).A data model is not just a way of structuring data: it also defines a set of operations that can be performed on the data.

MODELS



FILE MODEL
The flat (or table) model consists of a single, two-dimensional array of data elements, where all members of a given column are assumed to be similar values, and all members of a row are assumed to be related to one another.

HIERARCHY MODEL

Data is organized into a tree-like structure, implying a single upward link in each record to describe the nesting, and a sort field to keep the records in a particular order in each same-level list. Hierarchical structures were widely used in the structure of XML documents. This structure allows one 1:N relationship between two types of data. This structure is very efficient to describe many relationships in the real world; recipes, table of contents.One limitation of the hierarchical model is its inability to efficiently represent redundancy in data.Parent–child relationship: Child may only have one parent but a parent can have multiple children. Parents and children are tied together by links called "pointers“.

NETWORK MODEL

It organizes data using two fundamental constructs, called records and sets.Records contain fields and Sets define one-to-many relationships between records.A record may be an owner in any number of sets, and a member in any number of sets.Parent–child relationship: Child can have more than one parent and a parent can also have multiple children.

Wednesday, March 25, 2009

GOOGLE I/O DEVELOPER SUMMIT

I am big freak to attend summit. Recently I attended ADOBE RIA SUMMIT at Bangalore and Before that FOSS.in all these places are great as people share there vast knowledge in small amount of time. This places actually tell you where to start and where the future is up to.I am waiting sum one would sponsor me




Above summit is god of all. I wish it happens in bangalore. This is the best summit i heared foe web site designing.Please leave the posts about how the conference was if anyone has attended.

Tuesday, August 5, 2008

MYSQL B!!! (Bug / Behaviour)


Well i got an error in mysql for which i banged my head for full 2 days and figured out it was a small change(I knw every bugs ends the ame way.. :)).Well , i didnt find any forum that explains about the bug and its solution.

Query: Select * from where tot = tot1
BUG: Unknown column "tot1" in where clause.

SOLUTION: Select * from where tot = 'tot1'

If the value of the tot1 is TOT it works fine if it is any thing other than that it gives an error. I could never figure why it acts so weird, Well if any1 knows the solution lets me know and simple image has been attached for the results.

Sunday, June 22, 2008

I-phone Versus Laptop with Citrix Virtual desktop

Just imagine using i-phone instead of laptop. Things would be more simpler!!!! So for those outraged with the Windows XP "running" on a "slow" processor like iPhone's, I say - you can all relax, the actual processing was done on a back-end virtual desktop and remotely delivered via Citrix XenDesktop.

Tuesday, June 17, 2008

WEB 2.0Ooooh

One bad thing about web is you read about one version which took more than years of time by more than a million researchers... in a mins time you come to see web 3.0.Well we will talk about WEB 3.0 in next post but for now just 2.0

Web 2.0 is a base on the web 1.0 with the same networking techniques giving more enhancements to the user interaction with the net. Web 2.0 sites often feature a rich, user-friendly interface based on below tags. Any internet applications made using the concept of web 2.0 are called RIA.

Rich internet applications techniques such as AJAX, Adobe Flash, Flex, JavaFX, Curl and Silverlight have evolved that have the potential to improve the user-experience in browser-based applications. Specialized protocols such as FOAF and XFN (I have never gone through this protocols, but I have given links below.) extend the functionality of sites or permit end-users to interact without centralized websites.

http://en.wikipedia.org/wiki/FOAF_%28software%29

http://en.wikipedia.org/wiki/XHTML_Friends_Network

ADOBE AIR: I was in air at ninth cloud when i read about this.Dont miss the e-bay application.Its amazing.Best part of it is the response facts are similar to javascript and very fast than cache implementation.These applications are created as on-line application but there basic uses are for desktop deployment.

http://en.wikipedia.org/wiki/Adobe_Integrated_Runtime#Applications

ADOBE FLEX: FLEX in simple wrds HTML + FLASH. being from the networking back ground I was not very much impressed with this outcome as it turns a web application very heavy n slow to handle but advantageous is the look-n-feel u get from this, it make's the user crazy about the site.Check out lee burner site. You will stick to that site more than a day..It’s an SDK to develop WEB2.0 with all the rich contexts. In context of web1.0 he can match html as flex pages and java script which dynamic content as coldfusion ability from ADOBE

http://en.wikipedia.org/wiki/Adobe_Flex

MICROSOFT SILVER LIGHT: This not a framework rather it’s a browser plugin.Its just a sibling of Adobe flash with more good performance techniques. Worst part of it is it does not support any OS based browsers especially safari and other Linux based browsers. So it is also called browser-unsafe plug-in.

http://en.wikipedia.org/wiki/Microsoft_Silverlight

JAVAFX: This is my favorite... :)

It is a RIA frame work with similar to flex but performance was its very good than flex as they should be accessible by mobile applications that is using JAVAME.

If anyone wants to know internal content of any above applications .This site below is very good and informative

http://www.devx.com/RichInternetApps/Article/35208/1954?pf=true

There are few more like CURL, open lazzalo..You may think who is she to give her comments.Well these are just my comments.Do drop in your comments in the comments column.

Monday, May 26, 2008

AM I FAR?

VNC akka virtual network computing. Do you feel your far from your computer. just relax at your lappi and use technology .VNC server is basically remote computing .IT is not heavy like any refelction or Hummpi. Above that is is inbuilt in my fav OS linux esp fedora.... :)

Here is the awesome link which explains about VNC and gives how to set it up?

http://fedoranews.org/tchung/vnc/

Tuesday, May 20, 2008

DUMP MYSQL

OOoops!!!! did i say something wrong. Mysql is the best SQL database with lot of inbuilt functions, not just leaving you to the drag and drop stuff put encourages you to use your very own brain and come with queries!!! well thsi blog is not about to encourage and to pomp and show about mysql but this is where i will say how to take backup of your mysql database.

LINUX BASED USERS:
The most common use of mysqldump is probably for making a backup of an entire database:

shell> mysqldump --opt db_name > backup-file.sql

You can read the dump file back into the server like this:

shell> mysql db_name < backup-file.sql

Or like this:

shell> mysql -e "source /path-to-backup/backup-file.sql" db_name

mysqldump is also very useful for populating databases by copying data
from one MySQL server to another:

shell> mysqldump --opt db_name | mysql --host=remote_host -C db_name

It is possible to dump several databases with one command:

shell> mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql

If you want to dump all databases, use the --all-databases option:

shell> mysqldump --all-databases > all_databases.sql

oKE OKE YOUR AN WINDOWS USER:

"C:\Program Files\MySQL\MySQL Server 5.0\bin"\mysqldump -uBackup -pBackup %db% >c:\backup\%db%.sql

Thursday, October 18, 2007

Scheduling Tasks in ruby/rails

Whether it is retrieving an RSS feed, or performing some maintenance operations on your system or a Rails app, an easy to use scheduler is a must have. Motivated by this need, I did some scouring and came up with a few nifty ways to accomplish the task. Now, before we go on, it’s worth mentioning that all *nix based systems have the advantage of a cron daemon which can perform this job quiet effectively. However, building standalone scripts is not always the best way to get things done, hence there are some valid cases where replicating this functionality can, in fact, be very useful.

Thread based scheduler

The most obvious way to schedule a task from within your program is to either loop it forever with a periodic sleep interval, or launch a separate thread which will perform the same job:

> thread_scheduler.rb

require 'fastthread'

t = Thread.new do
while true do
p 'perform task'
sleep 5
end
end

t.join # wait for thread to exit (never, in this case)

Create a new thread, perform the task, sleep for 5 seconds, and repeat forever. Launching one of these inside a Tier IV datacenter will ensure that your tasks are executed until the next nuclear winter. (Or, until your thread crashes - whichever is more likely!)

Flexible scheduling in Ruby

While threads are easy to use, they are still not very intuitive. After some searching, I stumbled across the OpenWFEru project, which implements a really nifty standalone-ready scheduler. Take a look yourself:

> open_wfe.rb

require 'openwfe/util/scheduler'
include OpenWFE

scheduler = Scheduler.new
scheduler.start

# Simple usage
scheduler.schedule_every('2s') { p 'every 2 seconds' }
scheduler.schedule_every('5m') { p 'every 5 minutes' }
scheduler.schedule_every('1d') { p 'every day' }

# More fine-grained control + schedule task once.
scheduler.schedule_in('3d2m10s') do
p 'after 3 days 2 minutes and 10 seconds stopping the scheduler and exiting...'
scheduler.do_stop
end

# Cron-string scheduling. There is something for everyone here!
scheduler.schedule('1-60 * * * *') do
p 'perform task'
end

scheduler.join

OpenWFEru scheduler is now also available as a standalone gem thanks to John Mettraux.

Each call to the scheduler queues your request on the main thread, which then spawns a separate thread for each task when the time is right. It’s definitely quite a bit cleaner, but the rich parse engine is by far the best part. Even a non-programmer will understand this code. Plus, and if thats your preference, you have the ability of providing a cron-like string! Also, it is important to note that if you schedule a task for every 2 seconds, but the task itself takes 3 seconds, then the job will be performed every 5 seconds! If you really do need 2 second intervals, simply create a new thread in your scheduled block, and let it run.

Scheduling in Rails

Finally, if you want to schedule tasks in Rails, then BackgrounDRB is your new best friend. Ezra wrote a great guide for it, and I highly recommend that you check it out. As of 0.2.1, backgroundrb added support for easy job scheduling via a yaml config file (conf/backgroundrb_schedules.yml). Here is a sample:

> backgroundrb_schedules.yml

scheduled_task:
:class: :scheduled_task_worker
:worker_method: :do_work
:trigger_args:
:start: <%= Time.now + 10.minutes %>
:repeat_interval: <%= 1.hour %>

Note that you can have multiple workers, running at different intervals, simply duplicate the worker in your config and give it a different name. Then, call up the generator to create the file itself and navigate to lib/workers. Again, here is a sample implementation:

> scheduled_task.rb

class ScheduledTaskWorker < BackgrounDRb::Worker::RailsBase

def do_work(args)
# RailsBase worker gives this class access to all ActiveRecord models.. go wild!
p 'perform task'
end

end
ScheduledTaskWorker.register


Thanks to http://openwferu.rubyforge.org/.. concepts were clear from this site

Find HOW?

SYNOPSIS

find [path...] [expression]

DESCRIPTION

This manual page documents the GNU version of find. find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence (see section OPERATORS), until the outcome is known (the left hand side is false for and operations, true for or), at which point find moves on to the next file name.

The first argument that begins with `-', `(', `)', `,', or `!' is taken to be the beginning of the expression; any arguments before it are paths to search, and any arguments after it are the rest of the expression. If no paths are given, the current directory is used. If no expression is given, the expression `-print' is used.

find exits with status 0 if all files are processed successfully, greater than 0 if errors occur.

EXPRESSIONS

The expression is made up of options (which affect overall operation rather than the processing of a specific file, and always return true), tests (which return a true or false value), and actions (which have side effects and return a true or false value), all separated by operators. -and is assumed where the operator is omitted. If the expression contains no actions other than -prune, -print is performed on all files for which the expression is true.

OPTIONS

All options always return true. They always take effect, rather than being processed only when their place in the expression is reached. Therefore, for clarity, it is best to place them at the beginning of the expression.
-daystart
Measure times (for -amin, -atime, -cmin, -ctime, -mmin, and -mtime) from the beginning of today rather than from 24 hours ago.
-depth
Process each directory's contents before the directory itself.
-follow
Dereference symbolic links. Implies -noleaf.
-help, --help
Print a summary of the command-line usage of find and exit.
-maxdepth levels
Descend at most levels (a non-negative integer) levels of directories below the command line arguments. `-maxdepth 0' means only apply the tests and actions to the command line arguments.
-mindepth levels
Do not apply any tests or actions at levels less than levels (a non-negative integer). `-mindepth 1' means process all files except the command line arguments.
-mount
Don't descend directories on other filesystems. An alternate name for -xdev, for compatibility with some other versions of find.
-noleaf
Do not optimize by assuming that directories contain 2 fewer subdirectories than their hard link count. This option is needed when searching filesystems that do not follow the Unix directory-link convention, such as CD-ROM or MS-DOS filesystems or AFS volume mount points. Each directory on a normal Unix filesystem has at least 2 hard links: its name and its `.' entry. Additionally, its subdirectories (if any) each have a `..' entry linked to that directory. When find is examining a directory, after it has statted 2 fewer subdirectories than the directory's link count, it knows that the rest of the entries in the directory are non-directories (`leaf' files in the directory tree). If only the files' names need to be examined, there is no need to stat them; this gives a significant increase in search speed.
-version, --version
Print the find version number and exit.
-xdev
Don't descend directories on other filesystems.

TESTS

Numeric arguments can be specified as
+n
for greater than n,
-n
for less than n,
n
for exactly n.
-amin n
File was last accessed n minutes ago.
-anewer file
File was last accessed more recently than file was modified. -anewer is affected by -follow only if -follow comes before -anewer on the command line.
-atime n
File was last accessed n*24 hours ago.
-cmin n
File's status was last changed n minutes ago.
-cnewer file
File's status was last changed more recently than file was modified. -cnewer is affected by -follow only if -follow comes before -cnewer on the command line.
-ctime n
File's status was last changed n*24 hours ago.
-empty
File is empty and is either a regular file or a directory.
-false
Always false.
-fstype type
File is on a filesystem of type type. The valid filesystem types vary among different versions of Unix; an incomplete list of filesystem types that are accepted on some version of Unix or another is: ufs, 4.2, 4.3, nfs, tmp, mfs, S51K, S52K. You can use -printf with the %F directive to see the types of your filesystems.
-gid n
File's numeric group ID is n.
-group gname
File belongs to group gname (numeric group ID allowed).
-ilname pattern
Like -lname, but the match is case insensitive.
-iname pattern
Like -name, but the match is case insensitive. For example, the patterns `fo*' and `F??' match the file names `Foo', `FOO', `foo', `fOo', etc.
-inum n
File has inode number n.
-ipath pattern
Like -path, but the match is case insensitive.
-iregex pattern
Like -regex, but the match is case insensitive.
-links n
File has n links.
-lname pattern
File is a symbolic link whose contents match shell pattern pattern. The metacharacters do not treat `/' or `.' specially.
-mmin n
File's data was last modified n minutes ago.
-mtime n
File's data was last modified n*24 hours ago.
-name pattern
Base of file name (the path with the leading directories removed) matches shell pattern pattern. The metacharacters (`*', `?', and `[]') do not match a `.' at the start of the base name. To ignore a directory and the files under it, use -prune; see an example in the description of -path.
-newer file
File was modified more recently than file. -newer is affected by -follow only if -follow comes before -newer on the command line.
-nouser
No user corresponds to file's numeric user ID.
-nogroup
No group corresponds to file's numeric group ID.
-path pattern
File name matches shell pattern pattern. The metacharacters do not treat `/' or `.' specially; so, for example,
find . -path './sr*sc'
will print an entry for a directory called './src/misc' (if one exists). To ignore a whole directory tree, use -prune rather than checking every file in the tree. For example, to skip the directory `src/emacs' and all files and directories under it, and print the names of the other files found, do something like this:
find . -path './src/emacs' -prune -o -print
-perm mode
File's permission bits are exactly mode (octal or symbolic). Symbolic modes use mode 0 as a point of departure.
-perm -mode
All of the permission bits mode are set for the file.
-perm +mode
Any of the permission bits mode are set for the file.
-regex pattern
File name matches regular expression pattern. This is a match on the whole path, not a search. For example, to match a file named `./fubar3', you can use the regular expression `.*bar.' or `.*b.*3', but not `b.*r3'.
-size n[bckw]
File uses n units of space. The units are 512-byte blocks by default or if `b' follows n, bytes if `c' follows n, kilobytes if `k' follows n, or 2-byte words if `w' follows n. The size does not count indirect blocks, but it does count blocks in sparse files that are not actually allocated.
-true
Always true.
-type c
File is of type c:

b
block (buffered) special
c
character (unbuffered) special
d
directory
p
named pipe (FIFO)
f
regular file
l
symbolic link
s
socket
D
door (Solaris)
-uid n
File's numeric user ID is n.
-used n
File was last accessed n days after its status was last changed.
-user uname
File is owned by user uname (numeric user ID allowed).
-xtype c
The same as -type unless the file is a symbolic link. For symbolic links: if -follow has not been given, true if the file is a link to a file of type c; if -follow has been given, true if c is `l'. In other words, for symbolic links, -xtype checks the type of the file that -type does not check.

ACTIONS

-exec command ;
Execute command; true if 0 status is returned. All following arguments to find are taken to be arguments to the command until an argument consisting of `;' is encountered. The string `{}' is replaced by the current file name being processed everywhere it occurs in the arguments to the command, not just in arguments where it is alone, as in some versions of find. Both of these constructions might need to be escaped (with a `\') or quoted to protect them from expansion by the shell. The command is executed in the starting directory.
-fls file
True; like -ls but write to file like -fprint.
-fprint file
True; print the full file name into file file. If file does not exist when find is run, it is created; if it does exist, it is truncated. The file names ``/dev/stdout'' and ``/dev/stderr'' are handled specially; they refer to the standard output and standard error output, respectively.
-fprint0 file
True; like -print0 but write to file like -fprint.
-fprintf file format
True; like -printf but write to file like -fprint.
-ok command ;
Like -exec but ask the user first (on the standard input); if the response does not start with `y' or `Y', do not run the command, and return false.
-print
True; print the full file name on the standard output, followed by a newline.
-print0
True; print the full file name on the standard output, followed by a null character. This allows file names that contain newlines to be correctly interpreted by programs that process the find output.
-printf format
True; print format on the standard output, interpreting `\' escapes and `%' directives. Field widths and precisions can be specified as with the `printf' C function. Unlike -print, -printf does not add a newline at the end of the string. The escapes and directives are:

\a
Alarm bell.
\b
Backspace.
\c
Stop printing from this format immediately and flush the output.
\f
Form feed.
\n
Newline.
\r
Carriage return.
\t
Horizontal tab.
\v
Vertical tab.
\\
A literal backslash (`\').
\NNN
The character whose ASCII code is NNN (octal).

A `\' character followed by any other character is treated as an ordinary character, so they both are printed.

%%
A literal percent sign.
%a
File's last access time in the format returned by the C `ctime' function.
%Ak
File's last access time in the format specified by k, which is either `@' or a directive for the C `strftime' function. The possible values for k are listed below; some of them might not be available on all systems, due to differences in `strftime' between systems.

@
seconds since Jan. 1, 1970, 00:00 GMT.

Time fields:

H
hour (00..23)
I
hour (01..12)
k
hour ( 0..23)
l
hour ( 1..12)
M
minute (00..59)
p
locale's AM or PM
r
time, 12-hour (hh:mm:ss [AP]M)
S
second (00..61)
T
time, 24-hour (hh:mm:ss)
X
locale's time representation (H:M:S)
Z
time zone (e.g., EDT), or nothing if no time zone is determinable

Date fields:

a
locale's abbreviated weekday name (Sun..Sat)
A
locale's full weekday name, variable length (Sunday..Saturday)
b
locale's abbreviated month name (Jan..Dec)
B
locale's full month name, variable length (January..December)
c
locale's date and time (Sat Nov 04 12:02:33 EST 1989)
d
day of month (01..31)
D
date (mm/dd/yy)
h
same as b
j
day of year (001..366)
m
month (01..12)
U
week number of year with Sunday as first day of week (00..53)
w
day of week (0..6)
W
week number of year with Monday as first day of week (00..53)
x
locale's date representation (mm/dd/yy)
y
last two digits of year (00..99)
Y
year (1970...)
%b
File's size in 512-byte blocks (rounded up).
%c
File's last status change time in the format returned by the C `ctime' function.
%Ck
File's last status change time in the format specified by k, which is the same as for %A.
%d
File's depth in the directory tree; 0 means the file is a command line argument.
%f
File's name with any leading directories removed (only the last element).
%F
Type of the filesystem the file is on; this value can be used for -fstype.
%g
File's group name, or numeric group ID if the group has no name.
%G
File's numeric group ID.
%h
Leading directories of file's name (all but the last element).
%H
Command line argument under which file was found.
%i
File's inode number (in decimal).
%k
File's size in 1K blocks (rounded up).
%l
Object of symbolic link (empty string if file is not a symbolic link).
%m
File's permission bits (in octal).
%n
Number of hard links to file.
%p
File's name.
%P
File's name with the name of the command line argument under which it was found removed.
%s
File's size in bytes.
%t
File's last modification time in the format returned by the C `ctime' function.
%Tk
File's last modification time in the format specified by k, which is the same as for %A.
%u
File's user name, or numeric user ID if the user has no name.
%U
File's numeric user ID.

A `%' character followed by any other character is discarded (but the other character is printed).

-prune
If -depth is not given, true; do not descend the current directory.
If -depth is given, false; no effect.
-ls
True; list current file in `ls -dils' format on standard output. The block counts are of 1K blocks, unless the environment variable POSIXLY_CORRECT is set, in which case 512-byte blocks are used.

OPERATORS

Listed in order of decreasing precedence:
( expr )
Force precedence.
! expr
True if expr is false.
-not expr
Same as ! expr.
expr1 expr2
And (implied); expr2 is not evaluated if expr1 is false.
expr1 -a expr2
Same as expr1 expr2.
expr1 -and expr2
Same as expr1 expr2.
expr1 -o expr2
Or; expr2 is not evaluated if expr1 is true.
expr1 -or expr2
Same as expr1 -o expr2.
expr1 , expr2
List; both expr1 and expr2 are always evaluated. The value of expr1 is discarded; the value of the list is the value of expr2.

EXAMPLES

find /home -user joe
Find every file under the directory /home owned by the user joe.

find /usr -name *stat
Find every file under the directory /usr ending in ".stat".

find /var/spool -mtime +60
Find every file under the directory /var/spool that was modified more than 60 days ago.

find /tmp -name core -type f -print | xargs /bin/rm -f
Find files named core in or below the directory /tmp and delete them. Note that this will work incorrectly if there are any filenames containing newlines, single or double quotes, or spaces.

find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f

Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing single or double quotes, spaces or newlines are correctly handled. The -name test comes before the -type test in order to avoid having to call stat(2) on every file.

find . -type f -exec file '{}' \;
Runs `file' on every file in or below the current directory. Notice that the braces are enclosed in single quote marks to protect them from interpretation as shell script punctuation. The semicolon is similarly protected by the use of a backslash, though ';' could have been used in that case also.

find /       \( -perm -4000 -fprintf /root/suid.txt '%#m %u %p\n' \) , \
\( -size +100M -fprintf /root/big.txt '%-10s %p\n' \)
Traverse the filesystem just once, listing setuid files and directories into /root/suid.txt and large files into /root/big.txt.

find $HOME  -mtime 0
Search for files in your home directory which have been modified in the last twenty-four hours. This command works this way because the time since each file was last modified is divided by 24 hours and any remainder is discarded. That means that to match -mtime

0, a file will have to have a modification in the past which is less than 24 hours ago.

find . -perm 664
Search for files which have read and write permission for their owner, and group, but which other users can read but not write to. Files which meet these criteria but have other permissions bits set (for example if someone can execute the file) will not be matched.

find . -perm -664
Search for files which have read and write permission for their owner and group, and which other users can read, without regard to the presence of any extra permission bits (for example the executable bit). This will match a file which has mode 0777, for example.

find . -perm /222
Search for files which are writable by somebody (their owner, or their group, or anybody else).

find . -perm /220
find . -perm /u+w,g+w
find . -perm /u=w,g=w
All three of these commands do the same thing, but the first one uses the octal representation of the file mode, and the other two use the symbolic form. These commands all search for files which are writable by either their owner or their group. The files don't have to be writable by both the owner and group to be matched; either will do.

find . -perm -220
find . -perm -g+w,u+w
Both these commands do the same thing; search for files which are writable by both their owner and their group.

find . -perm -444 -perm /222 ! -perm /111
find . -perm -a+r -perm /a+w ! -perm /a+x
These two commands both search for files that are readable for everybody (-perm -444 or -perm -a+r), have at least on write bit set (-perm /222 or -perm /a+w) but are not executable for anybody (! -perm /111 and ! -perm /a+x respectively)

Linux geeks::::: want to FIND more... http://dsl.org/cookbook/cookbook_toc.html