Archive

Archive for the ‘Software Development’ Category

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:

Synchronization Toolchain revised

January 7th, 2010 mydani No comments

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

Persistence – JPA – EclipseLink

December 22nd, 2008 mydani No comments

Hello all,

everyone who’s involved in the development of Java applications, which need data out of relational databases, should have a look into the following links which all cover the “persistence” topic.

Read more…

  • Share/Bookmark
Categories: Software Development Tags:

SWT – a new friend of mine

December 13th, 2008 mydani No comments

Hey guys.

usual topic, x-platform GUI development – unusual result. I tried to find a good solution for this cross platform development issue.  And, obviously, I had to have another closer look @ Java. And, well, I found the solution to many of my problems. It’s called SWT.

Read more…

  • Share/Bookmark

“Bye bye ActiveSync” or “how to sync contacts, calendar and tasks under windows and linux between work pc, home pc and mobile phone “

November 29th, 2008 mydani No comments

Hello guys.

Today I want to address another issue that annoyed me a loooon time. But finally, I found a nice decent solution. But let me explain the situation. Facts first… At work I (have to) use Outlook for managing my mails, contacts, tasks and calendar. At home I use thunderbird as a mail and contacts application (for several years now!) and the lightning extension which provides a nice calendar.

Additionally, my mobile phone, which runs windows mobile 6, also provides a calendar, contacts and task list.

Fine. Being an engineer, I was not really satisified with having multiple unsynchronized calendars, contact books and task lists. It’s a pain, I can’t stand it, I HATE IT. So what to do? Well, synchronize! All of them. Unfortunately, this was a real pain. No ActiveSync for linux, no special software for syncing with Mozilla software…

Okay, I think most of you, who wanted to do the same thing, know what I’m talking about. And here’s the solution:

Read more…

  • Share/Bookmark

Crossplatform development sucks, too…

November 28th, 2008 mydani No comments

Good evening.

Sometimes I’m really into coding. At least, I have great ideas for great tools and already complex designs in mind. Unfortunately, I always want to make it very right from the beginning, and this is why I always try to start with platform independant code. And normally, this ends after a few days by dropping the complete idea…

You think I’m weird? No. Impatient? Maybe. But, definitely, I’m frustrated. Why? Because there is really NO nice way of developing a graphical tool for Windows, Linux and MacOS. I know, there are many toolkits, frameworks, etc… But, please, believe me – I know all of ‘em. I wrote code in and for each of them. And believe me – each one has it’s own problems:

Read more…

  • Share/Bookmark