20 Dec 2013
In ASP.net MVC Razor view, you might need to show just Date or Time given a DateTime object. Some naive approaches could be (.cshtml):
@String.Format("dd-MMM-yyyy", Model.TestDate)
@Model.TestDate.ToString("dd-MMM-yyyy")
@Html.TextBoxFor(x => x.TestDate, "{0:dd-MMM-yyyy}")
However, a better way could be overloading the ToString()
function for DateTime object as in following helper extension method:.
Read more
08 Nov 2013
In this post we will upload a local project to a remote repository.
invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Develo
per/CommandLineTools/usr/bin/xcrun
- Create a new Java project named “test” under directory “F:\Github” or you can have your existing project here. E.g. You will have bin, src folder in “F:\Github\test” directory.
- In GitShell, change current directory to “test” and initialize a new Git repository here.
cd F:\Github\test
git init
Read more
10 Oct 2013
Recently I came across a very good guideline in the book - PI Exposed about how to explain a programming language to a technical individual. The book suggests to include answers to following five questions while explaining:
- What is it: A programming language / framework / library etc.
- Application: Where it is used? Web / Windows / Mobile / System app.
- What it does: Validation / Update / Implementation etc.
- How: Describe a little bit about implementation details.
- Advantage: Why this approach is better than others.
Please feel free to share your way to express a technology.
Read more
06 Sep 2013
Collections are used quite often in applications and C# have different types of collection. Here are the subtle differences between collection types and choose appropriate type based on your needs.
IEnumerable: Provides Enumerator for accessing collection
Read more
12 Aug 2013
You may need to sort C# list elements in-place sometimes or copy elements of a list to another list according to some sort order (which is in fact another way to sort list elements). Linq provides an easy way to achieve both purposes. Let’s say you have a Project
entity with FirstName
property.
Read more
10 Aug 2013
Recently I came across a situation where I need to pass the name of a property as a string to a constructor. I realized that there is not any in-built framework property or method to achieve so. It makes sense too because the compiler interprets Property Type instead of Property Name. The Property name is for writing human readable (or understandable) code.
If you use this.PropertyName.ToString()
then it will convert the value of PropertyName property to string not the name of the property itself.
Read more
08 Aug 2013
I joined Motorola Solutions as a Summer Intern in May and was given an assignment to build a full-fledge website from scratch which will be used by a whole department internally. It was an independent development assignment while working with stakeholders. I was given freedom in technology decision as stakeholders were majorly interested in end-product not the intrinsics.
With Freedom Comes Responsibility
Read more