martes, 25 de agosto de 2009

Opera 10 RC y Fecha del lanzamiento final!

Ya está disponible para descargar la versión RC (Release Candidate o Candidato de Lanzamiento). Para descargarlo simplemente vayan a la barra derecha del blog y busquen el vinculo al RC. Y según se habla, la fecha final es el 1ro de Septiembre.

Entre las mejoras tenemos (en inglés):

Interfaz de Usuario:

  • New application icon
  • Fixed the new tab button on the sides
  • Various small Visual Tabs fixes
  • Fixed a BitTorrent crash
  • Fix to jumping up/down of the new tab button while on the sides
  • Fixed Bug DSK-195906 (Opera error page selects URL field when displayed, also when focus is already inside URL field)
  • Fixed Bug DSK-257578 ("..." in site titles in some cases overlap the close button)
  • Fixed Bug DSK-258585 (Can't remove menu button when main menu is disabled): The menu button can be removed as any other toolbar button now (upgraders may have to reset the toolbar first)
  • Fixed Bug DSK-261205 (Strings don't fit in Preferences > Downloads [pl])
    Fixed Bug DSK-261206 (Strings don't fit in Preferences > Programs [pl])
  • Fixed Bug DSK-261757 (Missing "splitter" in bookmark split view)
    Fixed Bug DSK-261933 (Text cut off in startup dialog (Polish translation))
  • Fixed Bug DSK-261962 ("Reset Toolbar to Its Default" resets all toolbars, not just the current)
  • Fixed Bug DSK-262181 (Empty [dropdown widget] section added to custom shortcuts by update)
  • Fixed Bug DSK-262283 (Skin.ini section inconsistencies)

 

Nucleo

  • Various crash fixes
  • Fixed Bug CORE-19376 (Crash navigating history)
  • Fixed Bug CORE-23125 (Adding IFRAME with javascript: src through DOM adds history entry (Yandex))

 

Opera Mail

  • Fixed a crash
  • Fixed Bug DSK-245600 (Mail imported into account with no downloading of message bodies loses bodies)
  • Fixed Bug DSK-261035 (Crash when opening image attachments)
  • Fixed Bug DSK-261459 (Go to Unread View when requested, don't reuse a maximized mail view)

Windows

  • Crash Fix
  • Reverted Fix to Bug DSK-241262 (Error message when opening HTML files if Opera is not already running): This caused DSK-262363
  • Fixed Bug DSK-259756 (Installer removes icon pinned to the Windows 7 task bar)
  • Fixed Bug DSK-260498 (The list of closed tabs needs clicks to be shown)
  • Fixed Bug DSK-262363 (Other programs using the http protocol to open websites in Opera just open blank page in Windows Vista and Windows 7)
  • Fixed Bug DSK-259743 (Closed tabs and new tab buttons have non-native looks in native skin)
  • Fixed Bug DSK-262120 (Panel selector buttons in Native skin get Standard style when not on the left)
  • Fixed Bug DSK-262272 (Closed tabs and new tab positioned incorrectly when tabbar is placed on left or right side)

Mac

  • Fixed Bug DSK-261726 (Closed Tabs button overlaps tabs when set to right or left and new tab button is disabled)

Unix

  • Fixed Bug DSK-259575 (Dead keys don't seem to work on widgets)
  • Fixed Bug DSK-250495 (Spell checking not working for some UNIX users)

 

Como siempre gracias por leer!

martes, 11 de agosto de 2009

Controlando Threads en .Net

En otro post les mostré como crear Threads en .Net de cuatro formas diferentes, ahora veremos como controlarlos, detenerlos, etc.  A continuación uso de algunos métodos importantes de la clase Thread:

Thread.Join()

El método Join le dice al sistema que haga esperar a la aplicación hasta que el thread haya terminado. Un pequeño ejemplo para demostrar el uso:

static void Main(string[] args)
{
    ThreadStart operation = new ThreadStart(SomeWork);
    Thread theThread = new Thread();


    Console.WriteLine("Comienza la ejecución");
    theThread.Start();


    Console.WriteLine("Esperamos que termine");
    theThread.Join();


    Console.WriteLine("Listo");
    Console.Read();
}


static void SomeWork()
{
    for (int i = 0; i < 10; i++)
    {
        Console.WriteLine("Hello World #{0}", i);


        //simulamos un proceso
        Thread.Sleep(500);
    }
}




Thread.Priority



La clase Thread soporta el cambio de la prioridad de un Hilo de ejecución usando la enumeración ThreadPriority, la cual consiste en los siguientes valores:




  • Highest: Prioridad más alta.


  • Above: Un poco más alta que la normal.


  • Normal: Prioridad por defecto.


  • Below: Un poco más baja que la normal.


  • Lowest: Prioridad más baja.



Los threads son agendados basándose en ésta enumeración. En la mayoría de los casos se utiliza el valor por defecto (Normal). Modificar la prioridad de un Thread a Above o a Highest puede traer como consecuencia que se prive algún otro proceso importante del sistema, por lo que hay que hacerlo con precaución.



Thread.Abort()



Controlar Threads en tu aplicacón también requiere que seas capaz de detenerlos. La forma de hacerlo es usando el método Thread.Abort(), el cual cuando es llamado el systema lanza un ThreadAbortException en el subproceso no en el principal. Y sin importar si la excepción es controlada o no, el Thread se detiene justo despues de que se lanza la Excepción. Ejemplo:



static void Main(string[] args)

{

    Thread newThread = new Thread(new ThreadStart(TestThread));

    newThread.Start();

 

    //Simulamos proceso.

    Thread.Sleep(50);

    newThread.Abort();

    Console.WriteLine("Ready: {0} - Completed: {1}",

TestClass.IsReady, TestClass.IsCompleted);

Console.Read();

}


public class TestClass

{

    private static bool m_isReady;

    private static bool m_isCompleted;


    public static  bool IsCompleted

    {

        get { return m_isCompleted; }

        set { m_isCompleted = value; }

    }

 

    public static bool IsReady

    {

        get { return m_isReady; }

        set { m_isReady = value; }

    }

}

static void TestThread()

{

    TestClass.IsReady = true;

    //Simulamos un proceso.

    Thread.Sleep(200);

    TestClass.IsCompleted = true;
}



Si ejecutamos el código anterior nos podemos dar cuenta de que a la propiedad IsReady se le asigna correctamente el valor, pero en cambio a IsCompleted no. Esto es debido a que el abort se está ejecutando justamente despues del IsReady, por lo que IsCompleted nunca llega a asignársele el valor.



Por lo que nuestro código debería quedar de la siguiente manera:




static void TestThread()

{

    try

    {

        TestClass.IsReady = true;

        Thread.Sleep(200);

        TestClass.IsCompleted = true;

    }

    catch (ThreadAbortException ex)

    {

        Console.WriteLine(ex.Message);

        Console.WriteLine("Tratamos el error");

    }

    finally

    {

        Console.WriteLine("Cerramos conexiones, streams,etc");

    }

}



De esta manera manejamos correctamente la el aborto de ejecución del hilo y nuestra data o proceso quedan íntegros.



 



Continuaré este post pronto, y como siempre gracias por leer!