Monday, February 12, 2018

what is the best laptop i can buy as a CS student

In this post you will know which is the best laptop for computer science students.The very basic thing a programmer need is to a laptop which has good speed. The focus should be on the processor speed, it should be minimum 2GHZ or more. The laptop RAM should not be less than 4GB.

The most basic of laptops will get the job done, so anything above that is for your own comfort. To be honest, you can just use the school's lab computers. However, my philosophy has been to go for a lightweight laptop with long battery life, as high a resolution screen as you can get, and a good keyboard.

  • Apple MacBook Pro 13" or MacBook Air (11" or 13")
  • Dell Vostro 1440, 3450, and V131
  • Lenovo Thinkpad T and X series
  • Toshiba Portege R830 and R835

The MacBooks are nice , but you'll probably load Windows on them, just to keep things easy. Keep in mind that you will buy something new when you graduate, so plan your purchase around what you can afford to replace in 2 years. Processing power, HD capacity, etc. are not important, especially for a computer that can easily get stolen or broken.

Also, if you end up taking any digital logic courses, you will want a few extra USB ports and will definitely need Windows, because most of the IDEs for FPGAs and micro controllers are only available on Windows.

The very basic thing a programmer need is to a laptop which has good speed. The focus should be on the processor speed, it should be minimum 2GHZ or more. The laptop RAM should not be less than 4GB.

WHAT TO LOOK FOR IN A LAPTOP FOR PROGRAMMING?

The very basic thing a programmer need is to a laptop which has good speed. The focus should be on the processor speed, it should be minimum 2GHZ or more. The laptop RAM should not be less than 4GB.

Laptop Starting price in India:



I will say the specs or some of the features to watch out for when buying a laptop. Because, the same model with the same specs is not available in all parts of the world.

CPU : Intel i5/i7 (6th/7th gen preferably, and buy one with a quad-core rather than a dual-core processor)

RAM : Minimum 8 gigs, buy one with 1*8 GB rather than 2*4 GB , with an expandable slot.

Display : Full HD (either 13.3 or 15.6 inches) , you’ll clear notice that there’s a great difference between the 1366*768 and the 1920*1080 displays.

GPU -:Nvidia GTX series graphics (only if you are a gamer and do some heavy Photoshop work, else the built in Intel HD graphics would suffice)

HDD :1 Terabyte. SSD’s are costlier, but they reduce boot time.

Backlit keyboard : They are definitely useful when you work during late hours. The keyboard layout is very important since certain laptops with tightly packed keys are not comfortable for typing.

OS :Instead of buying one with Windows, choose one with the DOS or Linux. It will definitely save you few thousand bucks and you can always install an OS later as per your wish.

Ports -:USB 3.0, HDMI ports are a must, type-C port is a bonus.
Laptops with ultrabays are better since they can be used in multiple ways (GPU/Optical Drive/SSD)

Optical drive : Not necessary as the CD’s and DVD’s are replaced by USB drives nowadays.

The Macbooks are very good for programming but if you are looking for a laptop for coding/designing/playing games/watching movies you should consider an alternative. The Thinkpad series of Lenovo, Envy series of Hewlett-Packard and the Dell ultrabooks are very good options to consider for CS students.

Thursday, February 8, 2018

JQuery Interview Questions and answers

In this post you will learn frequently asked JQUERY interview questions for freshers and Experienced candidates.

1. what is jQuery?
ans: JQuery is javascript library or javascript framework which helps in how to traverse HTML documents,to do animations,and add Ajax interaction to any web page. It is mainly used to reduce lines of code as huge code written in javascript,can be done easily with JQuery in few lines.

2. What does $ mean in JQuery?
 ans: Dollar sign is nothing but it's an alias for jQuery. see the below jQuery code

$(document).ready(function)
{
});

here $ sign can be replaced with "jQuery"keyword like
jQuery(document).ready(functioin)
{
}); 

3)What are the advantage of using jQuery?
ans:
  • Easy to use and learn.
  • Easily expandable.
  • Cross-browser support (IE 6.0+, FF 1.5+, Safari 2.0+, Opera 9.0+)
  • Easy to use for DOM manipulation and traversal.
  • Large pool of built in methods.
  • AJAX Capabilities.
  • Methods for changing or applying CSS, creating animations.
  • Event detection and handling.
  • Tons of plug-ins for all kind of needs.
4)Why you should be using jQuery?
Ans:
Based on the manipulation of the HTML DOM (Document Object Model) and designed to simplify the client-side scripting of HTML, jQuery incorporates parts of HTML and CSS. Thousands of companies and individuals are on the jQuery bandwagon, and you should be, too.

5)How JavaScript and jQuery are different?
ans:
jQuery is not a programming language but a well written JavaScript code. It is a library/framework built with Javascript. It is very popular because it (nearly universally) abstracts away cross-browser compatibility issues and it emphasises unobtrusive and callback-driven Javascript programming. Javascript is the core programming language.

6)How you will use Jquery means requirement needed for using jquery?
ans:
Nothing more need to do just olny download jquery library(.js file) from any of the jquery site Download jquery and just linked with your html pages like all other javascript file
as follows:
code:
< script src="jquery.js" language="javascript" type="text/javascript">

7)How do you select an item using css class or ID and get the value by use of jquery?
ans:
If an element of html like < div> , < p> or any tag have ID MyId and class used MyClass then we select the element by below jquery code

Code:
$('#MyId') for ID and for classs $('.MyClass')
and for value
Code:
var myValue = $('#MyId').val();
// get the value in var Myvalue by id
Or for set the value in selected item
Code:
$('#MyId').val("print me");
// set the value of a form input

8)How to get the server response from an AJAX request using Jquery?
ans:
When invoking functions that have asynchronous behavior We must provide a callback function to capture the desired result. This is especially important with AJAX in the browser because when a remote request is made, it is indeterminate when the response will be received.
Below an example of making an AJAX call and alerting the response (or error):
Code:
$.ajax({
     url: 'EmpRecords.php',
     success: function(response) {
        alert(response);
     },
     error: function(xhr) {
        alert('Error!  Status = ' + xhr.status);
     }
});

9)What is $(document).ready() function? Why should you use it?
ans:
This is one of the most important and frequently asked jQuery Interview question. The ready() function is used to execute code when document is ready for manipulation. jQuery allows you to execute code, when DOM is fully loaded i.e. HTML has been parsed and DOM tree has been constructed. Main benefit of $(document).ready() function is that, it works in all browsers, jQuery handles cross browser difficulties for you.

10)Difference between JavaScript window.onload event and jQuery ready function?
ans:

Main difference between JavaScript onload event and jQuery ready function is that former not only waits for DOM to be created but also waits until all external resources are fully loaded including heavy images, audios and videos. If loading images and media content takes a lot of time, the user can experience significant delay on execution of code defined in window.onload event.

On the other hand jQuery ready() function only waits for the DOM tree, and does not wait for images or external resource loading, which means faster execution. Another advantage of using jQuery $(document).ready() is that you can use it multiple times in your page, and browser will execute them in the order they appear in HTML page, as opposed to onload technique, which can only be used for a single function. Given this benefits, it’s always better to use jQuery ready() function than JavaScript window.onload event.

11)what are the different types of selectors in JQuery?
ans:
There are 3 types of selectors in jquery
1.css selector
2.XPath selector
3.Custom selector

12)How can you select all elements in a page using jquery?
ANS:
To select all elements in a page,we can use all selectors,for that we need to use * symbol

code:
<script language="javascript" type="text/javascript">
$("*").css("border","2px dotted blue");
</script>

13)What are jQuery Events?
ans:
Events are actions performed on a specific condition that are used for dynamic web pages. When we perform these actions on an HTML page, we can do whatever we want. We use some event handlers to perform the action. Some important handlers are bind(), unbind(), blur(), off(), hover(), on(), one(), ready(), trigger() etc.

14)What are jQuery plugins and what is the advantage of using a plugin?
ans:
A plug-in is piece of code written in a standard JavaScript file. These files provide useful jQuery methods which can be used along with jQuery library methods. jQuery plugins are quite useful as its piece of code which is already written by someone and re-usable, which saves your development time.

15)What is the difference between .empty(), .remove() and .detach() methods in jQuery?
ans:

All these methods .empty(), .remove() and .detach() are used for removing elements from DOM but they all are different.

.empty(): This method removes all the child element of the matched element while remove() method removes set of matched elements from DOM.

.remove(): We use .remove() when we want to remove the element itself, as well as everything inside it. In addition to the elements themselves, all bound events and jQuery data associated with the elements are removed.

.detach(): This method is the same as .remove(), except that .detach() keeps all jQuery data associated with the removed elements. This method is useful when removed elements are to be reinserted into the DOM at a later time.

16)What is the difference between bind() and live() method in jQuery?
ans:
The binding of event handlers are the most confusing part of jQuery for many developers working on jQuery projects. Many of them unsure of which is better to use. In this article we will see the main differences between Bind and Live methods in jQuery.

Bind() Method
The bind method will only bind event handlers for currently existing items. That means this works for the current element.

$(document).ready(function () { 
$('p').bind('click', function () {
alert("Example of Bind Method"); 
e.preventDefault();
  }); 
 
Live() Method
The Live method can bind event handlers for currently existing items or future items.

$(document).ready(function() {
$('P').live('click', function() { 
alert("Example of live method");
e.preventDefault(); 
});
$('body').append(''); });

17)What is the difference between eq() and get() methods in jQuery?
ans:
eq() returns the element as a jQuery object. This method constructs a new jQuery object from one element within that set and returns it. That means that you can use jQuery functions on it.

get() returns a DOM element. The method retrieves the DOM elements matched by the jQuery object. But it is a DOM element and it is not a jQuery-wrapped object. So jQuery functions can’t be used.

Wednesday, February 7, 2018

PHP Login Form using Session

In this post you will learn login form source code using session without storing details in the database. In our next post you will see login form using session storing details in database.

Step 1: First create login page named as index.php

<?php>
session_start();    // Session start
if(isset($_POST['check']))    // Check form submit with IF Isset function
{
$username="lucky";    // set variable value
$password="123";        // set variable value
if($_POST['username']==$username && $_POST['password']==$password)   // Check Given user name, password and Variable user name password are same
{
$_SESSION['username']=$username;    // set session from given user name
header('location:mainpage.php');
}
else
{
$err="Authentication Failed Try again!";
}
}
?>
 <html>
<head>
<title>Main Page</title>
</head>
<body>
<Center>
<?php if(isset($err)){ echo $err; } ?>      <!-- Print Error -->

<form method="POST" name="loginauth" target="_self">
 User Name: <input name="username" size="30" type="text" />
<br/><br/>
Pass Word: <input name="password" size="20" type="password" />
<br/><br/>
<input name="check" type="submit" value="Authenticate" />
 </form>
</center>
</body>
</html>

Step 2: Now create mainpage.php

<?php
session_start();    //session start
if(!isset($_SESSION['username']))     //if session not found redirect to homepage
{
header('location:index.php');
}
echo "Welcome &nbsp;";
echo $_SESSION['username'];      //retrieved using session
?>
 <html>
<head>
</head>
<body>
<center>
<h2>Welcome to Main page</h2>
<a href="logout.php">logout</a>
</center>
</body>
</html>

Step 3: Now create LOGOUT.PHP page for destroy the session

<?php
session_start();
if(!isset($_SESSION['username']))     //if session not found redirect to homepage
{
header('location:index.php');
}
unset($_SESSION['username']);       // Session Found Unset the variable values
session_destroy();                  // Destroy the session
header('location:index.php');
?>


OUTPUT:



Wednesday, January 17, 2018

What is Web based Applications in cloud computing

In this post we will learn what is web based application and their benefits. At the same time we will also known what are the essentials of creating web-based applications and what the IT department needs.

Web Application:

In computing, web application or web app is a client-server computer program in which client runs in a web browser. A web based application is any application that uses a website as a interface or front end. Users can easily access from any computer connected to the internet using a standard browser.

why develop web-based application?

  • They must be deliver adequate computing power and data storage to all users within the company.
  • Must be done,of course,within a set of budget
  • to meet peak need or to add capacity for new users
What are the essentials of creating web-based applications?

  1. web based application development is not just the way to save money and time
  2. organizing more effective collaboration process with your colleagues,clients or partners, that makes web based application development
  3. web based application development includes database integration,intra-and extranet applications deployment
 What the IT department needs?

Is a way to increase capacity or add capabilities without investing in new servers and networking gear,or licensing new software. It is to this need that cloud computing speaks
  • cloud services,in the form of centralized web-based applications
  • application hosted in the cloud is cheaper and easier to manage than individual copies
  • upgrading a cloud app only has to be done one time
  • cloud services development are particularly notable to smaller businesses,who otherwise wouldn't have the budget or resource to develop large scale applications 

Monday, October 23, 2017

Python Interview Questions for freshers

In this post we will learn frequently asked Python Interview Questions and answers for freshers and also for experienced developers.In previous post we had discussed about why Python so powerful for Data Science, one of the frequently raised question that one so go through that post as well.

1) What is Python?

Ans: Python is a high level ,Object oriented,most successful interpreted language. It is a portable language,since it can run on different platforms such as Windows,Linux,Unix,Mac...It is a interpreted language that means when write a Python script it doesn't need to get compiled before execution.

2) What are the Benefits of Python?

Ans:

  1. Python is a Object Oriented Programming language as you can define classes along with the composition and Inheritance. It doesn't use any access specifier like Public or private
  2. It provides very high level dynamic data types and supports dynamic type checking
  3. It can be use as Scripting language or can be compiled to byte-code for building large applications.
  4. We can use Python for developing Web applications,automation,Scientific Modeling,Big Data applications etc..
  5. It can be easily integrated with C,C++,JAVA,COBRA,COM .
  6. It is extensible
3) What are the Data types in Python?

Ans: Python has 5 Standard Data types:

  1. Numbers
  2. String
  3. List
  4. Tuple
  5. Dictiornary
4) Is Multithreading supports in Python?

Ans: YES,Python has multi-threading package. It has a Construct called Global Interpreter Lock(GIL). This GIL makes you feeling only one thread is 'executing' at any one time.This happens very quickly so to the human eye it may seem like your threads are executing in parallel, but they are really just taking turns using the same CPU core.This means that if you want to make your code run faster then using the threading package often isn’t a good idea.

5)What is the output of print str if str = ‘Hello World!’?


Ans: Hello World!.

6) How to overload methods in Python?

Ans: Python's constructor: 
_init__ () is a first method of a class. Whenever we try to instantiate a object __init__() is automatically invoked by python to initialize members of an object.

7)How To Find Bugs Or Perform Static Analysis In A Python Application?

Ans: You can use PyChecker, which is a static analyzer. It identifies the bugs in Python project and also reveals the style and complexity related bugs.Another tool is Pylint, which checks whether the Python module satisfies the coding standard.

8) How to achieve Inheritance in Python?

Ans: Inheritance allows One class to gain all the members(say attributes and methods) of another class. Inheritance provides code re-usability, makes it easier to create and maintain an application. The class from which we are inheriting is called super-class and the class that is inherited is called a derived / child class.

9) What is the usage of help() and dir() function in Python?

Ans: Help() and dir() both functions are accessible from the Python interpreter and used for viewing a consolidated dump of built-in functions. 

Help() function: The help() function is used to display the documentation string and also facilitates you to see the help related to modules, keywords, attributes, etc.
Dir() function: The dir() function is used to display the defined symbols.

10)How is memory managed in Python?

Ans: Python memory is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have an access to this private heap and interpreter takes care of this Python private heap. 
The allocation of Python heap space for Python objects is done by Python memory manager. The core API gives access to some tools for the programmer to code.
Python also have an inbuilt garbage collector, which recycle all the unused memory and frees the memory and makes it available to the heap space.

11)What is dictionary in Python?

Ans: The built-in datatypes in Python is called dictionary. It defines one-to-one relationship between keys and values. Dictionaries contain pair of keys and their corresponding values. Dictionaries are indexed by keys.

Let’s take an example:

The following example contains some keys. Country, State & Captain. Their corresponding values are India, Andhra and Kohili respectively.


dict={'Country':'India','State':'Andhra','Captain':'kohli'}
print dict[Country]
India
print dict[State]
Andhra
print dict[Captian]
Kohli

12)What is pickling and unpickling in Python?

Ans: Pickling is a process in which a pickle module accepts any Python object, converts it into a string representation and dumps it into a file by using dump() function.
Unpickling is a process of retrieving original Python object from the stored string representation for use.

13) How Python does Compile-time and Run-time code checking?

Ans: In Python some amount of coding is done at compile time, but most of the checking such as type, name, etc. are postponed until code execution. Consequently, if the Python code references a user -defined function that does not exist, the code will compile successfully. The Python code will fail only with an exception when the code execution path does not exist.

14)Which command is used to exit help window or help command prompt?

Ans: "quit" command is used to exit help window or help command prompt.

15)What Is The Key Difference Between A List And The Tuple?
Ans: 
The major difference between a list and the tuple is that the list is mutable while tuple is not. A tuple is allowed to be hashed, for example, using it as a key for dictionaries.

16)Is There A Switch Or Case Statement In Python? If Not Then What Is The Reason For The Same?

Ans:
No, Python does not have a Switch statement, but you can write a Switch function and then use it.

 17)What Is A Built-In Function That Python Uses To Iterate Over A Number Sequence?

Ans: 
range() generates a list of numbers, which is used to iterate over for loops.
Example:
for i in range(5):
    print(i)

The range() function accompanies two sets of parameters.

range(stop)
stop: It is the no. of integers to generate and starts from zero. eg. range(4) == [0, 1, 2,3].
range([start], stop[, step])
start: It is the starting no. of the sequence.
stop: It specifies the upper limit of the sequence.
step: It is the incrementing factor for generating the sequence.

Points to note:
Only integer arguments are allowed.
Parameters can be positive or negative.
The <range()> function in Python starts from the zeroth index.