Wednesday, May 5, 2010

GTK#: How to Change Font of Entry

This tutorial assumes that you are using MonoDevelop and created a C# GUI application using GTK#.

Supposing you already have a Window with an Entry, named txtSource, this is how you change the Font.

First, include Pango in imports.
  • using Pango;

Second, use the FontDescription class and instanciate one.
  • FontDescription fontDesc = new FontDescription();

Third, set the Family property of FontDescription object to any font family you want (ex, "Arial", "Tahoma", "Courier).
  • fontDesc.Family = "Courier";

Lastly, set the FontDescription object to Entry using ModifyFont method.
  • txtSource.ModifyFont(fontDesc);

The whole code should look something like this:

using System;
using Gtk;
using Pango;

public partial class MainWindow : Gtk.Window {
  public MainWindow () :base(Gtk.WindowType.Toplevel) {
    Build();

    FontDescription fontDesc = new FontDescription();
    
    fontDesc.Family = "Courier";
    
    txtSource.ModifyFont(fontDesc);
  }
}

Tuesday, May 4, 2010

Android on iPhone

I've heard about the fake iPhones from one of my officemates and I was deeply interested to buy one for some experiment. So I went to Divisoria (Philippine version of black market) and did see one which is worh PhP2,800

I tested the unit and was quite fascinated and impressed with the technology.

My supposed plan was to experiment with any opensource mobile operating system that would possibly work on the said phone. Specifically, I am interested in running Android on that fake iPhone. But a little googling showed that there is already an existing iPhone clone that uses Android. Cool, huh?


I'm still going to buy and try to do this hack for myself.

Sunday, March 21, 2010

AS3 and Red5

There seem to be not enough documentation about Red5 and AS3, especially on properly creating a new application, so I thought of writing one.

SOSampleAS3 is a simple Remote SharedObject demo app.The code is a modified Red5's SOSample demo which was written in Adobe Flash IDE and AS2. This is written in pure AS3 on FlashDevelop. Also, it demonstrates remote call using Shared Fridge Magnet tutorial.

How to install the demo webapp?

  1. Extract SOSampleAS3.zip.
  2. Then extract SOSampleAS3-src.zip.
  3. Copy bin directory to C:\Program Files\Red5\webapps\root so it will be:
    • C:\Program Files\Red5\webapps\root\bin\
    • C:\Program Files\Red5\webapps\root\bin\expressInstall.swf
    • C:\Program Files\Red5\webapps\root\bin\index.html
    • C:\Program Files\Red5\webapps\root\bin\SOSampleAS3.swf
    • C:\Program Files\Red5\webapps\root\bin\js\swfobject.js
  4. Extract SOSampleAS3-webapp.zip.
  5. Copy SOSampleAS3 directory to C:\Program Files\Red5\webapps so it will be:
    • C:\Program Files\Red5\webapps\SOSampleAS3\
    • C:\Program Files\Red5\webapps\SOSampleAS3\META-INF\MANIFEST.MF
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\classes\org\red5\server\webapp\elcMagnets\Application.class
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\lib\elcMagnets.jar
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\red5-web.properties
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\red5-web.xml
    • C:\Program Files\Red5\webapps\SOSampleAS3\WEB-INF\web.xml
  6. Restart your Red5 Server.
  7. Open your browser and set address to http://localhost/bin/.

That's it!