Subscribe: O(geek)
Added By: Feedage Forager Feedage Grade B rated
Language: English
android  bag  code  iphone  new  oofgeek archive  originally posted  posted oofgeek  system windows  windows forms  windows 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: O(geek)


Ryan Cain, running in time proportional to Geek.

Copyright: Ryan Cain

HP Slate 500 vs iPad 2

Mon, 04 Apr 2011 18:49:21 GMT

Originally posted on: many respects is not really fair to compare these two products, as they are mostly targeted toward two different markets, however, the HP Slate 500 is the best offering that Microsoft and it’s partners have put forward to compete head-on with Apple and the rapidly growing tablet/slate market.  As way of background I have been a Windows Tablet PC user since the product was first released as an extended version of Windows XP.  I started by testing a Panasonic Toughbook convertible, moved on to what is still my favorite convertible, the Toshiba M200, and last used the Toshiba M400 convertible.  I mainly stuck w/ the convertible form factor as it met the dual need of a development laptop (ie I had to have a keyboard) combined with my desire for a pen input device for note-taking.  The new HP Slate is my first foray into a Windows slate device as my development (Windows, iPhone and Android) has moved to a 15” MacBook Pro.  I have also been using an iPad since about a month after its release, and recently upgraded to the new iPad 2, managing to grab hold of one on launch day.  (The 2 is definitely a worth upgrade to the first device.)  HP Slate 500 While I may have missed a few quality slate releases in the previous years, in my experience the HP Slate 500 is the best Windows tablet to hit the market.  The Asus Eee Slate may come close, but the size the HP is what makes this unit the perfect business companion.  The screen resolution can be a bit small, especially for software not written for such a short screen, but where you really use it, OneNote, the size is perfect.  Even though I love the iPad and use it daily, I still believe Gates has it right when he says pen input is required for a usable tablet device in business.  The iPad is great for consumption, say for execs or board members in a meeting and needing access to information, but doing little in the way of creating digital content.  While there are great Apps for the iPad that actually work to take notes, it still feels like writing on a paper w/ crayon.  This is the single strongest point of the HP Slate and Windows 7 on slate devices.  Handwriting recognition is incredible, OneNote is perfect for use around the office, and the HP Slate is truly a business device in Gates vision. This same vision has led the Tablet PC market to sit stale for years and years, until Apple again took an idea and turned it around to create an entirely new market.  What has been missing all these years was a quality Windows interface that worked well in a tablet form factor.  Yes touch and pen input has been around forever, but the standard keyboard and mouse experience has remained the core of a paradigm that has been with us since Windows 1.0. I believe the focus on pen input has also been the biggest distraction keeping Windows from embracing the tablet form factor. Since a tiny stylus point can compensate for bulky, awkward fingers, there is no need to increase fonts or button or various other UI elements.  Thus Windows has remained Windows but now you use a pen instead of a mouse.   Of course the single greatest benefit of Windows on a slate, is well, Windows on a slate.  It’s a full Windows PC, so every single piece of your favorite software runs perfectly.  There’s no need to purchase new software, learn new software or change anything you’re used to.  Hardware Enough about Windows, what is the hardware like?  As I mentioned the form factor is great for note-taking.  Unlike when I carried the M400 into a room, I now fit into the meeting environment, with a notepad size device in front of me, not an SUV.  The screen resolution can be a little low, but any higher res and things would be unreadable.  Battery life has been great, I pretty much never worry about the battery, and just keep the unit in its (included) dock when I’m not actively using it.  I find that it’s actually small enough that I use it even during phone calls at my desk i[...]

Disneyland Inside Out on iPhone and Android

Mon, 21 Feb 2011 18:17:40 GMT

Originally posted on:

It's hard to believe October was the last time I was over here on my blog.  Ironically after getter the developer phone from Microsoft I have been knee deep in iPhone programming and for the past few weeks Android programming again.  This time I've spent all my non-working hours programming a fun project for my "other" website, Disneyland Inside Out

Disneyland Inside Out, a vacation planning site for Disneyland in California, has been around in various forms since June 1996.  It has always been a place for me to explore new technologies and learn about some of the new trends on the web.  I recently migrated the site over to DotNetNuke and have been building out custom modules for DNN.  I've also been hacking things together w/ the URLRewrite module in IIS 7.5 to provide strong SEO optimized URLs.  I can't say all that has really stuck within the DNN model of doing things, but it has worked pretty well.

As part of my learning process, I spent most of the Fall bringing Disneyland Inside Out to the iPhone.  I will post more details on my development experiences later.  But this project gave me a really great opportunity to get a good feel for Objective-C development.  After 3 months I actually feel somewhat competent in the language and iPhone SDK, instead of just floundering around getting things to work.  The project also gave me a chance to play with some new frameworks on the iPhone and really dig into the Facebook SDK.  I also dug into some of the Gowalla REST api's as well.  We've been live with the app in iTunes for just about 10 days now, and have been sitting in the top 200 of free travel apps for the past few days.  You can get more info and the direct iTunes download link on our site:

Disneyland Inside Out for iPhone

Since launching the iPhone version I have gotten back into Android development, porting the Disneyland Inside Out app over to Android.  As I said in my first review of iPhone vs. Android, coming from a managed code background, Android is much easier to get going with.  I just about 3 weeks total I will have about 85 - 90% of the functionality up and running in the Android app, that took probably 1.5 - 2x's that time for iPhone. 

That isn't a totally fair comparison as I am much more comfortable w/ Xcode and Objective-C today and can get some of the basic stuff done much faster than I could in the fall.  Though I'd say some of the hardest code to debug is still the null pointer issues on objects that were dealloc'd too early in Objective-C.  This isn't too bad with the NSZoombies enabled for synchronous code, but when you have a lot of async, which my app does, it can be hairy at times to track exactly what was causing the issue.  

I will post more details later, as I am trying to wrap up a beta of the Android app today.  But in the meantime, if you have an iPhone, iPod Touch or iPad head on over to the site and take a look at my app. 


Looking to Rock the PDC 2010 LG E900 Phone on AT&T?

Fri, 29 Oct 2010 13:41:29 GMT

Originally posted on:

If you are one of the numerous PDC10 attendees moving your iPhone SIM to your free LG-E900 Windows Phone 7, and you're on AT&T, you may have noticed the minute you lost WiFi coverage your data stopped as well.  If you read through the paperwork that comes with the phone there was a quick little note that says "you may need to manually configure your APN setting."  Well that was an important hint to getting your Windows Phone 7 up and running with data on AT&T.  To updates the APN do the following on your phone:

  • Open Settings
  • Cellular
  • Scroll to the bottom where is says Set or Edit APN
    • APN:  wap.cingular
    • Username:
    • Password:  CINGULAR1

Yes those are all cingular names, but that's what AT&T still uses.  These settings are those that are required for the iPhone to work, so if you're coming from a non-iPhone plan, these settings may not work, or you may be required to upgrade your data plan.  Also I won't guarantee that this won't impact our data plans in any way, it simply gets the Windows Phone 7 up and running on the AT&T iPhone data plan, and seems to work fine for me. 


PDC 2010 OData Feed iPhone App

Wed, 27 Oct 2010 04:19:44 GMT

Originally posted on:

I spent a few hours today and hacked, and I do mean hacked, together a quick iPhone App to consume the OData feed for PDC 2010.  Since the turnaround is way to quick to push something like this through the app store, I've pushed to code up to github for anyone to download and play with. 

You can access it at:

I will in no way claim that this code is good, that it manages memory well or does anything other than "work".  But if you're heading to PDC10, and have an iPhone and an Apple Dev account download the code and party on!  Also note that I'm fairly new to iPhone development, and coming from over 8 years with .NET I'm still definitely cutting my teeth on this new platform. 

In order to get the code to compile you will need the OData iPhone SDK, which you can download at:

Follow the install instructions that come with the SDK to re-configure the project to point to your install of the SDK.  The header and library paths on the Project info are currently pointing to a folder on my machine, as well as the binary for the library. 

Also this is my first time pushing out code to github, so hopefully I didn't royally screw something up.

Have fun and see you in Redmond!


Tom Bihn Bags–Worth the Money

Thu, 23 Sep 2010 23:28:26 GMT

Originally posted on: about 5 years now I’ve been carrying around the best recent TechEd bag; the messenger style bag from 2005.  It served me well as it could easily carry 2 laptop’s, plus loads of additional tech gear; iPad, multiple external hard drives, cables, etc.  My only dislike of the bag was that the strap never seemed that sturdy, and I occasionally had issues where the clip would reverse itself, making it very easy for the strap to come loose without me noticing.  Unfortunately this past week the metal clip part of the strap decided to completely break, which left my bag tumbling to the ground, 2 laptops and all.  Thankfully there was enough padding that neither were damaged, but since they are both MacBook Pro’s, the aluminum has a decorative dent on the corner now.  This led me to do some research on options that were available, of which many roads pointed to the Tom Bihn bags. I had heard about the Brain Bag for many years (originally from .NET Rocks), and have nearly purchased one in the past, but I just could justify spending the money.  Never thinking $140 for a bag to protect $5,000+ in equipment was probably worth it, until this most recent close call. Since I was coming from a messenger style bag, I decided to stick with the same style bag and selected the Empire Builder “briefcase”, the Absolute Shoulder Strap, 2 Brain Cells and a medium sized Cordura Organizer Pouch.  My biggest concern with the Empire Builder was whether or not it would hold both of my MacBooks (13” unibody MacBook Pro and 15” unibody MacBook Pro).  Well, Tom Bihn had posted a video to YouTube showing exactly how accommodating this bag is, so that answered that question. Tom Bihn Empire Builder with 2 Laptops The American made feature, that leads to the high price of the bags, is nice, but what’s even better is the quality of the product that you receive.  This is the first bag I have ever owned that has no sign of loose stitches or threads… anywhere!  Typically “out of the box” there are a few here or there that simply show the lack of craftsmanship, even on backpacks I’ve paid close to $200 for.  This quite simply is the highest quality bag I have ever held in my hand.  Beyond the craftsmanship the quality of materials appear to be excellent.  Shoulder strap clips are much stronger than my TechEd bag, zippers are high quality, and materials are top notch.  Even small details like the handles leave you feeling as though they are part of the backbone of the bag, not some added afterthought of an attachment that could break at any moment.  The bag has many different compartments and features, but rather than reinvent the wheel, Tom Bihn once again has posted a video showing off all the features of the bag: Empire Builder Features Inside the bag, the Brain Cells are excellent protection for your laptops.  They definitely add extra bulk, but coming from someone who just pictured 2 cracked screens as his bag fell to the cement floor, that extra padding is now well worth it in my view.  The Brain Cells are hard sided with quite a bit of padding on the “bottom” (the bottom changes depending on if your order the horizontal or vertical cells).  They pretty much protect your laptop from any direction, from drops, or from stabs from other hard objects in your bag.  You can, if you want, order the Brain Cells for use on their own.  Each cell has its own handles, and place for a shoulder strap.  If you’re at a conference or such you can easily pull the cell out of your larger bag and carry just the cell around with you during the day.  The Absolute Shoulder Strap is probably overpriced, but I do agree with most of the reviews that I have read, namely it is the most comfortable shoulder strap I have ever had on a bag, especially when carrying 2 laptops at a time. [...]

The mapping of interface member [...] is not supported.

Fri, 10 Sep 2010 19:47:22 GMT

Originally posted on:

This is good to know, strange solution but it works:

I created an Interface that my Linq to SQL classes implement so that I can create a generic function that will work across a few tables.  When I used the double equals (==) instead of the .Equals() in my LINQ query I got the runtime exception:

The mapping of interface member [...] is not supported.

Changing my query up to use the .Equals() it runs beautifully. 


Mobile Development Resources (iPhone & Android)

Wed, 08 Sep 2010 20:58:20 GMT

Originally posted on: building our mobile app I came across a few valuable resources for some of the specific issues I was facing, I thought I'd share those in case others were looking for similar info. Customized Color Progress Bar iPhone This one probably violates all UI rules defined by Apple, but we were looking to change the color of the progress bar for our app based on certain values.  As the bar filled up, we wanted it to change to red so the user could quickly see while driving that is represented a different state than when it was green.  There is no built in mechanism to do this on the iPhone, but I did come across a great free 3rd party progress bar that only requires attribution for licensed use: Android Android does have the colorization feature built into the framework.  All that is required is an XML file for your progress bar and an attribute on your progress bar itself.  The XML file should be placed in the res/drawable folder in your project and look something like: If the above is named “redprogress.xml” then simply add an attribute to your progress bar tag in the UI of: android:progressDrawable="@drawable/redprogress" JSON Parsing iPhone All of the data we use in our app comes from a REST service that pushes out JSON formatted data.  The iPhone framework doesn't include any libraries for parsing of the JSON data, but as with the colored progress bar there is a great open source 3rd-party library that provides that parsing for you: One gotcha though is that if you are pushing out your JSON data from a .NET REST service, apparently there is not standard representation for dates yet within JSON, so you will have to roll your own date parsing method.  A good starting point to parse the .NET formatted JSON date is at: Android Android has all the JSON objects and parsing already built in and accessible with no extra libraries needed.  Access your REST service is as simple as building up and HTTP connection and reading back the JSON as a string, then parsing as such: JSONObject json = new JSONObject(result); int myInt = json.getInt("MyJsonFormattedDataItem")); As with iPhone though, there is no built in parsing method for the .NET date type formatted in JSON so you will have to roll your own.  [...]

ASP.NET AJAX Control Toolkit and DotNetNuke Module Development

Tue, 07 Sep 2010 15:30:24 GMT

Originally posted on: working to get the AutoCompleteExtender control up and running in a custom DNN module, I ran across a forum post that said doing so "just works", which if you have previous ASP.NET AJAX experience and know what is and isn't in DNN is probably very true.  Trying to get it to run for the first time though, there's a few items to be aware of.  Getting Started First recommendation, go download Fiddler (, like now... no seriously go download it.  If you are running DNN in a dev environment on localhost, I'd also recommend getting Firefox for testing.  There is a fiddler plugin for Firefox that allows all traffic to be forwarded to fiddler, including localhost traffic, something that isn't easy for Internet Explorer to do.  I'm sure there's some extra tricks to getting DNN to use the ipv4.fiddler name (see the docs post fiddler install that described using the tool with IE), but I didn't have a chance to get into that, and Firefox just works, plus it forces you to test your site in another browser. The combination of these are are exactly what you need to debug any errors you might be getting but don't see since the AJAX calls are happening in the background (duh).  You'll also need to download and install the ASP.NET AJAX Control Toolkit from Microsoft (  What is very nice (I'm running DNN 5+) is the core pieces supporting ASP.NET AJAX are already in place in DNN, so there is nothing you need to do in the CMS itself.  The control toolkit when compiled will copy itself into the bin directory of your custom module, so there's nothing extra to install on your DNN server either.  The Service Something important to remember is a DNN Module is an ASP.NET user control, which means the default callback mechanisms for AJAX to a static method on a page, will not work.  In fact the built in Smart Tag tool to "Add AutoComplete Page Method" will error out with the error "Cannot create page method "GetCompletionList" because no CodeBehind or CodeFile file was found!".  You will need to either create your own ASMX web service and WCF service.  In my case I simply added the service to my custom module, but since it's just a web service you can serve that up from anywhere.  I used the VS 2010 built-in "AJAX-enabled WCF Service", but you can use a standard ASMX web service as well, though you do need to decorate this service correctly for it to work with AJAX (notably the class need to be decorated with [ScriptService]).  This automatically decorates your class with all the necessary attributes for it to work as an AJAX enabled web service.  This will also create a new web.config in your custom module and add all sorts of stuff that really can't be there since your module is hosted within the context of a larger site.  You'll need to copy the relevant bits into the web.config for your DNN site.  The relevant bits include everything in the section, including the behaviors, serviceHostingEnvironment and services.  Now you can add your WCF service for the auto complete.  In my case I'm working against a Linq-to-SQL model, so my method looks like (note that if you use clipboard inheritance and copy from another project that created this method in the code behind of an ASP.NET page this method is marked as static, which it can't be in the context of a true service.  This is soemthing that I kept missing and causes things not to run during execution):         [OperationContract]         public string[] GetCompletionList(string prefixText, int count, string contextKey)         {             DataClassesDataContext dc = new DataClassesDataContext();             var q[...]

Thoughts on Android and iPhone Development

Wed, 25 Aug 2010 23:32:06 GMT

Originally posted on: the past few months I had the great opportunity to tackle the challenge of learning both the iPhone and Android mobile platforms for the first time as a developer.  I had used both previously as a consumer, so it was interesting to finally get a chance to jump in with both feet for a work project. I have been focused on .NET development in C# for the past 8 years, but originally cut my teeth on unmanaged C & C++ during the 90's, along with a smattering of Java development for college courses during the same time.  Both platforms brought me back full circle and in some cases were frighteningly deja vu, especially since we're now 10+ years out from my work in those languages. The following are some of my observations as a .NET managed code developer building apps for these platforms for the first time. Frameworks and Languages It was an absolute blast to learn 2 brand new frameworks in the span of 3 months.  If you are a managed code developer and want an easy transition into mobile (this applies until Windows Phone 7 is released), I highly recommend trying Android as your first platform.  Virtually every managed code concept from the Microsoft world is translated on Android in one form or another.  The challenge is definitely the iPhone, but a very fun one at that. iPhone The language, the concepts, even the message (read function/method) names are foreign and brand new for me as a managed code developer.  Actually having to think about object lifecycle and release memory is so last millennium.  It is also extremely powerful for the resource constraints we are currently under on our mobile devices.  Apple has a great Build and Analyze tool to help you find memory leaks and unreleased objects, along with instrumentation to do the same.  Though quite interestingly, virtually everyone warns you not to run memory leak tools on the iPhone simulators, as those tools themselves have major memory leaks that will cloud your data with extraneous noise. Probably the single most powerful part of iPhone development is the UI framework that is built into the box for you.  If you have wondered how so many iPhone apps work in the same manner, it is because Apple has created project templates to use their recommended UI design, along with providing specific UI elements to ensure that consistency.  As a developer this is great, as I can build easy to use apps without having to bend over backward to do something that works just like the native Apps on the device.  This I believe is one of the strongest unifying elements of the iPhone platform. Objective-C itself is a very unique addition to the C language.  It is very evident to see where some of its features and concepts are a workaround for the limitations of its parent language.  It bends over backward to keep true C compatibility, often times to the detriment of the usability of the language for a beginner.  Messages are a very interesting concept and are essentially methods or functions that are late bound at runtime.  This provides a cool design concept for the iPhone API's that gives Apple some extended flexibility to add Messages to the API that your objects can handle, but at the same time don't break backward compatibility to code that doesn't already implement that Message. Android Android quite simply is a modern managed platform for the mobile world.  XML is the goo that defines the UI and Java is present in all its managed wonder.  Even with the limited tooling (see below) Google manages to throw in small niceties to the framework that just make developers lives easy. For this project we published a REST web services with JSON data.  For the iPhone I had to find a 3rd party framework to do the JSON processing for me, Google has t[...]

Windows Live Sync on Mac

Mon, 23 Aug 2010 20:59:10 GMT

Originally posted on:

I've been running various versions of Live Mesh and Live Sync on my Mac over the past year. So far I haven't been terribly happy with Live Mesh, but it got the job done, albeit very slowly at times.  I'm am very exited at what I am seeing though in the latest Windows Live Sync beta for both Windows and Mac OS X.

When installing the latest version of Live Sync, which is still in beta I ran across the following error on start:

"Sorry, there is a problem with Windows Live Sync. Please quit Sync, make sure your computer is connected to the Internet, and then start Sync again."

A Google search led me to Brian Hall's blog post at:

His specific post didn't help, but the link he provided to Microsoft sure did:

Deleting the folder at the following location seemed to do the trick for me:

~/Library/Application Support/Live Id

After deleting that and emptying the trash the Live Sync beta started no problem and prompted me for my Live ID and password.


The Growth of Mobile

Thu, 19 Aug 2010 20:30:03 GMT

Originally posted on:

In the past few months I've had the great opportunity to learn both the iPhone and Android platforms for an App we built for my 9 to 5 job.  This was a great new chance to learn brand new languages and frameworks after 8 years of living in the Microsoft world.  I'll get to more of the specifics in later posts.

In order to validate some of our platform decisions and the choice to move toward mobile development I did some research and came across some amazing stats.

  • According to CITA (the wireless trade association), there are over 285 million wireless subscriber accounts in the US.  This is the equivalent of 91% of the US Population with a cell phone in their hand.  Granted many folks have multiple cell phone accounts (personal and work), so this is a bit of a misnomer, but still absolutely amazing to think how far cell phones have come in the past decade in the US.  (
  • Nielsen estimates that over 50% of all cell phones will be smartphones by the end of 2011.  This is just incredible to think for years I was a lone geek walking around the office with a huge brick on my belt buckle, and now, pretty much within the past 3 years these advanced devices are just about to be the most popular type of mobile device.  (
  • The same Nielsen stats point to the iPhone with a 28% share of smartphones, and Android taking 27% of all smartphone sales in the first 6 months of 2010.  These 2 platforms make up 50% of all sales for the first half of 2010.
  • According to Steve Jobs in his antenna-gate press conference Apple sold more than 3 million iPhone 4's in their first 3 weeks of sales.  Eric Schmidt announced at the Techonomy conference that Google has been activating 200,000 Android phones PER DAY as of July 2010.

I think looking through all these numbers, to me, it is staggering how quickly we have adopted the mobile lifestyle.  The technology has finally reached a point where battery life matches that amazing power and features of a mobile device.  The entry point for smartphones is no longer $500, and often the newest phones run just $99 with a contract, or most frequently $199 for the latest and greatest device.

When I look back over the past year since adopting the iPhone as my primary platform, mobile access has truly become a way of life for me.  Rarely do I sit at a desktop computer anymore (except at work where I'm coding all day anyway).  Instead most of the time the first place I access information is on my phone or iPad, where I'm not next to a desk or at home.

It definitely gives some food for thought for a "corporate" programmer like myself, where we may lag behind some consumer trends in our day to day work, but where user expectations quickly creep up on us and suddenly we are thrust into entirely new worlds in order to meet our organizational needs.


SharePoint RSS Reader – Authenticated Feeds

Tue, 09 Dec 2008 17:49:36 GMT

Originally posted on:

If you are trying to setup a blog in SharePoint and want to aggregate its feed to a parent site, you’ll find that if you’re using NTLM you’ll get the following error:

The RSS webpart does not support authenticated feeds

This seems frustrating at first as you begin to wonder why you can create a blog, add RSS feed viewers, but can’t combine the two.  Basically this appears to come down to an authentication issue, and NTLM’s lack of ability to delegate credentials.  The solution:  Kerberos, and what appears to be a very simple solution at that. 

Basically just change the default Authentication Provider in SharePoint Central admin to Negotiate (Kerberos), use SetSPN to register an SPN for your App Pool account on your domain controller and allow that App Pool account to delegate through “trusted through delegation.”

More details on this can be found at:

Mark Arend: RSS Viewer web part and authenticated feeds

The referenced MSDN article from the above with more details on the setspn is at (4th question):

Credentials and Delegation

The download for the setspn tool for Server 2003 is at:

Windows Server 2003 Service Pack 1 32-bit Support Tools


SSL Host Headers

Mon, 06 Oct 2008 16:06:12 GMT

Originally posted on:

In case you happen to be needing to do host headers with a wildcard SSL Certificate, here is the article from Microsoft on how to do it in IIS 6:

The basic command line call is:

cscript.exe adsutil.vbs set /w3svc//SecureBindings ":443:"

Where is the numeric identifier displayed in IIS, and is the header you’re trying to capture for the given site. 

Also for reference, the full path to:

cscript.exe  is c:\windows\cscript.exe

adsutil.vbs is c:\inetpub\adminscripts\adsutil.vbs


SSRS Global Variable "Trick"

Thu, 26 Jun 2008 23:15:10 GMT

Originally posted on:

We are working through a beta release of an internal project so I'm getting a chance to solve many different problems right now.  Today I had to update a report that has an issue where its count at the bottom was displaying the total number or records instead of just those that were visible. 

Basically this is a report of applicants who have passed all tests during a job recruitment process.  If they fail any step then they shouldn't show on the list.  I did some tricks with the data of the report to check to see if the failed any test and hide a rectangle if they have.  This formula used a few aggregates to get the job done.  Of course anyone who's used SSRS 2005 knows you can't do aggregates of aggregates, so that makes getting the count at the bottom much more difficult. 

The trick I used was to create a "global" variable in the code of the report.  I wrapped that variable in a Function that looked like:

public dim passedCount as int32 = 0

public function IncreasePassedCount(a as boolean, b as boolean) as boolean
    if a or b then
        return true
    end if

    passedCount = passedCount + 1
    return false

end function

a and b are flags that specify whether or not there was a failure, since there's 2 possible ways an applicant could fail on a given row.  If they have failed then we return true (so that way hidden = true, somewhat counter intuitive for web and windows programmers).  Otherwise they have passed everything and we want to keep everything visible.

This code is then called via the Visibility expression on the rectangle that holds all the data.  That expression looks like:

Sum(Fields!PassedByScore.Value) <> Count(Fields!TestScoreId.Value),
Sum(Fields!PassedByFlag.Value) <> Count(Fields!TestScoreId.Value))

The IncreasePassedCount function serves double duty for me; a. it increases the passedCount variable as needed b. it returns a boolean to hide or show the rectangle.  This way I can guarantee my code is being called only when it needs to be to increase my counter.  If you try to call this method in an IIF statement the method always seems to get called, even when it is only in the true or only the false clause.  I'm guessing this is just how SSRS resolves its code behind. 

Now with that in place I have a very simple text box that has my total count, now based on what's visible not on all the records.



DataGridView DropDown Column Index -1 Exception

Thu, 26 Jun 2008 22:57:08 GMT

Originally posted on: developing one of our new applications I ran into an interesting issue with the DataGridView, which contained a DropDown (ComboBox) column that was bound to a different BindingSource.  The basic issue is that the user would click a LinkButton and select a file.  That process would create a new instance of an object on the backend, which would be added to a list that was then bound to the DataGridView.  The drop down option on this new item would be left null however.  When the user would go to click the drop down to make a selection, they would receive the following exception: System.IndexOutOfRangeException: Index -1 does not have a value. at System.Windows.Forms.CurrencyManager.get_Item(Int32 index) at System.Windows.Forms.DataGridView.DataGridViewDataConnection.OnRowEnter (DataGridViewCellEventArgs e) at System.Windows.Forms.DataGridView.OnRowEnter(DataGridViewCell& dataGridViewCell, Int32 columnIndex, Int32 rowIndex, Boolean canCreateNewRow, Boolean validationFailureOccurred) at System.Windows.Forms.DataGridView.SetCurrentCellAddressCore(Int32 columnIndex, Int32 rowIndex, Boolean setAnchorCellAddress, Boolean validateCurrentCell, Boolean throughMouseClick) at System.Windows.Forms.DataGridView.OnCellMouseDown(HitTestInfo hti, Boolean isShiftDown, Boolean isControlDown) at System.Windows.Forms.DataGridView.OnCellMouseDown (DataGridViewCellMouseEventArgs e) at System.Windows.Forms.DataGridView.OnMouseDown (MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.DataGridView.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) This really didn't seem to make any sense.  We had done this many times before and it worked perfectly fine, it was just this specific code that was causing an issue.  The code at issue was the following: recruitmentBindingSource.DataSource = recruitments; dataGridViewAttachments.DataSource = null; dataGridViewAttachments.DataSource = attachments; The recruitmentBindingSource was used for the drop down, and the gridview was where our problem was.  Well it turns out the 2nd line where we set the DataSource of the gridview to null was the source of the exception.  We had placed that line in there to force the gridview to refresh its display data.  We were updating that attachments list in a service, and the one way to make the gridview refresh is to set its DataSource to null, then to the object you want to work with.  Well this appears to cause more problems than its worth!  (Especially since I closed another issue today that was being caused by this null "refresh hack.")  After doing a little research I came across the following code, namely the ResetBindings(), which appears to be just what the doctor ordered in this case.  I hadn't used this method again, since I ran into issues with it a few months back on non-datagridview controls, but for gridviews that call seems to refresh the data nicely and force the grid to reread the data in the object collection.  The new code that resolves this issue now looks like: recruitmentBindingSource.DataSource = recruitments; recruitmentBindingSource.ResetBindings(false); attachmentBindingSource.ResetBindings(false); attachmentBindingSource.DataSource = attachments; dataGridViewAttachments.DataSo[...]