Refactoring C# Code With ReSharper Help

image.png

  A pattern that I do quite often is to first right out code that actually works, then when I see a pattern repeat itself, I like to refactor that code to try and avoid the repetitive code.  Reasons include: Smaller Code Less Chance For Error Don’t Repeat Yourself (DRY) As an example, the c# code I’m working on now involves reading key values to be used with the Stripe payment service.  Here is the code I first wrote: [crayon-55495f823e7e8263537648/] The first thing I do is to look for the pattern and try and pull out variables that I know are going to be helpful in refacotring. You can see below that I pulled out the keyAppName variable and I also changed the assignment to be to a new variable rather than … Continue Reading

Showing The Record Count in a Sencha ExtJS Grid Made Simple

image.png

I use Sencha’s ExtJS for lot’s of data maintenance type applications.  One such application is an email response manager where it’s convenient to know how many different URL’s got clicked.  Basically, how many rows in the gridview.  Certainly, counting is an option but showing it in the title makes a lot more sense. The tip here is that often you have to call store.load() on the store associated with a grid so with just a couple extra lines you can put the count in the title of that grid.  Those extra lines are basically just a callback to the store.load that then grabs a reference to the gridview.  In my case, I have a button on my toolbar (just above the gridview), and in the button’s handler I execute the … Continue Reading

Add a Data Driven Combobox to ExtJS Form

image.png

I’ve been enhancing the session editor for AngularU  (Written in ExtJS 4.2)  and I’ve recently had to add a couple data driven comboboxes.  One to specify which track the session is in and one to assign which track the session is in.  Having done it a couple times in a row, my muscle memory is pretty good so I thought I’d do it again but this time on my blog. This is what the result looks like: The basics of the relationship between the table data is that we have a Session Table and a Track Table as follows: For the sake of the controls, we actually have two rest feeds.  One Track and one Session.  You can see them both here: http://angularu.com/rest/track http://angularu.com/rest/session The track … Continue Reading

ReSharper Continues to Make My Life Easier as a Programmer

image.png

Again, it happened.  I was about go searching the web for the string format parameters to figure out how to format just the day of the week.  I type some code like this: [crayon-55495f824312a514240528/] And up pops up the below screen from JetBrains Resharper giving my choices for ToString(). Very nice! Just sayin... … Continue Reading

Follow

Get every new post delivered to your Inbox

Join other followers: