Posts

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.