Ads 468x60px

Pages

Blogroll

Thursday, December 29, 2011

Show Loading bar at the time of page loading


    <script type="text/javascript">

        $(window).load(function () {
            show();
        });
        function show() {

            $('#loading').hide();           
            $("#mainDiv").css("visibility", "visible");
        };
    </script>

<style type="text/css">
        #mainDiv
        {
            visibility:hidden;
        }
</style>


<body>
    <div id="loading">
        Loading......................
    </div>
    <div id="mainDiv ">
     write your main html content here....
    </div>
</body>


Thursday, December 22, 2011

Add JQuery Reference


   <script type="text/javascript"
            src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js">    
    </script>
    <script type="text/javascript">

        if (typeof jQuery == 'undefined') {
            document.write(unescape("%3Cscript src='Scripts/jquery-1.4.1.min.js'"
                                + "type='text/javascript'%3E%3C/script%3E"));
        }
    </script>

Vocabulary

Propagate, conviction, Gripe, jiffy, sneak, leftover, profound, pathological, goof, hindrance, slug, Brainstorm, luster, confront, outage, rinse, panacea, forbidden fruit, fatigue, absconder, fugitive, scrub, contended, comprising, amicus curiae, gradually, peer, tweaks, await, slip up, intent, hassle, peer-reviewed, prudent, convention, cornerstone, consensus, cited, flourishing, prosperity, enticing, aloof, limelight, Plateau, metabolism, lean and ripped, lean and fibers, flabby, stroll, endurance, treadmill, sow, drive out,
Carousel, divine, guesstimate, envisioning, prolonged, standoff, immunity, contends, roller-coaster, Deposed, plead, testimony, bestowed, avalanche, mounds, trapped, axis, hutments, adverse, venture, slopes, huddle, bells and whistles, Cater, sanitize, genre, inadvertently, intermittent, relies, paradigm, hereditary, benign, insane, lodge, IOC (International Olympic Committee), glitches, severe, dodgy, whiteout, brush up, negate, forge, impending, A strongly worded letter, dismayed, compassion, solidarity, thereby, assuaging, upholding, inculcate, unprecedented, monologue, Empathize, agile, drowsy, sedentary,onset, lag, unobtrusive, fork, empowered, Slothful, amorphous, canonical, circumvent, exhibit, Jot, smidge, taxonomy, joust, inevitably, acute, granular, flake, Doable, simulated, saturated, comprises, stumped, inclusion, stale,

 Emulate, downpour, solemn, mild, miffed, poke, slothful, Listlessness, Appetite, anatomy, shed, verbose, consensus, cerebral palsy, collate, lean, brush off, aesthetics, overlook, beetroot, prudence, Adherence, tepid, assert, dizzy, tertiary, spectrum, intuitive, uncluttered, timeless, pertaining, on-board, accreditation, succinct, illicit, seamless, Maiden Voyage, abide by, sensory, jargon, acronyms, Suburb, GLOSSARY


Wednesday, December 21, 2011

Control Logout on Direct Browser close

document.onkeydown = function (e) {
var evtobj = window.event ? window.event : e
LastKeyPressCode = evtobj.keyCode;
}

$(window).unload(function () {
alert('Handler for .unload() called.');
});

onbeforeunload = function () {
if (UserId != 0) {
SaveViewerSettings();
}
if (document.getElementById('uxReloadFlag').value != 'true' && LastKeyPressCode != 116 && LastKeyPressCode != 82) { //116 is for refresh key (F5) - Do not exit user on refresh - F5
ExitLiveSession(LiveSessionId, UserId, false);
}
}

Video

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Diagnostics;
using System.Collections;

namespace Video_Convertor
{
public partial class ConvertVideo : Form
{
public ConvertVideo()
{
InitializeComponent();
}

private void ConvertVideo_Load(object sender, EventArgs e)
{
cmbFileFormat.Enabled = false;
}

private bool validation()
{
bool flag = true;
if (txtSournce.Text.Trim() == string.Empty)
{
MessageBox.Show("Please choose source path.");
flag = false;
}
else if (txtDestination.Text.Trim() == string.Empty)
{
MessageBox.Show("Please choose destination path.");
flag = false;
}
else if (cmbConversionType.SelectedIndex == -1)
{
MessageBox.Show("Please choose the conversion type.");
flag = false;
}
else if (cmbFileFormat.SelectedIndex == -1)
{
MessageBox.Show("Please choose the file format.");
flag = false;
}
return flag;
}

private bool validateFileExtions(string inputFileExt, int conversionType)
{
string fileExt = inputFileExt;
string[] validfileExt = { ".wmv", ".flv", ".3gp", ".avi", ".dat", ".mpg", ".vob", ".mkv" };

if (validfileExt.Contains(fileExt))
{
return true;
}

return false;
}
private void btnConvert_Click(object sender, EventArgs e)
{
if (validation())
{
string[] files = Directory.GetFiles(txtSournce.Text);
string outputFileName = string.Empty;
string inputPath = string.Empty;
string outputPath = string.Empty;
string cmd = string.Empty;
string aORv = string.Empty;
if (files.Length > 0)
{
cmd = "-i {0} -r 25 -s vga -b:{1} 1024000 -ab 192000 {2}";
aORv = (cmbConversionType.SelectedIndex == 0) ? "a" : "v";
foreach (string file in files)
{
inputPath = @"""" + file + @"""";
if (validateFileExtions(Path.GetExtension(file), cmbConversionType.SelectedIndex))
{
outputFileName = Path.GetFileNameWithoutExtension(file) + cmbFileFormat.SelectedItem.ToString();
outputPath=txtDestination.Text + "\\" + outputFileName;
cmd = string.Format(cmd, inputPath, aORv, @"""" + outputPath + @"""");
ProcessFile( cmd);
}
}
}
else
{
MessageBox.Show("There is no file(s) in input folder.");
}
}
}

private void ProcessFile(string cmd)
{
string apppath = Application.StartupPath + "\\ffmpeg\\ffmpeg.exe";
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = apppath;
proc.StartInfo.Arguments = cmd;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
proc.Start();
proc.WaitForExit();
proc.Close();
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}

private void cmbConversionType_SelectedIndexChanged(object sender, EventArgs e)
{
cmbFileFormat.Items.Clear();

if (cmbConversionType.SelectedIndex != -1)
{
cmbFileFormat.Enabled = true;
string[] validfileExt = (cmbConversionType.SelectedIndex == 0) ? new string[] { ".mp3", ".wma" } : new string[] { ".wmv", ".flv", ".3gp", ".avi", ".dat", ".mpg", ".vob", ".mkv" };
Array.Sort<string>(validfileExt);
foreach (string ext in validfileExt)
{
cmbFileFormat.Items.Add(ext);
}
//cmbFileFormat.Refresh();
//cmbFileFormat.SelectedIndex = -1;
//cmbFileFormat.SelectedText = string.Empty;
}
}

private void btnSelectSource_Click(object sender, EventArgs e)
{
FolderBrowserDialog browseDialog = new FolderBrowserDialog();
browseDialog.Description = "Select folder that contains input video(s).";
browseDialog.ShowNewFolderButton = false;
DialogResult result = browseDialog.ShowDialog();
if (result == DialogResult.OK)
{
txtSournce.Text = browseDialog.SelectedPath;
}
}

private void btnSelectDestination_Click(object sender, EventArgs e)
{
FolderBrowserDialog browseDialog = new FolderBrowserDialog();
browseDialog.Description = "Select or create new folder that will contains output video(s).";
browseDialog.ShowNewFolderButton = true;
DialogResult result = browseDialog.ShowDialog();
if (result == DialogResult.OK)
{
txtDestination.Text = browseDialog.SelectedPath;
}
}

}
}

Watermark using placeholder HTML 5


    <input type="text" placeholder="Enter watermark text" name="txt" />
    <script type="text/javascript">
      
jQuery.support.placeholder = (function () {
    var i = document.createElement('input');
    return 'placeholder' in i;
})();

function WatermarkText() {
    if (!$.support.placeholder) {
        var active = document.activeElement;
        $('[placeholder]').focus(function () {
            if ($(this).attr('placeholder') != undefined && $(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
                //$(this).val() == '' - check is required here because the field is cleared off placeholder text on form submission
                $(this).val('').removeClass('hasPlaceholder');
            }
        }).blur(function () {
            if ($(this).attr('placeholder') != undefined && $(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
                $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
            }
        });
        $('[placeholder]').blur();
        $(active).focus();
        $('form').submit(function () {
            $(this).find('.hasPlaceholder').each(function () {
                $(this).val('');
                $(this).focus();              
            });

        });
    }
}

    </script>

   <style type="text/css">
        .hasPlaceholder
        {
        font-style:italic;
        }       
    </style>
http://archive.plugins.jquery.com/project/input-placeholder

Monday, December 19, 2011

Apply more than one watermarks on a page using single JQuery method

This post will show you an easy way to add a JQuery textbox watermark in your application.



  • Now add below class in your project css class. 
     .watermark
        {
           font-style:italic;
        }


  • Now put the following JQuery code in your common JavaScript class for the project. If you don't have the add a new javascript class and then paste the below code


$(document).ready(function () {
    ApplyWaterMark();
});

function ApplyWaterMark() {
    $(".watermark").each(function () {
        var txtVal = $(this).val();
        $(this).focus(function () {
            if ($(this).val() == txtVal) {
                $(this).val('');
                $(this).removeClass('watermark');
            }
        });
        $(this).blur(function () {
            if ($(this).val() == '') {
                $(this).val(txtVal);
                $(this).addClass('watermark');
            }
        });
    });
}



First make sure your application has the reference to the jquery file under the head section in your template header known as master page in asp.net. For e.g.

<head>

<script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"></script>

</head>






and the input control at your page under head section. 

 <input type="text" id="txtFirstName" value="Enter First Name" class="watermark"/>

 <input type="text" id="TxtMiddleName" value="Enter Middle Name" class ="watermark"/>
        
 <input type="text" id="TxtLastName" value="Enter Last Name" class="watermark" />

So here is your watermark ready to use.