Tuesday, June 28, 2011

Matrix is back.... but this time instead of action, it's for fun..!!!!

Welcome back, this article isn't a review on hollywood blockbuster si-fi "The Matrix", but this is all about fun with the basic math element Matrices. During your grade school you might have played around with matrices, by applying basic operations, using different formulae, proving well defined theorems etc..

But this time we will keep all those things aside and take it to a different level wherein we explore different possible way to read a matrix and try out some interesting tweaks. Let's stimulate all those lakhs of unused neurons in our brains for the first time ( and this is a true fact) .

Here is the collection of few programming problems on matrices which I found on web, books and from friends. try to solve these using minimum number of loops, use recursion and achieve the best, worst case running time.
The problems are arranged on the basis of difficulty, moving from easier ones to difficult.

1) Given a M*N matrix of integers, convert all the integers in a row or column to zero, which already has a "Zero" in the input matrix.



2) Given a M*N matrix of integers,  write a program to read the matrix in a circular way, starting from inside-out.


3) Given a M*N matrix of integers, write a program to read the matrix in a zig-zag way.


 Note : This way of reading the matrix is used in Run Length Coding of JPEG image compression technique.

4) Given a M*N matrix of integers having both +ve and -ve numbers, write a program to find a sub-matrix with the maximum sum


5) Given a matrix from Sudoku puzzle, write a program to check whether the given matrix is a valid Sudoku puzzle or not by without solving the puzzle. Here we assume that there could be invalid input matrices.

That's all for now. Sharpen your pencil, take a sheet of paper ... Happy coding :-)



Thursday, June 23, 2011

Your first Windows Phone 7 App is just a few keystrokes away.

Hi, just by looking at the title of the article don't think that this isn't for you, in fact this article is intended for all those who is interested in knowing how a mobile app is being developed and deployed. And to understand this you need not be a hard core developer or not even required to be working in telecom domain, but just an urge to know and learn is enough.

Before actually getting into our first app development, let me brief you about the current state of the art of mobile phone application development. Mobile apps are being developed for multiple platforms and the current well known platforms which are buzzing with high app development activities are,
Apple iOS
Android
Symbian
Windows mobile.

All of these platforms have their own well established developer communities well known as "ecosystems", developers from these ecosystems constantly contribute to the community by developing apps which fall into wide range of categories, like Business, Entertainment, Utility, Multimedia, etc..
The well known app stores of today are OVI store by Nokia, iStore by Apple, Market Places by Microsoft and Android Market by Google.

In this article, I'm going to show you how an app can be developed for windows phone 7. I have chosen windows phone not because I'm biased, but simply because of the fact that it's very easy to set up the development environment, straight forward to understand, and very less development efforts.

So, Let's get started.
By the time this article was written Microsoft had just released beta version of Window Phone 7.1 developer tools. But since this is an introductory article to Windows phone app development I'm sticking to Windows Phone 7.0 development environment.

The minimum requirement to have windows phone 7.0 development environment is that your machine should be running at least windows 7 OS, next
1) Download SDK from here
2) Apply patch
By now your dev environment for windows phone 7.0 is up and running, The windows phone applications are Silverlight applications written in "C#" language and will be running on  silverlight framework

As our first application I'll be showing how to create a log in page for Facebook application.
After you've installed the Windows Phone Developer Tools, the easiest way to create your first application is to use Visual Studio.
  1. On the Start menu, launch Microsoft Visual Studio 2010 Express for Windows Phone .
  2. On the File menu, click New Project .
  3. From the project templates select Silverlight for Windows Phone and choose Windows Phone Application .
  4. Name the project and click OK.














5.  A new Silverlight app tfor Windows Phone project is created and opened in the designer.
6.  Edit the user interface as required by adding controls from the tool box and editing "XAML"


7. Write event handlers for " Log in " and " Exit " buttons , In this example the user name and password is hard coded as "vdr" and "admin" for successful log in case.

<Code>
namespace FacebookLoginPage
{ public partial class MainPage : PhoneApplicationPage
  {
public MainPage()   {
     InitializeComponent();
   }
   private void BTN_Login_Click(object sender, RoutedEventArgs e)
   {
    if (TB_UserName.Text.Equals("vdr") && TB_Password.Text.Equals("admin"))
    {
     MessageBox.Show("Login Successful");
    }
    else
    {
     MessageBox.Show("Enter Valid Credentials");
    }
   }
   private void BTN_Exit_Click(object sender, RoutedEventArgs e)
   {
    NavigationService.GoBack();
   }}}
 </Code>

8. That's all your app is ready to launch. Compile the code and run it  in windows phone 7 emulator.

Here are the screen shots of  application functionality.
1. Once the emulator comes up your application can be seen in the list of applications displayed. Here we can see  the app "FacebookLoginPage" which we have just created.



2. Launch the application, and you are directed to Home screen of the application.

































3. Log in with valid credentials.

































4. Successful log in.

































5. Log in failed.

































With this we have successfully created our first windows phone 7 app and also have reached the end of this article, but before putting a full stop I would like to highlight on few things.
Mobile phone application development is not a rocket science it's more of a fun filled and challenging activity. Since these days, as the mobile phones are becoming integral part of our lives the phone user base is also rapidly growing and this has exponentially triggered the need for various kinds of mobile apps for people working in diverse domains.
And it's time to put in all your creative ideas and create great applications to serve the human community in a much better way.

Good bye for now.

Monday, June 20, 2011

Better late than never.

Having my own blog was one of the long standing entry on my wish list which was hardly prioritized, and the reason for this are hundreds. May be the feeling of lack of experience, insight into different technical aspects, time, and not the least laziness..
But I feel it should get started at some point, you can't always wait for that perfect time to come to you. Being a regular follower of many technical blogs it also inspires me to share with others my ideas,views, and also a bit of knowledge gained over last few years of my professional carrier :-)

I strongly believe in the fact that sharing ones intellectual wisdom is very important aspect of human life, in fact today the human race has witnessed lightning revolution in the field of information and technology because each one here wanted to learn, share and be innovative.
All you IT folks, Stop for a movement and think, can you work for the next 24 Hrs without using "GOOGLE" and deliver quality work, it's really hard right or I can say not possible. This is because we are very much dependent on the knowledge of someone who has a very strong hold on the domain and ready to share his expertise with you. During the last three years of my career I can't remember a day on which I haven't used Web/Google, which clearly indicates that some one at some corner of the world is in need of your knowledge, so go ahead and share it.

And, finally let me share with you some info about me,
Pervasive computing, Human computer interaction, Multimedia are the areas of my interest.
I love application development and system programming and had mainly used programming languages C,C++,Win32 APIs, C#. And since I'm currently working in telecom domain I use symbian C++ and Qt C++.
As hobby projects I develop apps for desktop and for mobiles,  spare free time with friends, watch movies, cricket, music etc..

Your comments, suggestions are always greeted on the articles which I'll be posting on this blog.

ShareThis