Saturday, 14 November 2015

Free Android Games. Fun Golf : Free

Leave a Comment
This is my second Games App in Play Store. Fun Golf : Free

Feel free to download and having fun playing this games.

https://play.google.com/store/apps/details?id=link.golf

Don't forget to give 5 star rating. =)

Thanks.


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Wednesday, 4 November 2015

Dialog box confirmation before exit android app.

Leave a Comment
This is the code to trigger dialog box before you exit the application in android.


  private void ShowMessageExit(String Message){  
     new AlertDialog.Builder(this)  
         .setMessage(Message)  
         .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {  
           public void onClick(DialogInterface dialog, int which) {  
             android.os.Process.killProcess(android.os.Process.myPid());  
             System.exit(0);  
           }  
         })  
         .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {  
           public void onClick(DialogInterface dialog, int which) {  
             // do nothing  
           }  
         })  
         .setIcon(android.R.drawable.ic_dialog_alert)  
         .show();  
   }  



By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Monday, 2 November 2015

Become android developer.

Leave a Comment
Since before, I was planning to try mobile development. and I choose date 1 November 2015 to become a android developer.

This is my first and Mobile App developed by me.

You guys can download and Install this simple app.

https://play.google.com/store/apps/details?id=com.ad.cameraflashlight

Thank you for supporting me.

By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Saturday, 3 October 2015

How to make request to webservice with soap message - asp.net /C#

Leave a Comment
If you have webservice and want to call the web service from your c# code, you can try to use this method example.

Code Behind

         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(<web service address>);  
         request.Headers.Add("SOAPAction", "http://tempuri.org/" + <web service method>);  
         request.ContentType = "text/xml;charset=\"utf-8\"";  
         request.KeepAlive = false;  
         request.Timeout = 300000; // - in millisecond. (5 minit)  
         request.Method = "POST";  
         request.Credentials = CredentialCache.DefaultCredentials;  
         byte[] byteArray = Encoding.ASCII.GetBytes(<data you want to send to webservice>);  
         request.ContentLength = byteArray.Length;  
         Stream s = request.GetRequestStream();  
         s.Write(byteArray, 0, byteArray.Length);  
         s.Dispose();  
         s.Close();  
         HttpWebResponse response = (HttpWebResponse)request.GetResponse();  
         Encoding enc = System.Text.Encoding.GetEncoding(1252);  
         StreamReader resStream = new StreamReader(response.GetResponseStream());  
         result = resStream.ReadToEnd(); // read webservice response
         dataToSend = "";  
         resStream.Dispose();  
         resStream.Close();  
         response.Close();  
         return result;  


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Method snippet to remove space between words - asp.net

Leave a Comment
This is the method that can use in c# application or asp.net to remove space between words.

Example :


Hello World  --> HelloWorld

Method 

    /// <summary>  
     /// Method to remove space in a string example : Hello world --> HelloWorld  
     /// </summary>  
     /// <param name="data"></param>  
     /// <returns></returns>  
     public static string removeSpace(string data)  
     {  
       Regex r = new Regex(@"\s+");  
       string _temp = "";  
       _temp = r.Replace(data, @"");  
       return _temp;  
     }  

OR without static

    /// <summary>  
     /// Method to remove space in a string example : Hello world --> HelloWorld  
     /// </summary>  
     /// <param name="data"></param>  
     /// <returns></returns>  
     public string removeSpace(string data)  
     {  
       Regex r = new Regex(@"\s+");  
       string _temp = "";  
       _temp = r.Replace(data, @"");  
       return _temp;  
     }  




By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Check web config file either encrypt or not.

Leave a Comment
This is example how to check if web.config file is encrypt or not. refer this article to encrypt and decrypt web config file.

The example will check web config file for 3 section which is ConnectionString, AppSetting, and system.web/authentication .

Code Behind

  private static string[] sectionName = { "connectionStrings", "appSettings", "system.web/authentication" };  
     public static string[] SectionName  
     {  
       get  
       {  
         return sectionName;  
       }  
       set  
       {  
         sectionName = value;  
       }  
     }  
     /// <summary>  
     /// method to check if web config file is encrypted or not  
     /// </summary>  
     /// <returns></returns>  
     private bool CheckWebConfigIfEncrypt()  
     {  
       bool isEncrypt = false;  
       foreach (string a in SectionName)  
       {  
         Configuration config =  
           WebConfigurationManager.  
             OpenWebConfiguration("~" + HttpContext.Current.Request.ApplicationPath);  
         ConfigurationSection section =  
              config.GetSection(a);  
         if (section != null &&  
            section.SectionInformation.IsProtected)  
           isEncrypt = true;  
         else  
         {  
           return false;  
         }  
       }  
       return isEncrypt;  
     }  


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Decrypt web config file - asp.net

Leave a Comment
This is example how to decrypt web config file in asp.net. You can refer to this post on how to encrypt web config file.

The example will decrypt web config file for 3 section which is ConnectionString, AppSetting, and system.web/authentication .

Front End aspx code

  <br />  
   This is button to decrypt web config.<br />  
   <asp:Button ID="Button2" runat="server" Text="Decrypt Web Config" OnClick="Button2_Click" />  


Code behind

  private static string[] sectionName = { "connectionStrings", "appSettings", "system.web/authentication" };  
     public static string[] SectionName  
     {  
       get  
       {  
         return sectionName;  
       }  
       set  
       {  
         sectionName = value;  
       }  
     }  
     protected void Button2_Click(object sender, EventArgs e)  
     {  
       //decrypt  
       UnProtectSection();  
     }  
     /// <summary>  
     /// Decrypted web config file for certain section  
     /// </summary>  
     /// <param name="sectionName"></param>  
     private void UnProtectSection()  
     {  
       foreach (string a in SectionName)  
       {  
         Configuration config =  
           WebConfigurationManager.  
             OpenWebConfiguration("~/");  
         ConfigurationSection section =  
              config.GetSection(a);  
         if (section != null &&  
            section.SectionInformation.IsProtected)  
         {  
           section.SectionInformation.UnprotectSection();  
           config.Save();  
         }  
       }  
     }  

Output







By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Encrypt Web config file - asp.net

Leave a Comment
This is example how to encrypt web config file in asp.net.

The example will encrypt web config file for 3 section which is ConnectionString, AppSetting, and system.web/authentication .


Front End aspx Code 

  <br />  
   This is button to encrypt web config.<br />  
 <asp:Button ID="Button1" runat="server" Text="Encrypt Web config" OnClick="Button1_Click" />  

Code Behind

  private static string[] sectionName = { "connectionStrings", "appSettings", "system.web/authentication" };  
     public static string[] SectionName  
     {  
       get  
       {  
         return sectionName;  
       }  
       set  
       {  
         sectionName = value;  
       }  
     }  
     protected void Button1_Click(object sender, EventArgs e)  
     {  
       //encrypt  
       ProtectSection();  
     }  
     /// <summary>  
     /// Encrypte WebConfig file for certain section  
     /// </summary>  
     /// <param name="sectionName"></param>  
     /// <param name="provider"></param>  
     private void ProtectSection()  
     {  
       string provider = "DataProtectionConfigurationProvider";  
       foreach (string a in SectionName)  
       {  
         Configuration config =  
           WebConfigurationManager.  
             OpenWebConfiguration("~/");  
         ConfigurationSection section =  
                config.GetSection(a);  
         if (section != null &&  
              !section.SectionInformation.IsProtected)  
         {  
           section.SectionInformation.ProtectSection(provider);  
           config.Save();  
         }  
       }  
     }  

Output






By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)
Read More...

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.