Showing posts with label Miscellaneous. Show all posts
Showing posts with label Miscellaneous. Show all posts

Wednesday, 25 September 2013

How Students Are Using The Internet For Studying

Does anyone out there remember actually having to go to the library to research for a paper? I remember having to order books from other libraries when I was in graduate school and -gasp- had to wait for them to be sent to me!

Annoying, right?

Even in that relatively short amount of time, we’ve been cultured to understand that we can learn from anything, anywhere, immediately. The landscape of researching and studying has changed quite a bit, hasn’t it? While I’m a little sad that there is no sourcing listed (and as such, I can’t cross check the information presented) the handy infographic below has taught me a few interesting things about current students’ online studying and research habits.

Did You Know?

  • Only 10% of students report using books from libraries to help them study
  • 100% of students report using Wikipedia to study
  • 80% of students report using social networks to help them study
  • 55% of students report using online services to help them write their papers
how-students-learn-today_51a483788c8ff

Friday, 13 September 2013

The Best Tools to Easily Perform Remote Tech Support

computer-phone-frustration

“Help, my computer is broken!” comes the phone call yet again. If you’re stuck playing tech support for family or friends, there are many free tools that allow you to remotely access the other person’s computer and fix it.

There are a million and one remote tech support options out there. We’ll look at the best ones here, whether you need to walk them through downloading one over the phone or want to set up remote access ahead of time.

TeamViewer

TeamViewer is the remote support tool of choice for many geeks. It can be used in several different ways. You can direct your partner to download the TeamViewer QuickSupport application, which can run without administrator access or any system configuration. It will give them a session ID and password that they can give to you, allowing you to easily remotely connect from your TeamViewer program. There’s no setup process here — just download the appropriate program and double-click it to launch it.



You could also opt to set up unattended access after installing the full TeamViewer client, giving you permanent remote access to the computer without the remote user having to give you any passwords or confirm anything. As long as their computer is on, you’ll be able to access it remotely. If you want to do preventative maintenance or fix their computer while they’re not around, this is a convenient option.


TeamViewer is also cross-platform, so you can use it to troubleshoot a Mac or troubleshoot your parents’ Windows computer from your Linux PC. You can even remotely connect from an Android or iOS device. We’ve taken an in-depth look at TeamViewer in the past.

Windows Remote Assistance

Windows has a built-in remote assistance feature designed for just this situation. While only Professional editions of Windows can use the remote desktop server software, every version of Windows can send a remote assistance invitation and invite someone else to assist with their computers. This can be a convenient option because it’s already installed on the remote Windows computer, so you don’t have to walk the person through installing anything.

To use this feature, tell the other person to launch Windows Remote Assistance — either by opening the Start menu, typing Windows Remote, and pressing Enter or navigating to Start -> All Programs -> Maintenance -> Windows Remote Assistance.

They’ll need to use the Invite someone you trust to help you option and then select Easy Connect, which will give them a password.

Note that Easy Connect won’t always be available — if it isn’t, the remote user will have to create an invitation file using the Windows Remote Assistance app and send it to you.


You’ll need to open the Windows Remote Assistance application on your computer, choose Help someone who has invited you, select Easy Connect, and enter the password. If Easy Connect isn’t available, you’ll have to provide the invitation file.

After they approve your connection, you’ll be able to see and control their desktop remotely so you can begin cleaning it of viruses, removing toolbars, or dealing with whatever other problems are there. Read our in-depth walkthrough to Windows Remote Assistance for more information.


Windows Remote Assistance can help in a pinch, but it’s not the ideal permanent solution. If you find yourself needing to connect regularly, there’s no way to connect without having the other person open the Remote Assistance app and tell you the password. If a solution that allows you to remotely log in without pestering the other person is ideal, set up TeamViewer or a similar program instead.

Chrome Remote Desktop

There’s a good chance both you and your recipient already have Google’s Chrome browser installed on your computers. If you do, you can use Chrome Remote Desktop app to connect to them remotely.
To do this, both you and the other person will need to have the Chrome Remote Desktop app installed. The other person will need to open the Chrome Remote Desktop app from their new tab page and click Enable remote connections.

They’ll then need to click the Share button to share their computer with someone, which will give them an access code.

Once they provide you with the access code, you’ll be able to open the Chrome Remote Desktop app, click the Access button, and enter the access code. You’ll then be connected to their computer.


You could also try setting up a PIN for permanent remote access. Like TeamViewer, this tool is cross-platform and also works on Mac, Linux, and Chrome OS. It will also likely be more robust than Windows Remote Assistance, as it shouldn’t fail — unlike the Easy Connect option in Windows Remote Assistance.
We’ve previously covered using Google Chrome to remotely access your computers.

More Options

Sure, there are more options, but they’re not all ideal. Skype has a screen-sharing feature, which is convenient because so many people have Skype installed — but Skype’s screen sharing feature doesn’t allow you to control the PC remotely, so you’d have to walk the person through clicking on the correct things.

LogMeIn is another remote desktop solution that’s occasionally used, but it’s much more focused on paid solutions for businesses. TeamViewer seems to be a better option for the average geek.
You could try enabling Remote Desktop in Windows for permanent remote access, but that would require the other person have a Professional version of Windows or better — not too common with average users. This would also require port forwarding to make the machine accessible from the Internet.


You could also set up a VNC server, which is the manual way of doing this. A VNC server is essentially a free alternative to Windows Remote Desktop, so you could install it on any edition of Windows. However, VNC servers are just a server — you have to manually forward ports and ensure it’s remotely accessible yourself. This is much more painful than just using one of the above solutions, which handles the connection setup itself without any messy port-forwarding.

Ultimately, you’re probably better off with TeamViewer. It’s easy to use, whether you’re trying to get the other person to download the QuickSupport application — no administrator access needed — and give you a password or configure remote, unattended access so you can always access their PC. The remote assistance features built into Windows and Chrome could also be useful as they should be quick to set up if you’re already using Windows or Chrome.

If you constantly find yourself having to perform remote tech support for the same people, you may want to get your relatives off of Windows entirely. Consider giving them a Mac, Chromebook, Linux PC, iPad, Android tablet — anything that’s more difficult to mess up than a good old-fashioned Windows desktop.

How To Troubleshoot Internet Connection Problems

hand-plugging-in-ethernet-cable

Internet connection problems can be frustrating. Rather than mashing F5 and desperately trying to reload your favorite website when you experience a problem, here are some ways you can troubleshoot the problem and identify the cause.

Ensure you check the physical connections before getting too involved with troubleshooting. Someone could have accidentally kicked the router or modem’s power cable or pulled an Ethernet cable out of a socket, causing the problem.
Image Credit: photosteve101 on Flickr

Ping

One of the first things to try when your connection doesn’t seem to be working properly is the ping command. Open a Command Prompt window from your Start menu and run a command like ping google.com or ping howtogeek.com.

This command sends several packets to the address you specify. The web server responds to each packet it receives. In the command below, we can see that everything is working fine – there’s 0% packet loss and the time each packet takes is fairly low.


If you see packet loss (in other words, if the web server didn’t respond to one or more of the packets you sent), this can indicate a network problem. If the web server sometimes takes a much longer amount of time to respond to some of your other packets, this can also indicate a network problem. This problem can be with the website itself (unlikely if the same problem occurs on multiple websites), with your Internet service provider, or on your network (for example, a problem with your router).

Note that some websites never respond to pings. For example, ping microsoft.com will never results in any responses.

Problems With a Specific Website

If you’re experiencing issues accessing websites and ping seems to be working properly, it’s possible that one (or more) websites are experiencing problems on their end.

To check whether a website is working properly, you can use Down For Everyone Or Just For Me, a tool that tries to connect to websites and determine if they’re actually down or not. If this tool says the website is down for everyone, the problem is on the website’s end.


If this tool says the website is down for just you, that could indicate a number of things. It’s possible that there’s a problem between your computer and the path it takes to get to that website’s servers on the network. You can use the traceroute command (for example, tracert google.com) to trace the route packets take to get to the website’s address and see if there are any problems along the way. However, if there are problems, you can’t do much more than wait for them to be fixed.

Modem & Router Issues

If you are experiencing problems with a variety of websites, they may be caused by your modem or router. The modem is the device that communicates with your Internet service provider, while the router shares the connection among all the computers and other networked devices in your household. In some cases, the modem and router may be the same device.

Take a look at the router. If green lights are flashing on it, that’s normal and indicates network traffic. If you see a steady, blinking orange light, that generally indicates the problem. The same applies for the modem – a blinking orange light usually indicates a problem.


If the lights indicate that either devices are experiencing a problem, try unplugging them and plugging them back in. This is just like restarting your computer. You may also want to try this even if the lights are blinking normally – we’ve experienced flaky routers that occasionally needed to be reset, just like Windows computers. Bear in mind that it may take your modem a few minutes to reconnect to your Internet service provider.

If you still experience problems, you may need to perform a factory reset on your router or upgrade its firmware. To test whether the problem is really with your router or not, you can plug your computer’s Ethernet cable directly into your modem. If the connection now works properly, it’s clear that the router is causing you problems.
Image Credit: Bryan Brenneman on Flickr

Issues With One Computer

If you’re only experiencing network problems on one computer on your network, it’s likely that there’s a software problem with the computer. The problem could be caused by a virus or some sort of malware or an issue with a specific browser.

Do an antivirus scan on the computer and try installing a different browser and accessing that website in the other browser. There are lots of other software problems that could be the cause, including a misconfigured firewall.

DNS Server Problems

When you try to access Google.com, your computer contacts its DNS server and asks for Google.com’s IP address. The default DNS servers your network uses are provided by your Internet service provider, and they may sometimes experience problems.

You can try accessing a website at its IP address directly, which bypasses the DNS server. For example, plug this address into your web browser’s address bar to visit Google directly:
http://74.125.224.72


If the IP address method works but you still can’t access google.com, it’s a problem with your DNS servers. Rather than wait for your Internet service provider to fix the problem, you can try using a third-party DNS server like OpenDNS or Google Public DNS.


Ultimately, most connection problems you’ll run into are probably someone else’s problem – you can’t necessarily solve them yourself. Often, the only thing you can do is wait for your Internet service provider or a specific website to fix the problem you’re experiencing. (However, restarting a flaky router can solve lots of problems.)

If you are experiencing problems, you can always try calling your Internet service provider on the phone – you’re paying them for this service, after all. They will also be able to tell you whether it’s a problem that other users are also having — or whether it’s a problem on your end.

How to Sync External Folders with Your SkyDrive

image

Microsoft launched its new SkyDrive desktop app which is set to compete head-to-head with Dropbox and Google Drive. Here’s how to sync folders that are outside of your SkyDrive folder.

Using a Reparse Point

Known as the Soft Link to some, a Symbolic Link is the most common form of reparse point. Luckily for us Windows Vista and later include a command line utility, called mklink, which can be used to manage symbolic links. In order to create a symbolic link we first need to find your SkyDrive folder which, buy default, is located at:
C:\Users\”Your Username”\SkyDrive
This is also known as the %userprofile% environment variable, which makes it extra easy to create a symbolic link. So go ahead and fire up a administrative command prompt.

Now we need to use mklink to create a symbolic link, the syntax to link to a folder is:
mklink /d <link> <target>
For files we don’t need the “/d” switch so we can just use:
mklink <link> <target>
But as an added bonus we can use our environment variable, so we can do something like this:
mklink /d “%userprofile%\SkyDrive\Music” C:\Music

Above I created a symbolic link that points to the Music folder on the root of my “C” drive. This means that any files I put into that folder will be automatically uploaded to my SkyDrive, you can check this by looking at your SkyDrive.

As you can see my symlink is there and functioning just as we expected. That’s all there is to it, happy symlinking

Sunday, 22 January 2012

System.Object : a look on mother of all managed classes



System.Object : a look on mother of all managed classes

In this article we will walkthrough and understand each function of Object class.
System.Object is known as mother class of all the managed classes. All the classes are inherited from System.Object. It is base type for all the managed classes. So it defines the base behavior of all the managed classes.
System.Object class contains below functions.
clip_image002
Let us examine each function one by one.
For all explanation we will use Student class. Student class is as below,
1class Student
2 
3   {
4 
5       public string RollNumber { get; set; }
6 
7       public string Name { get; set; }
8 
9   }
Object.GetHashCode method
1. This returns an integer.
2. On overriding it returns unique identifier for instance
3. Hash code for a instance can be calculated using simple algorithm to complex algorithm.
4. We should be using a constant and Read only data to calculate the hash code. Because if data changes then hash value will also get changed.
In Employee class let us override the GetHashCode() method. We will be returning 100 times of roll number as hash value for the instance. Feel free to put any complex algorithm in overridden method to calculate hash value of the instance.
01using System;
02 
03namespace ConsoleApplication8
04 
05{
06 
07    class Program
08 
09    {
10 
11        static void Main(string[] args)
12 
13        {
14 
15            Student student = new Student { RollNumber = "1" };
16 
17            int hash1 =   student.GetHashCode();
18 
19            Console.WriteLine(hash1);
20 
21            Console.ReadKey(true);
22 
23        }
24 
25    }
26 
27    class Student
28 
29    {
30 
31        public string RollNumber { get; set; }
32 
33        public string Name { get; set; }
34 
35        public override int GetHashCode()
36 
37        {
38 
39            //return base.GetHashCode();
40 
41            return Convert.ToInt32(RollNumber)*100;
42 
43        }
44 
45    }
46 
47}
clip_image004
Object.GetType method
1. This returns a Type object.
2. This is mainly used for reflection.
3. Type class is an abstract class and inherits MemberInfo class and implements _Type , IReflect interface
clip_image005
4. This class contains many vital methods like Name , ReturnType etc.
In below example, we will print type info of all the functions inside System.Object class.
01using System;
02using System.Reflection;
03 
04namespace ConsoleApplication8
05{
06    class Program
07    {
08        static void Main(string[] args)
09        {
10 
11            Object obj = new Object();
12            Type type = obj.GetType();
13            foreach(MethodInfo mn in type.GetMethods())
14            {
15                Console.WriteLine(mn.Name + "  " + mn.ReturnType);
16            }
17            Console.ReadKey(true);
18 
19        }
20    }
clip_image007
Object.ToString method
1. This method is one of the widely used methods.
2. This returns string representation of the instance.
3. It returns fully qualified name of the type.
4. For primitive type it is overridden and returns string values.
In below example we will convert instance of Object class to string.
01using System;
02 
03using System.Reflection;
04 
05namespace ConsoleApplication8
06 
07{
08 
09    class Program
10 
11    {
12 
13        static void Main(string[] args)
14 
15        {
16 
17            Object obj = new Object();
18 
19            Console.WriteLine(obj.ToString());
20 
21            Console.ReadKey(true);
22 
23        }
24 
25    }
clip_image009

Object.Equals method
1. Two References are equal only if they are pointing to the same object.
2. Two references are not equal if they are pointing to different objects.
3. For value types Equals is overridden and returns the comparison of values
4. Equals method can be override.
In below example we are overriding the Equals() method in Student class. Since we are overriding Equals() method and not overriding GetHashCode(). We should override both the methods to avoid unexpected result.
Two objects are equal if they have same hash value.
01using System;
02using System.Reflection;
03 
04namespace ConsoleApplication8
05{
06    class Program
07    {
08        static void Main(string[] args)
09        {
10 
11            Student s1 = new Student { RollNumber = "1", Name = "Scott" };
12            Student s2 = new Student { RollNumber = "1", Name = "Scott" };         
13            bool result = s1.Equals(s2);
14            Console.WriteLine(result);          
15            Console.ReadKey(true);
16 
17        }
18    }
19 
20    class Student
21    {
22        public string RollNumber { get; set; }
23        public string Name { get; set; }
24 
25        public override bool Equals(object obj)
26        {
27            //return base.Equals(obj);
28            if (obj == null)
29                return false;
30            return this.GetHashCode() == -obj.GetHashCode();
31 
32        }
33    }
34 
35}
clip_image011
Object.ReferenceEquals method
1. If two objects are same it returns true.
2. It is not virtual and cannot be overridden.
3. It compares identity of two objects.
01using System;
02using System.Reflection;
03 
04namespace ConsoleApplication8
05{
06    class Program
07    {
08        static void Main(string[] args)
09        {
10 
11            Student s1 = new Student { RollNumber = "1", Name = "Scott" };
12            Student s2 = new Student { RollNumber = "1", Name = "Scott" };
13            bool result = Student.ReferenceEquals(s1, s2);
14            Console.WriteLine(result);          
15            Console.ReadKey(true);
16 
17        }
18    }
19 
20    class Student
21    {
22        public string RollNumber { get; set; }
23        public string Name { get; set; }
24 
25    }
26 
27}





clip_image012Posted by ⋅ February 3, 2011 ⋅

Saturday, 21 January 2012

CSharp, Miscellaneous,Delegate to Lambda Expression



Delegate to Lambda Expression

Objective
This article will not give any theoretical definition of
1. Delegate Read theory of Delegate here
2. Anonymous method
3. Lambda Expression Read theory of Lambda expression here
I am going to give a story type discussion from Delegate to Lambda expression.
clip_image001
Let us say, there is a requirement that you need to pass one function as parameter of another function. This can be easily done through function pointer in language like C++ but in C#, we cannot pass a function.
There are two functions



    int Add(int number1, int number2)
        {
            return number1 + number2;
        }
     int Sub(int number1, int number2)
        {
            return number1 - number2;
        }
Now we need to pass the above function in other function called Display.
clip_image003
Sometime we need to pass add function or sometime we need to pass Sub function to display the result of the add or sub.
So here in our requirement we will have to pass something, which can represent both Add and Sub function.
If we notice, signature of both Add and Sub function is exactly the same. Both are returning an Integer parameter and taking as input two integer parameters.
So if we can have something which can represent Add and Sub function then we can pass that representation as parameter.
So here delegate comes into picture. We will pass delegate of Add and Sub function as parameter of Display function.
Now signature of Display function can be modified as
clip_image005
So now we have the task to create the delegate. We can say delegate is representation of function. While creating a delegate only one thing we need to keep in minds that, “Delegate can refer only those functions which are having exactly the same signature as of delegate “
So for our purpose we will have to declare a delegate with return type integer and taking two integer parameters.
clip_image007
In above delegate declaration
1. Integer is return type.
2. Name of the delegate is DelegateCal
3. There are two integer input parameter.
So, DelegateCal only can refer functions which are having integer return type and two integer parameters.
So now we can assign a function to delegate as below,
clip_image008
Here signature of Add and DelegateCal is same. Not a point here is that, you can assign function with different signature to delegate else you will be get a compile time error.
So, now Display function can be modified as
clip_image009
Now we are meeting our requirement and we can pass any function with the signature matching of the delegate to the display function.
Program.cs



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication18
{
    class Program
    {
        delegate int DelegateCal(int a , int b);
        static void Main(string[] args)
        {
            DelegateCal d = Add;
            display(d);
            Console.Read();
            d = Sub;
            display(d);
            Console.ReadKey(true);
        }
      static  void display(DelegateCal d)
        {
          int result = d(7,2);
          Console.WriteLine(result);
        }
      static int Add(int number1, int number2)
        {
            return number1 + number2;
        }
     static int Sub(int number1, int number2)
        {
            return number1 - number2;
        }
    }
}
Explanation
1. We have declared a delegate with signature, return type integer and two integer input parameters.
2. Created two functions Add and Sub. Both are taking two integer parameters and returning an integer.
3. Created a Display function which is taking delegate as parameter.
4. Assigning the function to the delegate.
5. Calling the display function.
Output
clip_image011
Anonymous method
Now let us say you need to create a function for multiply. Now we have an option that we can create a function for multiply [with signature same as delegate]
clip_image013
But, what if we don’t want to create a function rather we want the function at the run time or on the fly without any name. We can very much achieve that using anonymous method.
clip_image015
In above code,
1. d is the delegate.
2. delegate keyword is being used to create an anonymous method.
3. Anonymous method does not have any name
4. There are two input parameters for anonymous method.
5. d now can be passed as parameter to display function.
So from above code we can conclude that we have created a function without name (anonymous method) and assigned that to a delegate with the same signature.
So now rather than creating a function explicitly using anonymous method we are creating that on the fly or at the run time.
Program.cs



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication18
{
    class Program
    {
        delegate int DelegateCal(int a , int b);
        static void Main(string[] args)
        {
            DelegateCal d = Add;
            display(d);
            Console.Read();
            d = Sub;
            display(d);
            Console.ReadKey(true);
            d = delegate(int num1, int num2)
            {
                return num1 * num2;
            };
            display(d);
            Console.ReadKey(true);
        }
      static  void display(DelegateCal d)
        {
          int result = d(7,2);
          Console.WriteLine(result);
        }
      static int Add(int number1, int number2)
        {
            return number1 + number2;
        }
     static int Sub(int number1, int number2)
        {
            return number1 - number2;
        }
    }
}
Output
clip_image017
Lambda expression
If we see the anonymous method
1. We are using the keyword delegate.
2. We are explicitly giving the data type of input variables.
3. Readability is not very high.
Lambda expression allows us to write anonymous function in very concise way. Readability is high.
Lambda expression uses goes to operator.
So, if we modify the above anonymous method as below,
clip_image019
In above code we are directly in lining the code for division, rather than creating any function or anonymous method.
Program.cs



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication18
{
    class Program
    {
        delegate int DelegateCal(int a , int b);
        static void Main(string[] args)
        {
            DelegateCal d = Add;
            display(d);
            Console.Read();
            d = Sub;
            display(d);
            Console.ReadKey(true);
            d = delegate(int num1, int num2)
            {
                return num1 * num2;
            };
            display(d);
            Console.ReadKey(true);
            display((num1, num2) => { return num1 % num2; });
            Console.ReadKey(true);
        }
      static  void display(DelegateCal d)
        {
          int result = d(7,2);
          Console.WriteLine(result);
        }
      static int Add(int number1, int number2)
        {
            return number1 + number2;
        }
     static int Sub(int number1, int number2)
        {
            return number1 - number2;
        }
    }
}
Output
clip_image021