How to fix Chrome on Windows sitting at "resolving host" for a long time on each page load

This issue was annoying me increasingly over the last few days. After googling around for a bit, I eventually found an answer that worked for me. Only step 4 is likely to be strictly necessary, but I did a bit of prep just to be sure I didn't break anything.

  1. Disabled my Internet adapter in the "Network and Sharing Center" under "Change adapter settings".
  2. Turned off my VPN program. (Most users won't have this).
  3. Ran "cmd" as administrator. You can do this by hitting the Windows key, typing "cmd" and then right-clicking on the "Command Prompt" search result and then click "Run as administrator".
  4. Inside the Command prompt, ran this command:

    netsh interface ip delete destinationcache

  5. Turned my Internet adapter back on.
  6. Turned my VPN back on.
  7. Google Chrome is now fast again.

Update:

After a bit more investigation I realized that the problem was not solved. The fix that worked was using Google's public DNS servers (8.8.8.8 and 8.8.4.4) rather than the server that my network adapters were configured to use (probably related to my VPN). I made this update in the "Change adapter settings" view described above for each of my two network adapters. In each case, I clicked on the IPv4 settings and clicked "Properties". I then entered the above ip addresses as the DNS servers that I wanted to use. After this change, everything is back to full speed.

Turn off touchpad while typing on Linux

I installed Linux Mint 16 a few days ago on my Netbook. The touchpad didn't turn off while I was typing, so I dug around for a way to make it do so.

It turns out you can enable this feature on the "Mouse and Touchpad" configuration app (just search for that string among your applications) on the Touchpad tab. However, this default setting didn't work for me, because it turned off the touchpad for two seconds every time I typed something. For me, that was way too long.

(Note, in the following setup, I set my delay to 0.25 seconds. Feel free to change the 0.25 in the command in step 5 to whatever you want.)

Thus, it was a more manual configuration for me. Here goes:

  1. Run "Session and Startup". Again, you can just search for this from the "Start Menu" for Linux Mint.
  2. Go to the tab "Application Autostart".
  3. Click "Add"
  4. Type a name like "Synaptic Daemon", add in some comments about what you are doing in the description field, like: "Turn of touchpad while typing"
  5. In the command window, put:

    syndaemon -d -i 0.25 -K -R

  6. Click OK
  7. Make sure that the entry you just created has a little "x" in the box to the left of it.
  8. Click close.
  9. Restart your system.

Now your touchpad should not accept input while you are typing. Almost immediately after you stop typing, it should again respond to your movements.

Changing the order of entries in Grub 2 bootloader

A while back I had to solve the problem of removing an operating system entry from the Grub 2 bootloader.

Today I solved a related problem: changing the order in which the OS entries appear on the boot menu. It seems there are several solutions to this problem. The one I will show here was the most effective for me because I have already used the approach in the link above to remove an OS from Grub 2.

Here's how you do it:

  1. Log in as root, or execute the following mv commands using "su" before your commands.

    sudo su

  2. Go to the "/etc/grub.d" directory.

    $ cd /etc/grub.d

  3. Look at the directory:

    $ ls

  4. Which will give you a result that look something like this (numbers and names may vary).

    00_header 10_linux 30_os-prober 41_custom
    05_debian_theme 20_linux_xen 40_custom README

  5. Basically, the order of these numbers dictate what the order will be on the Grub menu. You can rename these files to change the order. In my case, I wanted to make one of my "custom" entries the first entry (because it was my Windows 7 partition).

    $ mv 10_linux 15_linux
    $ mv 40_custom 10_custom

  6. Now I just re-run update-grub to re-generate the boot menu table.

    $ update-grub

  7. We can check that things are ok by looking through the generated file. In my case, I checked that my Windows 7 entry was present in the file. Interpreting this file deeply requires a lot of knowledge, so don't worry if it is mostly gibberish.

    $ vi /boot/grub/grub.cfg

  8. Restart your computer to see the new boot menu order.

Dual wielding laptops

My poor netbook (Samsung NF210, which you might remember from my issue with the Grub 2 menu) has been dying under the weight of Matlab, LabView, and all the other normal programs that I run on a constant basis such as Acrobat Reader, TeXnicCenter, and Chrome.

I have had to pull my old laptop (Acer Aspire 5670) out of retirement. After a couple hours of setup, I had two laptops set up on my desk. This is when I found out that I am not an embarrassingly parallel procedure. By effectively doubling the number of processors that I was running on, my productivity went up about 50%.

The key to all of this has actually turned out to be a piece of software that I admit I turned my nose up to a bit when I first saw it...

Dropbox

I installed Dropbox on both laptops and told them to sync my folder full of work files. A couple minutes later everything was mirrored on both computers as well as on the online system.

Since I have wireless Internet on both laptops, they can both connect instantaneously the the online Dropbox repository and sync files with one another. The total lag time from when I save a file on one to when it shows up on the other is on the order of mere seconds.

This allows me to work on highly technical material on one computer, and be completely confident that all of my progress is saved elsewhere. Additionally, it gives me great mobility and freedom of mind.

I admit, I should probably be a poster child for Dropbox at this point.

Care about your files? Not too worried about putting them in the cloud? Try Dropbox. It impressed me.

Matlab Fast-Fourier Transform (FFT)

I have spent a lot of time in the last couple weeks fighting to discern some meaning from the results of some Fourier transforms I was doing. During this time I ran across some very helpful resources.

First and foremost among them is this excellent FFT tutorial for Matlab over at blinkdagger. I found this code and explanation to be very useful.

I still had a lot of learning to do however, especially about the correct frequency axis for my data. The simplest way to understand it (as far as I know) is this:

If you run an FFT on 9000 real-valued data points, then it will return an array of 9000 complex values. If you plot the complex modulus (absolute value, or abs(data) function in Matlab), then you will see that the magnitude of the data is symmetric. That is, the first 4500 points are the same as the last 4500 points. In fact there is an interchange of complex and real parts of the symmetric data, but we won't get into that here.

The important part for me was to realize that if I look at only the first 4500 points, then point number 1 represents the lowest frequency component in the signal that can be detected. The 4500th point is the highest-frequency point that can be detected. What frequency is this point?

It is the Nyquist frequency, equal to half of the sampling rate. The maximum frequency that we can extract from the data is half the sampling frequency. Therefore if your data was taken at a rate of six per second (6 Hertz, or one every 0.166667 seconds), then the Nyquist frequency would be 3 Hertz.

This allows you to create a meaningful frequency axis for your Fourier-transformed data. The highest point is the Nyquist frequency, and the lowest point would be equal to the Nyquist frequency divided by the number of data points. In my above example, that would be 3 Hertz / 4500 data points = 0.00066666 Hertz.

As simple as this sounds, it did take me a little while to figure out.

Secondly, in case anyone is taking the FFT of real-world data, it is very likely that you will have to view it on a log-log axis in order to get anything meaningful out of looking at it. Much of the useful information to humans is often clustered around the low-frequency end. Viewing the data in log-log is very helpful for this. Also, this view can help you identify intensity dropoffs with increasing frequency. Some common ones are 1/f and 1/f^2.

To view in log-log, the matlab command is:

loglog(xAxisData,yAxisData);

If there are no other figures created, this will create a figure with your plot in it.

Manually removing an OS from Grub 2 bootloader in Ubuntu 11.10

This post is here partially because I have had to go through this action several times in the last few months.

I recently bought a Samsung NF-210 Netbook and I have been fighting with setting it up since then. The netbook comes preloaded with Windows 7 Starter. I added in Ubuntu as a dual-boot option. I started with Ubuntu 10.10, but that proved to be difficult to use because it did not correctly handle the function keys for changing brightness or volume.

This same solution worked on Ubuntu 10.10 as 11.10.

My goal is to remove the Windows Recovery Environment from the automatic listing on the grub boot menu. This is more than just a cosmetic change because if you accidentally run this partition, it will fubar your boot partition causing you to lose the ability to boot using grub. Thus you will have to reinstall grub or possibly an entire OS (either linux or windows) depending on how you have set up your hard drive.

  1. Fire up a terminal, switch to root via "sudo su".
  2. "cd /etc/grub.d" - changing to the directory where we do most of the work.
  3. "chmod -x 30_os-prober" - turning off the automated ability of grub to find new non-linux OSes.
  4. "vi /boot/grub/grub.cfg" - going to see the current profile of OSes detected on the computer.
  5. Scroll down until you spot the entries for your windows partitions. Select the one(s) that you do want to show up on the menu. Copy them to the clipboard. Copy this text to somewhere so that you can paste it into the next file...
  6. "vi 40_custom" - This custom file lets you add your own OS profiles to the grub menu.
  7. Paste in the text that you copied earlier (below the comments).
  8. "chmod +x 40_custom" - The file needs to be executable in order to be included in the grub menu.
  9. "update-grub" - Grub needs to re-create its menu.

Now when you reboot you should see that only the OSes that you selected and moved will show up. In my case I moved my Windows 7 profile, but not the Recovery Environment profile. Thus when I boot I see all of my menu items except the recovery profile. Yey!

LaTeX on Ubuntu 10.10

When working in LaTeX on Ubuntu in the past, I was reasonably impressed with the development environment called "kile".

To install it, I fired up the System->Synaptic Package Manager and searched for "kile". I marked it for installation and applied the changes.

After several minutes, it had downloaded and installed itself. I then right-clicked on my menu bar in a blank area. A small menu popped up, I clicked "Add to Panel". A dialog pops up. I clicked "Custom Application Launcher". Another dialog shows up. In both the name and command fields I typed "kile". As soon as I completed typing it in the command textbox, the icon visible on the left side of the dialog changed to the kile icon. I hit OK.

Now I have a Kile button on my main menu bar. I fired it up.

At the top of the screen is had a button that said "ViewHTML". I want to be working with PDFs not, HTML. So I clicked the little down arrow to the right of the button. A menu popped up. I selected "ViewPDF" from the menu.

This is when I found out that I do not have "okular" installed. It is a viewer that kile integrates well with. I go into Synaptic Package Manager again and search for "okular". I download and install it.

Now when I load up a .tex file, such as my blank tex that I created, I can click "PDFLatex" to build the tex into a pdf. Then I can click ViewPDF to view it.

Working with LaTeX on Windows 7

I just had some trouble setting up LaTeX on Windows 7. I think I had some of these issues in the past however when I performed this installation years ago. The following steps are in some ways more of a guide for myself in the future than anything. Obviously I am putting it online in the hopes that someone else may find it useful as well.

Installation

MiKTex

Download and install MiKTex. There are some options on how to do this. What I did was select the "MiKTeX 2.9 Net Installer". I had to download a file called "setup-2.9.3959.exe" which I then had to run twice. Why did I have to run it twice? Because it would only do one of two things: 1) Download the MikTex distribution onto my hard drive (compressed) or 2) install the distribution FROM a place on the hard drive.

So I had to run the setup executable once to download the distribution, and once to install it.

Important Note: When the setup asks you something like: "You can choose whether missing packages are to be installed on-the-fly: " answer "Yes". If you don't answer yes, it can create problems with integration with TeXnicCenter.

Adobe Acrobat Reader

If you don't already have it, you can get it at the reader homepage.

Ghostscript and GSview

If you want to be able to use .ps files. Download Ghostscript, and GSview. Install Ghostscript by running the executable, then do the same with GSview.

TeXnicCenter

You can download this piece of software at the TeXnicCenter homepage. I didn't have any troubles with the installation until...

When you launch TeXnicCenter for the first time, it will ask you for the location of your LaTeX files. In the case of MikTex, I found them in C:\Program Files\MiKTex 2.9\miktex\bin

You may also need to know the location of your .ps file viewer. Since I installed Ghostscript and GSview as described above, my .ps viewer was in C:\Program Files\Ghostgum\gsview\gsview32.exe

There, now you should be able to load up a .tex file in TeXnicCenter and build it and view it.

Testing Adsense

Here is some text relating to physics. The purposes of this page is to test the physics relevance of the adsense units that will be placed here. Condensed matter is the subject of my masters degree. I am also interested in many other areas of physics even though they are not my areas of current specialization.

Let's see how well targeted this physics ad will be, or even if there are any physics related ads to show.