Geen categorie, PowerShell

A repository of useful PowerShell scripts

Note: this blog is no longer maintained. Please go here to see the latest updates of this post.

Due to a number of circumstances (traveling, certifications, lots of projects), it’s been way too long since I wrote my last post. Anyway, I have had to generate a lot of new files lately. Because I am allergic to repetitive work, I looked for a way to dynamically generate and process files. And for my case, PowerShell scripting comes pretty close to what I needed.

Just like a few of my other posts (the best of StackOverflow and Things I always have to Google, I decided it would be a good idea to centralize these scripts and share them with you. Most of these scripts were made for one specific case so they’re not generic – but upon request I’ll try to make these as generic as possible.

This is going to be a post that I’ll hope to update on regular occasions, so make sure to pay a visit every now and then if you’re working with PowerShell too.

Continue reading

Advertisements
ASP.NET MVC, Javascript

ASP.NET MVC and HTML5 Web Workers

Note: this blog is no longer maintained. Please go here to see the latest updates of this post.

Although the technology has been around for a while now, HTML5 Web Workers didn’t draw my attention until a few days ago. As I’m building a client facing SaaS application for my client, performance is crucial. Having worked with asynchronous methods in C#  for years, I thought of using this concept in JavaScript. As it turns out, multithreading in Javascript isn’t really part of the package. You had to work with timeouts and callbacks to implement some kind of asynchronous architecture, but splitting some heavy work into multiple threads (and even background work for that matter) wasn’t really supported out of the box – until HTML5 Web Workers were introduced. In this article, I’ll explore the capabilities in two different ways in the context of a ASP.NET MVC 5 application.

Continue reading

Geen categorie

Best of Stack Overflow

Note: this blog is no longer maintained. Please go here to see the latest updates of this post.

Just as in my other post about topics I have to “re-Google” often, this post serves as a catalog of interesting Stack Overflow articles. Because the concept of browser favorites doesn’t work quite well in my world, this blog post does the job of keeping a simple and convenient list very well.

Continue reading

Geen categorie

ExtJS grid page size – letting the user decide

Note: this blog is no longer maintained. Please go here to see the latest updates of this post.

In addition to the article below, I have embedded this feature into a new PagingToolbar child class. Basically it adds a combobox to the toolbar’s items and then adds extra behavior so the store reloads with the specified page size.

Ext.define('Ext.toolbar.PagingComboToolbar', {
extend: 'Ext.PagingToolbar',
displayInfo: false,
pageSize: 50,
initComponent: function () {
var me = this;
this.store.pageSize = this.pageSize;
var combo = new Ext.form.ComboBox({
name: 'perpage',
width: 75,
store: new Ext.data.ArrayStore({
fields: ['id'],
data: [
['10'],
['20'],
['50'],
['75'],
['100'],
['150']
]
}),
value: this.pageSize,
listWidth: 70,
triggerAction: 'all',
displayField: 'id',
valueField: 'id',
editable: false,
forceSelection: true,
listeners: {
select: {
fn: function (combo, record) {
var newPagesize = parseInt(record.get('id'), 10);
this.pageSize = newPagesize;
this.store.pageSize = newPagesize;
this.store.loadPage(this.store.currentPage);
},
scope: this
}
}
});

Ext.apply(this, {
items: [
'Per page: ',
combo
]
});

this.callParent(arguments);
}
});

Ed Spencer

Sometimes you’ll be using a Paging Toolbar on a grid and need to give the user the ability to change the number of records per page. One way of doing this is by adding a combobox to the toolbar:

We’ve set up a simple combo box which allows the user to choose between 15, 25 and 50 records per page. Now let’s set up a Paging Toolbar, and a listener to take action when the user changes the selection in the combo box:

Finally we’ll roll it all together into a Grid:

If the user needs to be able to enter her own page size, replace the ComboBox with an Ext.form.NumberField, and attach the event listener to the field’s ‘keypress’ event.

View original post

C#

Custom configuration sections in C#

This is the best article I’ve read about this topic. Very clear and lots of screenshots to show the correlation between the config file and the programatical equivalent. Only drawback is that the code samples can’t be copied pasted because the author took screenshots of the code snippets rather than inserting them as code excerpts.

BarDev - Archive

This post will provide an example and explanation of how to create custom configuration for C# applications. I will discuss ConfigurationSections, ConfigurationElements, ConfigurationElementCollection. Also I will discuss how to nest these items together. My plan is to take very small steps; implementing each part of the configuration individually.

By the end of the post we will be able to navigate a custom configuration similar to the following config file:

Assumption

  • Good understanding of C#
  • Good understanding Visual Studio – I’m will be using VS 2012
  • .NET 3.5 and higher
  • Basic understanding of configuration files

The application we are going to create is quite contrived. The school settings that we will store in the config file would usually be stored in a database, but I want to provide a domain that most people understand.

Our Domain

A School has
A Name
A Address
Zero or More Courses
A Course has
A…

View original post 1,582 more words