Resetting an Integer Identity column for a table in SQL Server

Jul 28 2015

More often while trying out inserting of data to tables with integer as Identity column, we need to delete and recreate data.

Use this script

DELETE FROM [TestTable]
DBCC CHECKIDENT (‘[TestTable]‘, RESEED, 0)
GO

Hope that helps :)

No responses yet

Windows Phone emulators stuck at ‘OS is loading’ or ‘Loading Operating System’ or ‘Windows Phone OS is starting…’

Jul 14 2015

Many a times, Windows Phone Emulators fail to launch and usually are stuck at ‘OS is loading’ or ‘Loading Operating System’ or ‘Windows Phone OS is starting…’. Simple fix for this is to go to ‘Control Panel’ -> ‘System and Security’ -> ‘Windows Firewall’ -> ‘Allow app or feature through Windows Firewall’, and add app found at C:\Program Files (x86)\Microsoft XDE\<version>\XDE.exe to allow list.

Simple isn’t it?

 

No responses yet

Generating random alpha numeric string

Jul 06 2015

After lot of search, found this one line code to generate alpha numeric strings

Membership.GeneratePassword

Hope that helps!

No responses yet

Listing table names from your SQL database

Jul 06 2015

Simple sql query to get all table names from SQL database is …

SELECT * FROM information_schema.tables

Hope that helps

No responses yet

Don’t let your server response headers reveal too much about your server!

Jul 05 2015

On every request on API or a website, your server sends some information that might hurt your servers, if vulnerabilities are discovered on specific version of IIS, MVC version, .Net framework. Below are sample response headers that reveal too much about your server.

Server: Microsoft-IIS/8.0
X-AspNetMvc-Version: 4.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

Lets figure out a way to hide them

Server: Microsoft-IIS/8.0

Add these lines to global.asax

protected void Application_BeginRequest(object sender, EventArgs e)
{
var application = sender as HttpApplication;
if (application != null && application.Context != null)
{
application.Context.Response.Headers.Remove(“Server”);
}
}

X-AspNetMvc-Version: 4.0

If it is MVC / MVC WebAPI project reveals  You can hide it by adding these lines in Global.asax 

protected void Application_Start()
{
MvcHandler.DisableMvcResponseHeader = true;
}

X-AspNet-Version: 4.0.30319

Add these lines to Web.Config

<system.web>
<httpRuntime … enableVersionHeader=”false” /> …

 X-Powered-By: ASP.NET

Add these lines to Web.Config

<system.webServer>
<httpProtocol>
<customHeaders>
<remove name=”X-Powered-By” />
</customHeaders>
</httpProtocol>

Hope that helps :)

No responses yet

[Issue => Fix] Stuck at Authenticating with the iTunes Store

Jul 03 2015

Many a times, while pushing the iOS app to Apple App Store, when we use Application loader, we get stuck at message ‘Authenticating with the iTunes Store.

Quickest fix for this is to copy ‘Application Loader’ app from ‘Applications’ to desktop, and simultaneously running both ‘Application Loader’ apps, one from ‘Applications’ folder and one from desktop to publish to app store. This works like charm every time.

Hope that helps!

No responses yet

MetadataException: Unable to load the specified metadata resource

Jun 23 2015

Sometimes if we change the database connectionstring or copied database settings, when we compile we get this error

MetadataException: Unable to load the specified metadata resource

Simplest possible fix is in web.config, in connectionstring property you will see something like this..

connectionString=”metadata=res:///<modelname>.csdl|res:///<modelname>.ssdl|res://*/<modelname>.msl;

Simply change it to

connectionString=”metadata=res://*/;

Hope that helps!

No responses yet

Azure Web deployment task failed ERROR_FILE_IN_USE

Jun 23 2015

Sometimes we are greeted with the following error when we are publishing websites/API service projects to Azure.

Web deployment task failed. (Web Deploy cannot modify the file ‘<project>’ on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE.)

Quick fix is find a pubxml file under properties folder. Under   <PropertyGroup> add the following line.

<EnableMSDeployAppOffline>true</EnableMSDeployAppOffline>

Hope that helps!

No responses yet

Wearables, Wearables, Wearables…

Apr 01 2015

Hot buzzword of the day is Wearables. Lot of us when we hear this word, we think of Apple Watch or Android Wear or Microsoft Band or Google Glass or Fitbit for that matter. But history of wearables dates back to 1961!

In 1961, a MIT Professor, Edward Thorp, whom we call Father of Wearables, created and successfully used a first wearable computer to cheat at Roulette which gave them 44% edge over the game :) Since then, we had calculator watches (how many of you remember Casio watches ;) ), digital hearing aids, Nike+, Go Pros, Fitbits and similar clones.

Then came Google Glass, with an open SDK that allowed Android developers to write code on. Xamarin also had a component for that. Fitbit also has an API that one can consume in apps. Then came slew of Android Wear Watches, coolest one being Moto 360. Some exciting news about new watches are making rounds.. watch out! (pun intended)

Microsoft released Microsoft Band, a cool band that looks more like a Fitbit but a way cooler, and as a surprise they made it work with all leading phone OS platforms, and they released SDK that will work with iOS, Android and Windows Phone too! And very soon Cortona which used to work only in Windows Phone, will work on iOS and Android, which will open up more avenues for apps to integrate voice in their apps.

Then came a much awaited big announcement from Apple, Apple Watch! WatchKit was in preview from quite some time, recently went live, and though Apple Watch is yet to be released, there are slew of applications ready for it! Xamarin has a full fledged support for Watch Kit!

Now coming to interesting part.. how to code for Microsoft Band, Google Android Wear and Apple Watch sharing almost 60-90% of code.. yes that is possible with Xamarin using C#!!!

Come and learn more about Xamarin and how to code for Wearables in our upcoming XHackers sessionWearables Day! See you all there!

No responses yet

iBeacon potential implementations

Mar 28 2015

Imagine you walk in to Starbucks and your app pings you saying, hey try ‘Try your regular Caramel Latte with Chicken wrap today and get 20% off bill’

Imagine you walk in to airport terminal to board and your phone automatically bring boarding pass on to your phone’s screen.

Imagine you have ‘Bring milk’ in your to do list and when you are in Walmart, and beacon in Walmart suggests you an offer ‘$2.19 for 2% fat, 2 gallons as special deal just to you’

Now imagine a world where every beacon that helps you build such scenarios as part of a global registry and each beacon has a unique metadata associated with it in that global registry, to store both public (imagine information about tourist places) and private (Starbucks, Airports, Stores, Offices, etc) and which app to open or which website to open. And that global registry has an API to give access to that metadata and showcase unique thing about that specific place, thing or event or whatever is associated with that beacon. 

Now imagine a generic app to trigger specific apps ( Starbucks app, Office login apps, Airlines app, Store apps etc,) or webpages (wikipedia links) based on stored credentials on the app and the beacon information from global registry.

These are two sided implementations.. on server, given a loyalty card info on phone, combined with beacon metadata, phone can ping the server for a specific deal that is customized for that specific user. On client, it is a simple app that talks to global registry and goes to corresponding service implementers to fetch relevant data for that place, thing or event!

Ok.. Can it be done? Why not, using iBeacons from providers like Estimote, MobStac, BKON and others, cross platform mobile apps that share almost 90% codebase and all written in C# using Xamarin and Azure IoT Services combined with the latest Azure App Service, world is your playground.

No responses yet

Older posts »