GAWK-ness!

Kill Stuff

ps -ef | gawk '/php|lead/ { print $2 }' | xargs kill

List processes list, grab anything that contains "php" or "lead" and print the PID (second column as signified by $2), pass through to xargs to kill.

ps -ef | gawk '/php|lead/ { print $n }'
//is functionally equivalent to
ps -ef | egrep "php|lead"
//as print $n prints all columns.
//second command comes with cool colors if your terminal is configured proper.
//first command - no colors

#kill process

Recursive FTP with NcFTP for Linux

One of my biggest peeves with traditional command line FTP tools is NOT being able to recursively put directories.

Welcome NcFTP.

yum install ncftp
ncftp -u username hostname/IP address
put -R *

Reference: http://www.linux.com/archive/feed/52714

.NET - Reading App Config File

Reading from the app config file is a necessary knowledge, though easily often forgotten.

Current
This works for the latest frameworks.
string configTest = System.Configuration.ConfigurationManager.AppSettings["Test"].ToString();

Deprecated
The follow is for older frameworks. Although still works, obviously should be avoided as they are deprecated.
string configTest = ConfigurationSettings.AppSettings["Test"]; //deprecated
string configTest = System.Configuration.ConfigurationSettings.AppSettings["Test"]; //deprecated

WPF Client Trusting Self-signed Certs

Created a WCF Service that's using basicHttpBinding over Transport. The certificate is self-signed.

WPF client was getting the follow error:

Could not establish trust relationship for the SSL/TLS secure channel with authority 'test-server.local'.

The WPF Client can use the following code to trust all self-signed certs and overcome this error.

//Trust all certificates
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);

SVN

SVN

Installation
yum install trac

Creating Repository
svnadmin create repo_name
svnadmin create --fs-type fsfs repo_name

Working With Repository
svn checkout file:///lci/svnroot/toolbox toolbox
svn import test file:///lci/svnroot/test --message "any message"
svn commit

Reference: http://www.cs.ubc.ca/~vailen/svn_howto.htm
Reference ebook: http://svnbook.red-bean.com/

Goodbye Media Temple, Hello WebHostingBuzz

Media Temple

I've been hosting with Media Temple (MT) for about a year or so. The idea that my instance is on a cluster was fancy and awesome. Static pages being served from Media Temple are blazing fast. However, using the default MySQL container proved to be mediocre, if not sub-par. Couldn't take this. So I upgraded to a dedicated MySQL Grid Container, essentially a dedicated instance of MySQL also on the cluster. Performance dramatically increased compared to the old set up. I was happy for a few months.

Enable Syntax Highlighting for root in vim

One of the most annoying things I couldn't figure out for the longest time was why syntax highlighting WORKED for users I created, but not for root. After reading an article, the fix was pretty simple.

Assuming syntax highlighting (syntax on) was placed in the global /etc/vimrc file instead of the local user's ~/.vimrc, you simply need to add an alias for vim.

Open up /root/.bashrc and add:

alias vi="vim"

Saving yourself from logging out and back in for the change to take effect, do this:

source /root/.bashrc

Disabling root SSH Access

I won't get into the arguments of why this is or isn't a good thing to do. I've already decided for myself that any machine I create, root ssh access will be denied.

For my distro, Fedora, you can find this file: /etc/ssh/sshd_config. Find this line and uncomment it.

PermitRootLogin no

Configure and Verify That .htaccess Works

For an hour, the bane of my existence last night as I was trying to configure Drupal on my personal server to get Clean URLs to work. Apache was NOT reading my .htaccess file.

Testing .htaccess
Create an .htaccess file in the directory you need it working for. Type random stuff in. Reload the page and see if you get a config error. If your page still shows up, Apache is ignoring it.

Configuring Apache

Creating Private Key, CSR, Self-signed CRT, and Converting CRTs using OpenSSL

OpenSSL, used in conjunction with Apache via the mod_ssl module, makes securing your site with SSL easy.
I use the naming convention suggested by the referenced article because it makes more sense. Prior to that, I was just using "key" and "server" and that was very confusing. Of course, I didn't know what I was doing either.

Creating Key
openssl genrsa -des3 -out www.dreamingbinary.com.key 2048

Too Much Going On

Lots of things going on. Four project are running in parallel. I realize I'm burning myself at both ends of the candle. Metaphors aren't much my thing anymore. Neither is coherency.

Biztalk, WPF, WCF on the plate at work.
Drupal on another plate.
WCF, WPF, E-Commerce, ERP yet on another plate.

Lots of acronyms. Lots of buzzwords. Lot of things to learn. Lots of other things to relearn. Lots of opportunity knocking. Sort of sucked all of the deadlines converged all around the same time though.

Install QAS From an Existing Copy on Linux

The installation book goes through the details. This is a very brisk summarize of how to deploy from an existing copy of QAS on some Linux server.

  • Tar/copy to the new environment.
    tar -czf qas.tgz /opt2/qas
  • Create symlink to the new location. This is only significant because the INI files reference this path. You can ignore this step if you update the INI files too. Good luck.
    cd /opt
    ln -s /opt2/qas qasWebPro
  • Create a symlink to lbqapwccd.so in /usr/lib.
    cd /usr/lib

cURL Headers Only

Following redirection is a pain sometime. Tools like Fiddler2 and Charles Proxy are nice. Tools built into Firefox's Firebug, Chrome, and IE's developer tools are also nice. But on the command line, I prefer cURL with just headers.

curl -IL www.hotmail.com

Produces the following output:

[root@web-dev-f13 /]# curl -IL www.hotmail.com
HTTP/1.1 302 Found
Date: Thu, 20 Jan 2011 22:25:28 GMT
Server: Microsoft-IIS/6.0
P3P: CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
xxn: -3
MSNSERVER: H: BAY0-DP3-3 V: 15.4.3057.112 D: 2011-01-12T20:15:15

Syndicate content