Saturday, January 22, 2011

Export Create Table Script in mySQL

SHOW CREATE TABLE TableName;

Thursday, January 20, 2011

SpaceSniffer - Drive Space Allocation Mapping

If you're looking for a quick and easy disk space mapper, then I suggest SpaceSniffer from Uderzo - it's a small download, runs fast, and has decent visualization.

Wednesday, January 12, 2011

dotNet eMail

assembly: System.Net.Mail
classes: MailMessage, SmtpClient

---

MSDN Social thread:

public static extern IntPtr ShellExecute(
IntPtr hwnd,
string lpOperation,
string lpFile,
string lpParameters,
string lpDirectory,
int nShowCmd);

Public static void LaunchEmailClient(string mailURL)
{�
ShellExecute(IntPtr.Zero, "open", mailURL, "", "", 4);
}

You can refer http://msdn.microsoft.com/en-us/library/bb762153.aspx

---



Contact Us




Monday, January 10, 2011

Taunting dotNET - Rhino Mocks

RhinoMocks is a best-practice Object Mocking Framework for dotNET written by uber-dev Ayende Rahien.

Official RhinoMocks Page

Central Forum - Google Group

Good Intro Examples
- Stephen Walther

http://en.wikibooks.org/wiki/How_to_Use_Rhino_Mocks/Introduction
http://www.ayende.com/wiki/Rhino+Mocks+Introduction.ashx
http://en.wikibooks.org/wiki/How_to_Use_Rhino_Mocks/Introduction
http://house9-code-samples.blogspot.com/2008/02/rhinomocks-basics.html

Martin Fowler - Mocks/Behaviour vs Stubs/State Testing:

... I've also adjusted my vocabulary to match that of the Gerard Meszaros's xUnit patterns book... Meszaros uses the term Test Double as the generic term for any kind of pretend object used in place of a real object for testing purposes... Meszaros then defined four particular kinds of double:

- DUMMY objects are passed around but never actually used. Usually they are just used to fill parameter lists.
- FAKE objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
- STUBS provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
- MOCKS are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.

Saturday, January 8, 2011

CPU & Memory Info in Linux

cat /proc/meminfo
cat /proc/cpuinfo

Ubuntu 10-10 on the Lenovo X100e ThinkPad

Installing Ubuntu Netbook Edition 10-10 Maverick Meerkat on the Lenovo X100e ThinkPad

I unsuccessfully attempted to use the PenDrive Universal Linux USB Installer, as recommended by the official 10-10 download page, as well as the USB Disk Creator from an older (9-10) live CD.

Specifically, I encountered the problem outlined here, namely

SYSLINUX 4.01 debian-20100714 EDD Copyright (C) 1994-2010 H. Peter Anvin et al
Unknown keyword in configuration file: gfxboot
boot:
vesamenu.c32: not a COM32R image


Various attempts at implementing suggested solutions failed, and so in the end I tried using UNetBootIn to create the USB bootable install, which has worked perfectly.

Importantly, the wireless LAN is seamlessly detected and operated by 10-10.

INSTALL/GENERAL
- justinsomnia
- petehowe
- semiantics

WLAN
- nulldevice
- how-to-linux

OPTIMISATION
- how-to-speed-up-ubuntu-910-on-x100e

10-10 Specific
- Customize 10-10


10-04
- karssen.com
- helmi-blebe
- decent post install guide

A Brief Review
Meerkat runs quite smoothly on my X100e with 2 MB or RAM. UI response is quite snappy, except for the Ubuntu button and following OS search functionality, which runs _very_ slowly for some unknown reason. Google Chromium runs v.fast. With the screen on bright, and the wireless lan card in use, you can literally watch the batter drain, and you'll get somewhere just under an hour. I can't get the proprietary video drivers to work under the std 32bit x86 binaries. I must try the AMD64bit binaries. All in all, quite happy. In terms of performance, I can listen to music in the background via rhythmbox, have a chrome instance open with a couple of tabs, and then develop python using Geany and the console, with no problems. The smart terminal has arrived.

UpDate 11-04
11-04 runs faster and smoother, with no more lag on using the Ubuntu button/OS search functionality.  Prooprietary graphics drivers installed and run ok.

Friday, January 7, 2011

Global Exception Catching in WPF

AppDomain.UnhandledException
- all threads in the AppDomain
MSDN
Dispatcher.UnhandledException
- single specific UI dispatcher thread.
Application.DispatcherUnhandledException
- main UI dispatcher thread in your WPF application
MSDN
stackoverflow

Kent Boogaart
Application.DispatcherUnhandledException is only raised if the exception was raised on the UI thread, whereas AppDomain.UnhandledException is raised for exceptions that occur on background threads. Typically I attach to both and run similar handling code. The only difference is that DispatcherUnhandledException allows you to "recover" by setting Handled to true. In other words, you could prompt your user to see whether they'd like to attempt to continue running (and potentially avoid data loss).

Exceptions in Managed Threads

---

MSDN
If an exception is not handled on either a background user interface (UI) thread (a thread with its own Dispatcher) or a background worker thread (a thread without a Dispatcher), the exception is not forwarded to the main UI thread. Consequently, DispatcherUnhandledException is not raised. In these circumstances, you will need to write code to do the following:

- Handle exceptions on the background thread.
- Dispatch those exceptions to the main UI thread.
- Rethrow them on the main UI thread without handling them to allow DispatcherUnhandledException to be raised.

---

Example of Subscribing to AppDomain.CurrentDomain.UnhandledException


App.xaml.cs:

protected override void OnStartup(StartupEventArgs e)
{
AppDomain.CurrentDomain.UnhandledException += new
UnhandledExceptionEventHandler(this.AppDomainUnhandledExceptionHandler);
}

void AppDomainUnhandledExceptionHandler
(object sender, UnhandledExceptionEventArgs ea)
{
// handle the exception
}