home

Archive for the 'xml-speak' Category

ORM for .NET

Thursday, February 9th, 2006

It’s not pretty, but today, I started writing my own Object Relational Mapper in .NET (C#).

After using Ruby and the Rails framework including the ORM framework that is ActiveRecord, it just seems so cludgy to write:

string strInsertCommand = "INSERT INTO [table]([col1, col2, ...)
    VALUES(@col1, @col2, ...);"
// ... and repeat ...

I know, too spoiled to write my own SQL. Well, what I’m not telling is that I’m using some Stored Procedures, which don’t really translate all that well into the ORM world. That, and my ORM is really nasty since it goes out and queries the table first for the columns, then builds INSERTS based on that. Makes me wonder how ActiveRecord really does it….

current project rambling

Tuesday, January 31st, 2006

I try not to blog too much about my “real-job” or contract work, but alas, it pays the bills. And, if it weren’t for other bloggers, blogging about their day-to-day development wins/losses/woes, I’d probably be really stuck every now and then myself….

I’m working on a really cool project right now, though. It’s great to be involved so thoroughly with a company, being able to have a really good view into how they do business to be able to offer up improvements to their processes, and even creating entirely new “workflows” and methods for doing things that weren’t even considered before. It’s also pretty cool to be able to suggest anything (from technology to processes) to get the job done right.

Without getting into too much detail, I’m working on a solution that involves a crazy cool set of technologies. While I won’t be able to fully describe it here yet, it really involves a custom linux distro (bootable over the network), a suite of Windows Services (multi-threaded, polling processes), XML processing, operating on a MSSQL database, providing “legacy” access to the data through an MSMQ-web-service gateway, and just a really neat process in general.

The great thing here is that each “technology” is used for a purpose. Using each as a tool or building block, the whole is a really slick process that automates where necessary, and is totally transparent as a whole.

Very cool stuff….

vs.net: large xml to datagrid = slow

Monday, August 22nd, 2005

I’m trying to perform validation on serial #s on a PocketPC PDA/phone device — the Siemens SX66, also branded under SprintPCS and Verizon as a different device, but still the same puppy.

The file is huge. 14,000 serial #s, thus a very large XML. I hate XML files that are that long — just think of the wasted space in those tags — the cost to pay for meta-data.

The xml file looks like:

<?xml version=”1.0″ encoding=”utf-8″?>
<validate xmlns=”http://usmicrocorp.com/validate.xsd”>
<items>
<row sn=”111″ />
<row sn=”222″ />
<row sn=”333″ />

</items>
</validate>

The code looks like:

dsValidate.ReadXml(GetAppPath() + “validate.xml”);
dsValidate.Tables[”row”].PrimaryKey = new DataColumn[] {dsValidate.Tables[”row”].Columns[”sn”]};

strSelect = “sn=’” + txtSerialNumber.Text + “‘”;
dr = dsValidate.Tables[”row”].Select(strSelect);
if (dr.Length > 0) {
// we found a duplicate
}

Oh, but man is that slow on the phone with a sufficiently large dataset. The poor little arm processor can’t build that primary key in under 5 minutes. Just sits there, and at the end actually errors out (throwing an exception), but then goes on to let me validate very quickly (the select statements) all the #s I tried.

Anyone know of any quick data structures (hash buckets, etc.) that a dinky little ARM processor might be able to handle?

In the meantime, I may migrate it over to a Web Service, but that’s a lot of overhead for a quick serial # scan from a barcode scanner, then a call to a web-service, even if it’s over the SprintPCS network. Wifi, maybe?