<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3861081418466813218</id><updated>2011-08-24T01:47:40.424-07:00</updated><category term='C#'/><category term='db4o'/><category term='DTS'/><category term='Performance'/><category term='General'/><category term='Solar System'/><category term='Web Services'/><category term='.Net'/><category term='Mars'/><category term='db4o Messaging'/><category term='Databases'/><category term='ASP.Net'/><category term='Astronomy'/><category term='Programming'/><title type='text'>Edwin's Trek</title><subtitle type='html'>My thoughts on programming, databases and other cool stuff</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-4328511672473969419</id><published>2008-01-21T01:17:00.000-08:00</published><updated>2008-01-21T01:25:22.672-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='db4o'/><category scheme='http://www.blogger.com/atom/ns#' term='Databases'/><title type='text'>6 Reasons for Not Using db4o</title><content type='html'>&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-family:Arial;"&gt;Don’t misinterpret the title. Db4o is such a good product. I admit that I was skeptical to use it at first. But once you tried using it, you don’t want to stop. You may know other reasons from people you know why they are still not using db4o. Are you one of these? Read on. You will not use db4o unless:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;ul style="margin-top: 0in;" type="disc"&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;b style=""&gt;&lt;span style="font-family:Arial;"&gt;You want to take it slow&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;. If you want to spend time mapping your objects      to relational counterparts, that’s it for you. Even if there are ORM      tools, you still need some time that a native ODBMS will not require.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;b style=""&gt;&lt;span style="font-family:Arial;"&gt;Your faith is in RDBMS&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;. Some developers I know have been “doctrinated”      that RDBMS is better and ODBMS is not good. We can not blame people      thinking that after what happened to history. Added to this, there is this      tendency of sticking to “What’s In? In is cool” and sticking to the      majority. They think the vast majority is way cooler. And this vast      majority is the RDBMS crowd. But it’s high time to look at the products      today, especially db4o. The product is promising and there are thousands      and thousands of members in the community trusting the product and the      company behind it. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;b style=""&gt;&lt;span style="font-family:Arial;"&gt;You want more work and less implementations&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;. Coding for queries, inserts, updates and      deletes are very simple in db4o. This will mean more time for features to      be implemented than spending time mapping objects to relational      counterparts. More implemented features means good for us developers and      it equates to good employee performance and satisfied customers.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;b style=""&gt;&lt;span style="font-family:Arial;"&gt;You want more time in your work and less with      love ones.&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt; I remember the days      when my colleagues and friends used to say “No time for love”. I was      single back then and I’m spending less time with my girlfriend (now my      wife) because of lots and lots of things to code. Now I have a 3-year old      daughter and I need even more time for love ones. If your development      tools can cut development time and your database does not require more      coding, then you’ll have more quality time for your family. Db4o made my      database tasks simpler. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;b style=""&gt;&lt;span style="font-family:Arial;"&gt;“But you can do away with ORM and map your table      fields straight to your user interface, right?”&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt; Before I answer that, I can see that there is a      group who prefers RDBMS and ORM Tools. On the other side is a crowd who      prefers to use ODBMS like db4o. The main goal of both groups is to adhere      with object-oriented design and principles. This is not bad.      Object-oriented principles have been proven to be advantageous many times.      However, there is a third crowd who will neither do ORM nor objects. They      say that the overhead of doing ORM will be reduced by deviating      object-oriented rules. That is, do your SQL homework, call it in C# or any      language and map it to your visual controls. Actually, you can do this in      Visual Studio without too much coding effort. Just drag the data controls      and visual controls to your form or web page, set the properties and      that’s it. You have a running application! Just to answer the question,      yes, you can escape from ORM and its overhead and map it straight to      visual controls. But why not solve the ORM issues by using a native      object-oriented database like db4o? You adhered to object-oriented      principles without hurting performance and you got rid of the impedance      mismatch at the same time.&lt;b style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class="MsoNormal" style="text-align: justify;"&gt;&lt;b style=""&gt;&lt;span style="font-family:Arial;"&gt;You just don’t know db4o. &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:Arial;"&gt;When I started working with db4o, I told my team      about it. Then I told my boss. I talked about it with other developers I      know. I even tried a demo from one of my projects. And they think it’s      cool. I was allowed by my boss to look into it. But you know what? When I      talked to people about it the first time, they never heard of it. Knowing      these reasons now, I think there is some lack of promotions in certain      areas like mine. I don’t know with others. Starters can always download and try it      out and read (thoroughly) the documentation. You won’t regret you had.      Then, we can help by telling friends about it. Write something about it      and tell the world. Contribute codes and help newcomers cope up. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-family:Arial;"&gt;As usual, this is just to share my thoughts on my favorite database. I’ve been using it in a Client-Server environment so you may have a different experience than mine. But generally speaking, you can think of the thoughts presented here.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-4328511672473969419?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/4328511672473969419/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=4328511672473969419' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/4328511672473969419'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/4328511672473969419'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2008/01/6-reasons-for-not-using-db4o.html' title='6 Reasons for Not Using db4o'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-2658228587974877499</id><published>2008-01-14T21:40:00.000-08:00</published><updated>2008-01-14T22:09:06.333-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='db4o'/><category scheme='http://www.blogger.com/atom/ns#' term='Databases'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Performance Guide to Tune your Application and db4o Database for Report Generation</title><content type='html'>&lt;p align="justify"&gt;&lt;span style="font-family:arial;"&gt;Reports drive businesses to be better. Behind those humongous data are processes that will need to generate summaries, listings, graphs and more. In addition to &lt;a href="http://developer.db4o.com/Resources/view.aspx/Reference/Tuning"&gt;what we know&lt;/a&gt; on how to supercharge our db4o database to top speed, below are the two main questions I ask myself when I am designing my application using db4o database for speed of generating reports:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;Will the report be produced real-time or not?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;This is a question I ask my users before I finalize the data source of the report. If this will be a periodic report (weekly, monthly, etc.), what I find the best design strategy for speed is to persist only the needed information in the particular report in one object, have an automated process run at night (or weekends depending on the requirement) to update the data. When reporting comes, my application will query the summarized data based on user criteria. This way, the user will perceive a faster generation of report based on lots of data. However, if the report is needed on demand real-time based on the latest data, that’s the only way I will need to query directly from the raw objects.&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;div align="justify"&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;Will the volume of raw data be very large?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Upon initial design stage of a system, I try to find out if the volume of data can be very large that querying it whether native queries or SODA will still be slow and unacceptable to the user. When I perceive this to be the case, I will design my db4o database into separate files. This will increase processing and loading time since the data store is smaller. (Designing which goes to what file is something to be taken seriously, though. It can make things better or worst depending on the design) One example is when you need to generate a monthly report out of humongous raw objects. You can design separate files each based by month and year. If separate monthly files are your way to go, I have found using the following to be effective in my case:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;FlushFileBuffers(false)&lt;/strong&gt; – “Wait a minute! Isn’t this considered a dangerous practice?” Yes, it is. This is included in the Dangerous Practices in the Reference Documentation. You may not agree with me but here’s the idea why. The monthly report files are generated separately each month. So a damage one will not affect the other. Added to that, when it gets corrupted due to some factors, you can still reproduce it by triggering the data processing for the month and year concerned.&lt;br /&gt;&lt;strong&gt;Enable Field Indexes on Key Fields&lt;/strong&gt; – This should be clear why. This will increase performance when you retrieve your summary data later. But remember, just the key fields only. You may degrade processing performance by adding unnecessary indexes.&lt;br /&gt;&lt;strong&gt;Disable Query Evaluation on Fields Not Used for Querying&lt;/strong&gt; – as the documentation states, all fields are evaluated by default. Specifying which of the fields will not be evaluated will increase performance&lt;br /&gt;&lt;strong&gt;Unicode(false)&lt;/strong&gt; – if your report is in plain English and not using double byte characters, turn Unicode support off. This is on by default.&lt;br /&gt;&lt;strong&gt;Query Evaluation Mode to SnapShot&lt;/strong&gt; – after processing has taken place, it’s time for the users to view the output. Snapshot is best for the client-server setting if your memory.&lt;br /&gt;&lt;strong&gt;Blocksize(8)&lt;/strong&gt; – I have found following this recommended setting increases performance. Changing it to a higher value makes processing slower.&lt;br /&gt;&lt;strong&gt;When Processing, Open or Create the File Using OpenFile. Use OpenServer to Open it later for shared use&lt;/strong&gt; – Single-user access is still the fastest when processing data. And since the user doesn’t need the output at processing time, OpenFile will be just right. When the time comes that the users need to view the report in your application, that’s the only time this will be hosted using OpenServer.&lt;br /&gt;&lt;br /&gt;Separating data in different files will simplify my query unlike one database for everything. And therefore will increase the performance. A more complex query will more likely to run slowly. Backing up the monthly data is also simpler in this setup. And chances of reaching the database file size limit will be low.&lt;/span&gt;&lt;span style="font-family:arial;"&gt; &lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p align="justify"&gt;&lt;span style="font-family:arial;"&gt;I have presented here my general considerations in this type of scenario which is reporting. There are other factors to consider that may only be applicable to your situation. I hope this general guide will help you.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-2658228587974877499?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/2658228587974877499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=2658228587974877499' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/2658228587974877499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/2658228587974877499'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2008/01/performance-guide-to-tune-your.html' title='Performance Guide to Tune your Application and db4o Database for Report Generation'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-2030239569984528414</id><published>2008-01-02T17:11:00.000-08:00</published><updated>2008-01-14T22:10:25.519-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.Net'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Invoking Web Services the Better Way</title><content type='html'>&lt;span style="font-family:arial;"&gt;Web services are around for some time and it has been supported by lots of languages and development tools, including Java and the .Net languages. In .Net, invoking web service methods is as easy as calling your own methods from a class library. There are requirements, though, before you can invoke any web service method. Just like your class library, you need to create a reference to the web service from the invoking client application. In .Net, this is a web reference. After that, you can declare any variable for your web service, like the one below:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0);font-family:arial;font-size:85%;"  &gt;MyWebService service = new MyWebService();&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Calling it is also simple:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="COLOR: rgb(0,153,0);font-size:85%;" &gt;returnedvalue = service.MethodName();&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;In .Net 2.0, Microsoft has added support for the new multithreaded programming with event-based asynchronous pattern when generating the proxy code by the WSDL tool. This opens a new way of invoking web services, better and faster. And this allows the programmer to easily utilize this feature without creating complex multithreading code. In the &lt;a href="http://msdn.microsoft.com/msdnmag/issues/07/03/WickedCode/"&gt;MSDN magazine&lt;/a&gt;, it has been pointed out that many web sites that utilize ASP.Net are not making use of asynchronous web service calls and in the end, experience the “Server Unavailable” error when lots of processes have consumed the thread pool. In order to conserve this thread pool, you need to call web services asynchronously. In my &lt;a href="http://edwinstrek.blogspot.com/2007/12/design-for-performance-implementing-web.html"&gt;last post&lt;/a&gt;, I have pointed out that this is one of the design considerations when developing applications using web services.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Implementing it is easy. You just need to add little code. The first thing to do is to add the Async attribute to the @Page directive to allow asynchronous calls:&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="COLOR: rgb(0,153,0)"&gt;&amp;lt;%@ Page Language="C#" Async="true" %&amp;gt;&lt;/span&gt;&lt;span style="COLOR: rgb(51,204,0);font-size:85%;" &gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;And then, depending on your requirements, you can utilize what event you need. What I have tried is to use an event handler for the Completed event of my proxy. Below is an example:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="COLOR: rgb(0,153,0);font-size:85%;" &gt;service.MethodNameCompleted += new WebServiceProxy.MethodNameCompletedEventHandler(service_MethodNameCompleted);&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;The &lt;methodname&gt;Completed is automatically generated by the WSDL tool where the methodname is the name of the method you are trying to invoke. When the method you call has completed its execution, this event will be triggered so whatever things you need to do after the web method call (such as binding data sources to controls) should be coded in this event.&lt;br /&gt;&lt;/methodname&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Lastly, you call the &lt;methodname&gt;Async where again, the methodname is the name of the method in the web service that you are trying to call. When this is invoked, it will return immediately, allowing you to perform further operations.&lt;br /&gt;&lt;/methodname&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(0,153,0);font-family:arial;font-size:85%;"  &gt;returnedvalue = service.MethodNameAsync(params);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;That’s the additional code you need to make call web services asynchronously. It is not so much of a big deal to add and the advantages outweigh the disadvantages.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;p&gt;&lt;span style="font-family:arial;"&gt;When is this applicable to use?&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;When you perform time-consuming tasks such as database operations (like a native query or SODA returning a large object set)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;When you need to execute multiple operations simultaneously&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;When you need to wait for resources without “hanging” your application.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:arial;"&gt;&lt;p&gt;&lt;br /&gt;You need to take note of this one thing: When you are still debugging your web methods, adding a breakpoint somewhere in the web service method (or a class library being invoked by the web service method) will not work, that is, the debugger will not stop in the breakpoint you specified. In order to work around on this, you can try calling the method synchronously at first. That is, calling it the usual way. When you are finish debugging, change the code to make use of asynchronous calls. Even better, a unit test can verify if your code is working or not before assembling all the components. This way, debugging will be less. &lt;/p&gt;&lt;p&gt;So, how about that? If your hands are getting itchy to try this out, try it now. You won’t regret you have used this feature.&lt;/p&gt;&lt;p&gt;---------------------------------------------------------------------------------------&lt;/p&gt;&lt;p style="FONT-FAMILY: arial"&gt;Related Posts:&lt;/p&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a style="FONT-FAMILY: arial" href="http://edwinstrek.blogspot.com/2007/12/design-for-performance-implementing-web.html"&gt;Design for Performance: Implement Web Services the Better Way&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-2030239569984528414?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/2030239569984528414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=2030239569984528414' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/2030239569984528414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/2030239569984528414'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2008/01/invoking-web-services-better-way.html' title='Invoking Web Services the Better Way'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-6563923645487114947</id><published>2007-12-30T17:00:00.000-08:00</published><updated>2008-01-14T22:10:45.865-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='Web Services'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.Net'/><category scheme='http://www.blogger.com/atom/ns#' term='.Net'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Design for Performance: Implementing Web Services Better</title><content type='html'>&lt;span style="font-family:arial;"&gt;In a distributed environment where different servers contribute for the processing of a certain task, good design is essential. One point of consideration is your database. If you have a db4o database and you have designed it well, it will give you the expected results. However, something can still slow down your application even if you designed your database well. What else could go wrong? Your middle-tier is another point of consideration. Are you using web services? Is it waiting too long because of a large database query? Let’s consider some design guidelines that can take you to maximum warp.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Consider asynchronous calls.&lt;br /&gt;&lt;/strong&gt;If you are doing large queries that can let your calling application wait for a long time, this is a must. I will explain this further on the next post.&lt;/li&gt;&lt;li&gt;&lt;strong&gt;Group different information into one when making web service calls&lt;br /&gt;&lt;/strong&gt;You may have data that you need to display in one or more dropdown lists, an existing transaction that comprise several objects, and any other information that you need to query from the database. Depending on your needs, you can reduce the number of calls to a web service just to return all of the objects you need. &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Cache the results of the web service call&lt;br /&gt;&lt;/strong&gt;Output caching is one of the cool things in ASP.Net. How does it work for web services? Suppose you call a web service that returns true if a user is a valid user in your application. You can cache the result of the web service in a specified time and when the same web service call with the same parameters is invoked again, instead of executing it, ASP.Net will get the results from the cache. This improves performance. Implementation is simple:&lt;/li&gt;&lt;/ul&gt;&lt;p style="MARGIN-LEFT: 0.5in"&gt;&lt;span style="font-size:85%;color:#009900;"&gt;[WebMethod(CacheDuration=60)] public bool IsUserAuthentic(string userId, string password)&lt;/span&gt;&lt;/p&gt;&lt;p style="MARGIN-LEFT: 0.5in"&gt;&lt;br /&gt;You just need to add the CacheDuration web method attribute and give it a time period in seconds to remain in the cache. In our example, the result will remain in the cache for 60 seconds. Take note, however, not to abuse this feature. This is really cool, I agree. But using too much of this, specially caching large object sets for a long time can be trouble. When caching results, ASP.Net stores it in server memory. It remains in memory for the specified cache duration. If you also have service calls that vary most of the time, it is not a good candidate for caching.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The next time you find bottlenecks in your web services, assess the problem by considering the performance guidelines above.&lt;/span&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-6563923645487114947?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/6563923645487114947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=6563923645487114947' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/6563923645487114947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/6563923645487114947'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2007/12/design-for-performance-implementing-web.html' title='Design for Performance: Implementing Web Services Better'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-8310372623830599714</id><published>2007-12-24T04:10:00.000-08:00</published><updated>2008-01-14T22:11:21.159-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='db4o'/><category scheme='http://www.blogger.com/atom/ns#' term='Databases'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.Net'/><title type='text'>Importing External Data to db4o</title><content type='html'>&lt;span style="font-family:arial;"&gt;From time to time, we may experience requirements involving exporting data from one source to another. Today, I will show you how an external data can be exported in db4o. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;The following technologies will be used:&lt;br /&gt;&lt;/strong&gt;&lt;span style="color:#3366ff;"&gt;· Db4o 6.4&lt;br /&gt;· .Net 2.0 using C#&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;This post will discuss the following:&lt;/strong&gt;&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;· Reading a text file using StreamReader&lt;br /&gt;· Extracting data from a line of record into db4o objects&lt;br /&gt;· Use List&lt;t&gt; Find method to check for existence&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;Data can come from many different sources. It can be an XML file, Excel File, from an RDBMS, from a web service or simply from a text file. I’m going to show you today about reading a text file as our source data. First, let’s take a look at the format of our sample text file: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="color:#3366ff;"&gt;“Department””Position””Name””Salary”&lt;br /&gt;“Information Technology””Team Leader””Jun Marfil””30000.00”&lt;br /&gt;“Information Technology””Programmer””Dino De Guzman””25000.00”&lt;br /&gt;“Human Resources””Benefits Supervisor””Shyrel Morco””15000.00”&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;From the data above, we can see that we need a department object, position object and employee object. The column delimiter is the pipe symbol () and it’s obvious that rows are separated by carriage return and line feed.&lt;br /&gt;&lt;br /&gt;In order to process this data, we need to read each line one by one. Each line of record should be read based on the column delimiter, interpreted and then written to a db4o database.&lt;br /&gt;&lt;br /&gt;Now, in order to read the loaded text file line by line, we need the StreamReader. To parse a line of record, we will use the Split string method to put the data in an array of string columns.&lt;br /&gt;&lt;br /&gt;Before we jump into code, let’s define our classes.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;public class Department&lt;br /&gt;{&lt;br /&gt;private string _name;&lt;br /&gt;&lt;br /&gt;public Department(string name)&lt;br /&gt;{&lt;br /&gt;_name = name;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string Name&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _name;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_name = value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Position&lt;br /&gt;{&lt;br /&gt;private string _name;&lt;br /&gt;&lt;br /&gt;public Position(string name)&lt;br /&gt;{&lt;br /&gt;_name = name;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string Name&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _name;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_name = value;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public class Employee&lt;br /&gt;{&lt;br /&gt;private string _employeeName;&lt;br /&gt;private double _salary;&lt;br /&gt;private Department _department;&lt;br /&gt;private Position _position;&lt;br /&gt;&lt;br /&gt;public Employee(string name, double salary,&lt;br /&gt;Department department,&lt;br /&gt;Position position)&lt;br /&gt;{&lt;br /&gt;_name = name;&lt;br /&gt;_salary = salary;&lt;br /&gt;_department = department;&lt;br /&gt;_position = position;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string EmployeeName&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _employeeName;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_EmployeeName = value;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#009900;"&gt;public double Salary&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _salary;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_salary = value;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#009900;"&gt;public Department EmployeeDepartment&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _department;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_department = value;&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#009900;"&gt;public Position EmployeePosition&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _position;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_position = value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now let’s look into the part of our program of parsing text. We assume that the database is already open at this point.&lt;br /&gt;&lt;br /&gt;&lt;span style="color:#009900;"&gt;private void ImportTextFile (IObjectContainer db)&lt;br /&gt;{&lt;br /&gt;string employeeName;&lt;br /&gt;double salary;&lt;br /&gt;string employeePosition;&lt;br /&gt;string employeeDepartment;&lt;br /&gt;string record[];&lt;br /&gt;string rawRecord;&lt;br /&gt;List&amp;lt;Position&amp;gt; positionList = new List&amp;lt;Position&amp;gt;();&lt;br /&gt;List&amp;lt;Department&amp;gt; departmentList = new List&amp;lt;Department&amp;gt;();&lt;br /&gt;Employee employee;&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;using (StreamReader sr = File.OpenText(“sample.txt”))&lt;br /&gt;{&lt;br /&gt;while ((rawRecord = sr.ReadLine()) != null)&lt;br /&gt;{&lt;br /&gt;// remove the quotes&lt;br /&gt;rawRecord = rawRecord.Replace("\"", "");&lt;br /&gt;&lt;br /&gt;// put into array&lt;br /&gt;record = rawRecord.Split(‘"’);&lt;br /&gt;&lt;br /&gt;//avoid the header line&lt;br /&gt;if(record[0] == “Department”)&lt;br /&gt;{&lt;br /&gt;//do nothing&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{ //get column values&lt;br /&gt;employeeDepartment = record[0];&lt;br /&gt;employeePosition = record[1];&lt;br /&gt;employeeName = record[2];&lt;br /&gt;salary = Convert.ToDouble(record[3]);&lt;br /&gt;}&lt;br /&gt;positionList = AddToList(positionList, employeePosition, db);&lt;br /&gt;departmentList = AddToList(departmentList, employeeDepartment, db);&lt;br /&gt;&lt;br /&gt;employee = new Employee(employeeName, salary, employeeDepartment, employeePosition);&lt;br /&gt;db.set(employee);&lt;br /&gt;}&lt;br /&gt;db.Commit();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;db.rollback();&lt;br /&gt;throw new Exception(“Error processing text file”,ex);&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;sr.Close();&lt;br /&gt;db.Close();&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="color:#009900;"&gt;&lt;p&gt;&lt;br /&gt;private List&amp;lt;Position&amp;gt; AddToList(List&amp;lt;Position&amp;gt; list, string name,&lt;br /&gt;IObjectContainer db)&lt;br /&gt;{&lt;br /&gt;Position position;&lt;br /&gt;&lt;br /&gt;// search if the name being inserted is already in the list&lt;br /&gt;position = list.Find(delegate(Position pos)&lt;br /&gt;{&lt;br /&gt;return pos.Name == name;&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;if (position == null)&lt;br /&gt;{&lt;br /&gt;position = new Position(name);&lt;br /&gt;list.Add(position);&lt;br /&gt;db.Set(position);&lt;br /&gt;db.Commit();&lt;br /&gt;}&lt;br /&gt;return list;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private List&amp;lt;Department&amp;gt; AddToList(List&amp;lt;Department&amp;gt; list, string name,&lt;br /&gt;IObjectContainer db)&lt;br /&gt;{&lt;br /&gt;Department department;&lt;br /&gt;&lt;br /&gt;department = list.Find(delegate(Department dept)&lt;br /&gt;{&lt;br /&gt;return dept.Name == name;&lt;br /&gt;});&lt;br /&gt;&lt;br /&gt;if (department == null)&lt;br /&gt;{&lt;br /&gt;department = new Department(name);&lt;br /&gt;list.Add(department);&lt;br /&gt;db.Set(department);&lt;br /&gt;db.Commit();&lt;br /&gt;}&lt;br /&gt;return list;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now let’s recap. We have made 3 classes for our objects and it’s pretty straightforward. The method we define for processing the file used several objects worth our concern. We used the StreamReader to process our file and the Readline is the one we used reading the file line by line. We did not try to load all the lines in memory since this will become troublesome when our file is several MBs and GBs big. We used the Split string method in order to parse the string based on the pipe symbol delimiter and put it in an array. Then, we store each and every array element in a variable. Another notable method is the AddToList method. We used the generic List&amp;lt;t&amp;gt; instead of IList so we can make use of the Find method. We need this so we avoid inserting duplicate departments and positions. After parsing the values, we are now ready to save an Employee object in our database.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Our code is rather simple at this point. One point of improvement is to put some visuals to the user like a progress bar to indicate the status of the processing. Or instead of the AddToList method is to use db4o callbacks to check for duplicates prior to commit.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;That’s how simple it is to import data from an external data source like a text file into db4o. I hope you find something useful in this post.&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-8310372623830599714?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/8310372623830599714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=8310372623830599714' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/8310372623830599714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/8310372623830599714'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2007/12/importing-external-data-to-db4o.html' title='Importing External Data to db4o'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-1616452807573079389</id><published>2007-12-16T20:31:00.000-08:00</published><updated>2007-12-16T20:49:01.186-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Solar System'/><category scheme='http://www.blogger.com/atom/ns#' term='Astronomy'/><category scheme='http://www.blogger.com/atom/ns#' term='Mars'/><title type='text'>Mars Closest to Earth on December 17, 2007</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;Yes, it's true according to space.com. And Mars will have the most attention on December 23. Very cool to space enthusiasts. See this &lt;/span&gt;&lt;a href="http://www.space.com/spacewatch/071214-ns-mars-closest.html"&gt;&lt;span style="font-family:arial;font-size:85%;"&gt;link&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:arial;font-size:85%;"&gt; to take you to the full story. Too bad for me, it will be visible to those living in the Northern Hemisphere. How I wish I was there! I'm really fascinated with space, the solar system and the universe in general. That's why I also love star trek. It feels like the show is taking me there, where no one has gone before. So for those in the Americas, Arctics, and parts of Europe, happy sky viewing!&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-1616452807573079389?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/1616452807573079389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=1616452807573079389' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/1616452807573079389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/1616452807573079389'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2007/12/mars-closest-to-earth-on-december-17.html' title='Mars Closest to Earth on December 17, 2007'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-7546386956999421840</id><published>2007-12-06T22:46:00.000-08:00</published><updated>2007-12-06T23:09:50.312-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='db4o'/><category scheme='http://www.blogger.com/atom/ns#' term='db4o Messaging'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='.Net'/><title type='text'>“Message Received”</title><content type='html'>&lt;p&gt;&lt;span style="font-family:arial;"&gt;Db4o has a client-server feature called Messaging. It’s so cool it allows you to execute a process remotely. It has less overhead and the execution is asynchronous. I find it so useful that something like this will fit in with my current project. I need to do something like this: &lt;/span&gt;&lt;/p&gt;&lt;span style="font-family:arial;"&gt;&lt;ul&gt;&lt;li&gt;The user will upload a text file thru a browser&lt;br /&gt;With the sounds of this, it is an ASP.Net application. The text file is delimited and it can be translated into columns of data. &lt;/li&gt;&lt;li&gt;After the file has been uploaded, a process should execute to transfer the data in the text file to my db4o database&lt;br /&gt;Each column of data in the text file will go to an object repository &lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Sounds simple. However, the text file is several MBs big so it will be a long running process. The user will be very bored uploading and processing the data. So I came up with the following additional requirements: &lt;/p&gt;&lt;ul&gt;&lt;li&gt;Once the text file is uploaded, an asynchronous operation needs to be done so the processing will actually happen in the server where the db4o database is located. &lt;/li&gt;&lt;li&gt;The processing logs certain information so that when the user inquires of it, he can see it in the browser page that displays the current status of the processing. &lt;/li&gt;&lt;li&gt;The user can close the browser anytime after the processing starts or go to another page while the processing is being done. He can inquire later on a page where he can see the current status. Wow! This is something that will make the user more productive. &lt;/li&gt;&lt;li&gt;In the server, I would like to know when a processing has been triggered and the current status of the processing so I cannot just shutdown the db4o server or do something bad for it. &lt;/li&gt;&lt;li&gt;I can also do the uploading of the text file and processing in the server application.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;Now this is something more complicated. It made me excited to do this so I started the research. I came thru the db4o reference documentation on Client Server regarding Out-of-Band Signaling. I read it and decided that this is the thing I need. How does it work? Figure 1 shows a high-level diagram of how I did it. I’m used to do distributed apps in my Visual Basic 6 days so I tried something distributed in this case. Explaining the architecture further is out of the scope of this topic. &lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5141120269531590706" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 454px; CURSOR: hand; HEIGHT: 398px; TEXT-ALIGN: center" height="349" alt="" src="http://bp0.blogger.com/_D0ueM_w4AgE/R1jtpXT9sDI/AAAAAAAAAAM/XVHKl7cLfgA/s320/Messaging.gif" width="332" border="0" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Now for some explaining to do. I will just cover the part where I’m actually sending and receiving the message. I will make it simple thru explaining with code blocks. I can’t post my entire code for some restrictions with my current employer. For a working example, you can go to the reference section of the db4o documentation. First, the objective of messaging is straightforward: The client will tell the server to execute a process. The message being sent is actually any object that is storable in db4o. With this you create a class in C# that you will use to be sent to the server.&lt;br /&gt;&lt;br /&gt;Below is the class that we will use as our message class:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;public class MyMessage&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;private string Message;&lt;br /&gt;&amp;nbsp;&amp;nbsp;public MyMessage(string message)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Message = message;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;get&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return Message;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;set&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Message = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;} &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;In order to receive messages, you will need a class that will implement the IMessageRecipient. This can be on the same namespace where the server application resides.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;public class MyMessageRecipient: IMessageRecipient&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;void IMessageRecipient.ProcessMessage(IObjectContainer con, object message)&lt;br /&gt;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;if (message is MyMessage) // MyMessage is the class we defined above&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;// call routines for your long processing and logging any status&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Before a server can actually receive messages, it needs to be configured that way. There should be something like the code below be implemented in the server application when the server will be started.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;IConfiguration config = Db4oFactory.NewConfiguration();&lt;br /&gt;IObjectServer server;&lt;br /&gt;Config.ClientServer().SetMessageRecipient(new MyMessageRecipient())&lt;br /&gt;server = Db4oFactory.OpenServer(config, &lt;em&gt;[yapfile]&lt;/em&gt;, &lt;em&gt;[port]&lt;/em&gt;);&lt;br /&gt;server.GrantAccess(&lt;em&gt;[userid]&lt;/em&gt;, &lt;em&gt;[password]&lt;/em&gt;);&lt;br /&gt;// some other code here, if desired&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Now, sending messages is simple enough. You can implement something like the code below in the Business Rules layer.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;IObjectContainer db = Db4oFactory.OpenClient(&lt;em&gt;[hostname]&lt;/em&gt;, &lt;em&gt;[port]&lt;/em&gt;);&lt;br /&gt;IMessageSender sender = db.Ext().Configure().ClientServer().GetMessageSender();&lt;br /&gt;MyMessage msg = new MyMessage(“Some Message”);&lt;br /&gt;sender.Send(msg);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;// some other code here, if desired&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That’s how it is. You can try it yourself and see how this is a very good feature of db4o when dealing with client-server. Happy Messaging!&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-7546386956999421840?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/7546386956999421840/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=7546386956999421840' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/7546386956999421840'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/7546386956999421840'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2007/12/message-received.html' title='“Message Received”'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp0.blogger.com/_D0ueM_w4AgE/R1jtpXT9sDI/AAAAAAAAAAM/XVHKl7cLfgA/s72-c/Messaging.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-8540300205810912996</id><published>2007-11-26T22:27:00.000-08:00</published><updated>2008-01-09T02:04:35.782-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='db4o'/><category scheme='http://www.blogger.com/atom/ns#' term='DTS'/><title type='text'>Microsoft DTS and db4o</title><content type='html'>&lt;span style="font-family:arial;"&gt;Microsoft Data Transformation Services (DTS) is a good tool bundled in SQL Server. One of the things you can do with it is to upload data from different file formats like text file and excel file into SQL Server. In this post, I will try to log my experience in comparing it to the program I created in db4o to transfer data from text/excel file to db4o. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;I tried to upload 2 files in SQL Server: one is a text file and the other is an excel file. I uploaded it as is based on the columns in the files. The 2 files eventually became tables in SQL Server. I performed a query left joining the 2 tables to find out if an item does not exist in the other. The result was 1,033 records.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;My db4o program's objective is to have the same results as in the SQL version. But to my surprise, the results are not the same. First, it gave me more than double the number of records I got from SQL Server. I found out that there are some information in the file that has spaces after them. For example: I'm expecting "FOO" but the data is "FOO " (with one space character after). So I tried to trim them. After that, the result is still not the same in terms of numbers. There are 3 records more in the result from the db4o program. After some scrutinization, I have found out that I forgot an important element: the data is not consistent if it's lower or uppercase strings. (See related post &lt;a href="http://edwinstrek.blogspot.com/2007/11/since-i-started-my-project-using-db4o-i.html"&gt;here&lt;/a&gt;) I tried converting them all to uppercase and finally, the results are the same.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;Here are the lessons learned:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;1. DTS removes trailing spaces in your data. Your db4o program should do the same to obtain the same result.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;So that means, it "looks" like you uploaded it in SQL Server "as is" but actually, all data are trimmed to remove the spaces. I proved that by inspecting the data in SQL Server with the len() function. It's not the same as the source data in text and excel files.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;2. Remember that db4o/C# is case-sensitive. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;Maybe this has not fully internalized in me and I forgot it again. &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Arial;"&gt;Hope this helps if you have this kind of stuff in your work.&lt;br /&gt;------------------------------------------------------------------------------------------------------&lt;br /&gt;&lt;span style="font-family:arial;"&gt;Related Posts:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;a style="FONT-FAMILY: arial" href="http://edwinstrek.blogspot.com/2007/11/since-i-started-my-project-using-db4o-i.html"&gt;Things to Watch Out in db4o&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-8540300205810912996?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/8540300205810912996/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=8540300205810912996' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/8540300205810912996'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/8540300205810912996'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2007/11/microsoft-dts-and-db4o.html' title='Microsoft DTS and db4o'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-7830452880076179857</id><published>2007-11-26T19:10:00.000-08:00</published><updated>2007-11-26T23:06:41.778-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Programming'/><category scheme='http://www.blogger.com/atom/ns#' term='db4o'/><category scheme='http://www.blogger.com/atom/ns#' term='Databases'/><title type='text'>Things to Watch Out in db4o</title><content type='html'>&lt;span style="font-family:arial;"&gt;Since I started my project using db4o, I get to encounter things that I was not accustomed to do. I used to do Visual Basic 6 on MS SQL Server, then VB.Net 2003 on the same database product and lastly C#(still on MS SQL Server). I would like to list the things out here that might help new entrants in the object-database world and C# with similar experience as mine:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;strong&gt;1. db4o/C# is case-sensitive&lt;br /&gt;&lt;/strong&gt;I'm used to SQL Server's case-insensitiveness (although you can make it case-sensitive too by changing the settings. See SQL Server 2000 Books Online under the topic How to create a case-sensitive instance of SQL Server 2000 (Setup)). When comparing strings, take note of this or your going to have lunch and dinner dates with the debugger. So those migrating from VB/SQL tools, expect this since Java and C# are case-sensitive.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Get out of the relational mind-set&lt;br /&gt;&lt;/strong&gt;There are many posts on this so I won't go any further explaining.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;strong&gt;3. Good performance depends on YOU&lt;br /&gt;&lt;/strong&gt;Some people may not agree with me but db4o may not perform properly if your code is slow. db4o is very fast as proved by the pole position survey. If you quickly jump to coding, process tons of objects and not reading the documentation on the best practices to ensure performance, then your code will crawl like a snail. I sometimes make my own mistakes by forgetting that performing connections and executing queries inside a while loop is a bad news. This is not in the docs but the db4o core team need not to put it there since this is a bad practice even in the relational world.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. Missing Features?&lt;br /&gt;&lt;/strong&gt;Check the documentation or the community forum on specific things that you need. If it's not there, do a work around for a while and much better, contribute to the community if you have great ideas. Things will get better soon, and the core team is very agile. And this is open source. Features will get better by community contributions.&lt;br /&gt;&lt;br /&gt;That's it for now. I'll try adding some more as I move on to my quest.&lt;br /&gt;&lt;br /&gt;Good day to all&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:arial;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-7830452880076179857?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/7830452880076179857/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=7830452880076179857' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/7830452880076179857'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/7830452880076179857'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2007/11/since-i-started-my-project-using-db4o-i.html' title='Things to Watch Out in db4o'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3861081418466813218.post-998012762411431211</id><published>2007-11-26T19:09:00.000-08:00</published><updated>2007-11-26T19:38:01.503-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='General'/><title type='text'>Just Started</title><content type='html'>&lt;span style="font-family:arial;"&gt;I just started my own blog to establish presence. I will post on subjects regarding programming, development, db4o, the industry I'm in, my interests and other cool stuff that I find across the internet. I will post my schedule from time to time when needed.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3861081418466813218-998012762411431211?l=edwinstrek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://edwinstrek.blogspot.com/feeds/998012762411431211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3861081418466813218&amp;postID=998012762411431211' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/998012762411431211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3861081418466813218/posts/default/998012762411431211'/><link rel='alternate' type='text/html' href='http://edwinstrek.blogspot.com/2007/11/just-started.html' title='Just Started'/><author><name>Edwin Sanchez</name><uri>http://www.blogger.com/profile/05326264084440695880</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://2.bp.blogspot.com/_D0ueM_w4AgE/SO7pR4QeYxI/AAAAAAAAAB0/hPh-2KIQO10/S220/Edwin.jpg'/></author><thr:total>2</thr:total></entry></feed>
