Posts

Showing posts from January, 2005

The Robots Exclusion Standard (web spider)

C++: Named Constructor Idiom

(quoted from http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.4)
What is the "Named Constructor Idiom"? A technique that provides more intuitive and/or safer construction operations for users of your class. The problem is that constructors always have the same name as the class. Therefore the only way to differentiate between the various constructors of a class is by the parameter list. But if there are lots of constructors, the differences between them become somewhat subtle and error prone. With the Named Constructor Idiom, you declare all the class's constructors in the private or protected sections, and you provide publicstatic methods that return an object. These static methods are the so-called "Named Constructors." In general there is one such static method for each different way to construct an object. For example, suppose we are building a Point class that represents a position on the X-Y plane. Turns out there are two common ways to …

C++: Warning: Derived::f(char) hides Base::f(double)

(quoted from http://www.parashift.com/c++-faq-lite/strange-inheritance.html)

What's the meaning of, Warning: Derived::f(char) hides Base::f(double)? Updated! [Recently included a new example, changed the parameter types so the behavior seems more bizarre/ominous, and added a note about warnings not being standardized, thanks to Daniel Kabs (in 12/04). Click here to go to the next FAQ in the "chain" of recent changes.]It means you're going to die. Here's the mess you're in: if Base declares a member function f(double x), and Derived declares a member function f(char c) (same name but different parameter types and/or constness), then the Basef(double x) is "hidden" rather than "overloaded" or "overridden" (even if the Base f(double x) is virtual). class Base {
public:
void f(double x); ← doesn't matter whether or not this is virtual
};

class Derived : public Base {
public:
void f(char c); ← doesn't …

Resolution to C++ "dreaded diamond"

(quoted from http://www.parashift.com)

The "dreaded diamond" refers to a class structure in which a particular class appears more than once in a class's inheritance hierarchy. For example, class Base {
public:
...
protected:
int data_;
};

class Der1 : public Base { ... };

class Der2 : public Base { ... };

class Join : public Der1, public Der2 {
public:
void method()
{
data_ = 1; ← bad: this is ambiguous; see below
}
};

int main()
{
Join* j = new Join();
Base* b = j; ← bad: this is ambiguous; see below
} Forgive the ASCII-art, but the inheritance hierarchy looks something like this: Base
/ / / Der1 Der2
\ /
\ /
\ /
Join Before we explain why the dreaded diamond is dreaded, it is important to note that C++ provides techniques to deal with each of the "dreads." In other words, this structure is often called the dreaded di…

Wrapping .NET Framework SP1 into a installer

(Original : http://www.mcse.ms/archive102-2004-9-1093014.html)

1. First download the .NET framework v1.1 re-distributable package, and run "dotnetfx.exe" with the "/C" switch (to extract contents).
2. Then download the .NET fw v1.1 SP1 update, and run "NDP1.1sp1-KB867460-X86.exe" with the /XP" switch (to extract contents).
3. A dialog box asking you where to save the MSP (update patch) comes up, choose where you want to save it (size 18,760 KB).
4. Rename that MSP to SP1.MSP, and place the extracted contents of dotnetfx.exe (.NET framework installer) in the same directory.
5. Clean the directory so sp1.msp, data1.cab, and netfx.msi are the only files (3 files) in the directory.
6. Run the following commands (from a command prompt):

CODE
msiexec /a netfx.msi TARGETDIR="c:\netfx1"
msiexec /p sp1.msp /a c:\netfx\netfx.msi

7. Your c:\netfx directory should have 3 items in it after this operation: 2 directories - Program Files & Win, and ne…

Log4Net tutorial (my straightforward version)

After playing around with the Log4Net, this is my version of tutorial of Log4Net. (WinForm or console)

I have come across a few tutorials but it seems that most of them are either not working or missing out some details that could lead to further waste of time in searching. Hence, my version is here. (in case in future I need to refer back again)

1. Download latest Log4Net. Not the release version 1.1.1, it won't work in this tutorial. Actually, I haven't seen any tutorials works on 1.1.1 release with FileAppender, what an upset. You will need to download the 1.2.0 Beta8 or later.
2. Start a .NET WinForm application or console application.
3. Add reference to Log4Net.dll
4. Add codes below to AssemblyInfo.cs

[assembly: log4net.Config.DOMConfigurator(ConfigFile="Logging", ConfigFileExtension="config",Watch=false)]

5. Add these two lines into your class.

private static readonly ILog logger =
LogManager.GetLogger(typeof(YourClassName));

static YourClas…

Logger

It seems that Log4J is a de facto logger for the Java Developer community. Automatically, the Log4Net gets all the limelight since it is a direct port from Log4J.

It is unbelievable that the project page (url below) does not provide helpful tutorials or something for people to kick start the logger. I suppose probably the developers of log4net assumed people who choose to use log4net are users from log4j. (well, at least not for me.)

http://logging.apache.org/log4net/

Let see, after some search. These are what I found.

(tutorial for ASP.NET users)
http://tom.gilki.org/programming/net/120604/


(explanation on the Log4Net, usage and design and structure)
URL

(another explanation,in layman terms)
http://www.donews.net/shanyou/archive/2004/12/16/204289.aspx

(Console example)
http://www.codeproject.com/csharp/log4net_intro.asp

http://www.codeproject.com/csharp/log4net_intro2.asp

Coding Standard Enforcer Tool

http://www.flexisoftsolutions.com./

Only for VS5/6 and VS.NET

GOF Codesmith Template

In refer to my previous post on the Jan 18, 2005. One of the tools, codesmith, and below a cool template for GOF.
http://www.ericjsmith.net/codesmith/forum/default.aspx?f=9&m=4640


C# 2.0 language features

A tutorial to connect to open source project with WinCVS.

Image
(quoted from http://www.compiere.org/technology/build.html)

Reason I copy all over to my blog is that overtime I notice many web sites will be either dissapeared, content changed or URL broken after some times. Just do not want to search here and there again for the same stuff. Therefore I just place the whole thing here for my sake of future references. The credit should still be all dued to the real authors.


These are the steps to build Compiere from Source:Download the CVScompiere-all module (details see below)In the utils-dev sub-directory customize the myDevEnv.bat fileexecute RUN_build.batWe internally use Eclipse, but you are able to use any IDE or Java development environment to build Compiere form Source.Please note that there is a delay between the CVS commit and it's availability in anomynous (general) CVS access - up to 24 hours according to SourceForge. Usually it does NOT create a problem, but it has resulted in compile errors. In that case, please re-down…

Ten Must-Have Tools Every Developer Should Download Now (.NET)

The URL

It basically introduces,

Snippet Compiler Regulator (regex tool)CodeSmithNUnit (unit tester.)NUnit: http://www.nunit.org/http://www.csunit.org/ (an alternative to NUnit)NMock : http://nmock.truemesh.com/http://sourceforge.net/projects/dotnetmock/http://www.mockobjects.com/NUnitForms http://nunitforms.sourceforge.net/download.htmlThe Humble Dialog Box
Lutz Roeder's .NET Reflector (ildasn advanced) http://www.aisto.com/roeder/dotnet/
FxCop
NDoc
NAnt (.NET based builder)ASP.NET Version SwitcheProject Convertor

.NET Memory Profiler

Found this

http://www.scitech.se/memprofiler/snapshotviews.htm

in the forum. Seems like it capable to be used to optimize the .NET application.


Moving Forward >>> .NET Reality Check

(quoted from http://forums.sgdotnet.org/ShowPost.aspx?PostID=3281)

Hello,

To follow up with my previous email about the deprecation of SOAPFormatter in .NET 2.0, I am wondering how many ppl here uses heavy-duty remoting in their projects. If you are, how are you securing that channel ? Are you using Custom Sinks for that ? Or are you using Enterprise Services ? If you are using Custom Formatters and Sinks, please minimize the use of it as it is NOT a strategic step moving forward.

The reason why i am asking is because Microsoft's focus is on Web services, Remoting is not getting a whole lot of new features going forward. Thus, it is not a long-term strategic technology. The deprecation of SOAPFormatters is just the beginning. To move forward to Indigo which will significantly change a lot of things (for the better...), it will also change the way you look at XML Services. Notice that I dropped the word "Web"...You may also need to change the way you look at communication..…

Ways to prevent virus (manually without AV)

A hands-on knowledge for anyone who wants to prevent virus attack manually.

http://msdn.microsoft.com/msdnmag/issues/03/05/VirusHunting/default.aspx




COM spying tool

http://www.ddevel.com/DrCOM/DrCOMMonitor.asp

Hope this will solve some of my COM debugging problems.


From Microsoft Developer Guide - Signing Assembly

Happen to read the Microsoft Developer Guide that my colleague received in the Ms Technet in Sunway Pyramid. Found a few useful tips. (well, although this could be easily found in MSDN or by googling) But want to jot it down for my future references.


Create a key pair and sign the assembly


Sign assembly. Run “sn” utility, add the key file by hand, or use IDE to generate strong name.

1. In the solution explorer, double click on the AssemblyInfo.vb and edit.
2. Modify AssemblyTitle and AssemblyDescription lines to be
- < Assembly: AssemblyTitle(“ClassName”) >
- < Assembly: AssemblyDescription(“.NET Version of PhysServer”) >

3. In the solution Explorer, right click project node, choose “Properties”. Click “Common Properties” folder and then “Strong Name” property page. Select box labeled “Generate Strong Name Using”. Click “Generate Key” to generate a key file and add to the project. Click OK then, build.


Register Assembly and create type library

Go to Ms Visual Studio .NET tools s…

Indenpendent Contractor How To

Bump into people blog and found useful stuff.

Independent Contractor

However, it is a bit US centric but I guess it still relavant.

Wikipedia

Wow, this site is really cool, it is free and it is HUGE in coverage.

http://meta.wikimedia.org/wiki/Main_Page

It supports a number of languages. I reckon this would probably replace all the commercial encyclopedias in the market in no time. At the same time I was enjoying this, I was also feeling worried as it is scary to see all those goodies, especially technology related, set to be free (as in no fees) which lead to non profit jobs and eventually backfire all the IT jobs. Sigh~


MLM

Well, just read some debates of MLM in a forum whether would it helps in making a fortune for an employee. My opinion is that MLM could not bring them far enough but only up to sustainable level.Only with solid R&D and export could do that. (my opinion of course)

Below are the facts taken from Herald Press. (quoted from the forum as well)

The 10 Big Lies of Multi-Level Marketing

Lie #1: MLM is a business offering better opportunities for making large sums of money than all other conventional business and professional models.

Truth: For almost everyone who invests, MLM turns out to be a losing financial proposition. Less than one percent of all MLM distributors ever earn a profit and those earning a sustainable living at this business are a much smaller percentage still.

Extraordinary sales and marketing obstacles account for much of this failure, but even if the business were more feasible, sheer mathematics would severely limit the opportunity. The MLM type of business structure c…

Working collaboratively with team members without the topography barrier

Image
Either through company VPN with source control server or with this Source Forge Enterprise Edition. (web version of source control whereby the source codes database (CVS) is hosted by sourceforge but not made public)




Optimizing Distributed Development™ SourceForge® Enterprise Edition is a secure, centralized, enterprise-grade solution for optimizing and managing distributed development. Whether teams are distributed across the building, the country or around the world, SourceForge provides an easy-to-use, web-accessible solution that: Integrates disparate tools and processesExpands visibility and controlImproves development efficiencyEmpowers collaboration and innovation Simply put, SourceForge optimizes distributed development by helping organizations deliver higher quality software in less time and with greater manageability and consistency.

open source project

Wow, what a patriot.

A open source project named "singapore"

http://sourceforge.net/projects/singapore/


Freelance

Was checking these freelance sites.

http://www.codelance.com/

http://www.scriptlance.com/

http://www.getafreelancer.com/

http://www.freelancewarriors.com/

It seems that what was mentioned in the web or press are true that many Indians are actively involving themselves into it. Just look at the number of Indian programmers in these sites. No wonder the number of IT graduates are decreasing globally except for India.




VB.NET and C# event

It is convenient to set up a handler for the controls in .NET, either C# or VB.NET, as compare to C++, Win32. Code snippet below.


VB.NET

Friend WithEvents oCombo As System.Windows.Forms.ComboBox
'expecting this control to have certain events to catch

Private Sub oCombo_OnMouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles oCombo.OnMouseUp
'the Handles function tell what event to handle

MsgBox("hello")

End Sub

C#

Public System.Windows.Forms.ComboBox oCombo;
this.oCombo.OnMouseUp+= new Windows.Forms.MouseEventHandler(this.OnComboMouseUp);

private void OnComboMouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
MessageBox.Show("Hello");
}




Gopher

Well, overheard someone saying RSS feed will be replaced by Gopher?
Curious but anyway, jot down this link for checking out the gopher.

gopher://gopher.floodgap.com/