How to Use FontTools Module in Python

Python
Python

Python comes with the great modules which you can use them to improve your application functionalities. Recently I felt in love with Python and trying to implement some of my daily usages with it. I was always interested in Unicode and Fonts so that I had a glance at Python abilities in these fields and I have to say that Python has a lot to say when it comes to these areas. It is really fantastic and powerful and you have access to whatever you want just a a peace of a cake. In this Article I show you how to use python abilities to save a font as an XML document. It may be wierd for you but sometimes it is necessary to check font tables and the rest of its information.

To start working with fonts it’s worth to add FontTools library to Python; it will extend your abilities to work with fonts. You can download it from here.

Each Python module has its own way for installation. Some of them only needs a simple copy to the appropriate folders and some of them should be installed. FontTools uses the second approach so that you have to follow the following instruction to install it in your Python.

  • Open Windows Command Prompt
  • Go to the folder you download FontTools
  • Write Setup.py build and press enter
  • Write Setup.pyinstall and press enter
Installing FontTools with Command Prompt in Python
Installing FontTools with Command Prompt in Python
Important Note: I first Installed My FontTools and Then take the above photo from my comand prompt so that the command reply may be different for the first time and the second. You just use the mentioned commands instead of considering provided replies by Python

Some lines will appear in your command prompt and then installation will complete within a minute. Now, to use this module in your application you have to load ( or  import or use ) this module in your application, so write the following command in your Python application just like other commands

[sourcecode language=”python”]
from fontTools.ttLib import ttfont
[/sourcecode]

Note that commands are case sensitive so write it in the exact mentioned way.

Till now you are able to use FontTools abilities in your application so that to test it we create a font object and then get a simple export from it.

To create a font object in Python write the below command in your application; just note that you have to use for slash instead (/) of back slash (\) for addressing

[sourcecode language=”python”]
font = TTFont("d:/fontname.ttf")
[/sourcecode]

Till now you created a new object of your font in the object named font. It’s time to use it in our application so that I save the font as an XML document just like

[sourcecode language=”python”]
font.saveXML("d:/YourDesireName.xml")
[/sourcecode]

Save a Font As XML with Python FontTools Module
Save a Font As XML with Python FontTools Module

You can find the rest of the FontTools commands in the documentation. Share your experiences with me if you know another good library to work with fonts.

How to publish Asp web sites with command prompt

I wanted to run a Continues Integration for my company and I set up Team City at first. It is a great application which works very nice and I configured it easily. Unfortunately our portal is one of the old asp.net website so that I couldn’t use Team City to publish my website because it work just with Web Application.

Then I try to use MSBuild for compiling and publishing my website and it wasn’t a good solution in order to the type of projects. Finally I had to use AspNetCompiler. It is a compiler to publish and build Asp.net website and you have to customize it to work with your project. Here are steps in which I did to publish my website via command line.

1 – Create a XML file with desire name next to your Portal Solution (portal.sln). I use this name “AutomateBuildConfiguration.xml”.

2 – Then you have to configure this XML file with this instruction. For me following configuration was enough:

[source code=”xml”]
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="PrecompileWeb">
<AspNetCompiler
VirtualPath="/Web"
PhysicalPath="F:\Build_Automation\trunk\src\Portal\Web\"
TargetPath="F:\Build_Automation\trunk\src\Portal\PrecompiledWeb\Web\"
Force="true"
Debug="true"
FixedNames="True" />
</Target>
</Project>
[/source]

3 – You have to open one of the visual studio command line from this path :

StartMenu > All Programs > Microsoft Visual Studio 2008 > Visual Studio Tools > Visual Studio 2008 x64 Cross Tools Command Prompt.exe

I used a x64 system and chose above command line, you are free to use your own.

4 – change your path up to your XML file

5 – Use below command to publish your website

MSBuild AutomateBuildConfiguration.xml /p:Configuration=Release

6 – Enjoy your coffee, and after a while, It’s finished you already publish your website.

What is Page Method and How to use it

JQuery Logo
JQuery Logo

I don’t know have you ever needed to use a server side method in a client (JavaScript or JQuery) function or not? PageMethod is the answer for this question. Actually PageMethod is not a complicated method it is just a simple method with 2 differences.

  1. All Web Methods should be Static
  2. And you need to add a [WebMethod] attribute to the top of method

[sourcecode language=”csharp”]
[WebMethod]
public static void GetMyData()
{
// your codes …
}
[/sourcecode]

And that’s all. Your WebMethod is ready to use in client scripts. The good news is that you can use these methods in both of Web Services and Asp.NET Ajax.
How to Use WebMethods in Client Side Scripts? Or How to call a server-side method in JQuery functions?

[sourcecode language=”csharp”]
<script>
function SendForm() {
PageMethods. GetMyData ();
}
</script>
[/sourcecode]

Where this kind of methods can be useful?

Just think that you have a web application which needs keyboard short-cuts to be enabled. Or an Ajax modal which try to pass some data to other server methods and some other examples.

You can find a good article about it here

Downgrading Report schema version and Report Viewer Nightmare

Nightmare
Nightmare

In most cases upgrading applications is a good idea, but in this week we have to downgrade our Reports to an older version. The scenario is that We had some SSRS 2005 reports in the past and we upgrade those to SSRS 2008 reports, so we actually upgrade our Report definition schema from 2005 to 2008 which I wrote an article about it at the past. Currently we decide to convert our SSRS server reports to Visual Studio Client Reports which has some benefit for us, but unfortunately Visual Studio 2008 use Older version of report schema and the nightmare begun here.

—————————————————————-

GNU Logo
GNU Logo

‪Title : Downgrading Report schema version and Report Viewer Nightmare

‪Publish Date : 09/05/2010

‪Version : 1.0

‪Author : Nasser Hadjloo

‪Author Mail : n.hajloo@gmail.com

‪Copyright (c) 2010 Nasser Hadjloo.

‪Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation;

‪with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

—————————————————————-

SQL Server Reporting Services (all editions) and Visual Studio Reporting use ReportViewer control to display Reports, but it’s not the end, it’s just the beginning of a nightmare.

SSRS 2005 and Visual Studio 2008 & 2005 using 2005 Schema to create reports which is an older version of schema so that it missed some newer items which it’s obvious.

SSRS 2008 RDL reports use 2008 schema to create reports (in this schema we have some new features to create reports like Tablix or etc)

Visual Studio 2010 using Schema 2008 to create RDLC reports.

Report Viewer 2005 (& RV SP1) only understands 2005 schema and older versions.

Report Viewer 2008 understands 2005 schema and older versions. And there is no noticeable option which included in this version.

Report Viewer 2008 Service Pack 1, resolved some issues (installation and etc) and also apply some patches for some performance issues.

Report Viewer 2010, has a few limitation (won’t install in XP SP2 – only XP SP3 accept installation) but resolved all issues and works fine with Schema 2008. This version work very well with Asp.net Ajax and Ajax functionality like AsynchPostback and etc.

With these background, just imagine you have a SSRS 2008 report which implemented by schema 2008, and you want to convert it to VS 2008 Client Report which use older schema (2005). Following options may help to resolve the issue.

1 – Don’t Convert SSRS 2008 reports to VS 2005 or VS 2008 client report! Go and drink a cup of coffee.

2 – Convert SSRS 2008 reports to VS 2005 or 2008 reports and get rid of reports which may face with issues. (For example don’t convert reports which contain tablix or newer 2008 schema items).

3 – Create client reports from the scratch for those which face with issue.

4 – Upgrading VS 2008 reporting schema which I don’t find a solution for it. (take a look at here)

5 – Using Report Viewer 2010 with Visual Studio 2008, this scenario may resolve your common issues but in my case it wasn’t enough.

6 – Convert SSRS 2008 reports to Visual Studio 2010 client reports. (I think in most cases it would be the best option). It will work fine because VS2010 use schema 2008 for reporting system. But unfortunately this will force you to buy a VS2010 edition!

So what’s the best approach to convert SSRS 2008 report to Client reports?

First approach – to get rid of some reports and create them from the scratch with schema 2005

Second Approach – To use Report Viewer 2010 inside Visual Studio 2008

Third approach – to upgrade VS 2008 to VS 2010 and enjoy conversion, but you have to upgrade your host framework too.

In my case second approach was good enough to resolve issue, but I used third approach. In your case it may be a little difference and you have to make a decision.

I was also looking for a solution which let me upgrade VS 2008 schema version from 2005 to 2008, (see here) but there were no solution.

How To Convert RDL files to RDLC files

.Net use RDLC files for reporting and SQL Server (Reporting Services) use RDL files for reports files. In this Article we will take a look at RDL and RDLC files and also a way to convert RDL files to RDLC files.

—————————————————————-

GNU Logo
GNU Logo

‪Title : How To Convert RDL files to RDLC files

‪Publish Date : 06/05/2010

‪Version : 1.0

‪Author : Nasser Hadjloo

‪Author Mail :  n.hajloo@gmail.com

‪Copyright (c) 2010 Nasser Hadjloo.

‪Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation;

‪with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

—————————————————————-

Comparison

1 – Both of them use a same XML schema called RDL (Report Definition Language). SQL Server Books Online documented this schema completely.

2 – “The ReportViewer control, which processes .rdlc files, ignores the <Query> element of RDL. If a report definition contains a query, the control will not process it. So A client report definition (.rdlc) file will only contain a query if it originated as a .rdl file.” MSDN said.

3 – DataSet and Data Source which used in RDLC and RDL files are totally different. RDLC (Client reports) use DataSet which actually is a DataTable and RDL (SQL Server Report) use DataSource which consist of a Data Source (actually connection String). Some Credential Information which used to access Database mentioned in Data Source and finally a SQL Command (StoreProcedure – Function …) or a Query which retrieve data from Database.

RDLC Report
RDLC Report

How To Convert RDL Files To RDLC Files

1 – As I mentioned before, both of these files are using RDL schema for representing items in a XML document, so in XML conversion there is no change. All the things you have to do, is to change RDL postfix to RDLC, commonly by Command Prompt.

2 – After that you need to Add this Report as an existing item to your Web project. (commonly in a report folder like “~/SystemName/Reports”)

3 – Next step is to create a dataset for this report, so create a DataSet File and put equivalent columns on it.

4 – At this time you need a method to retrieve data from Database and fill data on your DataSet.

5 – As you know, there is a Report Viewer control (actually an ActiveX) which get a Report and display itto user. So you need to create a page and use Report Viewer control on it. After including Report Viewer Control in the page, you need to assign your Report (RDLC file) to Report property of Report Viewer control. And also to assign your Dataset to DataSource property of ReportViewer.

6 – At the end you have to build project and check the results.

I wish this help you to convert RDL to RDLC files as easy as possible.

How to Extend SSRS Functionalities

SQL Server Reporting Services is one of the best Reporting Services which is available today; it has lots of functionalities and is easy to use. Today I’ll show you a way to extend SSRS functionalities.

—————————————————————-

GNU Logo
GNU Logo

‪Title : How to Extend SSRS Functionalities

‪Publish Date : 26/04/2010

‪Version : 1.0

‪Author : Nasser Hadjloo

‪Author Mail : n.hajloo@gmail.com

‪Copyright (c) 2010 Nasser Hadjloo.

‪Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation;

‪with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

—————————————————————-

There are sometimes which you cannot do, your desire work with SSRS default methods and Functions. For example CDate, IIF and etc are some of default SSRS commands. But what if you like to add your custom method to it? For example you need a method which take a Georgian date and return Persian Shamsi date. What can you do in these cases? Fortunately SSRS is a flexible service and you can easily extend it.

To extend SSRS, you need to create a class with desire methods, for example a class with a ConvertToPersiandate(dateTime georgiandate).

After that you have to build the project and Copy your DLL into following paths.

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager\Bin
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin

These paths changed to following path in 2008 version

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportManager\Bin
C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin

The final step is to use it as a built-in SSRS command.
Just note that, you have to use complete Address for your method for example if you have these configurations

Name Space > Hadjloo.Web.Helpers.SSRS
Class Name > Converters
Methods in Class > ConvertToPersiandate(dateTime georgiandate) , ConvertToShortPersian (dateTime georgiandate) and etc

After That you have to add this DLL to your Report. To do this you should right click on the report and select Properties, then you should go to References tab and add this dll as a reference to your report.

SSRS 2008 Design Environment
SSRS 2008 Design Environment

Then in SSRS you have to use it like

=Hadjloo.Web.Helpers.SSRS. Converters. ConvertToPersiandate( First(MyGeorgianDate.value))

Note that in above case, First is a built-in command to get the first row value, and MyGeorgianDate is the DateTime field from the DataSet.

And also note that ConvertToPersiandate will have a red underline which is not important.

How To Import Javascripts on Asp.net Pages

I had a serious problem with some Javascript functions and I found that there is some way to import the scripts in your asp.net pages. And each one will act different than another one.

—————————————————————-

GNU Logo
GNU Logo

‪Title : How To Import Javascripts on Asp.net Pages

‪Publish Date : 02/22/2010

‪Version : 1.0

‪Author : Nasser Hajloo

‪Author Mail :  n.hajloo@gmail.com

‪Copyright (c) 2010 Nasser Hajloo.

‪Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation;

‪with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

—————————————————————-

As you all know Javascript is Script language which used in web pages to do some client activities. In addition Asp.net is a Server side Language which control users behavior on server and get necessary feedback to him/her.

With this background we understand that Javascript will do some thing on client, And there is two way to use javascripts code in Asp.net pages. Classic Asp ( .Net 1.0 ) used a bad scenario to work with scripts, It imports scripts insode of Asp page and every peace of script codes in every postback comes from server to client and it cause to increase page size. In this scenario all JS files putted on a HTM/HTML page and this page imported on Classic Asp page.

 

[sourcecode language=”html”]
<!–#include virtual="JS.htm" –>
[/sourcecode]

The <!–#include virtual=”JS.htm” –> is server side include, won’t work without certain configurations and is included by the server there and then already whereas javascript’s way is loaded into the page. Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclusively for the web. (You can get more info at Wikipedia )

The above code increase page size and end-user may got crazy. So there should be a good solution to reduce the page size. Asp.net use another approach to use scripts.

In Asp.net Pages Java script codes has a JS file template. And you can write your codes inside it, Then you can ipmort it in your Asp.net page and when Asp.net page downloads to users computer, JS files are downloading in users computer Temp directory.

This approach will reduce page size and let Asp.net page load much faster than classic Asp pages. So to do this, all you need is addresssing JS file in your Asp.net Pages.

 

[sourcecode language=”html”]
<script src="myjavascript.js" type="text/javascript"></script>
[/sourcecode]

 

The above code will download MyJavaScript.JS file tousers Temp Directory and every Asp.net pages which address it, will use this file. So you address every where anddownload just one file to users computer.

How to Change Asp.net Applications Theme programmatically

I’m interested to Localization and globalization and one of the important issues in localization is designing scalable UIs. in this Article I’ll show you a simple way to create a scalable Asp.net UI.

—————————————————————-

GNU Logo
GNU Logo

‪Title : ‪How to Change Asp.net Applications Theme programmatically

‪Publish Date : 30/12/2009

‪Version : 1.0

‪Author : Nasser Hajloo

‪Author Mail : n.hajloo@gmail.com

‪Copyright (c) 2009 Nasser Hajloo.

‪Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation;

‪with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

—————————————————————-

in ASP.net2.0 microsoft present SKIN and Themes for Asp.net, in a short introduction, skin is a CssClass replacement and with skin you can specify some attribute that one of them are CssClass, and these other attribute goes in a *.skin file in App_Theme folder.

this will shorten back-end asp codes and makes it more readable and reliable and vice versa. in the other hand, Theme is a multi UI approach for asp.net application, with Theme you can create some different UI for you asp.net Application (Control) and the designer or back-end users select his/her desier UI from provided theme. in a theme you can create multi css classes or some skin files and in each skin file you can create many skins for a single control.

so with this short introduction, you (a a designer) can create different theme for a single application. and also can create some RTL and some LTR UI for your application (I always recommand to change HTML Directionality inside your css classes in html class like ).

[sourcecode language=”css”]
html
{
directionality: ltr; /* or rtl – base on page direction */
}
[/sourcecode]

usually creating an impressive UI is not a simple job and Ido not want to speak about that. Ithink you have created some Theme and now you want to let users select their theme by ownselves.

by default each theme should represent to each page to apply, this is possible inside <%@ Page %> decleration. you can represent your custom theme with Theme=”” attribute of page decleration. this apply your theme only for this page. and this let you apply different themes for different pages.

note that you can not use this approach in Master Pages.

you can change the theme for a single page programmatically, just note that theme (and skins) apply on page PreInit event. this will be a nightmare if you have more than 20 pages (just think about 300 Pages). so it is recommanded to use a Base class that it derived from System.Web.UI.Page and other pages derive from this class, so your base class should look like this

[sourcecode language=”css”]
namespace Hajloo.Web.UI
{
public class PageBase : System.Web.UI.Page
{
void Page_PreInit(object sender, System.EventArgs e)
{
if (Session["Theme"] != null && Session["Theme"].ToString().Length > 0)
this.Page.Theme = Session["Theme"].ToString(); // user selected theme
else
this.Page.Theme = "Hajloo_RTL"; // default theme
}
}
}
[/sourcecode]

the above code will apply a theme to the inherited pages, so now you should inherit your pages from this class. and all of your pages should look like this

[sourcecode language=”css”]
namespace Hajloo.Portal.Pages
{
public partial class Default : Hajloo.Web.UI.PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
[/sourcecode]

ok this will let you to provide a section for you user to select your provided theme from a list or by clicking on an image (below you can see some diffent method witchall of them change the current theme), and only in one page you need to put this code (usually in master pages or user profile)

[sourcecode language=”css”]
protected void drpThemes_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.drpThemes.SelectedIndex > 0)
{
Session["Theme"] = this.drpThemes.SelectedItem.Value; // dropdownlist Items Value should fill with theme names
Response.Redirect(Request.Url.AbsoluteUri);
}
}
protected void imbPersian_Click(object sender, ImageClickEventArgs e)
{
Session["Theme"] = "Hajloo_RTL"; // theme name
Response.Redirect(Request.Url.AbsoluteUri);
}
protected void imbEnglish_Click(object sender, ImageClickEventArgs e)
{
Session["Theme"] = "Hajloo_LTR"; // theme name
Response.Redirect(Request.Url.AbsoluteUri);
}
[/sourcecode]

now you can check it out and enjoy from your multi UI application.

‪How to read Embedded Resource in c#

As you may know enterprise applications Embedd all of indeed resources into their assembly because of end users relief and prevention of loosing indeed files, in most cases embedding and using an embedd resource is so easy in dot net (c#) but if you embedd an xml resource and want to read it, you may be astound. in this article I’ll show you a way to read XML documents from EmbeddedResource in dot net 3.5

—————————————————————-

GNU Logo
GNU Logo

‪Title : ‪How to read Embedded Resource in c#

‪Publish Date : 14/12/2009

‪Version : 1.0

‪Author : Nasser Hajloo

‪Author Mail : n.hajloo@gmail.com

‪Copyright (c) 2009 Nasser Hajloo.

‪Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation;

‪with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

—————————————————————-

How To Embedd Resource
How To Embedd Resource

what is Embedded Resource?

Embedded Resources are whatever developer want to usein his/her assembly without informing end user that he/she is using them. this type of resources will embedd in assembly and will increasing assembly size. the important note about the embedded resource is that this type of files never resultto application change, because their embedd to assembly and end user can’t change them, so if you have and important resource that lack of that file will result to application error you should emmded that resource as an Emmbeded Resource.

Embedded Resource and Resource are so different and Resources will appear to end user and him/her can shange it, usually application translation packs are the commonly exampleof this type of resource, and end user with changing this file willface with translated application.

 

How to Embedd a Resource? embedding a resource in dot net is as easy of drinking a cup of coffee!. to embedd a resource, all you need is selct the object on Solution Explorer and then press F4 to open Properties window, in properties window you should , from the Advanced section you should select Embedded Reource in Build Action Property. all of this proccess showed in side picture.

using each type of embedded resource is different from others, and how to use an embedded image is different from how to use embedded xml resource. in this article I will describe how to use a xml embedded resource.

How To Read / Write into XML Embedded Resource? because of embeding xml into assembly, you should use a little Reflection to read/write data into embedded xml resource. all you should do is calling xml from inside of the assembly. for example

[sourcecode language=”html”]

System.Reflection.Assembly asm = Assembly.GetExecutingAssembly();

System.IO.Stream xmlStream = asm.GetManifestResourceStream("Hajloo.FOSS.UnicodeConverter.EnterpriseAppUnit.ucd.all.flat.xml");

XmlReader reader = XmlReader.Create(xmlStream, settings);

[/sourcecode]

in this example we create an object for our assembly (asm) and then use a Stream (you can use a xmlTextReader or vice versa) to read the xml, in this line of code we address the xml with complete path of XML. note that my XML name is ucd.all.flat.xml and dot between xml do not affect the clr to check another path, you should use complete Path + Name + Extension of the XML document.

in final line of code I create a XMLReader object (you can make a XMRWriter object to write inside of XML) to read (write) data from XML.

trick : if you can not find a correct path to your XML, in windows explorer right click on your assembly and then open it on Notepad++ or other editor. you can find all of you XML document inside of the assembly and you can see the fullpath of XML document here.

فهرست مرجع تگهای Meta در صفحات وب

در جستجوی راه و استاندادری برای قرار دادن آدرس ای-میل در قسمت meta تگ‌های HTML بودم و به همین دلیل لازم دانستم که مرجعی از این متاتگ‌ها را در اینجا بیاورم.

—————————————————————-

این مطلب زیر نظر مجوز GFDL منتشر می‌شود. و کلیه حقوق آن برای همگان آزاد است، بدین شرط که به کلیه شرایط موجود در مجوز GFDL ( که یک نسخه از متن انگلیسی مجوز GFDL در این محل و یک ترجمه غیر رسمی (فارسی) از متن مجوز GFDL که در مرداد ۱۳۸۳ توسط کاوه رنجبر تهیه شده است در این محل ) قرار دارد پایبند باشد.

GNU Logo
GNU Logo

عنوان مطلب : فهرست مرجع تگهای Meta در صفحات وب

مرجع فهرست متا تگها  : http://vancouver-webpages.com/META/

بخش ثانی : ندارد

تاریخ انتشار : 12/09/1388 مطابق با 03/12/2009

شماره نسخه : نسخه یک

نویسنده : ناصر حاجلو

ای-میل نویسنده : n.hajloo@gmail.com

Copyright (c) 2009 Nasser Hajloo.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation;

with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”.

—————————————————————-

Meta (متا) تگ چیست ؟ اطلاعات اضافی که جهت معرفی و غنی سازی اطلاعات یک فایل به آن فایل اضافه می‌چسبد. به عبارت دیگر متا تگ‌ها جهت اطلاع رسانی استفاده می‌شوند. متا‌ تگ‌ها صرفا مربوط به صفحات HTML نمی‌شوند، و هر فایل دیگری مثل فایل‌های mp3 و … می‌توانند متا تگ داشته باشند. ( نام خواننده، نام آلبوم و اطلاعاتی از این قبیل، اطلاعات متا برای یک mp3 هستند )

از آنجا که این اطلاعات (متا) خیلی زیاد هستند، برای آنها استانداردهای مختلفی تعیین و وضع شده است. و شما نمی‌توانید از هر کلمه‌ای در بخش اطلاعات متا استفاده کنید. لیستی که در ادامه می‌آید اطلاعات استانداردی است که شمامی‌توانید دربخش متا تگهای html برای صفحات خود استفاده کنید.

در کل برای صفحات html (منظور از صفحات html کلا صفحات وب است، چرا که نهایتا همه زبان‌های مختلف در مرورگر بصورت html رندر می‌شوند) دو نوع meta تگ داریم.

HTTP-EQUIV (HTTP header) Index : که اطلاعاتی در ارتباط با header صفحه در اختیار می‌گذارد و از دو بخش http-equiv و content تشکیل شده است.

NAME tag Index : که اطلاعاتی در ارتباط با صفحه و محتوای درونی‌اش در اختیار می‌گذارد و از دو بخش name و content تشکیل شده است.
شاید معروف‌ترین متا تگها و پر استفاده‌ترین آنها برای صفحات وب ۳ متا تگ 

[sourcecode language=”html”]
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content=""/>
<meta name="description" content=""/>
[/sourcecode]

باشند.
همانطور که ملاحظه می‌کنید، اولین خط از نوع اول و دو خط بعدی ازنوع دوم هستند. در زیر لیست مرجعی از اطلاعات متایی را که می‌توانید به صفحات وبتان اضافه کنید می‌آورم. ذکراین نکته هم ضروری است که این اطلاعات باید در بخش قرار بگیرند.
فهرست زیر مربوط است به نوع اول بنابراین برای اضافه کردن هر کدام از آنها باید یک خط

[sourcecode language=”html”]
<meta http-equiv="" content=" />
[/sourcecode]

به صفحه اضافه کنید. از فهرست زیر، آنچه را که در بخش Attribute آمده در داخل قسمت http-equiv قرار بدهید و آنچه را که در قسمت Source آمده (مطالعه کرده) و راه حل ارائه شده را در قسمت content بیاورید 

Attribute                         Source                        Description
Allow                        rfc1945                        Gives allowed http methods
Alternates                        rfc2068                        List alternate representations
Bulletin-Date                        Lotus                        Date, e.g. 1997-03-24 15:57
Bulletin-Text                        Lotus                        Document description
Cache-Control                        rfc2068                        Directives to cacheing
echanisms
Content-Base                        rfc2068                        Specify base URL for entity
Content-Disposition                        rfc2183                        Specify content
andler (Microsoft)
Content-Encoding                        rfc1945                        Gives compression scheme
Content-language                        rfc1945                        Natural Language of document
Content-Length                        rfc1945                        Size of body in bytes
Content-Location                        rfc2068                        Resource location for entity
Content-MD5                        rfc2068                        MD5 digest of entity body
Content-Range                        rfc2068                        Range of partial response
Content-Script-Type                        html40                        Specifies default scripting language
Content-Style-Type                        html40                        Specifies default style sheet language
Content-Type                        rfc1945                        Media type
Content-type                        rfc1945                        
Content-Version                        rfc2068                        Version tag of evolving entity
Date                        rfc1945                        Date message originated (HTTP format)
Default-Style                        html40                        Set preferred style sheet
Derived-From                        rfc2068                        Version tag of previous version
ETag                        rfc2068                        Entity tag for resource identification
Expires                        rfc1945                        Expiry date of document (HTTP date format)
Ext-cache                        Netscape                        Alternate cache path
Instance-Delegate                        SHOE                        Pointer to Ontology Key
Instance-Key                        SHOE                        Ontology Key
Last-Modified                        rfc1945                        Date resource was last changed
Link                        rfc1945                        Relationship to other resources
Location                        rfc1945                        URL of resource
MIME-Version                        rfc1945                        May indicate MIME-compliance. Ignore.
Page-Enter                        MSIE 4                        Sets page entry transistion
Page-Exit                        MSIE 4                        Sets page exit transistion
PICS-Label                        PICS                        Document content labelling
Pragma                        rfc1945                        no-cache prevents cacheing
Public                        rfc2068                        List of supported methods by server
Range                        rfc2068                        Specify subrange (bytes)
Refresh                        Netscape                        Delay till browser reloads (optional URL)
Server                        rfc1945                        Gives information about server
Set-Cookie                        Netscape                        Sets cookie value
Site-Enter                        MSIE 4                        Sets site entry transistion
Site-Exit                        MSIE 4                        Sets site exit transistion
Title                        rfc1945                        Title of entity (obsoleted in rfc2068)
Transfer-Encoding                        rfc2068                        Specify transfer (cf. entity) encoding
URI                        rfc1945                        URIs by which resource is located. (obsoleted in rfc2068)
Vary                        rfc2068                        Specify that request was selected from alternates (e.g. different languages)
Via                        rfc2068                        Generated by gateways
Warning                        rfc2068                        Warning about cache problems, etc.
Window-target                        Netscape                        Specify target window of current document

 فهرست زیر مربوط است به نوع اول بنابراین برای اضافه کردن هر کدام از آنها باید یک خط

[sourcecode language=”html”]
<meta name="" content=""/>
[/sourcecode]

به صفحه اضافه کنید. از فهرست زیر، آنچه را که در بخش Attribute آمده در داخل قسمت name قرار بدهید و آنچه را که در قسمت Source آمده (مطالعه کرده) و راه حل ارائه شده را در قسمت content بیاورید

Attribute Source Description
   
ABSTRACT IBM Page Abstract
accessConstraints GILS Allowed access to information
agencyProgram GILS Official name of the agency program
Agent markup Language Version AML Agent Markup Language
ALIAS IBM Page URL
Area SONAH SONAH
Audience Fireball Intended Audience
Author-Corporate Apple Corporate Author
Author-Personal Apple Author
Author Publish Document Author
Bookmark Apple Bookmarkable URL
Build MS-Word Build Date
CC IBM ?
Checked by MS-Word Checked by
Classification Netscape Classification
Client MS-Word  
contact IBM Author email
contactCity GILS Contact City
contactFaxNumber GILS Contact Fax
contactName GILS Contact Name
contactNetworkAddress GILS Contact email
contactOrganization GILS Contact Organization
contactPhoneNumber GILS Contact Phone
contactState GILS Contact State (US)
contactStreetAddress1 GILS Contact Address
contactStreetAddress2 GILS Contact Address
contactZip GILS Contact Zipcode (US)
contributor RDU Contributor
Copyright Publish Document copyright
Coverage Apple name of applicable area
createDate GILS Date information resource was created YYYY/MM/DD
Creattim MS-Word Date/Time
custodian RDU Custodian
custodian_contact RDU Custodian Contact
custodian_contact_position RDU Custodian Contact Position
Date completed MS-Word (possibly DOS date mm/dd/yyyy)
dateofLastModification GILS Date the information was input or last modified
DC-CHEM.biological-activity DC-CHEM  
DC-CHEM.characterisation DC-CHEM  
DC-CHEM.computation-simulation DC-CHEM  
DC-CHEM.coordinates DC-CHEM  
DC-CHEM.reaction-data DC-CHEM  
DC-CHEM.safety DC-CHEM  
DC-CHEM.smiles DC-CHEM  
DC-CHEM.substance DC-CHEM  
DC-CHEM.synthesis DC-CHEM  
DC.CONTRIBUTORS Dublin Other Contributors
DC.COVERAGE Dublin Spatial and temporal coverage
DC.CREATOR Dublin Author or Creator
DC.DATE Dublin Date resource was made available in its present form.
DC.DESCRIPTION Dublin Description
DC.FORMAT Dublin Data representation of the resource
DC.IDENTIFIER Dublin Resource Identifier
DC.LANGUAGE Dublin Language(s) of the intellectual content
DC.PUBLISHER Dublin Publisher
DC.RELATION Dublin Relationship to other resources.
DC.RIGHTS Dublin Link to rights-management statement.
DC.SOURCE Dublin Work from which resource is derived
DC.SUBJECT Dublin Subject and Keywords
DC.TITLE Dublin Document Title
DC.TYPE Dublin Resource Type
Department MS-Word  
Description Spidering Document description
Destination MS-Word  
Disposition MS-Word  
Division MS-Word  
doccomm MS-Word Document Comments
Document number MS-Word  
east_bounding_coordinate RDU East Bound
Editor MS-Word  
EKArea Kodak numeric
EKBU Kodak numeric
EKdocOwner Kodak numeric
EKdocTech Kodak numeric
EKdocType Kodak Document Type
EKreviewDate Kodak yyyymmdd
Expires Fireball expires
Formatter Publish Document creation agent
Forward to MS-Word  
Generator Publish Document creation agent
geo.placename geotags Geographic Place Name
geo.position geotags Geographic Position
geo.region geotags Region
googlebot Google search engine control
Googlebot spidering Google Web Robot control
govType GILS Government type (city/state/regional etc.)
Group MS-Word  
htdig-email-subject HTdig email subject
htdig-email HTdig Recipient address
htdig-keywords HTdig keywords
htdig-noindex HTdig noindex
htdig-notification-date HTdig Notification date
Identifier-URL Apple URL
Identifier Apple Serial number
Keywords Search Document indexing keywords
Language MS-Word  
LastUpdated SONAH SONAH
linkage GILS Contact Linkage (URL)
Location Sympatico Geo. location (Country, Province, City)
Mailstop MS-Word  
MathDMV.ABSTRACT MathDMV URL locating an abstract
MathDMV.AUTHOR MathDMV Multiple authors separated with comma
MathDMV.CONTACT MathDMV e-mail address
MathDMV.CR MathDMV ACM Computing classification
MathDMV.IDENTIFIER MathDMV URL or bibliographic reference
MathDMV.KEYWORDS MathDMV Multiple keywords
MathDMV.NOTES MathDMV URL locating additional notes
MathDMV.ObjectType MathDMV PREPRINT or PUBLISHED
MathDMV.PACS MathDMV Physics and Astronomy Classification
MathDMV.PCLASS MathDMV Primary classification
MathDMV.SCLASS MathDMV Secondary classification
MathDMV.SERIES MathDMV  
MathDMV.SUBJECT MathDMV Subject
MathDMV.TITLE MathDMV Title of paper
MathDMV.UPDATE MathDMV Date last changed
MathDMV.UPLOAD MathDMV Date the paper is first made available
Matter MS-Word  
medium GILS physical file or formats in which the resource is available
Microsoft Border MS  
Microsoft Theme MS Frontpage  
MSSmartTagsPreventParsing MSSmartTags Microsoft Smart Tags
mytopic GeoCities GeoCities topic tag
no-email-collection UnSpam Forbid robots to index email addresses
north_bounding_coordinate RDU North Bound
note GILS Note (supplemental information)
ObjectType Belfast Type of document
Office MS-Word  
Operator Data Entry Operator?
organization Musella Organisation of Author
originalControlIdentifier GILS identifier applied by the originating agency
originatorDepartment GILS Official organization Department
originatorDivision GILS Official organization Division
originatorJurisdiction GILS Official organization responsible for information
originatorOffice GILS Official organization Office
originatorSection GILS Official organization Section
Owner MS-Word  
OWNER IBM Page owner (email)
Page-Topic Fireball Page Topic
Page-Type Fireball Page Type
Project MS-Word  
public Musella Availability (boolean)
Publisher-Email Apple email address of publisher
Publisher MS-Word  
Publisher Apple Publisher
Purpose MS-Word  
Rating mk-metas content rating
Received from MS-Word  
Recorded by MS-Word  
Recorded date MS-Word (possibly DOS date mm/dd/yyyy)
Reference MS-Word  
relation RDU Relation
reply-to RDU Reply Email
Resource-Type Resource-Type  
revision Musella Revision number of the document
revisit searchBC suggestion for robot revisit interval
rnmediafile RealProducer Real rm file
rnmetafile RealProducer Real ram file
rnpagelayout RealProducer e.g. embedded
Robots Spidering Web Robot control
SIC87.ObjectType VanWeb US 1987 SIC code
Source MS-Word  
south_bounding_coordinate RDU South Bound
Status MS-Word  
subject MS-Word Subject
subjects GILS hierarchical subject trees
Telephone number MS-Word  
Template MS-Word  
timePeriodTextual GILS timeframe covered by the resource content
timestamp Musella Date when authored
Typist MS-Word  
UserGroups SONAH Restricted set of users
Version MS-Word Document Version
VW96.ObjectType mk-metas Document Type
west_bounding_coordinate RDU West Bound