27 Jul 2010

Ubuntu Lamp Server

Quick and dirty Ubuntu Lamp Server

A lamp server on Ubuntu is pretty simple to setup to get working right away. Simply run the following command:

sudo tasksel install lamp-server

Create a MySQL password:

Tasksel will continue to install the components:

Open your browser and point to http://localhost. You should see the following message:

It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.

24 Jul 2010

Installing JRE on Ubuntu 10.04

How to install JRE6 on Ubuntu 10.04

Installing Java Runtime Environment and the plug-in on Ubuntu Lucid is pretty straightforward.  The first step is to enable the partner repository in /etc/apt/sources.list

## Uncomment the following two lines to add software from Canonical’s
## ‘partner’ repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
deb http://archive.canonical.com/ubuntu lucid partner
deb-src http://archive.canonical.com/ubuntu lucid partner

Once the sources are added, run an update

sudo apt-get update

Run the following command to install the Java Packages

sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts

Run the following to verify the installation

java -version

java version “1.6.0_20″
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)

24 Jul 2010

IT Toolbox

A list of free tools for System/Network Administrators

Unlocker

Unlocker is a tool that helps delete locked files with error messages like:

  • Cannot delete file: Access is denied
  • There has been a sharing violation
  • The source or destination may be in use
  • The file is in use by another program or user
  • Make sure the disk is not full or write-protected and that the file is not currently in use

http://ccollomb.free.fr/unlocker/

14 Jul 2010

Netstat on Windows

The netstat command is used to display active network connections on your workstation or server. Netstat can be used to display active TCP connections, ports on which the computers is listening, ethernet statistics, the IP routing table, IPv4 and IPv6 statistics. Used without parameters, netstat display active TCP connections.

Syntax

netstat [-a] [-e] [-n] [-o] [-p <em>Protocol</em>] [-r] [-s] [<em>Interval</em>]

Parameters

-a : Displays all active TCP connections and the TCP and UDP ports on which the computer is listening

-e : Displays ethernet statistics, such as the number of bytes and packets sent and received. This parameter can be combined with -s

-n : Displays active TCP connections, however, addresses and port numbers are expressed numerically and no attempt is made to determine names

-o : Displays active TCP connections and includes the process ID (PID) for each connection. You can find the application based on the PID on the processes tab in Windows Task Manager. This parameter can be combined with -a, -n, and -p.

-p Protocol : Shows connections for the protocol specified by Protocol. In this case, the Protocol can be tcp, udp, tcpv6, or udpv6. If this parameter is used with -s to display statistics by protocol, Protocol can be tcp, udp, icmp, ip, tcpv6, udpv6, icmpv6, or ipv6.

-s : Displays statistics by protocol. By default, statistics are shown for the TCP, UDP, ICMP, and IP Protocols.

-r : Displays the contents of the IP routing table. This is equivalent to the route print command.

Interval : Redisplays the selected information every Interval seconds. Press Ctrl + C to stop the redisplay. If this parameter is omitted, netstat prints the selected information only once.

/? : Displays help at the command prompt.

Examples

coming soon…

Alternatives

TCPView from SysInternals is another nice utility that takes netstat one step further. With TCPView you can view the active process name as well.

http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx

24 Jan 2010

Windows God Mode

This handy little folder makes access all system settings a breeze. The control panel can get a little annoying sometimes, so to avoid this and point everything in one location just create a new folder on your desktop, then rename it with the following:

Everything.{ED7BA470-8E54-465E-825C-99712043E01C}

“Everything” can actually be anything you want to name the folder. Once you hit enter on the rename the folder name will change.

30 Oct 2009

Apache Virtual Hosts (XAMPP)

apache

I had to create a couple virtual hosts on a windows 7 machine running XAMPP for development purposes.  This is typically a simple task.  XAMPP has an Apache virtual host configuration file in <xampp installation>\apache\conf\extra\httpd-vhosts.conf

There are some basic containers already set that you can use as reference, but in the end you have something like this:

NameVirtualHost 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
	DocumentRoot D:/www
	ServerName localhost
</VirtualHost>

<VirtualHost 127.0.0.1:80>
	DocumentRoot D:/www/mysite
	ServerName mysite.dev
</VirtualHost>

You then just configure your hosts file to point to your local IP address:

127.0.0.1    localhost
127.0.0.1    mysite.dev

You can add more directives to the virtualhost, but this was just the basic setup to get urls working without having to use subdirectories like http://localhost/mysite. Instead, I can use http://mysite.dev.

Restart apache and everything should be golden, but no, never quite that easy. I kept getting a blank screen for mysite.dev, but localhost was working. I would ping mysite.dev and get 127.0.0.1 like I would expect.

Well, long story short, I’ve behind a proxy/firewall and didn’t tell my browser to ignore the .dev domain. So, for my own purpose when I forget this again in a year or so, or anyone else behind a corporate network that may have a similar issue, this was why.

26 Oct 2009

WordPress Widgets

wordpress

WordPress widgets allow you to dynamically add content to sidebars directly from the wordpress control panel. I think this is a great option. The reason I’m using a Blog CMS is to reduce the amount of code I have to write, so this means less markup in my theme. I’m using only one sidebar on this site with a few widgets, including search, categories and links.

There are a few tricks to get widgets to work how you want, but it is relatively quick and painless. I’ll give an example of how I made this theme widget ready.

Read the rest of this entry »

15 Oct 2009

Filemaker searching with custom dialog and variables

filemaker

The built in scripting engine for FilemakerPro is actually pretty decent, but people design some pretty clunky interfaces. What I wanted was a button that the user could click which would open a dialog box with some search field inputs. There are a few tricks to get this to work properly.

The first step is to open the scripting engine. This is found under “Scripts” > “ScriptMaker”. Click on “New” in the dialog window to create a new script. The dialog window allows you to use up to 3 fields. Why you can’t select more is beyond me, but that is fine for my purpose.

Read the rest of this entry »

15 Oct 2009

CakePHP Auth Component Problem

cakephp

I’ve been using CakePHP for my last few projects and recently ran into a problem that was driving me nuts.  I have a few pages that don’t require any authentication.  You can allow pages to be viewed by calling $this->Auth->allow(‘function_name’) in your beforeFilter() method.  So, I set up my app_controller class with a before filter that looks something like this.

< ?php

class AppController extends Controller {

    var $helpers = array('Html', 'Form', 'Javascript');
    var $components = array('Auth');

    function beforeFilter() {
        $this->Auth->autoRedirect = false;
        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
        $this->Auth->allow('display');
    }

}

?>

Read the rest of this entry »

13 Oct 2009

Hello world!

If you are seeing this it is because I’m trying to create this site pretty much in real time.  I started creating this minimalistic theme and decided I’d upload changes as I go rather than only testing from my development machine.  This theme will have nothing very fancy, but I do plan to actually start blogging about things I do as an IT Pro and Web Developer.  Hopefully the majority of this blog will be completed over the next week or two.