Generate random number in RUBY January 22, 2008
Posted by amithasija in Ruby on Rails.Tags: RoR, Ruby
add a comment
size=8
s = “”
size.times { s << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }
s
@var= s
puts @var
Edit mysql variables for full text search January 22, 2008
Posted by amithasija in MYSql.add a comment
If you want to change the value of ft_min_word_len to some new variables (for eg:ft_min_word_len= 2)
which is by default 4 ,you just have to drag the my.cnf file placed in your mysql/bin to some editor (notepad) and under the heading [mysqld] place this line ft_min_word_len= 2,and now stop mysql server and restart it.To see the reflected changes you have to run the query ‘ show variables like ‘ft%’ and you’ll change the value of mysql variable changed to
ft_min_word_len= 2 from ft_min_word_len= 4.
Rails application with different database than mysql January 8, 2008
Posted by amithasija in Ruby on Rails.Tags: Database, Rails, Ruby
add a comment
By default when u create a rails application it will be connected to mysql as database but if you want you can make a application that will connect to some other database only at the time of application creation by command:
rails –database=oracle test_application
Search Google Like a Magician January 8, 2008
Posted by amithasija in Google.Tags: Google, Search
add a comment
Example: “internet marketing” site:www.smallbusinesshub.com
4. Similar Words and Synonyms: Let’s say you are want to include a word in your search, but want to include results that contain similar words or synonyms. To do this, use the “~” in front of the word.
Example: “internet marketing” ~professional
5. Specific Document Types: If you’re looking to find results that are of a specific type, you can use the modifier “filetype:”. For example, you might want to find only PowerPoint presentations related to internet marketing.
Example: “internet marketing” filetype:ppt
6. This OR That: By default, when you do a search, Google will include all the terms specified in the search. If you are looking for any one of one or more terms to match, then you can use the OR operator. (Note: The OR has to be capitalized).
Example: internet marketing OR advertising
7. Phone Listing: Let’s say someone calls you on your mobile number and you don’t know how it is. If all you have is a phone number, you can look it up on Google using the phonebook feature.
Example: phonebook:617-555-1212 (note: the provided number does not work – you’ll have to use a real number to get any results).
8. Area Code Lookup: If all you need to do is to look-up the area code for a phone number, just enter the 3-digit area code and Google will tell you where it’s from.
Example: 617
9. Numeric Ranges: This is a rarely used, but highly useful tip. Let’s say you want to find results that contain any of a range of numbers. You can do this by using the X..Y modifier (in case this is hard to read, what’s between the X and Y are two periods. This type of search is useful for years (as shown below), prices or anywhere where you want to provide a series of numbers.
Example: president 1940..1950
10. Stock (Ticker Symbol): Just enter a valid ticker symbol as your search term and Google will give you the current financials and a quick thumb-nail chart for the stock.
Example: GOOG
11. Calculator: The next time you need to do a quick calculation, instead of bringing up the Calculator applet, you can just type your expression in to Google.
Example: 48512 * 1.02
12. Word Definitions: If you need to quickly look up the definition of a word or phrase, simply use the “define:” command.
Example: define:plethora
13. Searching for URLs containing certain words. Use the “inurl:word” modifier.
Example site:i-hack.org inurl:psp