martes, diciembre 14, 2010

YouTube para el salón

Si eres de los que conecta el ordenador a la televisión y ve vídeos de YouTube desde el sofá de casa, seguro que te gustan estas versiones de YouTube.

La primera es una versión gigante, y se llama "XL":
http://www.youtube.com/xl

La otra es una versión a pantalla completa, y se llama "Leanback":
http://www.youtube.com/leanback

a disfrutar!!!

domingo, diciembre 12, 2010

LaTeX compiling error

If you are compiling a LaTeX document, and you get the following error:
! I can't find file `ptmr7t'
Here you have the solution:
sudo apt-get install texlive-fonts-recommended

lunes, diciembre 06, 2010

Fix @ (at) character problem with Ubuntu in Macbook

If you can't write the @ character in Ubuntu, you should do this:

1. System > Preferences > Keyboard
2. Go to Keyboard Distribution label
3. Click Options
4. Look for something like "Key to access the third level" (sorry, my Ubuntu is Spanish ;-)
5. Select the key you are used to use when typing the @ symbol (I selected the "Alt" key)

That's all,
Enjoy!!

Some keywords for spanish readers: arreglar, problema, arroba, macbook, ubuntu

jueves, noviembre 18, 2010

Install Qt Ruby (qt4-qtruby) in Linux / Ubuntu

Hi!!
You only need to do this:

sudo apt-get install ruby libqt4-qtruby

Maybe you need to install "qt4-dev-tools" if you do not have Qt4 libraries installed in your system.

Enjoy!!

PS: here I include a sample code to test if it works fine:


require 'Qt4'

app = Qt::Application.new(ARGV)

window = Qt::Widget.new()
window.resize(200, 120)

quit = Qt::PushButton.new('Quit', window)
quit.font = Qt::Font.new('Times', 18, Qt::Font::Bold)
quit.setGeometry(10, 40, 180, 40)
Qt::Object.connect(quit, SIGNAL('clicked()'), app, SLOT('quit()'))

window.show()
app.exec()

miércoles, noviembre 10, 2010

Error while compiling Qt 4.7.1 in Debian Ubuntu (solved)

Did you get this error?:
You might need to modify the include and library search paths by editing  QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11
Just do this:

sudo apt-get install libx11-dev libfreetype6-dev libavahi-gobject-dev libSM-dev libXrender-dev libfontconfig-dev libXext-dev

miércoles, noviembre 03, 2010

Tutorial rápido de C# (C Sharp)
Parte 1: Conceptos básicos

///
/// TUTORIAL RÁPIDO DE C# (C Sharp)
/// (Parte 1)
///
/// * Vía: http://www.csharp-station.com/Tutorial.aspx
///

// **********************************
// * Tipos básicos de datos en C# (C Sharp)

Type  Size (bits) Range
======== =========== ===========================================
sbyte    8           -128 to 127
byte   8    0 to 255
short       16    -32768 to 32767
ushort      16    0 to 65535
int   32    -2147483648 to 2147483647
uint   32    0 to 4294967295
long   64    -9223372036854775808 to 9223372036854775807
ulong       64    0 to 18446744073709551615
char   16    0 to 65535

Type  Size (bits) Precision    Range
======== =========== ==================== ===========================
float       32    7 digits     1.5 x 10-45 to 3.4 x 1038
double      64    15-16 digits    5.0 x 10-324 to 1.7 x 10308
decimal     128   28-29 decimal places    1.0 x 10-28 to 7.9 x 1028

// **********************************
// * Arrays de variables/objetos en C# (C Sharp)

string[] names = {"Cheryl", "Joe", "Matt", "Robert"};


// **********************************
// * Crear un programa básico en C# (C Sharp)

// Namespace Declaration
using System;

// Program start class
class WelcomeCSS
{
   // Main begins program execution.
   static void Main()
   {
      // Write to console
      Console.WriteLine("Welcome to the Tutorial!");
   }
}

//* o leyendo los parámetros que se pasan por consola

using System;

// Program start class
class NamedWelcome
{
   // Main begins program execution.
   static void Main(string[] args)
   {
      // Write to console
      Console.WriteLine("Hello, {0}!", args[0]);
      Console.WriteLine("Welcome to the Tutorial!");
   }
}

// **********************************
// * Escribir/leer en la consola en C# (C Sharp)

Console.WriteLine("Hello console!!");

// Write to console/get input
Console.Write("What is your name?: ");
Console.Write("Hello, {0}! ", Console.ReadLine());
Console.WriteLine("Welcome to the C# Station Tutorial!");

// * ó

string name = Console.ReadLine();

// **********************************
// * Estructura de los métodos

bool createAddress(string name)
{
   Address addr = new Address(name);
   storeAddress(addr);
   return true;
}

// **********************************
// * Crear clases en C# (C Sharp)

using System;

public class Echo
{
   string myString;

   public Echo(string aString)
   {
      myString = aString;
   }

   public void Tell()
   {
      Console.WriteLine(myString);
   }
}

public class Hello
{
   public static void Main()
   {
      Echo h = new Echo("Hello my 1st C# object !");
      h.Tell();
   }
}

// **********************************
// * Estructuras de control en C# (C Sharp)

// if, and else if, and else
// Multiple Case Decision
if (myInt < 0 || myInt == 0)
{
    Console.WriteLine("Your number {0} is less than or equal to zero.", myInt);
}
else if (myInt > 0 && myInt <= 30)
{
    Console.WriteLine("Your number {0} is in the range from 21 to 30.", myInt);
}
else
{
    Console.WriteLine("Your number {0} is greater than 30.", myInt);
}

// switch with integer type
switch (myInt)
{
case 1:
    Console.WriteLine("Your number is {0}.", myInt);
    break;
case 2:
    Console.WriteLine("Your number is {0}.", myInt);
    break;
case 3:
    Console.WriteLine("Your number is {0}.", myInt);
    break;
default:
    Console.WriteLine("Your number {0} is not between 1 and 3.", myInt);
    break;
}

// while loop
while (myInt < 10)
{
    Console.Write("{0} ", myInt);
    myInt++;
}

// do-while loop
do
{
    // Print A Menu
    Console.WriteLine("Something\n");

} while (condition != false);

// for loop
for (int i=0; i < 20; i++)
{
    if (i == 10)
        break;

    if (i % 2 == 0)
        continue;

    Console.Write("{0} ", i);
}

// foreach loop
string[] names = {"Cheryl", "Joe", "Matt", "Robert"};
foreach (string person in names)
{
    Console.WriteLine("{0} ", person);
}

// **********************************
// * Namespaces en C# (C Sharp)

namespace ns1
{
    namespace ns2
    {
        // Program start class
        class NamespaceCSS
        {
            // Main begins program execution.
            public static void Main()
            {
                // Write to console
                Console.WriteLine("This is a Namespace.");
            }
        }
    }
}

jueves, octubre 28, 2010

Join.me: escritorio remoto sencillo vía web


https://join.me/ es un nuevo servicio gratuito que permite que una persona (o varias) pueda controlar el ordenador de otra desde el propio navegador (no importa que sea Linux, Windows o Mac). Esto no es una novedad. Lo que sí lo es es lo sencillito que es utilizarlo, sin necesidad de pararnos a configurar router, cambiar puertos, etc.

Funciona de la siguiente manera:
  1. vamos a la web https://join.me/
  2. la persona que va a mostrar su ordenador hará clic sobre la flecha naranja. Eso hace que se descargue un programa, que se tiene que instalar.
  3. ejecutamos el programa, y vemos que nos muestra como una dirección de internet. Esa dirección se la daremos a quien quiera ver nuestro ordenador (por correo, por el messenger, facebook, etc.)
  4. los que quieran ver y controlar el ordenador de dicha persona sólo tienen que abrir el navegador, acceder a esa dirección y listo!!!
Pues eso, así de sencillo.

PD: me ahorrará muchos viajes a casas de amigos y familiares... lo presiento. Lo malo es que los tendré más encima :-(

viernes, octubre 22, 2010

lunes, octubre 11, 2010

Enable automatic spell checking in Emacs using flyspell

First you have to install the following packages:
Emacs (e.g. emacs-snapshot), aspell, and ispell.

Then, edit the .emacs file: e.g. sudo gedit (home dir)/.emacs

and add the following lines:

(add-hook 'latex-mode-hook '(lambda () (flyspell-mode t)))
(add-hook 'latex-mode-hook (function (lambda () (setq ispell-parser 'tex))))
(add-hook 'latex-mode-hook 'turn-on-reftex)
(add-hook 'latex-mode-hook 'turn-on-auto-fill)
(setq ispell-dictionary "english")
(dolist (hook '(text-mode-hook))
(add-hook hook (lambda () (flyspell-mode 1))))

sábado, octubre 02, 2010

WeFi: WiFi gratis vayas por donde vayas






Si entras en www.wefi.com y te descargas su software, tendrás un localizador de redes abiertas WiFi.




Lo mejor de todo es que va acompañado con un mapa de las ciudades, que se actualiza en tiempo real con las redes disponibles. Además, las clasifica por calidad de conexión y se conecta automáticamente a la mejor de todas las que haya disponibles.


Está disponible para PC, Netbook, dispositivos móviles (Android, Nokia, iPhone, etc.) y Mac.

lunes, marzo 22, 2010

Google JavaScript V8 Engine compilation error

If you get this error while compiling V8 JavaScript Engine with scons:

//++++++++++++++++++++++++++++++++++++++++++++++++++
cc1plus: warnings being treated as errors
src/handles-inl.h: In static member function 'static void
v8::V8::RemoveMessageListeners(void (*)(v8::Handle<v8::Message>,
v8::Handle<v8::Value>))':
src/handles-inl.h:50: error: dereferencing pointer '<anonymous>' does
break strict-aliasing rules
src/handles-inl.h:50: error: dereferencing pointer '<anonymous>' does
break strict-aliasing rules
src/utils.h:636: note: initialized from here
cc1plus: error: dereferencing pointer 'dest' does break strict-aliasing rules
cc1plus: error: dereferencing pointer 'dest' does break strict-aliasing rules
cc1plus: error: dereferencing pointer 'dest' does break strict-aliasing rules
src/api.cc:3457: note: initialized from here
scons: *** [obj/release/api.o] Error 1
//++++++++++++++++++++++++++++++++++++++++++++++++++

You have to edit the file named "SConstruct" and modify these
variables in this manner:

//++++++++++++++++++++++++++++++++++++++++++++++++++
GCC_EXTRA_CCFLAGS = ['-fno-tree-vrp', '-fno-strict-aliasing']
GCC_DTOA_EXTRA_CCFLAGS = ['-fno-strict-aliasing']
//++++++++++++++++++++++++++++++++++++++++++++++++++

You should delete the "if" structure and leave these variables alone.
Note that maybe you have to use "scons -c" to clean the old compilation files.

jueves, enero 28, 2010

C++: How to obtain the name of a class in C++ from a pointer

How to obtain the name of a class in C++ from a pointer:

#include
#include

...
// test any pointer
X * ptr;
...
cout << "requested type is " << typeid(*ptr).name() << endl;
...