Bleuchez!

welcome

Archive for the ‘Programming’ Category

Use Apache’s mod_proxy to Set Up a Proxy Server

without comments

A proxy server is a server that sits between your computer and the internet and services your requests to the internet. Many companies use proxy servers to filter employee internet requests since a proxy server can also modify or block your request.

My goal in setting up a proxy server was to give myself a means of encrypting my web traffic when I am in insecure locations such as airports and restaurants.

Setup
To set up a proxy server, you first need a server. You can use a machine on your home network, get a dedicated server, or get a virtual server. I chose to get a virtual server through slicehost.com. I am using their base $20 256 slice with Ubuntu 8.04 LTS. In addition to proxy services I also use it as a virtual desktop and, since I can leave it on all the time, run long term jobs.

I set up the proxy server to only allow connections from the local host. I can then connect to the local machine via SSH and surf the web through the SSH tunnel. This way, the connection to my server is encrypted and no one can use the proxy server unless they have an account on my machine.

The setup is simple but I had to go to several sources to figure it all out, hence this article.

First, install Apache:

apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

Next, link to the mod_proxy modules:

cd /etc/apache2/mods-enabled
ln -s /etc/apache2/mods-available/proxy_http.load
ln -s /etc/apache2/mods-available/proxy_ftp.load
ln -s /etc/apache2/mods-available/proxy_connect.load
ln -s /etc/apache2/mods-available/proxy.load

Then, in your httpd.conf file located at /etc/apache2 make
entries to configure the server:


ProxyRequests On
ProxyVia Block
<Proxy *>

   Order deny,allow
   Deny from all
   Allow from 127.0.0.1
</Proxy>

Here, ProxyRequests configures Apache as a forward proxy. <Proxy *> and </Proxy> delineate the proxy configuration block. The block tells Apache to deny all connections except from the local machine (127.0.0.1).

Now, restart Apache:

apache2ctl graceful

Finally, in your browser configure your host to use the proxy server you just set
up:

Sources:
slicehost.com: Ubuntu Hardy Apache and PHP install guide
serverwatch.com: Configuring Apache 2.0 as a Forward Proxy Server

Written by bleuchez

November 1, 2009 at 11:40 pm

Komodo 5.0

without comments

I’ve been using Komodo ever since version 3.5 came out several years ago. I first found out about it while looking for a Windows Perl distribution and happened upon the Activestate website. So, what is Komodo? Komodo is a IDE geared towards dynamic languages like Python/Perl/Tcl/Ruby that runs on all 3 major OS platforms (Windows, Linux, and OSX). It is put out by Activestate, the same company that puts out the most widely used Windows Perl distribution -Main Window showing debugger and variable viewers Activestate Perl.  I bought Komodo because I liked the built in Perl debugger and syntax highlighting. I purchased the upgrade to versionMain Window showing debugger and variable viewers 4.0 because it added VI keybindings. Version 5.0 didn’t have any features I thought were compelling, but I purchased the upgrade anyway because I wanted to support Activestate.

Features:
Komodo is a feature rich editor. Besides the required syntax highlighting, it has editing of remote files over FTP and SFTP, version control integration, VI emulation mode, a very nifty graphical debugger, http request and response inspector and editor (HTTP inspector), source control integration, a regex constructor (RX toolkit), and an interactive shell that lets you try out commands on the fly. These are just the features I use on a regular basis! Komodo is also extensible via scripts, supports macros, customizable keyboard shortcuts, and much more.

Usability:
Komodo is very user friendly.  Besides the VI keybindings, you can also customize the menu by assigning your own key combinations to the commands you use the most.  The interface stays out of your way until you need it, the main typing window takes up most of the screen with the quick link buttons  listed along the top.  You can bring up the debugger or your source control windows at the bottom and there are side tabs to let you quickly access files in your project, variables, and functions.  One area that is lacking is the help – it is sparse in some areas, especially on how to access the API and so sometimes I have to resort to trial and error.

The syntax highlighting is great, it makes the code readable and there are little red squiggles show you where you have errors in your code.  A little drop down pops up when you access member variables, however it is not as comprehensive as Microsoft’s intellisense in that it doesn’t perform the drop-down for every variable.

A great feature I use regularly but is not found in most IDEs is the ability to edit remote files over FTP and SFTP.  This allows me to get syntax highlighting, code folding, code completion and all the other nifty features of the IDE on files that can only be accessed via SSH or telnet.  This is great because a lot of my work is done on UNIX machines that don’t come with fancy editors but allow access via SSH and telnet.

Komodo Regular Expression Editor

Komodo Regular Expression Editor

I mainly use Komodo for Perl and C/C++ development but I have dabbled with Ruby on Rails using Komodo and it also shines in this area.  It has shortcuts to automatically generate scaffolding items and you can watch your site execute using the built in debugger.

I’ve discussed the features I use the most and like the best but Komodo has many more features that will interest others who work with different languages or with different needs.  Check out their features page for a full list of everything Komodo can do.  Activestate also offers a trial version and has a lite version of their IDE in Komodo Edit.

Conclusion:
Overall, Komodo is great software and I would highly recommend it to anyone who works with dynamic languages.  I don’t regret buying it since it has paid me back many times in saving me time and reducing the frustration of debugging code.

Pros:

  • Versatile and feature rich
  • Easy to modify to suit your tastes
  • Advanced debugging support
  • Great code editing features
  • Works on all major platforms – Windows, Mac, Linux

Cons:

  • Expensive!
  • Only supports dynamic languages

Checking out Slashdot with HTTP Inspector

Written by bleuchez

June 12, 2009 at 3:09 am

Mapping foreign keys to primary keys in an Objectdatasource

without comments

I was having a tough time finding how to display database data from a primary key in a drop-down and then have the selected item show up in my business class object when it returned.

I wanted to do this using an Objectdatasource because I had to reference several different tables in order to display my data.  As a newbie, I spent several days struggling on it when I found this set of tutorials on Microsoft’s MSDN site, specifically tutorial 20.  These tutorials nicely cover the basics of data manipulation in ASP.NET using C# and the Objectdatasource.

I hope this helps other like me who are struggling with the same problem.

Written by bleuchez

January 26, 2009 at 2:49 am

Posted in ASP.NET, Programming, Resource

Tagged with ,