Archive

Archive for the ‘What I do’ 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:

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:

RAID – fucked up… Thank you Samsung, thank you Adaptec!

January 31st, 2009 mydani No comments

Hello friends,

“long time no post”… But I was damn busy, you know! Some of the things I’ve experienced in the last months are maybe interesting for you, especially if you think of buying a hardware RAID controller.

I’ll tell you ’bout my experiences in a chronological order:

  • I bought a used RAID controller (300$) and new cables (30$) from america for my 2nd PC via Ebay. The controller arrived (after trouble with the customs), but didn’t work properly (it didn’t detect hard drives at all). So I sent it back but kept to cables to…
  • …buy a new RAID controller from a german adaptec distributor. Great, 450€ invested – and a few weeks afterwards I faced the same shit again. No harddrive dected. Well, great, I talked with the support guys from adaptec and they told me to get new “manufactured by adaptec” cables… *grml*
  • Ordered these cables (time until delivery – 5 weeks!). Weeks later I finally managed to have my hard drives recognized by the controller! I was so lucky…
  • …for five minutes. Then the raid drive got degraded the first, but certainly not the last time. So I talked with the adaptec guys again, and they told me that I better buy some enterprise class drives. WHAT? Am I mad? These drives are two and a half times more expensive then desktop drives. And they great thing is – the desktop drive I am using (Samsung HD103UJ 1TB) is on the compatibility list! *ARG* Fortunately I got my money back (thanks to the distributor “city-pc”).
  • After getting rid of the hardware raid (oh man…) I connected all drives to my on-board SATA controller – after a few runs of hutil (the Samsung tool for hard drive diagnostics) I was sure that 3 of the 4 Samsung drives were screwed. Oh great, so I have to return the drives to Samsung.

Final conclusion regarding hardware RAID – if you want to have on, be prepared to buy much more than just the controller. The controller is a quarter of the price. You also have to buy the cables (the original ones – and buy it from the same guy you buy the controller), a battery pack to use the controller’s write cache (otherwise it will be awfully SLOW!) and enterprise class drives (like the Samsung HE series).

I’m done with hardware raids, that’s  what I can say…

Regards!

  • Share/Bookmark

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

Sometimes daily work sucks…

November 22nd, 2008 mydani No comments

Unfortunately, the first post will not be amusing (well, not for the people taking the topic seriously) – because it’s a daily cause for headaches… and hence I sometimes even go berserk!

I’m working in a medium sized business – and the bigger the business is you’re working in, the more tools get invented by either the employees or the tool department, to make your life complicated and dreadful. Nothing new for you guys, right?

So let me list a few daily “use cases” of an employee: Read more…

  • Share/Bookmark
Categories: Business Tags: , ,