inicio mail me! sindicaci;ón

Unable to start Apache, port 80 in use–Skype bastard process

Today I was unable to start Apache using a new install of XAMPP. A quick netstat -o in cmd showed something was blocking port 80.

After about an hour of searching, I discovered that port 80 was in use by Skype. No kidding. There is an advanced setting in skype to “Use port 80 and 443 as alternate incoming connections.” If this is checked (which it is by default) then a service is started on port 80 that blocks Apache. Ungh for bad ideas and even worse defaults.

Manually remove a service from windows

Today I needed to manually remove a service from windows. I found this command line approach, which worked great for me.  Be sure to use the service name and not the display name:

sc delete ServiceName

You can find the service name by going to Control Panel -> Administrative Tools -> Services, right click the service and choose properties, the service name is shown there.

How to Run a Cygwin Command From Windows Scheduler (Scheduled Tasks)

After repeated problems setting up crond to run in cygwin (it just doesn’t like the user accounts, no matter how enthusiastically I argue that I’m me), I spent some time figuring out how to run a Cygwin command as a scheduled task from Windows.

Based on this mail archive post, I created the following cygrun.bat file:

    @echo off
    rem set HOME=c:\
    if "%DEF_PATH%"=="" set DEF_PATH=%PATH%
    set PATH=c:\cygwin\bin;%DEF_PATH%
    set myargs=%*
    if "%myargs%" == "" goto noarg
    rem echo %myargs%
    bash --rcfile "%HOME%/.bashrc" -i -c "%myargs%"
    c:
    rem pause
    sleep 1
    goto exit
    :noarg
 
    rxvt -e /usr/bin/bash --login -i
 
    :exit
    exit

Then I tested the script from the command line as follows, until I had the syntax just so:

c:
cd \cygwin
cygrun.bat cygwin_script arg1 arg2

Once I was able to run it happily, I added the scheduled task as follows:

    Run: C:\WINDOWS\system32\CMD.EXE /x /c start "Some title" /min
c:\cygwin\cygrun.bat cygwin_script arg1 arg2
    Start In: c:\cygwin     <-- must be a real disk drive and path
    Run as: domain\username

Unfortunately, I was never able to figure out how to redirect stdout and stderr. I tried plenty of variations on “>> /some/path/to/log.txt 2>&1″ with no joy. Instead, I just changed all the commands in the script and added that line on to each echo statement. Sad, but functional.

Extending the Windows Clipboard

For programmers and writers, being able to keep a history of copy/paste and access it with a hotkey is a serious boon. Here are some of the ways I use a clipboard tool daily (sometimes fifty times a day):

  • Take notes quickly–store a url, email address, or command for reference later
  • Reorganize a document–clip here, copy there, then paste it all together
  • Store commonly used commands and html strings for quick access
  • Passwords that I type more than ten times an hour
  • Storing things I use daily: IP addresses, dates, sql queries, urls

 

I’ve tried a few different tools, like Comfort Clipboard and XNeat Clipboard. But nothing beats Spartan for simple, direct, fast, and capable.

It allows you to store most any sort of formatted text, has 36 quick copy/paste slots, and multiple columns where you can drop text for different topics to store permanently and access them with a click.

If that wasn’t enough, it offers 10 different views, each with full hotkeys and columns. I’ve set mine up with CTRL+\ as a hotkey, so I have quick access to anything on the clipboard at the speed of typing.

It has a trial period, and is well worth the 20 bills for the full version.

For those with a little less robust needs, they also have a free version, 101clips, that is quite capable. Though I couldn’t live without the advanced capabilities of the full version.