This blog is a knowledge base...where I clip cool tricks and urls

Hashtable for Flex?

clipped from livedocs.adobe.com

Packageflash.utils
Classpublic dynamic class Dictionary
InheritanceDictionary Inheritance Object

The Dictionary class lets you create a dynamic collection of properties, which uses strict equality
(===) for key comparison. When an object is used as a key, the object's
identity is used to look up the object, and not the value returned from calling toString() on it.

The following statements show the relationship between a Dictionary object and a key object:

 var dict = new Dictionary();
var obj = new Object();
var key:Object = new Object();
key.toString = function() { return "key" }
dict[key] = "Letters";
obj["key"] = "Letters";
dict[key] == "Letters"; // true
obj["key"] == "Letters"; // true
obj[key] == "Letters"; // true because key == "key" is true b/c key.toString == "key"
dict["key"] == "Letters"; // false because "key" === key is false
delete dict[key]; //removes the key


See also





 blog it

spyware setup.dll.vbs

 blog it

submitting an article to codeproject

 blog it

Run commandline and get its output / error streams - async

clipped from www.codeproject.com
    void protected override void DoWork()()
{
// Start a new process for the cmd
Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = FileName;
process.StartInfo.Arguments = Arguments;
process.StartInfo.WorkingDirectory = WorkingDirectory;
process.Start();
// Invoke stdOut and stdErr readers - each
// has its own thread to guarantee that they aren't
// blocked by, or cause a block to, the actual
// process running (or the gui).
new MethodInvoker(ReadStdOut).BeginInvoke(null, null);
new MethodInvoker(ReadStdErr).BeginInvoke(null, null);
// Wait for the process to end, or cancel it
while (! process.HasExited)
{
Thread.Sleep(SleepTime); // sleep
if (CancelRequested)
{
// Not a very nice way to end a process,
// but effective.
process.Kill();
AcknowledgeCancel();
}
}
}
 blog it

Spawn like the IDE

clipped from www.codeproject.com
m_StopEvent.Reset();
string SpawnArgs = " -e " + m_StopEvent.Handle;
SpawnArgs += " \"" + Filename + "\" " + Arguments;
ProcessStartInfo Info = new ProcessStartInfo();
Info.FileName = "vcspawn.exe";
Info.Arguments = SpawnArgs;
Info.WorkingDirectory = "";
Info.CreateNoWindow = true;
Info.UseShellExecute = false;
Info.RedirectStandardOutput = true;
Info.RedirectStandardError = true;
Process Proc = Process.Start(Info);
m_StdOutReader = new RedirOutReader(Proc, Printer,
Proc.StandardOutput);
m_StdOutReader.Start();
m_StdErrReader = new RedirOutReader(Proc, Printer,
Proc.StandardError);
m_StdErrReader.Start();
m_StopWaiter = new ProcessStopWaiter(Proc, Printer,
Filename, DeleteAfterRun, m_StopEvent);
m_StopWaiter.Start();
 blog it

A class than get output from cmd

clipped from www.codeproject.com

This small class provides a very simple interface for running command line applications. It traps their standard output and error streams, and returns the output as a string. It provides method overloads to either return the errors in a second string, or to throw an exception if the error stream is non-empty.

 blog it

Run command line in C#

clipped from www.codeproject.com
    Process process = new Process();
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.FileName = FileName;
process.StartInfo.Arguments = Arguments;
process.StartInfo.WorkingDirectory = WorkingDirectory;
process.Start();
 blog it

How to build SQL Mobile Application

It runs on PDA, and also some new phones ...

See the demo:
http://msdn.microsoft.com/seminar/shared/asp/viewInline.asp?url=/msdntv/episodes/en/20060831mobilerb/roryblyth01_demo.wmv〈=en&cr=US&WMPVer=11.0.5721.5145