• 10
  • Nov

So, I’ve been using the basic version of CodeSmith’s Generator product and have mixed feelings about the .netTiers template. It apparently does not like uniqueidentifier fields marked as ROWGUID.

Frankly, I’ve been doing LINQ to SQL for long enough now that I am getting really juiced about using the PLINQO framework with CodeSmith.

The thing is, I love the L2S syntax, but do NOT love using VS-generated DBML files for everything, and Entity Framework sucks.

What’s a brother to do? Hand-code data-context-aware data entities? <sarcasm>Tempting, but no, thanks!</sarcasm>


PLINQO project layout screenEnter PLINQO, a framework that represents your data-aware entities in clear form, with partial classes you’ll need to extend them. The class structure allows for easy detachment from the entities’ data contexts so that you can pass your entities off to your presentation layers and they update the database directly, obviating the need for expensive-to-maintain custom data transfer objects.

PLINQO is built into the Professional Edition of the CodeSmith toolset, which is a template-driven source code generation application, in such a manner that you can generate the framework code automagically straight from your database. What’s coolest of all is that you can re-gen your entities from the database at any time, without it touching your custom code.

I have used the PLINQO’s code generated during my trial period for CodeSmith professional, but now that has lapsed, and I miss it dearly.  In the meantime, I am maintaining the framework code previously generated by hand. Kind of blows, but when I get my new dev studio setup at the home office, I will be getting all manner of new tools, and CodeSmith is one of them.

Using the code is a snap, and being able to integrate the classes out-of-the-box took me from database to business logic in one easy step. Granted, you still have to encode some data rules, but having all the basics in place ready to go meant that I was able to take some sketched out requirements, bang out the basic database structure and got me a data access layer right out of the box.

The PLINQO template can also configure your project to use PLINQO with Data Services and Window Communication Foundation (WCF), though I have yet to grok that.

Its integration into Visual Studio is also godsend, allowing you to update objects without having to leave your dev environment.

One item that makes it worth the price of admission though, is the Enum generator, which takes your look up tables (e.g. Product Types, Scanner Settings, etc.) and creates the Enum class for you. OMFG, I’ve been dying for this for years.

Anyway, take a quick look at the Solution Explorer to the right here. It shows a quick overview of how the PLINQO framework looks when generated by the PLINQO template in CodeSmith.

I am moving into using the ASP.NET MVC framework and want to focus on that, not on the data-access-layer.

The google’s code repository is where the PLINQO sample project Tracker is hosted.


This framework has already saved me many hours coding and debugging code for data access, code which is so boring I want to gouge my eyeballs out with pencil. The Visual Studio integration is what LINQ to SQL could have been had Microsoft not dropped the ball in favor of that pig of a beast EF4. Detachable entities and Enum objects round out a top-shelf solution, and those are just what I have grokked so far.

  • 15
  • Apr

how-to search mutiple keywords using LINQ to SQL

this bit of LINQ code will let you search for records using any number of keywords

it’s a bit limited, but it illustrates the starting point for something more.

the key is to get results for the first keyword into a disconnected object (in this case, a simple List<String>) and then search for the remaining keywords in there. clearly you could up the ante, and select more fields and spin up a collection of custom objects (i.e. List<MyClass>) but this suited my needs for an autocomplete for country names.

// GetMatchesIntersect(string csv, int maxMatches)
// mainly developed for auto-complete scenarios
// searches single [n]varchar|text|char field for multiple keywords
// returns array of field values containing ALL keywords
// NOTE: i decided on array because i am implementing this a webservice
//       to be consumed by other languages/platforms)
public string[] GetMatchesIntersect(string csv, int maxMatches)

    // keywords come in as comma-separated values
    string[] keywords = csv.Split(new char[] { ' ', ',' });

    // this list will hold the matches
    List<string> matches;

    using (DbDataContext db = new DbDataContext())

     // build list of matches for first keyword into generic List<string>
     matches = (from s in db.TableToSearch
                where s.FieldToSearch.Contains(keywords[0])
                select s.FieldToSearch).ToList<string>();

     // if any were found
     if (null != matches && matches.Count > 0)
         // start searching at the 2nd keyword (if any)
         for (int i = 1; i < keywords.Length && matches.Count > 0; i++)
          // using .ToUpper() because matching in a List<string> is case-sensitive
          // set matches equal to the query results for each succesive keyword.
          matches = (from match in matches
                  where match.ToUpper().Contains(keywords[i].ToUpper())
                  select match).ToList<string>();
    // ship it out as array
    return matches.Take(maxMatches).ToArray<string>();
  • 14
  • Oct

I want my conservatives to be buttoned up in clean, simple suits. I want them to be stoic, austere, self-assured, calm. Joe Six Pack needs someone to look up to, someone to respect. The GOP has spent all of its energy lately trying dress itself down, to its detriment.

People don’t want Bubba. Even G.W. does his pandering by example, owning a ranch, etc. But every day he wears a suit and tie and makes no apologies for it. The man, goofy as he is, is strictly business, even while torturing the English language.

I disagree with the man’s policies on almost everything, but over the years I’ve learned to respect the man, begrudgingly.

What the GOP has become is just one big BBQ or hoe-down, for the rural folks, but 50% of Americans live in cities, and you can’t run the nations’ government only on the concerns of the rural population. People in cities count, they drive huge swaths of the economy, they matter, they vote.

Joe Six Pack is a nice guy, but he isn’t the only American.

Which brings me to this article in the Wall St. Journal entitled “Obama’s 95% Illusion” which sets out to debunk Obama’s claims that he is providing middle class tax cuts.

Here’s the article.

The irony of how well this article is written made me laugh out loud.

The irony is that the GOP has spent so much time telling Joe Six Pack that anything from East Coast City Slickers is a lie, and that all they need are small-town country songs with single syllable words, etc.

So now the GOP leadership cannot point to the one article that every conservative should read, because it’s written in the “Mainstream Media.”

The Wall St. Journal is part of  “The Elite.”

And we all know that Joe Six Pack can’t trust them fat cats on Wall St. much less the media that writes about them.

The bottom line is the GOP has really let itself go.

It’s a shame too, because i think core conservative ideals about cutting taxes, reducing spending, offering people opportunities not hand-out, etc., etc. are noble in their simplicity.

I really miss the days when the GOP presented themselves as the stoic, wiser counterparts to the foolishness that Liberalism can really be.

Oh well, my favorite flavor Conservatives may never return, but I wish they would and clean up their house — it looks like a trailer park at this point.

Tags: , , , , ,

  • 30
  • Sep

so apparently the band My Bloody Valentine is getting back into the studio (finally)

anyway, i’ve seeded pandora with them and am blissing out as code like a monkey

Tags: ,

  • 29
  • Sep

So i have a log table that records server status, and what I needed was a query that returns to me only those rows that had status change. That is to say, over time, just show me the times when the status changed.

this query gets me just exactly that — only the rows that represent a change in status from the most recent previous status.

/* main select clause */
    A.LocationId, A.ConnectionStatus, A.Comments,
        A.TimeRecorded AS StatusChangeTime

    /* self-join the table to have a second date field */
    tblNetworkConnectionStatusLog AS A JOIN
    tblNetworkConnectionStatusLog AS B
        ON A.LocationId = B.LocationId
    /* only interested in rows of different status */
    B.ConnectionStatus <> A.ConnectionStatus
        /* limited to just the most recent different status */
        AND B.TimeRecorded =
                MAX(C.TimeRecorded) AS StatusChangeTime
                dbo.tblNetworkConnectionStatusLog  AS C
                C.LocationId = A.LocationId AND
                C.TimeRecorded < A.TimeRecorded
/* this just gets the first status recorded*/
    D.LocationId, D.ConnectionStatus, D.Comments,
        D.TimeRecorded AS StatusChangeTime
    tblNetworkConnectionStatusLog AS D LEFT OUTER JOIN
        tblNetworkConnectionStatusLog AS E
            ON E.LocationId = D.LocationID
                AND E.TimeRecorded < D.TimeRecorded
    E.LocationID IS NULL

    StatusChangeTime DESC

purdy sweet.

  • 11
  • Sep

9/11 is now long enough ago, that when i read e-mails from the time I am surprised by how antiquated my technology was.

i didn’t know anybody who died that day, thankfully.

*moment of silence*

  • 20
  • Jun

haven’t we all heard this claim before?

MIT neuroscientists explain deja vu

i am certain that i have heard claims to scientifically explain this eerie sensation that is ironically so banal, but apparently “forming memories of places and contexts engages a part of the brain called the hippocampus.” duh, but these guys “have been exploring how each of the three hippocampal subregions — the dentate gyrus, CA1 and CA3 — contribute to learning and memory”

yeah, yeah, yeah

but honestly, i was disappointed by this guy’s weak-ass example:

“[He] described his own occasional experience of finding the airport in a new city uncannily familiar. That occurs, he said, because of the similarity of modules — gates, chairs, and ticket counters — that comprise airports worldwide. It is only by seeking unique cues that the specific airport can be identified”

of course all airports look similar — there are entire international agencies whose raison d’etre is to ensure just that, so we cattle don’t get lost and so planes don’t need to figure a dozen sets of signage

duh — that ain’t deja vu

i recently experienced a chain of events (noticing a scientific article) that motivated me to post to a blog i maintain and while i was composing the the post i noticed the strange sensation that i have done this before.

weird, hunh?


  • 20
  • Jun

the blurring effect of the earth’s atmosphere is in large part the reason the hubble space telescope is well, a space telescope. land based telescopes have had to rely on a technology known as adaptive optics in which a reference star is used as a point of reference to adjust for the rivers of air they must see through to observe the heavens beyond.

the drawback to this is the relative shortage of good reference stars in the skies — in particular over the southern hemisphere.

enter the good folks of european souther observatory over at paranal observatory in chile — they have developed a new technique by which they create their own reference star using lasers.

The Laser Guide Star System installed at Paranal uses the PARSEC dye laser developed by MPE-Garching and MPIA-Heidelberg. The laser beam takes advantage of the layer of sodium atoms that is present in Earth’s atmosphere at an altitude of 90 kilometres. Shining at a well-defined wavelength the laser makes it glow. Despite this star being about 20 times fainter than the faintest star that can be seen with the unaided eye, it is bright enough for the adaptive optics to measure and correct the atmosphere’s blurring effect.

Full article at ESO here
Full adaptation from Science Daily here

  • 12
  • Jun

so many processes we employ in our modern world generate heat that goes to waste — from cpu in laptops to nuclear power plant

Orest Symko from the university of utah has found a way to create sound from waste heat and then use that sound to generate electricity

very cool tech http://www.sciencedaily.com/releases/2007/06/070603225026.htm

  • 06
  • Jun

Reuters is reporting today that Dutch students have concocted a powered alcoholic beverage that when mixed with water becomes a “a bubbly, lime-colored and -flavored drink with just 3 percent alcohol content.”

called Booz2Go, the target audience is clearly hikers who want to party after a long day but don’t wanna carry all that fluid around.


article here