March 10th, 2010 mydani No comments

Hello all,

you may or may not have noticed, that I finished a new major version of myTO in the last days. Now I want to share (or at least name) some of the technologies I’ve used for this new release.

LINQ (“SQL-like operations on object collections”):

I’d like to start with the most important one, called “LINQ”. LINQ helped me replacing the horrible dataset intermediate layer I was using to serialize data. By introduction of LINQ, I was able to execute queries against collection of objects, which – at least partly – replaced the features a dataset provided without the flaws. “…Microsoft LINQ defines a set of method names…These can, for example, be used to project and filter data in arrays, enumerable classes, XML (XLINQ), relational database, and third party data sources”

Wikipedia about LINQ

If you wonder how you can dynamically (during application runtime) create LINQ query-statements, describing several conditions which shall be linked by an OR operation, have a look at this:

http://www.rocksthoughts.com/blog/archive/2008/02/27/linq-to-sql-dynamic-queries-2-or-statements.aspx

But another maybe easier way of achieving this is the usage of lambda methods within the query itself. This is one example:

 .Where(x => {
 var result = true;
 if (Object1.Property1 == specialValue)
 result = false;
 ...
 return result;
 })

Now let’s imagine you implemented an object which provides some kind of parent-child relationship. In this case what you want is an implementation for IEnumerable or sth. similar.

One effective method for having this IEnumerable interface implemented can be found here:

http://www.claassen.net/geek/blog/2007/11/searching-tree-of-objects-with-linq.html

CLONING OBJECTS:

From time to time you’ll need to clone/duplicate an object. Well, you can obviously do that by the implementation of the IClonable interface. Nevertheless, you have to do this for each object and adapt the implementation each time you change the class of this object. A better and way faster cloning method is to use IL (intermediate language), as described in this post:

http://whizzodev.blogspot.com/2008/03/object-cloning-using-il-in-c.html

On the same page you can also find how to deep-clone (means cloning the references not as references, but as a clone of the referenced object) object(s):

http://whizzodev.blogspot.com/2008/06/object-deep-cloning-using-il-in-c.html

DATA BINDING:

The standard mechanism of windows forms data binding (>1Mio. hits on google, maybe start with this one: http://www.akadia.com/services/dotnet_databinding.html) is good enough most of the time. Nevertheless, there’s one flaw – whenever one of your object implements a collection interface (IEnumerable,…), data binding treats the object as list of objects. This means you can easily bind the object to a datagridview, which will then show a row per object, but you cannot bind it anymore the object’s properties to simple controls like texboxes and stuff.

My workaround for this problem was not to implement the IEnumerable interface explicitly. Rather than that, I enhanced the class by a new method “AsEnumerable()”, which allowed my to use LINQ statements as well as standard data binding.

public IEnumerable<INode> AsEnumerable(){
 yield return this;
foreach (Node child in Children)
 foreach (var node in child.AsEnumerable())
yield return node;
 }

DATA CONTRACTS (“Transfer objects by disk/network/…”)

As I’ve replaced datasets, I had to cope with the problem of storing objects to disk. Even tough there are several methods available (if interested, google for .NET XML serialization or SOAP), the latest one seems to be very promising. In MSN data contracts are described like this:

“A data contract is a formal agreement between a service and a client that abstractly describes the data to be exchanged. That is, to communicate, the client and the service do not have to share the same types, only the same data contracts. A data contract precisely defines, for each parameter or return type, what data is serialized (turned into XML) to be exchanged.”

Read more about data contracts on MSN.

If you wonder whether you can also store cyclically referenced objects – yes, you can. Here’s a nice article about that:

DataContracts and object references – Service Station, by Aaron Skonnard – Pluralsight Blogs

DRAGNDROP:

As one of the key features I wanted drag’n’drop to work (from Outlook to myTO, and later on from other applications, too). Here are a few links to articles about drag’n’drop, including a bug report for Mozilla Thunderbird to support drag’n’drop. J

CodeProject: How to Implement Drag and Drop Between Your Program and Explorer. Free source code and programming help

Drag’n'Drop von Windows Mail (Vista, 7) – coding-board

Bug 227305 – Support drag-drop single message to desktop / file-system window (e.g. Explorer)

These are some of the technologies and techniques I’ve used during the development. If you like any of these, or you maybe have questions regarding them, I’ll try to help…

Happy coding. :-)

Regards,

Daniel

  • Share/Bookmark
Categories: Software Development Tags:

File/folder Synchronization Tools Revised – Part II

January 18th, 2010 mydani No comments

Hey guys,

I found a mind-blowing tool for synchronization, even real-time. And it’s for free! Have a look at FreeFileSync, it’s awesome!

  • Share/Bookmark
Categories: Uncategorized Tags:

File/folder Synchronization Tools Revised

January 15th, 2010 mydani No comments

Hey guys,

let’s look at synchronization tools – all of ‘em from MS, and all are free and very very good:

Microsoft SyncToy (GUI only)

Robocopy (Commandline, additional gui, single threaded copy)

Richcopy (GUI, threaded copy)

SyncToy is the easiest to use and sufficient in 90% of the time… If you want to sync at a defined time. Same for richcopy, which is very performant because you can have multiple threads do the sync. With robocopy you can have an automated synchronziation in nearly realtime (periodically each minute robocopy checks for changes on the source folder and replicates them to the target folder).

Unfortunately, everyone of these tools does not support a real-time two-way synchronization. You don’t think this is necessary? Well – it actually is! And I’ll explain you why…

In my desktop I use a 1000GB drive to store everything – this drive can be called the “lord of data” or simply the master, as all the other drives are just for backup purposes. Okay, lately I bought a external 2.5” 1000GB drive which is connected via USB2. What I want to do now is work on my fast internal 1000GB as usual and – in the background – Iwant to have every change replicated to the USB drive. Well, this is one-way synchronization only, real-time but one-way. Well, you’re right… But I do actually work on files on the USB drive as well, so I do also have to get the changes from the USB drive to the internal one. So – you’ve already guessed it – I need a tool for 2-way real-time synchronization.

And guess what – I think I found one, called Unison. It requires the GTK+ runtime, which you can get here.

I’ll test this in the next weeks and then, maybe, I’m going to write again about it.
Regards,

Daniel

UPDATE: Forget Unison, not usable on Windows. I’m back to SyncToy – which works.

  • Share/Bookmark
Categories: Uncategorized Tags:

Synchronization Toolchain revised

January 7th, 2010 mydani No comments

  • Share/Bookmark
Categories: Business, Software Development Tags:

Merged homepage and blog…

January 7th, 2010 mydani No comments

Hey guys,

sick of having different content management systems, I merged everything into wordpress and finally achieved the “single source principle” without loosing any pros of a CMS. If you wonder what I’m actually talking about – maybe just have a look at my homepage once. You’ll see my blog and all of my former homepage now in one place. Cool, isn’t it? 8-)

I’ve also added a new page, check it out: Games.

Regards,

Daniel

  • Share/Bookmark

Even better than enigmail and PGP…

December 21st, 2009 mydani No comments

.. is to get your keys from a CA | certificate authority (Wikipedia). There are a some commercial ones and there’s one non-profit one – CACert (http://www.cacert.org).

From CACert you can get certificates for your emails, domains, servers (webservers, mail servers,…), etc… For free! What do you have to do to use it, especially with Thunderbird? Well, follow the following instructions:

1. Create an account at CACert

2. Verify your email address

3. Create a certificate for this email address

4. After creation click the link “install certificate” – now the certificates (private key, public key) are stored in the browser cache. If you’re using firefox, you can save those certificates (options -> security -> certificates)…

5. Save the certificates to your harddrive.

6. Save the root certificates of CACert (class 1 and class 3) from this page to your harddrive as well.

7. Open Thunderbird, Menu: Extras -> Settings -> Certificates. Click on the tab certificate authorities, then import both root certificates. Afterwards clock on the tab “your certificates” and import – well, your certificate!

Done!

Now you can sign or|and encrypt emails and 1. you don’t have to use enigmail/opengpg anymore and 2. you are using trusted certificates rather than some pgp key from some pgp server.

  • Share/Bookmark
Categories: What I do Tags:

Google Wave

December 21st, 2009 mydani No comments

Oh man, sometimes these google guys just overdo it!

Simple ideas well engineered, I guess… But sometimes I wonder why the audience get’s excited about e.g. spelly. I mean… How damn new is this feature? Never seen a spellchecker before?

  • Share/Bookmark
Categories: Uncategorized Tags:

Google Mail/gmail in use with Thunderbird 3

December 21st, 2009 mydani No comments

Hey guys,

as I was fed up with never having my emails at my girls place, I decided to migrate from this usual Outlook|.pst  get-mail-from-gmx-via-pop-situation to google mail (gmail) and IMAP.

Google provides a lot of space and – as one of the few providers – it provides full IMAP access for free… Means I can organize my mails as I did in Outlook. Basically the only thing I was worrying about was the fact that Outlook  itself really sucks when in use with IMAP. It’s damn slow! But – one URL away – the solution, called Thunderbird. I was using Thunderbird a lot, but due to syncing issues (ActiveSync with a Windows Mobile Phone) I finally gave up and migrated to Outlook. But now, as sync is working properly with funambol, I finally switched back to Thunderbird. And the lately released version 3 has – guess what – special support for google mail. Great, isn’t it? :)

Last thing to work out – is it possible to have a local backup…? Oh yes, it is. Basically it’s configurable on a folder basis, so I’ll have my emails available on my local PC even when the internet is broken (as it is sometimes – thanks to my current provider KabelBW) or as soon as I have access to gmail. And with Thunderbird as mail client I can use enigmail like I did a looong time before. Now I everything’s crypted here. Weird.

After I finshed the migration I googled about some enigmail stuff, and I found some guys had already written a good guide how to change to gmail/TB/enigmal…Great stuff… :) So, rather than writing the same stuff again, have a look at

http://www.rayacayan.com/the-web-mail-migration-project-procedure/

Regards!

  • Share/Bookmark
Categories: Uncategorized Tags:

Disk Encryption

December 20th, 2009 mydani No comments

Hey guys,

for some reasons I decided to crypt all of my stuff (harddrives, usb sticks, operating systems, etc.) using Truecrypt – you may have heard of it.

http://www.truecrypt.org/

It’s good and it’s free. So use it! Read more…

  • Share/Bookmark
Categories: Uncategorized Tags:

Synchronization Tool-Chain

December 12th, 2009 mydani No comments

Have a look at this for a big tool chain:

Synchronization Tool Chain visualized

  • Share/Bookmark
Categories: Uncategorized Tags: