How to use Ninject in ASP.NET MVC 5 and WEB API 2

by sunil ravulapalli /30. April 2014 05:17 /asp.net /Comments (0)

Dependency injection frameworks are becoming a common place in all modern code bases. One of the most popular dependency injection framework in the .NET world is Ninject. This post will show a very simple example of how you can get started with Ninject. Check it out here: http://aspnetguru.com/how-to-use-ninject-in-asp-net-mvc-5-and-web-api-2/

My first Windows 8.1 game!

by sunil ravulapalli /27. April 2014 04:30 /windows8 /Comments (0)

 

Defend the planet from a continues barrage of asteroids. You control a ship which moves around a planet and has an unlimited supply of laser cannons to destroy the incoming asteroids. Don't let the asteroid come too close to the planet or your ship. How many levels can you go without getting destroyed? 

Nokia Lumia 1520 Initial review

by sunil ravulapalli /5. April 2014 06:26 /other /Comments (0)

 

Nokia lumia is simply six inches of goodness. The HD screen is amazing. I am not sure if it will dull down with age, but out of the box it is just begs you keep looking at it. Windows Phone OS is now quiet a mature OS, it usually performs well on even low end devices, but on this quad core 2.2 Ghz machine it is just treat. I am quite happy with the  OS and looking forward to the 8.1 upgrade. I did have a little bit of an issue getting the google contacts on to my phone, I am not sure if this really is a wide spread issue or it was just me.

Although Nokia is supposed to be a hardcore phone company which knows everything about building phones. I had a couple of issues with my previous phone, the Lumia 920. When I did a phone reset it just took forever along with multiple tries to reset the phone to its initial state. The second issue was at some point the camera on phone became permanently blurry. May be it was my fault, I may have dropped it once or twice, but it was still very annoying and couldn't find fix for it. I just held out and waited for my contract to expire to get the new phone.

Anyways, I am enjoying my new phone and Nokia did an amazing job with it.

Although, they are major apps, I would love to see vonage, fitbit apps on the windows phone and my life will be complete.

Links for the Windows Phone Fanboy

by sunil ravulapalli /1. April 2014 05:39 /other /Comments (0)

 

There is no hiding that I am a Windows Phone Fanboy. But I didn't know about these websites until recently.

http://www.wpcentral.com/

http://wmpoweruser.com/

http://www.reddit.com/r/windowsphone

These are my new favorite websites. I visit them as often as The Verge, Engadget and the Reddit front page.

Podcast recommendations for developers

by sunil ravulapalli /1. April 2014 05:16 /other /Comments (0)

 

The following are all the podcasts I currently listen to. I usually listen to them on my short commute and while exercising. I don't listen to every episode. I tend to skip some episodes based on the topic.

Developer/IT podcasts

http://dotnetrocks.com/

This is what started the development podcasting trend. Still going strong. Features esteemed guests.

http://hanselminutes.com/

Features famous and not so famous guests, but a lot of variety. Each episode is just about 30 minutes and to the point.

http://jesseliberty.com/podcast/

Features various development topics in the Microsoft space.

http://indiedevpodcast.wordpress.com/

Interviews with independent game developers.

http://windowsdevelopershow.com/

Very entertaining show for windows and windows phone developers.

http://www.runasradio.com/

Features Microsoft IT topics.

Other

http://freakonomics.com/radio/

Entertaining and thought provoking information about various issues surrouding our daily lives.

http://www.startalkradio.net/

If your interested in space. Very entertaining.

 

Add a Music On/Off button to "Easy Menu" asset in Unity 3d store

by sunil ravulapalli /15. March 2014 07:06 /unity /Comments (0)

The "Easy Menu" I am referring to is https://www.assetstore.unity3d.com/#/content/4230.

In MenuElement.js, In the ElementTypes enum just below image add "button_MusicSwitcher" as a new option.

In the function OnGUI add this code

case ElementTypes.button_MusicSwitcher:
 if (GUI.Button (Rect (currentPosition.x, currentPosition.y, size.x, size.y), GUIContent (caption, icon)))
	if (!locked) {
		Camera.main.GetComponent(AudioListener).enabled =  !Camera.main.GetComponent(AudioListener).enabled;
		var musicOnOff = PlayerPrefs.GetString("MUSIC");
		if (musicOnOff == "OFF")
			PlayerPrefs.SetString("MUSIC", "ON");
		else
			PlayerPrefs.SetString("MUSIC", "OFF");
	}

 break;

Usually, if you have background music in a game scene you will have an "Audio source" component attached to game object like the "Main Camera" and you would have the option "Play On Awake" checked.

Uncheck "Play On Awake" option and modify code so that you start the music using code. It will look something like this:

[RequireComponent(typeof(AudioSource))]
public class MainCamera : MonoBehaviour {

	// Use this for initialization
	void Start () 
	{
		string musicOnOff = PlayerPrefs.GetString("MUSIC");
		audio.loop = true;        
		if (musicOnOff == "OFF")
			audio.Pause();
		else
			audio.Play();

		Debug.Log("Hello:" + PlayerPrefs.GetString("MUSIC"), gameObject);		
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

Replace List<T>.Where() with your own "Where" to understand Func<T>

by sunil ravulapalli /1. March 2014 06:25 /c# /Comments (0)
class Program
{
	static void Main(string[] args)
	{
		List<string> names = new List<string> {
											"mickey",
											"donald",
											"goofy",												
									};

		var outnames = names.Finder(x => x == "donald");

		foreach (var name in outnames) 
		{
			Console.WriteLine(name);
		}
		Console.ReadLine();            
	}        
}

public static class MyExtentions
{
	public static IEnumerable<string> Finder(this IEnumerable<string> strings, Func<string, bool> predicate)
	{
		foreach (var str in strings)
		{
			if (predicate(str) == true)
				yield return str;
		}
	}
}

Enumerable.Range Example

by sunil ravulapalli /1. March 2014 05:18 /c# /Comments (0)

 

var numbers = Enumerable.Range(1, 10);

foreach(var num in numbers)

{

	Console.WriteLine(num);

}

 

OUTPUT:

1
2
3
4
5
6
7
8
9
10

 

Web Api 2 Authentication Tutorial Video

by sunil ravulapalli /21. January 2014 05:24 /asp.net-web-api /Comments (0)


How I made progress on my goals in 2013!

by sunil ravulapalli /31. December 2013 07:07 /other /Comments (0)

I always had goals for every new year, but some how after an enthusiastic beginning I always loose track of them. This pattern started reappearing last year too. So instead of setting goals for each year, I decided to set goals for each month and track its progress by noting down what I did to achieve those goals on each day. Some of the monthly goals were

1. Read a half/full book
2. Write 4 blog posts
3. Contribute to 4 questions on Stackoverflow
4. Workout 12 days

these broke down to 25% of a book, one blog post a week, one stackoverflow a week, 3 days gym a week.

I began to note down in an spreadsheet my progress each day. If I read 5% of the book on the 1st, I put 5% in my sheet for the 1st on the book row, if I wrote a blog post on the 3rd, I put in 1 for the blogs row in the spreeasheet. This gave me the satisfaction of looking back on what I achieved and planning in time for what I have left. Below is an example of my tracking spreadsheet

November   Target 1 2 3 4 5 6 7 8 9 10
Agile Principles, Patterns 38.00% 100 30 0 0 0 33 35 38 0 0 0
Attend Meetup/conf : 2 0.00% 2 0 0 0 0 0 0 0 0 0 0
Educational Videos : 300 mins 0.00% 300 0 0 0 0 0 0 0 0 0 0
Project: 24 Days 17.50% 1200 0 0 0 45 45 45 75 0 0 0
Blog Posts : 8 37.50% 8 0 0 2 0 0 0 0 1 0 0
SO Posts : 8 12.50% 8 0 0 0 0 0 0 1 0 0 0
Gym : 16 days 25.00% 16 0 0 0 1 1 1 1 0 0 0
Eat Fruit : 20 days 20.00% 20 0 0 0 1 1 1 1 0 0 0
Tennis : 8 days 12.50% 8 0 0 0 0 0 0 0 0 1 0

This technique is a proving to be a great success for me. I have 52 blog posts this year, reached a reputation of 470 on Stackoverflow, read almost 6 books in 8 months. I still did not succeed in the my Gym goal, but spreadsheet is a reminder of how little I am working out! I will continue to use method of tracking in the new year with my new goals. Give it a try!