Showing posts with label debugging. Show all posts
Showing posts with label debugging. Show all posts

Saturday, March 4, 2017

C# DataBinding does not contain a property with the name with custom class object and CheckBoxList

I get the error "DataBinding: class1 does not contain a property with the name prop1"

public class1 {
  public string prop1;
  public string prop2;
}


My setup was an object array of class1 which has a property prop1 and prop2:

class1[] arrClass = new class1[arraySize];

Then I set the DataTextField and DataValue:
checkboxlist1.DataSource = arrClass;
checkboxlist1.DataTextField = "prop1";
checkboxlist1.DataValueField = "prop2";
checkboxlist1.DataBind();

This throws the error above. The fix is the lack of accessors in the class, class1. The class should be corrected to the following:
public class1 {
  public string prop1 { get; set; }
  public string prop2 { get; set; }
}
 Technically, set is not needed.


Reference

https://msdn.microsoft.com/en-us/library/aa287786%28v=vs.71%29.aspx

Wednesday, September 3, 2014

Work: MS Outlook hangs when opening a meeting invite

This suddenly happened to me today when opening a meeting invite today. The odd thing is that it is the only meeting invite that I unable to open. All the other invites are ok.

System Background

MS Outlook 2010 (desktop client, not OWA), Windows 7 Pro

Basic Troubleshooting

Restarted Outlook, restarted computer

Other Odd Behaviors

  • One coworker is having the same problem. Two others have no problems.
  • I was able to find the original invite. I noticed that I received 3 copies. I am able to open the first invite, the other two I am unable to open.
  • A coworker forwarded me the same invite, and I noticed that I received 3 copies just like the original. I do not know why that happens. I do not get it with other invites. Also, I am able to open the first but not the other two.
  • I noticed after a few minutes (about 3-5 minutes) the meeting will eventually load in my preview screen.
  • Appears that the problem is with loading the calendar which has "searching for this meeting..." although this is not a problem with the first email (by first I mean the first received email even though they all have the same times on it).
  • Rebooting machine does not fix the problem.

Exiting Problem

I cannot do anything else with Outlook once I attempt to open the broken invite. I end task the outlook. Reopening will allow me to do other tasks.


Conclusion

No fix yet except to wait 3-5 minutes. It has taken my coworker up to 10 minutes to open.

Friday, August 22, 2014

Work: Found Workaround when SharePoint view broken

I am still not sure why our views are at times broken. We receive an error that the data is not available but yet if we go to the all items view, all items are returned. We do not have access to the admin schedule so it possible that there are things happening in the back-end.

Whatever the case may be, my workaround to this is to click on the table section of the webform then export the data to Excel. The reason we need this is because we use this view in meetings to display what items need to be reviewed. Without the list, we are pretty much stuck and cannot continue.

I tried to play with some configurations in hopes to refresh the view to display. The problem seems to be only with this one views on a specific list (which is also the list we use the most). We have other lists but those lists does not appear to be impacted yet, although they are primarily all items views too.

Wednesday, January 15, 2014

Buggish: Blogger Compose Style removes Script Tags

I was posting a few links to Pinterest which uses a script to modify the link tags to display the images. To do this, I inserted the script into the HTML portion of Blogger.

Although Pinterest says to add this to the end, that only ensures that there are no other scripts that will interfere with Pinterest. The easiest way to check is just to try and see if it breaks. Very rarely do multiple scripts clash, but it can happen. I didn't want the script to be executed on all blog posts (why give them tracking data when I do not have to). So, short story is that I had no problems with this.

At the end, I wanted to add the reference. To do that, I went back to Compose mode and added the link to the site that I pulled some of the info from. When I updated, I noticed that the images were missing. Returning back to blogger, I noticed that the script disappeared which was easily remedied by re-adding the script.

Reference

Monday, July 22, 2013

Coding: JavaScript - Single Var vs Multi Var

I came across an article discussing Single-Var vs Multi-Var declaration for JavaScript. I am almost always for multi-var pattern from experience.

Programming from scratch, I do not particularly care for one pattern over the other. Some argue one looks better than the other. That is a personal preference. Single-Var promoters say it saves space, but most people tab it to the same level as the other variable names which defeats the space saving (unless you compress the file, then maybe there is an argument there). Even then, space is so irrelevant today because either the program is so large that the difference is insignificant or so small that systems today are so advanced that no one will even notice the minuscule delay.

Having to deal with troubleshooting, debugging, and reading through thousands of spaghetti-code, multi-var has so many more advantages. You cannot assume process when debugging or troubleshooting because if you are troubleshooting an issue, you are looking for a problem. On the same note, you cannot assume strict is being used. Also, developers may easily assume others can pick up the code easily or be aware of certain standards but not everyone is like that. You also do not know how many people the code has gone through or even how many companies.

There have been plenty of codes that I had to debug due to a variable not declared properly or even just misspelled. There was a code I had troubleshot because someone used an I instead of l or maybe it was a 1. Who is going to notice an upper-case 'i' to an lower-case 'l' to the number 1 when skimming through hundreds of lines of code?

Another use of declaring multiple vars is also to find where the variables are declared. Sure you can have IDE. But if you find yourself having to troubleshoot in unfamiliar environments, this makes a world of a difference to navigating through code with a simple text editor with a word find (or find word within a library of files). Even if comma-first, you then have to search for both comma-first and with var (in-case it is the first variable in the list or a parameter to a method/function or a different variable on a different block level [scope]).

For any advanced debuggers (I assume advanced developers), the cosmetics of tabs, alignments, etc., is barely a nuisance. At some point, I can read both styles easily without complications even if they were multi-line or single-line or case-insensitive.

So if there was an opinion to be made on this topic, it should be the people who are going to maintain the code after deployment. Developers have a project plan. Troubleshooters are expected to fix the problem yesterday. Time is more valuable to them than developers. No matter how experienced developers are or how mature the procedure may be, errors are human-nature.

Ultimately, either is acceptable. To me single-var would be like the developers leaving the power button in the back of the computer. You don't have to see the button and closer to the power supply which means no extra wires in the case. When was the last time you seen that design (the design did exist for those of you too young to have seen them)?

Reference

Kent Dodds - https://plus.google.com/u/0/114245123507194646768/posts/dnRkxWyQ4fM
Ben Alman - http://benalman.com/news/2012/05/multiple-var-statements-javascript/
Dan Hough - http://danielhough.co.uk/blog/single-var-pattern-rant/

Updates

3/12/2014 - Added two more references which support multi-var patterns. Ben Alman does a good job describing work-arounds to the advantages of single var pattern. Dan Hough does a good job explaining preventing errors and simplifying rafactoring. I like the addition of the refactoring which also expands on code maintenance.

There were a couple posts on the use of 'use strict'. For someone maintaining code, you may not always have access to modify code. Also, there are times working in a corporate environment which you may not even be able to install your choice of IDE or add-ins. Using multi var pattern is much more helpful for programmers supporting old code. Especially with javascript where code can put interjected in out-of place areas or written by untrained programmers like web designers.