November 23, 2005

Could not find a property

Error: Could not find a property named 'IDUser' on the type specified by the DataObjectTypeName property in ObjectDataSource 'ObjectDataSource1'.

Look at the properties for the ObjectDataSource and remove everything from DataObjectTypeName property and just leave that property blank; it will be RUN.
I hope this works for your ASP.NET 2.0 project on Microsoft Visual Studio 2005 Beta 2.0.

November 22, 2005

Connect to localhost

Connect to localhost

Error: The "Connect to localhost" that want USER/PASS for connecting to localhost
Error: "Connect to the localhost"
Error: "how to connect to localhost"
Error: I see the "You are not authorized to view this page"
Error: I can not "connect to the localhost"
Error: Unable to "connect to the localhost"

Problem:
- If you want to used the Microsoft SharePoint Services (after install) and it needs the password for Connecting to the localhost...
- If you want to load the SharePoint or the other web applications from "http://localhost" and it needs the password for Connecting to the localhost...
- If you are a .NET programmer and have installed VS2005 or VS2003 (with IIS) and the IIS is not at work and it needs password to Connect to the localhost...
- If you are a Web Application Developer and after running a sample project (such as a starter kit from Visual Studio .Net) it needs the password for Connecting to the localhost...

OK ... take it easy because you can remove your problem... You must just set your BROWSER SECURITY for your project or web application ... This is easy...

Solution 1:
- Find a small icon from the right-down corner of Internet Explorer Status bar and click on it. (If you haven’t status-bar ... turn it with View>Status)
- You can see the "Internet Security Properties" and you must click on the "Local Internet" and after that click on "Sites" Button and add your address ... Close and OK and Refresh and Enjoy

Solution 2:
I think that your administrator password is empty ... and the "Connect to localhost" dialog box can not accepted your user name ... OK ... take password for your administrator account...
For setting the administrator password follow below:
- Control Panel>Administrative Tools>Computer Management>"Local User and Group">Users>Right click on Administrator>Set Password
[OR]
- Run>compmgmt.msc>"Local User and Group">Users>Right click on Administrator>Set Password

August 19, 2005

Failed to save settings

Error: Failed to save settings: An error occurred executing the configuration section handler for userSettings/XYZ.Properties.Settings. (C:\Documents and Settings\Administrator\Local Settings\Application Data\amastaneh\XYZ.exe_Url_znuhtk3o00xt5ahfq5tlsmqqiclldnz5\1

I had a big problem with this error because every thing came normal but i had one error on Settings.Default.Save() method.
I think that, You can correct this error from app.config file.
I know that you wanna say this file is OK but i must tell you that i was like you, too.
However, you can test this way.
In this way you can build a sample application and then go to app.config and copy/past some line form first.
You must compare these codes with your uncorrected app.config file.
This is a section of my corrected app.config file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XYZ.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" />
</sectionGroup>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="XYZ.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
....
I hope this helps, Be happy.

August 18, 2005

Multilanguage Application

If you want to develope the Multi Language Application with newest Microsoft technology for supporting multi language feature then you can follow below:
New innovations in dot net technologies causes you not to need to add a new form for each language. You can have a form with multi configuration, image, and text … on interface.
Step 1: Insert New Form: Ctrl+Shift+A>WindowsForm
Step 2: Insert New Language: [On Form]RightClick>Properties>Design>Language>Select a new language like(French, Italy, US, Persian and ...)
Step 3: Insert New Language again: more and more...
Step 4: For Changing Languages you can use below
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("es-ES");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("it-IT");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fa-IR");
PS: this method is compatible with Microsoft .Net Framework 2.0 Beta 2 Compiler but I think that you can use this for old version and newest version of .net resealed.

July 12, 2005

NSIS Error

Error:
Installer integrity check has failed. Common causes include incomplete download and damaged media. Contact the installer’s author to obtain a new copy.

More information at:
http://nsis.sf.net/NSIS_Error

Error:
The installer you are trying to use corrupted or incomplete.


Solution:
run you exe file in CMD mode.
[FileName].exe /NCRC

Solution:
This could be the result of a damage disk, a failed download or a virus.
You may want to contact the author of this installer to obtain a new copy.
It may be possible to skip this check using the /NCRC command line switch (NOT RECOMMENDED)
If you have this error then you can go to Start>Run>cmd (or command for Win98 or ME)
and then go to your destination folder and run your setup (or any exe file) like this:
[FileName].exe /NCRC
for Example:
SharpDevelop_1.1.0.1964MayBetaRefresh_Setup.exe /NCRC

July 10, 2005

Express Manager

Do you have quistion like these? ;-)

- Where's the SQL Server Express Manager?
- I can't see the SQL Server Express Manager in start menu.
- I install the Microsoft SQL Server 2005 CTP but i havn't SQL Server Express Manager.
- I have just "Configuration Tools" sub menu in "Microsoft SQL Server 2005 CTP" at start menu.

The new Express Manager with considerable GUI(graphic User Interface) is seprated than Microsoft SQL Server 2005 CTP Package that come with Microsoft Visual Studio 2005 Beta 2.0 and you must download it from microsoft site.
This package is ExpressManager.msi with about "1004KB" size
Aftre install the Microsoft SQL Server 2005 CTP and Express Manager, you must enable SQL Server (SQLEXPRESS). for this work you can used of these two ways:

1- Start > Run > SQLServerManager.msc > SQL Server Configuration Manager (local) > SQL Server 2005 Services > SQL Server (SQLEXPRESS) > Right Click >Start

2- Start > Run > compmgmt.msc > Service and Applications > SQL Server Configuration Manager > SQL Server 2005 Services > SQL Server (SQLEXPRESS) > Right Click > Start

After that you must start the Express Manager from start menu.

In first look you see the "Connect to Server" form that must enter a "Server Instance" and then press Connect. (for example you can enter ".\SQLEXPRESS" in editbox)

Application: Microsoft SQL Server2005 Express Manager Preview 1
Version: 9.00.1116.00

Ok, wellcome to Microsoft® SQL Server™ 2005 Express Manager.

PS: If you don't like that type ".\SQLEXPRESS" for ever strat the Express Manager you can use of Express Manager Arguments.

-? Show the list of Arguments
-S server_name[\instance]
-d database
-U user_login
-P password

Start>Run>C:\Progra~1\Micros~4\XM.exe -? (for show the all Arguments)
Start>Run>C:\Progra~1\Micros~4\XM.exe -E -S .\SQLEXPRESS (for start without command)

Or you can edit your shortcut and insert new Arguments at the last of the target field.
Start>\Microsoft SQL Server 2005 CTP>SQL Server Express Manager>RightClick>Properties>Taget>"C:\Program Files\Microsoft SQL Server 2005 Express Manager\XM.exe" -E -S .\SQLEXPRESS

May 30, 2005

Project Properties

Error: There was an error trying to load project properties window. Close the window and try again.
Object reference not to an instance of an object.

If you have this error and you can't load project properties and etc... Don’t worry! Because you have chance for continue your tasks without solving this error.
For example if you want to change your application's icon you must edit a XML base file in an editor (like notepad).
Go to your project directory and open [projectname].csproj (for example like WindowsApplication1.csproj) in notepad or any simple text editor.
You can see a part of a TEXT in XML format like below:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition="'$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.40607</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{CDBB5C9E-C36D-489B-A538-6FD750DE8CBC}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>WindowsApplication1</RootNamespace>
<AssemblyName>WindowsApplication1</AssemblyName>
<WarningLevel>4</WarningLevel>
<ApplicationIcon>app.ico</ApplicationIcon>
...
You can see the <ApplicationIcon>app.ico</ApplicationIcon> that can solve your Application Icon problem without loading the project properties page.
This XML file is so simple and you can solve more other problems with a little search;-)
After that, you must load your solution and compile it again.
This method is for Visual Studio Project 2005 (Whidbey) but absolutely can used for VSP2002 and VSP2003 and VSP2005Beta2 and I think that can be also used for Orcas (next generation of Visual Studio)
The mentioned points are for C# project but absolutely not different for VB.Net, J# and other .Net projects.

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 تکه کد بالا رو با اصلش مقایسه کنید.

January 29, 2005

Convert Image to Byte

[Error Prompt] Cannot convert type 'System.Drawing.Image' to 'Byte[]'

If you have this problem or you can't make casting convert Image to Byte Array in dotNet Solution, you can follow bellow:
[WRONG]
return (Byte[])imgLogoBuffer;
[RIGHT]
Byte[] btImageLogo = new Byte[1];
[RIGHT]
return btImageLogo = (Byte[])(new ImageConverter()).ConvertTo(imgLogoBuffer, btImageLogo.GetType());
بابا جان هر چی رو که نمی شه با cast کردن تبدیل کرد. راه حل بالا بد نیست. گرچه راه زیاد است برای رسیدن به بایت های یک تصویر

Microsoft .Net Security

Microsoft .Net Security Information
This application is running in a partially trusted context. Some functionalityin the application may be disabled due to security restrictions.

If you this error prompt on running an application, you can follow below

Administrative Tools>Microsoft .NET Framework X.X Wizards>Adjust .Net Security>Make changes to this computer>Internet and set it to Full Trust

اگر شما مشکل فوق رو دارید و نمی تونید یه برنامة دات نت رو تو شبکه راه بندازید باید یه سری به Adjust .Net Security از Framework Wizard بزنید.

January 02, 2005

Highlight Text in HTML

Search and highlight some words in HTML Text with out changing in HTML BODY TEXT.
For this, you can use of one function in client side with JavaScript.
In below sample you can see that all "windows" word highlighted after line.
We use this way from Google site ;-)
<script> 
function hl(w) 
{ 
    if (document.body &&amp;amp; document.body.createTextRange) 
    { 
    var rng = document.body.createTextRange(); 
    rng.moveToElementText(document.all.start); 
    while(rng.findText(w,1,2)) 
        {rng.pasteHTML("<span style='color:black; background-color:#ffff88'>" + rng.text + "</span>"); rng.collapse(false);} 
    } 
} 
window.onerror=new Function(';'); 
</script> 
<body onload="hl('highlight'); hl('windows');"> 
This is a sample with highlight function. In this sample Windows is highlight. this methid have a client side highlight process that use Java Script. 
<hr id=start> 
This is a sample with highlight function. In this sample Windows is highlight. this methid have a client side highlight process that use Java Script. 
</body>

یک راه برای Highlight نمودن یک کلمه در تمام متن یک HTML همون راه احمقانه ای است که خودم رفتم ... اونم اینکه بنشینید با کلاس های مایکروسافت برنامه اون رو بنویسید .. یعنی متن رو بخونین و بعدش با تشخیص تگ های HTML به اون کلمات پیدا شده توسط تگ span رنگ پس زمینه بدین .. با این کار علاوه بر Highlight شدن کلمات در یک HTML رفتگانتون هم جلوی چشمتون میان ...
اما راه بهتر استفاده از Java Script هستش .. این هم نمونه کد که از روی Google کش رفته شده. در مثال بالا و توسط این روش کلمه Windows در تمام متن بعد از خطی که توسط hr کشیده شده Highlight می گردد.