Visual Studio Code Settings

User Setings Below are few user preferences I use that defer from the default { // Controls the font family. "editor.fontFamily": "Fira Code Light, Consolas, monospace", // Enables font ligatures "editor.fontLigatures": true, // The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on. "editor.tabSize": 2, // Controls how lines should wrap. Can be: // - 'off' (disable wrapping), // - 'on' (viewport wrapping), // - 'wordWrapColumn' (wrap at `editor. [Read More]

Laravel Mix and Path Settings

A quick refernece for myself, when setting up new asp.net core spa and VueJS based project along with laravel mix the following setting helps in translating the path resolution correctly: mix.setResourceRoot('/dist/') .setPublicPath(path.normalize('wwwroot/dist')); so a typical laravel-mix webpack.mix.js file for asp.net core and vue js project (especially with admin-lte) would look like: mix.js('client-src/main.js','') .extract([ 'vue', 'vue-router', 'vuex', 'chart.js', 'admin-lte', 'bootstrap', 'jquery', ]) .autoload({ jquery: ['$','jQuery', 'window.jQuery'] }) .sass('client-src/assets/vendor.scss','') .sass('client-src/assets/main.scss','') .setResourceRoot('/dist/') . [Read More]

Publishing aspnet core web app to linux

Step 1 : Publish your project to a proper directory On researching a subfolder under /var seems to be a good candidate. So, create a suitable subfolder and copy the published app files to it. For future reference lets assume we have copied the app to /var/myproject folder. Step 2: Configure reverse proxy > sudo apt-get install nginx > sudo service nginx start update /etc/nginx/sites-available/default to server { listen 80; location / { proxy_pass http://localhost:<port_number>; proxy_http_version 1. [Read More]

Adding Service Account in Linux

useradd --system [--no-create-home] <account name> from the man pages If called with one non-option argument and the –system option, adduser will add a system user. By default, system users are placed in the nogroup group. To place the new system user in an already existing group, use the –gid or –ingroup options. To place the new system user in a new group with the same ID, use the –group option. [Read More]

Bypassing YouTube stream throttling by ISPs [for Windows]

If you have a very decent internet connection (equal to or more than 4 mbps) but still not able to stream YouTube video’s without it waiting for buffering a lot, it maybe because your local ISP could be using a CDN for caching YouTube instead of loading from the main site. There is an easy way to bypass this throttling by asking your OS to block traffic from the caching CDN and loading the content directly from YouTube by simply providing the following command at elevated command prompt [Read More]

Working with .NET Boolean and Oracle along with ASP.NET MVC

Somethings that are straight forward in MS-SQL and .NET are bit convoluted when using Oracle and .NET. A good example for this case is when trying to map a database Boolean field to a .NET POCO. With MS-SQL we can straight away use bit which has a possible values of 1 or `, but with Oracle since it does not have a built in Boolean type we would normally go with a single character field with a value of‘Y’or‘N’`.

[Read More]

ClickOnce and WinForms application – tiny tips

The below are few points that we learned during a recent application developed using WinForms and deployed using ClickOnce.

Refracting to use native PC/SC interface

The core functionality of the application was to provide proximity card based attendance system for students in a classroom. For this we were previously using the API provided by HID Global. This caused various dependency issues between Windows operating systems and architectures (32bit vs 64bit), so as part of the refactoring we have removed the dependency and using the PC/SC interface exposed by Windows natively. Of course, this means mucking around a bit in the P/Invoke world (for accessing WinScard.dll related functions), but it provides elegance to the application by eradicating extra baggage of dependency.

[Read More]

Authenticating with the help of System.DirectoryServices.AccountManagement

With the help of System.DirectoryServices.AccountManagement (available from .NET Framework 4.0) authenticating users against Microsoft Active Directory has become a lot simpler. Compare the below code public static bool IsAuthenticated( string domain, string username, string pwd ) { using ( PrincipalContext pc = new PrincipalContext( ContextType.Domain, domain) ) { return pc.ValidateCredentials( username, pwd ); } } to what you have to do previously public static bool IsAuthenticated(string domain, string username, string pwd) { string domainAndUsername = username + " [Read More]

Zen Coding for Visual Studio 2012

Don’t wait, head over to VS extensions gallery and grab hold of Web Essentials 2012 by Mads Kristensen. The extension offers good amount of features for VS based developers, of all of them the one I am going to talk about is the Zen Coding style introduced by Sergey Chikuyonok (as mentioned in JohnPapa.net).

Before I proceed further Zen Coding style has been implemented across various text editors, and if you are a full time or regular web developer you should have a look into it. For all the supported text editors check out the Wikipedia entry at http://en.wikipedia.org/wiki/Zen_Coding#Text_editors.

Once you have installed Web Essentials 2012, you will have support for coding in Zen Coding style development inside of Visual Studio 2012. The main idea behind the coding style is to reduce the manual typing process of creating the mundane html code for your web application. It is kind of text expansion mechanism, but it is much more than that.

[Read More]