New Toy – Raspberry Pi

Raspberry Pi

Ordered a Raspberry Pi last week and the next day I received it. Excited with it!

Advertisements

Removing non-essential Files from Visual Basic 2010 Compiled Output

By default the compiled output from Visual Basic 2010 comes with several non-essential files for debugging. If you want to remove them from the output folder, here is the article about it.

Background

Normally the compiled output will have the following files:

Visual Basic Compiled Output

  • A compiled executable (.exe)
  • A database with debug information (.pdb)
  • A debug executable for debugging purpose (.vshost.exe)
  • A configuration file for the debug executable (.vshost.exe.manifest)
  • A documentation file (.xml)

Most of the time you will only need the compiled executable.

Disable Generating .pdb

1. Go to project Properties, Compile tab, and click the Advance Compile Options button.

Compile Tab of Project Property

2. In Advanced Compiler Settings dialog, choose None in Generate debug info.

Advanced Compiler Settings

Disable Generating .vshost.exe and .vshost.exe.manifest

1. Go to project Properties, Debug tab.

2. Uncheck the option Enable the Visual Studio hosting process.

Debug Tab of Project Properties

Disable Generating Documentation File .xml

In some version of the Visual Studio there is an option to disable the generation of documentation file in Compile tab of the project Properties. However I couldn’t find this in my Visual Basic 2010 Express and as a result I got to edit the project file using Notepad.

1. Open the Visual Basic Project file .vbproj using text editor.

2. Remove the XML node with tag DocumentationFile.

Visual Basic Project File

Configure RedHat Linux as Router

In my case, because a normal router doesn’t come with support of 802.1x security and I only have 1 IP address, I got to set up a Red Hat Linux server as a router with perform NAT and packet forwarding function.

Steps

  1. Suppose your server is using static IP 192.168.1.10, your network interface is eth0, and there is another PC with IP address 192.168.1.11 connected to the server directly
  2. Enable IPv4 packet forwarding on Linux
    echo 1 > /proc/sys/net/ipv4/ip_forward
  3. Enable SNAT
    # Example
    iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 192.168.1.10
  4. (Optional) Enable DNAT (port fowarding) for services such as web server
    # Example
    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.1.11:80

Bonus

If you want to save the rules in iptables or restore them after edit, you can use these commands!

Edit 2013-05-08: The previous command were incorrect and has been updated.
Edit 2014-11-20: Added a command for persistent change on RedHat 5

# Save iptables rules to a file
iptables-save > /tmp/iptables.txt

# Restore iptables rules from a file
iptables-restore < /tmp/iptables.txt

# (For RedHat 5) Save the iptables rules so that changes is persistent (across reboot)
service iptables save

Rollback

Edit 2014-11-20: I have more IP addresses now after moving to new office. So today I rollback the configuration.

  1. Edit the file at /etc/sysctl.conf and locate the following line:
    net.ipv4.ip_forward = 1

    Edit it to read as follows:

    net.ipv4.ip_forward = 0
  2. As the root user, run the following command to enable the change to the sysctl.conf file:
    sysctl -p /etc/sysctl.conf
  3. You can then verify the result by the following command, which should give you zero as output:
    cat /proc/sys/net/ipv4/ip_forward