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

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

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

Wednesday, September 21, 2011

Drag Drop with a Custom Icon in C#



Code:

        private void frmDragDrop_Load(object sender, EventArgs e)
        {
            //enable the dragged item to be dropped on to the target
            this.txtDropTarget.AllowDrop = true;
            //to make the custom drag icon visible over the form
            //we must allow drop on the form but take no action upon it
            this.AllowDrop = true; 
        }

        private void lblDragSource_MouseDown(object sender, MouseEventArgs e)
        {
            //initiate the drag operation
            //the given DragDropEffect iindicates cursor to use when dropping is allowed
            lblDragSource.DoDragDrop(lblDragSource.Text, DragDropEffects.Copy);
        }

        private void txtDropTarget_DragEnter(object sender, DragEventArgs e)
        {
            //if dragging has data, show the droppable cursor
            //otherwise show the no-drop cursor
            if (e.Data.GetDataPresent(DataFormats.Text))
                e.Effect = DragDropEffects.Copy;
            else
                e.Effect = DragDropEffects.None;
        }

        private void frmDragDrop_DragEnter(object sender, DragEventArgs e)
        {
            //this is where the actual "show drag icon over the form" occurs
            if (e.Data.GetDataPresent(DataFormats.Text))
                e.Effect = DragDropEffects.Copy;
            else
                e.Effect = DragDropEffects.None;
        }

        private void txtDropTarget_DragDrop(object sender, DragEventArgs e)
        {
            //process the drop action
            txtDropTarget.Text = (string)e.Data.GetData(DataFormats.Text);
        }

        private void lblDragSource_GiveFeedback(object sender, GiveFeedbackEventArgs e)
        {
            //customize the drag cursor for the given DragDropEffect for this control
            e.UseDefaultCursors = e.Effect != DragDropEffects.Copy;
            Cursor.Current = new Cursor("1.ico");
        }


Sources:
http://www.switchonthecode.com/tutorials/winforms-using-custom-cursors-with-drag-drop
http://www.switchonthecode.com/tutorials/csharp-tutorial-how-to-use-custom-cursors
http://stackoverflow.com/questions/1733912/how-do-i-handle-dragging-of-a-label-in-c

Wednesday, August 17, 2011

PHP mail() on WAMP

  1. Install the fake sendmail. (http://glob.com.au/sendmail/)

  2. Configure fake sendmail to use a valud SMTP server.

    example: Gmail
    smtp_server=smtp.gmail.com
    auth_username=your gmail username
    auth_password=your gmail password


    sources:
    https://mail.google.com/support/bin/answer.py?answer=13287
    http://www.geekzone.co.nz/tonyhughes/599

  3. Configure "php.ini" to use fake sendmail.

    example:
    sendmail_path = "c:\wamp\sendmail\sendmail.exe -t"

    source:
    http://www.joshstauffer.com/send-test-emails-with-wampserver/

  4. Restart Apache/WAMP.

  5. Write a call to mail() in PHP & run it.