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;
}
}

}
}