Tuesday, September 4, 2018

C# TryParse() Safe convertion.

TryParse() - C# best practice

TryParse() is introduce In .Net framework 2.0 for safe conversion in string to any numismatic value. and its a replacement method of Parse which exist in earlier version of .net framework.

TryParse() has many advantages ;
  • Safe to convert string to many data types (int,decimal,float,byte,Boolean,double)
  • Not throw an exception if the conversion fails.
  • Return boolean if the conversion fails.
  • Handle the null conversion. 

Why to use TryParse() instead of Parse();

Parse method will throw exception - ArgumentNullexception or FormatException or OverflowException, if the string value cannot be converted to the respective data type. so it will impact the system performance.

Explore the TryParse()
  
1:  int parsedResult;   
2:  int.TryParse("125A", out parsedResult);  
out put is

parsedResult =0


With more validation
       

string strTextData = "125A";
int parsedResult; 

if (int.TryParse(strTextData , out parsedResult))
{
   return "Valid Data";

}
else
{
 return "Invalid Data";
}


       
 

Friday, June 1, 2018

Enable remote Debugging for Android Device in Chrome

Here is simple steps to enable remote debugging for Android Device in Chrome.



you can easily debug your website contain or hybrid web app in android device in chrome remote debugging option. this feature available from Android ice cream sandwich (4.0) on words.

On your Android device.
  1. plug you android device to computer.
  2. Enabled developer option.
    1.   Find software build number by 
                   in most samsung devices  go to   Settings > About phone > Build number or
                   Settings > About phone > Software information > Build number
                   tap 7 time on the Build number.
                   After that the Developer options will available under the settings menu


    2. USB Debugging - Settings > Developer options > Check “USB debugging”.

On your Computer
  1.  install ADBPlugin  Chrome Extension from the webstore 
    1. Click on the Android icon in your Chrome menu and select “Start ADB”

                             or
    download ADB (Android debug bridge ) here  and extract the folder and open command prompt then move the  "platform-tools" folder and give the adb usb command.

  2. Open chrome inspect mode and enable the remote device.

 3. now you can see the device is connected
4. now in your android device open chrome browser and type the url need to inspect and then click the inspect icon.

.

Thursday, May 31, 2018

Introduction To Xamarin

Ok lets start it this way.. iam so new to Xamarin. previously I spell it as X - marin but peoples call it samaring ;-) .

so What is Xamarin ?


simply its a common mobile application development platform for IOS , Android and windows phone. that means developers able to sheared their single code base with multi mobile platform.


How it Works !
as its Microsoft no need to worry much. you can use Xamarin studio or visual studio for windows or mac. (here i start with VS 2015)

Why Xamarin ?

  • Xamarin is based in native platform so the performance of the application is  high.
  • All the native based APIs are available in the xamarin.
  • UI design are focus in the native platform. the user experience is almost same for the native android/ios app and the xamarin app
  • Developer need to know one language to cater many platform.
Xamarin Native Vs Xamarin Forms

There are two type of Xamarin developments.




Xamarin Native is the traditional stage of Xamarin app development and its simply based on the mobile platform and developer need to maintain separate UI for each platform

Xamarin Native
Pros

  • Create one UI per platform.
  • Easy ability to adjust the platform specific UI features and components.
  • Get the maximum out of your UI.

Cons

  • Cross platform development process is much slower.
  • You need to learn all native UI frameworks.
  • You may result in having duplicate code (as you describe almost the same UI in three different platform specific ways).    
Xamarin Form
Xamarin form is latest approch of xamarin and it enable the developer to share UI and code base among the multiple platform. 

Pros

  • Create one UI for all platforms.
  • Use basic components that are available on all platforms (like Buttons, Textfields, Spinners etc.).
  • No need to learn all the native UI frameworks.
  • Fast cross platform development process.
  • Custom native renders give you the ability to adjust the appearance and feeling of controls.
Cons

  • It's still a new framework and still contains bugs.
  • Less resources.
  • It's sometimes slower than accessing the native controls directly.
  • Custom native renders have boundaries and are poorly documented.