May 13, 2005

Metro

If you want to release a new version of your "printer driver" or you are a "printer driver developer" there is the Microsoft newest technology. I'm so glad to tell you that "Metro Print Path" is a newest technology print path for document that is so closed to the Avalon graphics engine. Metro Print Path is a print path that will be put in the next client version of Microsoft® Windows® (Longhorn).
Metro uses the most of the newest technology such as XML, Unicode, ZIP and etc all together.
In a word METRO is An advanced print format such as Adobe PDF and more that.
The METRO enhancements the printer driver architecture and the New print paths from the application to the printer.
Among the benefits that the new architecture is expected to provide are:
• Improved performance
• Support for extended color spaces
• Improved fidelity (providing an efficient printing pipeline for handling advanced graphics such as transparency and smooth gradients)
• Integrated document security (incorporating support for digital signatures)
• Enhanced user experience
If you have questions about the Metro print path send e-mail to prninfo@microsoft.com.

PS1: Sample MetroDrv driver code is planned for Longhorn Beta 2.
PS2: A draft version of the Metro format specification is planned for publication early in 2Q2005.
PS3: The metro print path does not support Postscript pass through
PS4: Microsoft provide a framework for applications to access or share private printer settings.
PS5: Microsoft resolve the plotter form size limitation in the Metro print path.
PS6: Microsoft provide a reference implementation for a Metro raster image processor (RIP).

[doc] Metro_FAQ.doc: http://download.microsoft.com/download/5/D/6/5D6EAF2B-7DDF-476B-93DC-7CF0072878E6/metro_FAQ.doc
[doc] Metro_support.doc: http://download.microsoft.com/download/5/d/6/5d6eaf2b-7ddf-476b-93dc-7cf0072878e6/Metro_support.doc
[link] Windows Printing Architecture and Driver Support: http://www.microsoft.com/whdc/device/print/default.mspx
[link] Metro format specification: http://www.microsoft.com/whdc/device/print/metro.mspx
[link] Metro FAQ page: http://www.microsoft.com/whdc/device/print/metro_FAQ.mspx
[link] Office Online File Converters and Viewers: http://office.microsoft.com/en-us/assistance/HA010449811033.aspx
[link] WinHEC 2005 Conference Presentations and Papers: http://www.microsoft.com/whdc/winhec/papers05.mspx
[link] My favorite page about Windows Driver Foundation: http://www.microsoft.com/whdc/driver/wdf/default.mspx


شاید به فارسی خیلی نشه چیز زیادی گفت جز اینکه وقتی شنیدم Adobe داره Macromedia رو می خره حس کردم که احتمالا باز یه خبری شده. آره باز این مایکروسافت افتاده به جون این شرکت ها و این بار داره پوزه PDF رو به خاک می ماله.
البته باید واستاد و دید چون جدیدا مایکروسافت مثل بیل خیلی پیر شده و سخت می تونه حال این و اون رو بگیره .. نمونش همین گوگول، iPod و چند تا چیز کوچولوی دیگه.
از صمیم قلب امیدوارم که این بار بیلی از صندوقش چیز معرکه تری بیرون بیاره نه مثل XP.

April 21, 2005

Convert from byte[] to string


Do you have this compilering error message?
"Argument '?': cannot convert from 'byte[]' to 'string' ???.cs" with .Net Compiler .Net 1.0 or .Net 2..0?
Do you have any problem for converting between 'byte[]' to 'string' (from 'byte[]' to 'string' or from 'string' to 'byte[]')?
Ok! Don’t worry.
You can use Encoding class (library).

In this example ABC is the name of a project and A01 is a resource with byte[] format.
String strTest = Encoding.ASCII.GetString(ABC.Properties.Resources.A01);
Byte[] bytTest = Encoding.ASCII.GetBytes(strTest);
So easy! Yes?
عجیبه باز یادم رفت که باید تو این دات نت همش از انکدینگ و دیکدینگ استفاده کنیم.
دوتا مثال بالا مثل روز راه رو نشون میده (یه چیزی هم روش!!!)

March 16, 2005

Verbs in C# Whidbey

Error: Verbs Error: no suitable method found to override.
If you have the "public override DesignerVerbCollection Verbs" problem in your UserControl's Class (in C# 2.0 or C# 2005) then you must use an "internal class" of "ControlDesigner" similar to your UserControl's class because the UserControl dose not contain the Verbs property and the "public override DesignerVerbCollection Verbs" can't accept the override method.
The brilliant way to insert a new item in the Actions Menu in the design mode for your UserControl(s) is to use the "internal class" after your UserControl class.
For example:

internal class MyControlDesigner : System.Windows.Forms.Design.ControlDesigner
{
    private DesignerVerbCollection m_pVerbs = new DesignerVerbCollection();
    public override System.ComponentModel.Design.DesignerVerbCollection Verbs
    {
        get
        {
            if (m_pVerbs.Count < 1)
            {
                m_pVerbs.Add(new DesignerVerb("About", new EventHandler(this.heoAbout_Click)));
            }
            return m_pVerbs;
        }
    }
    private void heoAbout_Click(object sender, EventArgs e)
    {
        MessageBox.Show("You're Successful");
    }
}
But this is important that you must show this class to the Runtime Designer, with like this code:
[Designer(typeof(MyControlDesigner))]
You must put this code to top of your master UserControl class.
Please, attention to this: System.Windows.Forms.Design
If you don't have this reference in your Project's References you must add it.
خب راستش بدجوری تو گل گیر کرده بودم تا اینکه راهش پیدا شد. یک پروژه تو 2003 را به 2005 بیارید و بعد از Convert شدن خوب بررسیش کنید. اصولا اغلب تغییرات رو می شه از همین روش پیدا نمود البته تا زمانی که یه help درست حسابی براش بیاد. اگه متن بالا رو هم بخونید متوجه می شوید که چه راحت می شه یک Verb override نوشت تازه کلی هم به کلاس برنامه اضافه می شه :)) خوش باشید.

LLBLGen Foreign Key problem

If you have a problem with FOREIGN KEY(s) in LLBLGen application, you can follow this way:
LLBLGen creates a big table of your database information with one ALTER PROCEDURE that can you find it on their codes. The "IsForeignKey" field is showing the "FOREIGN KEY" that it might be wrong. To solve this problem you can go the source code and correct the "PROCEDURE" just with putting one "TOP 1" in before every "SELECT" like this:
string sSQL = "SELECT INFORMATION_SCHEMA.COLUMNS.*, (SELECT COLUMNPROPERTY (OBJECT_ID (@sTableName), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsComputed')" + ") AS IsComputed,(SELECT COL_LENGTH(@sTableName, INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME )) AS ColumnLength, (SELECT " +"COLUMNPROPERTY (OBJECT_ID(@sTableName), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsIdentity')) AS IsIdentity,(SELECT" + "COLUMNPROPERTY(OBJECT_ID(@sTableName), INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME, 'IsRowGuidCol')) AS IsRowGuidColumn,(ISNULL(" + "(SELECT TOP 1 1 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME=@sTableName AND TABLE_SCHEMA='dbo' AND COLUMN_NAME=" + "INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME AND EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME=@sTableName " + "AND TABLE_SCHEMA='dbo' AND CONSTRAINT_TYPE = 'PRIMARY KEY' AND CONSTRAINT_NAME = INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME)" + "), 0)) AS IsPrimaryKey,(ISNULL((SELECT TOP 1 1 FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = @sTableName AND TABLE_SCHEMA='dbo'" + "AND COLUMN_NAME = INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME AND EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE TABLE_NAME = TABLE_NAME=@sTableName AND TABLE_SCHEMA = 'dbo'" + "AND COLUMN_NAME = INFORMATION_SCHEMA.COLUMNS.COLUMN_NAME AND EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE " + "TABLE_NAME = @sTableName AND TABLE_SCHEMA='dbo' AND CONSTRAINT_TYPE = 'UNIQUE' AND CONSTRAINT_NAME = INFORMATION_SCHEMA.KEY_COLUMN_USAGE.CONSTRAINT_NAME)" + "), 0)) AS HasUniqueConstraint FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = @sTableName AND TABLE_SCHEMA='dbo'";

داستان اینه که با یه "TOP 1" در وسط سورس کد برنامة LLBLGen مشکلش با 'FOREIGN KEY' ها حل می شه. پیشنهاد می کنم قبل از Copy/Paste تکه کد بالا رو با اصلش مقایسه کنید.