Friday, March 9, 2018

Git could not pull because there were uncommitted changes

Recently, I could not pull from origin master on my Visual Studio 2017. Git could not pull because there were uncommitted changes. I forgot that every change in my local repo must first be committed before pull.

One easy way to commit uncommited changes and then pull was using command-line on the Visual Studio solution folder as follows.

git add -A
git commit -m "your message"
git fetch origin master
git pull origin master
git push origin master //To push to the git

Saturday, December 16, 2017

Broken Korean Text Fix

Due to a unique character encoding widely used for Korean text in Korea, you may run into broken, unrecognizable text when opening a file (txt, smi, hwp, doc, etc) created on the Korean Windows platform.

Use Notepad++ to fix such broken Korean text. Notepad++ is an open-source software freely available to download ( It is available for Windows only.

  1. Download and install Notepad++ on Windows.
  2. Open the original text in another text editor like the "Notepad".
  3. Copy all broken Korean text.
  4. On Notepad++, start a new blank file. 
    1. Go to Menu --> Encoding --> Character Sets --> Western Europe --> Windows 1252.
    2. Paste the copied broken Korean text on Notepad++'s new file.
    3. Go to Menu --> Encoding --> Encode in UTF-8
    4. When prompted to save the file, go ahead and save it.
    5. As the file is saved, the broken Korean text are fixed.

Wednesday, December 6, 2017

Age calculation based on today's date and birthday

To calculate the exact age based on today's date and birthday, it might be a little tricky to implement it in SQL. Below is one way to do it.
declare @BirthDate datetime = '12/1/2016'
declare @Today datetime = DateAdd(dd, DateDiff(dd, 0, getdate()), 0)

declare @age int = 
  ( CONVERT(int,CONVERT(char(8),@Today,112)) - CONVERT(char(8), @BirthDate, 112)) /10000

select @age 
/* returns 1 if today's date is 12/1/2017. */
/* returns 0 if today's date is 12/2/2017. */

Sunday, November 19, 2017

Full-Page Background Image CSS

Using CSS3, the following can be used for most modern browsers to produce full-page background image.
html {
  background-image: url('images/background-image.jpg') no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
Make sure to start the style with background-image: url(''). This style should work with IE9 or above.

Tuesday, October 3, 2017

Excel Services Issues Troubleshooting (2013/2010)

After updating Excel file on SharePoint from which a chart is published on SharePoint through Excel Service webpart, you run into an error "We're sorry. We ran into a problem completing your request. Please try that again in few minutes."

Solution: give it 3-5 minutes. If the worksheet chart used to work on SharePoint webpart before and if you did not modify the data connection(s), try again later. It seems to take a while for SharePoint to handle the updated Excel files in the back-end.

If the problem persists...

1. Check if Excel Services is running.
Central Administration -> System Settings -> Manage Services on Server -> Excel Calculation Service -> Check if "Started"

2.  Check if Excel Service Application is associated to Web Application in question.
Central Administration -> Application Management -> Manage Web Applications -> Select Web Application -> Configure Service Associations

3. Check if Trusted File Location is configured for Excel Service Application.
Central Administration -> Application Management -> Manage Service Applications -> Excel Service Application  -> Trusted file location -> Add  trusted file location -> Add address as https:// and Location Type as Microsoft SharePoint Foundation -> Keep the rest as is

4.  Check if document library configured to open documents in browser.
Site -> Library -> Library Settings -> Advanced Settings -> Check for "Opening Documents in the Browser"  Use either Server Default(Open in Browser) or Open in the Browser.

5. Grant "Excel Service Account" access to SharePoint Content database via PowerShell.

$wp = Get-SPWebApplication -identity
$wp.GrantAccessToProcessIdentity("Domain\Account that runs Excel Service")

**To check for service account - Central Administration -> Security -> Configure service accounts

6. Check if SharePoint Web Services in IIS has ASP.NET Impersonation disabled.
Select SharePoint Web Services from list of available of sites. -> Select Authentication from right panel and available authentications are displayed. -> Disable ASP.NET Impersonation if enabled.

Sunday, August 27, 2017

Make Windows 10 run faster

Below are tips to make Windows 10 run faster. This is useful when using Windows 10 virtual machine on a resource-limited developer PC or laptop.
  1. Disable Windows Search service
  2. Disable Windows Update service (please perform Windows update manually from time to time)
  3. Disable Telemetry and Data Collection service
    1. Open Registry Editor
    2. Go to
    3. Create a 32-bit DWORD value named AllowTelemetry and set it to 0.
    4. Open Services and disable the following services.
      1. Diagnostic Tracking Service or Connected User Experiences and Telemetry
      2. dmwappushsvc
  4. Disable Windows Defender
    1. Open Registry Editor
    2. Go to
      HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender
    3. Create a 32-bit DWORD value named DisableAntiSpyware and set it to 1.
  5. Restart Windows 10
  6. Run .NET Optimization manually via PowerShell (this could take 10-20 min).
    1.  Get-ChildItem $env:SystemRoot\\NGen.exe -recurse | ForEach-Object { & $_ executeQueuedItems }
  7. Restart Windows 10

Saturday, July 29, 2017

"vertical-align: middle" that works anywhere

Outside a table cell, vertical-align: middle does not work as expected. The following is a css that allows any child element to be positioned at center vertically and horizontally.

text-align: center works in most cases. However, it does not place a child element in perfect center position. It generally places the left-most edge of child element to the center horizontally, giving the look of off-to-right appearance of the child element.

.cell {
 border: 1px solid #587cdd; 
 border-radius: 5px; 
 margin: 5px;
 width: 50px; height: 50px;
 text-align: center;
 position: relative;
 float: left;
 -webkit-transform-style: preserve-3d;
 -moz-transform-style: preserve-3d;
 ransform-style: preserve-3d;
.content {
 position: absolute; 
 top: 50%; 
 -webkit-transform: translateY(-50%);
 -ms-transform: translateY(-50%);
 transform: translateY(-50%); 
 display: block; 
 width: 100%;

<script src=""></script>

<div id="app">
 <span class="cell" v-for="n in 10">
  <span class="content">{{ n }}</span>

new Vue({
 el: '#app',

The above code will produce the following. Each square has content with perfectly centered position: both horizontally and vertically.