We Help You To Renovate Your Blogger Blog With Awesomeness!

Friday, January 2, 2015

  • Full screen Overlay using CSS only- CSS Only Modal Popup

    Full screen Overlay Effects 




    When you search for a solution for fullscreen overlay, most website provide solutions using JavaScript or jQuery. The following solution is using only CSS and not using any JavaScript of jQuery. Here we are going to create a pop-up window that overlays an existing html page and disabling all links and bringing into focus on the pop up window.






     Sometimes you need your entire browser window with a black tint in the background and make a popup at the center of the screen. Normally this technique is used for displaying a login window without moving from existing page or displaying a video, when a user clicks on a link or button in a web page.



    Add this to your Page

     <style>
            .button {
                width: 150px;
                padding: 10px;
                background-color: #2d57f8;
                box-shadow: -8px 8px 10px 3px rgba(0,0,0,0.2);
                font-weight: bold;
                text-decoration: none;
            }

            #cover {
                position: fixed;
                top: 0;
                left: 0;
                background: rgba(0,0,0,0.6);
                z-index: 5;
                width: 100%;
                height: 100%;
                display: none;
            }

            #popupScreen {
                height: 380px;
                width: 340px;
                margin: 0 auto;
                position: relative;
                z-index: 10;
                display: none;
                background: url(login.png) no-repeat;
                border: 5px solid #cccccc;
                border-radius: 10px;
                background-color:rgb(245,245,245);
            }

                #popupScreen:target, #popupScreen:target + #cover {
                    display: block;
                    opacity: 2;
                }

            .cancel {
                display: block;
                position: absolute;
                top: 3px;
                right: 2px;
                background: rgb(245,245,245);
                color: black;
                height: 30px;
                width: 35px;
                font-size: 30px;
                text-decoration: none;
                text-align: center;
                font-weight: bold;
            }
        </style>



    HTML Code

    place anywhere 
      <div align="center"><a href="#popupScreen" class="button">Click here for Dialog</a> </div>
                        <div id="popupScreen">
                            <a href="#" class="cancel">&times;</a>

                       
                            <h2>Hi there</h2>
                        </div>
                        <div id="cover"></div>




    ×

    Hi there

  • Saturday, December 6, 2014

  • Prepare web.config for HTML5 and CSS3 HTTP Error 404.3 - Not Found

    HTTP Error 404.3 - Not Found
    The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
    The problem is that the IIS doesn’t know how to serve these new files unless we tell it how. This can be easily done in the web.config’s <system.webServer> section by adding the following snippet:
     
     
    <staticContent>
        <mimeMap fileExtension=".mp4" mimeType="video/mp4" />
        <mimeMap fileExtension=".m4v" mimeType="video/m4v" />
        <mimeMap fileExtension=".ogg" mimeType="video/ogg" />
        <mimeMap fileExtension=".ogv" mimeType="video/ogg" />
        <mimeMap fileExtension=".webm" mimeType="video/webm" />
    
        <mimeMap fileExtension=".oga" mimeType="audio/ogg" />
        <mimeMap fileExtension=".spx" mimeType="audio/ogg" />
    
        <mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
        <mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
    
        <remove fileExtension=".eot" />
        <mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
        <mimeMap fileExtension=".otf" mimeType="font/otf" />
        <mimeMap fileExtension=".woff" mimeType="font/x-woff" />
    </staticContent>
     
     
    The above snippet incl

    udes support for most video, audio and font file types used by HTML5 and CSS3.
  • Get language and country from a browser in ASP.NET

    Resolve the culture

    Splitted the functionality up into two methods. The first one resolves the CultureInfo based on the browsers language.
    public static CultureInfo ResolveCulture()
    {
      string[] languages = HttpContext.Current.Request.UserLanguages;

      if (languages == null || languages.Length == 0)
        return null;

      try
      {
        string language = languages[0].ToLowerInvariant().Trim();
        return CultureInfo.CreateSpecificCulture(language);
      }
      catch (ArgumentException)
      {
        return null;
      }
    }


    Resolve the country

    The next method uses the ResolveCulture()method above to create a RegionInfo object. The RegionInfo contains all the country information needed such as ISO code, EnglishName, NativeName and DisplayName.
    public static RegionInfo ResolveCountry()
    {
      CultureInfo culture = ResolveCulture();
      if (culture != null)
        return new RegionInfo(culture.LCID);

      return null;
    }





  • Sunday, October 26, 2014

  • How to convert DateTime to Date VarChar





    This line of code do the job


    CONVERT(varchar(10), [MyDateTimecolumn], 20)
     
     
    eg: select PKID,CONVERT(varchar(10), createdDate, 20) from tempTable
     
     
     
     
     
  • Best way to check if a Data Table has a null (SQL) value in it


    Hostgator Offers


     Check Whole table



    If you want to check if a null value exists in the table you can use this method:
    public static bool HasNull(this DataTable table)
    {
        foreach (DataColumn column in table.Columns)
        {
            if (table.Rows.OfType<DataRow>().Any(r => r.IsNull(column)))
                return true;
        }
    
        return false;
    }
     
     
    and use 
     
    table.HasNull(); 


     where ever you need


     Checking Specific column


    Compare the value of the column to the DBNull.Value value to filter and manage null values in whatever way you see fit.

     
     
     
     
    foreach(DataRow row in table.Rows)
    {
        object value = row["ColumnName"];
        if (value == DBNull.Value)
            // do something
        else
            // do something else
    }
     
     
    Check More About DBNull Class
     
     
     
     
  • Saturday, October 4, 2014

  • Get 25% Off on HostGator Hosting Coupon Code


    Since started in 2002, Hostgator has been providing World Class web hosting services to its clients in more than 200 countries. Hostgator has been offering world-class solutions around shared hosting, reseller hosting, VPS hosting and dedicated servers to individuals and professionals. Each web hosting solution from Hostgator comes with 24×7 support, 45 money back guarantee and unlimited bandwidth and disk space. 700,000 plus domain owners trust Hostgator web hosting solutions.






    Get 25% Off on HostGator Hosting Coupon Code
  • Wednesday, October 1, 2014

  • Read HTML File C# ASP Stream Reader



    string file = Server.MapPath ("abc.html");
    StreamReader sr;
    FileInfo fi = new FileInfo(file);
    if(File.Exists(file))
    {
         sr = File.OpenText(file);
         input += sr.ReadToEnd();
         sr.Close();
    }
     
     
     
     
     

    Another Method 

     

    string[] lines = File.ReadAllLines("path/to/my/file.html");
    foreach(string line in lines)
    {
        Response.Write(line);
    }

     

     
     
     
     
     
  • Monday, September 29, 2014

  • Datetime format Issue String was not recognized as a valid DateTime C# ASP .Net


    If this issue happens after the website is uploaded to server and no problem at your local computer, the cause of error is the date format difference of your system and your server

    Mostly the error happens for month

    consider a date "29/09/2014 20:20:00"

    Usually this error occurs at Convert.ToDateTime(DateTimeInStringFormat);

    My local computer consider '29' as day and my server consider '29' as a month.

    ie. at my local server date format is 'dd/MM/yyyy HH:mm:ss'

    and at server it is 'MM/dd/yyyy HH:mm:ss'

    There is lot of working solutions i found in a search. I am listing few of them

    Sol Using Parse Exact


    DateTime dt = DateTime.ParseExact(dr["dateCreated"].ToString().Trim(), 
     "M/d/yyyy h:mm:ss tt", CultureInfo.InvariantCulture);
     
    //dr["dateCreated"] returns  date from database
     
     

    Sol Using TryParse

     
    DateTime date4;
    string dateString = @"20/05/2012";
    bool result = DateTime.TryParse(dateString,out date4); 
    
    
    the parsing fails, but it will not throw error, rather it returns  
    false indicating that the parsing failed.
     
     
    
    

    Sol Using appropriate culture (I got this working)

    string dateString = @"20/05/2012";
    DateTime date2 = Convert.ToDateTime(dateString,
     System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);

     

    
    
     
    
    
  • Sunday, September 21, 2014

  • Setting up connection string in ASP.NET to SQL SERVER WEB.config Global

     
    In Web.config under <configuration> Tag
     
     
     
    <connectionStrings>
        <add name="ConnStringDb1" connectionString="Data Source=localhost;Initial Catalog=YourDataBaseName;Integrated Security=True;" providerName="System.Data.SqlClient" />
      </connectionStrings>
     
     
     

    in C# code usage

     
      SqlCommand command;
            public static string connectionstring = ConfigurationManager.ConnectionStrings["ConnStringDb1"].ToString();
            SqlConnection conn = new SqlConnection(connectionstring); 
    
    
    Dont Forget to add "using System.Configuration;"
     


  • How to play a Sound in Android Java Eclipse



    MediaPlayer class can be used to control playback of audio/video files and streams.

     keep the intro.mp3 file in raw folder in res



     MediaPlayer mp = MediaPlayer.create(getApplicationContext(), R.raw.intro);
        mp.start();
     
     
    mp.pause();// To pause / Stop music
     
     
     
     
  • Copyright @ 2013 Code Snippets.