August 2006 - Posts

Un-titled Opinion for ISVs!

Some AppServer or middleware products are very complex to build. Those require millions lines of code and hundreds of man hours. AppServer or middleware are also very advanced in term of architecture and critically required some hidden-ancient (sometimes undocumented) knowledge like understanding of OS level services and API. In Indonesia, those types of products are rarely being developed. Even though potentially can rises bigger ISV revenue, the challenge is not about market demand. In period when distributed, SOA and SaaS coming back as trends (like now), market is demanding. I believe that the reason is not around market demand, but simply because we don’t have many skilled developers and architects in that field. What we have in Indonesia is library users, code re-users, and so on. The key word here is "users". I prefer to use "programmer" instead of "developer" for such kind of coders.

Principal vendors try to simplify the complexity for programmers. They make many abstraction layers to change the programming models. They help programmers in solving problems without facing too many complexities. Such abstraction layers (collection of system building blocks) need interaction models (protocols) to formalize system behaviors on top of hardware resources. We work on top of n-th layers.

Over the last 30 years after the PC period came up, we have a lot of layers and models. Too many because the business war is around models that gaining # of layers. Everything we have done is to increase productivity in solving business problems. Can you imagine in what layer you work on the top of your machine’s hardware??? I even don’t know how to explain Raffy about XAML markup starting from silicon semiconductor based transistors, hardware (CPU, RAM/ROM, IO Devices) and so on. Lets Uncle Petzold explain him with Petzold’s famous book, Code.

My key point here is layers and models makes difficult for someone to decide where to start concentrating the learning effort. Imagine when you have to advice your son when he asks, "Papa, What should I learn??" Electrical Engineering, Computer Science, Math of Theoretical physics, Law, or just Singing to become Indonesian idols” (I had a war with my wife when I voted Dirly over Ihsan)?? If you prefer fast $$, you should advice Law, because in Indonesia that is demanding. Difficult question, isn’t it? Let say, after your son decided Computer Science, many other questions will rise, for example, what programming language is the best?. Son, I will answer your question with consultant's argument, it DEPENDS!. Then what ever you choose, you should learn how to ship a product (not only for software product). Come on,... Inul Daratista has product (don’t have to mention it here).

Well, lets back to previous complexities. I always like to start at the lowest level by gaining a solid understanding of the systems building blocks. Once he understands the basics, it's easy to incrementally add any higher level aspects of the system to his knowledge. I watched in National Geographic, how ancient Egypt people built PYRAMIDS. They don’t have technologies at that time. They had Project Owner (The King), Architect, Project Manager, Developer and Tester. They do implemented methodology with a pyramid vision and plan and iterate through the work items in cycles. They were able to built and constructed failed and successful PYRAMIDS. Think about Pyramid basic building blocks, qubic rock!!!.

When I was in High School, I saw some traditional engineers in my homeland (Makassar) who built PHINISI boat. Do you know what? First, they had to choose some trees with their metaphysics knowledge. They cut and sliced the wood and make PHINISI’s basic building blocks from it. They knew and used some patterns to construct PHINISI later on. Their architectural knowledge is hidden-ancient knowledge because it was un-documented. It was and always inside the brain of PHINISI developers. The history has proved that developers in Makassar shipped many PHINISI to worldwide market. The same thing also happened for traditional boat in Bali.

"We are the country of developers!!". If we can ship products hundreds years ago, why we can’t do that today with Software? Lets back to the basic building blocks and start building and constructing worldwide shipped products!!. I believe Software is not more complicated comparing to AMMANAGAPPA and PHINISI boats.

My Bina-ISV friend Wawan Sugiri (not son of Toto Sugiri) is now building Vista (.NET 3.0) product for Q-Pro. Friends from Intellisys also do specific segment accounting product. I started to feel the spirit and energy in this community and I believe one day, it will happen again. If you see in Detikinet, Government started a tender to provide better internet connectivity for Indonesia. That will be GREAT!!!!. Let’s start to learn how to ship products.

Share this post: | | | |

My Presentation Slides

Here is my slides for the incoming events. You can download it before attending.

Community inTouch | ASP.NET Security , Sept 2, 2006
- Security Processing of HTTP Request

.NET Curriculum Workshop, Aug 29, 2006
- Inside .NET CLR
- .NET Remoting

ETF Surabaya, Augt 31, 2006
- .NET and J2EE Interoperability for Multiplatform Enterprise
- The Essentials of Service Orientation

TechEd SEA, Sept 5, 2006
- Code Optimization and Analysis with Phoenix, Not available yet

Ciao
Share this post: | | | |

Phoenix DLL Phase Plug-In

Phoenix supports modular compiler phase design. It allows us to select phases that we want invoked including core processing phases in Phoenix framework. In addition, Phoenix supports the ability to customize the phases invoked via a managed DLL plug-in. The DLL phase plug-in can manipulate the phase list as it sees fit: inject new phases, remove or replace existing ones, and so on. Phoenix execution engine pre-scans the control list for any DLL plug-ins; if the control list contains plug-ins, the engine loads the associated DLLs to extend the infrastructure.

There are two Phoenix entry points required for a DLL phase plug-in:
-
RegisterObjects
- BuildPhases

These methods must be contained in a public class derived from Phx::PlugIn. Here is the basic template:

public class MyPhxPlugIn : Phx.PlugIn
{
   public override void
   RegisterObjects()
   {
   }

   public override void
   BuildPhases
   (
      Phx.PhasesContainer obj
   )
   {
   }
}

Share this post: | | | |

Phoenix Garbage Collector

Conservative GC like Boehm-Demers-Weiser can be used as a GC replacement for C malloc or C++ new. You can allocate memory basically as you normally would, without explicitly deallocating memory that is no longer useful. The collector is also used by a number of programming language implementations that either use C as intermediate code, want to facilitate easier interoperation with C libraries, or just prefer the simple collector interface. Alternatively, the garbage collector may be used as a leak detector for C or C++ programs, though that is not its primary goal. Empirically, this collector works with most unmodified C programs, simply by replacing malloc with GC_malloc calls, replacing realloc with GC_realloc calls, and removing free calls. You can download it from Hans J. Boehm website. If you compare it with SSCLI GC codes, you will have better knowledge how technology improved over the last 10 years. Both, you will find some *.asm, *.h, *.c, and *.cpp extension codes, and have fun with it :). 

Modern runtime GC manages the allocation and release of memory for all managed programs. Each time a managed program creates an object, the runtime allocates memory for the object. Eventually, however, repeated allocations stretch memory resources and the runtime Garbage Collector performs a collection so that it can release some memory. The Garbage Collector can release any memory that is no longer used by the running program. You can learn GC model for .NET Framework from Shared Source CLI Essentials.

The Phoenix compiler helps identify the set of managed objects that are still in use by the method at a collection point, based on information tracked by the GC Tracker and based on code processing points the GC designated as safe for collection. The GC Tracker tracks object lifetimes, and performs the analysis necessary to decide which objects can no longer be accessed. The Phoenix infrastructure provides a general framework to support compilation requirements for runtime Garbage Collection (GC). So,
Phoenix supports GC Code generation, GC Tracking and Reporting and Encoding GC Tables. In addition, the Phoenix framework is parameterized to support multiple target and runtime implementations.

Share this post: | | | |

Phoenix Input and Output Components

Most of LOB developers don’t have a clear understanding what is inside DLL/EXE even though they have done it with managed or native compilers. One job of compilers is to produce PE/COFF for your OBJ/assemblies. If you know what's inside your OBJ/assembly, you'll find that you've become a better developer all around. To Windows, .NET assemblies are just plain old Win32 executable files like native DLL/EXE because it has PE/COFF. However, CLR recognizes data within assembly as metadata and IL.

PE (Platform Executable) File Format is a part of Win32 specs. Some people believe that Windows’s PE COFF derived from VAX/VMS format but I don’t really believe that because I never use VAX/VMS. Our compilers, what ever it is (ML,CL, CSC, C2), will produce DLL/EXE/CIL, that use PE/COFF format (PE32 for IA-32 and PE32+ for IA-64). The distinction between EXE and DLL files is entirely one of semantics. They both use the exact same PE format. The only difference is a single bit that indicates if the file should be treated as an EXE or as a DLL. Data structure of PE files in disk is exactly same with in memory. Loading a DLL/EXE into memory is primarily a matter of mapping certain ranges of a PE file into the address space. The key point here is if you know how to find something in a PE file, you can almost certainly find the same information when the file is loaded in memory. I recommend you the following MSDN articles to inject better understanding around PE/COFF in your brain.

- An In-Depth Look into the Win32 Portable Executable File Format Part 1
- An In-Depth Look into the Win32 Portable Executable File Format Part 2
- Peering Inside the PE: A Tour of the Win32 Portable Executable File Format
- The Common Object File Format (COFF)

Knowledge on PE/COFF will help you to utilize Phoenix as it has input and output components to handle CIL, PE files, COFF, MSIL, assemblers, and so on. Below is the input-output components in Phoenix.

PE Reader
The PE Reader converts a Microsoft© Portable Executable (PE) binary image file into Phoenix Intermediate Representation (IR). The Phoenix infrastructure can then perform static analysis on the IR, instrument the IR, and/or write a new binary.

MSIL Reader
The MSIL Reader generates high-level intermediate representation for a variety of configurations, including Just-in-Time (JIT) compilers and NGEN.

CIL Reader
The C/C++ Compiler Intermediate Language (CIL) reader for Phoenix compilers provides a basis for native compilers. The CIL Reader reads CIL input files produced by the C/C++ front end and generates Phoenix Intermediate Representation (IR).

COFF Object File Writer
Phoenix compilers produce common object file format (COFF) object files as output. For more information on COFF object files, see Microsoft® Portable Executable and Common Object File Format Specification, Revision 7.0, September 2001.

PE Writer
The PE Writer feature writes Microsoft Portable Executable (PE) and PE32+ file formats. Microsoft Windows, Windows CE, and the Common Language Runtime (CLR) use PE and PE32+ format files. 32-bit architectures such as the x86 and ARM use PE format files. 64-bit architectures such as the I64 use PE32+ format.

I strongly recommend you to see the implementation codes of .NET Framework in SSCLI distribution. You will have a fun research as I had. Start from ILASM, ILDASM, CSC source codes, GC, M2, etc. Have fun with it. Your PC will become a big LAB for you after that :).

Share this post: | | | |

Memory management (M2)

M2 maybe the most difficult tasks C++ developers face. Problems like dangling pointers and memory leak will become big risk for your shipped applications. M2 is the art and the process of coordinating and controlling the use of memory (RAM or ROM). M2 can be divided into three areas:

- M2 hardware (MMUs, RAM, etc.);
- Operating system M2 (virtual memory(1), protection);
- Application M2 (allocation, deallocation, garbage collection).

I found a very good website contains informations about M2. If you are a serious C/C++ developer, I think you must visit and learn from it:
http://www.memorymanagement.org. Other useful links from MathTools also interesting. If you are exploring GC like me, I suggest you install SSCLI 2.0 and learn other people thing around GC like this one.

Share this post: | | | |

Learning Algorithm

This is a collection of usefull link from MathTool.
Share this post: | | | |
Posted by Risman Adnan Mattotorang | with no comments
Filed under:

Phoenix | High Level View

I just scanned my hand written paper and looks okay :). It describes what phoenix means to me.

What is Phoenix ? 

Click on the picture for some explanation. My other suggestions are, try to download Phoenix from here and see how Uncle Jim described it from Channel9 .

Share this post: | | | |

.NET Curriculum Workshop | Aug 29-30, 2006

We are going to Bali again :). Can you imagine write your codes at Bali? Learn new things at Bali? .NET CURRICULUM WORKSHOP 2006 is there.

This is for faculty members who teach programming and want to know how .NET really works. We will cover .NET runtime, GDI, remote object and robotics studio.

For Registration (FREE for Faculty Members):
Contact Mr. Ngurah Indra atau Ibu Linawati
Telp./SMS: 08123659213 (Indra) ; 081338652093 (Lina)
Email:
linawati@gdlnunud.org atau indra@unud.ac.id

Agenda

Day 1, Agustus 29, 2006
08.30 – 09.00 – Opening From Udayana University
09.00 – 10.30 – Inside .NET Common Language Runtime, Me 
10.30 – 12.00 – GDI+ and Accessing C# Compiler from Code, Uncle Zeddy
12.00 – 13.30 – Lunch Break
13.30 – 15.00 – Inside .NET Remoting, Me
15.00 – 15.30 – Break
15.30 – 17.00 – Technical Preview of Microsoft Robotics Studio, Uncle Zeddy

Day 2, Agustus 30, 2006
09.00 – 17.00 – Hands on LAB

See you there !!!

Share this post: | | | |

MASM32.COM

Check this out :

www.masm32.com

MASM32 assumes that the programmers who will use it already have experience in Win32 API programming using compilers and have done some work in assembler. It is not designed as a beginners package and it does not have the support for beginners to learn the basic concepts about assembler.

Share this post: | | | |

Phoenix #1

Introduction to Phoenix. 

Uncle Kangsu Gatlin wrote the first article on Phoenix http://blogs.msdn.com/kangsu/archive/2005/11/16/493744.aspx. I suggest you go to http://research.microsoft.com/phoenix to get more information on Phoenix.

With Phoenix we can write an application that loads an EXE and raises the machine code into the Phoenix IR. From IR we can add a new function call at entry to each function. After this, we can instruct Phoenix to lower the modified IR back into an executable file.  That is a research project based on Phoenix, Phx.Morph which is a static byte-code weaver that enables Open Classes and Aspect-Oriented Programming for .NET.


Phx.Morph is written in C# and built on top of Phoenix. It
supports:

+ Open Classes (aka static crosscutting, introductions, intertype declarations)
   + Add fields
   + Add methods
   + Add properties
   + Add base iface
   + Add base class
   + Replace methods
+ Aspect-Oriented Programming (AOP)
   + Advice types: before, after
   + Pointcuts: execution, call, get, set, within, withincode, this, target
   + Joinpoint context: This, Args, Annotations, SourceLocation, Signature,
     Within, Kind, Target
   + Statement Annotations

Thx

Share this post: | | | |

Phoenix C2.EXE

C2.EXE is a compiler backend that is compatible with the CL.EXE. C2 has three major components:
- Driver
- Phoenix core
- Target.

Unmanaged builds statically link these three components into one executable. Managed builds create these three components as separate Microsoft Intermediate Language (MSIL) assemblies. 
C2 compiler accepts a set of command-line flags as input. The flags specify compiler options and indicate the location of Microsoft Compiler Intermediate Language (CIL; not to be confused with the ECMA CIL which we refer to as MSIL) files produced by the compiler front-end. The primary output of the C2 compiler is a Common Object File Format (COFF) object file. 

C2 compiler can run standalone. To do this you must first run the C2 compiler as part of an overall compilation to get the necessary flags from the driver, and to get the front-end to create the appropriate Compiler Intermediate Language (CIL) files. You can use the -Bz switch to show the compilation steps without executing them.

I am exciting to have the opportunity talking about this at TechEd SEA Kuala Lumpur.

Share this post: | | | |

TechEd SEA

See you on TechEd SEA at Kuala Lumpur, we will discuss about Phoenix ().

Code Optimization and Analysis with Phoenix Framework.

Share this post: | | | |

ASP.NET Infrastructure and Machinery

Some of us think ASP.NET 2.0 application as a collection of pages and user controls (markup) and codes that will be compiled by ASP.NET runtime through on-demand and pre-compilation (aspnet_compiler.exe). Actually, many things happen before a HTTP request can reach the destination page class with in the assemnly. This including ISAPI filters, ISAPI extension, Worker Process, AppDomain, ASP.NET Pipeline, ASP.NET Http Handler etc. I delivered this topic to some of ISVs since yesterday and I found that knowledge around infrastructure and machinery are critical important to construct better web applications.  Today I just finished our last HOL to create simple HTTP Handler that responds to *.sqlx (XML query) files and return modified HttpContext object to browser. We also did simple HttpModule to add simple message on HttpContext through BeginRequest and EndRequest.

I hope you enjoy Bina-ISV training as I enjoy coaching you.



Share this post: | | | |
Posted by Risman Adnan Mattotorang | with no comments
Filed under:
More Posts Next page »