How To Reverse the Order of a C# DataTable without Sorting

Sure, it’s easy to use the built in DataView functionality to sort a DataTable, but what about when you to reverse the order of the data without sorting? On occasion, data can come from a database in a sorted but not sorted manner. For instance, with logs. Ignore timestamps for the time being, sometimes the order in which it is written to the DB is important. Unfortunately, C# does not have a built in method for this. But I’ve written one that will work with any DataTable, enjoy!

 
    public DataTable ReverseRowsInDataTable(DataTable inputTable)
    {
        DataTable outputTable = inputTable.Clone();

        for (int i = inputTable.Rows.Count - 1; i >= 0; i--)
        {
            outputTable.ImportRow(inputTable.Rows[i]);
        }

        return outputTable;
    }

Is it Kumo or Bing? Microsoft’s new Search…

The blogging world seemed content that Kumo.com was to be the name of Microsoft’s new Google search killer, but now word is being spread that Bing.com is still hot in the running. Personally, I think “bing it” is better than “kumo it”, but I also think they both suck.

If anyone at Microsoft is reading this, remember: part of the reason Google grew so fast was because people liked to say “google it”. Neither “kumo it” or “bing it” are in that class; “kumo” is too hard to say compared to “google”, and “bing” is easy to say but just a lame word. Delay your launch until you get the name right, because you may never get a second chance…

Dear Google, Please fix Reader!!!

I’ve been a loyal Google Reader user now for a quite a while. And I’m about to quit it, forever, because of a very STUPID decision by the Google engineers and product managers. You see, despite it saying so, there isn’t really an option to “keep unread” your, well, unread items. I often queue items up to read later, or keep them as read at the bottom of the new posts for later reference (say, software I want to try but don’t have time for yet.)

Well now Reader has marked many of those items read. It seems that after 30 days, even if I kept checked to “keep unread”, they get marked as read. So, Google is lying to me. Furthermore, when I have the option to receive email feeds or RSS, I choose RSS out of convienence with the assumption it will act the same as email, i.e. unread messages are unread until they, well, aren’t.

So Google, you are about to lose a Reader customer, and considering I use many other services of yours, believeing that Google prioritizes the users data and preferences first, I’m not sure I can continue trusting your services in the same way. I mean, you didn’t even warn me.

So now I must go back through hundreds of blog posts I’ve already read, to find the 4 you’ve taken away from my unread list, despite me telling you explicitly not to, as you asked me to do. Shame on you, Google.

On the Economy…

In 1933 in the midst of the Great Depression Congress was debating what would become the Glass-Steagall Act. Today, most economists agree that while there were numerous compounding causes of the Depression, the overarching cause was the lack of credit flow to the economy from the banks. 

The lack of credit flow, caused by banks taking unnecessary investing risks, and realizing a conflict of interest within a banking system that allowed a bank to both issue loans and trade investments based upon them, two Democratic senators had the following dialog as Congress debated new regulations:

(Mr. Glass:) Here [section 21] we prohibit the large private banks whose chief business is investment business, from receiving deposits. We separate them from the deposit banking business.
(Mr. Robinson of Arkansas:) That means if they wish to receive deposits they must have separate institutions for that purpose?
(Mr. Glass:) Yes.

(Sen. Glass was a former Secretary of the Treasury. His co-sponsor of the bill, Rep. Steagall, was the Chairman of the House Committee on Banking and Currency.)

Ultimately it was decided, that as shepherds to our economy and the heart that keeps our life blood pumping (credit), banks had to first and foremost be banks, and not engage in risky investing behavior. 

It was obvious then that society came first, and shareholders came second. Banks could make as much money as they could, but within reason, and not at the risk of the stability of the entire banking system.

This worked for decades, but then in the 1980’s banks started to get greedy, lobbying Congress to repeal the Glass-Steagall Act.

In 1987, the Congressional Research Service investigated the question, and came up with the following conclusions for both sides of the argument:

The argument for preserving Glass-Steagall (as written in 1987):

1. Conflicts of interest characterize the granting of credit – lending – and the use of credit – investing – by the same entity, which led to abuses that originally produced the Act
2. Depository institutions possess enormous financial power, by virtue of their control of other people’s money; its extent must be limited to ensure soundness and competition in the market for funds, whether loans or investments.
3. Securities activities can be risky, leading to enormous losses. Such losses could threaten the integrity of deposits. In turn, the Government insures deposits and could be required to pay large sums if depository institutions were to collapse as the result of securities losses.
4. Depository institutions are supposed to be managed to limit risk. Their managers thus may not be conditioned to operate prudently in more speculative securities businesses. An example is the crash of real estate investment trusts sponsored by bank holding companies (in the 1970s and 1980s).

The argument against preserving the Act (as written in 1987):

1. Depository institutions will now operate in “deregulated” financial markets in which distinctions between loans, securities, and deposits are not well drawn. They are losing market shares to securities firms that are not so strictly regulated, and to foreign financial institutions operating without much restriction from the Act.
2. Conflicts of interest can be prevented by enforcing legislation against them, and by separating the lending and credit functions through forming distinctly separate subsidiaries of financial firms.
3. The securities activities that depository institutions are seeking are both low-risk by their very nature, and would reduce the total risk of organizations offering them – by diversification.
4. In much of the rest of the world, depository institutions operate simultaneously and successfully in both banking and securities markets. Lessons learned from their experience can be applied to our national financial structure and regulation.
(Lists courtesy Wikipedia)

Ultimately, those in favor of repealing the Act won favor, and in 1999 Glass-Steagall was no more.

What followed was 8 years of astounding growth by banks, as they transformed themselves into full-service, one-stop, financial companies. As the (regular) bankers made money from taking deposits, fees, and loans, the normal methods available to a bank for creating revenue, the investors and traders at the new groups within these conglomerate banks started investing to try and make more. The loans the bank was granting were then being traded by the banks investors, re-instituting the conflict of interest Congress removed in 1933.

In the end, they lost most, if not all, the profits the regular bankers earned for the companies over those 8 years.

In the process, as these losses continuing to mount, the banks bled. Today, most of these conglomerate banks have so many debt obligations that they can no longer effectively distribute credit, and as we know the Federal Reserve has no facility for directly distributing credit to the populace – one of two primary functions of a modern-day bank. There are still some smaller, stable, banks lending as they always have. But in the age of conglomerates they are few and far between.

In response, the Federal Government has decided to shore up these banks financials to allow them to stabilize and lend more. This is necessary and good, as they are all likely to fail under the weight of their mistakes otherwise. However, the government is also currently of the opinion that lack of regulation and oversight is to blame in this crisis, and to a degree it is true. But the underwriting cause of it all is the banks greed, and the governments indulgence of it, that led to them taking risks that are quite frankly completely unacceptable when the potential loss is the destabilization of the entire global banking system.

Congress, the President, and the banks, all claim no one could see this coming. No one could predict what was deemed the “financial tsunami” or the financial “perfect storm”.

But they did, in 1933. “Those who cannot remember the past, are condemned to repeat it.” And repeat it we did.

Now Congress is facing a second challenge, that of rising unemployment, and they believe that forcing Federal spending will stem the loss of jobs, and even create up to four million anew. They believe the Federal government, no matter how much debt it currently holds, can simply spend the economy out of a recession/depression. This too was an opinion held in the 1930’s. It was tried then.

Later, Henry Morgenthau, FDR’s Treasury Secretary said, “We have tried spending money. We are spending more than we have ever spent before and it does not work. … I say after eight years of this administration we have just as much unemployment as when we started … And an enormous debt to boot!”

During the Depression they were never able to solve the credit problem. No matter how much the Federal Government spent on the economy, it was eventually lost as the economy failed to use that money to create growth. After all, sustainable growth isn’t possible without credit.

Now our Democratic leaders want to do it again. It won’t work any more now than it did then, and we have a debt load that is virtually overwhelming, something that didn’t exist in the 1930’s. All congressional Republicans, except three (weak) moderate senators, have resoundingly resisted Democratic efforts. Despite this, the House today passed a 1,071 page bill, that no Republican voted for, to repeat the mistakes of history by spending upwards of $800 Billion. Even the bipartisan Congressional Budget Office thinks this bill will lead to disaster.

In conclusion, I offer the following suggestions:
1. Congress needs to read its own history.
2. Banks need to revert to being banks first and foremost. As the shepherds of our economy they do not have the right to risk it all for a little extra profit. Leave the greed for the pure investment houses. Conflicts of interest should not be *possible* to exist.
3. The Federal Government should invest it’s time and money in stabilizing the banks and freeing the credit markets, not increase spending to create jobs.
4. If the credit markets are free, the private sector will create the jobs, as they have the motivation to make more money. Government employees do not.
5. Greed is human nature. Reliance on a person’s good will and free market principles is normally the right choice, but not when the alternative is as dire as a systematic banking collapse. Do not trust banks to not be greedy, or more precisely, only greedy within reason. Greed unfortunately does not work that way. Preventive measures must be taken, even if it means bank shareholders won’t be able to increase their value ad infinitum.

We have history to look upon for guidance. People did see this coming. Let’s remember them…

(This article may be reproduced without my explicit permission so long as proper credit is attributed to me where the article is reproduced and a link is provided to this blog. If you do reproduce it, I wouldn’t mind a message letting me know for my own ego’s sake :) )

Microsoft Releases Office Translator for Office 2003 and 2007

The Microsoft Research Machine Translation (MSR-MT) Team today annouced they have released the new Office Translator plugin for Office 2003 and 2007.

I have yet to test out the tranlation capabilities, but when I do I’ll post here!

In the meantime go read the instructions on how to install it manually now, or wait for the Windows Update!

Read

Microsoft Finally Discusses ‘Fiji’ – Should’ve Stayed Silent

My mother used to tell me, “If you don’t have anything good to say, don’t say anything at all.” Microsoft today responded to much of the rumors and criticism that has been circulating regarding it’s new Media Center TV Pack. Unfortunately, I didn’t much care for what they had to say. Chris Lanier (Microsoft Media MVP) sums it up nicely: “Fiji will go down in history as one of the worst coordinated projects to come out of Microsoft in a long time.”

Mary Jo Foley has been covering it in detail, if you’d like to read more. But for me, it comes down to these issues:

  • No h.264 support (though third party codec packages like the K-Lite Codec Pack will enable it. Check out MediaControl 5.3 if you go that route.)
  • No DirectTV support. I don’t use satellite, but this would have gone a long way towards increasing adoption.
  • No 16:9 or otherwise widescreen thumbnails! This is the biggest for me since I have a media collection with lots of widescreen videos and hate that my thumbnails all have black bars on the top and bottom.
  • It was delayed, a lot.
  • And last but not least, I CAN’T GET IT IF I WANTED IT (at least not officially, it’s OEM only and rumors are OEMs won’t release it for already sold computers).

All in all, way to go Microsoft! Media Center may be the only consumer product where you have true technological dominance. This isn’t doing much to reassure customers of that, nor build your lead over competitors.

Now This Is Cool – First Video of Microsoft Multi-Touch Sphere ‘Surfaces’

I first heard of this a few months ago when rumors of such a device first surfaced. Based on the same technology as the Surface multi-touch table, the Sphere allows users to interact with content on, well, basically a huge crystal ball. Cool. I’m especially a fan of the globe application and the 360° camera. The latter will be especially popular with security stations (imagine a 360° camera on the ceiling in the center of a room, and then the entire room being recreated on the Sphere.)

Check it out for yourself, more details to come as microsoft releases them.

[Via Engadget]



Follow

Get every new post delivered to your Inbox.