Blog

  • DasBlog 2.0 yayınlandı

    Open source blog yazılımı olan DasBlog’un 2.0 versiyonu yayınlandı.Yeni versiyon Asp.Net 2.0 desteği veriyor.

    Bilgi:
    http://www.dasblog.info/
    Download:
    http://sourceforge.net/project/showfiles.php?group_id=127624


    Source: rss

  • Generik sınıflar

    Generik sınıf,içerisinde her türlü değişken tipi (int,string…) tutabilen,hangi nesne tutabileceğine sınıftan bir nesne yaratırken karar verebileceğiniz ve belirlene tip için aynı işleri yapabilmenizi sağlayan sınıftır.

    List<Tipi> mylist = new List<Tipi>();

    şeklinde tanımlanır.Bir kaç örnek vermek gerekirse;

    List<string> mylist = new List<string>();
    List<int> mylist = new List<int>();


    Source: rss

  • Değişken Sql Parametre

    Dinamik “WHERE”  Cümleciği 

    Select * From Products
    WHERE ((@SupplierID is null) or SupplierID=@SupplierID)) AND ((@CategoryID is null) or (CategoryID=@CategoryID));

    şeklinde kullanarak parametrelerinizi parametrik hale getirebilirsiniz.

    Bu sayade sadece SupplierID’ye veya sadece CategoryID’ye bağlı veya
    her ikisine bağlı olarak verilerinizi çekebilirsiniz.


    Source: rss

  • SQL 2005 ve Pivot Tablo

    PIVOT deyimi kullanarak aşağıdaki şekilde satırlarınızı sütun haline getirebilirsiniz.

    SELECT
    [1]
    AS ‘January’
    ,[2] AS ‘February’
    ,[3] AS ‘March’
    ,[4] AS ‘April’
    ,[5] AS ‘May’
    ,[6] AS ‘June’
    ,[7] AS ‘July’
    ,[8] AS ‘August’
    ,[9] AS ‘September’
    ,[10] AS ‘October’
    ,[11] AS ‘November’
    ,[12] AS ‘December’

    FROM (

    SELECT

    MONTH(OrderDate) AS ‘MonthNumber’
    ,COUNT(*) AS ‘OrderCount’

    FROM Orders WHERE YEAR(OrderDate) = 1997

    GROUP BY MONTH(OrderDate)

    ) AS Data

    PIVOT(

    SUM(OrderCount)

    FOR MonthNumber IN([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])

    ) AS PVT

    Source: rss

  • Datalist,DataGrid,Repeater Kontrolerinde buton tıklama olayı

    1)Data bileşenin template itemine  Button,LinkButton veya ImageButton ekleyin.
       ilgili butonun CommandName özelliğine değer verin.Örneğin: SepeteEkle

    2)Data bileşeninin Item_Command olayını aşağıdaki şekilde kullanarak tıklama olayına
    cevap alabilirsiniz.

    private void DataList1_ItemCommand(object source,
    System.Web.UI.WebControls.DataListCommandEventArgs e)
    {
       if (e.CommandName == “SepeteEkle”)
       {     
          // Sepete ürün ekleme kodunu buraya yazın
          // e.Item.ItemIndex kullanarak DataSource’nuzdaki değere ulaşıp
          // işleminizi yapın.
       }


    Source: rss

  • SQL 2005 ve Paging(Veri Sayfalama)

    ROW_NUMBER fonksiyonunu kullanarak verileriniz sayfalı olarak gelmesini sağlayabilirsiniz.
    Özellikle “Satır” sayısının fazla olduğu tablolarda size büyük performans sağlayacaktır.

    SELECT OrderID,CustomerID,OrderDate From
    (SELECT ROW_NUMBER() OVER (ORDER BY OrderDate DESC) AS Row,OrderID,CustomerID,OrderDate From Orders)
    As OrdersWithRowNumbers WHERE  Row >= 1 AND Row <= 10

    İkinci sayfa için;

    SELECT OrderID,CustomerID,OrderDate From
    (SELECT ROW_NUMBER() OVER (ORDER BY OrderDate DESC) AS Row,OrderID,CustomerID,OrderDate From Orders)
    As OrdersWithRowNumbers WHERE  Row >= 11 AND Row <= 20


    Source: rss

  • BlogEngine.Net 1.0 – Open Source Blog

    Asp.Net 2.0 ile yazılmış Blog Sistemi.
    Birçok özelliği mevcut.(Rss,Multi-Author vs gibi)

    Daha fazla bilgi için:

    http://www.codeplex.com/blogengine


    Source: rss

  • Microsoft Silverlight

    Microsoft WPF/E’yi Silverlight olarak lanse etti.Vektörel görüntü olarak çalışan Silverlight Flash’a
    ciddi rakip olacak gibi görünüyor.Browser’lara plugin olarak eklenecek ve .Net dilleri ile geliştirilebilecek.

    Daha fazla bilgi için:

    http://www.microsoft.com/silverlight/


    Source: rss

  • DbDataReader kullanımı

    //using System.Data.Common;
    //using System.Web.Configuration;
    //isim uzaylarını ekleyin

    string dtProvider = WebConfigurationManager.ConnectionStrings[“NorthwindConnectionString”].ProviderName;
    DbProviderFactory dataFactory = DbProviderFactories.GetFactory(dtProvider);
    DbConnection con = dataFactory.CreateConnection();
    con.ConnectionString = WebConfigurationManager.ConnectionStrings[“NorthwindConnectionString”].ConnectionString;
    DbCommand cmd = con.CreateCommand();
    cmd.CommandText = “Select * from Categories”;
    try
    {
    con.Open();
    DbDataReader rd = cmd.ExecuteReader();
    GridView1.DataSource = rd;
    GridView1.DataBind();
    }
    catch (Exception ex)
    {
    Response.Write(ex.ToString());
    }
    finally
    {
    con.Close();
    }


    Source: rss

  • Thumbnail oluşturmak…

    //thumbnail.aspx oluşturun…aşağıdaki kodları yazın…

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Drawing;
    using System.Drawing.Imaging;

    public partial class thumbnail : System.Web.UI.Page
    {
       private void Page_Load(object sender, System.EventArgs e)
       {
          string Image = Request.QueryString[“Image”];
             if (Image == null)
                {
                   this.ErrorResult();
                   return;
                }
       string sSize = Request[“Size”];
       int Size = 120;
       if (sSize != null)
          Size = Int32.Parse(sSize);
       string Path = Server.MapPath(Request.ApplicationPath) + “” + Image;
       Bitmap bmp = CreateThumbnail(Path, Size, Size);
       if (bmp == null)
       {
       this.ErrorResult();
       return;
       }

       string OutputFilename = null;

       OutputFilename = Request.QueryString[“OutputFilename”];
       if (OutputFilename != null)
       {
          if (this.User.Identity.Name == “”)
             { bmp.Dispose();this.ErrorResult();}
          
    try
          
    {
          
       bmp.Save(OutputFilename);}
          catch (Exception ex)
          {
             bmp.Dispose();
             this.ErrorResult();
             return;
          }

    }

    Response.ContentType = “image/jpeg”;

    bmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

    bmp.Dispose();

    }
    private void ErrorResult()
    {
    Response.Clear();
    Response.StatusCode = 404;
    Response.End();
    }

    public static Bitmap CreateThumbnail(string lcFilename, int lnWidth, int lnHeight)
    {

    System.Drawing.Bitmap bmpOut = null;
    try
    {

       Bitmap loBMP = new Bitmap(lcFilename);
       ImageFormat loFormat = loBMP.RawFormat;
       decimal lnRatio;
       int lnNewWidth = 0;
       int lnNewHeight = 0;
       if (loBMP.Width < lnWidth && loBMP.Height < lnHeight)
             return loBMP;
       if (loBMP.Width > loBMP.Height)
       {
          lnRatio = (decimal)lnWidth / loBMP.Width;
          lnNewWidth = lnWidth;
          decimal lnTemp = loBMP.Height * lnRatio;
          lnNewHeight = (int)lnTemp;
       }
       
    else
       
    {
          InRatio = (decimal)lnHeight / loBMP.Height;
          lnNewHeight = lnHeight;
          decimal lnTemp = loBMP.Width * lnRatio;
          lnNewWidth = (int)lnTemp;
       }

    bmpOut = new Bitmap(lnNewWidth, lnNewHeight);
    Graphics g = Graphics.FromImage(bmpOut);
    g.InterpolationMode =
    System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;

    g.FillRectangle(Brushes.White, 0, 0, lnNewWidth, lnNewHeight);
    g.DrawImage(loBMP, 0, 0, lnNewWidth, lnNewHeight);
    loBMP.Dispose();
    }
    catch
    {return null;}

    return bmpOut;
    }
    }

    yukarıda thumbnail.aspx oluşturuldu..Resmi çağırıken öreneğin Image1 adlı Image Control için;

    <asp:Image ID=”Image1″ runat=”server” ImageUrl=”~/thumbnail.aspx?image=Fall800.jpg&size=800″/>

    şeklinde çağırın…


    Source: rss

Top