Erciyes Üniversitesi Ipy Semineri

Pazartesi, 26 Ekim 2009 13:48 by ikivanc


Bugün üniversitemde Ironpython hakkında sunum gerçekleştirdim. Desktop Application, Silverlight, Console, COM Nesneleri, .NET kütüphaneleri, WPF, ASP.NET tarafındaki kullanımlarından bahsettim ve bunlardan birer örnek yaptık.

Genel itibari ile güzel geçti seminer, umarım herkes için faydalı olmuştur ;)

Katılan herkese teşekkürler...

Erciyes Üniversitesi IronPython Semineri

Çarşamba, 21 Ekim 2009 15:24 by ikivanc
Bu sene IronPython seminerlerine başlıyorum. Çeşitli üniversitelerde IronPython tanıtımı ve kullanımı hakkında bilgilendirmelere başlıyacağım. İlk olarak kendi üniversitemden start veriyorum. 

Seminer hakkında duyuru aşağıdadır. İmkanı olan herkesi beklerim.


Python programlama dilinin .NET'e entegre hali olan IronPython ile .NET uygulamaları, WPF, Silverlight ve Asp.Net uygulamalarının olacağı; dinamik dil dünyasının avantajları ile tanışmaya hazır olun.

İbrahim KIVANÇ (Microsoft Student Partner)
Yer: Mühendislik Fakültesi Konferans Salonu
Tarih: 26 Ekim Pazartesi
Saat: 16:00

Tags:   ,
Categories:   IronPython
Actions:   E-mail | del.icio.us | Permalink | Yorumlar (2) | Comment RSSRSS comment feed

BirlikteGeliştir Makalelerim

Çarşamba, 21 Ekim 2009 11:19 by ikivanc
Birlikte Geliştir'de IronPython makalelerimin tamamını yayınladım. 

http://www.birliktegelistir.com/IronPython adresinde IronPython makalelerime erişebilirsiniz. Bağlantılarım'a da bg olarak link ekledim buradan da direkt olarak erişebilirsiniz ;) 


Python + .NET = IronPython

Dinamik diller ve tip tanımlamaları

IronPython Console

AgDLR - Dinamik Dillerle Silverlight

IronPython Chiron Here

IronPython WebIDE

IronPython Silverlight Visual Studio

IronPyton Silverlight ButtonClick

IronPyton Silverlight MultiScale Images

IronPyton Silverlight ChironTR

IronPython Silverlight Animation

IronPyton Built-In Yapılar

IronPyton Listeler

IronPyton Silverlight For Döngüsü

IronPyton Silverlight While

IronPython ASP.NET Entegrasyonu

Organik Yazılım Günü 1.5

Pazartesi, 19 Ekim 2009 21:31 by ikivanc
İşte uzun bir aradan sonra yeniden açık kaynak etkinliğinde buluşma fırsatına ne dersiniz? İlk etkinliğimizde yaşadıklarımız ve açıklığa getirdiğimiz ilginç bakış açısı sonrasında :) şimdilik 1.5 sürümü olarak nitelendirdiğimiz bu etkinliğe hepinizi bekliyorum! Güzel ve hızlı bir açık kaynak günü olacak!


Etkinliğe kayıt olmak için: http://www.inetatr.org/

von Neumann Mimarisi

Pazar, 18 Ekim 2009 10:55 by ikivanc
Bu yazımda Bilgisayar Mimarisi konusunda bir temel oluşturmuş olan von Neuman’ın ortaya sunduğu “von Neumann Mimarisinden” bahsedeceğim. 

Öncelikli olarak von Neumann’ı tanıyarak ne gibi bir yenilik ortaya attı ve diğer mimarilere göre avantajı nedir buna bir göz atalım.

John von Neumann 1903 yılında doğmuş Amerikalı bir matematik ve bilgisayar bilimcidir.

Bilişim teknolojisi yapısı itibariyle sürekli yenilenen ve takip edilmesi zor bir sektördür. Günümüzde de görebileceğimiz gibi eskisi üzerine geliştirilen yeni teknolojiler bir noktadan sonra yavaşlamakta veya istenilen performansı verememektedir. Bu yenilikleri en iyi şekilde aktarabilmek için bu teknolojilerin mimarilerini değiştirmek gerekir. Hatırlayacağınız gibi tek çekirdekli işlemcilerden çok çekirdekli işlemcilere geçişte işlemcilerin, işletim sistemi olarak da XP’den Vistaya geçişte de işletim sisteminde mimari değişikliğine gidilerek gelişimleri sürmüştür. 

Geçmişte de bilgisayar gelişimi hızlanmış ve eski mimari artık yavaş kalmaya başlamıştı. ENIAC isimli büyük hesaplamalar yapan bilgisayar mimarisi gereği iyice yavaşlamış ve yeni bir mimari tasarım denenmişti. ENIAC’ta veriler delikli kağıtlar ile dışarıdan girilerek yapılıyordu. Von Neumann ise bu dışarıdan girilen verilerin bilgisayar içerisinde saklanabileceğine dair bir makele yayınlamış ve bunun mümkün olduğundan bahsetmiştir. 

Bu mimariyi 1946 yılında oluşturan Von Neumann’a göre bilgisayar 4 temel birimden oluşmaktadır. Bunlar;  
Kontrol birimi (CPU), 
Matematiksel ve mantıksal işlemlerin yapıldığı aritmetik-mantık birimi (ALU), 
Bilginin saklandığı hafıza bölümü (Memory) 
Giriş/Çıkışı sağlamak için de Input Output birimidir (I/O).
 

Tüm bu birimler birbirlerine “veriyolu (bus)” adı verilen kablolar ile bağlıdırlar ve tüm iletişim elektronik sinyaller ile sağlanmaktadır.
 

Bu birimlerin ayrılmasından sonra bilgisayarlar çok fonksiyonel araçlar olmuşlardır. Eskiden hesaplamalar için ayrı bir yapı metin işlemleri için ayrı bir yapı kullanılmaktaydı, bunun temel nedeni işlemcisi ile memory’nin bütünleşik olmasıydı. Von Neumann sayesinde bilgisayar ile hem hesaplama yaparken hem de metin işlemleri rahatlıkla yapılabiliyor olması oldu. 

Bu mimari ile Stored Program Computer ve Sequential Architecture ortaya çıkmıştır. Yani Stored Program Computer ile bilgilsayar içerisinde yazılım saklanabilecek bu yazılım kendi üzerinde değişiklik yapılabilecekti. Aslında bir program kendi kendini kopyalayabileceğinden bahsederek bir nevi viruslerin fikir babası da olmuş diyebiliriz.

Günümüz bilgisayarlarında da kullandığımız; işlemleri tek seferde değil de parçalara bölerek tasklar halinde sıra ile yapılması mimarisi de sunulmuştur bu da Sequential Architecture yani sıralı, dizgisel mimari sayesinde olmuştur.

 
Bu mimari ile beraber gelen bazı sorunlar da mevcuttur. Bunlardan birisi crash ve diğeri ise bottleneck (dargeçidi)dır.  Crash temel olarak bilgisayarda yüklü olan programların bir hata sonucu kendilerine ve/veya diğer programlara zarar vererek kendisinin ve onlarında çalışmalarına engel olur ve durdurabilir. Çeşitli algoritmalar ve işlemci içerisindeki register’lar sayesinde bu sorun bir nebze de olsa aşılmıştır.

Bottleneck ise veriyolunda verinin transferinde yaşanan sorundur. CPU ile Ram arasında yaşanan veri transferi sorunu yüzünden veri taşıması sorunlu olabilir. İşlemcinin bilgileri işleme ve hafızadan yeni bilgiler talep etme hızı, hafızanın bilgi gönderebilme hızından çok daha yüksek olduğundan, bilgi işleme hızı büyük oranda düşmektedir.

Bu mimari günümüzde de hala kullanılmakta olup geçerliliğini sürdürmektedir. Günümüzde cache memory sayesinde  bilgisayar sıkça kullandığı verileri buradan çekerek bilgisayarın daha hızlı çalışmasını sağlamaktadır.

Gördüğümüz gibi von Neumann mimarisi bilgisayar tarihinde önemli bir mihenk taşı olmakla birlikte günümüzde de hala geçerliliğini korumaktadır. Kullandığımız bilgisayarlar bu mimari üzerinde çalışmakta olup geçerliliğini korumaktadır.

Tags:  
Categories:   Bilişim
Actions:   E-mail | del.icio.us | Permalink | Yorumlar (0) | Comment RSSRSS comment feed

Renklerin İçinde...

Pazar, 18 Ekim 2009 03:55 by ikivanc


İfadende karasızsın,
Işıkların altında.
Seni tutan birşeyler var,
Korkuların yanında..

Renklerin içinde, düşlerin içinde;
Doğmak sessizce...
Renklerin içinde cenneti içinde;
Ölmek sessizce...

Anlatılmaz bir yanın var,
Öldürmeye hevesli..
Kupkuru çiçek gibisin;
Biraz suya özlemli...

Renklerin içinde düşlerin içinde;
Doğmak sessizce...
Renklerin içinde cenneti içinde;
Ölmek sessizce...

Kargo - Renklerin İçinde
Tags:  
Categories:   FotoRoman
Actions:   E-mail | del.icio.us | Permalink | Yorumlar (0) | Comment RSSRSS comment feed

IronPython with Silverlight

Cumartesi, 17 Ekim 2009 18:24 by ikivanc
Silverlight + IronPython = <3

Silverlight projects can be directly developed by 2 main languages; C# and Visual Basic. After Silverlight 1.1 release Silverlight now support Dynamic Languages. Now we can develop applications on IronPython!

After this support Silverlight can be developed by IronPython and IronRuby which runs on Dynamic Language Runtime (DLR). 

With “The Silverlight Dynamic Languages” we can develop apps on .NET with .NET libraries.
 
For Dynamic Silverlight Development Kit come with us with their releases. IronRuby also contains IronPython binaries for using them together. Unless you need a specific version of IronPython, just download IronRuby's latest release to get both.

To get lastest release of IronPython:  http://ironpython.codeplex.com 

There is a tool called Chiron for developing Silverlight apps. 

Developing Silverlight apps with Dynamic Languages is a bit harder than C# apps. We couldn’t edit IronPython Project code directly Blend or we couldn’t develop it with desing preview. Now we can only run and edit IronPython Silverlight projects in visual studio.

As you know Silverlight project works with XAP package files in the browser.  XAP file contains files which a Silverlight application requires files for working in a browser. DLLs of Silverlight project code and XAML.  We will use Chiron for generate XAP file for Dynamic Language Silverlight Application and we will use it for serving our Silverlight project.

What is Chiron?
Chiron is a Dynamic Languages Silverlight development tool for languages runs on DLR(Dynamic Language Runtime). It helps us for developing IronPython with Silverlight. XAML code and PY files.

Chiron generates a XAP file and uses it with a server. Server runs project at Localhost.

Chiron is an executable file and we can use it from “cmd”. We can access Chiron like below.
 
chiron_cmd 

Let’s check out a standard IronPython-Silverlight project. Which files are included in our Project template: 

Projem\
Projem \index.html
Projem \app\
Projem \app\app.py
Projem\app\app.xaml
Projem\ assets\


app.xaml 
<Canvas x:Class="System.Windows.Controls.Canvas" 
    xmlns="http://schemas.microsoft.com/client/2007"    
    xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml
    x:Name="parentCanvas">
 
<TextBlock Height="42" FontSize="28" Margin="36,40,170,0" VerticalAlignment="Top" x:Name="metin">Wooow, Supeeer!</TextBlock>
<Button Height="38" HorizontalAlignment="Left" Margin="27,103,0,0" VerticalAlignment="Top" Width="112" Content="Dugme" x:Name="dugme"/>
</Canvas>

app.py
from System.Windows import Application
from System.Windows.Controls import Canvas
 
xaml = Application.Current.LoadRootVisual(Canvas(), "app.xaml")
xaml.metin.Text = 'Wooow, Supeeer!'
xaml.dugme.Content = 'Dugme'    #Dugme means Button in English


index.html 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
 
<head>
    <title>SilverlightApplication</title>
    <style type="text/css">
    html, body {
        height: 100%;
        overflow: auto;
    }
    body {
        padding: 0;
        margin: 0;
    }
    #silverlightControlHost {
        height: 100%;
        text-align:center;
    }
    </style>
    <script type="text/javascript" src="Silverlight.js"></script>
    <script type="text/javascript">
        function onSilverlightError(sender, args) {
            var appSource = "";
            if (sender != null && sender != 0) {
              appSource = sender.getHost().Source;
            }
 
            var errorType = args.ErrorType;
            var iErrorCode = args.ErrorCode;
 
            if (errorType == "ImageError" || errorType == "MediaError") {
              return;
            }
 
            var errMsg = "Unhandled Error in Silverlight Application " +  appSource + "\n" ;
 
            errMsg += "Code: "+ iErrorCode + "    \n";
            errMsg += "Category: " + errorType + "       \n";
            errMsg += "Message: " + args.ErrorMessage + "     \n";
 
            if (errorType == "ParserError") {
                errMsg += "File: " + args.xamlFile + "     \n";
                errMsg += "Line: " + args.lineNumber + "     \n";
                errMsg += "Position: " + args.charPosition + "     \n";
            }
            else if (errorType == "RuntimeError") {           
                if (args.lineNumber != 0) {
                    errMsg += "Line: " + args.lineNumber + "     \n";
                    errMsg += "Position: " +  args.charPosition + "     \n";
                }
                errMsg += "MethodName: " + args.methodName + "     \n";
            }
 
            throw new Error(errMsg);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server" style="height:100%">
    <div id="silverlightControlHost">
        <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%">
          <param name="source" value="ClientBin/SilverlightApplication.xap"/>
          <param name="onError" value="onSilverlightError" />
          <param name="background" value="white" />
          <param name="minRuntimeVersion" value="3.0.40624.0" />
          <param name="autoUpgrade" value="true" />
          <a href="http://go.microsoft.com/fwlink/?LinkID=149156&v=3.0.40624.0" style="text-decoration:none">
               <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style:none"/>
          </a>
        </object><iframe id="_sl_historyFrame" style="visibility:hidden;height:0px;width:0px;border:0px"></iframe></div>
    </form>
</body>
</html>


Let’s generate XAP Package. Chiron generates XAP file in our project folder.

>Chiron.exe /directory:Projem\app /zipdlr:app.xap 

 cmd_xap 
Files in Silverlight Dynamic Language SDK must be at the same directory with our project.

It will add some dll files to XAP file which are necessary for Ipy with Silverlight.

Check out what a XAP file contains. As you know in after Running our C# Silverlight project in Visual studio, our xaml and cs files are complied to a DLL assembly file. Bu in Dynamic Languages it doesn’t complied. XAP file contains them with their original format as Py and xaml files.

 xap_icerik 
After that on our project we will follow this steps: 
Run Chiron as a web server:

> cd Projem
> Chiron.exe /webserver 
chiron_server 

Chiron works as a web server on port localhost:2060 and will open root.
 
server_localhost

We can run our app now by the clicking index.html
 
IronPython_browser

But developing apps in Silverlight with IronPython is a bit harder then developing with C# in Blend.
You can generate XAML code via Blend design tool. I use C# Silverlight Project desing tools in Blend to generate XAML and I code IronPython code with manually.

PDF version of this article >> 6 - IronPython with Silverlight

If you have any questions or discover any errors / typos please let me know ik@ibrahimkivanc.com

All The Best!

Elbette...

Cumartesi, 17 Ekim 2009 08:06 by ikivanc


Güneş her akşam batıp hergün doğuyorsa,
Çiçekler solup solup tekrar açıyorsa...
En derin yaralar kapanıyorsa,
En büyük acılar unutuluyorsa...
Neden korkulur hayatta söyleyin bana !
Ben neden hep aynı kalayım söyleyin bana?!

Elbette bazen çiçek açıp bazen solacağım ...
Elbette daldan dala konup sonra uçacağım ...
Elbette bazen hızla dönüp bazen duracağım ...
Elbette bazen söyleyip bazen susacağım ...

İnanmadım asla inanamam
Herşeyin bir sonu olduğuna...

Candan Erçetin - Elbette
Tags:  
Categories:   FotoRoman
Actions:   E-mail | del.icio.us | Permalink | Yorumlar (0) | Comment RSSRSS comment feed

Asp.NET with IronPython Integration

Cuma, 16 Ekim 2009 14:09 by ikivanc
One of the IronPython development area is Asp.NET. In this article we will see Visual Studio 2008 Asp.Net integration. 

Then download the Asp.NET IronPython integration for visual Studio 2008 installer here.



Asp.NET with IronPython is really rocks! This combination gives us time/performance advantage. Especially in small scripts for events, python code is too short and powerful! So we can prototype projects quickly.

Because of Dynamic Language, it will work server-side on client’s machine and it works dynamicly. With this feature we can connect websites faster. 

Let’s check out, files in a project from Solution Explorer.
 
    IRONPYTHON                                                             C#
 
After creating a new web project, “bin” folder, "default.aspx" page, "Global.py" file and "Web.config" file are created by Visual Studio.

"bin" Folder
It contains our website DLLs for running IronPython on the web. 

Default.aspx
It’s our default homepage for web project. It work with code-behind file, Default.aspx.py which contains all python code for page.

Global.py
This file contains some situations about web application for some cases.

def Application_Start():
    ' Code that runs on application startup' 
    pass
 
def Application_End():
    ' Code that runs on application shutdown'
    pass 
 
def Application_Error(app, e): 
    ' Code that runs when an unhandled error occurs'
    pass 
 
def Application_BeginRequest(app, e): 
    ' Code that runs at the beginning of each request'
    pass 
 
def Application_EndRequest(app, e):
    ' Code that runs at the end of each request'
    pass 

web.config
Some Asp.NET web project configurations included in it. 

What is the differences between “C# Asp.Net” and “IronPython Asp.Net”?
First differences In Ipy Project, it contains “bin” folder which contains DLL libraries for IronPython and global.py file.

The most helpful advantage of IronPython is easy and short code. Usually people compare C# and IronPython with their code line.

Let’s check out the example below
The web page contains label and a button. First page initialize button text as “Click” and Page title as “IronPython Example” on Page Load. After clicking button, label text will be “Clicked” on Button1 Click. 

C# 
public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Button1.Text = "Click!";
            this.Page.Title = "C# Example";
        }
 
        protected void Button1_Click(object sender, EventArgs e)
        {
            Label1.Text = "Clicked";
        }
    } 

IronPython 
def Page_Load(sender, e):
    Button1.Text = 'Click'
    Page.Title = 'IronPython Example'
 
def Button1_Click(sender, e):
    Label1.Text = 'Clicked' 
 
Also in IronPython we don’t have to import standard libraries. Now Programming is really enjoyable! :)

PDF verison of this article >>  5 - IronPython ASP.NET Integration

If you have any questions or discover any errors / typos please let me know ik@ibrahimkivanc.com

All The Best!

IronPython Studio & VS Integration

Pazar, 11 Ekim 2009 08:05 by ikivanc
IronPython Studio Installation & Visual Studio 2008 Integration

IronPython Studio is a development IDE for developing IronPython projects based on Visual Studio. It’s like developing web application IDE "Visual Web Developer 2008 Express" for a specific development area. Built on Visual Studio and it’s free.

First of all you shouldn’t install ironpython studio setup directly. You must install some pre-requisites. If you try to install directly after that you get an error “Cannot find one or more components. Please reinstall the application”. For correcting this mistake,



You should first install Visual Studio 2008 Shell setup. It is available for Visual Studio 2008 Shell, Isolated and Integrated modes. You can install isolated mode from here about 380MB. After the installation open it from installed directory.
 
Then install "vs_shell_isolated.enu" setup from installed directory of VS shell isolated mode.


Now we are ready for installation IronPython Studio.

We can download IronPython Studio isolated mode installer from http://www.codeplex.com/IronPythonStudio . Then run the installer.
                                                       

After installation with steps above, now we can run IronPython Studio without any error.

             
If you are familiar with developing  apps in Visual Studio, you can easily develop IronPython project in this environment!


We can develop
Windows Application
Class Library
Console Application
WPF Application apps in IronPython Studio.

But if we wanted to develop “WPF Application“ we got an error. I will introduce how we can solve this problem in next articles.

Introduction to IronPython Studio

Let’s look at integration IronPython Studio into Visual Studio. How it looks like with Visual Studio integration.

As you see there is a IronPython section.

If you are familiar with developing  apps in Visual Studio, you can easily develop IronPython project in this environment! We develop Python project which runs on .NET! Coding python on windows is a bit harder especially developing projects with GUIs. On windows there are Qt, BOA constructor IDE’s or on Console tkinter library, wx library for developing GUI elements on Python. But they are too harder! Especially for running projects on windows there are third party apps like “py2exe” to run on windows, it’s too difficult!

It’s over with IronPython… Let’s begin:
First , let’s introduce Visual studio for non-familiar users. See how do we use VS.

Follow File>New>Project  then splash a New Project Page and choose IronPython section.




Under this section there are 4 projects type:
Windows Application
Class Library
Console Application
WPF Application 

With IronPython we can develop Silverlight, Asp.NET applications, I will introduce how do we develop this apps in next articles…

Then we select Windows Application and for Project Name: ikivanc_Ders1 then following OK. Our project environment will be look like below. We can see parts of our project in the Solution Explorer. There is "From1.py" and "Program.py" files.

              
As you see there is Design form and other tool panels on in VS 2008. First look at Visual Studio Panels:

ToolBox
We can develop GUI with drag and drop components to add them to our project. To show toolbox Short-Cut is (Ctrl+Alt+X).

Solution Explorer
This tool shows us our project and project tree. Source Code and other project codes. We can edit them with double click. To show Solution Explorer Short-cut is (Ctrl+Alt+S).
             

Properties
In this panel we can change attributes of Components, Forms and objects on the Forms, without editing code-behind easily. To show Properties short-cut is (F4)

Server Explorer
This panel is for connecting to database. We can do anything about database like creating table, creating stored procedure… To show Sever Explorer short-cut is (Ctrl+Alt+S).

To Run the Application:
To start debugging short-cut is (F5) or on the menu Debug>Start Debugging, If you run without Debugging; Ctrl+F5 or Debug> Start Without Debugging


After Running Application, our project “exe” will be created by  Visual Studio.  It’s located in our projects directory there is “bin” folder, in “bin” folder there is “Debug” folder which contains our exe file. That’s all!



PDF verison of this article >>  4 - IronPython Studio & Visual Studio Integration

If you have any questions or discover any errors / typos please let me know ik@ibrahimkivanc.com

All The Best!