Setting Up Your Turntable For Audio Pleasure

This one is actually a special request because I have got this question by multiple people. For some reason, it seems like record players are making a comeback? I have no problem with this, but it is just be a bit surprising.

Regardless, there’s a lot of amateurs out there who have never had experience with RCA outputs and such so I`m going to try and make this process very simple.

Step 1: Grab a phono preamp

If you do not have a good phono preamp or it’s not built in to your current record player, you will not get it to work. A preamp is how sound transfers from the speaker to your turntable, put very simply. If you don’t have one, go buy one now.

Step 2: Connecting the Cables Together

This step is pretty simple but I can see why it would be confusing. Here is a very detailed breakdown of what you need to do.

RCA Output cable from your record player —> Phono preamp RCA input —> Phono preamp RCA output —> Your speaker system.

That is basically the gist of it. Make sure you have the proper cables if they do not come with any of your purchases. That is the RCA cables of course.

Thats it. Enjoy an audiophile listening experience.

Building Ruby Gems Cheat Sheet

Here are some quick commands for building and installing ruby gems locally. This is just for reference; I’ve been meaning to make more of these kinds of posts.

Bump the Gem Version

To bump to version 1.0:

echo "1.0" > VERSION

Generate the Gemspec

rake gemspec

Build the Gem

gem build ./hello_world.gemspec

Install the Gem

gem install ./hello_world.gem

Setting a Default Upstream Branch in Git

So you’re working in a branch in your Git repository, and you’ve just made some changes. You just ran git commit and now you want to merge any changes from upstream. So you issue a git pull and BAM!, you see this error:

# git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.xyzbranch.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull  ').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:
    [branch "xyzbranch"]
    remote = 
    merge = 

    [remote ""]
    url = 
    fetch = 

See git-config(1) for details.

So what gives? Why doesn’t git know what you’re trying to do?

Where is My Upstream Branch?

The problem is git has no idea which branch you want to pull from or push to. Chances are you made this branch like this:

# git branch xyzbranch

That creates a new branch in your git repository, but it’s not set up to track any remote (upstream) branches. You can use git remote show origin to see where your branches are pushing and pulling if you’d like to verify that.

# git remote show origin
* remote origin
  Fetch URL: git@hostname:repository.git
  Push  URL: git@hostname:repository.git
  HEAD branch: master
  Remote branches:
    another_branch    tracked
    master            tracked
    some_other_branch tracked
  Local branches configured for 'git pull':
    another_branch    merges with remote another_branch
    some_other_branch merges with remote some_other_branch
  Local refs configured for 'git push':
    another_branch    pushes to another_branch (fast-forwardable)
    master            pushes to master (up to date)
    some_other_branch pushes to some_other_branch (up to date)

So there is no upstream branch set for xyzbranch! That’s not really a problem, it just means you have to tell git where to pull changes from and where to push them to every time you use git pull and git push. But that’s annoying, so how do we fix it and set a default remote branch?

Setting Your Upstream Branch

If you’re on a branch called xyzbranch and you want to track the master branch, you could use git branch –set-upstream to do that like this:

# git fetch origin
# git branch --set-upstream xyzbranch origin/master
Branch xyzbranch set up to track remote branch master from origin.

And suddenly, voila!

# git pull
Already up-to-date.

No more complaining from git!

For more tips and tricks on Git, check out GitReady.com.

Git it done!

How to Install the Service Trace Viewer Tool (SvcTraceViewer.exe) to View *.svclog Files

I work with WCF services day to day, so sometimes I need to check the service logs to debug an issue or provide a stack trace for a bug report. To view *.svclog files, you need to install the Service Trace Viewer Tool from Microsoft.

Installing the Service Trace Viewer Tool

1) Go to the Windows SDK page and click Install Now
2) On the next page click Download and then run the web installer (winsdk_web.exe)
3) The default installation will install a lot of development tools, including the Service Trace Viewer Tool. But if you’re a minimalist and you’re just looking for the Service Trace Viewer Tool, just install the .NET Development Tools.

My machine required those additional reference assemblies, but your mileage may vary depending on what you’ve already installed.

Good luck debugging!

Installing build-essentials in CentOS (make, gcc, gdb)

Once upon a time I was a very avid desktop user of Ubuntu Linux. As a software developer, I would usually need the standard build tools installed on my machine.

Installing build tools in Debian/Ubuntu

In Debian/Ubuntu, you can install the typical build tools by installing the package build-essentials, which is just a pseudo-package that downloads all the popular development packages:

# apt-get install build-essentials

Installing build tools in CentOS

Since I prefer CentOS as my server platform, I also occasionally need to install packages using yum.

To install the common build tools using yum in CentOS you’ll want to install the group package “Development Tools”, which is similar to build-essentials in Debian/Ubuntu flavors of linux. You’ll probably also want to install kernel-devel and kernel-headers if they’re not already installed:

# yum groupinstall "Development Tools"
# yum install kernel-devel kernel-headers

This should give you a copy of make, gcc, gdb, and all those other tools you were looking for.

How to Fix a Broken Steam Game

There are all sorts of reasons a Steam game might not work after you’ve downloaded it. On this page I’ll try to compile a list of things I’ve had to do in the past to get a Steam game to work properly. This list is not intended to be specific to any single game; it’s just a collection of useful tips to try if you’re stuck with a broken Steam game.

Verify the Game Cache Files

The first thing you should do is verify the game cache files because if there was a problem downloading the game or updating the game it may cause nasty gameplay problems. You shouldn’t rule this out even if there have been no recent updates because a file could easily become corrupt during gameplay or due to other running programs on your computer (such as antivirus). It’s easy to verify the game cache; just follow these steps:

Go to your Library, right-click the game, and click Properties

Click Local Files, then click Verify Integrity of Game Cache

This could take a while.. make yourself a sammich (or ask your girlfriend!)

I promise it will finish eventually..

It’s done! Try the game again!

Download Windows Live ID Sign-in Assistant

Some games require Windows Live and if you haven’t downloaded it or you have disabled it the game may crash or refuse to start at all. If you haven’t downloaded Windows Live, go download it and see if the game still crashes after it’s been installed.

Try the tips at the Steam Support Troubleshooting Page

Steam Support has a good guide for general troubleshooting, including lots of links to update Windows, Direct X, and drivers for your graphics card.

Game on!

How to Fix the Android NetworkOnMainThreadException

If you’re trying to communicate with a web service or scrape any data from the web in your Android application, you might run into an exception like this:

E/AndroidRuntime(673): java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.example.helloandroid/com.example.helloandroid.HelloAndroidActivity}: android.os.NetworkOnMainThreadException

From Google’s documentation:

The exception that is thrown when an application attempts to perform a networking operation on its main thread.

This is only thrown for applications targeting the Honeycomb SDK or higher. Applications targeting earlier SDK versions are allowed to do networking on their main event loop threads, but it’s heavily discouraged.

The fix

The problem here is simply that you need to make your web service calls (or what-have-you) on a separate thread. So, quite simply, you’ll need to look into how to do threading with Android. Unfortunately this can be a bit of a pain because you need to make your service calls on a separate thread, but you need to update the UI on the main thread. Normally this would require passing data between the threads, which involves handlers or other complexities. Luckily the Android platform provides the Async Task to handle this, which alleviates some of this complexity and may help you avoid some clutter in your code.

The difference between ‘rpm -Uvh’ and ‘rpm -ivh’ (or how to install packages in RHEL, CentOS or Fedora)

When installing packages in RHEL, CentOS, or Fedora, chances are you use yum, the default package manager. But what if you want to download a package not provided in a repository? Or what if you just want to upgrade a package to the latest version and your repositories haven’t upgraded it yet?

Most users know that to install a package from an RPM, you simply use the rpm command. But a bit of perusing on the internet will show that people use various flags when installing packages:

  • rpm -i
  • rpm -ivh
  • rpm -U
  • rpm -Uvh

In this post we’ll examine the difference and whether or not you should care.

The simple truth is that the only flags that are truly important to most users are -i and -U.

Using -i

When using -i you tell the rpm package manager to install the package. For example to install htop version 0.8.3:

# rpm -i htop-0.8.3-1.el5.rf.x86_64.rpm

This command only installs htop version 0.8.3. It does not care if you have other versions of htop installed. If you do not have any other versions of htop installed this is probably the correct command to use. If you do have other versions of htop installed, this is probably NOT what you want to do.

Using -U

When using -U you tell the rpm package manager to upgrade the package. For example to upgrade htop to version 0.9:

# rpm -U htop-0.9-1.el5.rf.x86_64.rpm

This command not only installs htop version 0.9, but also removes any other versions of htop that are installed. The great thing about using -U is that even if you don’t have other versions of the software installed, it will still install the version you requested. In this way you can think of -U as a more careful version of -i. In nearly every practical case you want to use -U!

But what about -v and -h?

The -v and -h flags are just to print more verbose information regarding the installation or upgrade. These are optional, but useful parameters. Below is the information from the man page:

-v Print verbose information - normally routine progress messages will be displayed.
-h, --hash Print 50 hash marks as the package archive is unpacked. Use with -v|--verbose for a nicer display.

How can I learn more about rpm?

If you want to learn how to use other features of rpm, I would suggest using the man page by typing this at terminal:

# man rpm

Man pages aren’t nearly as scary as people make them out to be. They provide plenty of helpful information and they’re always the first place to turn when looking for help with a command.

In conclusion, any good admin should understand every command he or she uses at least in some detail. But for the common case, rpm -U or rpm -Uvh should serve you well.

Copyright Tech 2016