To start using Couchbase solution as data store for your mobile application you need to setup up couple of things. This stack is named Couchbase Mobile and consist of three components: Couchbase Lite (Embedded NoSQL database) Couchbase Sync Gateway (Server component to synchronize data between the device and server) Couchbase Server (NoSQL database server) Download the above components from here. Going forward we are going to setup the two server components from the above list on Ubuntu machine (Ubuntu 14.04 at the time of writing). For the sake of writing, I have used droplet from Digital Ocean. But it is not restricted to any hosting provider. You can spin up a Ubuntu machine on Amazon Web Service, Microsoft Azure or any other hosting provider of your choice. AWS also provides a ready made package for the same in AWS marketplace you can use. Once you have a Ubuntu machine » Read more

 Jsinh        

Note: [Deprecated Content] This was written while ASP.NET and .NET Core was in beta (around beta5 or beta6). Since then a lot of stuffs have changed and moved around. Stuffs described below may or may not be true for current stable releases of ASP.NET Core - Configuration feature. I recommend not to follow along and get confused. Use official configuration documentation that explains it correctly - docs.asp.net With the upcoming release of .NET 4.6 and ASP.NET 5 (currently in BETA phase) one namespace that is getting new look (re-written) is System.Configuration. If you have not already read then I recommend you to take a look at getting started post by Louis DeJardin - ASP.NET vNext Moving Parts: IConfiguration He has also explained other moving parts which are some interesting reads. Why you ask? Louis explains few reason why System.Configuration needs to » Read more

 Jsinh        

Apple MacOS has beautiful rounded corner scrollbar and add to the UI experience you have while working on a MacOS machine. You can easily have similar scrollbar style for your WPF application to boost up your application's UI experience. If you wish to apply this scrollbar style application wide then you should follow below steps. Step: Create a new resource dictionary (skip creating if you already have one) file and add the following code to it. <Style x:Key="ScrollBarTrackThumb" TargetType="{x:Type Thumb}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Thumb}"> <Grid x:Name="Grid"> <Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Fill="Transparent" /> <Border x:Name="CornerScrollBarRectangle" CornerRadius="5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Height="Auto" Margin="0,1,0,1" Background="{TemplateBinding Background}" /> </Grid> <ControlTemplate. » Read more

 Jsinh        

There are so many productive tools and packages out there that can be used for profiling an ASP.NET MVC application. While back I wrote a quick intro about how Glimpse can come handy profiling your web application. There is one more simplistic and quick way to start profiling load / execution time for your application routines using MiniProfiler. This little package is prepared by folks at Stackexchange and used for Stackoverflow.com and other sites. MiniProfile's homepage shows quick way to get started with using MiniProfiler in your application. Following code snippet is required to profile a piece of code (not to forget MiniProfiler.Start() and MiniProfiler.Stop()): var profiler = MiniProfiler.Current; using (profiler.Step("Set page title")) { // Your code to profile } and you will see something similar to following when you load your application and run through profiled piece of code: So if I need to profile the execution » Read more

 Jsinh        

The brand new version ASP.NET 5 (a.k.a ASP.NET vNext) can be developed and hosted on all three major platform - Windows, Linux and MacOS. Getting started with ASP.NET 5 (TODO: Link to be updated with new Post for .NET tools) is not so hard after all and is definitely fun to play early. The biggest break through that comes to .NET and ASP.NET world is the capability to write and host anywhere. Yes you can now develop and host a ASP.NET Web application - MVC or WebAPI even SignalR on any platform - Windows, Linux and MacOS. This has always been the de-facto standard for windows since long using Visual Studio (prior VS2015) but it can be fun on Linux and MacOS also using your favourite editors or Visual Studio Code. Following step needs to be performed on a brand new spinning Linux » Read more

 Jsinh        

Not blogging yet? Around 1.5 years back, I wrote a post about what i call Slumdog Blogging, and I think you should read it. I learned a few things during my blogging journey and reading around which I would like to share today. Choose your seat and stick to it. I started blogging in late 2011 on URL: jsinh.in. At the time of starting I never thought of other things I might like to do with the domain. In few years I decided to put out a page or two where I can meta-link to well-known sites where I can be found. This was with the intention to give "More information" links to people who are interested in what I do or I don't. This would be about me and more direct, blogging content and articles is about what I write or wrote and shared with the community. » Read more

 Jsinh        

Once you have your PostgreSQL database server installed, up and running, due to security reasons by default remote access to connect with your database instance is disabled. If you try connecting with your PostgreSQL database server from client machine, you will encounter error. could not connect to server: Connection refused (0x0000274D/10061) Following screenshot displays error I received when trying to connect from a windows client machine using pgAdmin III Following below steps you will be able to enabled remote access to PostgreSQL database server. Before even we start it is important to know that there are two configuration files (and others) which control how your database server works. This configuration files contains settings that needs to be tweaked or changed to make your database instance run as per your needs. postgresql.conf (Used to set various parameters that affect the database) pg_hba.conf (Used to control client authentication, » Read more

 Jsinh        

Ok so you know the blah blah of how PostgreSQL is awesome relation database (RDBMS) and great for reliable transactions, good for so many things, lots of enterprise features and gives concurrency without read locks and stuffs. If you are not aware of this RDBMS, then I would recommend you search for advantages of using PostgreSQL and what is served in its plate. PostgreSQL is pronounced mostly as "post gray sequel" or "post ge are ee as que el" (I am sounding very dramatic here). Back to the post now, Fire up your Ubuntu 14.04 to start the installation. It would almost follow the same for most of the Ubuntu flavors out there. First step - you know the drill :) sudo apt-get update Next step: sudo apt-get install postgresql postgresql-contrib postgresql installs the core PostgreSQL engine and RDBMS around which everything else is build. The core files for this » Read more

 Jsinh        

Recently one of my family member ran into trouble when trying to fill an admission form online. As part of this form filling process, we had to upload scanned copies of previous study's merit sheet. We got it scanned but the scans where big in size. One of the scan image was around 2.5 MB. The online form filling site only allowed maximum 900 KB of file size to be uploaded. The way to compress or reduce size of an image is using Microsoft Office Picture Manager. This program / feature is part of Microsoft Office 2010 and prior editions. For some reason this program is been discontinued and is not part of later versions of Office packages. You can download this as part of Microsoft SharePoint Designer 2010. As an example I have a minions-party.jpg file which around 1.35 MB on disk. While installing Microsoft SharePoint Designer » Read more

 Jsinh        

I guest most of us are using cloud storage for taking backup of our precious data. No you say? Then my friend you will be in big trouble soon and you will repent for this act. I have lost few of my precious data in past because of this mistake and from that day I have never skipped taking backup of my data every week. Local hard disk can fail anytime, no one can give any gaureentee for that for sure. Anything stored on cloud is fail safe and secure unless you decide to share it to public. One thumb rule you should follow for all your important data is always backup your data at least at three different place. Primary storage where you keep it and access it daily or easily available. Take a backup to a local detachable - portable drive or something. This is your local quickly » Read more

 Jsinh        

Not a long post but very handy query that can be used when you need to know the installed SQL Server product's version, edition, flavour, server name details. SQL Query to get version details for installed Microsoft SQL Server: SELECT SERVERPROPERTY('productversion') AS 'Product Version', SERVERPROPERTY ('productlevel') AS 'Product Level', SERVERPROPERTY ('edition') AS 'Product Edition', @@SERVERNAME AS 'Server Name', SUBSTRING(@@VERSION, 1, CHARINDEX('-', @@VERSION) - 1) + CONVERT(VARCHAR(100), SERVERPROPERTY('edition')) + ' ' + CONVERT(VARCHAR(100), SERVERPROPERTY('productlevel')) AS 'Server Version'; Following query shows below output on my test machine: Happy coding !! » Read more

 Jsinh        

The date time of your PC (specific for windows) sync with one of the listed NTP server. This time sync happens every 7 days and with time.windows.com by default. You can also manually sync or update your time. To do that: Click on your system time > "Change date time settings" > "Internet Time" tab > "Change settings and click on Update now to sync. You can also resync time from command prompt by using command line utility called w32tm: cmd> w32tm /resync The default time to automatically sync time with any NTP server is 604800 seconds which is 7 days if you convert. You can change this settings by making edits to REGISTRY using regedit. Warning: Always backup your current registry state before making any changes. The key to change the auto time sync - time interval settings is located at: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\ » Read more

 Jsinh        

So someday you might need to create shortcut of or in your application programatically. Here is how you can do it: A shortcut is basically a LINK to the original file / executable that will be called when the link / shortcut is clicked. To create shortcut pro-grammatically, first you need add reference to Windows Script Host Object Model COM library in your project. Next add this using to your class - using IWshRuntimeLibrary; Next code snippet to create shortcut: var startupFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); var shell = new WshShell(); var shortCutLinkFilePath = Path.Combine(startupFolderPath, @"\CreateShortcutSample.lnk"); var windowsApplicationShortcut = (IWshShortcut)shell.CreateShortcut(shortCutLinkFilePath); windowsApplicationShortcut.Description = "How to create short for application example"; windowsApplicationShortcut.WorkingDirectory = Application.StartupPath; windowsApplicationShortcut.TargetPath = Application.ExecutablePath; windowsApplicationShortcut.Save(); Using above code, I create shortcut on my user's desktop. First line gives me the path to the desktop of my user - using Environment.SpecialFolder.Desktop. Next I » Read more

 Jsinh        

I recently bought a MAC Mini for development purposes and learning cross-platform / Xamarin development. Being windows / linux user for a quite long time now, I haven't ever touched or operated MAC OS before (I know, shame on me). So I have no prior experience with MAC world what so ever. In excitement, I opted for beta testing for early release of MAC OSX - Yosemite and was happy to use it. But when I experienced that my Xcode and Xamarin studio started breaking and acted weirdly, I decided to downgrade back to MAC OSX Mavericks. It was not an easy thing for me at first, after a few runs and tries I figured out a way to do it. This involved in preparing a flash drive to fresh install MAC OSX using recovery options. I prepared a flash drive with instruction from Apple and other developers and was successful to » Read more

 Jsinh        

Shout out: WPF programmer, someday you will be asked to work on a feature where you need to show live preview of a attached USB camera (webcam) and on click of button you need to capture a picture and save or display in some image control. Pretty simple right? Well actually not, ok partially. Fine its pretty simple. Let me walk you through it and save you some time. People who wants to jump right into the code refer / download attached sample at the end of this article. Best of luck !! How to preview webcam (camera) video and take snapshot with WPF using AForge and MVVM. Step: Create a new WPF project or use your ongoing / existing WPF project, whatever you fancy. Step: Add reference to AForge NuGet package that will do the "talking to the webcam" stuffs for us. AForge.Controls AForge.Video.DirectShow By adding this two packages » Read more

 Jsinh        

I had a weird experience before few days, I definitely knew how to solve the problem and I am sure it is the right way to do it. Thinking it would not be any different to map a datatable to POCO class(es) using Automapper. But it didn't turned out to be completely true. I have been playing with Automapper for couple of years now in my day-to-day work, but I stumbled a bit this time. Situationally, I was not able to conclude the problem with a working solution at that moment, thus I would take this opportunity and write about it so anyone out there who is facing same or similar problem can find their answers. Problem Data filled into a datatable was expected to be converted to Json object. If the datatable contains more than one row the resultant Json should have list of Json objects for each » Read more

 Jsinh