Friday, January 13, 2017

Meditation is the Ultimate Tool for Success



Meditation Improves our Concentration & Productivity: To achieve your personal goals, you will have to have the concentrative powers to stay focused on both short-term objectives and your long-term vision. Fortunately, one of the two main components of meditation is concentration, and by regularly practicing, you can improve your abilities to focus on finding the solutions needed to achieve your desired outcomes. Furthermore, with an improved ability to focus your attention on the most important tasks, your levels of productivity will certainly be enhanced. Swami Vivekananada, the celebrated Hindu monk who brought the world’s oldest religion to America in 1893, understood this meditation benefit and told us, “The flow of this continuous control of the mind becomes steady when practiced day after day, and the mind obtains the faculty of constant concentration.”


Meditation Improves our Mindful Awareness & Flexibility: The second component of meditation is mindfulness, or present-moment awareness, and it can similarly help us achieve our goals in important ways. By taking the time to practice meditation, you will certainly improve your mindful awareness, and once this happens, you will have an improved ability to discover and change the faulty cognitions and behaviors that are acting as roadblocks on the path towards success. Without improving your mindfulness capabilities, many of your debilitating thoughts and behaviors may continue to hinder your progress because they remain hidden outside of your basic conscious awareness. Additionally, by gathering information without associating your deeper self with your thoughts and emotions, you can become more flexible in your personal development approach and more easily make changes to problematic beliefs, behaviors, and ways of thinking. A famous Zen Buddhist proverb tells us that by meditating regularly, we can, “Be the master of mind rather than mastered by mind.”


Meditation Improves our Creativity: Oftentimes when chasing success, individuals will become overly rigid in their approach which counterproductively stops them from achieving their goals in the most effective and efficient ways possible. Not only does the practice of meditation increase an individual’s ability to locate problems in their achievement strategies, as we just discussed, but it can also put them in touch with creative resources that were previously untapped. Studies have shown how individuals who regularly practice enjoy improved problem-solving capabilities and are able to conceptualize new and novel ideas. Moreover, meditation naturally reduces our habitual ways of relying on ingrained mental patterns and opens our mind to new ways of being. Eckhart Tolle, one of the most influential spiritual writers of modern times, tells us that, “True intelligence operates silently. Stillness is where creativity and solutions to problems are found.”


Meditation helps us Develop and Cultivate Relationships: Rarely, if ever, can an individual, aiming for achievement, succeed without the help of others. Along the road towards success, it is inevitable that each of us will have to develop and cultivate relationships by means of open and honest communication. Fortunately, meditation allows us to improve our abilities to communicate with others and helps us find a natural connection to all. Since meditation is widely known to increase present moment awareness, individuals who regularly practice are better equipped to wholly communicate with others in the present. Furthermore, research has shown how meditation improves emotional resilience, helps to develop important communication skills such as empathy, and increases feelings of joy, peace, and happiness which are all vital components of developing and cultivating relationships. Renowned spiritual teacher and author Deepak Chopra tells us, “Meditation takes you beyond the mind’s noisy chatter into the pure awareness that is the source of all your happiness, inspiration, and love.”


Meditation Decreases the Amount of Sleep we Need: The unfortunate reality of chasing one’s dreams is that they often neglect sleep by either working towards their goals or worrying about the progress that they have made. While sleeping less then recommend isn’t prescribed, meditation has been shown to improve individuals’ sleep and even lessen their need for it. By using advanced brain imaging technologies, scientists have been able to show how brain waves of individuals meditating display similar neural activity of individuals who are in deep sleep. Additionally, it is widely believed that meditation naturally increases alertness and energy. Osho, the great Hindu guru and leader of the Rajneesh movement, tells us, “Meditation means: remain as relaxed as you are in deep sleep and yet alert.”


Meditation helps us Decide upon Truly Meaningful Goals: Probably the most important benefit that comes from using meditation as a tool for success, is that it helps us distinguish our most meaningful objectives from our surface level desires. By exploring spiritual wisdom, found within the religions of Buddhism and Hinduism, as a supplement to a meditation practice, one can break free from goals that were created through social conditioning and advertisement. By doing so, they will instead be able to aim for the things that will bring them true happiness. Assuredly, when one fully understands important spiritual concepts, such as the ego and impermanence, they will naturally begin moving down a path that brings them what it is they truly want: fulfillment. None other than the Buddha himself told us, “If you are quiet enough, you will hear the flow of the universe. You will feel its rhythm. Go with this flow. Happiness lies ahead. Meditation is the key.”

Sunday, January 8, 2017

Developing Android app in C# with Visual Studio with Xamarin

Xamarin let’s you create apps in C# for iOS, Android & Mac.


Project Structure:

image
This is how a project structure of an Android app will look. When you create a new Android application in Visual Studio, Xamarin set’s it up for you by default.
Few things to make a note of – only a few for now.

AndroidManifest.xml

Every Android project must contain this file. The manifest lets you define the metadata of your application like Application Name, Package Name, Required Permissions, Activities etc. This is similar to a App.config or Web.Config files but differs in certain ways. In Xamarin you can easily edit manifest information by going to the properties of the project. Please note that there are other values that are auto generated by Xamarin from the attributes that you define in classes. You can learn more about it from the documentation.

Resources

It’s a good practice to keep non-code resources like images, icons, and constants external to your code. Android expects you to store them in a specific sub folders within the resources folder. Notice 6 different Drawable folders which are kept separated based on the DPI displays. These folder will include respective sized bitmaps & PNG images. Perhaps the most powerful Resource to be noted is the Layouts.

Layouts

Layout is the User Interface – Yes that’s right! Whatever user sees is what is designed inside layout files. These are xml based and have the extension .axml . It decouples the presentation layer – much similar to XAML in Windows Phone.
Here’s an example of a layout:
1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button
        android:id="@+id/MyButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/Hello" />
</LinearLayout>

Activity

Activity is the class responsible for setting the UI content for the users to interact! You can consider this as a code-behind for the Layout written in the resources. So the activity class will contain the presentation logic of your view. It is the class that is referenced by the Android system to do the user interaction. Activities are created or destroyed by the Android system. It’s important to understand the Activity Life Cycle to effectively handle user data in the changing states such as RunningPausedBackgrounded  & Stopped.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
namespace HelloXamarin.Android
{
    [Activity(Label = "HelloXamarin.Android", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
         
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
           // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
        }
    }
}
All your Activity classes should derive from Activity base class. Notice the MainLauncher = true set in custom attribute – this is to set the starting screen of your app!
OnCreate() is called when the activity is created. It’s always overridden to perform startup initializations such as
  • Creating  Views
  • Initializing variables
  • Binding static data to lists
Notice the SetContentView() – It places your layout on the screen. Layouts can be accessed using the static variable Resources.Layout.<yourLayoutName>.
Now let’s add a Click event handler to the button placed in the Layout. Shall we?
To get the reference of the button placed in the layout use the helper method FindByViewId<T>() and pass the Id of the button you set in the resource. Once you get the handle – just add the event to the Click handler.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[Activity(Label = "HelloXamarin.Android", MainLauncher = true, Icon = "@drawable/icon")]
    public class MainActivity : Activity
    {
        private int count = 0;
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
           // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);
            button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
        }
    }
To navigate to another screen and pass some extra information along, use StartActivity() with an intent that contains the extra information. Extra information is nothing but the data that you want to pass between your screens.
1
2
3
4
5
6
button.Click += (s, e) =>
      {
          var intent = new Intent(this, typeof(DetailActivity));
          intent.PutExtra("userCount", count++);
          base.StartActivity(intent);
      };
Finally to receive the extra information that was passed from the previous screen you can use Intent.GetStringExtra or other type based methods. Here’s the full code:
1
2
3
4
5
6
7
8
9
10
11
12
13
[Activity(Label = "DetailActivity")]
public class DetailActivity : Activity
{
    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);
        SetContentView(Resource.Layout.Detail);
        var t = FindViewById<TextView>(Resource.Id.textView1);
        t.Text = string.Format("{0}:{1}","You clicked ",Intent.GetIntExtra("userCount", 0));
    }
}