Geeks With Blogs
New Things I Learned January 2008 Entries
Allow other pages to be anonymously viewed with Forms Authentication
I was playing around with Live ID Controls and trying to do a sample project to have my page integrate both Live ID authentication and my own forms-based authentication. This reminds me of the first .NET project that I did way back... Rewind time... Back in 2001, I got involved in creating a new web page to allow our clients to send their files to us, and we decided to use .NET (still in Beta 1 at the time). I learned about using Forms-based authentication, which was nice since accesses to any page ......

Posted On Saturday, January 26, 2008 7:23 AM

An alternative to notifying CollectionView of multiple items changed
While trying to sort out a different problem, I ended up looking at the NotifyCollectionChangedEven... constructor where the first overload only needs a NotifyCollectionChangedAction enumeration with no items needed. It must've escaped my mind since most of the implementation I had so far will actually raise the CollectionChanged event when adding or removing an item, and most of those implementation will just specify the item being added/removed. This single parameter constructor documentation ......

Posted On Friday, January 25, 2008 12:10 PM

protected internal modifier weirdness
I was talking with my peer today, and she told me about the weird behavior of using 'protected internal' access modifier. Using that modifier does NOT mean that the property/field is protected (can only be accessed by that class or derived classes) AND internal (if the derived class is in a different assembly that derived class won't be able to see that property/field). It turns out to be an OR - (per msdn) - that property/field is now protected (can only be accessed by that class or derived classescan ......

Posted On Wednesday, January 23, 2008 6:49 PM

Casting value type to object and back to another value type...
This may be old news for other people, but new to me and I am trying to put in new stuff that I learned. I wasn't aware of this, and after thinking about it, it does make sense (looking at it from how boxing/unboxing works), but I wished it had worked. The following code will throw an InvalidCastException private void PassValue() { float f = 5; double d = CastValue(f); } private double CastValue(object o) { return (o is float) ? (double)o : double.NaN; } So would the following. private void PassValue() ......

Posted On Monday, January 21, 2008 5:12 PM

Understanding Garbage Collection in relation to CollectionView classes
In my post yesterday, I created a rudimentary mechanism to detect if/when an object is garbage collected in .NET. In the example I gave, I created a ListCollectionViewEx class deriving from ListCollectionView. The sample code then tries to create 100 ListCollectionViewEx and then for a GC.Collect. To my surprise, the ListCollectionViewEx objects are not garbage collected. Now, I know the mechanism to record garbage collected item works, because I've tried it with other objects. So what gives? From ......

Posted On Friday, January 18, 2008 3:06 PM

Verifying objects do get Garbage Collected
I learned something new, relating to when/how to dispose CollectionView, but it comes after a series of steps of proving it. Along the way I learned some new stuff to, so I'll stagger them so it becomes easier to read & digest. This post will become the first one in this series (of 3 I think). I'm always somewhat wary about the automatic garbage collection nature of .NET, so every now and then I need to prove to myself that something is actually garbage collected. The technique I use is to create ......

Posted On Thursday, January 17, 2008 2:10 PM

Changed blog's display skin
After looking at some other blogs that reside here, they all look... better for lack a more suitable word. Went into my configuration and there I saw Display Skin selection, so I gave that a try. Most of the skins/styles are narrow-ish, which doesn't work very well with blogs that may contain code (like I'm planning mine would). I got it down to a few selection that would work, and I'll just put it here so I can remember what they are (and not try them again one-by-one if I wanted to change it in ......

Posted On Thursday, January 17, 2008 9:23 AM

Have worker thread update ObservableCollection that is bound to a ListCollectionView
While playing around with WPF, I tried to do some multithreading where I have a worker thread updating my ObservableCollection, while having a ListCollectionView of that ObservableCollection being shown on a ListBox. It was surprising to see that I get a NotSupportedException thrown, with the message saying 'This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.'. That doesn't seem to make sense - In my mind, I understand how ......

Posted On Wednesday, January 16, 2008 6:30 PM

ListCollectionView/CollectionView doesn't support NotifyCollectionChanged with multiple items
One issue with an app I'm developing is speed. It's a WPF desktop app, and it has a global list of entities being loaded, and we're using ListCollectionView to show the entities (filtered accordingly by each ListCollectionView created). We always thought that it was a DB issue, so yesterday I went researching how to optimize the DB call & code in general. My code was very spartan; paraphrasing, it goes as follows: BaseEntity[] entities = GetEntities(parentId); foreach (BaseEntity entity in entities) ......

Posted On Wednesday, January 16, 2008 9:33 AM

Binding to an Attached Property
Yesterday, I have some ideas in my mind on how to give out ValidationRule errors after the values passes the converter, and I was trying to see if I can use Attached Properties for that. When trying to do this, one of the things I'd like to do was set a control's text to the Attached Property's value and that's when I realized that I don't know the syntax to do that. A quick Google search yields some results; someone asked the same question and the answer suggested using parentheses. The following ......

Posted On Tuesday, January 15, 2008 12:53 PM

Trying to blog...
Blogging is new territory for me, so I'm trying to look & see what stuff can I do with this blog site. I found that you can create new categories, and then each post (I was correct that you blog by creating post - see my first post ) can be associated with 0 or more of these categories. Found a way to edit my first post, so I can associate it with my categories. Also found a way to hyperlink to my first post - again we'll see if this works later. Doesn't seem to be any way to preview or test ......

Posted On Tuesday, January 15, 2008 11:45 AM

Prologue
This is my first post. It should be my first post... hopefully - we'll see... This is my first venture into the world of blogging; I hope this would be a good move - I believe it will have some nice benefits for me, and I hope it can help others too. I plan to use this blog to catalog & detail (somewhat) any new things I learned during my day-to-day experience. Sometime early last year, I realized that I learn quite a bit of new stuff just by doing my regular work. I would just try to remember ......

Posted On Tuesday, January 15, 2008 11:12 AM

Copyright © Muljadi Budiman | Powered by: GeeksWithBlogs.net