viernes, diciembre 31, 2004

ReflectionOnly apis

Since I want to end this year with a good thing, I will talk about a new mini api contained in the 2.0 version of .Net, called ReflectionOnly. As its title says, this is a group of methods that load assemblies and retrieve the metainformation. The difference with the Load methods, is that the last retrieve information and also prepare the environment to execute code contained withint them (late binding is something that uses this feature).

Since there can be time when it is important to only load the metainformation -based on performance, for example-, ReflectionOnly methods help that.

Probably we will include this in Mono in the next weeks, as long as I finish the methods -currently I have a working Assembly.ReflectionOnlyLoadFrom method- and let them to be reviewed by the jit guys.

Below an example:


using System;
using System.Reflection;

public class Tester {

static void Main ()
{
Assembly ass1, ass2;

AppDomain.CurrentDomain.AssemblyLoad += OnAssemblyLoad;

ass1 = Assembly.ReflectionOnlyLoadFrom ("AssemblyRefParent.dll");
ass2 = Assembly.ReflectionOnlyLoadFrom ("AssemblyRefChild.dll");

Type t = ass2.GetType ("Child");
if (t == null) {
Console.WriteLine ("Type Child could not be loaded");
return;
}

Console.WriteLine ("Parent of Child = {0}", t.BaseType.Name);

Console.WriteLine ("ReflectionOnly Assemblies:");
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies ()) {
Console.WriteLine ("\t{0}, ReflectionOnly = {1}", a.FullName, a.ReflectionOnly);
}

}

static void OnAssemblyLoad (object o, AssemblyLoadEventArgs args)
{
Assembly loaded = args.LoadedAssembly;

Console.WriteLine ("Assembly Loaded = {0}", loaded.FullName);
Console.WriteLine ("Is Reflection Only = {0}\n", loaded.ReflectionOnly);
}

}

Output

Assembly Loaded = AssemblyRefParent, Culture=neutral
Is Reflection Only = True

Assembly Loaded = AssemblyRefChild, Culture=neutral
Is Reflection Only = True

Parent of Child = Parent
ReflectionOnly Assemblies:
AssemblyRefDriver, Culture=neutral, ReflectionOnly = False
mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, ReflectionOnly = False
AssemblyRefChild, Culture=neutral, ReflectionOnly = True
AssemblyRefParent, Culture=neutral, ReflectionOnly = True

jueves, diciembre 30, 2004

My wishes for the next year

This has been a year with good and bad things. But for the next year, I have my purposes and things to do, and also my wishes for the three wise men (as we call him in Mexico).
My wishes are:

  • Be hired in a *certain* company.
  • A laptop (today everybody has a laptop, except me).

And because I could not get my wishes done, I add them to next purposes:

  • Work in the new GC engine for Mono
  • Move to a different city (Boston or Frankfurt would be ok ;-) )
  • Finish a novel in which I'm working on (an be a good one, I don't want to be one of the so many geeks that _try_ to be good writers)

sábado, diciembre 18, 2004

Great article about the Mexico gov

Today I found a very interesting article (in Spanish) about the mexican governmentm, and the reasons that show that we have to improve tons of things.

Unfortunately, as I have mentioned earlier, in Mexico it is more difficult to deliver this kind of information to the people, because of the government managed news, because of the paid political magazines, and because the people here in Mexico is used to believe everything shown in TV.

Currently I just can say that I see in Manuel Lopez Obrador the best choice for president in next 2006 elections, against the bad options that the two other main political groups could offer us.

The link here.

lunes, diciembre 13, 2004

Mono VM Docs

Miguel reported that now the docs for the Mono VM (Reflection, Internal calls, JIT, GC Handles, Interpreter, IO Layout,...) are avalaible to be seen in monodoc.

Note, however, that work for documenting them is needed. Currently, however, some of them are a little documented, and other can be just be seen (which is a good things, since I won't need to look the namesof the functions).

A screenshot below:

jueves, diciembre 09, 2004

Mono 1.1.3 released

Mono 1.1.3 was released yesterday. The mos important changes are:

  • New build system

  • SSAPRE (Common subexpression elimination)

  • Full support for Mono.C5 (Generics library) in gmcs

  • Bundles (mechanism to bundle in a single binary the Mono runtime)

  • Support for the /doc option in mcs

  • C# 2.0 new features (contravariance/covariance and properties accessors modifiers)



The last features added to mcs were made by me ;-)

martes, diciembre 07, 2004

Education Problems

Read at DW that Germany is currently having problems with its education system, because some students leave the school when the are still young (this also is a consequence of the education system). And it also points out that in Germany the success the students get is involved with their economical situation.

At least there they have good schools, and they are now trying to improve the educations system. In Mexico we have several problems, and the current government (that being said, the last government monopoly and the current one) is not improving the system, but just making it worse.

How? creating more techinical universities, technical high schools, which shows that the government is just interested in producing qualified workers for the big companies.

Second, the more money you have, the better work you get. If you go to a expensive (very expensive) private school/university, you get almost the same education you could gain in a public one, but with more expensive builds *and*, more important, you get the sympathy of the companies. If you studied in a public university, you have fewer probabilities to get a decent job than if you studied at a particular one. Worse, the education you get there is usually not as good (or not that bad) as the one you could get ina public universitie.

Third, I thinkg we have a matter of vision and the ideas we get. Students at public universities receive an excelent education, _but_ they are educated to serve and not to manage a company; they are going to be part of another problem that in Mexico happens: the chief is an dumb-ass and his workers are people with good level, but who don't want to improve their status.

It is well known that our current public system doesn't empaphize in teaching how to think, but how to repeat _and_ do the things your chief ordered to you.

One important person told me that our *president* Fox (the most bizarre political you could ever known) decreased the amount of money for public universities, and since he couldn't do that, he then gave that money to private ones. WHAAAAAAT?

viernes, diciembre 03, 2004

Covariance and Contravariance

Support for delegates Contravariance/Contravariance support is now in Mono SVN repository.

In C# world, delegates are constructions designed to save a function; in the C world, this is similar to function pointers. Delegates offer some advntages over C function pointers, as compile and run type checks, additional properties, and they also add clearness in code.

Currently, the delegates are defined just as the following example:

public delegate void MethodHandler (string msg);

In this case, MethodHandler will act as a pointer to methods with the signature defined by itself; this is, methods with void as return value, and string as a unique paratemer. A method such void SomeMethod (string msg) would be valid, but a one like void OtherMethod (string msg, string msg2) or int AnotherOne (string msg) wouldn't.

The problem here is that the methods passed to the delegates must have the exact signature defined by it. Here is where Contravariance and Covariance come to scene.

Covariance
Having something like:

class A {}
class B : A {}

delegate A MethodHandler () { // Do something }


It would be nice to have the chance to pass not only methods like A MyMethod (), but also B MyOtherMethod. This would be possible because Be is just only a specialization of class A, which is the return value defined by delegate MethodHandler. So, returning B instead of A could be done just because B is in fact, a A class, bust maybe with more methods, more properties, etc.

With the Mono 1.x series,a dn also with MS .Net 1.0, that wouldn't be possible. Mo more: .Net 2.0 (which is in state of beta) and current Mono development branch support it.

Contravariance
Again, having code like this:

class A {}
class B : A {}
delegate void MethodHandler (B b);

Methods in the form: void SomeMethod (A a) and also void OtherMethod (B b) could be passed. Why? it's because B instances could be casted to A, so, if a delegate is called, it will receive a B instance, which will cast to A for the void OtherMethod (B b).

Just as above, this is not possible with Mono 1.x/.Net 1.0, but it is avalaible with .Net 2.0 and Mono development branch.

domingo, noviembre 21, 2004

Invitation to avoid your daily lecture of a pseudo portal

Today I had the bad -when I say, I really mean bad- idea of reading some computer related news at a mexican portal -which name beging with "Co" and ends with "día"- just to see how the ideas are going in this country every day. All the things that, as mexicans dislike, are well represented there, and also they are well applied.

In this portal, is is easy to find persons with a bad aperture to new ideas, and the haughty ideas are there the bread of every day.

Nothing easier than go there (as mexican, it's probably you would have read sometime) and begin to read the news and find that almost everyone there don't believe in nothing, not even in the good things or bad ones; they don't think in the logical things or the other. I don't say anymore, because for a smart person, it should be enough.

I only hope that never the 'main' moderatore there contacts me or somehting like that.

And again, this is an invitation to not visit that pseudo portal anymore, and in general, all the portal where only people wanting see the bad things speak. As someone said, "there's no hope for those persons who only see the ugly things in the pretty ones".

Lets just try to make a better world.

miércoles, noviembre 03, 2004

Accessor Modifiers in CVS

The code for accessor modifiers support is -finally- in CVS. I wanted it to e included in the last release that will be taken place tomorrow (the development release, of course). However, as I said before, it is now in CVS in the mcs module.

The accessor modifiers are a new feature part of the C# 2.0 specification, and with it now is possible to add an access modifier -such PUBLIC, PRIVATE, etc- for the accessors -get/set- in the properties.

This is something important in classes where you want to keep some data hidden, and want to have your Property read-only, for example. A very common behavior for a class would be to have, then, your get accessor public, and keep your set accessor protected:


public int Count {
get {
// count is a private int field
return count;
}
protected set {
// Only protected members will be able to modify Count
count = value;
}
}


With accessor modifiers, there is improvement hiding get or set methods defined by a Property, thus avoiding the need no keep a lot of variables protected.

The rules for applying this are: your access modifier must be more restrictive than the parent, when overriding the accessor must keep the parent access modifier, and that if yor property has only a an accessor (only set or only get) you can't define an access modifier.

With the first, that implies every access modifier must be more restrictive than the parent, it is not possible to have:


public int Count {
get {
}
//
// Error: public is not more restrictive than public
//
public set {
}
}


The second is very obvious, but the third says you can't have a property just only one a accessor that has access modifier:


public int Count {
//
// Error: Property must have both set and get accessors
// for applying access modifiers
//
protected get {
}
}


And finally, a sample:

using System;

public class Test {
string message;

public Test (string message)
{
this.message = message;
}
public string Message {
get {
return message;
}
protected set {
message = value;
}
}

static void Main ()
{
Test t = new Test ("Mono");

// Good, it is possible to access get accessor
Console.WriteLine (t.Message);

// Bad, mcs will complain about the access
// t.Message = "Hey";
}
}

sábado, octubre 30, 2004

C# Generics

I wrote a paper about how the System.Object based collections (dynamic arrays with different properties) work and something about the performance. It is the beginning of a serie of small articles to show why Generics (Parameterized types) represent a major improvement in the applications.

The first paper is here: Understanding System.Object based Collections.

martes, octubre 26, 2004

Linux in first class countries

Everyday I use to read the news at DW, which is a resource of news provided by the known german channel 'Deustche Welle'. I'm happy to see a new that says something that a lot of people already knew, but others didn't: Linux is being used more and more, and is used in important cities like Paris and Munich.

The new -in spanish- here.

lunes, octubre 25, 2004

We are Hackers!!!

Today in the afternoon I had chance to go to computer event, where the most interesting conference was given by a man working at a enterprise dedicated to the design of websites. They pointed out lot of very interesting facts, and also gave me the opportunity to figure out others.

The man I'm talking about talked about how important the design of a website was. One of the most important things is how easy for an user results. Imagine a site that has a lot of information, and that that site has also a bad organization. Even having a huge amount of information, it's sure the site won't success, because for the user it can represent a bad experience.

He talked they analyse the site they are going to work on, and check for a lot of variables, such: information arrangement, design, they way the page behaves when a resize is done, etc.

Other interesting thing he pointed out was that it's possible to invest a lot of money in your site, but if for example, you don't let the user know the current url, you are wasting that money. Finally, that the marketing was a big aspect to be take care of, just as defining waht you want to do with your site.

We are just simple workers
Maybe the most important thing he mentioned -that is not part of the design of a site-, is that they only design the site, and then they hire somebody to do the work -this is, the coding-. However, he mentioned this in a way in which I could feel he talked about the coders/hackers as simple workers, who don't need to be well paid. What???????

But it is natural, because in Mexico there's no big advance in the computer area. I mean, we don't have big corporations yet, which helps the money-people to think we don't are that qualified people. Add the fact that lot of coders and hackers sell their work so cheap, because of the mexican economical status, and we have a really bad situation. The way in which the man talked about the hackers -almost as people who do bad design- helped me to understand it. Let's face it: the good hackers trend to be bad designers. But maybe that needs to change.

The importance of the design
The first important conclusion is that the design must be planned. Define your target, define who will use your software. Think about its needs. Thinks about the simpleness. Thinks about the colors. Think in everything you can. This will definitely help your product to achieve a bigger step in quality.

I just can about it following the Gnome project ideas: be as possible as you can, but not _that_ simple. You must have a usability guide, you must have in mind what your customers want.

Paste the money and the science
At least something in Mexico happens is that there is a big problem in the way the money is paid. It looks that the current politics of our president -Vicente Fox, who is part of the PAN political group, an extrem conservativ one- are the same we have had for lot of time: the richs get the more, and the poors the less. That's it all resume din that phrase.

The difference could be done by the people hiring and having corporations -even small ones-, who could give their workers a better salary. Guess what? almost NOBODY does it. Isn't it really bad?

I really think a good thing could be having a corporation -a computers related one- where you are also a coder/hacker and _know_ that your workers worth. You don't explode them, you get the money -the money you really need, not more, not less- and stop thinking that the informatic people must not be well paided.

For example, for the example of the corporation dedicated to the design of the sites, you could have in your same corp both the areas dedicated to design and dedicated to the coding. I'm pretty sure you will have a better way to optimize your designs with your coding areas. Isn't that a good idea?

Economical status?
I think that one of the results of our current economical system is this: everyone out there is thinking in how to gain more and more money. In a world where everything is money, you can't escape this trend. I whish that other economical system were possible -and not just a dream-. Maybe, and just maybe we could spend more time in other aspects of our live: social, human, arts.

But we are not, and the best we can do is compete.

Conclusion
Ok, maybe nothing that productive can be gotten from this -it takes so much time and studies-, but somebody could right now begin a corporation that designs precious sites and also codes them. You will have opportunities to give a better way of live to your workers -not just, maybe, the people who graduates from a private university-. As least in Mexico, that's the way the things work.

viernes, octubre 08, 2004

Patents ...

I'm very sick about the current patents system. The most known problem with the patents began, I think, with SCO reclaming intelectual properties over Linux kernel, or at least it marked the beginning of the moment we are living currently: the era where you suit the man selling magazines in the street, cause you have the patent number 999999999-565656 that reclaimg the right to sell magazines in the streets.

Probably I should patent the process by which human reproduce themselves - I call call it 'sex'.

The last stupid new I heard of, was a
suit
by which Kodak is reclaiming 'a method by which a program can ask for help from another program', which is totally stupid.

Is this the era where everyone suits everyones, as I just states before? It looks like a bad business practice, more than a good one.

domingo, septiembre 26, 2004

Mono Days

Last thursday I met Miguel de Icaza at Mexico city, where he gave a conference about the advantges of the use of Linux (and particularly the Novell version) over the use of other OS.

His conference was part of a small Novell and Hp event surrounding Linux, and the mentioned event took place at a luxurious hotel where a lot of people had chance to talk to Miguel not only about computers, but abou politics and economics.

After the event we had lunch and I could met also Mancha, Cesar Octavio López Nataren ( the Mono JScript guy) and other Miguel's friends.

Just as always, I must say that I admire Miguel a lot and I'm happy to being working in the same project with him.

Properties Access Modifiers
Currently I'm implementing a new feature that is part of the C# 2.0 specs is the posibility to have your properties accessors with different access scopes. Today, a property is declared as follows:

public int Property {
get {
return val;
}
set {
val = value;
}
}

This generates two methods, set_Property and also get_Property, that work very smoothly. It is important to note that both methods will inherit all the acess modifiers indicated in th Property declaration, so in the previous example the methods would be described as:

public int get_Property ( );
public void set_Property (int value);


However, sometimes it would be great if the methods need to have different acess modifiers each one. For example, when you have an abstract class that exposes both get and set accessors, but want to declare the get as public, and the set as protected (thus reserved to the subclasses), wou will have to avoid declaring the set accessor and expose it in another way.

With this new feature found int C# 2.0, no more problems of this kind. Now is possible to declared one of the two accessors with different access modifier than the Property itself:

public int Property {
get {
return val;
}
protected set {
val = value;
}
}

Finally, the accessors methods would be described then as:

public int get_Property ( );
protected void set_Property (int value);

Which will be clearer and prettier than before.

lunes, septiembre 06, 2004

The Geek cliché

I was reading a blog from a guy who is a geek (almost everybody blogging can be considered a geek), and then found little details that have helped to build the geek cliché, this is, all the things that all the people think a geek does. So I here enumerate them:


  • Read a lot of trash in the web

  • A huge huge huge huge ego

  • Dislike about the stupid society

  • Have an open source hero ...

  • ... talk tooooooo much about that hero

  • Talk about the online communities they are in

  • Hatting trolls but they themselves are trolls

  • Doing nothing for the community



* Fortunately I hadn't to see him in person, when he missed a Linux event in which I was.

Of course these are only the *features* a geek has while he's online. Is that a lie or not?

sábado, septiembre 04, 2004

System Tune

Hell! I was preparing me to go to Xalapa today but ... yes, I forgot I had no money, and also that I'm in conflicts with my parents, so go figure out. Shit.

And trying to improve the performance on my almos dead pc (Celereon 500, 256 ram, 40 gb hd), I has to compile-the-linux-kernel, which took me almost 3 hours. And the system is just as slow as before. After checking the system performance, I saw that xmms was using almost 10% of the cpu! And that's just the mp3 player, that is a small application. Now think in Evolution, in Epiphany (because God, I don't use Mozilla), in all the open Terminals, in Gaim, in Xchat ...

The worst is that I could see that alsa is not as slow as before (when it was not included in the linux kernel officially), but it still is toooooo slow. Check the part of the report:

  

NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
0 63316 7500 11m S 10.3 3.3 3:15.13 xmms
0 1820 816 1620 R 8.6 0.4 0:00.11 top
0 96076 27m 72m R 6.9 12.3 5:09.98 X



My God, I need a new pc.

Excuses for Federico
I know this is the second time I'm not able to go to Xalapa, and I must confess to be embarrased. I promise to send you the C# book with Mauricio (I know I will see you at irc, but just wanted to make clear that I'm very sorry about this situation).

miércoles, septiembre 01, 2004

Officially a Hacker

Today I commited System.Collections.Generic.Collection class, which is part of the generics support for Parametric Polymorphism in Mono. So, I can say that after sending some small patches, and now this class, I'm a Mono hacker. Now, it's time to go beyond and work on the left classes and then work at the Generational garbage collection support.

Little sample:

using System;
using System.Collections.Generic;

public class Test {
public static void Main ()
{
Collection <int> c = new Collection <int> ();
c.Add (3);
c.Add (5);
c.Add (11);

// Note that unboxing is not neccessary
int sum = 0;
for (int i = 0; i < c.Count; i++)
sum += c [i];

Console.WriteLine (sum);

}
}



Compile with gmcs. Enjoy.

martes, agosto 31, 2004

6 Invitations to gmail.com

Today when I opened my gmail's inbox, the first thing I saw was the text in red, saying "Invite 6 friends to gmail.com". Currently, almost all the people I know has already an account. Furthermore, almost all my friends hate internet, which is a bad thing. I wonder if they will be deleted or what.

Collection class finished
After two days without work station, and after a day in which I was totally sick, I could check for compatibility for this class with the .Net implementatiion. It looks like everything is ok, and all my tests were good. However, with gmcs I still can't compile -I still wonder why-.

Probably I will be committing to cvs tomorrow.

viernes, agosto 20, 2004

Bad, bad, bad

Ok, ok, I know, Mexico is not having a good time at Olympic Games. We could say that it is because of the government, the social problems, and things like that. And in fact, the could all be true. But for me, that represents the big, huge, importance of preparing yourself for your objectives. That's all. If you know your rivals are as twice strong as you, then you must go and get four times the potential you have.

Yesterda I heard at a tv show that the "heroes" from Mexico had arriven to Greece. Well, they lose one or two hours ago. Pretty bad. And it is very sad to observe that lot of people representing Mexico at the OG needed to train themselves for 4 years, every day, having to work, or to study. Now, imagine you are one of them, and that a small mistake makes you lose in your are. Bad, isn't it?

The most important thing is that all those persons that have to work harder and harder every day to do anything (sport, coding, etc) is that they must train and go to their limits from day to day. That's the only way I can imagine it.

Congratulations to those persons that go to OG and had to lose again the best of the best in this world. Increible that we still have people who can go beyond with almost nothing support by the government and its departments. Let's go, people!

A little paper about GC
Garbage collections is the routine of managing the memory in a certain environment. Maurimal (Mauricio's friendly name) got an excelent paper about GC here. Now I will have something to play with until I wait for that-gc-book-you-have-heard-about. Thanks Maurimal, you are my hero.

Linux event
Here in Puebla a Linux event will take place in the next month. It is an event ths is done yearlyby the Linux user group from Puebla and that intends to show to the people the big big power of Linux and the Open Source software.

Currently a call for papers is having place right now, so, if you think you have something to say, and something that someone should hear, then, send your paper!

I hope to see people from different universities in that event. If everything goes well, we will have Arturo Aldama Espinoza, Mancha, Gunnar Wolf and Federico. More info can be found here.

miércoles, agosto 18, 2004

Generics and more generics

While waiting for the GC Book Federico will lend me in a marvelous action, I'm working at Generics, a new feature that will be part of the Mono 1.2 release for next february and that will have compatibility with the .Net 2.0 from MS.

Currently I'm working implementing some classes in the System.Collections.Generic, specially in the Collection class, that it is designed to be the base for custom classes that need to keep a collection of objects, thus avoiding writing a new collection class from scratch. It is a small and easey-to-implement class, however, this is a great chance to code Generics and learn a lot of them. I highly recommend the document in the Generics site to understan the way they work and the internals to make this feature happen.

Some notes about Generics
There may be some people who doesn't want to go and read that paper, because of its complexity or because its size. For them, some notes about thus new feature called Generics, or Parametric Polymorphism.

Currently the collection classes (Stack, Queue, ArrayList, etc) use System.Object as a wrapper for the data (this could be the equivalent to void* in C world, but not exactly the same). However, this impact a lot in performance, beacuse when you use reference-based variables (instance classes, e.g. System.String), the runtime will have to 'wrap' your variable. Something worse happen with value-based variables (e.g. System.Int, System.Long, System.Enum, etc), because they originally live in an area called 'runtime stack', that make them very light, and thus casting them to be of type System.Object will create a reference-based variable, using more innecessary space and also creating an almos useless additional variable.

Then, when a value based variable is passed as argument for a method, it will be automatically casted and impact performance. When an instance class is passed, the impact will be smaller, but it will exists. Obviously, this can cause some coders to re-implement a custom collection class.

Because of that, Parametric Polymorphism exists. It is a feature similar to those 'templates' in C++ world (note that I'm not a C++ guru). As far as I know, templates is a mechanism similar to macros in C world, but better. Now, imagine you can use the capabilites of the CLI (Just-In-Time compilation, Metadata, etc), and then you will have an interesting design, creating custom classes based on the 'generic' class. So, everytime a class is requested, the runtime will check for it: if it previously exists, it will re-take the stubs; if not, it will create it.

Imagine the code:

class GenericClass <T> {
int Add (T item) {
...
}
}


Observe the new parameter, ''. The 'T' will be an alias for the types passed in the creation of the new class. This alias will be used along all the class definition and then will generate it depending on the type. For example, you could declare it as:

GenericClass <int> gclass = new GenericClass <int> ();
...
Add (6);

The above code will be valid, because the int type will be used as the base class,
having emitted code like:

int Add (int item) {...


Im my opinion, this is a great feature, and I recommend again the lecture of the paper that is on the Generics site.

lunes, agosto 09, 2004

Bad Days

There are days when you you so much problems that you can't believe it. Well, I'm in those days: my cpu got broken, my internet connection was having trouble the entire day, I couldn't go to see Federico last Saturday ... I only hope to have less problems in the next days ...

Generics


Finnaly done with the Generics Paper Lecture. It is very impressive that a lot of ideas behind it are a little old, and the way they were taken. Now I think I'm ready to begin implement some classes and test for the .Net 1.2 compatible Mono release (expected in next february).

Also, I can't wait to see Federico and read that Richard Jones' GC book. I hope to be at Xalapa next weekend or something like that ...

lunes, julio 19, 2004

I need a GC Book

Today I spent almost all the day trying to build some samples with both the conservative Boehm and the Electrical Fire's generational garbage collectors. With the first, which is conservative and uses a mark and sweep algorithm, I could do a small example and looks easy to use. With the second (the one from the Electrical fire project) I couldn't build it, because of the old and bad Make files (it looks like they are not updated).

However, the papers I've found on google don't satisfy me, and I'm thinking I should buy a book about GC written by Richard Jones. So, if you want to contribute, you can give $ 0.1 and with 800 person helping me I will be able to buy that book ;-).

viernes, julio 16, 2004

Avoiding showing errors is bad

I have just finished installing Fedora Core 2 and well, just running some problems (ntfs support, usb ports, etc). But the biggest problem is that I still can't run the graphical mode, adn worse, I don't get error messages.

In some manner, it is normal in software to have some problems. But, what about showing good errors? In my opinion, good error messages can really help to know where the error is. Bad error messages can help, but maybe they won't give you enough information. Finally, if you are only giving some messages to some errors, well, then the problems for the user will be wrong.

Finally, I would like to say that I've been receiving a huge amount of critics. It used to be good when I only receive critics (and most importan, constructives ones) when asked for them. But, what about when you receive them without asking for them? And the worst of all, it's when you got critics about things that all the persons do every minute. Advantes of living in an exotic country like Mexico is.

jueves, julio 08, 2004

Garbage Collection in the .Net Framework

Some time ago I was reading some papers about Garbage Collection, which is the process of managing the allocations and deallocations of memory in an environment. Unfortunately, that information is hard to find in the web, since only some little info or slides are avalaible (I found an interesting book at amazon about GC, but it is so expensive).

Since that, I'm trying to read that little info, and since I could access the ACM digital library, I'm going to check some related papers. However, I have the experience that this kind of papers only cover the theorical part, and thus are not enough for me (I have more than a just theorical interest on GC).

However, I found good papers in the MSDN site and currently I'm reading the GC internal. Those papers are interesant, but again, they do not cover the area I'm interesting in (of course that I'm interested in the area they cover, it is just that I need some more information).

Something very interesant is a process called Resurrection, by which a dead object (unreachable and thus marked for being deleted from the memory) can be resurrected. Imagine you have an object that has a Finalizer method (destructor syntaxis in C#) that assigns a global/static variable a pointer to your current object:


~MyClass ()
{
// 'this' refers to the current instance
MyNamespace.AnyClass.AnStaticObject = this;
}


When and object has a Finalizer (destructor in C#), is added to an internal GC data structure called F-Reachable queue, that contains pointers to object that need to be finalized before they get deleted. However, if you have something like the previous code, your object will live again, but its Finalize method won't be called when it becomes -again- unreachable.

In fact, resurrection should NEVER happen. Just for the purpose of 'security', if the object needs to be finalized, an internal boolean flag could be added, keeping the state (finalized or not) and throw an expection when a method is called (throwing an expeption from the Finalizer would only finish the method).

miércoles, junio 23, 2004

I need to move to Fedora

I've been haing some trouble with RH 9 and the ext3 file system. Some time ago I tested Mandrake and ReiserFS and it worked very smooth, without problems. Now I'm using ext3 and I hate the way it 'locks' my files (I have to reboot). And based on tha benchmarks, I'm really waiting for Mono 1.0 core release to move to Fedora Core 2 (I was thinking about Debian; however, its comunity scares me a lot).

Germany out of the Euro


Very bad. Germany is out of the Euro 2004 and I'm very sad about that, but I hope this makes understand Rudi Völler that his 4-5-1 is bad and inefficient. Lets have better hopes for World Cup. Now, my favorites are Holland, England and, of course, France.

Futbol!!!!


Recently my friend Jorge Carrasco wanted me to look for a place to play soccer. I have invited some old friends and tomorrow we will be playing. I have a lot of time without playing, and now it's a good time to re-take it.

miércoles, junio 16, 2004

Euro 2004 & other stuff

The Euro 2004 continues and I'm just seeing that geeks don't like soccer (very bad). Today was the game Germany vs Holland, and I think it was a good game (however, in a lot of sites the press is not comfortable with that opinion). The best of the game: Michael Ballack from Germany and -of course- Van Nistelrooy -is that well written?- from Holland. No more need to be said.

At Carrasco's house


Today I was almost all the day with my friend Jorge Carrasco -who is a lawyer and we met at school when we both were 14 years old- and we were talking and thinking about the behavior of the people around us. Very interesting, and I must say I needed to talk to someone who weren't a geek or a computer.

Port of Rhino


I continue with the port of the lexer and parser routines from the Rhino engine. Today I could in a pair of hours check some errors in the Lexer and I hope to finish tomorrow or maybe on thursday it and go to the parser. No challenge, but it must be done by someone.

Books, books, books


I was reading danguer's blog and I read there that he has just finished reading The Illiad. I must confess I'm jealous because I don't have so much oportunities to read a book, and I must just wait for any chance to get a new one. The last I got was a Lovecraft book about horror stories and was good. But I bought that book 1 or 2 years ago, so try to figure out why I need a new book. It looks like danguer has stopping reading pseudo philosophical books, which is a good thing. I'm still trying to understand why geeks can't just support the idea that another geek read as much as you (hey! I'm just jealous about that I can't read so much books as I wished). Y have geek pals that still think that I'm not just as good as they at culture.

Yes, this is my selfconfidence moment of the day and ... Yes, I think I have a much higher culture level that most of the geeks I know. No more needs to be said.

lunes, junio 14, 2004

Why the geeks need to stopping being geeks?

Yesterday and part of this day I¡ve been thinking about the fact that a lof of computer people -admins, coders- are known as geeks, which turns to be a word to describe people who don't like to have real-life friends, read a lot, and so on. The difference, as I see it, between a nerd and a geek, is that the geek doesn't go to cinema, doesn't go to take a break, doesn't play sports, and also doesn't like to dress cool. Also they have to be fan of facism (with this I try to say that they are persons who only believe in their ideas and no more, and don't like to listen different opinions).

A nerd, on the other hand, is just a person who dedicates great amount of time trying to finish a task and no more. He/She is not an expert, which is really bad. But the nerd trends to be a average person.

I'm not trying to say that being an average person is the best, but I think that, if you can't control your feelings and you feel like an outsider, you should better be an average guy.

The problem which lots of geeks is that they are all the day complaining about the society and every thing in the planet. The cars, the money, and the way of life. That's not bad, as it could be just be tranfered into social critics. But wait, a geek, just as the ones I one, whould always be complaining _and_ feeling miserable about that. Then they began to hear bad music, to watch sad movies and so on. The live in a depression built by themselves, which is horrible.

Since a lot of work needs to be done in front of a monitor, a lot of geeks lose social life. The question, however, is: do they lose social life because of the work, or because of the fear to the society? I'm very sure that ALL of them would say that they like to code/admin better than going out with friends. But let me say something: I really think most of thems are afraid of the extern world, that one that lives outside a computer, in the streets, in the cinemas, in the malls, in the sport centers.

We could find two vertients as a possible cause of this: the first, is the bad way of being of the person and thus avoiding any form of social contact. The second, is an anormality in the society that together with discrimination will create persons like that.

have you heard about persons who doesn't like to go out? I'm sure you have listened of those people. Yes, serial killers.

Please, stop being a geek, change the way you think, and be more respectful of other ways of thinking. Go to the cinema on saturday, get yourself a lover and play some sport -even if you aren't good at-. Search for friends that are not that geek. Feel much better, and please avoid being a serial killer or even a guy who only lives for sadness and alcohol/drugs. Make yourself a favor and help to build a better world.

Stop thinking you are THE correct and the world is wrong. Stop thinking you are superman.


domingo, junio 13, 2004

Some notes on weekend

I'm a little bored right now -sunday evening-, and while my parents are watching tv -thus I can't see it-, I'm trying to see what to do, but without needing my brain. Hey, it's a sunday!

Wow, France!


Today I saw the France vs England game, and wow. I must confess I was very sad at the end of the game, because England was winning 1-0, but then that sadness became happiness after the only one Zinedine Zidane made two goals. Great!!! (I want to avoid the comment on the game that Pumas won versus Chivas, the mexican national soccer final). For tomorrow: Italy vs Denmark. I really would be a geek is I had nothing to do but only coding ;-)

.NET Blogs


I was curiois about the note I saw on a Mono blog -I don't remember who wrote it-, that made reference to the .NET guys at Microsoft. So I wen to MSDN and looked for them ... Now, I have the address and another resource for learning:

sábado, junio 12, 2004

Reflection Emit and Parametric Polimorphism Stuff

WOW! Finally the Euro 2004 is here! The best soccer of the all f*ck world! No more mexican trash .... ehr I mean, no more mexican soccer. My teams? Germany, Italy and Holland. No more. One of this must be the champion. The final must be decided between Portugal and Germany, with Portugal as champion, so we can have a beautiful world champion: the semi-final between Germany and Portugal (the first revenge) and the final between Germany and Brasil (the second revenge). World Champion for 2006: Germany. (Note that I'm a big fan of Germany and currently I'm planning to go to study the university there).

Reflection Emit


Yesterday I sent my patch for support to EnumBuilder class to the mono-devel list. Now it is going to be possible to use that class to emit the IL for en enum, avoiding the use of TypeBuilder and that stuff ...

However, I note that it is not that hard to emit an enum (you only need to know some things about the internals of the CLI architecture). But since a lot of people are not wanting to know the internals, I think it could help them and could help to keep a clearer approach.

Thus currently to build an Enum using RE you should type:

EnumBuilder enumBuilder = new EnumBuilder ("enumName",
TypeFlags visibility, Type typeoftheEnum);
//Define some values for this enum
enumBuilder.DefineLiteral ("FirstValue", 0);
enumBuilder.DefineLiteral ("Secondvalue, 1");
enumBuilder.CreateType ();


And an enum enumName {Firstvalue, SecondValue} will be created.

Parametric Polimorphism


I was reading the first six pages of this document about generics found at Microsoft UK Research, describing a feature called Parametric Polymorphism that let the CLI to emit collections (just an ArrayList or HashTable) for a certain type, and not anymore for a generalized System.Object. This is great.

Rhino Parser and Lexer Port


I'm working in the port of Java implementation of Javascript, Rhino, that is part of Mozilla Project, to C#, thus we can use it on Mono to build the JScript compiler (by Cesar Lopez Nataren). It doesn't represent any challengue and should be finished by a week or two.

The best and the worst


The best: my friend Mauricio printed for the the Ecma 334 standard! Cool. The worst: the project DotGnu and its FUD (the begin by saying that Mono has spreaded some FUD, and continue saying bad things in his homepage). It even doesn't deserve to be mentiones anymore.

lunes, junio 07, 2004

Emitting IL and other stuff

I've been adding some research about the IL doing some research about the IL doing some research about the IL basics on Mono, and I just got working the creation of the IL for a Enum using System.Reflection. The problem about my latest approaches was the fact that a special field called value__ must be added to the class.

Based on that, I'll be coding the System.Reflection.Emit.EnumBuilder class. I don't think is will represent a challenge, and the only important thing will be compatibility with .NET.

Also I was reading about parametric polymorphism (aka generics), that represent an interesting approach to the collections that Mono/.NET currently support. The fact behind this feature of C# 2.0 is the posibility of having dynamic collections, like a Stack or a Queue, of the exact desired type. Thus you won't have to use objects as the fundamental unit, avoiding the runtime casts (that cause a lot of runtime related problems and hard to catch).

I will be writing two articles: more about p/invoke, and other about GC in Mono (and good practices).

Finally, right now I'm taking a break with Mauricio. Cool.

jueves, junio 03, 2004

Why I love C# (and Mono)

Mi idea about creating this new blog (and of course, based on the fact that mi last blog server is offline) was caused by the title of the first post of danguer, who has a entry standing for "Why I love Python".

Before all, I must say that I confess that I think he is talking about python just as a platform, and not just like the language itself.

Said those things, let's start: I really really love the idea behinf the Mono Platform because of some simple things:

  • Multiplatform capabilites

  • Support for Multiple languages

  • Great API

  • Freedom

  • and ... performance



Currently in Mono we have support for BasicNET (renames as MonoBasic) and for C#, the most beautiful language I have ever seen. It mixed the best of Java/VB/C++. Can you imagine that! That's so much POWER!

First of all, I don't have to see the horrible event model in Java (we have delegates, a powerful way to encapsulate methods and results to be type safe). Also, I don't have to play with weak-type languages like perl or python or basic or ... I really like the clean things and couldn't support to have such an inefficient app that needs that bad approach. Really.

Second, I like the way it is performing the inheritance, and the way it drives the default scope of the members of the class. A big difference with MonoBasic.

Third, I like new statements that add great capabilities. For example, we have the using keyword/statement, that lets use a resource for a limited scope, hiding psoiible problems durin its execution. You will find it useful in a lot of scenarios in which you don't want to write the awful try/catch statements.

This should be enough. Some other things I could say would rely on the Mono platform. However, I think could show the difference between liking a language and a platform.