DCSIMG
December 2006 - Posts - Justin myJustin = new Justin( Expriences.Current );

December 2006 - Posts

ClickOnce Case Studies

I've recently been asked by a company I'm working with to make a short list of real-world application that use ClickOnce for deployment over the Internet.

Here's what I came up with:

Application name

ClickOnce URL

One line description

SQL 2005 Report Builder

http://go.microsoft.com/?linkid=4540578

Microsoft's Ad-hoc Report Building tool for Reporting services 2005

Meebo Browser

http://norman.rasmussen.co.za/dl/meebo/clickonce/ 

Alternative .Net 2.0 Based Browser.

Feed Writer

http://www.duncanmackenzie.net/FeedWriter/default.aspx 

RSS 2.0 Creater for non-developers

IntraWeb Studio Professional

http://downloads.atozed.com/IWS/pro/index.html 

Content Management System (CMS)

PwopCatcher

http://www.pwopcatcher.com/install/ 

Podcast RSS Downloader

Photo Resizer

http://www.cameronalbert.com/PhotoResizer.aspx 

 

PyPod.NET

http://pypod.net/console/index.html 

decentralized P2P

Loan Ace 2006

http://www.loanace.net/publish.htm 

 loan origination system (or LOS) 

Comicster

http://www.madprops.org/comicster/Publish/publish.htm 

comic books catalog 

System Manager

http://www.orbwave.com/software/systemmanager/ 

Taskbar Shortcut helper

Node Browser

http://www.nodeirc.com/install/ 

Alternative .Net 2.0 Based Browser.

Virtual Ground Station 3

http://gs.space.t.u-tokyo.ac.jp/vgs3/publish-e.html 

satelites orbital calculation application

OLAF Demo

http://www.faser.net/public/tmp/outlook/publish.html 

Outlook Look & Feel demo

Trigger Pin

http://josh.com/clickonce/triggerpin/publish.htm 

home awareness and automation

Orkut Messenger 

http://shauryaanand.qsh.sk/OrkutMessenger/clickonce/ 

online community application

Outlook Addin 

http://jausovec.info/OutlookCheck/publish.htm 

Outlook Addin Check (VSTO)

netBake

http://software.computa.co.uk/aspnet/netBake/ 

Bakery Control Solution

MindLink

http://www.minddriven.it/mindlink/Setup.html 

File Organizer

DirectWeb

http://www.poplogix.net/install/DirectWeb/index.htm 

MSN Messenger RSS Addin

emailAI Pro

http://www.softwaredevelopment.net.au/emailAIPro.htm 

Email Enchancer

SIRIUS

http://reickenbacker.com/SIR/Player/

Internet Radio Player

iTunes Playlist Converter

http://www.s-church.net/software/windows/itunes/
iTunesPlaylistConverter.htm 

Convert iTunes playlist for other media players

משקית

http://www.1point.info/vdir4/publish/publish.htm 

Israeli Hebrew software for running for agriculture

BoatExec

http://www.boatexec.com/Download.htm 

Ship's log & organizer

Web Paint Factory 

http://www.mobiform.com/demos/paintfactory/publish.htm 

WPF Demo

ForestPad Ecosystem

http://www.forestpad.com/forestpad.ecosystem
.desktop/install.htm 

Hierchiel mobile text organizer

ITSdesign

http://itstankdesign.com/ITSdesign/publish.htm 

design program 

Wallpaper Cycler

http://www.ariankulp.com/ClickOnce/Cycler/Publish.htm 

Background Wallpaper Cycler

Service Manager 

http://www.alexeyonline.com/Deploy/
SQLServerServiceManager/publish.htm 

SQL Server 2005 Service Manager 

Planner

http://www.anozireth.com/planner/publish.htm 

events planning program

Posted by Justin-Josef Angel [MVP]
תגים:

This Sunday: Roy Osherove:: Agile Development using Team System

[via Roy]

Roy is the BEST presenter in Israel regarding Agile Methodologies and anyone who will be at his talk will only benefit greatly from it.

I know for a personal fact that he has been working on Team System for the last year.
It'll be interesting to hear him talk about combining his two passions for both Agile & VSTS.
What will the curious mix between hardcore Agile Development and Team system bring? I'm guessing we'll find out tomorrow.

 

24 בדצמבר, 2006
17:30-20:00
משרדי HP, רח' דפנה 9 רעננה.
מרצה: Roy Osherove - TeamAgile

הרצאה זו תציג מידע לגבי שימוש בשיטות Agile Development תוך שימוש במערכת ה Team System. בהרצאה נסקור מספר שיטות פיתוח חדשניות וכן כיצד ניתן להעזר במערכת ה Team System בכדי לתמוך בתהליכי פיתוח הכוללים בניה ברזולוציה יומית.

ניתן להירשם כאן.

Part I:

Introduction to Agile Methodologies and Concepts

Ever knew on your first day on the project that you're going to miss the deadline? Ever been 'surprised' that the customer changed their mind? Ever had long nights trying to fit your latest changes into code that just keeps on breaking? You're not alone. Wondering where you should start if you want to go Agile? This session is for you. We'll take a look at the traditional 'Engineering' based methodologies such as the waterfall model, how they came to be, why most projects today fail, and what the differences are between Engineering methodologies and 'Agile' methodologies. We'll explore what 'Embrace Change' really means in the context of Agile development and what 'People-Oriented' 'Adaptive' development mean in that context. We'll see how methodologies such as XP, Scrum, Microsoft Solutions Framework (MSF) Agile and others fit into the context of Agile development and talk about the ways in which one can start adopting agile in their organization. Finally, we'll look at some of the most basic steps any organization can take in the road to becoming more and more Agile.

Part II

Implementing Continuous Integration: With and Without Team System

In this session we'll dive into a world where the system is built and run on a daily basis, and even on an hourly basis. We'll discuss Tools and Libraries that help you get there with VS 2003, 2005 and Team System. Even with Express tools – it's all possible, and more easy than you think.

 

Question from .Net Tapuz forum: Refactoring Code-behind to Static Methods and Properties example

שאלה:

 יש לי את הקוד הבא ואני בטוח שיש דרך יותר טובה ונקייה לכתוב אותו, למישהו יש רעיונות? 

 

       // טבלא ראשית
        Table MainTbl = new Table();

        // הגדרות עבור טבלא 
        MainTbl.CellPadding = 0;
        MainTbl.CellSpacing = 0;
        MainTbl.Width = Unit.Parse("456") ;

        
        TableRow MainRow = new TableRow();
        MainTbl.Rows.Add(MainRow);
        // טור קו שמאלי של טבלא ראשית
        TableCell MainLineLeftCell = new TableCell();
        MainRow.Cells.Add(MainLineLeftCell);
        MainLineLeftCell.Width = Unit.Parse("1px");
        MainLineLeftCell.Height = Unit.Parse("100%");
        MainLineLeftCell.Style.Add("background-image", "url(simages/FramePixel.gif)");

        // טור שמאלי של טבלא ראשית
        TableCell MainLeftCell = new TableCell();
        MainLeftCell.ColumnSpan = 0;
        MainLeftCell.Width = Unit.Parse("439");
        MainRow.Cells.Add(MainLeftCell);
        
        // הוספת טבלא לתוך התא השמאלי
        Table LeftTable = new Table();
        MainLeftCell.Controls.Add(LeftTable);
        // הגדרות עבור טבלא שמאלית
        LeftTable.Width = Unit.Parse("100%");
        LeftTable.CellSpacing = 0;
        LeftTable.CellPadding = 0;
        LeftTable.Height = Unit.Parse("100%");

        // שורה עליונה
        TableRow leftUpRow = new TableRow();
        LeftTable.Rows.Add(leftUpRow);

        TableCell leftUpCell = new TableCell();
        leftUpRow.Cells.Add(leftUpCell);
        leftUpCell.Style.Add("background-image", "url(simages/FramePixel.gif)");
        leftUpCell.Height = Unit.Parse("1px");
        leftUpCell.Width = Unit.Parse("100%");
        
        // שורה אמצעית
        TableRow leftMRow = new TableRow();
        LeftTable.Rows.Add(leftMRow);
        TableCell leftMCell = new TableCell();
        leftMRow.Cells.Add(leftMCell);
        
        // שורה תחתונה
        TableRow leftDRow = new TableRow();
        LeftTable.Rows.Add(leftDRow);
        TableCell leftDCell = new TableCell();
        leftDRow.Cells.Add(leftDCell);
        leftDCell.Style.Add("background-image", "url(simages/FramePixel.gif)");
        leftDCell.Height = Unit.Parse("1px");
        leftDCell.Width = Unit.Parse("100%");

        // טור ימני של טבלא ראשית
        TableCell MainRightCell = new TableCell();
        MainRightCell.ColumnSpan = 0;
        MainRightCell.Width = Unit.Parse("16");
        MainRightCell.Height = Unit.Parse("100%");
        MainRow.Cells.Add(MainRightCell);

תשובה:

בלי לשנות את הפתרון של שימוש בטבלה (במעבר ל-GridView או ל-DataList) בהחלט יש כאן מקום לשיפור הפתרון המוצא.

הפתרון הוא שימוש במתודות סטטיות ואף במאפיינים סטטיים כדי להכיל את כל ההגדרות המעניינות האלו ולרכז קוד.

נתחיל ביחד בתהליך שנקרא Refactoring. מילת המפתח כאן היא Refactoring.
הכוונה היא: |הדגש| שינוי הקוד בלי לשנות את הפונקציונליות שלו|סדגש|.
כלומר, אנחנו יודעים שהקוד עובד אבל עכשיו הגיע הזמן להפוך אותו ליותר קריא וסה"כ יותר "נכון".

נתחיל את הדוגמה בלעשות Refactoring לתאים בטבלה. נתחיל מהקוד הזה:

// טור קו שמאלי של טבלא ראשית
TableCell MainLineLeftCell = new TableCell();
MainRow.Cells.Add(MainLineLeftCell);
MainLineLeftCell.Width = Unit.Parse("1px");
MainLineLeftCell.Height = Unit.Parse("100%");

נוציא את כל קביעת המאפיינים הזו למתודה סטטית

 

// טור קו שמאלי של טבלא ראשית
MainRow.Cells.Add(TableHelper.GetNewCell()); 

public static class TableHelper
{
    public static TableCell GetNewCell()
    {
        TableCell ReturnCell = new TableCell();
        ReturnCell.Width = Unit.Parse("1px");
        ReturnCell.Height = Unit.Parse("100%");
        return ReturnCell;
    }
}

OK, אז מה עשינו כאן? לקחנו את כל המאפיינים שנקבעו ושמנו את הקביעה שלהם בתוך מתודה סטטית. המתודה הסטטית הזו גם מחזירה את התא החדש ובחוץ אנחנו דואגים להוסיף אותו לרשימת התאים.

עכשיו נטפל בקוד הזה:

// טור שמאלי של טבלא ראשית
TableCell MainLeftCell = new TableCell();
MainLeftCell.ColumnSpan = 0;
MainLeftCell.Width = Unit.Parse("439");
MainRow.Cells.Add(MainLeftCell);

אפשר לראות שההבדל בין מה ש-GetNewCell מחזיר לנו לבין מה שאנחנו צריכים זה ה-Width וה-ColumnSpan. אז נשנה את המתודה כך שעדיין GetNewCell יחזיר בדיוק אותו TableCell, אבל גם יהיה לנו Overload שמאפשר להחזיר בדיוק מה שאנחנו צריכים.

public static class TableHelper
{
    public static TableCell GetNewCell()
    {
        return GetNewCell("1px", 1);
    }
    public static TableCell GetNewCell(string Width, int ColumnSpan)
    {
        TableCell ReturnCell = new TableCell();
        ReturnCell.ColumnSpan = ColumnSpan;
        ReturnCell.Width = Unit.Parse(Width);
        ReturnCell.Height = Unit.Parse("100%");
        ReturnCell.Style.Add("background-image", "url(simages/FramePixel.gif)");
        return ReturnCell;
    }
} 
// טור קו שמאלי של טבלא ראשית
MainRow.Cells.Add(TableHelper.GetNewCell()); 

// טור שמאלי של טבלא ראשית
MainRow.Cells.Add(TableHelper.GetNewCell("439", 0)); 

כפי שאפשר לראות, לא שנינו את העבודה של GetNewCell בלי פרמטרים, אבל קיים GetNewCell עם פרמטרים נוספים שמאפשרים לקבוע מאפיינים נוספים. נמשיך עם הקוד הבא:

TableCell leftUpCell = new TableCell();
leftUpRow.Cells.Add(leftUpCell);
leftUpCell.Style.Add("background-image", "url(simages/FramePixel.gif)");
leftUpCell.Height = Unit.Parse("1px");
leftUpCell.Width = Unit.Parse("100%");

עכשיו אנחנו נדרשים לקבוע גם גובה וגם רקע (שהוא זהה לכל התאים בעלי הרקע), אז נוסיף עוד overload של GetNewCell שמקבל את הגובה של התא וגם מקבל האם צריך להוסיף רקע.

leftUpRow.Cells.Add(TableHelper.GetNewCell("100%", "1px", 1, true)); 

public static class TableHelper
{
    public static TableCell GetNewCell()
    {
        return GetNewCell("1px", 1);
    }

    public static TableCell GetNewCell(string Width, int ColumnSpan)
    {
        return GetNewCell(Width, "100%", ColumnSpan, false);
    }

    public static TableCell GetNewCell(string Width, string Height, int ColumnSpan, bool AddBackground)
    {
        TableCell ReturnCell = new TableCell();
        ReturnCell.ColumnSpan = ColumnSpan;
        ReturnCell.Width = Unit.Parse(Width);
        ReturnCell.Height = Unit.Parse(Height);
        if (AddBackground)
            ReturnCell.Style.Add("background-image", "url(simages/FramePixel.gif)");
        return ReturnCell;
    }

נמשיך עם שני התאים האלו:

TableCell leftDCell = new TableCell();
leftDRow.Cells.Add(leftDCell);
leftDCell.Style.Add("background-image", "url(simages/FramePixel.gif)");
leftDCell.Height = Unit.Parse("1px");
leftDCell.Width = Unit.Parse("100%"); 

// טור ימני של טבלא ראשית
TableCell MainRightCell = new TableCell();
MainRightCell.ColumnSpan = 0;
MainRightCell.Width = Unit.Parse("16");
MainRightCell.Height = Unit.Parse("100%");
MainRow.Cells.Add(MainRightCell);

שהופכים ל:

leftDRow.Cells.Add(TableHelper.GetNewCell("100%", "1px", 1, true)); 

// טור ימני של טבלא ראשית
MainRow.Cells.Add(TableHelper.GetNewCell("16", "100%", 0, true));


יפה, אז עכשיו כל מקום שבו יוצרים TableCell חדש וקובעים לו מאפיינים הפך למתודה סטטית. עכשיו נשלב גם מאפיינים סטטים.

// טור קו שמאלי של טבלא ראשית
MainRow.Cells.Add(TableHelper.GetNewCell()); 

// becomes
MainRow.Cells.Add(Cells.LeftLine); 

public static class Cells
{
    public static TableCell LeftLine
    {
        get
        {
            return TableHelper.GetNewCell();
        }
    }
}

כלומר, במקום כל פעם עכשיו לקבוע מאפיינים בקוד, נשתמש במאפיינים סטטים שיתנו לנו תמיכה Strongly Typed בקוד במקום הערות מיותרות.

public static class Cells
{
    public static TableCell LeftLine
    {
        get
        {
            return TableHelper.GetNewCell();
        }
    }

    public static TableCell LeftColumn
    {
        get
        {
            return TableHelper.GetNewCell("439", 0);
        }
    }

    public static TableCell TopRow
    {
        get
        {
            return TableHelper.GetNewCell("100%", "1px", 1, true);
        }
    }

    public static TableCell LowerRow
    {
        get
        {
            return TableHelper.GetNewCell("100%", "1px", 1, true);
        }
    }

    public static TableCell RightColumn
    {
        get
        {
            return TableHelper.GetNewCell("16", "100%", 0, true);
        }
    }
}

עכשיו הקוד שנשאר לנו נראה ככה:

 

// טבלא ראשית
Table MainTbl = new Table(); 

// הגדרות עבור טבלא 
MainTbl.CellPadding = 0;
MainTbl.CellSpacing = 0;
MainTbl.Width = Unit.Parse("456"); 

TableRow MainRow = new TableRow();
MainTbl.Rows.Add(MainRow);
MainRow.Cells.Add(Cells.LeftLine); 

// טור שמאלי של טבלא ראשית
MainRow.Cells.Add(Cells.LeftColumn); 

// הוספת טבלא לתוך התא השמאלי
Table LeftTable = new Table();
MainRow.Cells[MainRow.Cells.Count - 1].Controls.Add(LeftTable);
// הגדרות עבור טבלא שמאלית
LeftTable.Width = Unit.Parse("100%");
LeftTable.CellSpacing = 0;
LeftTable.CellPadding = 0;
LeftTable.Height = Unit.Parse("100%"); 

// שורה עליונה
TableRow leftUpRow = new TableRow();
LeftTable.Rows.Add(leftUpRow); 

leftUpRow.Cells.Add(Cells.TopRow); 

// שורה אמצעית
TableRow leftMRow = new TableRow();
LeftTable.Rows.Add(leftMRow);
leftMRow.Cells.Add(new TableCell()); 

// שורה תחתונה
TableRow leftDRow = new TableRow();
LeftTable.Rows.Add(leftDRow);
leftDRow.Cells.Add(Cells.LowerRow); 

// טור ימני של טבלא ראשית
MainRow.Cells.Add(Cells.RightColumn); 

this.Controls.Add(MainTbl);

ניקח גם את המאפיינים של טבלה ונכניס למתודות ומאפיינים:

 

Table MainTbl = Tables.Main;
Table LeftTable = Tables.Left; 

public static class Tables
{
    public static Table Main
    {
        get
        {
            return TableHelper.GetNewTable("456");
        }
    }

    public static Table Left
    {
        get
        {
            return TableHelper.GetNewTable("100%", "100%");
        }
    }
} 

עכשיו נוסיף גם מאפיינים סטטים לשורות כך שבתוכן יתווספו תאים.

 

// שורה תחתונה
TableRow leftDRow = new TableRow();
LeftTable.Rows.Add(leftDRow);
leftDRow.Cells.Add(Cells.LowerRow); 

//becomes
LeftTable.Rows.Add(Rows.LowerRow);

public static class Rows
{
    public static TableRow LowerRow
    {
        get
        {
            TableRow ReturnRow = new TableRow();
            ReturnRow.Cells.Add(Cells.LowerRow);
            return ReturnRow;
        }
    }
} 

בצורה דומה, נכניס את כל השורות לתוך מאפיינים, ואת כל הקשרים בין המאפיינים השונים.

public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Controls.Add(Tables.Main);
    }
}

public static class TableHelper
{
    public static TableRow GetNewRow(TableCell CellInRow)
    {
        TableRow ReturnRow = new TableRow();
        ReturnRow.Cells.Add(CellInRow);
        return ReturnRow;
    }
    public static Table GetNewTable(string Width)
    {
        Table ReturnTable = new Table();
        ReturnTable.CellPadding = 0;
        ReturnTable.CellSpacing = 0;
        ReturnTable.Width = Unit.Parse(Width);
        return ReturnTable;
    }

    public static Table GetNewTable(string Height, string Width)
    {
        Table ReturnTable = GetNewTable(Width);
        ReturnTable.Height = Unit.Parse(Height);
        return ReturnTable;
    }

    public static TableCell GetNewCell()
    {
        return GetNewCell("1px", 1);
    }

    public static TableCell GetNewCell(string Width, int ColumnSpan)
    {
        return GetNewCell(Width, "100%", ColumnSpan, false);
    }

    public static TableCell GetNewCell(string Width, string Height, int ColumnSpan, bool AddBackground)
    {
        TableCell ReturnCell = new TableCell();
        ReturnCell.ColumnSpan = ColumnSpan;
        ReturnCell.Width = Unit.Parse(Width);
        ReturnCell.Height = Unit.Parse(Height);
        if (AddBackground)
            ReturnCell.Style.Add("background-image", "url(simages/FramePixel.gif)");
        return ReturnCell;
    }
}

public static class Cells
{
    public static TableCell LeftLine
    {
        get
        {
            return TableHelper.GetNewCell();
        }
    }

    public static TableCell LeftColumn
    {
        get
        {
            return TableHelper.GetNewCell("439", 0);
        }
    }

    public static TableCell TopRow
    {
        get
        {
            return TableHelper.GetNewCell("100%", "1px", 1, true);
        }
    }

    public static TableCell LowerRow
    {
        get
        {
            return TableHelper.GetNewCell("100%", "1px", 1, true);
        }
    }

    public static TableCell RightColumn
    {
        get
        {
            return TableHelper.GetNewCell("16", "100%", 0, true);
        }
    }
}




public static class Tables
{
    public static Table Main
    {
        get
        {
            Table ReturnTable = TableHelper.GetNewTable("456");
            ReturnTable.Rows.Add(Rows.Main);
            return ReturnTable;
        }
    }

    public static Table Left
    {
        get
        {
            Table ReturnTable = TableHelper.GetNewTable("100%", "100%");
            ReturnTable.Rows.Add(Rows.UpperRow);
            ReturnTable.Rows.Add(Rows.LeftRow);
            ReturnTable.Rows.Add(Rows.LowerRow);
            return ReturnTable;
        }
    }
}

public static class Rows
{
    public static TableRow LowerRow
    {
        get
        {
            return TableHelper.GetNewRow(Cells.LowerRow);
        }
    }

    public static TableRow LeftRow
    {
        get
        {
            return TableHelper.GetNewRow(new TableCell());
        }
    }

    public static TableRow UpperRow
    {
        get
        {
            return TableHelper.GetNewRow(Cells.TopRow);
        }
    }

    public static TableRow Main
    {
        get
        {
            TableRow ReturnRow = new TableRow();
            ReturnRow.Cells.Add(Cells.LeftLine);
            ReturnRow.Cells.Add(Cells.LeftColumn);
            ReturnRow.Cells[ReturnRow.Cells.Count - 1].Controls.Add(Tables.Left);
            ReturnRow.Cells.Add(Cells.RightColumn);
            return ReturnRow;
        }
    }
}

 

קישור: http://www.tapuz.co.il/tapuzforum/main/addmsg.asp?id=831&msgid=90269910&Subject=&Content=

.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: Consolas, "Courier New", Courier, Monospace; background-color: #ffffff; Direction: ltr; Text-align: left; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

Question from Tapuz .Net forum: How to use XmlDataSource with DetailsView/FormView? (XPath)

שאלה:

 יש לי FormView WebControl ואני רוצה להכניס ערכים מתוך קובץ XML שיוצגו בתוכו. כיצד ניתן לעשות זאת?

 

תשובה:

נגעת בנושא מאוד מעניין שהוא המשך ישיר של הפוסט הזה:
Question from .Net Tapuz Forum: Using the ASP.Net Menu WebControl with XmlDataSource


כלומר, הגענו עכשיו למצב שאנחנו יודעים שאפשר להכניס ביטוי XPath לתוך XmlDataSource, אבל אנחנו בבעיה נוספת עכשיו איך אני יכול להשתמש בו בפקדים עם Templateים?

אז בוא נביט על המצב מנקודת המבט הזה - מה מחזיר ה-XmlDataSource שלנו שאנחנו עושים Bind? כנראה איזה אלמנט בסגנון XmlNode. שזה אלמנט שיחסית קשה סתם להתחיל לנווט בתוכו להחזיר ערכים (תיכנס לילד הזה, תוציא ממנו את הטקסט הזה וכך הלאה).

אבל רגע, אמרנו שיש לנו Xml, ומה עושים שרוצים להוציא ערך כלשהו מ-Xml? התשובה הברורה היא - XPath.
אז בוא נסכם איפה אנחנו עומדים:

 - יש לנו XmlDataSource שעליו יש לנו ביטוי XPath שדואג שנקבל רק XmlNode רלוונטים.
 - אנחנו רוצים בתוך איזה Template להמשיך להוציא ערכים באמצעות ביטויי XPath מתוך אותו אלמנט דמוי XmlNode.


למזלנו, יש אפשרות Binding מאוד לא מוכרת - XPath. בדומה ל-Eval או ל-Bind, קיימת מתודת XPath שאפשר לעבוד עימה.
אז בואו נראה דוגמה. נגיד ויש לנו את ה-Xml הסטדנרטי של w3schools של חנות ספרים:

<?xml version="1.0" encoding="utf-8" ?>

<bookstore>

    <book>

        <title lang="eng">Harry Potter</title>

        <price>29.99</price>

    </book>

    <book>

        <title lang="eng">Learning XML</title>

        <price>39.95</price>

    </book>

</bookstore>

נמשיך ונגיד שאנחנו רוצים להציג ב-FormView/DetailsView את השם של ספר, המחיר שלו וגם את השפה בו הוא כתוב.
אז דבר ראשון ניצור XmlDataSource שמפנה לקובץ הזה ונחבר אליו FormView/DetailsView:

        <asp:FormView ID="FormView1" runat="server" DataSourceID="XmlDataSource1">

        </asp:FormView>

 

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

        </asp:XmlDataSource>

עכשיו נגיד - את מקור המידע שלי אני רוצה שבמקום להחזיר לי את אלמנט ה-<bookstore> היחיד אנחנו רוצים שתחזיר מספר XmlNode וספיציפת אחד לכל אלמנט <book>. אז נקבע ביטוי XPath על ה-XmlDataSource.

        <asp:FormView ID="FormView1" runat="server" DataSourceID="XmlDataSource1">

        </asp:FormView>

 

        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XMLFile.xml" XPath="bookstore/book">

        </asp:XmlDataSource>

ועכשיו נרצה להוסיף <ItempTemplate> כדי לכתוב בתוכו באמת את שלושת הערכים שאנחנו רוצים (כותרת, מחיר ושפה).

        <asp:FormView ID="FormView1" runat="server" DataSourceID="XmlDataSource1">

            <ItemTemplate>

                price:

                <asp:Label Text='<%# XPath("price") %>' runat="server" ID="Label1" /><br />

                name:

                <asp:Label Text='<%# XPath("title") %>' runat="server" ID="Label2" /><br />

                name:

                <asp:Label Text='<%# XPath("title/@lang") %>' runat="server" ID="Label3" /><br />

            </ItemTemplate>

        </asp:FormView>

 

        <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/XMLFile.xml" XPath="bookstore/book">

        </asp:XmlDataSource>

אפשר לראות שבמקום מתודות Bind או Eval השתמשנו במתודת XPath שעובדת בצורה דומה. היא מקבלת אלמנט דמוי XmlNode, מריצה עליו ביטוי XPath ומחזירה את הערך הסקלארי שהוחזר.

ובאמת הגענו למצב שכל האינפורמציה שאנחנו רוצים מוצגת באמצעות מתודת XPath.

 

קישור: http://www.tapuz.co.il/tapuzforum/main/forumpage.asp?forum=831

my Real World Application Development course on MVP Week

תאריך פתיחה: 12-13/12/2006 משך הקורס: יומיים

המרצה: ג'סטין-יוסף אנג'ל, www.JustinAngel.Net 


ג'סטין-יוסף אנג'ל עובד ומיעץ בפרוייקטים רבים תחת כובעים שונים וביניהם: יועץ, אחראי פרוייקט, ארכיטקט ותוכניתן בכיר. הוא פעיל ועובד בתחומים רבים: ניהול פרוייקטים במתודולוגיות , פיתוח מערכות מבוזרות, , ניתוח, אפיון ופיתוח מונחה ארכיקטורת עצמים, Web 2.0, ניהול והכשרות. ג'סטין-יוסף אנג'ל בעל מספר תמקצועיים. הוענק לו תואר MVP לשנת 2006 שניתן ע"י מיקרוסופט למפתחים שהראו ידע מעמיק, מיומנות טכנית רצינית ובעלי היסטוריה של מעורבות קהילתית.
בלוג :
http://blogs.Microsoft.co.il/blogs/JustinAngel

אתם לא מצליחים לתחזק אפליקציות שכתבתם. נקודה.

אל תעמידו פנים, אתם יודעים שכל פעם שאתם צריכים לגשת לקוד שכתבתם לפני יותר משבוע, אין לכם מושג איך לגשת אליו. כותבים 100 שורות קוד בלחיצה של כפתור, פותחים חיבור למסד נתונים בטעינת הדף ועושים חישובים מתמטיים בתוך תא של GridView. יש דרך יותר טובה לכתוב קוד, שבה תוכלו לכתוב קוד ולתחזק אפליקציות כמו שאתם תמיד רציתם.

 כל פעם שאתם מעתיקים קוד ממקום למקום ברחבי האפליקציה שלכם, אתם יוצרים קוד שאתם לא יכולים לתחזק. כל פעם שאתם כותבים יותר מ-5 שורות קוד במתודה אתם יוצרים קוד שאתם לא תבינו. כל פעם שאתם מרגישים כאילו אתם מבזבזים זמן לריק, אתם באמת סתם שורפים זמן.

ב-OOP (באנגלית: Object Oriented Programming) יש לנו כלל אחד ויחיד שחוזר על עצמו בכמה צורות: תפתור בעיה פעם אחת ופעם אחת בלבד, אל תעתיק קוד ברחבי האפליקציה שלך, תשים כל אחריות במקום שלה. במהלך ההרצאה נתקוף את הסוגיה של פיתוח אפליקציות לאור הכלל הבא כתיבת קוד נכון, כתיבת קוד חזק, כתיבת קוד שעובד וקל לתחזוקה.

במהלך הקורס נעבור במסע של לימוד באמצעות דוגמאות קוד תוך כדי פיתוח אפליקציות אינטרנט, אפליקציות חלונאיות ו-WebServices. במהלך המסע נרכוש השכלה לדבר החשוב ביותר בתחום פיתוח התוכנה – למה אנחנו מפתחים אפליקציה בצורה שמעבירים בקורס, ונרכוש כלים להשתמש באותו היגיון של "למה ככה?" לעבודה היום-יומית שלנו.

 

Day One - Real World ASP.Net 2.0 Web Application

ASP.Net 2.0 Is an amazing tool and Visual Studio 20005 is a great work environment. We need more than that if we are to develop software. We need order, structure and good architecture. Come join us and gain Real-World expertise on how to develop an ASP.Net application.

  • ASP.Net & ASP.Net 2.0 Server Controls
  • Data Access Layer
  • Business logic Layer
  • 3Tier Project Development – Brining it all together
  • ORM & Presistence Layers – Making your life simpler
  • Implementing a database
  • Code Generation

Day Two - Real World Smart Client Application

On day two we will learn how to build a Smart Windows Application that can work offline.
.NET Windows forms are meant to work in a connected fashion. Winforms should to be extensions of our main server & database. We can break the chains of connectivity. Join us and see how we develop such a Semi- connected client Real-World application!

  • Windows Forms
  • Web Services
  • Client side Data Access Layer to a Webservice
  • Server side Data Access Layer to a Sql Server 2005
  • 5Tier Client-Server Project Development
  • Caching
  • Refactoring

4/12/2006 Upgrading To Sequel 2005 Lecture Summery

Yesterday I gave a 3 hours talk at the Israeli SQL Server user group. It want great!

The room was literally packed. We filled the "Dekel 0" room. all chairs were full, the stairs didn't have any more place to sit on and there even people standing near both doors outside the room looking in.
There were 120~ people which is an awesome turn-out for an Israeli User group!!!

I hope everyone had a great time!

 

I gave two parts of a three part talk:

  1. T-SQL Changes - 99% of feedbacks gave this part 5 stars (out of 5).
  2. XML Data Type - was not presented due to changes in the schedule.
  3. .Net Integration - Where hardcore .Net 2.0 meets SQL server 2005. Note to self, never demo Async programming at 9 PM O'clock again.

 

Files for download:

 

 

Couple of questions the arose during the presentation and I said I'd get back to the audience:

  1. Is it possible to use the new Async Methods (SqlCommand.BeginExcuteReader, SqlCommand.EndExcuteReader, SqlCommand.BeginExcuteNonQuery & SqlCommand.EndNonQuery) with SQLCLR?

    The Answer is - No. It is not possible to do use Async methods in any SQLCLR scenario.
    The Reason being that in order to Execute those methods we need to have a connection defined on the SqlCommand (as we are not using the SqlContext.Pipe). That connection has to be a "current context = true" connection string as we are actually inside the DB at that time.

    In order to use Async SqlCommand methods we need to add "Async = true" in the connection string.
    However, Custom attributes are not allowed in "current context" connection strings.

    "Restrictions on Regular and Context Connections 

    No other connection string keywords can be used when you use "context connection=true"."

    http://msdn2.microsoft.com/en-us/library/ms131101.aspx

     

  2. Why are we using struct as  SQLCLR Aggregates and not a class?
    OK, This is a really interesting question. There actually isn't any "real" reason to not use classes in stand of structs. However, let's look at this those piece of code:


    public class EmailConcatClass : IBinarySerialize

    {

        public StringBuilder sb = new StringBuilder();

        public void Init()

        {

            //  sb = new StringBuilder();

        }

    }


    We assume that the only way to access a class is to initlize it by calling the constructor. In which point all variables inside the class who have a default value are also initlized. However, in this case SQLCLR does not call the constructor (or something of the sort) and the internal variables are not initlized. Which is extremely unusual for a class.

    So yes, we CAN use a class. But we would have to manually initlize it's variables like a struct. So why not use a struct from the starting point?

 

If you've got any more questions feel free to ask them in the comments or by email.