How to restart services on Linux box you’re not familiar with?

One of the things that I inevitably run into when my group takes over some servers from another company or department and we haven’t set them up ourselves, is where everything is and how to start and restart services. One trick that I use a lot is to do a “history” and pipe it to grep.

If I know the server runs Apache but I’m not sure how they’re restarting it, you can usually do this to see:

Or to be super-pedantic, a case-insensitive grep:

The results actually tell me a lot about the system without having to dig around very far:

You can replace “apache” with whatever service you’re looking for.

Happy history grepping!

Continue reading

How to map the ESC key on a Macbook Pro to be a VIM warrior

My old Mac died and I needed to get the new Macbook Pro with the touch bar. The touch bar is useless for a developer, just absolutely useless. The first time I went into VIM I felt the pain. No hardware ESCAPE key!

There’s lots of tutorials out there to remap your ESC key to your Caps Lock. The steps that worked best for me are below:

  1. Open System Preferences → Keyboard.
  2. Click the Modifier Keys button in the bottom right-hand corner.
  3. If USB devices are attached, you will need to “Select Keyboard” at the top and choose “Apple Internal Keyboard/Trackpad”
  4. Click the drop down box next to the hardware key that you’d like to remap, and select Escape.
  5. Click OK and close System Preferences.

Some steps pulled from the article No hardware Escape key on new MacBook Pros? Don’t fret, macOS Sierra lets you remap the Escape action to a modifier key

Continue reading

How to get the Minecraft Aquatic Update for Windows 7, 8 and Mac

If your kids haven’t already bugged you about it, the Minecraft Aquatic update has been released on some platforms. However, its still in beta on the Java platform for Mac and Windows. Here’s how to run the Minecraft beta (including the Aquatic update) on Windows 7,8 and Mac:

In the Java Edition, we put out regular test versions known as Snapshots: just go to the Launch Options tab, enable Snapshots, and then select the latest snapshot by clicking the arrow next to the Play button on the main tab.

Here’s info on how to get the Minecraft betas on all different systems.

Anything with a 1.13 release number should get you the Aquatic update.

Once in, create a world with 111 as the seed under “more options.”

Then when spawned in the world, go find an ocean. One should be close to you. Get a turtle shell so you can breathe underwater. And put some dolphin, turtle and tropical fish eggs in your inventory. Then you can spawn any of these creatures that you want in the water. Actually, it’s fun to spawn them on land too.

Enjoy!

Continue reading

How to search and replace text in Vim

Here’s how to search and replace in vim (also known as “substituting” text).

Let’s say I want to replace the text “this” with the text “that”.  In vim, we can do:

This is saying, from line 1, to the end of the file (represented by $), replace “this” with “that”.  The “g” on the end is to do this multiple times on one line of text if applicable.
So you can mix this up and do it from line 1 to line 10:

Or from line 100 to the end:

Or only the first instance on each line (remove the “g”)

There you go.  Happy Vim substituting!
Continue reading

Error renaming database in SQL Server 2008

I right clicked on a database in SQL Server Management Studio and selected rename. Gave it a new name and hit enter. Eventually this error comes back:

The database could not be exclusively locked to perform the operation.

The better way to rename the database is using SQL running these queries:

Continue reading

How to check MD5 hash values for a file with a Microsoft tool

We have a lot of download sites blocked at work, so I’m not always able to just go and grab a utility when I need it. But I usually have access to all the Microsoft sites.  I needed to calculate some MD5 sums for a file on a Windows machine. You can do this with the Microsoft File Checksum Integrity Verifier or FCIV. The current version is from 8/22/2012.

The download is a zipfile that you can extract and it produces a .exe file and a readme. I put small utilities like this into a directory on my machine that’s easy to get to like c:\tools

Once you have the exe, you can follow the instructions of “How to compute the MD5 of SHA1 hash values for a file” or just use this:

Happy MD5 summing!

Continue reading

How to set an Orchard CMS module to be home page with code

This will work for Orchard CMS Version 1.8.

  • Create a new module
  • Create a Routes.cs file in the module
  • Set the RouteDescriptor priority to something high like 99
  • Set the new route url to be an empty string

Here’s some example code for Routes.cs

Continue reading

TL-WA850RE has no internet access

TL;DR – Get the firmware update for the TL-WA850RE at http://www.tp-link.us/support/download/?model=TL-WA850RE&version=V1, unzip it and run the update from within the TPLink setup page.  This solves most problems.  The other handy thing is to change the SSID of this range extender by adding a “2” to the name of your original SSID.

I’ve got a TV that’s just out of range from my wifi router.  Yes, I know, I should get off my lazy butt and just run cat6 thru my whole place.  But in the meantime, I purchased a TP-LINK TL-WA850RE 300Mbps Universal Wi-Fi Range Extender.

I plugged it in and did a manual setup.  I could get devices to connect to it but it took a long time.  Once connected, each device had no internet access whatsoever.  Bummer.  I tried some different configurations of it but the thing that worked the best was just going to the TPLink download site and grabbing the latest firmware.  The firmware on my newly purchased device was like 2 years old.  I’m not sure why they ship it like that.

Once I updated to the latest firmware in the web-based tool for the TPLINK, it still didn’t work as smoothly as I would have liked.  The final two settings I did were under “DHCP” where I set a static IP to be one IP up from my wifi router.  I also tweaked the SSID put out from the TPLINK to have a “2” at the end of my original wifi SSID.

Once I did those three things, the wifi range extender worked to perfection.  I have a great fast signal far away from the wifi router.  It’s fast enough to stream Netflix adequately.

Continue reading