Ink Spout

Ink Spout has evolved into Ink Spouts now. It is available at a new address now. www.inkspouts.com We have rebooted it and It's back with lots of stuffs . :D Just go and check it out.

Featured Posts

Ink Spout has evolved into Ink Spouts now. It is available at a new address now. www.inkspouts.com We have rebooted it and It's back with lots of stuffs . :D Just go and check it out.
Sunday, June 10, 2012 2 comments

Guest Post by Bill

In this tutorial, I will be describing a more effective way to validate credit cards when accepting payment on your site. This method provides smoother and more compact way of verification, eliminating the use of larger scripts. The plug-in I will be describing will help you so that you can check a credit card number you are given for correct checksum values as well as correct format before submitting for processing.


To begin, we will describe how this plug-in works. This plug-in takes details about a credit card and returns true or false depending whether the card passes checksum and date verification. It requires the following arguments:

Number: A Credit Card Number               
Month: The Credit Card's Expiry Month
Year: The Credit Card's Expiry Year

Variables, Arrays, and Functions

left                    Local variable containing the first 4 digits of number
cclen                 Local variable containing the number of digits in number
chksum             Local variable containing the card’s checksum
date                  Local date object
substr()            Function to return a portion of a string
getTime()          Function to get the current time and date
getFullYear()     Function to get the year as a 4-digit number
getMonth()        Function to get the month

This function first ensures that all three parameters passed to it are strings by adding the
empty string to them, like this:
number += ' '
month += ' '
year += ' '
Next, each argument is processed through a CleanupString() to ensure that they are in the formats required:

number = CleanupString(number, true, false, true, true)
month = CleanupString(month, true, false, true, true)
year = CleanupString(year, true, false, true, true)

After this, the variable left is assigned the first 4 digits of number, cclen is set to the
card number’s length, and chksum is initialized to 0:

var left = number.substr(0, 4)
var cclen = number.length
var chksum = 0

Now with several if() ... else if() statements we check that left contains a valid sequence that matches a known brand of credit card and, if it does, that the card number length in cclen is correct for the card type. However, If left doesn’t match a known card, or it matches one but cclen is the wrong length, then the plug-in returns false to indicate that the card cannot be verified.

If these initial tests are passed, the card’s checksum is then calculated using a very known algorithm that gives us just what we need (this algorithm was invented by a the famous IBM scientist Hans Peter Luhn)



for (var j = 1 - (cclen % 2) ; j < cclen ; j += 2)
     if (j < cclen) chksum += number[j] * 1
for (j = cclen % 2 ; j < cclen ; j += 2)
{
      if (j < cclen)
      {
            d = number[j] * 2
            chksum += d < 10 ? d : d - 9
       }
}
if (chksum % 10 != 0) return false



To use this plug-in, pass it a card number, expiry year, and month and it will return true or false. Of course, this algorithm tests only whether the card meets certain requirements. This program will give the customer a "heads up" to check their info before trying to submit their information; it does not test whether the user has entered a genuine card or whether the charge will go through. This plug-in is best for preventing errors before the processing state, e.g. catching mistakes made by customers in typing numbers, entering correct numbers in the wrong area of a form, etc).

Again, a big warning here: We are not connecting to a bank or any financial party to provide us any verification as to whether this card is good to go for a certain amount of payment or not.
The purpose of the plug-in is to catch typing errors, as well as people entering random data to see what happens.
               
Here is a full coded example using our previous code:

<h3>Your credit card details:</h3>
<font face='Courier New'>
Card Number: <input id='ccnum' type='text' name='n' size='24' /><br />
Expires: Month <input id='ccmonth' type='text' name='m' size='2' />
Year <input id='ccyear' type='text' name='y' size='4' /><br />
<button id='button'>Submit Credit Card</button>     

<script>
window.onload = function()
{
      O('button').onclick = function()
      {
if (ValidateCreditCard(O('ccnum').value, O('ccmonth').value, O('ccyear').value))
                                alert("The card validated successfully")
                                else
                                alert("The card did not validate!")
        }
}
</script>                         

If you are to use this plug-in with your own code, you will probably want to replace the onclick event attachment used in the example with a function attached to the onsubmit event of your form. Also, make sure that when you do this your function returns true if the card verifies to allow the form submission to complete, and false (along with and alert message stating the error message) if the card submission doesn’t validate, to stop the form submission from going through.

The full plug-in code:


                                                                          CODE                                                                 

function ValidateCreditCard(number, month, year)
{
         number += ' '
         month += ' '
         year += ' '
         number = CleanupString(number, true, false, true, true)
         month = CleanupString(month, true, false, true, true)
         year = CleanupString(year, true, false, true, true)
         var left = number.substr(0, 4)
         var cclen = number.length
         var chksum = 0

         if (left >= 3000 && left <= 3059 ||
                left >= 3600 && left <= 3699 ||
                left >= 3800 && left <= 3889)
         { // Diners Club
               if (cclen != 14) return false
         }
          else if (left >= 3088 && left <= 3094 ||
                left >= 3096 && left <= 3102 ||
                left >= 3112 && left <= 3120 ||
                left >= 3158 && left <= 3159 ||
                left >= 3337 && left <= 3349 ||
                left >= 3528 && left <= 3589)
          { // JCB
                if (cclen != 16) return false
          }
          else if (left >= 3400 && left <= 3499 ||
                  left >= 3700 && left <= 3799)
          { // American Express
                  if (cclen != 15) return false
          }
          else if (left >= 3890 && left <= 3899)
          { // Carte Blanche
                  if (cclen != 14) return false
          }
          else if (left >= 4000 && left <= 4999)
          { // Visa
             if (cclen != 13 && cclen != 16) return false
          }
          else if (left >= 5100 && left <= 5599)
          { // MasterCard
                  if (cclen != 16) return false
          }
          else if (left == 5610)
          { // Australian BankCard
                   if (cclen != 16) return false
          }
          else if (left == 6011)
          { // Discover
                    if (cclen != 16) return false
          }
          else return false // Unrecognized Card

          for (var j = 1 - (cclen % 2) ; j < cclen ; j += 2)
                       if (j < cclen) chksum += number[j] * 1
          for (j = cclen % 2 ; j < cclen ; j += 2)
          {
             if (j < cclen)
              {
                    d = number[j] * 2
                    chksum += d < 10 ? d : d - 9
              }
          }
          if (chksum % 10 != 0) return false

          var date = new Date()
          date.setTime(date.getTime())

          if (year.length == 4) year = year.substr(2, 2)

          if (year > 50)                                                                    
          return false
          else if (year < (date.getFullYear() - 2000))                     
          return false
          else if ((date.getMonth() + 1) > month                           
          return false
          else
          return true                                                                                           
 }


                                                                          CODE                                                                 


So this is how we can use JavaScript in a more effective way to verify the credit card information.
About the Guest Author
This article was contributed by Bill at Spotted Frog Design, a web development and online marketing company based in the Philadelphia area. For more information about Spotted Frog, please visit their site, or follow them on Twitter at spottedfrog


Read More.....

Friday, June 8, 2012 0 comments

It's a post by our part-time contributor Aditya Sharma. He likes to write about tech & Health.


Notebook (laptop) is a very efficient and important tool of many people today.Businessmen, college students, housewives and professionals all use laptops for one use or the other. However, it is better that men learn that they risk losing their fertility with the excessive usage of laptop computers.


The main reason men tend to lose their fertility with the excessive use of laptop computers is that the heat that is generated by the computers, and the posture that the man adopts to balance the laptop computer tends to increase the temperature surrounding the scrotum.

Scientific researches have proven that the higher is the scrotal temperature, the higher is the possibility of damaging sperms and affecting the male's fertility. Moreover, with the advent of Bluetooth and infrared connections, where there are wireless links to the internet, more and more men are using laptops on their laps than on a desk.

Men usually keep their legs open wider than women to keep their testicles at the right temperature, and for added comfort. However, with a laptop on their laps, they tend to adapt a less comfortable position so that they can balance the laptop on their laps. This leads to an increase in body temperature that is found between the thighs.

It has been recently proven that prolonged and continuous usage of laptops on the laps tend to lead to damage to the fertility of the man. This was because the use of laptops usually leads to about 2.7C increase inthe scrotal temperature of the male. This has lead to more and more men having decreased sperm levels where sperm counts seem to have dropped by a third in ten years.

Most of the reasons for this reduced sperm count is drug use, smoking, alcohol and obesity. Besides this, pesticides, radioactive materials and chemicals, and laptops too contribute to decrease in fertility in men.

The human male body has a fixed testicular temperature to maintain usual sperm production and development.Though it is not known the exact time of heat exposure and frequency of exposure to heat that can lead to reversible and irreversible production of sperms, it is known that frequent usage of laptops can lead to irreversible or partially reversible changes in the reproductive system of the male body.

This is why it is advised that young men and teenage boys should limit the use of laptops on their laps to avoid losing their fertility. It is not advisable for young men or boys to also use wireless services on their laps to play games and do other work as they are sure to develop problems in ten years' time, when trying to have a family.

It is thereby advised that men should use laptops on the desk; in fact, anywhere else is possible, other than using it in the lap. Women don't have to worry much about laptop computers on their laps, as so far, there have been no studies on the impact of using laptop computers on their laps.

Although rare,there have been cases of severe burns from a laptop overhaeting on an individual's lap. Burns can also come from combustion of laptop batteries. Also rare, there have been instances of this happening when the laptop is held in such a way that the venting fan is blocked. So avoid bad postures and try avoid putting laptops on your laps.

Read More.....

Saturday, June 2, 2012

After orders issued by a court in india, some ISPs (the organization which provides you the internet facility known as Internet Service Provider) have started blocking and banning torrent websites (e.g. Torrentz, Piratebay, kat.ph etc) along with video streaming sites (e.g. Vimeo and Dailymotion).


Whenever a user with those particular ISP tries to access these sites, he gets an webpage showing a message as following :

           “Access to this site has been blocked as per Court Orders.“


This banning and blocking thing came into picture after a tamilnadu court issued an order to prevent copyright infringement and piracy. The main ISPs are Airtel and Reliance who have done this job till now. Also other ISPs have blocked a number of websites as per indication by the Central Government. The list of blocked sites can be found here.

But since these torrent sites are good options for countries like india (where a fair and nice internet speed is a dream) because many open source content (Operating systems etc.) are easily downloadable through torrent rather than direct download.

So we are going to tell you how to access these blocked sites. 

Method 1 : Use of “https” instead of “http”
The easiest method I have come across till now is using secured connection that is you have to add an “s” in the end of “http” which will become “https” before the URL in the address bar. The Website will open with full functionality.




Method 2 : Use of Proxy sites
If you want another way then proxy sites would be alternative option which you can find easily by Googling.


I hope this article and these methods helped to access these sites. If you have come across any other method then let’s know by comments. We appreciate them. 


Disclaimer : We DO NOT SUPPORT piracy and copyright infringement. This article is for educational purpose and meant only for legal use.

Read More.....

Friday, June 1, 2012

Internet Download Manager
Internet Download Manager is one of the widely used Download Managers. Due to its simplicity, functionality and user friendly interface makes it quite handy and popular between users. It is also a nifty tool to download videos from various video streaming sites like Youtube, dailymotion and vimeo.

Often Youtube users encounter with a problem that Internet Download Manager downloads videos from youtube with name videoplayback_# . This things not only adds to problem of renaming the videos again and again but also an unmanageable and difficult task to find needed video if not renamed.
As this is not the problem of mine only but of a large number of IDM users who search like “YOUTUBE IDM videoplayback name problem ” etc.

So in this post, I am going to tell you folks a new way to get rid off the problem of renaming or videoplayback name problem.This solution is for Google Chrome users.
Chrome Youtube Downloader
All you have to do is to install a Google Chrome extension Chrome Youtube Downloader and rest of the story I tell you in next steps.

Step 1. Download Chrome Youtube Downloader from here and install it.

Step 2. After installing the extension,  whenever you will open any Youtube page , there will be extra button of Download below the video with various options for downloading (i.e. different quality, resolution and formats).
Download button appears below the video

Various Downloading options

Step 3. Make sure IDM is running in the  background and don’t click on the “Download with IDM” when video is buffering. Just click on Download button and IDM will automatically capture the video with its original name. Simply hit on start download and you’re done.


Also you can choose default  video format and resolution by going into extension setting tab as below.


I hope you liked my article. If you consider it helpful then consider to comment below,like us and share us.
Happy Sharing, Happy Caring. :-)
Read More.....

Most Trending

Recent Posts

Recommend us on Google!

featured-slider

Labels

Bloggers.com

Bloggers - Meet Millions of Bloggers