Search Results

Search found 166 results on 7 pages for 'doris sel'.

Page 2/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • highlight the text of the DOM range element,

    - by ganapati
    I am able to highlight the text on the HTML page(rendered through gtkmozembed), which is selected, like below. var range, sel; if (window.getSelection) { sel = window.getSelection(); if (sel.getRangeAt) { range = sel.getRangeAt(0); } document.designMode = "on"; if (range) { sel.removeAllRanges(); sel.addRange(range); } document.execCommand("HiliteColor", false, colour); document.designMode = "off"; } Well,it works very fine.Now i am trying to store the information(startNode, startOffset,endNode, endOffset) about the highlighted text, and next time when i open the same page,highlight the same text. I am able to successfully store the info and retrieve them when the same page opens. And i am trying to highlight the text using following code. var range = document.createRange(); range.setStart(startNode, startOffset); range.setEnd(endNode, endOffset); document.designMode = "on"; range.execCommand("HiliteColor", false, colour); document.designMode = "off"; But it is not working as i am expecting. Can anyone help me to achieve the required? Thanks...

    Read the article

  • How to clean completly select2 control?

    - by Candil
    I'm working with the awesome select2 control. I'm trying to clean and disable the select2 with the content too so I do this: $("#select2id").empty(); $("#select2id").select2("disable"); Ok, it works, but if i had a value selected all the items are removed, the control is disabled, but the selected value is still displayed. I want to clear all content so the placeholder would be showed. Here is a example I did where you can see the issue: http://jsfiddle.net/BSEXM/ HTML: <select id="sel" data-placeholder="This is my placeholder"> <option></option> <option value="a">hello</option> <option value="b">all</option> <option value="c">stack</option> <option value="c">overflow</option> </select> <br> <button id="pres">Disable and clear</button> <button id="ena">Enable</button> Code: $(document).ready(function () { $("#sel").select2(); $("#pres").click(function () { $("#sel").empty(); $("#sel").select2("disable"); }); $("#ena").click(function () { $("#sel").select2("enable"); }); }); CSS: #sel { margin: 20px; } Do you have any idea or advice to this?

    Read the article

  • What is wrong in my DKIM setup? I'm getting all fails

    - by djechelon
    I own a domain name I have implemented SPF and DKIM to avoid my mails being junked. I have also upgraded to DMARC in monitor mode. Since I received a few failure reports recently I wanted to investigate more. I have only one server sending outbound emails, running postfix + dkimproxy. I trust that dkimproxy has no major software bugs resulting in bad messages. I have tested ReturnPath's automated DKIM test and this is the part related to DKIM/DomainKeys DKIM Results ============ Result = failed: invalid key for signature: Syntax error in tag: \"v Domain = domain.org Selector = sel DNS Record(s) = sel._domainkey.domain.org TXT "v=1; p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsMMLhxzXkU+tagc44oMi7eX2BsFb8BsWeT8MRL+hxi4Lsosx7tuPm90iYgilNteyJoXuSP5SUf8B2tDAifdzYQhfhctr0hX9b6ocBCukGq5p0GHpNsCPWyFvxZsCkGqLRmkfb0c36quEAWBeQLe4Z/BwXBBiW1g96WFNb2/GRI1+9OHhligdfuo4PPuU+xiwX4GB0Ik50cJL4xTdBf7lrFwoGYa03ZkXuzKxeGE4cTk50OeIs6eqrzAfbmej4nCex2qGOUt1TWI7ZvCY7u3Gxj+XKaE7VFrQACZof+NP0k2pXPHg9saGJqZrr2i6+RoxGD0w/ibjAWij9enwqlnv2ORsZfe+FmXNOLJAhlYvhHaruubDpte1c7V3ZKDceM45ZawnVmSdLCfBrMbsqipzy8NXN5MxuANYFBkx5EDT+Ieab+zqcnf08m9bgDc4RXMYppDT1/lUy6On+nyfZEnJWiH3BUtgxS8X0uXciXbsooTmPnpkzzvvKXAE/Tv3XqL90q51geqP0EmaZI6lRTpiqoX7zFGlEBiiF7/u8oheszATks8LsNZ/boTFy0OVldbYNhxlIuRmqeXkqD6+kM5ObKtMEv3AdaeBiZmvyJTP8tCsSmPt+e954RLlz2HaDjjNnZNgsj/39U2RzZsFbVqW6uyQh36/y1X4joOiPf366GkCAwEAAQ==; t=s" Public Key Length = 4096 DomainKeys Results ================== Domain = domain.org Selector = sel DNS Record(s) = sel._domainkey.domain.org TXT "v=1; p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsMMLhxzXkU+tagc44oMi7eX2BsFb8BsWeT8MRL+hxi4Lsosx7tuPm90iYgilNteyJoXuSP5SUf8B2tDAifdzYQhfhctr0hX9b6ocBCukGq5p0GHpNsCPWyFvxZsCkGqLRmkfb0c36quEAWBeQLe4Z/BwXBBiW1g96WFNb2/GRI1+9OHhligdfuo4PPuU+xiwX4GB0Ik50cJL4xTdBf7lrFwoGYa03ZkXuzKxeGE4cTk50OeIs6eqrzAfbmej4nCex2qGOUt1TWI7ZvCY7u3Gxj+XKaE7VFrQACZof+NP0k2pXPHg9saGJqZrr2i6+RoxGD0w/ibjAWij9enwqlnv2ORsZfe+FmXNOLJAhlYvhHaruubDpte1c7V3ZKDceM45ZawnVmSdLCfBrMbsqipzy8NXN5MxuANYFBkx5EDT+Ieab+zqcnf08m9bgDc4RXMYppDT1/lUy6On+nyfZEnJWiH3BUtgxS8X0uXciXbsooTmPnpkzzvvKXAE/Tv3XqL90q51geqP0EmaZI6lRTpiqoX7zFGlEBiiF7/u8oheszATks8LsNZ/boTFy0OVldbYNhxlIuRmqeXkqD6+kM5ObKtMEv3AdaeBiZmvyJTP8tCsSmPt+e954RLlz2HaDjjNnZNgsj/39U2RzZsFbVqW6uyQh36/y1X4joOiPf366GkCAwEAAQ==; t=s" The mail displays an anonymised DNS record with genuine public key. It reports an error in tag v. A few hours ago I noticed my v tag was v=DKIM1 instead of v=1 as specified in RFC. I thought it was an error made by me during the initial setup months ago and fixed to v=1, but anyway I received one DMARC success from Google. Let me explain better: I enforced DMARC a couple of days ago. On 4/16 morning I got a mail from Google telling me that DMARC fully passes, then since 4/17 I get all failures. Then I discovered the v=DKIM1 tag and replaced with v=1 without success I have not modified my DNS records before that. So, keeping in topic with the question, why does ReturnPath refuse my DKIM DNS record? Is something wrong in my DKIM implementation at DNS level? [Add] I have just tried port25.com's tester but at least DKIM passes ---------------------------------------------------------- DomainKeys check details: ---------------------------------------------------------- Result: permerror (DK_STAT_BADKEY: Unusable key, public if verifying, private if signing.) ID(s) verified: header.From=########### DNS record(s): sel._domainkey.domain.org. 1800 IN TXT ""v=1; p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsMMLhxzXkU+tagc44oMi7eX2BsFb8BsWeT8MRL+hxi4Lsosx7tuPm90iYgilNteyJoXuSP5SUf8B2tDAifdzYQhfhctr0hX9b6ocBCukGq5p0GHpNsCPWyFvxZsCkGqLRmkfb0c36quEAWBeQLe4Z/BwXBBiW1g96WFNb2/GRI1+9OHhligdfuo4PPuU+xiwX4GB0Ik50cJL4xTdBf7lrFwoGYa03ZkXuzKxeGE4cTk50OeIs6eqrzAfbmej4nCex2qGOUt1TWI7ZvCY7u3Gxj+XKaE7VFrQACZof+NP0k2pXPHg9saGJqZrr2i6+RoxGD0w/ibjAWij9enwqlnv2ORsZfe+FmXNOLJAhlYvhHaruubDpte1c7V3ZKDceM45ZawnVmSdLCfBrMbsqipzy8NXN5MxuANYFBkx5EDT+Ieab+zqcnf08m9bgDc4RXMYppDT1/lUy6On+nyfZEnJWiH3BUtgxS8X0uXciXbsooTmPnpkzzvvKXAE/Tv3XqL90q51geqP0EmaZI6lRTpiqoX7zFGlEBiiF7/u8oheszATks8LsNZ/boTFy0OVldbYNhxlIuRmqeXkqD6+kM5ObKtMEv3AdaeBiZmvyJTP8tCsSmPt+e954RLlz2HaDjjNnZNgsj/39U2RzZsFbVqW6uyQh36/y1X4joOiPf366GkCAwEAAQ==; t=s"" ---------------------------------------------------------- DKIM check details: ---------------------------------------------------------- Result: pass (matches From: #########) ID(s) verified: header.d=domain.org Canonicalized Headers: message-id:<[email protected]>'0D''0A' date:Thu,'20'18'20'Apr'20'2013'20'11:40:26'20'+0200'0D''0A' from:#############'0D''0A' mime-version:1.0'0D''0A' to:[email protected]'0D''0A' subject:Test'0D''0A' content-type:text/plain;'20'charset=ISO-8859-15;'20'format=flowed'0D''0A' content-transfer-encoding:7bit'0D''0A' dkim-signature:v=1;'20'a=rsa-sha1;'20'c=relaxed;'20'd=domain.org;'20'h='20'message-id:date:from:mime-version:to:subject:content-type'20':content-transfer-encoding;'20's=dom;'20'bh=uoq1oCgLlTqpdDX/iUbLy7J1Wi'20'c=;'20'b= Canonicalized Body: '0D''0A' DNS record(s): sel._domainkey.domain.org. 1800 IN TXT ""v=1; p=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsMMLhxzXkU+tagc44oMi7eX2BsFb8BsWeT8MRL+hxi4Lsosx7tuPm90iYgilNteyJoXuSP5SUf8B2tDAifdzYQhfhctr0hX9b6ocBCukGq5p0GHpNsCPWyFvxZsCkGqLRmkfb0c36quEAWBeQLe4Z/BwXBBiW1g96WFNb2/GRI1+9OHhligdfuo4PPuU+xiwX4GB0Ik50cJL4xTdBf7lrFwoGYa03ZkXuzKxeGE4cTk50OeIs6eqrzAfbmej4nCex2qGOUt1TWI7ZvCY7u3Gxj+XKaE7VFrQACZof+NP0k2pXPHg9saGJqZrr2i6+RoxGD0w/ibjAWij9enwqlnv2ORsZfe+FmXNOLJAhlYvhHaruubDpte1c7V3ZKDceM45ZawnVmSdLCfBrMbsqipzy8NXN5MxuANYFBkx5EDT+Ieab+zqcnf08m9bgDc4RXMYppDT1/lUy6On+nyfZEnJWiH3BUtgxS8X0uXciXbsooTmPnpkzzvvKXAE/Tv3XqL90q51geqP0EmaZI6lRTpiqoX7zFGlEBiiF7/u8oheszATks8LsNZ/boTFy0OVldbYNhxlIuRmqeXkqD6+kM5ObKtMEv3AdaeBiZmvyJTP8tCsSmPt+e954RLlz2HaDjjNnZNgsj/39U2RzZsFbVqW6uyQh36/y1X4joOiPf366GkCAwEAAQ==; t=s"" Public key used for verification: sel._domainkey.domain.org (4096 bits)

    Read the article

  • $.fadeTo/fadeOut() operations on Table Rows in IE fail

    - by Rick Strahl
    Here’s a a small problem that one of customers ran into a few days ago: He was playing around with some of the sample code I’ve put out for one of my simple jQuery demos which deals with providing a simple pulse behavior plug-in: $.fn.pulse = function(time) { if (!time) time = 2000; // *** this == jQuery object that contains selections $(this).fadeTo(time, 0.20, function() { $(this).fadeTo(time, 1); }); return this; } it’s a very simplistic plug-in and it works fine for simple pulse animations. However he ran into a problem where it didn’t work when working with tables – specifically pulsing a table row in Internet Explorer. Works fine in FireFox and Chrome, but IE not so much. It also works just fine in IE as long as you don’t try it on tables or table rows specifically. Applying against something like this (an ASP.NET GridView): var sel = $("#gdEntries>tbody>tr") .not(":first-child") // no header .not(":last-child") // no footer .filter(":even") .addClass("gridalternate"); // *** Demonstrate simple plugin sel.pulse(2000); fails in IE. No pulsing happens in any version of IE. After some additional experimentation with single rows and various ways of selecting each and still failing, I’ve come to the conclusion that the various fade operations in jQuery simply won’t work correctly in IE (any version). So even something as ‘elemental’ as this: var el = $("#gdEntries>tbody>tr").get(0);$(el).fadeOut(2000); is not working correctly. The item will stick around for 2 seconds and then magically disappear. Likewise: sel.hide().fadeIn(5000); also doesn’t fade in although the items become immediately visible in IE. Go figure that behavior out. Thanks to a tweet from red_square and a link he provided here is a grid that explains what works and doesn’t in IE (and most last gen browsers) regarding opacity: http://www.quirksmode.org/js/opacity.html It appears from this link that table and row elements can’t be made opaque, but td elements can. This means for the row selections I can force each of the td elements to be selected and then pulse all of those. Once you have the rows it’s easy to explicitly select all the columns in those rows with .find(“td”). Aha the following actually works: var sel = $("#gdEntries>tbody>tr") .not(":first-child") // no header .not(":last-child") // no footer .filter(":even") .addClass("gridalternate"); // *** Demonstrate simple plugin sel.find("td").pulse(2000); A little unintuitive that, but it works. Stay away from <table> and <tr> Fades The moral of the story is – stay away from TR, TH and TABLE fades and opacity. If you have to do it on tables use the columns instead and if necessary use .find(“td”) on your row(s) selector to grab all the columns. I’ve been surprised by this uhm relevation, since I use fadeOut in almost every one of my applications for deletion of items and row deletions from grids are not uncommon especially in older apps. But it turns out that fadeOut actually works in terms of behavior: It removes the item when the timeout’s done and because the fade is relatively short lived and I don’t extensively test IE code any more I just never noticed that the fade wasn’t happening. Note – this behavior or rather lack thereof appears to be specific to table table,tr,th elements. I see no problems with other elements like <div> and <li> items. Chalk this one up to another of IE’s shortcomings. Incidentally I’m not the only one who has failed to address this in my simplistic plug-in: The jquery-ui pulsate effect also fails on the table rows in the same way. sel.effect("pulsate", { times: 3 }, 2000); and it also works with the same workaround. If you’re already using jquery-ui definitely use this version of the plugin which provides a few more options… Bottom line: be careful with table based fade operations and remember that if you do need to fade – fade on columns.© Rick Strahl, West Wind Technologies, 2005-2010Posted in jQuery  

    Read the article

  • Take screenshot with Selenium: WaitForPageToLoad does not wait long enough

    - by OregonGhost
    I'm trying to get screenshots from a web page with multiple browsers. Just experimenting with Selenium RC, I wrote code like this: var sel = new DefaultSelenium(server, 4444, target, url); sel.Start(); sel.Open(url); sel.WaitForPageToLoad("30000"); var imageString = sel.CaptureScreenshotToString(); This basically works, but in most cases the screenshot is of a blank browser window, because the page is not yet ready for display. It kind of works if I add a sleep just after the WaitForPageToLoad, but that slows down the fast browsers and/or may be to short for the slower browsers (or under load). A typical solution for this seems to be to wait for the presence of a certain element. However, this is meant as a simple generic solution to get a screenshot of a local web page with as many browsers as possible (to test the layout) and I don't want to have to enter certain element names or whatever. It's a simple tool where you just enter the Selenium Server URL and the URL you want to test, and get the screenshots back. Any advice?

    Read the article

  • How to store javascript variables in iPhone application

    - by sugar
    <script type="text/javascript"> function getSelectionRange() { var sel; if (window.getSelection) { sel = window.getSelection(); if (sel.rangeCount) { return sel.getRangeAt(0); } } else if (document.selection) { return document.selection.createRange(); } return null; } var range; </script> whatShouldBeHere=[wvText stringByEvaluatingJavaScriptFromString:@"getSelectionRange();"]; Here, method getSelectionRange is returning JavaScript Object of Range type. How can I catch & store in plist file in iPhone application ? Thanks in advance for sharing your knowledge. Sagar

    Read the article

  • Javascript - How to index html code into variables

    - by Fernando SBS
    The webpage has the following source (only copied the important part): <h1>Relatórios</h1> <div id="textmenu"> <a href="berichte.php" class="selected ">Tudo</a> | <a href="berichte.php?t=2">Comércio</a> | <a href="berichte.php?t=1">Reforços</a> | <a href="berichte.php?t=3">Ataques</a> | <a href="berichte.php?t=4">Outros</a> </div> <form method="post" action="berichte.php" name="msg"> <table cellpadding="1" cellspacing="1" id="overview" class="row_table_data"> <thead> <tr> <th colspan="2">Assunto:</th> <th class="sent"> enviada</th> </tr> </thead><tfoot> <tr> <th>&nbsp;</th> <th class=buttons><input name=del value=apagar alt=apagar type=image id=btn_delete class=dynamic_img src=img/x.gif /></th> <th class=navi>&laquo;<a href="berichte.php?s=10&amp;o=0">&raquo;</a></th> </tr> </tfoot> <tbody> <tr> <td class="sel"><input class="check" type="checkbox" name="n1" value="15737030" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15737030">Rio Grande Do Leste ataca lcsanchez da aldeia</a> </div> </td> <td class="dat">hoje 21:33</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n2" value="15736877" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736877">Rio Grande Do Leste ataca Thabiti da aldeia</a> </div> </td> <td class="dat">hoje 21:32</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n3" value="15736759" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736759">Rio Grande Do Leste ataca Dionisio</a> </div> </td> <td class="dat">hoje 21:31</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n4" value="15736513" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736513">Rio Grande Do Leste ataca Aldeia de troakris</a> (nova)</div> </td> <td class="dat">hoje 21:30</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n5" value="15736275" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736275">Rio Grande Do Leste ataca Thabiti da aldeia</a> </div> </td> <td class="dat">hoje 21:28</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n6" value="15736220" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15736220">Rio Grande Do Leste ataca Aldeia de troakris</a> (nova)</div> </td> <td class="dat">hoje 21:28</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n7" value="15734824" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15734824">Rio Grande Do Leste ataca Austrália</a> </div> </td> <td class="dat">hoje 21:18</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n8" value="15734440" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15734440">Rio Grande Do Leste ataca andrômeda</a> (nova)</div> </td> <td class="dat">hoje 21:15</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n9" value="15730612" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15730612">Rio Grande Do Leste ataca wLG02 KING OF POP</a> (nova)</div> </td> <td class="dat">hoje 20:49</td> </tr> <tr> <td class="sel"><input class="check" type="checkbox" name="n10" value="15730304" /></td> <td class="sub"><img src="img/x.gif" class="iReport iReport1" alt="Ganhou como atacante sem perdas" title="Ganhou como atacante sem perdas" /> <div><a href="berichte.php?id=15730304">Rio Grande Do Leste ataca wLG02 KING OF POP</a> (nova)</div> </td> <td class="dat">hoje 20:47</td> </tr> </tbody> </table> </form> </div> I want to read from the source and assign to a variable the values like: relatorio[0] = berichte.php?id=15730304; relatorio[1] = berichte.php?id=15730612; ... relatorio[9] = berichte.php?id=15737030; How to do that? thanks

    Read the article

  • on .bind('click') it is not deleting the first div

    - by Jean
    Hello, When I click on a particular div, that div should fade out, simple, but when I click on one of the divs it deletes the div on top of the stack. ie., when I click #sel6 it removes sel5 html code <div id="selc" class="selc" style="position:absolute; left:15px; top:200px; width:260px;"> <div id="sel5" class="sel">something</div> <div id="sel6" class="sel">something</div> <div id="sel7" class="sel">something</div> </div jquery code sel_id, sel_1 are variables $('.selc').bind('click',function(){ var sel_id = $('.sel').attr('id'); alert(sel_id); $('#'+sel_id).fadeOut('slow'); $('#'+sel_id).remove(); $('.search_box').append(sel_1); }); Thanks Jean

    Read the article

  • Call instance method with objc_msgSend

    - by user772349
    I'm trying to use the objc_msgSend method to call some method dynamically. Say I want call some method in Class B from Class A and there are two methods in class B like: - (void) instanceTestWithStr1:(NSString *)str1 str2:(NSString *)str1; + (void) methodTestWithStr1:(NSString *)str1 str2:(NSString *)str1; And I can call the class method like this in Class A successfully: objc_msgSend(objc_getClass("ClassB"), sel_registerName("methodTestWithStr1:str2:"), @"111", @"222"); And I can call the instance method like this in Class A successfully as well: objc_msgSend([[objc_getClass("ClassB") alloc] init], sel_registerName("instanceTestWithStr1:str2:"), @"111", @"222"); But the thing is to get a instance of Class B I have to call "initWithXXXXX:XXXXXX:XXXXXX" instead of "init" so that to pass some necessary parameters to class B to do the init stuff. So I stored a instance of ClassB in class A as variable: self.classBInstance = [[ClassB alloc] initWithXXXXX:XXXXXX:XXXXXX]; And then I call the method like this (successfully): The problem is, I want to call a method by simply applying the classname and the method sel like "ClassName" and "SEL" and then call it dynamically: If it's a class method. then call it like: objc_msgSend(objc_getClass("ClassName"), sel_registerName("SEL")); If it's a instance method, find the existing class instance variable in the calling class then: objc_msgSend([self.classInstance, sel_registerName("SEL")); So I want to know if there is any way to: Check if a class has a given method (I found "responseToSelector" will be the one) Check if a given method in class method or instance method (maybe can use responseToSelector as well) Check if a class has a instance variable of a given class So I can call a instance method like: objc_msgSend(objc_getClassInstance(self, "ClassB"), sel_registerName("SEL"));

    Read the article

  • Rangy move boundaries of user selection out of header element

    - by Frank
    I'm using rangy and have a case with a contenteditable div where the users selection can be saved and later restored so that HTML can be inserted. My problem is that if the user selects within a header element, I don't want the html inserted within a header. So I'm trying to figure out how to use rangy so that if the the selection is made within a header then I can move it before the header element. So if the user selects within an h1: <div id="editable" contenteditable> <h1>|user selects here| Header Text</h1> </div> Then the saved selection would be moved before the h1: | selection boundary moved here |<div id="editable" contenteditable> <h1>|user selects here| Header Text</h1> </div> I've tried the following to see if I could move the selection boundary: var sel = rangy.getSelection(); var range = sel.getRangeAt(0); range.setStartBefore(sel.anchorNode.parentNode); sel.removeAllRanges(); sel.addRange(range); selected = rangy.saveSelection(); But when I select within the H1, it still sets the saved selection boundaries within the H1 and not before it. I'm not sure how I can get the boundaries moved before the header element.

    Read the article

  • Ranking Part III

    - by PointsToShare
    © 2011 By: Dov Trietsch. All rights reserved   Ranking Part III In a previous blogs “Ranking an Introduction” and  “Ranking Part II” , you have already praised me in “Rank the Author” and learned how to create a new element on a page and how to place it where you need it. For this installment, I just added code to keep the number of votes (you vote by clicking one of the stars) and the total vote. Using these two, we can compute the average rating. It’s a small step, but its purpose is to show that we do not need a detailed history in order to compute the average. A running total is sufficient. Please note that once you close the game, you will lose your previous total. In real life, we persist the totals in the list itself. We also keep a list of actual votes, but its purpose is to prevent double votes. If a person has already voted, his user id is already on the list and our program will check for it and bar the person from voting again. This is coded in an event receiver, which is a SharePoint server piece of code. I will show you how to do this part in a subsequent blog. Again, go to the page and look at the code. The gist of it is here. avg, votes, and stars are global variables that I defined before. function sendRate(sel){//I hate long line so I created pieces of the message in their own vars            var s1 = "Your Rating Was: ";            var s2 = ".. ";            var s3 = "\nVotes = ";            var s4 = "\nTotal Stars = ";            var s5 = "\nAverage = ";            var s;            s = parseInt(sel.id.replace("_", '')); // Get the selected star number            votes = parseInt(votes) + 1;            stars = parseInt(stars) + s;            avg = parseFloat(stars) / parseFloat(votes);            alert(s1 + sel.id + s2 +sel.title + s3 + votes + s4 + stars + s5 + avg);} Click on the link to play and examine “Ranking with Stats” That’s all folks!

    Read the article

  • I want to DEACTIVATE the window's focus, please help me

    - by Doris Sel
    I want to disable something for a specific window : the window's ability to get activated or focused. Everytime a window gets a focus or it gets activated( ex: when you click on it ) ,the window appears the top most of all windows. So I want to stay forever in the 'background'. And to do this , maybe I need somehow to remove the possibily of having focus for that windows... EDIt: I know the window can be hided or minimized but I need it displayed on the monitor. Can this be possible, please help me, thankyou so much!

    Read the article

  • Summing up spreadsheet data when a column contains “#N/A”

    - by Doris
    I am using Goggle Spreadsheet to work up some historical stock data and I use a Google function (=googlefinance=…) to import the historical closing prices for a stock, then I work with that data further. But, in that list of data generated from the =googlefinance=… function, one of the amounts comes up as #N/A. I don’t know why, but it happens for various symbols that I have tried. When I use a max function on the array, which includes the N/A line, the max function does not come up with anything but an N/A, so the N/A throws off any further functions. I thought I’d create a second column to the right of the imported data in which I can give it an IF function, something like, If ((A1 <0), "0", A1), with the expectation that it would return 0 if cell A1 is the N/A, and the cell value if it is not N/A. However, this still returns N/A. I also tried an IS BLANK function but that resulted in the same NA. Does anyone have any suggestions for a workaround to eliminate the N/A from an array of numbers that I am trying to work with?

    Read the article

  • iphone app: delegate not responding

    - by Fiona
    Hi guys.. So i'm very new to this iphone development stuff.... and i'm stuck. I'm building an app that connects to the twitter api. However when the connectionDidFinishLoading method gets called, it doesn't seem to recognise the delegate. Here's the source code of the request class: import "OnePageRequest.h" @implementation OnePageRequest @synthesize username; @synthesize password; @synthesize receivedData; @synthesize delegate; @synthesize callback; @synthesize errorCallBack; @synthesize contactsArray; -(void)friends_timeline:(id)requestDelegate requestSelector:(SEL)requestSelector{ //set the delegate and selector self.delegate = requestDelegate; self.callback = requestSelector; //Set up the URL of the request to send to twitter!! NSURL *url = [NSURL URLWithString:@"http://twitter.com/statuses/friends_timeline.xml"]; [self request:url]; } -(void)request:(NSURL *) url{ theRequest = [[NSMutableURLRequest alloc] initWithURL:url]; theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self]; if (theConnection){ //Create the MSMutableData that will hold the received data. //receivedData is declared as a method instance elsewhere receivedData=[[NSMutableData data] retain]; }else{ //errorMessage.text = @"Error connecting to twitter!!"; } } -(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{ if ([challenge previousFailureCount] == 0){ NSLog(@"username: %@ ",[self username]); NSLog(@"password: %@ ",[self password]); NSURLCredential *newCredential = [NSURLCredential credentialWithUser:[self username] password:[self password] persistence:NSURLCredentialPersistenceNone]; [[challenge sender] useCredential:newCredential forAuthenticationChallenge:challenge]; } else { [[challenge sender] cancelAuthenticationChallenge:challenge]; NSLog(@"Invalid Username or password!"); } } -(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ [receivedData setLength:0]; } -(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{ [receivedData appendData:data]; } -(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{ [theConnection release]; [receivedData release]; [theRequest release]; NSLog(@"Connection failed. Error: %@ %@", [error localizedDescription], [[error userInfo] objectForKey:NSErrorFailingURLStringKey]); if(errorCallBack){ [delegate performSelector:errorCallBack withObject:error]; } } -(void)connectionDidFinishLoading:(NSURLConnection *)connection{ if (delegate && callback){ if([delegate respondsToSelector:[self callback]]){ [delegate performSelector:[self callback] withObject:receivedData]; }else{ NSLog(@"No response from delegate!"); } } [theConnection release]; [theRequest release]; [receivedData release]; } Here's the .h: @interface OnePageRequest : NSObject { NSString *username; NSString *password; NSMutableData *receivedData; NSURLRequest *theRequest; NSURLConnection *theConnection; id delegate; SEL callback; SEL errorCallBack; NSMutableArray *contactsArray; } @property (nonatomic,retain) NSString *username; @property (nonatomic,retain) NSString *password; @property (nonatomic,retain) NSMutableData *receivedData; @property (nonatomic,retain) id delegate; @property (nonatomic) SEL callback; @property (nonatomic) SEL errorCallBack; @property (nonatomic,retain) NSMutableArray *contactsArray; -(void)friends_timeline:(id)requestDelegate requestSelector:(SEL)requestSelector; -(void)request:(NSURL *) url; @end In the method: connectionDidFinishLoading, the following never gets executed: [delegate performSelector:[self callback] withObject:receivedData]; Instead I get the message: "No response from delegate" Anyone see what I'm doing wrong?! or what might be causing the problem? Regards, Fiona

    Read the article

  • Selenium RC: how to capture/handle error?

    - by KenBurnsFan1
    Hi, My test uses Selenium to loop through a CSV list of URLs via an HTTP proxy (working script below). As I watch the script run I can see about 10% of the calls produce "Proxy error: 502" ("Bad_Gateway"); however, the errors are not captured by my catch-all "except Exception" clause -- ie: instead of writing 'error' in the appropriate row of the "output.csv", they get passed to the else clause and produce a short piece of html that starts: "Proxy error: 502 Read from server failed: Unknown error." Also, if I collect all the URLs which returned 502s and re-run the script, they all pass, which leads me to believe that this is a sporadic network path issue. Question: Can the script be made to recognize the the 502 errors, sleep a minute, and then retry the URL instead of moving on to the next URL in the list? The only alternative that I can think of is to apply re.search("Proxy error: 502") after "get_html_source" as a way to catch the bad calls. Then, if the RE matches, put the script to sleep for a minute and then retry 'sel.open(row[0]' on the URL which produced the 502. Any advice would be much appreciated. Thanks! #python 2.6 from selenium import selenium import unittest, time, re, csv, logging class Untitled(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 4444, "*firefox", "http://baseDomain.com") self.selenium.start() self.selenium.set_timeout("60000") def test_untitled(self): sel = self.selenium spamReader = csv.reader(open('ListOfSubDomains.csv', 'rb')) for row in spamReader: try: sel.open(row[0]) except Exception: ofile = open('output.csv', 'ab') ofile.write("error" + '\n') ofile.close() else: time.sleep(5) html = sel.get_html_source() ofile = open('output.csv', 'ab') ofile.write(html.encode('utf-8') + '\n') ofile.close() def tearDown(self): self.selenium.stop() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main()

    Read the article

  • Opera bug with JS autoselecting text (if more than 1 div)

    - by E L
    Here is HTML code. It supposed to select all text in "Container" div <B onclick="SelectText(document.getElementById('Container'));">select all text</B> <Div id="Container"> <Div>123456</Div> <Div>123456</Div> <Div onclick="SelectText();">123456</Div> </Div> here is JS code of the SelectText() function function SelectText(target){ if(target==null){ var e = window.event || e; if (!e) var e = window.event; var target=e.target || e.srcElement; } var rng, sel; if ( document.createRange ) { rng = document.createRange(); rng.selectNode( target ); sel = window.getSelection(); sel.removeAllRanges(); sel.addRange( rng ); } else { var rng = document.body.createTextRange(); rng.moveToElementText( target ); rng.select(); } } Problem is that in Opera 12.02 when "select all text" is clicked, all text seems like selected, but it's not selected (I can't rightclick it and copy). (terrific, but IE works fine with it) Why not in Opera?!!! And what can I do to make Opera 12.02 believe that all text in "Container" is selected?

    Read the article

  • Problem setting output flags for ALU in "Nand to Tetris" course

    - by MahlerFive
    Although I tagged this homework, it is actually for a course which I am doing on my own for free. Anyway, the course is called "From Nand to Tetris" and I'm hoping someone here has seen or taken the course so I can get some help. I am at the stage where I am building the ALU with the supplied hdl language. My problem is that I can't get my chip to compile properly. I am getting errors when I try to set the output flags for the ALU. I believe the problem is that I can't subscript any intermediate variable, since when I just try setting the flags to true or false based on some random variable (say an input flag), I do not get the errors. I know the problem is not with the chips I am trying to use since I am using all builtin chips. Here is my ALU chip so far: /** * The ALU. Computes a pre-defined set of functions out = f(x,y) * where x and y are two 16-bit inputs. The function f is selected * by a set of 6 control bits denoted zx, nx, zy, ny, f, no. * The ALU operation can be described using the following pseudocode: * if zx=1 set x = 0 // 16-bit zero constant * if nx=1 set x = !x // Bit-wise negation * if zy=1 set y = 0 // 16-bit zero constant * if ny=1 set y = !y // Bit-wise negation * if f=1 set out = x + y // Integer 2's complement addition * else set out = x & y // Bit-wise And * if no=1 set out = !out // Bit-wise negation * * In addition to computing out, the ALU computes two 1-bit outputs: * if out=0 set zr = 1 else zr = 0 // 16-bit equality comparison * if out<0 set ng = 1 else ng = 0 // 2's complement comparison */ CHIP ALU { IN // 16-bit inputs: x[16], y[16], // Control bits: zx, // Zero the x input nx, // Negate the x input zy, // Zero the y input ny, // Negate the y input f, // Function code: 1 for add, 0 for and no; // Negate the out output OUT // 16-bit output out[16], // ALU output flags zr, // 1 if out=0, 0 otherwise ng; // 1 if out<0, 0 otherwise PARTS: // Zero the x input Mux16( a=x, b=false, sel=zx, out=x2 ); // Zero the y input Mux16( a=y, b=false, sel=zy, out=y2 ); // Negate the x input Not16( in=x, out=notx ); Mux16( a=x, b=notx, sel=nx, out=x3 ); // Negate the y input Not16( in=y, out=noty ); Mux16( a=y, b=noty, sel=ny, out=y3 ); // Perform f Add16( a=x3, b=y3, out=addout ); And16( a=x3, b=y3, out=andout ); Mux16( a=andout, b=addout, sel=f, out=preout ); // Negate the output Not16( in=preout, out=notpreout ); Mux16( a=preout, b=notpreout, sel=no, out=out ); // zr flag Or8way( in=out[0..7], out=zr1 ); // PROBLEM SHOWS UP HERE Or8way( in=out[8..15], out=zr2 ); Or( a=zr1, b=zr2, out=zr ); // ng flag Not( in=out[15], out=ng ); } So the problem shows up when I am trying to send a subscripted version of 'out' to the Or8Way chip. I've tried using a different variable than 'out', but with the same problem. Then I read that you are not able to subscript intermediate variables. I thought maybe if I sent the intermediate variable to some other chip, and that chip subscripted it, it would solve the problem, but it has the same error. Unfortunately I just can't think of a way to set the zr and ng flags without subscripting some intermediate variable, so I'm really stuck! Just so you know, if I replace the problematic lines with the following, it will compile (but not give the right results since I'm just using some random input): // zr flag Not( in=zx, out=zr ); // ng flag Not( in=zx, out=ng ); Anyone have any ideas? Edit: Here is the appendix of the book for the course which specifies how the hdl works. Specifically look at section 5 which talks about buses and says: "An internal pin (like v above) may not be subscripted". Edit: Here is the exact error I get: "Line 68, Can't connect gate's output pin to part". The error message is sort of confusing though, since that does not seem to be the actual problem. If I just replace "Or8way( in=out[0..7], out=zr1 );" with "Or8way( in=false, out=zr1 );" it will not generate this error, which is what lead me to look up in the appendix and find that the out variable, since it was derived as intermediate, could not be subscripted.

    Read the article

  • How to reuse a dropdownlist each row of a table instead of rebuilding it.

    - by Praesagus
    I have a table the uses the same dropdown list in each row. I thought that I could just create one dropdown list and then reuse it in each new row, but the table only ends up with one row unless I create "new" dropdownlist. Am I approaching this all wrong? Thanks private void UserRoles() { Table table = MakeTable(); Ewo.sqlDataStore.Administrator sql = new Ewo.sqlDataStore.Administrator(); DataSet dataset =sql.SiteUserRoleList(); DropDownList sel = RoleList(dataset.Tables[0]); if(tools.validDataSet(dataset)) { if (dataset.Tables.Count > 1)//existing roles are #2, show the roles the user is part of { foreach (DataRow dRow in dataset.Tables[1].Rows) { table.Rows.Add(CreateRoleRow(Convert.ToString(dRow["SitePageGroupName"]), sel));//add a row with data } } table.Rows.Add(CreateRoleRow(sel));//add a blank row on the bottom } AdminSiteUerRoles.Controls.Add(table);//add it all to the page }

    Read the article

  • JQuery selector in variable

    - by nagut
    I wanted to ask about using selector from a variable first I have: function check() { $('.info input, .info select').each(function(n, element){ if ($(element).val()=='') alert('empty'); }); } and called it in $('input')change(check); and they worked fine. But now I want to pass some value to the function to make it dynamic, like $('input')change(check('.info')); and changed the function to function check(sel) { $(sel +' input, '+ sel + ' select').each(function(n, element){ if ($(element).val()=='') alert('empty'); }); } but it doesn't work. Any help please.. Thanks, nagut

    Read the article

  • Jquery effect problem : How to detect if mouseover is triggered by scroll ?

    - by Crupuk
    Hello, I have another problem, and because the reply is to fast here i come back again !! I would like to use "key navigation" and for that, i use the keypress event with down/up key ) When my mouse is over a div (div who's contenaing a big table) and i pull the down key : i scroll to next td + change css style + remove the current style And again, for each event.. So, because my mouse is over the main div, each time i scroll (auto) to a element, the mouseover event is triggered .. And so, the effect is missed.. This is the perfect script : User use keyboard navigation : Mouseover is disabled (so style change only with up/down key) User don't use keyboard : mouseover change the style Could you help me ? The code : $("#content tr").mouseover(function() { $("#content tr.use,#content tr.sel").removeClass("use sel"); $(this).addClass("sel"); }); And the keyboard navigation code : http://pastebin.com/Hgn5Y1FV (Sorry again for my english.. ) Thanks

    Read the article

  • How to get array keys in Javascript?

    - by DisgruntledGoat
    I have an array created with this code: var widthRange = new Array(); widthRange[46] = { sel:46, min:0, max:52 }; widthRange[66] = { sel:66, min:52, max:70 }; widthRange[90] = { sel:90, min:70, max:94 }; I want to get each of the values 46, 66, 90 in a loop. I tried for (var key in widthRange) but this gives me a whole bunch of extra properties (I assume they are functions on the object). I can't use a regular for loop since the values are not sequential.

    Read the article

  • How to get jSon object in servlet from jsp?

    - by divi
    In jsp page i have written: var sel = document.getElementById("Wimax"); var ip = sel.options[sel.selectedIndex].value; var param; var url = 'ConfigurationServlet?ActionID=Configuration_Physical_Get'; httpRequest = new ActiveXObject("Microsoft.XMLHTTP"); httpRequest.open("POST", url, true); httpRequest.onreadystatechange = handler(){ if (httpRequest.readyState == 4) { if (httpRequest.status == 200) { param = 'ip='+ip; param += 'mmv='+mmv; param += "tab="+tab; }}; httpRequest.send(param); i want this param variable in my configurationServlet. Can any one tel me how to get this json object in servlet???

    Read the article

  • Sending object C from class A to class B

    - by user278618
    Hi, I can't figure out how to design classes in my system. In classA I create object selenium (it simulates user actions at website). In this ClassA I create another objects like SearchScreen, Payment_Screen and Summary_Screen. # -*- coding: utf-8 -*- from selenium import selenium import unittest, time, re class OurSiteTestCases(unittest.TestCase): def setUp(self): self.verificationErrors = [] self.selenium = selenium("localhost", 5555, "*chrome", "http://www.someaddress.com/") time.sleep(5) self.selenium.start() def test_buy_coffee(self): sel = self.selenium sel.open('/') sel.window_maximize() search_screen=SearchScreen(self.selenium) search_screen.choose('lavazza') payment_screen=PaymentScreen(self.selenium) payment_screen.fill_test_data() summary_screen=SummaryScreen(selenium) summary_screen.accept() def tearDown(self): self.selenium.stop() self.assertEqual([], self.verificationErrors) if __name__ == "__main__": unittest.main() It's example SearchScreen module: class SearchScreen: def __init__(self,selenium): self.selenium=selenium def search(self): self.selenium.click('css=button.search') I want to know if there is anything ok with a design of those classes?

    Read the article

  • how delete all options except second in javascript

    - by Syom
    i have a select tag, with some options <select id="sel"> <option>text1</option> <option>text2</option> <option>text3</option> <option>text4</option> </select> i want to delete all options except second, i.e i want to get <select id="sel"> <option>text2</option> </select> i think it must looks something like this document.getElementById('sel').options.length= 0; but it deletes all list, so could you help me. thanks

    Read the article

  • Handy Generic JQuery Functions

    - by Steve Wilkes
    I was a bit of a late-comer to the JQuery party, but now I've been using it for a while it's given me a host of options for adding extra flair to the client side of my applications. Here's a few generic JQuery functions I've written which can be used to add some neat little features to a page. Just call any of them from a document ready function. Apply JQuery Themeroller Styles to all Page Buttons   The JQuery Themeroller is a great tool for creating a theme for a site based on colours and styles for particular page elements. The JQuery.UI library then provides a set of functions which allow you to apply styles to page elements. This function applies a JQuery Themeroller style to all the buttons on a page - as well as any elements which have a button class applied to them - and then makes the mouse pointer turn into a cursor when you mouse over them: function addCursorPointerToButtons() {     $("button, input[type='submit'], input[type='button'], .button") .button().css("cursor", "pointer"); } Automatically Remove the Default Value from a Select Box   Required drop-down select boxes often have a default option which reads 'Please select...' (or something like that), but once someone has selected a value, there's no need to retain that. This function removes the default option from any select boxes on the page which have a data-val-remove-default attribute once one of the non-default options has been chosen: function removeDefaultSelectOptionOnSelect() {     $("select[data-val-remove-default='']").change(function () {         var sel = $(this);         if (sel.val() != "") { sel.children("option[value='']:first").remove(); }     }); } Automatically add a Required Label and Stars to a Form   It's pretty standard to have a little * next to required form field elements. This function adds the text * Required to the top of the first form on the page, and adds *s to any element within the form with the class editor-label and a data-val-required attribute: function addRequiredFieldLabels() {     var elements = $(".editor-label[data-val-required='']");     if (!elements.length) { return; }     var requiredString = "<div class='editor-required-key'>* Required</div>";     var prependString = "<span class='editor-required-label'> * </span>"; var firstFormOnThePage = $("form:first");     if (!firstFormOnThePage.children('div.editor-required-key').length) {         firstFormOnThePage.prepend(requiredString);     }     elements.each(function (index, value) { var formElement = $(this);         if (!formElement.children('span.editor-required-label').length) {             formElement.prepend(prependString);         }     }); } I hope those come in handy :)

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >