Saturday, November 12, 2016

"Could not activate cellular data network” Fix for iPhone with IIT Ropar WiFi enabled!

If you are using your iPhone to access IIT-Campus wifi, and you get an error whenever you access 3G or 4G data network, the problem is the IIT Ropar network profile, which you need to install on your iPhone to access Internet.

Fix

  1. Go to "Settings" and the "General"
  2. Select "VPN" and look for "Profiles"
    • If you find IIT-Ropar profile, delete it (and all other profiles for that matter)
  • If 2 din't work, look for "Profiles" option just below "VPN"
    • If you find IIT-Ropar profile, delete it
  • Restart your phone and data network should work.
  • You can now re-install IIT Ropar profile
The problems occurs because of the stupid, unnecessary, useless, annoying apple updates which keep poking you until you install them. 

Sunday, August 7, 2016

Makefile : *** missing separator

This error comes when you do not add a "tab" before the command, just below the "target:dependencies" line, i.e.

main.o: main.cpp
[\tab] g++ -c main.cpp

A missing tab would cause this error. 

Sunday, July 31, 2016

C++: what is the difference between passing a reference and passing a pointer to a function?

Both are same in the kind of functionality they provide, they allow you to modify a variable of calling function.

Pointers store variable location and need special operators to access the content. References, on the other hand, also point to the same location but with a symbolic variable ('alias' of the original symbolic variable).

When we call a function with the original variable, a new copy of the variable is created and passed to the function. The references are introduced exactly to bypass the copy stage and pass the symbolic variable directly to the function.


The reason for the existence of references is that they are slightly more user friendly than the pointers. We can have normal expressions (without '*') and yet have pointer functionality.

References are even used when we do not want pointer functionality, i.e., we do not want to to change the variable in the called function. This is done by declaring the reference variable 'const'. The advantage is to avoid copy of the large objects.  

Thursday, July 28, 2016

While delivering presentation: how do I look at Notes?

Answer: Look at your notes in a deliberate manner and let the students know that you are consulting them.

After you finish a slide, look at your notes in a deliberate manner, don't glance surreptitiously at the notes as if you're trying to make it seem that you're not looking at or consulting notes.

It may seem long to you, but student's do not mind it. In fact, they get a breather to grasp the things explained at the previous slide.

Friday, July 15, 2016

Algorithm Analysis: How to calculate coefficients of asymptotic notation?


An algorithm with running time $f(n)$ is said to be $\theta(g(n))$ if the following holds:

$c_1g(n) \leq f(n) \leq c_2g(n)$ for all $n>n_0$ and some value of $c_1$ and $c_2$.

For example, $f(n)=\frac{n^2}{2}-3n$ is $\theta(n^n)$.

To prove this, we need to find at least one set of values for $n_0, c_1$ and $c_2$ that satisfies above inequality. Below is a simple procedure to do that:
  1. To calculate $c_1$, obtain a value of n for which $f(n)$ is positive and solve left side inequality with that value of $n$.
    • $n_0=7$ and $c_1\leq1/14$
  2.  To calculate $c_2$, just put $n=1$ and solve the right side inequality.
    • $n_0=1$ and $c_2=1/2$
The basic idea is to make sure that $c_1$ and $c_2$ are positive.




How to add LaTex (math symbols) on blogger.com?

To write equations on blogger.com using LaTex, you need to add a java script to the template. Follow the steps below to add the script.
  1. Click on the Blog (not Post) you want to add equations to.
  2. Find "Template" on right side panel and click it.
  3. Click on "Edit HTML".
  4. Search for <head> and paste the following text just below <head>:
  5. Save it and add latex math code in-between two dollar signs ($\$$latex$\$$) as follows:
    • Einstein's most famous equation is $\$E=mc^2\$$
  6. It will appear as: 
    • Einstein's most famous equation is $E=mc^2$