NCAA Basketball championship 2015 spreadsheet with odds

After finding some odds from KenPom here, I through them in a spreadsheet, added the Vegas odds as well as my own “Geiger Rankings™”

Geiger Rankings™ are other ranks weighted by the Vegas odds.  If you are in pools, this should really help give you some insight.

https://docs.google.com/spreadsheets/d/1FW-SAJugyNv5EjghK-dKHWVejxQxSuf_mu1fWTwWGkg/pubhtml?gid=301639732&single=true

How to kill a frozen linked sql server connection

So I recently setup a Linked Server in our SQL database that connects to some sort of version of IBM’s DB2.

I made the mistake of querying a ginormous table.  After 30 minutes or so, I cancelled the query.  The query wouldn’t cancel so I closed the window in SQL Server Management Studio (SSMS).  I opened a new window and proceeded to query again with an added where clause.  I repeated this a few times with more and more restrictive where clauses.  After a while I closed SSMS and reconnected from a different machine.  I checked the activity monitor in SQL and saw that I had 5 connections.  I proceeded to “Kill” all of them.

Then this happened.
image

All the processes where stuck in KILLED/ROLLBACK and had a wait of PREEMPTIVE_OLEDBOPS.

At this point most SQL experts will blindly give you the advice that you should just “Wait” until the rollback is complete.  However, this was a linked server.  I wasn’t doing anything but select data from it.  I waited an hour or 2 an still nothing.  I checked the rollback status of each connection and each was at 0%.  Also, the CPU was pegging on the database server.  What was I to do?

Well the solution for me was to download TCP View from Microsoft.
http://www.google.com/search?q=tcp+view&btnI

I opened TCP View up and found the connections that weren’t working.  I killed the first one and the rest just disappeared.  My CPU went from almost all down to 2%.  (Note: It gave me a different machine name in TCP View because the machine in question had multiple DNS names that went to the same IP Address)

An enterprise level database should not allow an unreturned linked server to compromise the entire server.  If you agree, write to them here.

https://connect.microsoft.com/SQLServer/feedback/details/187192/

Windows guy learns linux How to telnet/ssh

So far I have used the VirtualBox console to connect to my virtual machine running Linux (CentOS 7).  This is fine and good for one session, but if you want to run multiple terminals you have to install a Telnet/SSH client.

I will be using a client called “Putty” which is free and very widely used.  Download Putty.exe to your desktop.

Now we have Putty now but it’s useless until we make some changes on our local virtual machine.  (If you’ve installed Linux on a real physical machine or had Linux installed on a server VM then this next steps might not apply)

We need to know which IP address our Linux server is running on.  In your VM console run “#ifconfig”.  This is very similar to running ipconfig on Windows command line.  My results are below.

Linux IFConfig

Note, the IP address of the virtual machine is 10.0.2.15.  Now that we know that we go to VirtualBox, select the VM in question and click on Settings and then select “Network”.

Expand the “Advanced” tab if it is not already showing and click on “Port Forwarding”.

Virtual Box Linux SSH Port Setup

Here, click the +Plus sign and add a new rule.  It can be called whatever, I called mine SSH.  Add the line as shown.  If you have a different VM IP than 10.0.2.15 then you will want to use that.

Virtual Box Linux SSH Port Forward Setup

At this point you can run that Putty.exe that you downloaded earlier.  Enter 127.0.0.1 as your IP address and click “Open”.

Putty SSH Linux VirtualBox

At this point you should get a “login as:” prompt.  Enter your username and password and you should be connected.

Putty CentOS 7 VirtualBox

Now you can open up multiple terminal windows and run multiple programs at once.

If your terminal keeps timing out too early for you, you can change it so that it “stays alive” for a much longer time by doing something like this.

Open the sshd_config file.

# nano /etc/ssh/sshd_config

Add/change the following lines

ClientAliveInterval 30
TCPKeepAlive yes 
ClientAliveCountMax 99999

3/2/2015 Edit: Despite my changes, my terminal sessions were still getting disconnected.  For me the problem was with VirtualBox.  I had to download the beta version (4.3.23 r98674).  Then I could not launch any VMs because I would get a STATUS_OBJECT_NAME_NOT_FOUND error having to do with \Device\VBoxDrvStub.  I then uninstalled Windows Update KB3004394 and then reinstalled VirtualBox.  Now things seem better.  Hope that anybody having this problem finds this update helpful.

Windows guy learns linux centos network issues

So it was mandated by the “Linux Dudes” at work that they don’t really want Ubuntu installed in production.  RedHat is what they use.  The free version of RedHat is called CentOS.  CentOS is what I will be using going forward.  I don’t know enough to debate the pros and cons of one version of Linux over another but I am sure going to miss the nice graphic interface of Ubuntu.  For reflection, this is the CentOS interface.

CentOS Terminal

The first thing to note for CentOS other than the lack of graphical interface is that you manually have to setup a network adapter in the setup or it the OS won’t have any way of accessing the network/internet.

It was a super easy fix once I knew what I had left out.  Here’s some quick screenshots of how simple it is to install a network adapter in CentOS.

CentOS 7 Language Selection

CentOS 7 Add Network Adapter

CentOS 7 Enable Ethernet

CentOS 7 Network Connected

Windows guy learns linux hosts files

The hosts file is like a local DNS that takes priority over the real DNS.

The average person won’t understand what that means.  In other terms, the hosts file is a local map of “domain name” to an “IP address”.  For example, normally Google.com would resolve to something like 216.58.216.238.  If you go to http://216.58.216.238 you would see Google.  http://www.Google.com is the same as http://216.58.216.238

Now if you went into your host file and put an entry like…
    Google.com    204.79.197.200
Then Google would point to Bing instead.

If you set Google.com to point to 127.0.0.1 then in that case it would point to your local Apache server.

To create a map, we enter the URL and IP address in the hosts file that lives in the /etc directory.  (ie. /etc/hosts)

To modify the file we will use a text editor called nano.  It is much easier than some of the other options.   The hosts file is protected so we need to run as SUDO.  So get to a terminal (Ctrl+Alt+T in Ubuntu) and run the following command.

#sudo nano /etc/hosts

You then enter your root password and can then add the line.
    127.0.0.1 [TAB] Google.com

[TAB] is the tab key, not actually the word “[TAB]”

image

Hit Ctrl+O to save the file and then Ctrl+X to exit.

Now if you go to “http://google.com” (not http://www.google.com because we did not create an entry for that) you should see something like this…

image

Boom, all done.  Now you’re a hosts file expert.  Make sure to delete that line if you want to use Google again normally.

WINDOWS GUY take on LINUX webserver and mail server

Note: This article is using Ubuntu 14.04 but most will apply to other Linux versions.

So, we have learned how to install packages on Debian Linux and now want to configure mail and websites for this server.

Launch Terminal (Press Ctrl-Alt-T)

#sudo apt-get update
(This updates our local package list)

#sudo apt-get install lamp-server^
(This installs Apache, MySQL and PHP)
(Mind the caret (^) at the end.)

#sudo apt-get install mailutils
(This is for mailx)

#sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/default
(This copies the default Apache config file to a new file that will be used by Apache)

By running those 4 commands you have Apache, MySQL, PHP and Mailx installed.  To test apache you can open up your web browser and go to http://localhost to see this…
Ubuntu Apache Test

There are more things that go into setting up the mail server if you want to have it reside on the internet.  However if you are on a small work network, you can start sending test email immediately by running.

#mail –s “Some Subject” SomeWorkingEmail@Example.com

Some message…
Ctrl+D

Like this…
Test Linux mailx

If you try this above example on a home network, or if you aren’t setup to relay mail on your work network, this test won’t work.  There’s a lot more to setting up email but this is the most basic of installs.

windows guy take on linux root user and packages

Note: This post mentions Ubuntu root access but most of it is about Linux in general.

Linux and Windows differ when it comes to login accounts that have full access to the system.  In Windows,  when you add a user to the local “Administrators” group, that user has complete access to all files and settings.  For good or bad.  Linux doesn’t really do it that way.

In Linux there is a “Root” user.  This root user has full access to everything.  However, every Linux admin will yell that you shouldn’t log into a computer as “Root”.   Instead you login as your self, then run a program called “sudo”.  Sudo runs the next command as root.   If I run..
#sudo ls
I will first get a prompt for “Root” password.  I type that, hit enter and then ls runs.

image

Tangent: In Linux you run “Terminal” in Windows you run “Command” or “Command Line”.  Terminal command start with a pound sign, ie “#”.  So if you see… #sudo blahblahblah it means run “sudo blahblahblah” from the terminal/command line.

The next thing to note is that there are “packages” for a type of Linux called “Debian”.  Everything that gets installed in a “Debian Linux” is a package.  Ubuntu is built on top of Debian so software in Ubuntu is installed from packages.

Q: How do you install packages on Debian Linux?
A: You use APT (Advanced Package Tool)

APT, in simplest terms, lets you install, remove and update packages.

ex.
#sudo apt-get update

The above command runs “apt-get update” with “root” rights.
“apt-get update” downloads a list of all packages and updates the local lists.  So when you want to know what new packages are available or if there are updates to your existing packages, just run sudo apt-get update.

More examples of how to install packages to follow.

windows guy initial take on ubuntu

Ubuntu was super easy to install.  It was all graphical.  It had very little options and networking worked right out of the box.  I was impressed that Firefox even worked because I installed Ubuntu in VirtualBox at work which is behind a proxy server.  The only problem was this…

SNAGHTML8cf022d0

No, I did not shrink the image.  That is the only screen resolution available to me.  I had to do some searching to find out how to change that.  Here are the 2 options of changing adding more resolutions to Ubuntu on VirtualBox. 

Note: To “Search” you simply press the “Windows” key on your keyboard then start typing.

Add More Resolutions to Ubuntu on VirtualBox

Search and run “xdiagnose”
Enable
- Extra Graphics Debug Messages
- Display boot messages
- Enable automatic crash bug reporting
- Restart

or..
Search and run Software & Updates
Click “Additional Drivers” tab
Select “Using x86 virtualization solution…”
Apply Changes

I did “both” of the above options.  According the my searches either would have worked.  Regardless I now have more resolutions to play with.

It is worth noting that Linux guys and Windows guys have a point of contention with issues like this.  Windows guys want this “Basic” stuff just to work right out of the box.  Linux guys don’t seem to mind searching for the answers for a few minutes.  It’s interesting to note, that while this is a minor issue, it is very disheartening to Windows people.  This is probably because there’s so much “good stuff” to learn in Linux that they give up when walls are thrown up at them even before they get into the real guts.

windows guy Learns Linux

The last time I really played around with Linux was back in college.  I wasn’t remotely dangerous with it.  Fast forward to present day where I have a new obsession with getting Request Tracker up and running.

The internet community believes that Request Tracker (or RT) is the hands down best issue tracking system for the money.  (It is free)  However RT runs only on Linux and Perl.  If it was Linux and PHP or Windows and Perl then I probably wouldn’t feel the need to learn Linux.  Unfortunately for me that is not the case and I am going to have to beat-up my brain cells and come to terms with figuring out how to get things done in Linux. 

There’s going to be back tracking, skipping around and general “whining”, but this is going to serve me well in learning the overall process.

Going forward, the only thing that might stay the same is my use of VirtualBox (running on Windows) to host things.   Virtual box is free software that lets you run virtual computers called Virtual Machines or VM’s on your computer.  It’s like having one or more computers running inside your computer.

I probably won’t get into describing how to create VM’s or download (or install) Linux from ISO’s.   This will be more about figuring out how to do “Setup” after Linux is installed.

Cheers!

Geiger, you don't know me! (Yet)

Web Analytics