Skip to main content

Posts

Showing posts from 2017

How to run Firefox after installing Windows 10 creators update

I updated my Windows machine to use creator update and among other surprises, Firefox suddenly stopped to run. It was shown in the Task Manager, but I didn't see anything in Taskbar and the browser wouldn't open. Finally, I found the fix from the below link. This easy solution helped me to get the Firefox app running back again in no time. [Fix] How to run Firefox after installing Windows 10 creators update Here is the summary of needed steps - 1. On the Windows Explorer, go to address bar and type: %appdata%\Mozilla and press enter key. This will take you to the Mozilla folder in AppData folder where additional data and information regarding user program settings and preferences are stored. 2. Once you are inside the Mozilla folder, head to the address bar again and click the “Roaming” word. Doing this will take you the the upper level directory which contains the Mozilla folder. 3. Once in the Roaming folder, go and delete the Mozilla folder. Deleting the Mozilla f

Getting SQL Server Database Size using Python on Windows

Pre-requisites: 1.        Install SQL Server or an Azure SQL Database: I have tested it with SQL Server 2012 installation 2.        Get Python: https://www.python.org/ downloads/ 3.        Get Microsoft ODBC Driver 11 or 13 for SQL Server Windows:   https://www.microsoft.com/en- us/download/details.aspx?id= 50420 4.        Install 'Pyodbc' library using pip or any other package manager of your choice   Here are the main parts of Python Script that fetches DB size -   Import Pyodbc library import pyodbc Define database variables server = <ServerName> database = <DBName> username = <UserName> password = <Password>  Define Database Connection String cnxn = pyodbc.connect( 'DRIVER={ODBC Driver 13 for SQL Server};SERVER=' + server + ';   DATABASE=' + database + ';UID=' + us ername + ';PWD=' + password) cursor = cnxn.cursor()   Define query

Recursively deleting files in Windows

Due to a magical feature of OneNote software, one day I noticed lots of files with extension ' .onetoc2 ' in one of the folder and each of it's subfolders.  I found the below solution using wildcards with ' del' command and '/S ' switch to remove them completely and recursively -  1.   Open command prompt and go to home directory where you want to perform this operation             cd MyFiles 2.   Run the below command – del /S  *.onetoc2 PS: There's a huge difference between running del /S *. onetoc2 and del /S C:\*. onetoc2 .  The first command is executed from the current location , whereas the second is executed on the whole drive .

Profiling with SQL Server Management Studio

On the Query menu, click on ‘Include Advance Execution Plan’ or click the toolbar button. Now open a new query window, type the following queries and execute them. use Northwind ; set statistics io on ; set statistics time on ;  Select top 5 * from Customers   You should be now able to see additional information in the message tab and execution plan tab (along with result tab in lower window pane)

Using the InvariantCulture Property

It is associated with the English language but not with a country or region.    The   CultureInfo.InvariantCulture   property is neither a neutral nor a specific culture. It is a third type of culture that is culture-insensitive. You can use   InvariantCulture   in almost any method in the   System.Globalization   namespace that requires a culture.  When should we use it? You should use the invariant culture only for processes that require culture-independent results, such as system services. In other cases, it produces results that might be linguistically incorrect or culturally inappropriate. You should also use   InvariantCulture   when a security decision will be made based on the result of a string comparison or case change.  The default implementations of methods such as   String.Compare ,   String.ToUpper , and   String.ToLower   use the   CultureInfo.CurrentCulture   property.  When we shouldn't use it? Code that performs culture-se

Requirements file in Python

Requirements files in Python is used to get and install all python dependencies packages across user PCs. Here is how to create and use the requirements file using pip package manager (pip comes built in with Python 3.4 and higher. For previous versions, download and run get-pip.py) 1. Save your project dependencies in requirements.txt. It also includes correct package versions. pip freeze>requirements.txt 2. Install all packages listed in requirements.txt pip install -r requirements.txt

How to implement Wait Cursor in C#

public class WaitCursor : IDisposable {      private Cursor _previousCursor;        public WaitCursor()      {          _previousCursor = Mouse .OverrideCursor;            Mouse .OverrideCursor = Cursors .Wait;      }        #region IDisposable Members        public void Dispose()      {          Mouse .OverrideCursor = _previousCursor;      }        #endregion }

Threading tutorials from Microsoft

Do you know what’s lurking in the deepest, darkest parts of your thread pool? Take control of that monster and keep your applications responsive by becoming a threading expert with this free 5-part course. Advanced .NET Threading , Part 1: Thread fundamentals Advanced .NET Threading , Part 2: Compute-bound async operations Advanced .NET Threading , Part 3: I/O-bound async operations Advanced .NET Threading , Part 4: Thread synchronization primitives Advanced .NET Threading , Part 5: Thread synchronization locks