Query on .net

this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Tuesday, December 18, 2012

Windows 8 application development requirement


Since launching of Windows RT model, in internet we see buzz of Windows 8 application development. Before developing any application it is very important for creating it’s development environment.

Many times during my professional discussion we came to situation of what’s software requirement for developing any Windows 8 based application?

Below are must things for developing windows 8 application.
·         Windows 8 OS, you can’t create application on any other OS (i.e windows 7).
·         Visual Studio 2012, you can develop your application in Visual studio’s latest version. There are few choice you can have , which version you are using of IDE (i.e express, professional, enterprise, ultimate etc)
·         Developer account, for developing any windows application it asks for your developer account. You need to specify your live id (i.e hotmail, live, msn, outlook) credential and system will do rest of things for you.
·         For developing Windows mobile 8, you will need to install Windows phone 8 SDK explicitly. It does not come along with your Visual studio installation.

Hope, this check list will help you building up your development environment.
Happy Windows 8 app development!!

Best of luck!



Monday, October 1, 2012

Add Event/Appointment in Google Calendar with Google account credential.


Google calendar is one of the best free tool for tracking your day to day appointment and reminder for your rest of schedule. There are facilities for reminder with email and sms that will enable you for preparing your next meeting/appointment.
We can leverage this tool in our any of application, we can sync our event or appointment with google calendar so one may miss reminder from application but alternatively get from google calendar.
Doesn’t it seem cool? Even implementation is simpler than it seem.
Firstly, you will need to add reference of following files.

using Google.GData.Client;
using Google.GData.Extensions;
using Google.GData.Calendar;

You can find those files here.

Below is code block for adding event in google calendar.

public CalendarService GetService(string applicationName, string userName, string password)
        {
            CalendarService service = new CalendarService(applicationName);
            service.setUserCredentials(userName, password);
            return service;
        }

public static void AddEvent(CalendarService service, string title, string contents, string location, DateTime startTime, DateTime endTime)
        {
            Google.GData.Calendar.EventEntry entry = new Google.GData.Calendar.EventEntry();

            // Set the title
            entry.Title.Text = title;

            //Set event details.
            entry.Content.Content = contents;

            // Set a location for the event.
            Where eventLocation = new Where();
            eventLocation.ValueString = location;
            entry.Locations.Add(eventLocation);

            //Set starting time and end time for the event.
            When eventTime = new When(startTime, endTime);
            entry.Times.Add(eventTime);

            Uri postUri = new Uri("https://www.google.com/calendar/feeds/aslam.h.net@gmail.com/private/full");

            // Send the request and receive the response:
            AtomEntry insertedEntry = service.Insert(postUri, entry);
        }

Here, GetService method will take three parameters named application name, username and password.
Application name can be any name, you wish. Username is your google account name where you have configured your calendar and wish to sync with that calendar. Password is your google account password.
Method will return back calendar service object. We can use this service object anywhere for using any service associated with calendar.

Method AddEvent: this method will add event in any our calendar. Most of statements are formatted with comments.
There is one critical statement you need to take care.

Uri postUri = new Uri("https://www.google.com/calendar/feeds/shailesh@gmail.com/private/full");


Please note that one dynamic part, shailesh@gmail.com. It’s my calendar’s id. You can easily find your sync calendar id with following steps.

1)      Logon to your gmail account and click on calendar link at top bar, it will open up your calendar in new tab.
2)      On the right side, there will be section named “My Calendars”. It lists out calendars, you created. You can create more than one calendar in google calendar tool.
3)      Go to any of calendar, click on the arrow. It will show one menu. Click on “Calendar settings”.
4)      There will be one row with “Calendar Address”, most probably before last row. Just look around this row, there will be information like this.
(Calendar ID: shailesh @gmail.com)
This is the address for your calendar. No one can use this link unless you have made your calendar public

That’s it.

I hope this will enable to sync your important tasks, appointment and meeting with google calendar.

Happy scheduling appointment

Friday, September 7, 2012

Html.RenderPartial() Sytanx Error : No overload for method 'Write' takes 0 arguments

Hey Everyone,

I was trying Html.RenderPartial() in Asp.net MVC and what I got “No overload for method 'Write' takes 0 arguments“

From my code it seems very clear that I have written correct syntax but actually there is a little problem with it.

My earlier code was is as below

@foreach (var p in Model.Members)

{

@{ Html.RenderPartial("MemberSummary",m); }

}

But it was giving me Error : “No overload for method 'Write' takes 0 arguments”. As we all know RenderPartial() directly writes in the output stream so it was better for using it than Partial().

After close look inside of code, I found that it should be C# statement and I was mixing inside of code block and I corrected out my code as below. It worked.

@foreach (var p in Model.Members)

{

Html.RenderPartial("MemberSummary", m);

}

Have a happy debugging !!

Monday, July 30, 2012

Windows Mobile 7.5 on my view.

Before few days ago I got chance to play with Windows mobile 7.5. I heard a lot about it but unfortunately I didn’t get chance to work around. At first glance I was really impressed with it’s graphical user interface and its screen layout. Now nobody would criticize Microsoft mobile os for looking around this.
I must admit os is not just fancy at look but Microsoft has invested big in making its very responsive. It was much faster than android phone I have used. I was astonished with its simple user interface and for operating it, one would not be necessary tech-savy. It is targeted for any of the no-voice user who is wishing furnished, easy to use smart phone.

End User Experience
From the end user perspective, it’s very nice MS phone so far. Who ever used earlier version of windows would be surprised with its easy layout and graphics. I am sure end user would love operating system and its user experience. They will find it powerful, business smart phone. It includes all necessary app for business needs and also has some fun application inbuilt. One would not feel it less useful for both business and fun.
Early Microsoft phone was mostly used by business user and even its operating way was also somewhat tricky. But in case of 7.5, all limitations are over come.

Developer Experience
Earlier version development was very similar to that of windows forms development in .net framework. But in case of 7.5, it has been changed from very basic. Now, developer has facility for developing high end user graphics application. Development and design is on XAML. If one had worked with earlier version, they would need upgrade themselves for this new development.

Market Perspective
Now a day’s most of site, online buying and banking is booming and they provide their facility in mobile native platform. One is already aware about android and ios app market. In both of platform you would find lots of free and paid version application. Some of them are targeting business need and some of them are for entertainment. Definitely windows platform has very less application compared to other platforms due to recent changes in development. One would invest for developing windows apps by considering future growth. There will be definitely users who are looking for great application as they have in other platform.
Future of windows mobile 7.5

Microsoft is going to launch new os Windows 8. Around the net it has created buzz and now almost all will be upgrade to new os Windows 8. There are so many discussions around it. Microsoft is going on something different way than earlier now they want to line up their os with all devices. Certainly it will take some time for moving in Windows 8, at least for 2 year it will not be. One could say that they can use windows mobile 7.5 and then they will be continuing using it. Critical part of adopting windows mobile 7.5 is that it will not be upgraded to windows 8. Alternatively at some way Microsoft has indicated, they may come up with windows mobile 7.8 and it will be very near to windows 8.

Right now, windows mobile is taking market share from other OS and only constraint people are feeling to adopt is to have lack of application available compared to other platform. That will be huge advantage for entrepreneur for creating apps on windows mobile platform. Microsoft would also take steps for making its app store rich.

Let’s hope at least tech people would use Windows mobile as they use other smart phone.

Monday, July 2, 2012

Green field / Brown field development

In software development we are usually have two types of work to be done in any application. Both some legacy system is already running and we should require build on new system on it or build new system from very scratch.

When we are going to build new system without considering any of the old system and it does not connect with any other system such type of development referred as Green Field development

In contrast some system does not require depending on any other system, we can go ahead with development from scratch, we don’t rely on any other system such type of development referred as Brown Field Development.

Both type of development have their advantage and disadvantage on development.

Green Field:

Advantage

We have more control at the time of development,

We don’t rely on sub system.

We are free to stretch system as we need

Disadvantage

No reference is available, new system should build carefully meet all requirement of business.

Brown Field:

Advantage

Have reference of already running system

Can take advantage of existing data for future expansion

Can leverage system incorporate with new System.

Disadvantage

Hard to implement programming semantics at some level due to bound with old system.

We do many application but we might not know what type of development we do? Hope this will help us identifying our development.

Wednesday, June 6, 2012

Print button is not working in Crystal report viewer


Crystal report is very crucial part of LOB application reporting. Most of enterprise uses Crystal Report for the reporting purpose. In case of windows platform, it has good integration with .net framework and .net provides crystal report viewer for rendering Crystal report.

From the early, VS 2005 has inbuilt integration with Crystal report version 10. We don’t need to install other component for accessing Crystal Report Viewer. It was straight forward process, for running that application on client machine we all need is installing Crystal Report runtime.

It was going good and we didn’t come across any issues till date. Some older applications were built on VS 2005 and it was running in most of windows operating system with runtime and necessary component installed. Problem arose with 64bit version, when we try to install application built on VS 2005 and using crystal report on Win 7 64bit or other later version of 64bit. In that case, we don’t able to take advantage of printing facility of Crystal report viewer.

After investigating, we found that there was problem with crystal report version10. If we upgrade our crystal report version to later on, it would work and it did.

We choose path of upgrading our solution to VS 2010, and what we found that we didn’t see any Crystal Report viewer in toolbox. It requires installed explicitly, Microsoft stops to ship that along with VS 2010.

I hope below link is worth to keep with us while upgrading to vs2010 for Crystal Report .


Hope this post will be helpful!

Tuesday, June 5, 2012

Change default time out of strongly typed dataset table adapter command.


By default when every any command executed by table adapter, its time out is 30 second. Due to heavy load of data and traffic over the network, we require increasing this default time out.
It’s very straight forward when we use code for it. In case of strongly data set it’s a bit tricky.
Firstly, you will require extending your dataset existing name space and its table adapter. In data table adapter class, you can add one method for changing this time out.
//Extend existing data table adapter class created by strongly typed dataset.
Namespace MyTableAdapters
Partial Public Class MyTableAdapter

Public Sub SetCustomCommandTimeout()
Utility.SetCommandTimeout(CommandCollection)
End Sub

End Class
End Namespace
//Set Custom Timeout to underlying command.
Public Shared Sub SetCommandTimeout(ByVal commands As System.Data.SqlClient.SqlCommand(), Optional ByVal timeout As Integer = -1)

If (commands IsNot Nothing) Then

If (timeout < 0) Then timeout = GetConfigTimeout()

For Each cmd As System.Data.SqlClient.SqlCommand In commands
cmd.CommandTimeout = timeout
Next

End If

End Sub

//Get Custom time out from web.config.

Private Shared Function GetConfigTimeout() As Integer

Dim timeOut As Integer
If Not System.Configuration.ConfigurationManager.AppSettings("CommandExecutionTimeOut") Is Nothing Then
timeOut = CType(System.Configuration.ConfigurationManager.AppSettings("CommandExecutionTimeOut"), Integer)
Else
timeOut = 0
End If

Return timeOut

End Function

Hope this would be very helpful !!