Posts

Showing posts from January, 2013

get mouse click if inside a div or not

Use this Code : $("body > div").click(function() { if ($(this).attr("id") == "in_or_out") { // inside } else { // not inside } }); OR $(document).mouseup(function (e) { var container = $("YOUR CONTAINER SELECTOR"); if (container.has(e.target).length === 0) { container.hide(); } });

Unsafe JavaScript attempt to access frame with URL from frame with URL youtube

best solution to use youtube API : jQuery(document).ready(function() { var Vid = 'youtubeId'; var params = { allowScriptAccess: "always" }; var atts = { id: "myytplayer" }; swfobject.embedSWF("http://www.youtube.com/v/" + Vid + "?enablejsapi=1&playerapiid=ytplayer&version=3", "ytapiplayer", "320", "315", "8", null, null, params, atts); }); and add Div with ID "ytapiplayer"

HttpContext.Current.Session is null (Inside WebService)

[WebMethod(EnableSession = true)] public void SomeMethod() { ... code here }

numeric up down "spinner"

use Jquery UI $( "#spinner" ).spinner();

sum int array values

we will loop to sum all values : if we have an array like <ul> <li class='price'>10</li> <li class='price'>5</li> <li class='price'>3</li> <li class='price'>11</li> </ul> summ will get by : $('.price').blur(function () { var sum = 0; $('.price').each(function() { sum += Number($(this).html()); }); });​​​​​​​​​

Parse to Int - Float Javascript

convert to Int var intvar = parseInt('1'); var Floatvar = parseFloat('10.52');

Ubuntu intallation is stuck at vmware tools installation

Problem is : When I finish the intallation Ubuntu , the VMware automatically installed the VMware Tools, and it was stuck at this scene. The scene is like this: ****************************************************************** ****************************************************************** Vmware Easy Install PLEASE WAIT! VMware Tools is currently being installed on your system. Depending on the version of Ubuntu you are installing, you may log in below and use the system during intallation. Otherwise, please wait for the graphical environment to launch. Thank you. ****************************************************************** ****************************************************************** ubuntu login:_ Solution : 1- Restore the /etc/issue file: sudo mv /etc/issue.backup /etc/issue 2- Restore the /etc/rc.local file: sudo mv /etc/rc.local.backup /etc/rc.local 3- Restore the /etc/init/lightdm.conf file: sudo mv /opt/vmware-tools-installer/lightdm.conf /etc/...

Event for user pressing enter in a textbox

to make event when click to any input you can use : $('textarea').keyup(function(e){ if(e.keyCode == 13) { // code here } });

FTP upload, download, delete ,get files asp.net

you first need to download FtpClient.cs from here once you add this file to your project you can upload - download - delete and get files from FTP servers - To get all files from ftp: FTPclient ftPclient = new FTPclient("XXX.XXX.X.XX", "xx-xx", "xx-xx"); foreach (FTPfileInfo ky in ftPclient.ListDirectoryDetail("")) { TreeNode trParent = new TreeNode(); trParent.Text = ky.Filename; trParent.Value = ky.FullName; trVFiles.Nodes.Add(trParent); } - To Upload Files if (Fileupload1.HasFile) { FTPclient ftPclient = new FTPclient("XXX.XXX.X.XX", "xx-xx", "xx-xx"); ftPclient.Upload(fu_FtFile.FileContent, fu_FtFile.FileName); } - To Download Files: FTPclient ftPclient = new FTPclient("XXX.XXX.X.XX", "xx-xx", "xx-xx"); byte[] _downFile = ftPclient.Download(e.CommandArgument.T...

max File size can upload to ASp.net servers

- default upload file size if 4MB - To increase it, please use this below section in your web.config - Max value to upload : 2,147,483,647 = 2GB <configuration> <system.web> <httpRuntime maxRequestLength="2147483647" /> </system.web> </configuration> - Max value to upload: 4,294,967,295 = 4GB - you can upload Files more than 2GB use below code : <system.webServer> <security> <requestFiltering> <requestLimits maxAllowedContentLength="4294967295" /> </requestFiltering> </security> </system.webServer>