Barre horizontale de naviagtion

dimanche 31 octobre 2010

vendredi 29 octobre 2010

HTMLEditor AjaxToolkit

HTMLEditor is an ASP.NET AJAX Control that allows you to easily create and edit HTML content. Various buttons in toolbar are used for content editing. You can see generated HTML markup and preview document.

http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/HTMLEditor/HTMLEditor.aspx

query datatable

Use a DataView to query a DataTable or you can use LINQ.

//LINQ Example
DataRow row = customers.AsEnumerable()
.Where(i => i.Field("CustID") == 4)
.FirstOrDefault();

//LINQ - Strongly Typed DataSet
DataRow row = ds.Customers.AsEnumerable()
.Where(i => i.CustID == 4)
.FirstOrDefault();

//DataTable Example
DataRow row = customers.Select("CustID = 4")[0];

//DataView Example
DataView dv = new DataView(customers);
dv.RowFilter = "CustID = 4";

jeudi 21 octobre 2010

Converting VB LINQ to C# LINQ

VB.Net to C# Converter is one of the few conversion tools that knows about LINQ and lambdas and the other 3.5 stuff. I turned to a trial version of the product after going in circles on this VB code conversion:

Dim q = From c In dc.Categories, _
p In dc.Products _
Where c.CategoryID = p.CategoryID _
Group p By c.CategoryName Into Group _
Select New With _
{.cgname = CategoryName, _
.prdcts = Group
}

While other tools choked, VBConversions churned out this:

var q = (
from c in dc.Categories
from p in dc.Products
where c.CategoryID == p.CategoryID
group p by c.CategoryName into g
let CategoryName = g.Key
let Group = g.ToArray()
select new { CategoryName, Group }).Select(s =>
new { cgname = s.CategoryName, prdcts = s.Group }
);

I'm not sure I would have figured that out on my own.

Actually, I fixed a small bug in the conversion. The original result had the assignment operator (=) instead of the comparison operator (==) in the where clause. When I reported this issue to the author, I got a prompt, polite, and appreciative response with the assurance of a fix in the next release.

One thing that I'd like to see is a snippet converter in the tool. Right now, you need to point the converter to a VS project file - something I don't normally use in file-based, ASP.NET 3.5 Web development.

For more info on VB.Net to C# Converter, see http://vbconversions.net/ .

BTW, I had to smile at C#'s use of "let" in LINQ syntax. Don't I remember Let from the earliest BASIC days?

Using XSLT files with the new XMLDataSource control

VS 2005 RTM (.net framework 2.0)
Target: Intermediate Developers

Consider you have an XML file like this:

<Employees>

<Employee FirstName="Tom" LastName="Jones" CustomerId="1" />

<Employee FirstName="John" LastName="Doe" CustomerId="2" />

Employees>

You wish to display the data in a DropDownList with the DataTextField set to the FirstName and the DataValueField set to the CustomerId..

..and you do not want to write any code ;-)

Here is how you do it.

Drag and drop an
XmlDataSource and DropDownList control on to your page. Set their properties like so:

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Employees.xml">asp:XmlDataSource>

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="XmlDataSource1"

DataTextField="FirstName" DataValueField="CustomerId">

asp:DropDownList>


Run the page.

The DropDownList will get rendered like so:



What if the XML file were like this (where the values were elements instead of attributes)?

<Employees>

<Employee>

<FirstName>TomFirstName>

<LastName>JonesLastName>

<CustomerId>1CustomerId>

Employee>

<Employee>

<FirstName>JohnFirstName>

<LastName>DoeLastName>

<CustomerId>2CustomerId>

Employee>

Employees>

Our page will fail with the following error:
DataBinding: 'System.Web.UI.WebControls.XmlDataSourceNodeDescriptor' does not contain a property with the name 'FirstName'.


The reason is that attributes of XML elements are promoted to properties and exposed through the XmlDataSource during databinding. In our case, FirstName is an element instead of an attribute which leads to the error.

So what can we do about this? Easy, we have to figure out how to transform the FirstName, CustomerId so that they become attributes of the parent node - Employee. In other words, we need to transform the second XML file so that it looks like the first XML file. This is were XSLTs come in. Explaining XLSTs is beyond the scope of this post. Please use your search engine to learn more J
XSLT Reference

The
XmlDataSource allows you to specify an XSLT file where you can define a transformation that will be applied to the DataFile you specified.

Add an XSL file to your project and enter the following (In brief, the XSLT below will transform the XML file resulting in the FirstName, CustomerId elements becoming attributes of the Employee node)


<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="Employees">

<Employees>

<xsl:apply-templates select="Employee"/>

Employees>

xsl:template>

<xsl:template match="Employee">

<Employee>

<xsl:attribute name="FirstName">

<xsl:value-of select="FirstName"/>

xsl:attribute>

<xsl:attribute name="CustomerId">

<xsl:value-of select="CustomerId"/>

xsl:attribute>

Employee>

xsl:template>

xsl:stylesheet>

Set the XmlDataSource’s TransformFile property to point to this XSL file. Our page will look like this:

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Employees.xml" TransformFile="~/XSLTFile.xsl">asp:XmlDataSource>

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="XmlDataSource1"

DataTextField="FirstName" DataValueField="CustomerId">

asp:DropDownList>

The DropDownList will now get rendered like so:

What if you wanted to display the FirstName, LastName in the DataTextField separated by a comma?

Easy! Change the XSL file to this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="Employees">

<Employees>

<xsl:apply-templates select="Employee"/>

Employees>

xsl:template>

<xsl:template match="Employee">

<Employee>

<xsl:attribute name="FullName">

<xsl:value-of select="FirstName"/>

<xsl:text xml:space="preserve">, xsl:text>

<xsl:value-of select="LastName"/>

xsl:attribute>

<xsl:attribute name="CustomerId">

<xsl:value-of select="CustomerId"/>

xsl:attribute>

Employee>

xsl:template>

xsl:stylesheet>


Note that we changed the attribute name to FullName.

Note also the xml:space attribute which specifies that the space after the comma should be preserved.

Now change the page to this:

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/Employees.xml" TransformFile="~/XSLTFile.xsl">asp:XmlDataSource>

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="XmlDataSource1"

DataTextField="FullName" DataValueField="CustomerId">

asp:DropDownList>


The DropDownList will get rendered like this:


All this without writing a single line of code (if you exclude the xsl file you wrote)!

lundi 18 octobre 2010

outille blog

Écrire peut parfois être difficile. Blogger peut l’être encore plus si l’on doit s’occuper en plus de mise en forme, d’upload, de vérification des liens, d’HTML… A peine rentré de vacances, je vous propose quelques outils vraiment pratiques.

caract
Y doit y avoir plus pratique


Parti pris 1 : je ne parlerai ici que des produits gratuits, sachez qu’il existe des produits payants.
Parti pris 2 : désolé pour nos amis utilisateurs de mac ou de linux, j’ai fait mes tests sous Windows.

Éditeurs texte

machineecrire
A l’époque du web 1.0

Si vous n’ êtes pas friands du BB Code ou des éditeurs de vos blogs respectifs, voici de quoi vous changer la vie. La plupart des applis présentées utilisent l’API XML-RPC, qui permet de se passer (du moins en partie) de l’admin de votre blog préféré pour poster. Note : DotClear utilise quant à lui l’API MovableType, qui fonctionne sur le même principe.

Pour FireFox

Plutôt que de vous asséner une xième liste imbuvable des 100 meilleurs plugins pour Firefox, en voici 3, qui pourront vous plaire ou non en fonction de vos besoins. Je ne m’éternise pas la dessus, préférant la puissance des applications stand alone.

Scribefire posséde une fonction FTP très pratique pour les images. J’avoue ne pas l’avoir utilisé longtemps, mais en être assez satisfait. Il est possible de sauvegarder ses posts en local (sous forme de notes), puis de les publier.

Deepest Sender Dans la veine de ScribeFire

BBComposer Editeur au format BBCode

Au passage j’ajoute les dictionnaires pour Firefox, indispensables pour moi.


pour l'intégration de code voila un lien explicatif:

http://www.cyberack.com/2007/07/adding-syntax-highlighter-to-blogger.html

Converting VB LINQ to C# LINQ

VB.Net to C# Converter is one of the few conversion tools that knows about LINQ and lambdas and the other 3.5 stuff. I turned to a trial version of the product after going in circles on this VB code conversion:


Dim q = From c In dc.Categories, _       
p In dc.Products _
Where c.CategoryID = p.CategoryID _
+ Group p By c.CategoryName Into Group _
Select New With _
{.cgname = CategoryName, _
.prdcts = Group
}

While other tools choked, VBConversions churned out this:

var q = (from c in dc.Categories        
from p in dc.Products
where c.CategoryID == p.CategoryID
group p by c.CategoryName into g
let CategoryName = g.Key
let Group = g.ToArray()
select new { CategoryName, Group }).Select(s =>
new { cgname = s.CategoryName, prdcts = s.Group });

samedi 16 octobre 2010

Cpanel:Simple DNS Zone Editor

cpanel->Simple DNS Zone Editor

choisir le domaine

supprimer les User-Defined Records(tableau)

!! à chaque fois rafraichir la page pour continuer

supprimer aussi les Domaines garés

il doit rester q'un seul domaine sur votre espace revendeur exemple www.point-i.com

l'ajoute d'un espace client doit passer ar l'ajoute d"un pakage puis Create a New Account

Hébergement : Cpanel : Domaines : Domaines garés

Question:A quoi correspond les domaines garés (domain parking)?

Les domaines garés sont des noms de domaines supplémentaires qui pointent dans le même dossier que votre nom de domaine principal (public_html).

Afin d'ajouter des domaines garés sur votre espace web

> Cliquez sur Domaines garés à partir de votre Cpanel.

> Saisissez le nom de domaine dans le champ Nouveau nom de domaine

> Cliquez sur Ajouter

Cpanel:créer un nouveau pack

Pour créer un nouveau pack:
1- Connectez-vous à votre cPanel >> "WHM"
2- Une nouvelle page du WHM Web Host Manager s'affiche.

Il faut avoir au minimum un pack hébergement (Exemple 300M, 1G, 5G...)
configuré avant de pouvoir créer un compte hébergement.

3- Dans WHM, sur le menu à gauche, cliquez sur "Add a Package"
Ajoutez le pack que vous désirez avec les options que vous voulez.
4- Dans WHM, sur le menu à gauche, cliquez sur "Create a New Account"
Ajoutez le domaine SANS le www.
Le nom d'utilisateur doit avoir 8 caractères, sans espace, symboles ou
accents.
Créer un mot de passe
Ajoutez l'adresse email de contact
Sélectionnez le pack
Ne touchez à AUCUNE autre configuration sur la page de création, et
surtout pas les DSN
Créez le compte en validant le bouton "Create".

Cpanel :Bandwidth limit exceeded

Bandwidth Limit Exceeded:dépassement bande passante

1-aller WHM :gestionnaire webHost
2-Account Information-->View Bandwidth Usage

User Domain Xfer
(Best Fit)
Xfer
(in Megs)
Limit
(Best Fit)
Limit
(in Megs)
Usage
adjerba adjerba.com 61.32 Meg 61.32 M 80.00 Meg 80.00 M 77% used
pointic point-i.com 703.01 Meg 703.01 M 5.00 Gig 5120.00 M 14% used
4-Packages-->Add a Package

Quota (MB)(espace )=100Mg
Bandwidth (MB) (bande passante) =
500 Meg doit etre supérieur Xfer(best fit)

3-Account Functions-->Modify/Upgrade Multiple Accounts -->cocher le domaine du problem -->


Domain User Owner
adjerba.com adjerba pointic
point-i.com pointic pointic

Affecte new Package

jeudi 7 octobre 2010

Windows 7-reseau

il faut crer un compte administrateur avec mot de passe ,puis aller à account settings choisir Never Notify ,partger un dossier aller sharing->add Everyone -->clique share -->aller Network-> chose machine in network ->
login : ComputerName\User sample:CELABMED-PC1\Mehdi
password :123456