Showing posts with label Web technology. Show all posts

Explain briefly, how the domain names are translated to IP addresses?

DNS (Domain Name System) is just as important as fast content. DNS is what translates your familiar domain name (www.google.com) into an IP address your browser can use (173.194.33.174). This system is fundamental to the performance of your webpage, yet most people don’t fully understand how it works. Therefore, in order to help you better understand the availability and performance of your site, we will be publishing a series of blog articles to shed light on the sometimes complex world of DNS, starting with the basics.

Before the page and any resource on the page are loaded, the DNS must be resolved so the browser can establish a TCP connection to make the HTTP request. In addition, for every external resource referenced by a URL, the DNS resolution must complete the same steps (per unique domain) before the request is made over HTTP. The DNS Resolution process starts when the user types a URL address on the browser and hits Enter. At this point, the browser asks the operating system for a specific page, in this case, google.com.





Step 1: OS Recursive Query to DNS Resolver
Since the operating system doesn’t know where “www.google.com” is, it queries a DNS resolver. The query the OS sends to the DNS Resolver has a special flag that tells it is a “recursive query.” This means that the resolver must complete the recursion and the response must be either an IP address or an error.
For most users, their DNS resolver is provided by their Internet Service Provider (ISP), or they are using an open source alternative such as Google DNS (8.8.8.8) or OpenDNS (208.67.222.222). This can be viewed or changed in your network or router settings. At this point, the resolver goes through a process called recursion to convert the domain name into an IP address.
Step 2: DNS Resolver Iterative Query to the Root Server
The resolver starts by querying one of the root DNS servers for the IP of “www.google.com.” This query does not have the recursive flag and therefore is an “iterative query,” meaning its response must be an address, the location of an authoritative name server, or an error. The root is represented in the hidden trailing “.” at the end of the domain name. Typing this extra “.” is not necessary as your browser automatically adds it.
There are 13 root server clusters named A-M with servers in over 380 locations. They are managed by 12 different organizations that report to the Internet Assigned Numbers Authority (IANA), such as Verisign, who controls the A and J clusters. All of the servers are copies of one master server run by IANA.
Step 3: Root Server Response
These root servers hold the locations of all of the top level domains (TLDs) such as .com, .de, .io, and newer generic TLDs such as .camera.
The root doesn’t have the IP info for “www.google.com,” but it knows that .com might know, so it returns the location of the .com servers. The root responds with a list of the 13 locations of the .com gTLD servers, listed as NS or “name server” records.
Step 4:  DNS Resolver Iterative Query to the TLD Server
Next, the resolver queries one of the .com name servers for the location of google.com. Like the Root Servers, each of the TLDs has 4-13 clustered name servers existing in many locations. There are two types of TLDs: country codes (ccTLDs) run by government organizations, and generic (gTLDs). Every gTLD has a different commercial entity responsible for running these servers. In this case, we will be using the gTLD servers controlled by Verisign, who run the .com, .net, .edu, and .gov among gTLDs.
Step 5: TLD Server Response
Each TLD server holds a list of all of the authoritative name servers for each domain in the TLD. For example, each of the 13 .com gTLD servers has a list of all of the name servers for every single .com domain. The .com gTLD server does not have the IP addresses for google.com, but it knows the location of google.com’s name servers. The .com gTLD server responds with a list of all of google.com’s NS records. In this case, Google has four name servers, “ns1.google.com” to “ns4.google.com.”
Step 6: DNS Resolver Iterative Query to the Google.com NS
Finally, the DNS resolver queries one of Google’s name server for the IP of “www.google.com.”
Step 7: Google.com NS Response
This time the queried Name Server knows the IPs and responds with an A or AAAA address record (depending on the query type) for IPv4 and IPv6, respectively.
Step 8: DNS Resolver Response to OS
At this point, the resolver has finished the recursion process and is able to respond to the end user’s operating system with an IP address.
Step 9: Browser Starts TCP Handshake
At this point, the operating system, now in possession of www.google.com’s IP address, provides the IP to the Application (browser), which initiates the TCP connection to start loading the page. For more information on this process, we wrote a blog post on the anatomy of HTTP.
As mentioned earlier, this is worst case scenario in terms of the length of time to complete the resolution. In most cases, if the user has recently accessed URLs of the same domain or other users relying on the same DNS resolver have done such requests, there will be no DNS resolution required, or it will be limited to the query on the local DNS resolver.


Learn more »

What's the difference between standards mode and quirks mode?

In the old days, pages were written in two versions:

  1. Netscape Navigator
  2. Microsoft Internet Exploreer
When W3C, was introduced, browsers could not just start using them as doing so would break most existing sites on the web. Browsers introduced two modes to treat new standards compliant sites differently from old legacy sites. 

Layout engines in browsers uses three modes:
  1. Quirks mode: In quirks mode, layout emulates nonstandard behavior in Navigator 4 and IE 5. These were needed for websites written before introduction of web standards. 
  2. Full standard mode: In this mode, the behavior described is same as described by HTML and CSS specifications. Most of the modern browsers uses full standard mode.  
  3. Almost standard Mode: In almost standard mode there is very small number of quirks implementation. 


Make sure you put the DOCTYPE right at the beginning of your HTML document. Anything before the DOCTYPE, like a comment or an XML declaration will trigger quirks mode in Internet Explorer 9 and older.
The DOCTYPE as, <!DOCTYPE html>, is the simplest possible, and the one recommended by HTML5. Earlier versions of the HTML standard recommended other variants, but all existing browsers today will use full standards mode for this DOCTYPE, even the dated Internet Explorer 6. 
Learn more »

Important Front end Developer interview questions and answers

General Questions:

  • What did you learn yesterday/this week?
  • What excites or interests you about coding?
  • What is a recent technical challenge you experienced and how did you solve it?
  • What UI, Security, Performance, SEO, Maintainability or Technology considerations do you make while building a web application or site?
  • Talk about your preferred development environment.
  • Which version control systems are you familiar with?
  • Can you describe your workflow when you create a web page?
  • If you have 5 different stylesheets, how would you best integrate them into the site?
  • Can you describe the difference between progressive enhancement and graceful degradation?
  • How would you optimize a website's assets/resources?
  • How many resources will a browser download from a given domain at a time?
    • What are the exceptions?
  • Name 3 ways to decrease page load (perceived or actual load time).
  • If you jumped on a project and they used tabs and you used spaces, what would you do?
  • Describe how you would create a simple slideshow page.
  • If you could master one technology this year, what would it be?
  • Explain the importance of standards and standards bodies.
  • What is Flash of Unstyled Content? How do you avoid FOUC?
  • Explain what ARIA and screenreaders are, and how to make a website accessible.
  • Explain some of the pros and cons for CSS animations versus JavaScript animations.
  • What does CORS stand for and what issue does it address?

HTML Questions:

  • What does a doctype do?
  • What's the difference between standards mode and quirks mode?
  • What's the difference between HTML and XHTML?
  • Are there any problems with serving pages as application/xhtml+xml?
  • How do you serve a page with content in multiple languages?
  • What kind of things must you be wary of when design or developing for multilingual sites?
  • What are data- attributes good for?
  • Consider HTML5 as an open web platform. What are the building blocks of HTML5?
  • Describe the difference between a cookiesessionStorage and localStorage.
  • Describe the difference between <script><script async> and <script defer>.
  • Why is it generally a good idea to position CSS <link>s between <head></head> and JS <script>s just before</body>? Do you know any exceptions?
  • What is progressive rendering?
  • Have you used different HTML templating languages before?

CSS Questions:

  • What is the difference between classes and ID's in CSS?
  • What's the difference between "resetting" and "normalizing" CSS? Which would you choose, and why?
  • Describe Floats and how they work.
  • Describe z-index and how stacking context is formed.
  • Describe BFC(Block Formatting Context) and how it works.
  • What are the various clearing techniques and which is appropriate for what context?
  • Explain CSS sprites, and how you would implement them on a page or site.
  • What are your favourite image replacement techniques and which do you use when?
  • How would you approach fixing browser-specific styling issues?
  • How do you serve your pages for feature-constrained browsers?
    • What techniques/processes do you use?
  • What are the different ways to visually hide content (and make it available only for screen readers)?
  • Have you ever used a grid system, and if so, what do you prefer?
  • Have you used or implemented media queries or mobile specific layouts/CSS?
  • Are you familiar with styling SVG?
  • How do you optimize your webpages for print?
  • What are some of the "gotchas" for writing efficient CSS?
  • What are the advantages/disadvantages of using CSS preprocessors?
    • Describe what you like and dislike about the CSS preprocessors you have used.
  • How would you implement a web design comp that uses non-standard fonts?
  • Explain how a browser determines what elements match a CSS selector.
  • Describe pseudo-elements and discuss what they are used for.
  • Explain your understanding of the box model and how you would tell the browser in CSS to render your layout in different box models.
  • What does * { box-sizing: border-box; } do? What are its advantages?
  • List as many values for the display property that you can remember.
  • What's the difference between inline and inline-block?
  • What's the difference between a relative, fixed, absolute and statically positioned element?
  • The 'C' in CSS stands for Cascading. How is priority determined in assigning styles (a few examples)? How can you use this system to your advantage?
  • What existing CSS frameworks have you used locally, or in production? How would you change/improve them?
  • Have you played around with the new CSS Flexbox or Grid specs?
  • How is responsive design different from adaptive design?
  • Have you ever worked with retina graphics? If so, when and what techniques did you use?
  • Is there any reason you'd want to use translate() instead of absolute positioning, or vice-versa? And why?

JS Questions:

  • Explain event delegation
  • Explain how this works in JavaScript
  • Explain how prototypal inheritance works
  • What do you think of AMD vs CommonJS?
  • Explain why the following doesn't work as an IIFE: function foo(){ }();.
    • What needs to be changed to properly make it an IIFE?
  • What's the difference between a variable that is: nullundefined or undeclared?
    • How would you go about checking for any of these states?
  • What is a closure, and how/why would you use one?
  • What's a typical use case for anonymous functions?
  • How do you organize your code? (module pattern, classical inheritance?)
  • What's the difference between host objects and native objects?
  • Difference between: function Person(){}var person = Person(), and var person = new Person()?
  • What's the difference between .call and .apply?
  • Explain Function.prototype.bind.
  • When would you use document.write()?
  • What's the difference between feature detection, feature inference, and using the UA string?
  • Explain AJAX in as much detail as possible.
  • Explain how JSONP works (and how it's not really AJAX).
  • Have you ever used JavaScript templating?
    • If so, what libraries have you used?
  • Explain "hoisting".
  • Describe event bubbling.
  • What's the difference between an "attribute" and a "property"?
  • Why is extending built-in JavaScript objects not a good idea?
  • Difference between document load event and document ready event?
  • What is the difference between == and ===?
  • Explain the same-origin policy with regards to JavaScript.
  • Make this work:
duplicate([1,2,3,4,5]); // [1,2,3,4,5,1,2,3,4,5]
  • Why is it called a Ternary expression, what does the word "Ternary" indicate?
  • What is "use strict";? what are the advantages and disadvantages to using it?
  • Create a for loop that iterates up to 100 while outputting "fizz" at multiples of 3"buzz" at multiples of 5 and"fizzbuzz" at multiples of 3 and 5
  • Why is it, in general, a good idea to leave the global scope of a website as-is and never touch it?
  • Why would you use something like the load event? Does this event have disadvantages? Do you know any alternatives, and why would you use those?
  • Explain what a single page app is and how to make one SEO-friendly.
  • What is the extent of your experience with Promises and/or their polyfills?
  • What are the pros and cons of using Promises instead of callbacks?
  • What are some of the advantages/disadvantages of writing JavaScript code in a language that compiles to JavaScript?
  • What tools and techniques do you use debugging JavaScript code?
  • What language constructions do you use for iterating over object properties and array items?
  • Explain the difference between mutable and immutable objects.
    • What is an example of an immutable object in JavaScript?
    • What are the pros and cons of immutability?
    • How can you achieve immutability in your own code?
  • Explain the difference between synchronous and asynchronous functions.
  • What is event loop?
    • What is the difference between call stack and task queue?

Testing Questions:

  • What are some advantages/disadvantages to testing your code?
  • What tools would you use to test your code's functionality?
  • What is the difference between a unit test and a functional/integration test?
  • What is the purpose of a code style linting tool?

Performance Questions:

  • What tools would you use to find a performance bug in your code?
  • What are some ways you may improve your website's scrolling performance?
  • Explain the difference between layout, painting and compositing.

Network Questions:

  • Traditionally, why has it been better to serve site assets from multiple domains?
  • Do your best to describe the process from the time you type in a website's URL to it finishing loading on your screen.
  • What are the differences between Long-Polling, Websockets and Server-Sent Events?
  • Explain the following request and response headers:
    • Diff. between Expires, Date, Age and If-Modified-...
    • Do Not Track
    • Cache-Control
    • Transfer-Encoding
    • ETag
    • X-Frame-Options
  • What are HTTP actions? List all HTTP actions that you know, and explain them.
  • What techniques do you use to increase availiability of your website?
Learn more »

why has it been better to serve site assets from multiple domains?

Most of large websites store their static content such as Images, JavaScrips & CSS files to a Content Delivery Network or CDN as deploying your content across multiple, geographically dispersed servers will make your pages load faster from the user's perspective. Additionally, it increases site performance by reducing the roundtrip time for resource requests. 

As the CDN has a different domain name, it also provides domain sharding benefits. Web browsers are restricted to download several items at once, so the more you use resources hosted on external domains the faster a page loads. This applies to everything from images to javascripts. Hence, Requests for static resources should be parallelized and balanced 
Learn more »

How would you optimize a website's assets/resources?

  1. Image of Proper Size: Always using image of proper size and specifying height and width of image is good idea.
  2. Compressing image, Use Photo shop, Save for Web
  3. Use of Sprites
  4. Caching:
    $expire = 60 * 60 * 24 * 1;// seconds, minutes, hours, days
    header('Cache-Control: maxage='.$expire);
    header('Expires: '.gmdate('D, d M Y H:i:s', time() + $expire).' GMT');
    header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
  5. Data URI Scheme / Inline Images
$picture = fread($fp,filesize($file));
fclose($fp);
// base64 encode the binary data, then break it
// into chunks according to RFC 2045 semantics
$base64 = base64_encode($picture);
$tag = '<img src="data:image/jpg;base64,'.$base64.'" alt="" />';
$css = 'url(data:image/jpg;base64,'.str_replace("\n", "", $base64).'); ';
 
Learn more »

What is the difference between tags and elements (HTML)?

Tags are just HTML tag that has just opening or closing entity. For example:
<p> and </p> are called HTML tags.

HTML element encompasses opening tag, closing tag, content (optional for content-less tags) Eg:
<p>This is the paragraph</p> : This complete thing is called a HTML element. 


<h3>This is the H3 heading level.</h3> Here, <h3></h3> are HTML tags and the entire statement, <h3>This is the H3 heading level.</h3> is referred as HTML element.

HTML attributes
An attribute defines a property for an element, consists of an attribute/value pair, and appears within the element’s start tag. An element’s start tag may contain any number of space separated attribute/value pairs.
The most popular misuse of the term “tag” is referring to alt attributes as “alt tags”. There is no such thing in HTML. Alt is an attribute, not a tag.
Learn more »

How does a web server link physically on the Internet? How do we navigate from one URL to another from a page displayed at a browser? Explain.

SECTION A
Long Question Answer
1. How does a web server link physically on the Internet? How do we navigate from one URL to             another from a page displayed at a browser? Explain.
2. List the protocols and their use at the application layer in the Internet. Why World Wide Web is         use? Explain.
3. What is Dom Hierarchy? Explain the use of *,? and t in defining a Dom element.

SECTION B
Short Question Answer
1. What are the tags and the attributes for a table in HTML document?
2. Write short notes on various services offered by the Internet.
3. What is the functionality and purpose of HTTP?
4. Explain the XML syntax and structure rules.
5. Mention the application of XSL.
6. What are the benefits and draw backs of using XML name space?
7. What is the syntax of declaring an attribute in a DTD?
8. Explain briefly, how the domain names are translated to IP addresses?
9. Explain the client/server concepts of web?
10. What do you mean by cookies? Explain with example.
Learn more »

What do you mean by Design Pattern? Why is it necessary? What are the common design patterns?

Design patterns are the generic solution to common object oriented software design. When solving any software design, we come across several issues that have common solutions. Design pattern can be useful at this step.

Why Design Pattern?
  • It can speed up the development process by providing tested and proven software development paradigm.
  • Improves code reusability
  • Pattern allows developers to communicate using well known, well understood names of software interactions. 
Some of the common design patterns are as follows:
  1. Creational Design pattern: These are concerned with creation of instances of one or more classes.  Some of its common types are factory method, abstract factory method, prototype, singleton, builder method, etc
  2. Structural Method: These are concerned with objects and class composition. Some of the common structural  methods are adapter, bridge, composite, decorator, facade etc. 
  3. Behavioral Design Pattern: These are concerned with class and objects communication and how objects communicates with one another. Some of common approaches of behavioral methods of design patterns are chain of responsibilities, command etc. 
Learn more »

How to develop iphone application?

To develop iOS apps, you need:
  • A Mac computer running OS X 10.8 (Mountain Lion) or later
  • Xcode
  • iOS SDK

Xcode is Apple’s integrated development environment (IDE). Xcode includes a source editor, a graphical user interface editor, and many other features. The iOS SDK extends the Xcode toolset to include the tools, compilers, and frameworks you need specifically for iOS development.

Which programming language should I know?
In order to develop IOS application, you need to know objective -C. It is similar to C++ programming language or C programming language with object oriented features.
Learn more »

Write a PHP Program to count number of words from a file.

PHP program to count number of words in a string with its number of occurrences. 

First of all Create the interface where user can enter text or string to count the number of words and its frequencies.

Here is index.php file. 
<head>
<style>
#textarea{
    width:100%;
    min-height:100px;
    margin-bottom:50px;
}
#count,#clear{
    float:right;
    width:200px;
    height:50px;
    box-shadow:1px 2px 2px 1px green ;
    background:#9999CC;
    color:white;
    font-size:13px;
    margin-right:10px;
}
#count:hover, #clear:hover{
    box-shadow:1px 2px 2px 1px black ;
    margin-top:-2px;
    font-size:14px;
}
</style>
</head>
<body>
    <p>Enter your texts here.</p>
    <textarea id="textarea" placeholder="Put Your Text here to Count Your words."></textarea>
    <input type="reset" value="Clear" id="clear"/    >
    <input type="submit" value="Count" id="count"/    >
   
    <p id="result"></p>
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("#count").on("click",function(){
            var strings = $("#textarea").val();
            if(strings=="")
            {
                    $("#result").text("Please put some text to count words");
            }
            else
            {
                $.ajax({
                    type:"POST",
                    url:"countwords.php",
                    data:{strings:strings}
                }).done(function(msg){
                    //alert(msg);
                    $("#result").html(msg);
                });   
            }
       
           
        });
       
        $("#clear").on("click",function(){
            $("#textarea").val("");
        });
    });
   
</script>
</body>


Here is the countwords.php file. 
<?php
/*This program Counts the number of words in a given File and its number of occurence*/
class WordCounter{
    const ASC=1;
    const DSC = 2;
    private $words;
   
    function __construct()
    {  
      
        $file_content = $_POST['strings'];
        //str_word_count counts words inside a string and returns in array format

      //array_count_values counts the number of each values in the array
        $this->words = (array_count_values(str_word_count(strtolower($file_content),1)));
    }
   
    public function counting($order)
    {
        if($order==self::ASC)
        asort($this->words);
        else if($order==self::DSC)
        arsort($this->words);
        foreach($this->words as $key=>$val)
        {
            echo $key."=". $val."<br/>";
        }
    }
}
?>
<br/>
<?php
 $var = new WordCounter();
 $var->counting(WordCounter::ASC);

?>

 
Learn more »

How to secure Facebook account?


Is it safe to use Facebook? How to securely use Social Web?
Despite the actual statistics about the popularity of Social Web, security is always a burning question. Anyone can get into hot water when asked, which social web is most popular, whether it is Facebook, or Twitter or Instagram or other. But whatever it is, when it comes to end users, there is always a mind-shattering question “Is it safe to use Facebook? Or how can I secure my Web World?” In this article, I would like to share you about most common ways people can exploit your web world and tweaks you can do to prevent yourself from being socially engineered.
What are the common security threats?
·      Suspicious Emails and notifications: If you get email asking for your username or password, never respond them. Facebook or any other website will never ask you to send your username or password or answer to your security questions. Spammers and scammers sometimes create phony emails that look like they’re from Facebook. These emails can be very convincing. You might get something like, warnings that something will happen to your account if you don't update it or take another immediate action, Claims or offers that sound too good to be true (ex: You've won the Facebook Lottery!) etc.

·      Adware: Some program claims that they can give you special feature on your Facebook like, who viewed your timeline or adding theme to timeline. When you click on those links, it asks you to download small extensions. Once done, it will populate your timelines with ads and banners and makes your timeline load slowly.
o   Remedy: To get rid of them remove the suspicious extensions from the browser you use. For example in, if you are using Safari, you click on “Safari” -> “Preferences” ->”Extensions” and remove unwanted extensions.

·      Malware: Malware is software system that is designed to break a PC or a network. If you've got Malware on your PC, it might be wont to get around Facebook's security controls and take over your account. This software system will collect data from your account, send standing updates or messages that appear as if they are from you, or cowl your account with ads that crash your pc.
o   Remedy:
§  Change your Password.
§  Scan your computer for Malware.
§  Upgrade your browser to latest version.
§  Remove unwanted browser add-ons.

·      Keylogging through Keyloggers: Keylogger is a type of computer virus that tracks key strokes. Keyloggers can be installed remotely on a computer system by a cracker to record all the activity that is going on the victim's computer. Keylogging gets easier if the hacker has physical access to the victim's computer.
o   Remedy: Install a good antivirus and update it frequently. Do not click on suspicious links and avoid downloading illegal software. Also, avoid installing free toolbars and other such spam software. Always scan third-person's flash and pen drives before using them on your computer.

·      Phishing: Phishing is one of the easiest ways to trick users into giving out their login credentials. All a hacker does is setup a webpage similar in design to that of the Facebook homepage, attach a server sided script to track the username and password entered and store it in a log. Sending people emails stating that someone tagged a photo of them on Facebook in the same format as Facebook and giving a link below to the Phishing website further reduces the chances of it being detected as a fake. Sometimes, spam Facebook apps, like those promising to tell who viewed your Facebook profile, automatically post links to Phishing websites. A new trend amongst phishers is creating Facebook look-a-like widgets for stealing user's login credentials.
o   Remedy: If you think your friend's account was phished, tell them to change their password and run anti-virus software on their computer. At all costs, avoid clicking on suspicious links. Moreover, always check the URL in the address bar before signing in. Avoid logging in through various "Facebook widgets" offered by websites and blogs. Instead, use Facebook's homepage to sign in.
How to keep your account safe?
·      Confirm your mobile number: Most of the social web allows securing your account using mobile numbers. You can get notifications whenever some unknown person tries to access your account. Code Generator methods of Facebook are one of the great ways to protect your Facebook account.
·      Pick a strong password:  Do not use any dictionary words. Any meaningful words can be hacked through some attacking methods. Use a combination of at least six numbers, letters, and punctuation marks.
·      Make sure your email account(s) are secure: Do not use same password for your email and Facebook or any other social web. If you have same password, stop reading this right here and go ahead and change your password.
·      Log out of Facebook: Log out of Facebook or other sites when you use a computer you share with other people. Do not save your password in your browser when it prompts for saving it.
·      Run anti-virus software on your computer: Keep your anti-virus and Operating System updated. Operating system keeps integrating security patches in every new version. Make sure you have latest copy.
·      Think before you click or download anything.
What to do after your account is hacked?
What can be done after your account is hacked? Don’t Panic. Web security flows is a known but controlled issues.
·      Change your Password: If your password was not changed, change your password immediately. If your password is change, reset your password.
·      Report compromised account: If your Facebook account is compromised, it means your Facebook account was not hacked. Follow the instructions and you can regain the access to your account.
·      Do damage Control: After you regain access to your account checks your inbox, settings, apps etc. Inform your friends your account was hacked and if any message sent was not by you. Remove suspicious applications.
·      Change your email password: If your email address is hacked, hacker or spammer can easily gain access to your all the accounts associated with that email address. Make sure, your email account is safe.
Compiled By
Suresh Kumar Mukhiya
[Web Developer, Web Security Analyst, SEO Expert]
itsmeskm99@gmail.com
Learn more »

How can I prevent SQL injection in PHP?

  1. Use prepared statements and parameterized queries. These are SQL statements that are sent to and parsed by the database server separately from any parameters. This way it is impossible for an attacker to inject malicious SQL.
    $stmt = $pdo->prepare('SELECT * FROM employees WHERE name = :name');
    
    $stmt->execute(array('name' => $name));
    
    foreach ($stmt as $row) {
        // do something with $row
    }
  2. You could do something basic like this:
    $safe_variable = mysql_real_escape_string($_POST["user-input"]); mysql_query("INSERT INTO table (column) VALUES ('" . $safe_variable . "')"); This won't solve every problem, but it's a very good stepping stone.
  3.  
Learn more »

How to convert string to uppercase or lowercase in PHP?

We can convert strong to upper case using strtoupper() function and convert string to lowercase using strtolower() PHP function.

For Example, 
<?php 
$string = "This is test string.";
$new_string = strtoupper($string);

echo $new_string;
//output would be THIS IS TEST STRING
 
?>
Learn more »

Odesk Seo Test Questions And Answers 2013

Odesk Seo Test Questions And Answers 2013

oDesk Search Engine Optimization Test Questions and Answers
Question: Which of the following search engines or directories provides the directory search results for Yahoo? 
 b. Yahoo Directory 
Question: Which of the following statements regarding website content are correct?                                                             
c. Syndicating your content could lead to Google viewing the material as duplicate
Question: What is Keyword Density?
d.The number of times the keyword is used in the page title
Question: Which of the following statements about the Google Sitemap are correct:
a.Repeated submission of the Sitemap to Google could be penalized
Question: Are RSS/Atom feeds returned in Google's search results?
b.No
Question: What does the term Keyword Prominence refer to?
c.It refers to the fact that the keywords placed in important parts of a webpage are given priority by the search engines
Question: Which of the following factors does Google take into account while assessing whether or not a website is an authority website?
Ans: A,B,C
Question:  What is Anchor Text?
c.It is the visible text that is hyper linked to another page
Question: If you search for the term "iq test" in the Word Tracker keyword suggestion tool, will it return the number of independent searches for the term "iq"?
b.No
Question: What is the illegal act of copying of a page by unauthorized parties in order to filter off traffic to another site called?
d.Pagejacking
Question: Do search engines such as Google detect unnatural linking patterns by checking the Class C IP address of the page where the link to the website originates?
a.Yes
Question: What term is commonly used to describe the shuffling of positions in search engine results in between major updates?
 b.Flux
Question: While grading your website, Google gives credit to outbound links pointing to authority websites?
b.False
Question: Which of the following URLs can the Google search engine spider?
e.All of the above
Question: Google displays up to _____ characters of a webpage's Title Tag.
c.66
Question: What does the 302 server response code signify?
 d.The page has temporarily moved
Question: Which of the following statements is correct with regard to the description meta tag?
d.Google uses the meta description to generate the search engine results pages
Question: State whether true or false.
The Yahoo Directory listing is a free service for commercial sites.
a.True
Question: Which of the following statements is correct with regard to the images within a webpage?
b.Important keywords related to the image should be placed in the ALT text
Question: Cloaking is a controversial SEO technique. What does it involve?
b.Offering a different set of web pages to the search engines
Question: Which of the following facts about Alexa are correct?
a.Alexa provides free data on relative website visitor traffic
Question: Google looks down upon paid links for enhancing page rank. If a website sells links, what action/s does Google recommend to avoid being penalized?
 c.Paid links should be disclosed through the "rel=nofollow" attribute  in the hyperlink
Question: Which of the following actions could get you banned by Google?
a.Hiding text on the webpage
Question: Which of the following statements about Google's technical and quality guidelines is true?
b. If using dynamic pages, it helps to keep the parameters short and the number of them few
Question: Which of the following is an ethical SEO Technique?
d.None of the above
Question: All major search engines are case sensitive.
b.False
Question: While optimizing your website it is important to generate the right type of traffic, how does the Bounce Rate information help in this regard?
b.By letting you know the percentage of users who entered the website and then left without viewing any other page
Question: Which of the following factors contribute towards link popularity of a website?
Ans: A,B,C,D
Question: Search engines do not index some common words (such as "or", "and", "when", and "in") within the webpage. What are these common words called?
d.Stop words
Question: Which of the following activities could be looked down upon by Google as per their quality guidelines?
Ans: B,C
Question: Which of the following statements about RSS are correct?
a.It is a form of XML
Question:_________ is usually the best web page to get linked to while receiving a themed in-bound link from another website.
d.The page which you would like to improve in the search engine rankings
Question: Which of the following can be termed as good keyword selection and placement strategies?
Ans: A,D
Question: If your site is not appearing in Google search results because of some unethical SEO practices in the recent past, _________________.
d.it is better to discontinue the website and shift your webpages to a fresh website with a new domain name.
Question: Which of the following statements about search engine optimization techniques are correct:
Ans: A, B, D
Question: A Hallway Page is used to:
d.Enable search engine bots to index the Doorway Pages
Question: Which of the following free tools/websites could help you identify which city in the world has the largest search for the keyword - "six sigma"?
d.Google Trends
Question: How are site maps important for the search engine optimization process?
c.Site maps help the search engine spider pick up more pages from the website
Question: State whether the following statement is true or false.
A Sitemap provides a list of internal links to user accessible pages on a website.
 a.True
Question: What is the function of "indexer" part of the Google search engine?
d.It helps to generate meaningful results based upon the user's search term
Question: Which of the following conditions will Google treat favorably from the 'Relevancy' perspective?
d.Image Alt tags on the home page matching the search term
Question: Some words, when followed by a colon, have special meanings to Yahoo. What is performed by the link: operator?
c.It shows all the pages that point to that URL
Question: Which of the following factors have an impact on the Google PageRank?
a.The total number of inbound links to a page of a web site
Question: What is the term for Optimization strategies that are in an unknown area of reputability/validity?
c.Grey hat techniques
Question: Why is it a bad idea from the seo perspective to host free articles and write ups that are very common on the internet.
b.Because you could get penalized by search engines for using duplicate content
Question: The following robots meta tag directs the search engine bots:
<META NAME="robots" CONTENT="noindex,nofollow">
b.Not to index the page and not to follow the links in the page
Question:_________________ use both crawlers and directories to generate relevant results.
d.Meta Search Engines
Question: Which of the following statements is correct with regard to natural links?
c.They are voluntary in nature
Question: What will happen if you type the words 'Certification -Networking' in the Google search box?
d.Google will find the web pages about Certification that do not contain the word Networking
Question: If you enter 'Help site:www.microsoft.com' in the Google search box, what will Google search for?
b.It will find pages about help within www.expertrating.com
Question: Which of the following statements about FFA pages are true?
b.They are also called link farms
Question: What is the name of the search engine technology due to which a query for the word 'actor' will also show search results for related words such as actress, acting or act?
d.Stemming
Question: If a website's search engine saturation with respect to a particular search engine is 20%, what does it mean?
a.20% of the webpages of the website have been indexed by the search engine
Question: What is the main reason for the effectiveness of optimizing a webpage towards a long tail keyword search?
a.There are more long tail searches than shorter keyword queries
Question:10 people do a web search. In response, they see links to a variety of web pages. Three of the 10 people choose one particular link. That link then has a __________ clickthrough rate.
 b. 30 percent
Learn more »