Sunday, December 16, 2007

Common rails validations



A rather short post, this one if focused on few validations in rails that I often use. In rails you could do a lot of validations, as they are very simple to handle. Because of the well structured and separated MVC architecture all you need to do is write you validations for the database in our model. Actually as a matter of fact you could also write them as a library and call its methods. The ones below aim to do just that. They use regular expressions, in case you are confused with what that is do read up.

Validating an Email Address

validates_format_of(:email,
:with => /^([^@s]+)@((?:[-a-z0-9]+.)+[a-z]{2,})$/i,
:on => :create,
:message=>"has an invalid format")

Validating URLs

validates_format_of :url, :with => /^(https?://)?([^/]+)(/.+)?$/i

# OR

validates_format_of :url, :with => /^(ftp|https?)://((?:[-a-z0-9]+.)+[a-z]{2,})/

Validating IP addresses

validates_format_of :ip, :with => /^(d{1,3}.d{1,3}.d{1,3}.d{1,3})?$/

=================================================
||My FREE services||

ParkingWHOIS is now not only a domain parking lookup, but now also has reviews on Parking Companies.
=================================================


Tuesday, December 4, 2007

Installing Rails on uBuntu 7.10 Gusty Gibbons


So I wanted to install Ruby on Rails on my new linux box. And really thats not tough, this post just guides you to do the same. Actually I feel it is 80% easier to setup your linux box for any programming language than a windows COMPUTER. I might be wrong cause I used Windows for about a decade and then its a little more than one year since I have been using uBuntu (DUH!! a linux distro for the ones that didnt know) and I am already in love with it. One year and it still hasn't crashed. I can go on and on about my love for uBuntu but I think I will stop here. Ohh BTW uBuntu 7.10 (or uBuntu Gusty Gibbons has launched). It is sooooo light and awesome looking that my mom also is telling me to install it on her laptop. Truly linux for human beings. But I think I will let her laptop be a dual boot with XP and uBuntu; It will help me test my web apps.

Coming back to the main topic of discussion, I need to install Rails on uBuntu (actually works well for debian too). So here are few basic steps you might want to review:
1) Make sure all the build essentials are present on your Linux box. If not then quickly get into the terminal and hit

sudo apt-get install build-essential

2) Next you need to install ruby ri and rdocs so hit
sudo apt-get install ruby ri rdoc

3) Now you would want to download the latest versions of RubyGems; you could do that from http://rubyonrails.org/down or hit
sudo wget http://rubyforge.org/frs/download.php/11289/rubygems-0.9.0.tgz

4) Uncompress and extract the file by
tar -xvzf rubygems-0.9.0.tgz

5) Go into that folder by
cd rubygems-0.9.0

6) execute the setup.rb file to setup RubyGems
sudo ruby setup.rb

7) Use RubyGems to install Rails
sudo gem install rails --include-dependencies

8) If the previous step gave you an error about SSL then install the Open SSL library for ruby
sudo apt-get install libopenssl-ruby


And you are ready to go!!! Lets test the Rails setup by creating a demo project and running it (remember you are still in the terminal)
$ rails testapp
$ cd testapp
$ ruby script/server

/testapp$ ./script/server
=> Booting WEBrick…
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2006-12-07 05:28:37] INFO WEBrick 1.3.1
[2006-12-07 05:28:37] INFO ruby 1.8.4 (2005-12-24) [i486-linux]
[2006-12-07 05:28:37] INFO WEBrick::HTTPServer#start: pid=6687 port=3000



You’ll notice that the server is listening on port 3000. Open up a browser, and go to http://localhost:3000. Ok this is it for this article hope you are successful in setting up Rails on your Linux box and I wish your app gets as famous as David's. Peace.








=================================================
||My FREE services||

Find out more information about domain parking at ParkingWHOIS
=================================================

Thursday, November 29, 2007

Does habit equal addiction?

This article talks about the Siamese twins called Habit and Addiction, their similarity and how one should tackle them...

The oxford dictionary defines habit as a settled or regular tendency or practice or alternatively an addiction to drugs. Ok that was what the books told us, but lets see what I understood of the word habit, Habit is word or tendency such that when I remove the starting letter from it (i.e. H), I still have a-bit, if I remove the next letter (i.e. A), I am still left with bit, when I remove the next letter from that, I am left with it, I still keeping having it, now in my desperate attempt I remove the next letter from that (i.e. I), I am still left with T, i.e. tea or coffee whatever you prefer. So habit is one such word so well defined in the English literature that it doesn't make you feel like an addict nor does it sound insulting, an extremely polite way of saying, Yes, I am addicted to something.

Many people, including my clients keep asking me, How can I differentiate between a habit and an addiction? Well the answer is very simple, you can't, and you just can't differentiate between a habit and an addiction. They both mean exactly the same. Socially or rather politically, the word habit is considered to be more polite than the word addiction. In most cases, if not in all, habits are formed unknowingly and people involuntarily get habituated. Now why did I say that? Well in most cases you never understand your body and why is it demanding something. You just do it because your body demands it.

Accepting that you are addicted is the only way to conquering your fears. You need to realize, not assume, what you are habituated to. Getting rid of an addiction or a habit starts from knowing your body, understanding its needs. Bringing discipline in your life, is a more practical way to word it. You need to know that your body is not like any other machine that processes your food, but is way much more complex. You need to balance your sleep hours, eating habits, and recreation timings.

Loosing your addiction or habits is only half success, but maintaining it for life is your final success. So once you have won yourself against addiction, it is very important to maintain this victory. The key element that would keep you going on in this battle is that fact that you love yourself and you love your life. Boys like their toys and girls like their boys, a phrase that displays relation betweens the oddest of elements. Raising the bar is a very good thing, as humans are competitive but one must know when and where the word enough, in their line of life. You may not be the best but you are not bad either.

So, let me end this one here by saying, be in control of yourself and your life. They just give you one life, so don't let any habit manipulate it cause this is one place you never get a second chance.

=================================================
||My FREE services||

Find out more information about parking domains at ParkingWHOIS
and many more...
=================================================

Wednesday, November 28, 2007

Domain monetization

Welcome to the world of monetization, the a prime community of online real estate. Back in the early 90s a man named Rick Schwartz saw the future of domain names; Domain monetization as we call it now. Rick that time bought many generic domain names like men.com, eScore.com and a whole bunch of adult domain names. Men.com is no longer rick's property but he sold that prime name for $1.3 Million, he also sold eScore.com to Stanley Kaplan test preparation company for about $100 thousand. Although rick sold few of his generic domain names he still owns a good lot of them. And that just one of them now you cannot forget Frank Schilling, Sahar Sharid and many more...

So, how is the market now? and what do you do if you lost a chance on grabbing one of those prime real estate. Well in real life one would simply buy some real estate near those prime property and that exactly happened in the cyber world too. People started buying typos of domain names that were either generic or famous brands. It there exist a loan.com then someone bought a laon.com buy getting inspired by that. Mind it, its a good strategy but not a successful one always. There is a good chance that the typo you own may not be the best that exist for that particular domain and hence its value might be less than few others. It is really hard to calculate the probability of how successful a typo domain name would be, but you could use this tool at SEOChat to generate domain typos. This lead to a new generation of pseudo domainers called typo squatters. One can get lucky with a good domain typo but there are times you can be sued for trademark violation.

Is this opportunity just for individuals? Well I would say no!! Back in the early days people in the Registry (i.e the DOTcom registry)also understood what they are gonna loose, so they tried to cap the losses by proposing the Wait List Service (WLS). The whole idea of WLS was, there would be a wait list for a particular domain name. If a person wanted a domain name he could pre order it. If that domain name has to expire then he would be the next rightful contender of that domain name. This was proposed for the DOTcom and DOTnet top level domains (tlds). But the deal never went through. The DOTtv registry is another example of the registry making profit out of domain names. The DOTtv registry has marked some domains are their premium set of domain names, no one can register them but a person can only rent them for a tenure of one year. The domain renting rate for each domain is calculated on its value in the industry and changes very dynamically.

We have covered premium domain names and also typo squatting, getting further in depth lets discuss how Registrars make money off domain monetization. In a particular domain cycle (this example image is specific to that provider) there are various stages when a registrar could monetize domains he has such as:
Domains that are newly registered
Often when you register a domain name you do not point that domain to your actual hosting provider for one reason or the other (may it be testing, or you don't have hosting as of yet). What a registrar could do is give a set of nameserver records and volla!! he is monetizing your domain traffic by simply giving you a "coming soon" page filled with ads. A good example of this would be this screen cap



Domains that have expired
When a domain name expires the registrar gets 45 days of grace if he chooses to keep this domain or get a refund for it. From the 45 days given to them they give about 15 to 20 days to the registrant of the domain name for them to register it. Once the 20 day period is over the registrar parks the domain name (in few cases from the start of the 20 day period). This is a good source of quick pocket money for the registrar. Another smart move would be to keep the domain to themselves if it makes them a good sum while they have parked this concept is called as smart parking.

Page not found | 404 error
Another way to make money from domains that are registered are to monetize their 404 error pages (in few cases all error). They display a very smart looking "page not found" error with rest of the page filled with ads. This generally is not done in paid hosting, it is more seen in free hosting where companies offer free hosting but use methods like these to make money on the side.

By now the Registry also knows the money involved here, what they do is a even bigger step, they wild card an entire tld. If you havent registered a particular domain name eg. my-domain.in.com the in.com tld is so configured that it will show you a generic parked page and monetize the traffic on that domain name. Check out this example below



All said and done domain monetization is a pot full of going coins or hug bunch of green Benjamin Franklins or which ever currency you follow but not the end of the purpose of the internet. I will leave this article here and continue this topic in another article.

=================================================
||My FREE services|| Find out where a domain is monetized
Parking WHOIS
and many more...
=================================================

Friday, November 16, 2007

SEO with different server-side languages

This article sheds light on an important aspect of SEO, i.e clean URLs. How would you achieve clean URLs in few commonly used server-side languages like JSP, PHP, Ruby on Rails.

Let me start off with clean URLs; Dynamic websites use server-side languages to process visitor inputs and display results generated at real time. Often you might see the address bar of most of your famous web browsers growing really long. I tried to search something on Google and I got a long URL on my address bar.
[goto|http://www.google.com/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=rmk&q=urls&btnG=Search]

So what are all these weird words?
My techie brothers by now might have already guessed that these are parameters a page passes to the server to dynamically generate the next page you are navigating to. So if you lost then check this for a little intel on server-side coding. Search engines find it hard to index these pages that are dynamically generated. They love static pages, for example
www.domain-name.com/pages/Check-this-article.html

So lets quickly learn on how we could clean these URLs
You could use the POST method instead of GET, this would clean the URL; But the problem is that it would completely clean the URL... hahah for example
http://domain-name.com/search.php would simple direct you to http://domain-name.com/results.php
no parameters at all, but then the state of that page would be lost and just the default results.php page would be indexed.
You could use URL rewriting, this would be the best solution as it would still preserve the state of that page and index it. For example,
http://domain-name.com/search.php?query=finance
can be modified as
http://domain-name.com/search/finance
by using Apache's mod-rewrite.

So now we have modified the URLs, (I haven't explained how to do URL rewriting in detail as there a zillion tutorials on the net plus the official Apache tutorials) whats next?

Which Server-side language is the best for this?
You should consider the fact that the older a language is the harder it is to have clean URLs there. So lets compare
JSP - Advance configuration
ASP - Advance configuration
PHP - Intermediate configuration
ASP.net or the .net frame work - Rather simple
Ruby on Rails - No configuration already done by the system

What about Windows or Linux (*nux) servers?
As configurations depends on server flavors, it is a different procedure on a Windows Box as compared to a Linux Box rather it is different on a IIS server as compared to Apache server or any other choice. According to the tests I can confirm that it is much easier on a Apache
server as compared to an IIS server.

Few links to help you configure your server for URL rewrite
On IIS try http://www.isapirewrite.com/ (commercial/paid)
On Apache try the mod-rewrite (Open source/FREE)
On Websphere try http://www.exforsys.com/tutorials/websphere/websphere-v5.0-running-applications-understand-session-manager.html

In the end of the day, it you and your application; For the love of coding... keep the cyber world clean and green!!!

=================================================
||My FREE services||
Parking WHOIS
and many more...
=================================================

Tuesday, September 25, 2007

Am I addicted?

A question that pops up in your mind when you do a certain task very regularly with your understanding so as to why you are doing so in the first place. I have noticed in many situations that people never realize that they are addicted until they are told so. So how do people react when they are termed as addicted? A very obvious emotion seen is fright, or worry. Addiction is considered to be a disease that can't be cured. However, just like a coin addiction can be viewed with two different perspectives. A positive addiction is similar to a good habit that voluntarily or involuntarily done by a person. At the same time a negative addiction is just like habit that causes damage to self or others in a physical or psychological way.

Ok so I am addicted, can you help me? The answer to this question is NO. There are no drugs or special herbs that would come in handy in this situation. So how do I cure myself? The answer is in that question itself, i.e. I, yes only you can cure yourself. Learn to use the word NO; it's a small word with big impact. You have to be strong in your mind, don't let your sub-conscious mind control you but you control your sub-conscious mind. Whenever you are tempted to do one of those addicted tasks, be strong, understand the fact that it is wrong, and finally refrain from doing it. You may have mixed emotions in you mind that instance but don't you ever overlook the fact that you are now so proud of yourself, for saying NO, to all those addictive tasks.

Isn't that like so simple, so what is the catch? I spoke to few addicts, after they understood this procedure they agreed to follow it for a month to start with and then they would give me feedback on it. The day of the feedback I realized that many could successfully follow the procedure only for a week or even less, many very easily lied and later confessed, and there were some who just preferred continuing being an addict without even trying to see the other side of the world. Yes, it isn't as simple as it sounds. Controlling your sub-conscious mind isn't very simple.

So the question arises, how do I control my sub-conscious mind? Do I take relaxants or any other drugs? No don't need to start taking relaxants; you cannot stop one addiction by starting another. The idea out here is to always be in your conscious mind and not let your sub-conscious mind control you. You should be in peace with yourself; yes this is one very important thing. I would recommend yoga in the morning; a small session would do the trick. When you meditate I want you to remember all the good things that happened to you, all the bad things that happened to you, how would that change you, how would respond to things, this way I want you to reflect on your past, and cure the wounds, so that your past positively influences your present. When you do this exercise regularly, it also presets you in an active mode when you start your day, rather than a passive mode.

As they say, winning someone's trust is hard, but keeping that trust maintained is even harder. This phrase also applies in our situation too, as coming out of an addiction is hard but maintaining that life long is even harder. So let us see some sarcastic do's and dont's. If you are tempted towards an addictive task, don?t feel bad that?s just human, but you saying NO is just divine. For every addictive action, there is an equal and opposite guideline. If you feel defeated, complaining would just not help, just work harder. If they call you a geek because you quit an addiction, times are changing, geeks are cooler now-a-days. Every person in an addictive state tends to remain in that state unless an external force is applied to it.

I would like to conclude saying, be strong and stay strong. It is hard and it even gets harder, but its totally worth it.


=====================================================
||My FREE services||
Parking WHOIS
and many more...
=====================================================


Thursday, September 13, 2007

Does your command center have the essentials??

Yes, its your computer I am referring to. I have often seen people buy the most expensive computers in the market at that time. They believe that it would help them do more tasks and last longer before being outdated. Well, I don't believe that is entirely true. On an average any computer is new only for three months. After three months there is always a new processor or higher ram or even better graphics card. I guess then what really matters is what your computer can do or rather what is its functionality; Obviously assuming the fact that those functionalities are hardware independent. There are always a small bunch of functionality that one would always expect his computer to do. Let me name a few...

  1. Access the web and use its various elements like email or chat or telephony
  2. Draft documents
  3. Keep their computer safe from malicious programs
  4. Gather and organize pictures
  5. Listen music and watch movies

I am sure a lot of you accomplish all this in one way or the other. But this is for the few that don't, here is what you can do; Try Google Pack, it has the most basic essentials that are required. This is what you get when u download and install Google Pack...

  • Google Earth (Zoom from space to street level — tour the world)
  • Norton Security Scan (Detects and eliminates viruses and internet worms)
  • Google Desktop (Find all your email, files, web history, and more)
  • Firefox with Google Toolbar (Browse the web quickly and securely)
  • Adobe Reader (View, print, and search PDF files via a redesigned interface)
  • Skype (Make free voice and video calls to anyone else on Skype)
  • StarOffice (Word processing, spreadsheet, presentation, and more; also includes Java™)
  • Google Toolbar for IE (Search from any web page and autofill forms; Block annoying pop-ups)
  • Spyware Doctor (Detects and removes spyware, adware, trojans and keyloggers)
  • Picasa (Find, edit, and share your photos in seconds)
  • Google Photos Screensaver (Display photos from your PC and photo sharing sites)
  • Google Talk (Connect with your friends via IM or free voice calls)
  • RealPlayer (Play popular media formats, organize music and videos)

Well although I am not such a big fan of the Google Pack but recently I understood how important it is have something on similar lines. My aunt wanted to watch one of her documented videos, her XP have nothing but a standard installation, it took a mind boggling 3 minutes 18 secs for her PC to boot (as compared to 26 seconds on my uBuntu box). I was her all time favorite computer mechanic. It was so sure her computer was stuffed with malware and trojans; And I was imagining my task list...
  1. Need some antivirus
  2. Have to shift to Firefox
  3. Needed something for communication

Luckily all of this could be covered by a single Google Pack installation. Moral of the story, although not my favorite but Google Pack can save you some time but if you are old school like many(including me) then you wouldn't really need this product.

==================================================================
||My FREE services||
Parking WHOIS
and many more...
==================================================================

Monday, September 10, 2007

Is 24 hours less for a day?

This article briefs you about how lack of time management could cause you ample of stress. In addition it also explains how time management would differ in the different phases of life. Secondly it introduces you to the different techniques used in successful time management that is practiced by many.

In my recent survey about causes of stress, I realized a major issue that was ignored by many. Bad time management; this is what many volunteers indicated in the survey. A good analysis of the survey results showed how crucial part time management had in the cause of daily incurred stress. So in this article I would like to elaborate on the different phases in an individual's life and how they manage time then.

In the school days, like many I was an average student too. What I lacked was time management as seen in many brilliant students. I used to attend school, come back home, and occasionally study or revise what was done in school, play around or do some leisure activities, eat up my dinner and off I went to bed. What is the point of all this, at the teenage phase in your life, many tend to ignore the value of time. Many take life as it comes without any planning and without any goals. If you are a keen observer you would notice that your teenage cousin or kid in the next block would be very often found playing at evenings at a particular time. So the point assumed by many about kids or teenagers not planning their day out, is totally wrong. They do plan their day, however they do so with prioritizing different elements, like play time, or party time, or even time to eat. This however is very different compared to any adolescent, and how one would prioritize and plan in that phase of life. Time management for an adolescent would be completely different as they would prioritize on elements like college work, friends, interest groups, or even study groups, are more complex compared to before. As you go the next phase of life the number of elements keeps increasing and to prioritize according to these elements becomes intricate.

Humans crave for the best; and after getting the best they still would never be satisfied. A constant crave for success is what an average man would strive for everyday. In the process many things are streamlined like, friends, relatives, or even dear loved ones. This is where most of the problems begin from. Friends may feel that you are become too arrogant enough to talk. Relatives may be angry with you for months and still won?t say a word, worrying that it might affect your career. Dear loved ones like your spouse, fiance or someone you are going out with would just be victimized due to your ignorance. At many cases the communication reduces to such an extent that, you never know that you are wrong until the very end, when things are irreversible.

Trust me on this one; twenty four hours are not less for a day. You are so focused at a certain task that you tend to forget, overlook, or even avoid the other tasks that are given to you or you are responsible for. The only solution here is to keep peace with your mind. You have to learn the art of channeling your mind at any and every task given to you. For example if you are working on a class project for three hours in a day, you should learn how to schedule your work in those three hours only. Once those three hours are over you should learn how to divert yourself into another task and channeling your mind there. This is important because in most cases when you are doing a task you still are physically present but mentally mental; mental because you are still constantly thinking about your previous task which you left. This could affect your performance, and in most cases it does.

Now the question is how one should make a healthy transition between one task and another. There are many simple solutions that are hard to implement. I still call them simple because they are simple to understand and hard because they are hard to get into your daily life. Reading a novel, always is an old school way of having a transition between any two phases. A good example would be, coming back from work and reading a Chicken Soup novel or any other of self choice and then spending time with your folks or spouse and later having a nice sleep. Once could also use music, either listen to or play some gentle music. A good example would be coming back from college and playing some guitar before you could start off your next task. This helps ease out all tensions and stress and prepares you for your next task. Sports also is an excellent alternative, however many have their reasons so as to why sports could not be an option that would opt for.

But in the end of the day any relaxant used to have a healthy transition between phases is your choice; all have their positives and negatives. So choose wisely, after all I can only show you the path; you have to walk through it.

==================================================================
||My FREE services||
Parking WHOIS
and many more...
==================================================================

Friday, September 7, 2007

I have something to say and I want you guys to listen...

After about nine years of tourism over Internet locations, here I am to leave back a mark. Another regular kid on the block, I too was lucky to have access to the Internet from those early days. It started off with a student shell accounts, no images only text. Next was a dial-up connection, I remember getting my phone bills up by 500%, got grounded for that by my folks back then. Then I got a fibre optics line when I joint college, I guess thats the best gift my folks could give me for doing college and not pursuing my career as a Gansta!! I wasn't sure if it was college or those geeky chat rooms I visited often, that really got me charged up about Computer Science, Information Technology, Agile Web Development, Open Source, Linux, etc.

An FAQ section:

1) Whats the purpose of this blog?
Well not rocket science obviously, but just few things that I thought are worth noting!!


2) Is this another Made-for-Adsense type sites?
NOOOOOOOOOOOOOOOO, I dont intend to make money of this prime e-Real Estate!!


3) So what kind of topics would I find here?
Majorly techie, few psychology and marketing-management articles too.


4) Is this another fake blog just like the Steve Jobs or Bill Gates one?
No, this is 100% authentic and the official blog of Warlock handleR.

For any further queries please feel free to comment in the respective post.

==================================================================
||My FREE services||
Parking WHOIS
and many more...
==================================================================