The type or namespace name 'InCharge' could not be found (are you missing a using directive or an assembly reference?)Double-clicking the error takes me straight away to the using line that it claims might be missing. Madness! The answer, as is typical, is simple if not obvious. My project was automatically created with the target framework of .NET Framework 4 Client Profile. You can research what that's all about but it clearly ignores references to other projects. Switching that to simply .NET Framework 4 in the project's properties resolved the issue without any further fuss.
Wednesday, November 2, 2011
Are you missing a using directive? Stupid compiler, you're highlighting the using statement!
So, here I am, bopping along after adding my company's (InCharge Institute) framework library and referencing it in my project. I've added a using statement and completed writing the code, which ReSharper blesses and gives no syntax errors. And yet, I get a compiler error:
Monday, October 31, 2011
How to databind a Dictionary to a ComboBox or Why I don't post much lately
Here's a perfect example of the kind of simple stuff I'm dealing with which is oddly new to me but has been solved for a looooong time now.
Thursday, October 20, 2011
Are you a bad programmer?
For the rare person who frequents my blog, I'm sorry to say that I am no longer working on BI web development. I've taken a new opportunity where I'm doing straight-forward ASP.NET development so I don't expect many more posts on this blog. I will likely fire up a new blog if and when I have something to say that hasn't been said a bazillion times before by folks who have been at this far longer than me. In the mean time, I may post something I found nifty, like the following article:
Signs that you're a bad programmer
Friday, July 15, 2011
Jack of all, Master of none?
If you're reading this post, bless you for stopping by this ghost town. I've been busy with projects that have nothing to do with BI, strictly web development and not very interesting web Dev work, at that. However, it has gotten me thinking so I'll share with you a post I put up on the LinkedIn .NET Group. Take a look and comment away.
http://lnkd.in/fzAit3
http://lnkd.in/fzAit3
Thursday, March 17, 2011
Frustrating error #267: "Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element."
I recently experienced this issue and struggled to find a solution. After reading through the many blogs and forums a Google search returned, I was fortunate enough to read the linked post which made the answer built into the error obvious. Move the <configSections> block to the top of the blocks inside of <configuration>. Just re-sharing the knowledge so the answer is more broadly known and findable.
Tuesday, March 15, 2011
ARGHHH!!!
Everyone has heard of the maxim, "Every bug fix is an opportunity to create a new bug." Unfortunately, this is even more true in MDX queries. It turns out that what I perceived as a bug previously wasn't one and my efforts to "fix" that bug made things worse in the long run. Details to follow...
Reformatted my blog
Just a quick note to document the day I finally figured out Blogger well enough to make my blog readable. Sorry for those who struggled with it previously. :-S
Friday, February 25, 2011
My First Hack at Functional Programming
I'm learning that with every new bug I learn something. If you've been keeping up, I use my Symantec.DataFactories to code against SSAS OLAP cubes. It's very rare, but I discovered that it is possible (and I didn't take into account) for the query to result in a dataset with no data, i.e. a list of people with null values. I have to present those values as averages and standard deviations. It came as a nasty surprise when I found out that the DataTable.Compute() method doesn't handle a column of all nulls very gracefully. So, I coded up a solution, thanks to some Googling, which I believe lends itself to functional programming, something I just got introduced to by Chris Eargle at the last Orlando DotNet UG meeting. Here's my initial stab and maybe I'll get some feedback on how to improve.
Usage is made simple this way:
As an aside, I had no idea how to name the class or namespace for any usefulness. However, I learned that I never use the class name, anyway, so perhaps it doesn't matter. *shrug*
using System; using System.Collections.Generic; namespace MathLib { ////// Container class for all statistics values which may be set by the Statistics class /// public class StatTypes { public double? Average { get; set; } public double? StdDev { get; set; } } public static class Statistics { ////// Gets the average and standard deviation of a set in one pass /// /// The set to be operated on ///A StatTypes object with the Average and StdDev values /// for the set operated on public static StatTypes GetAvgAndStdDev(this IEnumerable<double> values) { StatTypes avgAndStdDev = new StatTypes(); // ref: http://warrenseen.com/blog/2006/03/13/how-to-calculate-standard-deviation/ double mean = 0.0; double sum = 0.0; double stdDev = 0.0; int count = 0; foreach (double val in values) { count++; double delta = val - mean; mean += delta / count; sum += delta * (val - mean); } if (1 < count) { stdDev = Math.Sqrt(sum / (count - 1)); } if (count > 0) { avgAndStdDev.Average = mean; avgAndStdDev.StdDev = stdDev; } return avgAndStdDev; } ////// Gets the average and standard deviation of a set in one pass /// /// The set to be operated on ///A StatTypes object with the Average and StdDev values /// for the set operated on public static StatTypes GetAvgAndStdDev(this IEnumerable<int> values) { StatTypes avgAndStdDev = new StatTypes(); // ref: http://warrenseen.com/blog/2006/03/13/how-to-calculate-standard-deviation/ double mean = 0.0; double sum = 0.0; double stdDev = 0.0; int count = 0; foreach (double val in values) { count++; double delta = val - mean; mean += delta / count; sum += delta * (val - mean); } if (1 < count) { stdDev = Math.Sqrt(sum / (count - 1)); } if (count > 0) { avgAndStdDev.Average = mean; avgAndStdDev.StdDev = stdDev; } return avgAndStdDev; } } }
Usage is made simple this way:
string metric = "DaysWorked"; StatTypes avgAndStdDev = (from row in table.AsEnumerable() where row.Field<double?>(metric) != null select row.Field<double>(metric)).GetAvgAndStdDev(); calculatedTarget["Mean"] = (object)avgAndStdDev.Average ?? DBNull.Value; calculatedTarget["StdDev"] = avgAndStdDev.StdDev;
As an aside, I had no idea how to name the class or namespace for any usefulness. However, I learned that I never use the class name, anyway, so perhaps it doesn't matter. *shrug*
Wednesday, February 23, 2011
Silly Trick of the Quarter
Ok, the title would have sounded better as Silly Trick of the Day, but let's be honest; I don't post that often. :-) That said, here's something someone might enjoy. I've been working a lot with AJAX recently to improve the performance of a dashboard. No matter how fast I make the queries run, though, there will be times where we have to wait. So, the inevitable progress indicator comes up...boring, annoying, time for a cup of coffee.
I decided to reward those who grin and bear it with an iconic symbol of activity, Pacman being chased by ghosts until he goes offscreen and then returns the favor by chasing the suddenly blue ghosts back off where they came from. However, I didn't want it to do this every time. Here's the cool trick, code provided below.
The key is to create a Render() method which overrides the base class' method. Your asp:Image in your UpdatePanel on the page, named imgLoading in my case, gets randomly set to the specified ImageUrl.
Note: As my project is neither publicly facing nor used in the pursuit of any profit, I don't believe I'm breaking any copyright laws. If you wish to use Pacman as I have, I'm willing to share my graphic but be aware of how the copyright laws may affect your application.
I decided to reward those who grin and bear it with an iconic symbol of activity, Pacman being chased by ghosts until he goes offscreen and then returns the favor by chasing the suddenly blue ghosts back off where they came from. However, I didn't want it to do this every time. Here's the cool trick, code provided below.
////// Extends the Base.Render() method to randomly choose which image to show /// for Loading panel /// /// protected override void Render(HtmlTextWriter writer) { Image loadingImage = (Image)UpdateProgress1.FindControl("imgLoading"); if (loadingImage != null) { int pacmanFlag = new Random().Next(1, 10); loadingImage.ImageUrl = pacmanFlag == 1 ? "~/Images/indicator-pm.gif" : "~/Images/indicator-big.gif"; } base.Render(writer); }
The key is to create a Render() method which overrides the base class' method. Your asp:Image in your UpdatePanel on the page, named imgLoading in my case, gets randomly set to the specified ImageUrl.
Note: As my project is neither publicly facing nor used in the pursuit of any profit, I don't believe I'm breaking any copyright laws. If you wish to use Pacman as I have, I'm willing to share my graphic but be aware of how the copyright laws may affect your application.
Common Error, Simple Solution
Have you ever seen this error?
What I was doing seemed simple enough. I needed certain RadPanels to show up on the page while others are hidden (<- a="" ajax="" and="" as="" be="" behind="" big="" browser.="" by="" c="" cannot="" class="brush: cpp; toolbar: false" code-behind="" code="" control="" controls="" css="" d="" didn="" display="" displayed.="" do="" don="" error="" false.="" find="" foreshadowing="" frankly="" hidden="" hiding="" i="" if="" in="" include="" instead="" interface="" is="" issue.="" it="" key="" like="" look="" may="" modify="" no-no.="" not="" of="" or="" out="" pops="" pre="" property="" radpanel="" render="" root="" s="" same="" setting="" should="" simple="" so="" solution="" something="" t="" tag="" telerik="" that="" the="" their="" then="" this:="" this="" to="" toolkit.="" true="" turns="" up="" use="" visible="" want="" wants="" was="" when="" whether="" with="" you="">radDock.Style.Remove("display"); // Visible = true
radDock.Style.Add("display", "none"); // Visible = false->
Message: Sys.ArgumentNullException: Value cannot be null. Parameter name: panelsCreated[2]I struggled for quite some time trying to figure out what to do about it. If you do a Google search, you'll come across lots of people struggling with this error and the responses pointing at the AJAX Toolkit. However, in my case, I wasn't using the AJAX Toolkit directly. Rather, I was using Telerik's ASP.NET/AJAX controls.
What I was doing seemed simple enough. I needed certain RadPanels to show up on the page while others are hidden (<- a="" ajax="" and="" as="" be="" behind="" big="" browser.="" by="" c="" cannot="" class="brush: cpp; toolbar: false" code-behind="" code="" control="" controls="" css="" d="" didn="" display="" displayed.="" do="" don="" error="" false.="" find="" foreshadowing="" frankly="" hidden="" hiding="" i="" if="" in="" include="" instead="" interface="" is="" issue.="" it="" key="" like="" look="" may="" modify="" no-no.="" not="" of="" or="" out="" pops="" pre="" property="" radpanel="" render="" root="" s="" same="" setting="" should="" simple="" so="" solution="" something="" t="" tag="" telerik="" that="" the="" their="" then="" this:="" this="" to="" toolkit.="" true="" turns="" up="" use="" visible="" want="" wants="" was="" when="" whether="" with="" you="">radDock.Style.Remove("display"); // Visible = true
radDock.Style.Add("display", "none"); // Visible = false->
Subscribe to:
Posts (Atom)
Mocking GCP APIs containing iterator structs
New company & language, who dis? The astute amongst my readers may have noticed that I left Lightbend to go work with some friends who ...
-
tl;dr version Memory issues? Try -XX:+UseSerialGC -Xss8m in your Run Configuration or as command-line parameters. The Problem I'...
-
New company & language, who dis? The astute amongst my readers may have noticed that I left Lightbend to go work with some friends who ...
-
Ahem! Did You Fall Asleep? Well, now that you mention it, I did about a month of sleeping since my last post. Thanks for the nudge awake. I...