e-tobi.net Update

Posted by Tobi Sat, 02 Oct 2010 18:53:00 GMT

Vielleicht hat es der eine oder andere bemerkt, dass e-tobi.net in letzter Zeit öfters mal ausgefallen ist. Der Grund war ganz einfach: Der Server ist aus allen Nähten geplatzt - die 40GB-Platte war randvoll! Aber dank DomainBOX.de konnte ich nun auf einen neuen Server umziehen. Jetzt werkeln hier eine 320'er Platte mit einem 2.2GHz Dual-Core und 2GB RAM unter der Haube.

DomainBOXAn dieser Stelle also nochmal ein fettes Dankeschön an DomainBOX.de für das Sponsoring des Servers und den tollen Support!!!


Neben dem Serverumzug gibt aus auch noch ein paar andere kleine Änderungen.

Für Lenny wird es Paket-Updates nur noch auf expliziten Wunsch geben und es wird für Lenny kein VDR 1.7+ geben! (Mal abgesehn von vdrdevel). Dafür gibt es jetzt ein Squeeze-Repository mit VDR 1.7.16:

deb http://e-tobi.net/vdr-experimental squeeze base addons vdr-multipatch
deb-src http://e-tobi.net/vdr-experimental squeeze base addons vdr-multipatch

Auch mein altes FF/SDTV-System habe ich inzwischen auf Squeeze + VDR 1.7.16 umgestellt. Das apt-get dist-upgrade lief reibungslos durch, lediglich bei den Lirc-Modulen musste ich i2c deaktivieren (siehe #588027).

Wer also up-to-date und HDTV/VDPAU-tauglich sein möchte, sollte auf obiges Repository umsteigen. Damit werde ich in Kürze auch das vdr-ng-experimental-Repository offline nehmen.

Twitter Paket-Updates könnt ihr in Zukunft HIER via Twitter verfolgen (Hashtags: #etobivdrexperimental, #etobivdrdevelexperimental).

TomG hat dankenswerter Weise schon die meisten Pakete aktualisiert. In Kürze werde ich noch xineliboutput auf den neusten Stand bringen und was ggf. sonst noch so anliegt. Einige Plugins sind für Squeeze/VDR1.7 rausgeflogen. Falls ihr da was vermisst, lasst es mich wissen.

Speziell wäre hier das DXR3-Plugin zu erwähnen, das momentan mangels em8300-Paket nicht für Squeeze/Sid compiliert werden kann.


Posted in  | Tags  | no comments | no trackbacks

Polymorphic lists in RavenDB / JSON

Posted by Tobi Tue, 08 Jun 2010 15:23:00 GMT

Recently I'm doing a lot of playing around with RavenDB, a pure .Net Document database.

By default RavenDB can't handle documents containing lists of different types. That's not exactly RavenDB's fault, as the documents are stored as JSON. One way to solve this, is by providing a custom JsonContractResolver, as Ayende already pointed out.

While using JsonContractResolver definitly works, I think, I would prefer to do this using an attribute. Fortunately Newtonsoft.Json already allows this, so I can do:

public interface IBar
{
}

public class Foo
{
    public string Id { get; set; }

    [JsonConverter(typeof(PolymorphicListConverter))]
    public List<IBar> Bars { get; set; }

    [JsonConverter(typeof(PolymorphicListConverter<List<IBar>>))]
    public IList<IBar> NonConcreteBars { get; set; }

    [JsonConverter(typeof(PolymorphicListConverter))]
    public ArrayList NonGenericBars { get; set; }
}

public class BarMaid: IBar
{
    public string Something { get; set;}
}

public class BarTender: IBar
{
    public string SomethingElse { get; set;}
}

Note that PolymorphicListConverter can take a generic type argument, because it might need to know, what type of list to create on deserialization, if the property doesn't use a concrete type.

The PolymorphicListConvert will now take care of the serialization/deserialization:

public class PolymorphicListConverter<TListType> 
  : PolymorphicListConverter where TListType : class, IList
{
    public PolymorphicListConverter()
        : base(typeof (TListType))
    {
    }
}

public class PolymorphicListConverter : JsonConverter
{
    private readonly Type _explicitListType;

    public PolymorphicListConverter()
    {
    }

    protected PolymorphicListConverter(Type type)
    {
        _explicitListType = type;
    }

    public override void WriteJson(JsonWriter writer, object value,
      JsonSerializer serializer)
    {
        writer.WriteStartArray();
        foreach (var item in (IEnumerable) value)
        {
            writer.WriteStartObject();

            writer.WritePropertyName("CrlType");
            writer.WriteValue(item.GetType().AssemblyQualifiedName);

            writer.WritePropertyName("Value");
            serializer.Serialize(writer, item);

            writer.WriteEndObject();
        }
        writer.WriteEndArray();
    }

    public override object ReadJson(JsonReader reader, 
        Type objectType, object existingValue,
        JsonSerializer serializer)
    {
        var list = (IList) Activator.CreateInstance(
          _explicitListType ?? objectType);

        while (reader.Read())
        {
            if (reader.TokenType == JsonToken.EndArray)
                break;

            reader.Read(); //CrlType prop name
            reader.Read(); //actual type
            var type = Type.GetType((string) reader.Value);
            reader.Read(); // value property
            reader.Read(); // actual value
            list.Add(serializer.Deserialize(reader, type));
            reader.Read(); // end object
        }
        return list;
    }

    public override bool CanConvert(Type objectType)
    {
        var deserializationType = (_explicitListType ?? objectType);
        return typeof (IEnumerable).IsAssignableFrom(objectType) &&
               deserializationType.IsClass && 
               !deserializationType.IsAbstract;
    }
}

Posted in  | Tags , ,  | no comments | no trackbacks

XmlTextReader for Delphi

Posted by Tobi Wed, 14 Apr 2010 16:11:00 GMT

Originally I intended to reimplement some old Delphi 6 projects at work to C#, but finally decided to rather give Delphi 2010 a try. Unfortunately the brain-dead decision of Codegear/Embarcadero to make string/PChar be Unicode types by default made the update a little bit more complicated as expected.

But anyways - while updating the old Delphi code I stumbled upon a small project, which I intended to release as Open Source years ago. Better late then never, here it is:

XmlTextReader for Delphi

XmlTextReader for Delphi is a wrapper around the XmlTextReader interface of the libxml2 library. I very much like the XmlTextReader in .Net for processing large XML files, and the libxml2 XmlTextReader is a very similar kind of beast.

Hope someone finds this useful. Feel free to post bugs and feature requests to the GitHub site!

Posted in  | Tags , ,  | no comments | no trackbacks

Keine Patente auf Saatgut und Nutztiere!

Posted by Tobi Mon, 15 Mar 2010 14:56:00 GMT

Software-Patente sind schon ziemlich übel, aber richtig krank wird es eigentlich erst bei der Patentierung von Leben.

Daher an dieser Stelle mal zwei Links:

www.no-patents-on-seeds.org

www.arche-noah.at

Wer sich in Zukunft nicht ausschließlich von gentechnisch manipulierten Grundnahrungsmitteln aus der Hand weniger Großkonzerne ernähren will, ist herzlich eingeladen, sich an den dortigen Unterschriftendsammlungen zu beteiligen!

Tags ,  | no comments | no trackbacks

Ruby / Mechanize Cheat Sheet

Posted by Tobi Thu, 04 Feb 2010 23:00:00 GMT

For a recent article, I've created a Cheat Sheet for Ruby / Mechanize.

You can download it here:

  • Version 2010-01-30 - svg pdf

Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Posted in  | Tags ,  | 1 comment | no trackbacks

 

Categories

Tags

.NET dkb mono Notebook squeeze squeezevdr StructureMap survey vdr visa