Posts

Incognito mode in chrome

Image
The least we can to do when browsing using chrome is use incognito mode. So here is way to always open chrome in incognito mode use this argument for the application shortcut. --incognito Open the properties of application shortcut and change as below Here is what incognito mode does and what most people think is just the opposite. So incognito just makes sure that data like the history and the cookie are deleted when you close that window. It does not hide what you are browsing from the ISP or the software's that is running in your OS like the key logger or the antivirus etc., Happy browsing! Somewhat incognito 👽😜

Protecting sensitive data using Secret Manager in .Net Core

Image
Accidentally pushing sensitive data stored in application config into source controls!!! Thankfully this happens to many not only you 😜. It feels good when you have company doing mistakes or anything else. So here is how make sure this does not happen again. There are  multiple ways  to protect, the one we will learn now is using Secret Manager tool in #dotnetcore. All we have to do use  dotnet user-secrets  this command. Before using it remove the sensitive value of the property you are trying to hide. In my case it is  "TwilioAuthToken":""  in  appsettings.json  file. Now in the terminal run this below command, dotnet add package Microsoft.Extensions.SecretManager.Tools We have the necessary tools required to run the commands on  user-secrets . Lets create a key value vault for our project in * .csproj  file like this <PropertyGroup> <UserSecretsId>LocalKeyVault</UserSecretsId> </PropertyGr...

Containerize an Application

Image
Here is how we containerize an application in this example in this example I have chosen a dotnetcore application. Photo by  Samuel Zeller  on  Unsplash Add a Dockerfile which will be used to create an image for your application. Below is the sample. FROM  microsoft/dotnet:2.2-sdk  AS build  this basically says create our application based on this Microsoft image. Navigate the shell to your application folder and then using  docker run  create an image for your application. docker build -t sampleapp. you can see your image using  docker images . Finally that you have your image ready we can create as many container we need using this. There are two options to create a container out of the image you just created either use this below command docker run -d -p 8080:80 --name sampleapp appcontainername or use the  docker-compose.yml  file from the app folder. Which consists the exact same information as yml...

Launch .Net Core with VSCode for starters

Image
To use VSCode for .net core you would need Omnisharp extension so that we can debug our application just like as in Visual Studio. -- Photo by  SpaceX  on  Unsplash Using the dotnet new command we create a web and an API project dotnet new webapp appname.web dotnet new webapi appname.api Create a solution so that it wraps all the projects in one place dotnet new sln appname dotnet sln add appname.web appname.api After building the Web and the API projects we need to create the launch.json which VScode refers to build and debug the application. For a complete reference on doing these projects consider this great resource . You can always use VSCode terminal to run these above commands as well, also note you can open multiple terminals the same VSCode instance like this . Setup the launch.json by clicking on add configuration and select .Net core web app. we will need to add two such configurations one for web and another for web ap...

How to Run two .net core apps with debugging On using Visual Studio Code ?

Image
When developing a web application we separate our application with *.web being initial server-side application and  *.api application which will help us fetch/update data for client-side operations and avoid page reloads. Photo by  Vincent van Zalinge  on  Unsplash Here is .NET Core application I was working on which had a similar kind of ask, and I wanted to use VSCode to debug my application. This is how we do it, first, we need to create a solution so that we keep both the API and Web project in one place dotnet new sln -n appname dotnet sln add src/appname/appname.web.csproj dotnet sln add src/appname/apname.api.csproj Open "launch.json" and Click on add configuration and add then select .NET Core Launch (web)  No go ahead and rename to web or web-api, also add a development URL with a different than web configs the "env" property "env": { "ASPNETCORE_ENVIRONMENT": "Development", "ASPNETCORE_URLS": ...

Setting up docker with Hyper-V

Image
Docker is just amazing with flexibility we get to not worry about setting up the environments for our application. --Photo by  Ilse Orsel  on  Unsplash Download docker for windows . So with Windows we can use hyper-V and get containers spawned in minutes. Here is how we do it. Make sure you have Hyper-V enabled on windows if not go to turn on windows feature and turn this feature On. Once this is done with restart. Use Hyper-V Manager for Windows to create a Virtual Switch Now use the following commands to create the docker containers docker-machine create -d hyperv --hyperv-virtual-switch "Primary Virtual Switch" default this will create a VM, you can see this with Hyper-V manager or docker-machine ls once the machine is created you need to set some of the machine details in Environments Variables to list the variables use docker-machine env default Now set the env vairables as below using bash eval $("C:\Users\arjun_shetty\bin\...

Load Testing an nodejs API

Image
Load Testing is quite a stream of its own all I did was smoothly sailed on top of it. With not much time in hand, the only weapon of choice was Jmeter, Well quite brilliant a tool!! We had to test a facebook chat-bot built with nodejs. This app is a webhook for FB to push the chat messages down to our app. This is how we achieved it On Windows: Download JMeter from  here . Now run the jmeter.bat, this will open up a java GUI where you can easily configure the endpoints you want to test. Add a thread group and set the number of users/thread you want to spawn to test your API Add an Http request sampler  Fill in the intuitive fields like URL, request body, Method, etc., For setting up HTTP headers like content-type or authorization fields right click on HTTP request and add config element HTTP header manager, then the key values as you may To see the results on all the requests that will spawn create add listener View results tree.  You are ready ...

Simply Notes #3: Multiple File Upload in ASP.Net MVC

Image
Here is requirement I tripped into "Give me an option to upload multiple images which blah blah blah". Blah blah part is where it says do not use the easy way like input type multiple . Below is the POCO  for this sample which is the View Model Checkout the UIHint attribute which will let us use DisplayFor or EditorFor in any of the views To make this control reusable create a template File.cshtml which is type bound to custom Image type The jQuery script will copy the input type file element and appends to the last file element whenever a file is selected to upload on the input element. The Action here is to ModelBind image array to the action parameter The Bind  attribute takes care of the naming convention that takes behind the scenes when rendering the element. If you are using the template to render any element the framework will append the model property names of the nested elements. In this example it will render input element with name="PIma...

Simply Notes #2: Single Click File Upload in ASP.Net

For those who hate to click more than required and like Scott Hanselman said  " There are a finite number of keystrokes left in your hands before you die. "  I definitely have very little left to spare and I am still writing this! - Check yours Here is one way of doing file upload in single click Keep fileupload control hidden using css styles On client click of the upload link button trigger the fileupload click event and return false so that server side click event is not fired Now bind an onchange event for the fileupload control Onchange event trigger the server side click event of upload link button On upload link server click save the file on server

Simply Notes #1: Setting up Source control with BitBucket using Git

Image
Bitbucket lets you create free unlimited private repositories. Here are the simple steps to setup a project and push it to Cloud. Get this awesome native app for Git from here  Now create a Repository on Bitbucket Open up Git Shell and enter these simple commands >  cd /working project folder >  git init >  git remote add origin https://username@bitbucket.org/username/reponame.git Note:   If that above command says remote origin already exists try this below command >  git remote set-url origin https://username@bitbucket.org/username/reponame.git >  git add . >  git commit -m "first commit" >  git push -u origin --all DONE!!! your code on cloud. For reference on what each command does this is the place to go. 

Hangout!!!

Image
Everyone is hanging out lately, so thought sharing some views of mine on the same. I might be biased on thoughts for Google's culture and intentions (don't be evil) seems to be on the same frequency as mine on that aspects. Hope Hangout does not end up with the same fate as of Google Wave . I know it was not a failure and most off its interesting features been ported to Google Drive or GMail in some or the other way. The best thing about this app is the seamless integration with multiple devices.( Yes Multiple devices! if you did not know) Here are some tips on getting it in multiple devices. On Android devices you can get it from Google Play . On Desktop try this extension for chrome. On Gmail try clicking on the profile pic on top of the chat window and then "Try the new Hangouts". You seem to be hanging from every where now. Happy Hangouts ;-)

Cascading Dropdownlist in MVC3- the ajax way

Image
Creating a dropdownlist the ajax way using jQuery is kind of messy. Ajax Helpers in MVC3 has an elegant alternative using unobtrusive jquery. Lets first create a simple page with ajax form The  UpdateTargetId  property of the AjaxOptions says where the partial view is to be inserted on form submit. The corresponding controller will be Create a partial view that will hold the second dropdownlist like this Now one last important thing do not forget to include the unobtrusive script in your layout page In this example when we have binded the on change of event so that the form it is contained in is posted. The argument name of the method SelectFromDDL1  and the id of dropdownlist should be the same so that it is posted when the form is submitted. Using the same  you can create any number of cascading dropdownlists. 

Unleashing Javascript

Image
One world One language This post is about advent of the javascript. Have you ever imagined what would happen if we were to have only ONE language... WOW!.. It would have been a great place without doubt every single being in this world talking, singing, thinking, etc., in one language. In the world of development if it were one language it would sure have been Javascript, looking at the pace of development in this language seems like that day is not so far. I personally did not favour javascript only for the reason it being ugly because of Duck_typing  (not only me many out there think the same even Robert Cailliau ), well looking at it from the point i stood was wrong until, i found the real inner power it had hidden under its sleeves. Javascript is the only language most of developers have got their hands on apart from their "bread earning language".  So here is a small list of frameworks to start with that will enchant you with its magical powers. Node.J...

KISS Tabular View

Image
KISS- Keep it Simple Stupid This post is about a simple html tabular view using bootstrap  and a kind of raw grid with sort & search option using ASP.MVC framework. I always like to keep a lot of things (not everything) simple, not that i don't like owning NOT so simple things ;)  From development perspective the KISS principle has been spreading lately. Simplicity, the first thing that pops up when i hear that word, it would be Google . Well in fact "simple" is more like "beauty" it's in the eye of the beholder. Here is a sample whose idea on simple contradict with that of mine. May be we can't jump into conclusion that if something is simple to someone it is the same for the other. So on that same idea of Simple i will try to make a simple page with a simple grid with simple lines of code. Here is simple table which has got nothing to do with this post. Let us Create trivial class Employee like this Now lets create a PersonContro...

Facebook App & Google Drive forms

Image
In this post i will just walk through on creating a Google Form on Facebook app platform. " Nothing is discovered until you explore " The above stated might not hold good for all but most of the time it is so true. Recently one of the developer wanted to know how much of a work is involved to create a simple form as a facebook app, then i wondered why haven't i still not explored! this yet ? May be i was too busy (or acting busy) with some other techinical explorations. Logically thinking, assumed there would be simple WYSIWYG  where i can drag and drop a controls, as in Google Drive forms. Turns out that there is nothing like that but in a developer perspective far better. There was just a canvas in which the developer was allowed to play his own games. PART-1 (Creating the Facebook app) : Just had to login into Facebook as Developer Goto apps Click on create new app Enter the captcha (this part always makes me feel not so human, its so h...

Mono for Android is Awesome!!

Image
Its been an Android era. Every six out of ten persons was an android developer. This explosion has sent shock waves on the Desktop computing world, Cell phones possess more computing power than the Desktops (atleast in my case ;-) ). Android is still enchanting developers including .NET developers, In this post like a thousand post out on the internet, will sum up a little bit about  "Mono for Android" . The second thought would cross a .NET mind before starting developing apps is the learning curve involved for studying the IDE & Java. This won't be a barrier anymore as we can start developing apps using C# in our own home ground Visual Studio. Before you start anything on this cool framework read this . The Mono and the Dalvik  are the real heroes who do the work using C without whom it would have to a bit hard not impossible. Le me share some snippets which would be required to start with (For detailed docs refer this  docs) Designing a view is simi...

Google Drive

Image
To be honest Google is good at keeping secrets even with 30,000 employees ;)    But there are nerds who dig through all the way to the bottom. Google has been lately cooking something on "Google Drive". Google drive will be more like Dropbox  or Box  a place in the cloud where all different kinds of files will be stored. Well we have the same as of now on Google Docs  but more presentable. May be we even will get a client app so that it will sync the local files with the cloud. Today i stumbled upon some secret Google's been working on. Well seems like there is some trouble with this link http:\\beta.google.com . this link is acting weird today may be soon we will get to see the drive, and moreover the link is alive for sure. This link shows secret is not really secret anymore ;) 

Chat application using SignalR

Image
I know what is magic about now, its just that it somehow works and we don't know how. So was this chat app a magic for me, until yesterday when i got to know how it works. In this post we will try to create a chat application that works with approximately 10-12 lines of real code. ( i am sure we can write that in one line too ;) ) The chat recipe goes like this Ingredient: SingnalR is solution for ASP.NET which lets communicate with client and the server-side with JS and ASP.NET. MVC3 Procedure: Create an empty MVC application ( Which is not really empty) Create a HomeController by right clicking on the controller folder Install latest Jquery and SignalR using Nuget Now create a model Communicator which inherits the Hub from SignalR just like this on the html side do this There's your tasty treat :)  Server-side: uses the dynamic object to call the function defined on the client side. Client-side: client creates an object of the communi...

You Tube new look

Image
Google has been busy revamping their style sheets for all their products and focus'n more on revenue now Get Youtube's new interface which turns out to be more social ;) On chrome: Go to  http://www.youtube.com Ctrl + Shift + i Then click on console Now paste  document.cookie="VISITOR_INFO1_LIVE=ST1Ti53r4fU"  on the console and hit Enter. Reload (F5)

Google Maps

Image
Browsers are getting Stronger Sharper & Smarter ;) The day is not far away when we have nothing but a  browser installed in the desktop and things will be floating in the cloud ( provided our ISP are reliable which they are not now). Web technology is so open that even the all time money maker  Microsoft  to open up. WebGL is a open source technology that helps build 3D enabled apps with its rich API within the browser. WebGL's early application the  Body Browser  was just a peek to this technology. Google has integrated this tech with the google maps now and they have it pretty well. Google Maps GL once you click on the above link you will see a option on the left bottom something like this then just flow through. Now checkout the satellite view from the right top then just browse places its so smooth, no more frame by frame loading. Now that's sleek ;) even try the new view angles from the round knobs. Well everything was not smooth as i expe...