Monthly Archives: May 2012

10. jubilarni sastanak Bihac .NET UG


Danas 24. maja. 2012. godine,  sa početkom u 17:30 sati, održaće se 10 po redu sastanak Bihac NET User grupe, sa temom:

Tema: Windows 8 for Developers

Predavač: Bahrudin Hrnjica, Microsoft MVP

Nivo: 300 

Mjesto: Tehnički fakultet u Bihaću

Opis teme: Sve što trebate znati o novostima vezanim za developere, prvenstveno .NET platforme. Na predavanju će biti riječi o novinama u samom WIndows 8, WinRT kao novoj platformi sa starim programiskim jezicima C# i XAML. Developer platforma na Windows 8 donosi novi koncept razvoja desktop aplikacija tzv. Metro aplikacija koje se vrte na WinRT, i koje zahtjevaju da vaša aplikacija mora biti kompatibilna sa dizajnom, u tom smislu definiše se pojam “compatible by design”, skupu principa i novih mogućnosti u Windows 8 za buduće desktop aplikacije. Želite više saznati o tome na koji način razvijati višeplatformske aplikacije koje se vrte na Win RT, WP7 i u .NET okruženju, a sve su bazirane na Metro Stilu sa certifikacijom za Windows Store. Biće prikazano i nekoliko demo primjera sa novimana koje se pojavljuju u novoj verziji C# 5, Async programming pattern i  CallerMemberName.

Predavanje za one koji nisu u Bihaću biće obezbjeđen Lync prenos sa sljedećom adresom:

Join online meeting

https://meet.lync.com/daenetlab/bhrnjica/83JD5B30

Predviđene su i nagrade za sudionike:

  • Telerik ultimate licenca,
  • kao i MSPress knjiga o Visual Studio 2010

vidimo se na sastanku.

Download Outlook calendar: ovdje

Advertisements

Optimization a new feature in GPdotNET vNext


After announcing the new version of GPdotNET v2.0 in February of this year, today the post will announce optimization tool as a new part of the GPdotNET. When you make model there is often need to optimize it in order to get the specific input parameters for maximize or minimize output value. This is the case in most engineering process. For example if you model some process on CNC machine and you need to find which parameters of the process produces the best result.
So every model calculated by the GPdotNET will be able to be optimized by optimization tool ff the GPdotNET v2.0.
In addition with GPdotNET it will be possible to find global maximum or minimum of the function defined in analytic term as well. The picture below shows analytic tool definition. You can also see a brand new GUI for the GPdotNET v2.0.

Optimization tool in GPdotNET

Optimization tool in GPdotNET

Working with  Analytic function definition tool

How to add function

Within GroupBox you can see several buttons and combobox for selection basic math function. For example if you select SIN function from the combo box and click on Add function button, in the central window two rectangles will appear  similar like this . The picture represents sin function with one argument. O argument means that it is not defined yet, and you will not go further until you specified the name of the argument, or define a another function in chain. The tool automatically knows how many arguments need every defined function in GPdotNET.

If you select + or * function you will get three node, one with function name and two for arguments. Sililar like this picture: .

Defining function arguments

Every function must define its argument in order to works correctly. Letter small o in the second rectangle means that the argument of function sin is not defined yet. To define argument select node with left mouse click, enter the name of the argument, and click on Add Param button. Whole process is depicted on picture below.

Adding function argument

Adding function argument

Deleting the nodes in function

With Delete button you can delete nodes. In fact you can delete only leaf node. If you have bunch of nodes, and want to delete node in the middle, you need to delete all leaf node below it, in order to delete it. So select the leaf node with mouse and click on Delete node button.

After you finish the function definition, you must be sure that you defined all function nodes correctly with proper number of argument, otherwise GPdotNET will analise it and cannot pass further until you correct the function argument issue.

Until next feature of GPdotNET vNext!

My Master Thesis will finally be completed tomorrow


English

I prefer write blog post about technical issue, and less about my personal life, but this time is not the case. After 1,5 year of working on master thesis, the final day is come. Offical oral defence will heppen tomorrow at 12th of May 2012 at Technical faculty in Bihać. Ceremony starts at 11:00 AM, so all of you are welcome on that event.
I have held hundreds of speeches in front of various audience, but the this time is different, my mom and dad will be there, as before 11 years when I defended my Dimploma work, so I will have stage fright. :)

Bosanski


Preferiram pisanje blog postova više tehničke prirode, a manje iz mog ličnog života. Međutim, ovaj blog post će biti izuzetak. Naime, nakon 1,5 godišnjeg rada na magistarskom radu, finalni dan je stigao. Sutra 12. Maja 2012 godine, s početkom u 11:00 sati će se održati odbrana magistarskog rada pred komisijom. Ovaj događaj je javan te stoga je svako dobro došao na odbranu.
Držao sam mnogo predavanja i govore pred raznom publikom ali ovaj put će biti drugačije. Mama i babo planiraju doći na odbranu, kao i prije 11 godina kad sam branio diplomski, te zbog toga imam veliku tremu pred sam događaj. :)

Using RenderTargetBitmap to print non selected tab pages


When you work with WPF, you can easily print visual content in to image by using RenderTargetBitmap and call render with WPF visual content.

But there are some problems when you want to print the content which currently not showed on screen. For example if you want to print all Tab pages, you will have a problem because your content has to be showed on the screen before using Render method.

In this blog post it will be implement demo sample how to print all tab pages in to PNG image format.

The idea behind this implementation was that during switching between tabpage, create background thread wait some millisecond, back to UI thread and Render visuals in to image, then proceed to next tab page with same steps.

All said can be described in the following source code sample.

//Print all tab pages
private void button1_Click(object sender, RoutedEventArgs e)
{
    //select firts page
    tabCtrl.SelectedIndex = 0;

    //create background thread and wait some time
    new Thread(new ThreadStart(() =>
    {
        Thread.Sleep(500);

        //back to UI thread and print visual content
        this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
            {
                var st1 = CreateImage(((TabItem)tabCtrl.Items[0]).Content as FrameworkElement);
                saveImage(st1, "c:/temp/page1.png");

                //select next tab page
                tabCtrl.SelectedIndex = 1;
               //create background thread
                new Thread(new ThreadStart(() =>
                {
                    //wait some time
                    Thread.Sleep(500);

                    //back to UI thread and render visuals to bitmap
                    this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
                        {

                            var st2 = CreateImage(((TabItem)tabCtrl.Items[1]).Content as FrameworkElement);
                            saveImage(st2, "c:/temp/page2.png");

                            //select thrid page and wait some time
                            tabCtrl.SelectedIndex = 2;

                            new Thread(new ThreadStart(() =>
                            {
                                Thread.Sleep(500);

                                //back to UI thread and print to bitmap
                                this.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() =>
                                {
                                    var st3 = CreateScaledImage(((TabItem)tabCtrl.Items[2]).Content as FrameworkElement,
                                        120,120);
                                    saveImage(st3, "c:/temp/page3.png");
                                }));

                            })).Start();

                            }));

                    })).Start();
                }));
        }
        )).Start();
}

In the previous method we have created three background thread waited some time to alow main thread to render content, back to UI thread and render visual elements. The result of caling prevous method is the following image files on C:/Temp directory.

The whole demo sample with source code can be found here.