Posts

Showing posts from October, 2020

C# Thinking outside the norm

Image
Introduction Had a forum question today where a developer wanted to load a TreeView in Windows Forms were data was read from a database and in turn caused the user interface to become unresponsive. They asked about BackGroundWorker component or asynchronous way (async/await task) but had never worked with any of these. My solution Since the idea is to use a delegate/event this path will work on any control ranging from TreeView to ListView or DataGridView the example given uses a ListView. Start off with a class which represents returning data. using  System; namespace  IteratingCodeSample.Classes {      public   class   Countries     {          public   int  CountryIdentifier {  get ;  set ; }          public   string  Name {  get ;  set ; }        ...

VS Code with Cold Fusion - SVN and FTP'ing

I work for a state agency where the main programming languages are C#, PLSQL and Cold Fusion. Before I transfered to this agency and to this day the Cold Fusion developers have been using Aptana editor. Aptana was selected because when the developers where looking for an editor one requirement was to push the active file to the development server. When I was called for writing code for Cold Fusion I would write JQuery and CSS in Microsoft Visual Studio and only use Aptana for Cold Fusion native code and really disliked using Aptana. This week I installed VS Code with several extensions coldfusion for working native cold fusion SFTP for transfering file(s) to our development server SVN to do source code management along with TottoiseSVN Then for a warmer feeling installed the following extensions vscode-icons VS Color Picker It was nice to have the support of die hard Aptana developers eager to move to VS Code woohoo. Visual Studio is still my editor for all coding other than cold fusi...

VB.NET Working with Delegate and Events

Introduction From hobbyist to seasoned developers delegates are avoided or attempts are made to understand them, which in many cases is met with frustration. I see questions on various forums where code could be refactored by using delegates and when making suggestions to use delegates generally the response is something like “that is over my head, what I have works!”. Well just because code works does not mean there is room for refactoring. Search the Internet for VB.NET delegates and find out there are an abundance of post while the majority are not fully working examples and may be untested which can lead back to frustration. The first mistake some coders make is not reading Microsoft documentation on delegates or think outside the box and study C# code samples and a decent C# to Visual Basic converter as there are more code samples in C# than Visual Basic. One must understand that there are cases like with MulticastDelegate class there is syntactic difference on how to use them ...

Friday rant

First time for this but needs to be out there as we as a community can do better to educate novice coders who might someday be tomorrow's developers. Novice coders (note I will be call them developers), many times will ask “what is wrong with my code”, I tell them, provide a better solution and they come back with “but that’s over my head, can you explain that in detail?” or “can you make my code work?” Well in the first case “over my head”, I wonder why they don’t read Microsoft documentation? Then in the second case “make my code work”, well if it was decent code that would be me telling them how and if stuck come back and explain. Just yesterday I provided a solid solution but the asker refused to use it because I would not fix their code. I said, it’s going to be a while until you get someone to fix your code and I was right, going on 20 hours and generally speaking less answers are done on weekends. How can this and similar situations be remedied? Have them read the docu...