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 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

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

WordPress 3.9 – PHP Fatal error: Allowed memory size of XXX bytes exhausted

More WordPress 3.9 system administration issues.  Kept getting errors from WordPress once a couple of plugins were installed that looked like this:

PHP Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 30720 bytes) in /var/www/wp-content/themes/x/framework/functions/global/admin/sidebars.php on line 166

According to Editing wp-config, the minimum memory required for WordPress 3.9 is 64mb.  You can do this by editing the php.ini file and increasing:

And then restarting Apache or Nginx.  Enjoy!

 

Continue reading

WordPress 3.9 Update plugin shows FTP connection screen

While working on a new wordpress install for a person in my group, I came across a problem when trying to upgrade plugins from within wordpress itself.  It kept showing an “FTP connection” screen.  Putting in valid ftp credentials for that server would fail with “Unable to connect” errors.  WTF?

It turns out there’s a magical wordpress config setting that you can add to wp-config.php:

This forces wordpress to use another method of updating plugins besides FTP ( I don’t really know what method it uses at this point, should research that.)

Continue reading

How to define an application pool user for your website directory in IIS

I wind up needing this like once a month and can never remember. Here’s how:

And here’s the relevant stackoverflow pages for more information:

http://stackoverflow.com/questions/7334216/iis7-permissions-overview-applicationpoolidentity

http://serverfault.com/questions/81165/how-to-assign-permissions-to-applicationpoolidentity-account

Continue reading

tail -f equivalent on Windows

As a longtime Linux guy, I always find myself looking for similar equivalents in the Windows space when I’m doing work over there. I tend to look a lot at the end of log files from my applications to see what’s happening. In Linux you can do something like:

This shows you the last few lines of “logfile” interactively. Meaning, that it will sit there and wait until “logfile” is appended to and it will then show you those lines. It’s great for monitoring something sticky deep inside an application if you don’t have tests you can generate and run.

An equivalent to “tail -f” on Windows is to use PowerShell with this command:

Another nicety in PowerShell “Get-Content” is that you can pipe the output to a search to only show the logfile lines that contain a specific string:

Happy tailing and Get-Contenting!

Continue reading

Commit your local git branch changes first, then checkout another branch

One of the things people get confused about is the branching in Git, specifically, the local branching. If you make a local branch, make code changes and then commit those changes to the local branch, you are free to switch to another branch and Git will automagically manage your files for you. From the git book:

Git resets your working directory to look like the snapshot of the commit that the branch you check out points to.

But it’s very easy to make a mistake here. If you don’t commit the changes in your new branch and instead check out another branch, those changes will be there too. I’ve seen this cause confusion with developers. So if you make a local branch off your “develop” line:

and make some changes to files, you have to commit those changes to “NewBranch” or you’ll still see them as modified files if you switch back to the “develop” or “master” branches. Now if you commit those changes to NewBranch line first, then checkout “develop,” you won’t see them as modified, and the files will instead be in their state from the “develop” branch.

Happy Local Branching!

Continue reading

How to get the address of the svn server for my subversion repository?

Recently, I had some code from a Subversion repository on my machine, but no longer had tortoise svn or any svn command lines tool set up. Luckily, I remembered that in Subversion there is a lot of fun data inside the .svn directory. For instance you can see the address of the server and repository by viewing the .svn/entries file at the root of the local subversion files.

Just look for the svn:// or svn+ssh://

That line should show you the svn server address, as well as the repo name and branch.

Continue reading