Thursday, April 29, 2010
Monday, April 26, 2010
C# Improve Responsiveness in Real Time Searching
When you have real-time searching (searching as you type) you will inevitably get a performance hit because each letter you type will trigger a search which usually retrieves data from the database or at best a cache.
One solution is to add a delay and not search until the user has stopped searching for say 500ms.
One solution is to add a delay and not search until the user has stopped searching for say 500ms.
//declare the timer private Timer _searchQueueTimer; ... //Initialize the timer in the constructor _searchQueueTimer = new Timer(); _searchQueueTimer.Interval = 10; _searchQueueTimer.Enabled = true; _searchQueueTimer.Tick += new EventHandler(_searchQueueTimer_Tick); ... ////// Add the search string to a Queue /// private string _currentSearchItem; private string _queuedSearchItem; private DateTime _queuedSearchTime; public void Search(string search) { if (search.Trim().Length > 0) { _queuedSearchTime = DateTime.Now; _currentSearchItem = search.Trim(); _queuedSearchItem = _currentSearchItem; } } ////// Delay the search while user is still typing /// before performing the actual search /// private void _searchQueueTimer_Tick(object sender, EventArgs e) { // Time in milliseconds to wait before initiating the search const int queueTime = 500; if (_queuedSearchItem != null && DateTime.Now.Subtract(_queuedSearchTime).TotalMilliseconds >= queueTime) { Cursor = Cursors.WaitCursor;//Provide feedback to users DoSearch(); Cursor = Cursors.Default; } } /// Some psudo code for the method which actually does the search /// Removes the queued search text from the queue private Results DoSearch() { if (string.IsNullOrEmpty(_queuedSearchItem)) return list; _queuedSearchItem = null; SearchDB(); return results; }
Saturday, April 24, 2010
Monday, April 19, 2010
NBA Playoffs 2010: The first round
Lakers vs Thunder
The Oklahoma Thunder are in the playoffs for the first time since their move from Seattle (Supersonics), and with Kevin Durant leading the way, they are hoping to gain some experience before becoming an elite team in the years to come. But its still Laker time. Ron Artest is playing Dennis Rodman like defense, keeping KD shooting under 30%. Bryant is also a great defender, plus they have two 7 footers. I don't see anyone out west beating them beside Dallas.
Magic vs Bobcats
Howard's first game into the playoffs and he was frustrated by the Bobcat's front line. He's not going to have a bad game every game, but it was great to see Jameer Nelson step up, scoring 36 pts 4 rebs 6 assists. Lewi, Pietrus and Reddick had solid games and it was enough for a win even with VC playing badly. I think the Magic will bounce back from this bad performance and play better as the playoffs go along, which is scary considering how deep they are. Its no secret I'm vouching for a Magic Lakers finals rematch with the Magic finally winning that championship.
This still has Orlando fans angry...
Celtics vs Heat
I don't really care who wins this series, winner goes on to play Cleveland who will eventually make it through to the conference finals anyway. I really like Paul Pierce, and I really like Dwayne Wade, so I'm just sitting back and enjoying an intense defensive series.
And just for fun... NBA's Record for most 3 pts by a team, staring the Orlando Magic...
The Oklahoma Thunder are in the playoffs for the first time since their move from Seattle (Supersonics), and with Kevin Durant leading the way, they are hoping to gain some experience before becoming an elite team in the years to come. But its still Laker time. Ron Artest is playing Dennis Rodman like defense, keeping KD shooting under 30%. Bryant is also a great defender, plus they have two 7 footers. I don't see anyone out west beating them beside Dallas.
Magic vs Bobcats
Howard's first game into the playoffs and he was frustrated by the Bobcat's front line. He's not going to have a bad game every game, but it was great to see Jameer Nelson step up, scoring 36 pts 4 rebs 6 assists. Lewi, Pietrus and Reddick had solid games and it was enough for a win even with VC playing badly. I think the Magic will bounce back from this bad performance and play better as the playoffs go along, which is scary considering how deep they are. Its no secret I'm vouching for a Magic Lakers finals rematch with the Magic finally winning that championship.
This still has Orlando fans angry...
Celtics vs Heat
I don't really care who wins this series, winner goes on to play Cleveland who will eventually make it through to the conference finals anyway. I really like Paul Pierce, and I really like Dwayne Wade, so I'm just sitting back and enjoying an intense defensive series.
And just for fun... NBA's Record for most 3 pts by a team, staring the Orlando Magic...
WPF Problem Loading Designer
If your designer view is having problem loading, its probably because you have some code-behind in the constructor of your xaml form or user control. Add the following;
if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
{
// Code which causes the designer to fail
// Stick this using segment inside the contructor
// code-behind and encapsulate all extra code
// You may also need to add it to any initialize
// or form load method if you have added extra code
}
Sunday, April 18, 2010
Selling some work out equipment
In order to make room for my new bench press - which has a lateral pull down, I'm going to sell my previous bench press and some dumbbell weights. If anyone is interested, come visit my trade me listings.
If these don't get sold I'll consider lowering the price. If anyone is interested - and if there aren't any existing bids, I'll do mates rates for these.
Hyper Extension Bench Press with Leg Extension
20KG Dumbbells
If these don't get sold I'll consider lowering the price. If anyone is interested - and if there aren't any existing bids, I'll do mates rates for these.
Hyper Extension Bench Press with Leg Extension
20KG Dumbbells
Saturday, April 17, 2010
Subscribe to:
Posts (Atom)

