This blog has moved to www.voidsoft.ro/blog/ . Please update your bookmarks.
Bye bye DotNetJunkies and thanks for all the fish :).
I have finally released the latest version. Karmencita is a high level object query language for .NET . It's purpose is to allow easy querying from in memory structured data.
Features :
- easy, SQL like language.
- common, slim API used for querying data.
- supports any IEnumerable data source, DataTables and XmlDataDocuments.
- extensible implementation
- common API but still get results depending on the data source. (for instance when querying XmlDataDocuments we get back XmlElement[]. But if we query a DataTable we get back a DataRow[]).
- supports IComparable for custom type implementation.
Samples :
-query a generic list of Customers :
//get a list of customers
List<Customer> list = ………
ObjectQuery<Customer> oq = new ObjectQuery<Customer>();
string query = “Name=[Marius Gheorghe] and IsMale=true and Age > 10”;
Customer[] custom = (Customer[]) oq.Select(list, query);
- query a DataTable (the Northwind database products table)
//load the DataTable from the database
DataTable dt = ………
ObjectQuery<DataTable> oq = new ObjectQuery<DataTable>();
string query = “Name=[Salted Pork Meat] and Discontinued = false and UnitPrice > 12”;
DataRow[] rows = (DataRow[]) oq.Select(dt, query);
- query a XmlDataDocument
//load the XmlDataDocument
XmlDataDocument dt = ………
ObjectQuery<XmlDataDocument> oq = new ObjectQuery<XmlDataDocument>();
string query = “Name=[Salted Pork Meat] and Discontinued = false and UnitPrice > 12”;
XmlElement[] rows = (XmlElement[]) oq.Select(dt, query);
The web site is located at www.voidsoft.ro/karmencita.html
This is free software (LGPL).
Here is a way to synchronize scrolling in multiple DataGridViewes . Add in the scroll event of the DataGridView:
private void dataGridViewFirst_Scroll (object sender, ScroolEventArgs e)
{
this.dataGridViewSecond.FirstDisplayedScroolingRowIndex = this.dataGridView.FirstDisplayedScroolingRowIndex;
}
PS: Does anyone knows how to configure BlogJet to work with a DotNetJunkies account ?
First of all.....Happy New Year everyone.
I'm quite dissapointed by this one. It's so bad it's not even funny. The so called "purpose" of the book is to "open the eyes" of the Java programmers about Ruby and ROR. First of all the book's name is wrong. It should be something like "Beyond Java : Choose Ruby and don't look for something else". Practically the book is a HUGE, shameless,"in you face" RoR advertisment. The only good thing from the book is a presentation of Java strengths as a "enterprise application" language.
Here are some things i thought were particulary bad about the book :
- "C# is effectively a Java clone". You'll find this 4 times in the book. So either the books is badly edited or the author is flaming away without the slightest knowledge about the subject.
- it says that the JVM made the Virtual Machines popular : this is hilarioulsy wrong. Languages like LISP and Smalltalk
were running under VMs long before Java. The sad part is that, from a technical point of view, the JVM doesn't have any
advantage above other VMs.
- the author indulges himself with the ideea that he is a pragmatic programmer and always uses the best tool/language for the job. But :
1. It suggests that open source is "the one true way" which is soooooooooo lame. I had expected a technical book not
some open source zealot chants.
2. "Finally, the next language needs to be politically safe (think Ruby, not C#), so standards can emerge without the constant bickering that can get in the way ".
After reading the above paragraph i was asking myself : is this guy for real ? How the heck a ISO/ECMA standardized
language is NOT "politically safe" ?! How the heck Java is MORE politically safe than C# ?!!! How the heck is Ruby
more politically "safe" then C# ?! Just because is "open source" ? What the heck is an open source "language" ?!
But people DO HAVE ACCESS to 2 different compiler source code for C#.
- in a few pages the author tries to find "suitors" for Java : Python, Ruby , Groovy (WTF ?!!!), C#/VB.NET and Smalltalk.
Each "suitor language" is described in just a few lines. No in depth comparations between languages.
- it presents ROR like is the "one true answer" to the web application + RDMBS problem. But....hmmm....NO other framework
is presented !?!!! Only ROR...so how the heck is this guy expected to be taken seriously ?!
After reading this i have only 2 things to say :
- i regret to have wasted my time to read this.
- a big thumb down to O'Reilly for publishing this flame fest.
http://www.jamesshore.com/Blog/That-Damned-Construction-Analogy.html
This guys really hits the nail. I have always hated that stupid analogy. And the "software arhitect" thing......what THE HECK is that suppose to mean ?!!! The software suffers from title inflation....BAD.
I'm very happy to announce the first release of Karmencita, an minimalist
object query language for .NET 2.0 . It's purpose is to allow a hassles free
object querying from “in memory” data sources. It was developed as part of the
DataBlock Object Relational Mapper ( www.voidsoft.ro/DataBlock/) and now released
as a open source project (licensed under GPL) by me.
Here is a very simple query sample :
//get an array of running processes
Process[] proc = Process.GetProcesses();
//initialize Karmencita with the type of object which will be queried
ObjectQuery<Process> oq = new ObjectQuery<Process>();
string query = “BasePriority > 3 and Responding=true and MainWindowTitle Like C%”;
//run the query
Process[] pc = oq.Select(proc, query);
The project webpage is located at www.voidsoft.ro/karmencita.html
Here is a quick tip if you want to run the same unit test from VSTS and NUnit. If the code is witten for VSTS you can add these declarations :
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
and run it under NUnit. Reverse the declarations if the code is written for NUnit and you want to run it in VSTS.
In .NET 2.0 use Marshal.FinalReleseComObject to "dispose" a COM object. This method sets the object's reference counting to 0.
The Krypton Toolkit has been released
It provides user interface controls for Windows Forms
It is targeted at Visual Studio 2005 and .NET Framework 2.0
It is free for commercial use
A link to http://www.componentfactory.com/downloads.php
Listened to latest Opeth last night. Very good album. Wholeheartedly recommended. Also...music related...i'm going to a Nightwish concert tonight in Bucharest. It should ROCK.
I wrote a comment to the DLinq PM blog (http://blogs.msdn.com/dinesh.kulkarni) couple of days ago with some critics to Dlinq mapping. It seems to me that Microsoft employees don't take critics too well because my comment got deleted. So i have decided to write them here. So here they are :
Attribute based mapping. Atrribute based mapping has a few disadvantages :
- it's slow. Due to heavy usage of the Reflection API it's slower than Xml based mapping
and , of course, a heck of a lot slower then direct mapping calls.
- it needs a separate API that you need to learn to extend DLinq.
- the mapping atrributes need to be cached for further reuse. Now imagine
what happens when mapping attributes of 100 database tables are cached....the working set goes to the roof.
There are basically 3 ways to map database schema info : attribute mapaping, xml mapping and direct mapping (which
we used in DataBlock). With attribute based mapping MS made the worst choice between those 3.
Database specific attributes mapping :
This pretty much by itself should give us a clue that MS doesn't want DLinq to play nice with other RDBMS vendors.
It saves Sql Server specific types in the attributes mapping. If you want to create a RDBMS independent O/RM that's
definitely a no no. Another problem with their mapping is that it doesn't support type which are not supported by Sql Server.
How would i map a PostgreSql Point type with Dlinq ?
DataContext
So the DataContext itself it pretty much a database connection. In a database independent O/RM a database connection
is pretty much described by 3 attributes :
- connection string
- database server type (Sql Server or PostgreSql for instance).
- provider used to connect to the database. This may not be useful if you're working with SqlServer only but
it's very useful when working with 3rd party RDBMS.
DataContext uses only a connection string. So it seems that there is no way for Dlinq that allows you to use a different
database server then Sql Server. In the documentation it's mentioned a "strong typed connection" using a class which
derives form DataContext. The downside of this approach is that you HAVE TO ADD THE mapped objects to the DataContext !!!!
Why ?! Why ? A mapped object...it's just that....a object. A POCO (Plain Old CLR Object). Why do you constrain me to
associate it with a typed DataContext ?
Another problem with their DataContext approach is that is too low level. In a business application you usually have business
objects to whom you pass these mapped objects and , from there, they go to the database. With a DataContext i'm sure there
will be plenty of people who will update the database from the event handler in the GUI. That's bad...
So there you go....this is what i think it's wrong with the current architecture of DLinq so far.
I've read the C# 3.0 specs last night and ....well i'm a bit puzzled. I think the C# team is taking the language into
a wrong direction.The design of C# 1.0 was pretty good. Despite making a few small mistakes mr Helsjberg & co clearly were aware
that code is written once and read many times. Little things...like putting ref / out at the function call site showed
that readability is a key point for them in the design of a language.
In my opinion in the design of C# 1.0 they screwed up by adding domain specific functionality in the core language definition.
Domain specific functionality is handled in libraries (in which is easier to deprecate / improve) then the core language itself.
This domain specific functionality i'm talking about is threading. C# includes 2 keywords (volatile and lock) which deal with threading
directly from the language instead of the libraries (never mind that lock "maps" to a Monitor). Adding these functionality in
the language definition is bad because :
- they don't belong there
- it bloats unnecessary the language
- their functionality already exists in the library
- it harder for them to "evolve" the language when they are adding new keywords.
- a small fixed core is always better
Despite this i think the design of C# 1.0 was very good. With C# 2.0 they added again domain specific functionality into the
language definition. You can argue but a nullable type is used mainly in the context of a database operation. In fact nullable
types are implemented in mscorlib like any other type but the made the mistake of trying to add sintactic sugar in the language
definition for nullable types (with the ? and ?? operators). Don't know about you but Nullable x is way more comprehensive
to me than int? x. I guess after all it's just a matter of taste. I have mixed feelings about the rest of the C# 2.0 features.
Were they REALLY necessary ? I guess the C# team think they are in some kind of competition with the Java guys...think about it..
why the heck they added that half assed template implementation in Java ? I am willing to bet my socks that at least 50% of the reason
is because C# will have generics. To me it seems that the C# team is just adding things because they think they have to compete with Java
and because C# must be cool (Ruby style)....without really asking themselves if we REALLY need them. Do they ONESTLY think that the programmer's productivity is increased by introducing lamdbda functions ? What happened to the much (in C# 1.0) touted simplicity ?! (please don't gimme the "don't use them if you don't like them" line). I mean...there is already out there a language that pretty much tries to be everything to everyone. And failed. Do we really want C# to follow the same route ?
We really don't need the things added to C# 3.0 ( or should i say LISP wanna be ?). And also it seems to me that at least some of them
were added to simply allow for LINQ implementation. Not because we want them / need them.
So...C# team...what happened to the balance between simplicity and power ?
PS : Also....why the HECK var ? It's not like C# is Pascal. Why not remove the var entirely and just let the name of the variable? It makes
way more sense than var.
Linq. And DLinq.
I'm going to go straight to the point. I think Linq is a good thing done the wrong way.
Let me backtrack and explain. Linq's main usage will be to query the "in memory" representation
of a list/array/data structure of business objects. ( Karmencita....our solution for this will be available
next month with DataBlock v1.3) That's it.
The problem with Microsoft is that you don't have business objects. And here is DLinq comes. It
seems that with DLinq they *tried* to create a mini O/RM . (finaly indirectly Microsoft
admited that ADO.NET pretty much blows chuncks for writing data access code).
So they seems to combine a code generator which based on the databse schema generates a mapping class.
Nothing out of the ordinary....we've been doing this (we...as in the O/RM writers) for some time.
But still MS manages to screw it in a couple of ways :
- DLinq generated code is database specific (Sql Server only).
- It seems it's not extensible. So bye bye PostgreSql extensions for instance.
- The mapping information is held in attributes. As a O/RM writter i can tell you that IT WON'T SCALE.
It works with a couple of tables but it will NOT scale for a enterprise application with 30-40 tables.
- only querying. What about CREATE, DELETE, UPDATE ?!
If this is the descendant of ObjectSpaces then (ok....i might be a little mean here) i think every O/RM vendor can relax.
Linq is not a solution to write some serious database independent datababase access code.
I have recorded last night a screencast with DataBlock. It's a simple introduction which shows you how to generate the mapping files for the database entity and how to do simple CRUD operations in a Windows Forms application. You can view at http://www.voidsoft.ro/downloads/screencasts/data_block.html
The purpose of the screencast is to show you how SIMPLE is to get started with DataBlock in .NET 2.0 No mapping files, no hassles.
Just generate the files and use the business objects.
Karmencita is a object query language for DataBlock (and in the future it will also support POCO, DataTables and XMLDocuments) which allows us to query "in memory" data structures. It has a simple and straighforward SQL like syntax . Here is a small snippet :
Let's say we have a entity like this
public class Author : TableMetadata
{
public int AuthorId;
public string Name;
public DateTime DateOfBirth;
public bool Manager;
public decimal Salary;
}
We retrieve it from database with DataBlock;
Author[] authors = perst.GetTableMetadata();
and now we can manipulate it with Karmencita :
ObjectQuery<Author> oq = new ObjectQuery<Author>(); // notice that ObjectQuery is a generic class
Author[] selectedData = oq.Select(authors, " AuthorId > 67 and Name like Stan* and Manager = true");
We can also have math operations on data;
decimal totalSalary = oq.Sum(authors, " Manager = true and AuthorID > 60);
More details (also some bits about implementation) are available in the following paper : www.voidsoft.ro/downloads/karmencita.pdf
Karmecita will be available in DataBlock v1.3 in the October 2005 timeframe.
PS: The "Write a review and get a DataBlock license for free" contest is still available.
The title pretty much says it all. We have an offer for all the .NET developers. Write a review for our .NET 2.0 Object Relational Mapper, DataBlock ( http://www.voidsoft.ro/DataBlock/index.html), and win a free copy. The only requirement is that the review should be published on web (on your blog, your site...whatever).
Also please note that this is a limited offer (we are ready to hand 5 free licenses). If you have questions please post them here or mail me at gmarius at gmail dot com
I'm 26 today. So happy birthday to....me :).
I'm very happy to announce the release of the DataBlock v1.2. Here is the press release :
" voidsoft is pleased to announce the release of DataBlock v1.2 for
Microsoft .NET 2.0. DataBlock is an advanced O/RM and persistence
framework for .NET 2.0 which helps you build advanced database
applications fast and easily by generating a complete business facade
for your database entities. DataBlock comes with DataBlock Modeler (a
GUI tool) which allows you to generate your entities in a few seconds
(it supports both C# and VB.NET).
Features list : http://www.voidsoft.ro/DataBlock/features.htm
Support Forum : http://www.voidsoft.ro/forum/
Download : http://www.voidsoft.ro/DataBlock/download.htm "
Please note that the evaluation version is not limited in any way so give it a shot.
If you have questions you can leave messages on this blog, post on the forum (see link above)
or mail me directly at gmarius at gmail dot com. Also note that this new release is .NET 2.0 only
so if you're looking for a .NET 2.0 O/RM.....We scrapped the 1.x version and went straight for .NET
2.0 and this is the result of many months of work. We also included a small ASP.NET 2.0 demo
application. Check how you can have ther business facade ready in 15 seconds and how an
application can run on 3 different RDBMS (Access, MySql and SqlServer) only by changing 2
lines in a config file.
A demo video should be up on the site in the following week.
PS: I kept my word. End of august :)
Work on Datablock ( http://www.voidsoft.ro) continues at a franctic pace. The upcoming release (1.2) will be available at the end of august.
Along with the enhancements (i will talk another time about this) and bug fixes a big noteworthy change :
-.NET 2.0 only. Mostly for generics (like i already said i'm not entirely happy with the constraints in .NET 2.0 generics) but getting rid of the custom collections along with StringCollections and the like worth it. It's speedier too when compared with 1.1. As long as i'm on this topic....we decided that arrays will still the primary method of returning multiple data ( we can also returned List<TableMetadata> as a conventional sided API for the languages that will support generics......although the generics are CLR compliant i don't expect that most languages will have support for them in the foreseeable future).
Other new related to DataBlock....well DataBlock will be "the main pillar" of the upcoming codenamed Sunrise business application framework which we will launch along with the .NET 2.0 release. More news about this in the upcoming months.
We're planning to write some medium size application (with GUI both Windows Forms and ASP.NET) as demonstration for DataBlock.
(the current one is too small). I will also record a demonstration video for DataBlock (not everyone has time to read docs ).
So much things to do....so little time. Got to get back to work.
Finished the game last night. I was interested in the game because the story was written by R.A. Salvatoare so i thought it's going to be good. Big dissapoiment. The game is simply a 3rd person hack and slash with a vaguely sketched story. Anyway :
good stuff :
- you get to play as Drizzt :)
-nice action packed scenes in the last 3-4 chapters.
bad stuff :
- bugs. Lots of them. I couldn't finished 2 chapters because of showstopping bugs (i had the patch installed).
-simple story.
-fixed keys.
-one dialog said "Please press the triangle button !!!!".
-the game is a little bit hard.
-battle pshysics and mechanics were downright bad when compared to games like POP: Warrior Within.
- too short.