Related Posts for the ‘Blog’ Feed

WPF ListView Performance traps

Wednesday, January 7th, 2009

I am using ListView/GridView to low hundred of rows of data, with 10-20 columns with assorted cell templates, and I found that the performance is unacceptable!

Hey a Centrino Pro laptop isn’t that slow, right?

After googling for a night, here are the useful tips I gathered, http://itknowledgeexchange.techtarget.com/wpf/listview-is-it-really-too-slow/,http://www.designerwpf.com/2008/02/12/listview-and-listbox-performance-issues/, http://blogs.msdn.com/jgoldb/archive/2008/03/25/quick-tips-to-improve-wpf-app-memory-footprint.aspx

  • Embedding the ListView inside a StackPanel
  • Embedding the ListView inside a ScrollViewer
  • Not setting ScrollViewer.CanContentScroll to true [Sam: Default is True]
  • Having too many columns
  • Having UI Virtualization turned off (VirtualizingStackPanel.IsVirtualizing) [Sam: Default is On]
  • Avoid grouping

All checked, but it’s still slow! Scrolling is slow, sorting is crawling!

I finally give a try to Snoop, and wahola! Oh my!

It’s not using the VirtualizingStackPanel as the ItemsPanel. Each rows generates about 65 Visual Element, and the number runs into thousands for an hundred rows. No wonder.

Ok, but why?

Turned out that I have a line that reads-

<ListView.GroupStyle>
    <GroupStyle ContainerStyle="{StaticResource StandardGroupStyleWithMark}"/>
</ListView.GroupStyle>

Even though I am not using GroupDescription at all, but this enough for WPF to fallback to non-virtualized mode.

Note’s taken!

xLanguage receives major updates

Monday, January 5th, 2009 Chinese

Last update was almost 8 months ago. Now, xLanguage 2.0 could hide those post written in foreign language that reader cannot read. It’s effective under category list, in the RSS feed, when being searched…”This post is not available under…” is no longer shown! Of course, it’s your choice to activate this behavior, and you could also limit this behavior only to certain language.

There was actually a plan long ago to get this implemented, however life is hard and I just couldn’t find any free time to invest into this, afterall there wasn’t a strong user request. Until last Decemeber, when a user seriously asking for this feature (though with not much money) still I was exhausted and couldn’t take it. I was looking for help from my friend - Huizhe, but the user is converted to qTranslate when we were trying to send him an offer. Anyway, Huizhe spent a few good hours in the weekend to get this feature out of door, after bringing the UI and Readme file up to the par of Wordpress 2.7, the originally planned Milestone 2 is now finally completed! Enjoy!

2008 Election just finished, now 2012 Polling Statistics?

Friday, November 7th, 2008 Chinese

XKCD just got a comics strip about googling “2012 Polling Statistics”.

Let see how long does it take for http://2012pollingstatistics.com/ to show up in the google result.

Learn to drive a shuttle bus in Shanghai way

Wednesday, November 5th, 2008

Driving Culture of Shanghai (Nighttime)

Driving Culture of Shanghai (Daytime)

Be sure you click the “Watch in High Quality” link on the Youtube page, under the flash player box.

One Linux Box replacing Many SOHO Routers (iptables, iproute2, netfilter)

Saturday, October 18th, 2008 Chinese Cantonese

It’s easy to use Linux to replace one SOHO router. It can be conclude with 6 commands:

dhclient3 … $WANIF # Get the IP on WAN side
ip addr add 192.168.0.0/24 broadcast + dev $LANIF # Get the IP on LAN side
dhcpd3 … $LANIF # Enable the DHCPD on LAN side
sys.net.ipv4.ip_forward = 1 # Enable forwarding
iptables -t nat -A POSTROUTING -o $WANIF -j MASQUERADE # Enable SNAT
dnsmasq # Enable DNS proxy

GOAL: Use one Linux box to replace N SOHO Routers. i.e. This box would multiple isolated NAT each running at the same but actually different private IP range.

One router takes 5 commands doesn’t mean 2 routers take 10 commands, the problems are:

  1. How to get more than one IP for the WAN Interfaces?
  2. How to MASQUERADE to different WAN IP, for each set of router?
  3. N routers subnet will be defined as 192.168.0.0/24, but just like real router setup, THIS 192.168.0.0/24 is not THAT 192.168.0.0/24. Attaching 192.168.0.1/24 to $LANIF[1..n] confuses the kernel, or routing table to be exact, what can be done?
  4. From LAN side to visit the Router box?
  5. How about DMZ and Port Forwarding?
  6. Can visiting the other NAT subnet from one NAT subnet be done?
  7. How about Router visiting Client Side?

(more…)