Wednesday, August 28, 2013

NATting with iptables on Ubuntu

/etc/sysctl.conf:
net.ipv4.ip_forward = 1

sysctl -p /etc/sysctl.conf

/etc/init.d/networking restart

# list rules
iptables -L
iptables -t nat -L
iptables -t nat -L -n -v

# flush rules & NATs
iptables --flush
iptables --table nat --flush

iptables -t nat -A PREROUTING -p tcp –-dport 80 -j DNAT –-to-destination 192.168.22.122:80
iptables -t nat -A PREROUTING -p tcp –-dport 3306 -j DNAT –-to-destination 192.168.22.122:3306
iptables -t nat -A PREROUTING -p tcp –-dport 2222 -j DNAT –-to-destination 192.168.22.122:22

iptables -t nat -A POSTROUTING -j MASQUERADE


####### Auto Loading Rules at System Start-up #######

#1 save rules to file
iptables-save > /etc/iptables.rules

#2 find interfaces
iwconfig
ifconfig

#3 edit config file
vi /etc/network/interfaces

#4 add line to relevent interface (iface eth1)
pre-up iptables-restore < /etc/iptables.rules

Thursday, January 10, 2013

See all connected users to MySQL

SHOW PROCESSLIST;

Caveat: you need to execute this command as a user with the PROCESS privilege in order to see all of the other users who are connected to the database. Otherwise, you see only those server threads that belong to the same user as the one making the query.

Thanks to : David Harper - Cambridge, England

Reference: http://dev.mysql.com/doc/refman/5.0/en/show-processlist.html

Wednesday, January 2, 2013

Proxying via Apache

Inside the <virtualhost> section add following.
<Proxy *>
 Order deny,allow
 Allow from all
</Proxy>

ProxyRequests Off
ProxyPreserveHost Off

ProxyPass /proxy/ http://www.newurl.com/
ProxyPassReverse /proxy/ http://www.newurl.com/

Friday, November 2, 2012

A fork in the road...


Alice came to a fork in the road.
'Which road do I take?' she asked. 
'Where do you want to go?' responded the Cheshire cat. 
'I don't know,' Alice answered. 
'Then,' said the cat, 'it doesn't matter.'
  
Lewis Carroll, 1832-1898
English Author, Mathematician and Deacon

Thursday, August 9, 2012

Mono for Android

How to prepare the environment with offline installers for Windows.

Android SDK/AVD Manager
http://dl.google.com/android/installer_r20.0.1-windows.exe

Android SDK Platforms
Download from http://{repository url}/{relevant file-name} (hint: see repository.xml)
e.g. - Platform 4.0 http://dl.google.com/android/repository/android-14_r03.zip
Move the ZIP file to {sdk-path}\temp directory and use SDK Manager to install the respective platform.

SDK Tools
http://dl.google.com/android/repository/tools_r20.0.1-windows.zip

JDK (1.6) for Mono (4.2.4)
http://download.xamarin.com/Installer/MonoForAndroid/jdk-6u31-windows-i586.exe
Note: JDK 1.7 is not supported

Mono for Android 4.2.4
http://download.xamarin.com/MonoforAndroid/Windows/mono-android-4.2.4.167234518.msi

MonoDevelop
Locate the downloads from: http://monodevelop.com/Download (listed below)
MonoDevelop 3.0.3.5 Installer
http://download.xamarin.com/monodevelop/Windows/MonoDevelop-3.0.3.5.msi
GTK# for .NET 2.12.10http://download.mono-project.com/gtk-sharp/gtk-sharp-2.12.10.win32.msi
.NET Framework 4.0 Standalone Installer
http://www.microsoft.com/en-us/download/details.aspx?id=17718

--------------------------------------------------------------------------------------------------------

Resource files:
http://dl.google.com/android/repository/repository-7.xml
http://xamarin.com/download/installer/Windows/MonoForAndroid/InstallationManifest.xml

Sources:
http://qdevarena.blogspot.com/2010/05/download-android-sdk-standalone-for.html
http://stackoverflow.com/questions/2766713/android-download-the-android-sdk-components-for-offline-install

Friday, November 18, 2011

C# - Draw a Rectangle on a Picture Box on Mouse-Move

private void pictureBox1_MouseMove(object sender, MouseEventArgs e)
{
 pictureBox1.Refresh();
 System.Drawing.Graphics g = pictureBox1.CreateGraphics();
 System.Drawing.Pen p = new System.Drawing.Pen(System.Drawing.Color.Blue);
 g.DrawRectangle(p, new Rectangle(e.X, e.Y, 40, 80));
 p.Dispose();
 g.Dispose();
}

Thursday, November 17, 2011

Enable Query Log for MySQL

File: my.ini

[mysqld]
#Set General Log
log = "c:/wamp/logs/genquery.log"

Monday, October 17, 2011

අපි හැමදාමත් ආදරෙයි !

අපි ඉස්සර නිවාඩු කාලේ එනකම් බලං ඉන්නේ මාමා හඬ කවපු කාටුන් බලන්න.
අපේ පුංචි කාලේ ලස්සන කරපු මාමාට අපි එදා වගේම අදත් ගොඩාරියක් ආදරෙයි!
මාමාට නිවන් සුව ලැබෙන්න කියලා පුංචි අපි හැමෝම ප්‍රාර්ථනා කරනවා.