Thursday, 30 April 2009

Monday, 9 March 2009

How to serialize ADODB.Recordset in order to use it with WCF


It is easy to find that, unfortunately, ADODB.Recordset cannot be posted from client to server using WCF. The reason is simple: it is not serializable. The following code allows you to overcome this problem.

1. Without having to serialize using xml, so sufficiently increase the size of data flow in WCF.

2. Without having to convert it into Datatable - you will have quite a perfomnce problem converting it back from a DataTable to ADODB.Recordset in case on the client you (somekind old code) like to consume still ADODB.Recordset

This sample is written using VB.Net and implementing in any other language should be straight forward


'Imaging that rs is a ADODB.Recordset already existing in your code

Dim ret() As Byte
Dim aStr As Object = CreateObject("ADODB.Stream")

rs.Save(aStr, 0) ' 0 is ADODB.PersistFormatEnum.adPersistADTG)
Return aStr.Read(aStr.Size)

Dim binFormat = New System.Runtime.Serialization.Formatters.Binary.BinaryFormatter()

Dim oStream As New System.IO.MemoryStream()
binFormat.Serialize(oStream, rs)
oStream.Flush()
oStream.Position = 0

ret = oStream.ToArray() ' now ret is the byte array and you can post it via WCF


On the client side the following code as an example can be used. Imagine that QueryBypassAsByte is the function that returns the earlier formed byte array over the WCF call


Dim res() As Byte = proxy.QueryBypassAsByte()
Dim oStr As New ADODB.Stream()

'' read back into the stream...
Dim resRecordset As New ADODB.Recordset()
oStr.Open(System.Reflection.Missing.Value, ADODB.ConnectModeEnum.adModeUnknown, ADODB.StreamOpenOptionsEnum.adOpenStreamUnspecified, "", "")
oStr.Type = ADODB.StreamTypeEnum.adTypeBinary
oStr.Write(res)
oStr.Position = 0

resRecordset.Open(oStr, System.Reflection.Missing.Value, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockReadOnly, -1)


Now the resRecordset object contains ADODB.Recordset and you can either consume it or pass it further into any old code.

Saturday, 17 January 2009

Moving toward PhD title: Conferences - posters

There are different ways to participate in conferences and one of those is presenting the work as a so called poster. In the general meaning, the poster is a printing material that can be attached to a wall and can be either textual or graphical or mixed. In our case posters are mainly papers that were not accepted to the conference main stream (as a presentation), but which still have a chance to appear on the conference. The main idea of posters is to give a high-level overview of the work. Those are normally printed out by authors and posted to special transportable walls in conference halls. Each conference attendee, walking in halls can have it read and get introduction into the work. Normally the authors should also be presented somewhere close to the poster so everybody interested in the work can discuss it in more details.

Some conferences do position posters as an official participations in the conference with an article, while other as an un-official. The difference between those is – whether the article will still be included into the conference proceeding or not. If it will be included then it is treated as an article when the author has no right to talk loudly about it unless somebody asks. Otherwise it is a way for students to communicate the work and discuss, but it will not count for the PhD requirement to have x articles published, and so is not worth to accept the invitation in majour cases. Notice that sometimes those are printed in a local proceeding. Therefore you should be very careful if your work is accepted to the conference as a poster and find out in advance what it means from the publication point of view and then check with your supervisor whether it counts or not for your PhD articles requirement.

There are different ways to compile a poster. Mostly posters are prepared by authors in a classical way as a A1 or A2 size paper that contains a composition showing the logical flow of the paper from introduction to the conclusion. Some authors doesn’t bother to produce something creative picture and just put on the poster a set of slides they would show if they are allowed to present the work as a talk. Minor number of authors will just print out A4 pages and put them instead of A1 having printing out nothing more than the text of the article.

There are some examples from ICEIS’08 conference.

Saturday, 10 January 2009

Moving toward PhD title: Been stupefied (the third and last part)

Several posts ago we started to discuss what should you do to break down from been stupefied working on PhD thesis or articles. In addition to communicating the problem to friends or your supervisor you can also:


  1. Postpone your work for some time and switch the type of activity – go for a walk, start building a house or garden. Here you hope that your brain will recharge after some time and you will be able to use it again later … after it was cleaned from all details you never actually needed. Once the light will turn on again in the brain and will do even more than you did so far.
    The biggest disadvantage is – lost time. Besides you can loose the taste for the research and find more useful to deal with the current work task, friends and family on the constant base instead of PhD activities.


  2. Leave you ideas for a while and start researching others. For example to read recent articles from your or neighbour topic hoping to get from there something, that could either be useful for you or even will give you a new, inspiring idea.

    The biggest disadvantage in those approaches is sufficiently decreased productivity and general tiredness that will definitely follow the no-ideas period As soon as you are not concentrated on the topic you find attractive, you will think that it is boring and is not worth to spend your time at all. Especially if you read others articles and struggle to understand the point in these papers. The reason is very simple – your body try to recover from pressure you put on it in the past by routing available resources on other type of activities or just on rest. Generally it is good as you must relax for certain time, but there is a danger to loose a taste of research, forget how interesting it as it is much more boring without details when you look at it from a huge distance.

Saturday, 3 January 2009

Moving toward PhD title: Been stupefied II

In the last post we discussed that it is advisable to discuss a problem, you deal with, with somebody else in case you just cannot think of any good way to progress your work further. Actually such discussion with your supervisor is very useful because of a set of reasons. Notice that supervisor mostly means superior, i.e. having a lot of experience and therefore a constant communication will surely accelerate your progress moving toward the desired goal.

First of all you can communicate to supervisor the current status of the work and articles. Sometimes supervisor can help just by asking “right” questions pushing you in the certain direction or way of thinking highlighting the point where you did something incorrectly or incompletely
Secondly s/he can show you new ways, directions, which are obvious for him/her. Notice that you should not afraid that if the idea is produced by supervisor, then it is no longer yours and you will be just a „work force” evolving others thoughts. The truth is: each research is a lot of work and certainly much more just one sentence said once. It is different hypothesises, proves, collecting statistical information or measuring some process, solving local problems and so forth. In other words it is all that your supervisor has neither time to do nor intentions to do. S/he has a lot of own ideas, which s/he is fond of.

Finally it will allow you just to talk the problem out and probably you will find new ideas and solutions just properly formulating your thoughts in front of some superior person.

Monday, 29 December 2008

Greetings from Tallinn

Friday, 26 December 2008

Moving toward PhD title: Been stupefied I

Normally, the process of writing of PhD work/articles is well-balanced and rapid, but sometimes a certain problem occurs when you have no ideas how to evolve the work further. You just cannot think of any good ideas and this lasts quite a long time – a week or a month. It seems that all ideas left you head and promised never return back and the best thing you can do is to apply to some none-intellectual type of work. It is especially sad since you had a lot of good ideas just 10 minutes ago .... and now you can park a truck or two into the completely empty garage called „your brain”.

Such problems are quite common and experienced by most scientists during certain periods of their life. What you desperately need in such case is to obtain (somehow) a new point of view on the problem you deal with in your PhD thesis. The best way to get it is to communicate the problem to somebody else. This person can be your supervisor (why else you need him / her :)? ) or another student probably having the same problem and so a lot of time to talk about whatever you would like to talk about.