w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Why position: relative; places background elements their existent on front?
Using position:relative or position:absolute or position:fixed allows you to also use a z-index value to determine the order of stacking. if you set z-index:-1 on the h2 it should push it back behind the other elements. Alternatively you could set position:relative on the other element and set a higher z-index on that.

Categories : CSS

Python Flask, how to detect a SSE client disconnect from front end Javascript
I've had a similar problem with Rails Live Controllers. The problem is that the framework doesn't seem to detect that the connection is closed until it attempts to send an Event to the client. One approach is to send periodic "heartbeat" events to the client. I'm presently using this successfully on my Rails project with an interval of 60 seconds. I have a separate thread that "emits" these heartbeats into Redis, that my controller has subscribed to. An alternative to the threaded approach, is to wrap the Redis pubsub block with a timeout (again, say 60 seconds). And then send the heartbeat event to the client - followed by another pubsub call. The downside to this approach, is you may miss an event while you're not subscribed. There's more on the threading approach here: Redis + Acti

Categories : Python

How can I detect support for events on disabled elements?
You should test this, as I've only tested it in one version of Firefox and Chrome, but it seems to correctly detect whether disabled inputs support events (dispatchEvent throws an exception on a disabled input): function hasEventsOnDisabled(){ var input = document.createElement('input'); input.disabled = true; var e = document.createEvent('HTMLEvents'); e.initEvent('click', true, true); try{ input.dispatchEvent(e); return true; }catch(err){} return false; }

Categories : Javascript

Detect mousedown event on canvas elements
You could use IsMouseOver Property foreach (Ellipse element in nodesOnCanv) { if (element.IsMouseOver) { element.Fill = Brushes.Red; } } or handle MouseDown for each node test = new Ellipse(); test.MouseDown += new MouseButtonEventHandler(test_MouseDown); . void test_MouseDown(object sender, MouseButtonEventArgs e) { (sender as Ellipse).Fill = Brushes.Red; } I would prefer the latter.

Categories : C#

jquery: detect when one of the elements of each function is empty
I'd suggest: var aryYears= []; $(".year").each(function(){ var v = $(this).val(); aryYears.push(v !== '' ? v : prompt('Please enter a year:')); }) JS Fiddle demo; Updated (after a while, due to a couple of accidental infinite loops, sigh...): function getValue(v, hint) { if (v && v !== '') { return v; } else { v = prompt('Please enter a ' + hint + ': '); return getValue(v); } } var aryYears = []; $(".year").each(function () { var v = $(this).val(); aryYears.push(getValue(v, 'year')); }) console.log(aryYears); JS Fiddle demo. The latter sample should, if nothing else, put the user in a position where s/he gets frustrated enough to enter a value, however there's no sanity-checking of that value; so please do

Categories : Javascript

Detect Hover for two intersecting Circular elements
Here you go. First, the Code: (function($){ $.mlp = {x:0,y:0}; // Mouse Last Position function documentHandler(){ var $current = this === document ? $(this) : $(this).contents(); $current.mousemove(function(e){jQuery.mlp = {x:e.pageX,y:e.pageY}}); $current.find("iframe").load(documentHandler); } $(documentHandler); $.fn.ismouseover = function(overThis) { var result = false; this.eq(0).each(function() { var $current = $(this).is("iframe") ? $(this).contents().find("body") : $(this); var offset = $current.offset(); result = offset.left<=$.mlp.x && offset.left + $current.outerWidth() > $.mlp.x && offset.top<=$.m

Categories : Javascript

How to detect load requests of iframe content elements?
That sounds like something, that would be possible (straightforward, even) as soon as Service Controllers (previously known as NavigationControllers) are implemented, but I do not know any way to accomplish this via any currently available method. No wonder you didn't find info about this - the proposal is called "Service workers" (though, previously this was called Event workers, and even before that, they were called - guess what - navigation controllers). This is a lively spec! ;) Find the working draft on GitHub: https://github.com/slightlyoff/ServiceWorker/ with a lengthy explainer document that should get you going. Also, there is a document with the current Chrome (blink) implementation plans.

Categories : Javascript

why doesn't valgrind detect excess elements in arrays
Your array is stored in stack area and Valgrind checks for the leak in heap area.It check for leak of memory allocated by dynamic allocation so you are not getting any detection by Valgrind. If you really want to see the effect then use bellow code int main() { int *p=malloc(6); } and use Valgrind to check the memory leak.

Categories : C

JS feature detect preserve-3d property support for nested elements
Well, I wouldn't bother too much with this. As far as I know IE is so far the only CSS 3D Transform supporting browser that doesn't support preserve-3d, however I can understand that you want to avoid having to update lots of sites once IE supports it (even if by that time your Autonomous Robot Butler will be able to do that for you). So, for something that actually tests the support you might want to give this Modernizr test a try: Tests for "preserve-3d" are not working on Android (via Browserstack)? http://jsfiddle.net/wsqSw/

Categories : Internet Explorer

How do I take a JS array that has some elements that are also arrays and make ALL array elements top level elements
You don't need the second step to have an array of arrays, just join then split it by the comma: var array = ["item1", "item2", "item3, item4", "item5", "item6"] console.log(array.join(',').split(',')); Example fiddle

Categories : Javascript

In Firefox SPAN elements cannot be dynamically added to elements with -column-width values
Solved it. As I suspected, its a matter of forcing Firefox to redraw elements. The problem is fixed after adding the following line to the addSpan( ) function. document.getElementById("content").innerHTML = document.getElementById("content").innerHTML;

Categories : HTML

Do elements with "position: absolute;" behave as block-level elements?
A <div> element is not inline while a <span> element is. Here's the definition of absolute from position: absolute - The element is positioned relative to its first positioned (not static) ancestor element. So the answer to your questions is yes: span elements with display: block display as somewhat block-level elements. Let me know if you still need clarification.

Categories : CSS

alternative to a for loop for replacing a subset of elements in a matrix with elements in a vector in R
The items you are comparing are of different classes: character and Dates. (I get an entire matrix filled with 1's.) Try this: mydates <- as.Date(mydates) # then the comparisons will more sensible It get to a vectorized answer I resorted to the use of outer and rearranged the logic a bit to create a matrix with the "new" values, and then set the failing items back to strating value of 1: myarray2 <-matrix(mycons, nrow=length(dates), ncol=length(mydates), byrow=TRUE) myarray2[ outer(dates, mydates, "<=") ] <- 1 myarray2 I tried using mapply thinking I could do something like to pass "parallel items" from two sequences but there is no way that I could get the "i" indexing to take hold. mapply(function(x,y) {myarray[i , ] <- y[x>dates]} , mydates,

Categories : R

Dynamically adding elements to jQuery Mobile , when these elements are retrieved Asynchronously?
Try to populate your list where you're building your albums arrays. var myList = $("ul"); // better save this in a var for (i=0; i<response.data.length; i++) { myList.append('<li><img src="' + response.data[i].cover_photo + '" /><h2>' + response.data[i].name + '</h2></li>').listview('refresh'); } Also, it seems you won't need these data arrays anymore unless you plan to do some additional things with it.

Categories : Jquery

String gsub - Replace characters between two elements, but leave surrounding elements
You can do it using this character class : [^/] (all that is not a slash) and lookarounds mystring.gsub(/(?<=start/)[^/]+(?=/end)/,"7")

Categories : Ruby

Removing elements that have no attributes, child elements, or text during transform
This should do the job: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:output indent="yes" method="xml" omit-xml-declaration="yes"/> <xsl:strip-space elements="*"/> <!-- Elements/attributes to remove. Note that comments are not elements or attributes. Since there is no template to match comments they are automatically ignored. --> <xsl:template match="@*[normalize-space()='']|info|@file_line_nr|@file_name"/> <!-- Match any attribute --> <xsl:template match="@*"> <xsl:copy> <xsl:apply-templates select="@*"/> </xsl:copy> </xsl:template> <!-- Match any element --> &l

Categories : Xml

What best way to populate java list with separate elements and elements from other lists?
You could at least introduce a loop: List<WebElement> containers = Arrays.asList(inetConnection, wiredConnection, phonesConnection, usbConnection, wifiConnection); List<WebElement> list = new LinkedList<WebElement>(containers); for (WebElement e : containers) list.addAll(e.getExpectedElements());

Categories : Java

Backbone Collection Set method remove existing elements and then add all elements
From the docs The set method performs a "smart" update of the collection with the passed list of models. If a model in the list isn't yet in the collection it will be added; if the model is already in the collection its attributes will be merged; and if the collection contains any models that aren't present in the list, they'll be removed. It is also a good idea to provide `idAttribute' to the model so that the collection identifies that based on the id. Otherwise the collection would not know if the model is a new one or not. So after setting the id and using set, you can see that is performs a smart update $(function () { var MyModel = Backbone.Model.extend({ // This attribute should be set as a default defaults: { Name: '' },

Categories : Backbone Js

extract elements from list of lists with variable number of elements and NAs R
So this can be marked as answered: SimonO101's solution (checking for NA values): lapply(mytestlist, function(x) { if( all(is.na(x)) ){ c(a=0,b=1,c=0) } else { x$nums } }) My solution (checking for named list elements): lapply(mytestlist, function(x) { if('nums' %in% names(x)) { x$nums } else { c(a=0, b=1, c=0) } })

Categories : R

Comparing class member array elements and main elements
Your canswers member is not a valid declaration. It is likely using an extension provided by your compiler to support the C flexible array member. This will act like a 0 sized array, and your access to the canswers variable are thus reading and writing beyond the object boundary, resultig in undefined behavior. You should either declare canswers with the right array size, or allow it to be a vector<char> or array<char, 20> instead. For vector<char>: class TestGrade { public: void setKey(char []); void grade(char []); std::vector<char> canswers; void display(); }; If you use vector<char>, you would need to change how you implement setKey(). void TestGrade::setKey(char answers[]) //setting values from "key" array in main { canswers.clear

Categories : C++

check if matrixs elements are all not equal or deferent elements
I recommend using the unique command. It will return the values of all unique values. If you want to check that all values in your matrix v are unique, I would use the following command: everything_is_unique = length(unique(v))==length(v); You can also return the indices of the equal elements. See the documentation on unique for more information.

Categories : Matlab

How do you expand all elements in the WebKit Inspector elements view?
Here's how i've decided to do it: Highlight the element tag I wish to inspect, if it's the whole (expand all) the requirement, then highlight <body> tag, click F2. Note: F2 is actually the shortcut for 'Toggle edit as HTML'. You can directly make any change in this mode, changes are reflected on web page. You may right-click within this new code view-window and enable/disable wordwrap.

Categories : Google Chrome

jQuery select elements only if they aren't nested within like elements
Try using the jQuery :not selector $('.a:not(.a .a)') http://jsfiddle.net/7E7Mk/1/

Categories : Javascript

How to make html elements fire effects on other elements using css
You can try this: .view-first { opacity: 0; /*more properties here*/} .myDiv:hover ~ .view-first{ -webkit-animation: boxanimation 1.5s; opacity: 1; -webkit-transition: all 0s; -webkit-animation-fill-mode: initial; /*more properties here*/} This will work for chrom and safary, for more broser you can set the -moz for firefox, and -o for opera

Categories : HTML

how to combine extjs graphical elements and easelJs elements
From a quick look at it, easel doesn't seem to pollute the global namespace, and nor does Ext4, so there is no reason they can't play well on the same page. I have tested this theory in this fiddle, and it indeed works. I hope the following code can get you started. It is using the html option of the window to create the canvas. Ext.define('EaselWindow', { extend: 'Ext.Window' ,html: '<canvas id="demoCanvas" width="500" height="300">' + 'alternate content' + '</canvas>' // The canvas markup will only be available after the window has rendered. // This is a useful protected method, but you could use a afterrender event instead. ,afterRender: function() { this.callParent(arguments); // The canvas is available to do easel s

Categories : Javascript

Check all tr elements for visibility:hidden between two same class tr elements
Try this - $('tr.header').each(function(){ if ($(this).nextUntil("tr.header").filter(function(){ return $(this).is(':visible'); }).length == 0){ $(this).hide(); } else { $(this).show() } });

Categories : Jquery

How to add elements from sublists with 2 elements (the first element is a string and the second one a number)?
You just need to break out the string versus the number: sum_fire( [[_,N]|Tail], Sum ) :- sum_fire( Tail, S1 ), Sum is N + S1. sum_fire( [], 0 ). So I'm using [_,N] instead of H for the head item because I want what's inside (the number N). I don't care about the string for the sum, so it's _.

Categories : Prolog

HTML Elements whose parent elements are transparent won't go opaque
Children can't have a higher opacity than their parents as their opacities multiply. You use could png backgrounds or rgba colors: http://css-tricks.com/rgba-browser-support/ div { background-color: rgba(255,255,255,0.5); }

Categories : HTML

HTML overlapping elements in absolute elements
Your problem is how the z-index stacking works. In this case, you actually need to put a z-index on #content that is higher than the z-index of #menu, as those two elements exist in the same stacking context. Two elements are only in the same stacking context if they are direct siblings. In this case, #content and #menu are siblings. You can z-index #content>.layoutOuter all you want but if the z-index of #menu is higher than the z-index of #content, #menu will display higher than it no matter the values.

Categories : HTML

Sequence contains no elements for Query with Multiple Elements Possible
If the sequence is empty and you iterate over it, nothing should happen, which is the semantic you usually want (and what you're looking for as well). What exactly is the iteration code you're using? A foreach shouldn't have any problems with an empty sequence.

Categories : C#

Float box to the right and let it overlap elements below static elements
without giving it too much thought, you could let it float and apply clear[left|right] - whichever suits your needs. Depending the surrounding rules, you may need to set clear also to the image, preferably with a value of [none]. That should let the image flow and the box float without either one getting in the way of the other.

Categories : CSS

How to fetch attribute value under elements/elements in xml using LINQ
To get the value attribute you can use the following: var foo = (from n in xml.Descendants("property") where n.Attribute("name").Value == "TestcaseId" select n.Attribute("value").Value).FirstOrDefault(); Gives: 70592

Categories : C#

How to change origin of elements based on another elements in ios
You could use the previous frame, since you are using [label1 sizeToFit]; Example below for label 2: UILabel *label2 =[[ UILabel alloc]init]; label2.frame=CGRectMake(10, label1.frame.origin.y+label1.frame.size.height+30, 10, 150); label2.text=@"Preferred Dress Style";

Categories : IOS

Get elements by name IE8 on different tab (Javascript)
If the website you are testing has access to jQuery you can use Coypu to populate specific fields in their respective forms: e.g. void PopulateInputField(int formName, string fieldName, string fieldValue) { browser.ExecuteScript(string.Format("$('form[name='{0}'] > input[name='{1}']).val('{2}')", formName, fieldName, fieldIndex)); } Note how the C# string passed to Coypu's ExecuteScript contains the jQuery.

Categories : C#

Javascript : How can I add X elements to an array
You are repeatedly setting j=2 every time the loop runs, and you never change nombre so the loop will never end. Note that JavaScript sets literal vaues by value, not by reference, so nombre = premier.length won't magically update. Additionally, statements of the form if( x = true) will set x to true, and then pass the condition automatically. In this case, since x is a function call, it is invalid syntax. Did you mean this? var j = 2; while(premier.length < 100) { if( isPrime(j)) premier.push(j); j++; }

Categories : Javascript

Using javascript to access li elements within ul
You could use either .prepend() or .append() Working Example $('ul.selectBox-options').prepend('<li>Hello World</li>'); $('ul.selectBox-options').append('<li>Good bye World</li>'); Post Re-title: Working Example 2 There are many ways to select an <li> within a <ul> here are a few: $("ul.selectBox-options li:contains('8.5')").css('background', 'purple'); $('ul.selectBox-options li').first().css('background', 'yellow'); $('ul.selectBox-options li').last().css('background', 'orange'); $('ul.selectBox-options li:nth-child(2)').css('background','red');

Categories : Javascript

Javascript DOM elements invalid CSS
I'm not an expert in jQuery (mobile), but I assume that the tooltip initializes before the DOM Elements are appended. If this is the case you should either append your elements before the tooltip chek the DOM tree, or more dynamically, which is more likely to be the usual use case, re-initialize the tooltips. Anyway I suggest checking the tooltip implementation if possible, to find the easiest, most efficent way to do.

Categories : Javascript

Tabindex on javascript elements
If I understand correctly, I think that you should be able to solve your problem by listening for the "focus" event on the dots and simulating a click on the dot when you receive it. There are several ways to do this, depending on what frameworks (if any) you are using. For example, if you are working with jQuery and the dots are identified by having the "dot" class: $('.dot').focus(function(e) { e.target.click(); } Here's a small test page that I put together - it seemed to work in both IE10 and Chrome: <html> <head> <script type="text/javascript"> function handleOnLoad() { var elems = document.getElementsByTagName("span"); var i; for (i = 0; i < elems.length; ++i) {

Categories : Javascript

Javascript tooltips for SVG elements
1) First off all you should use ';' ( style="fill:#9CAAC6;" ) in style attribute and every js code ( onmouseout="HideTooltip(evt);" ) 2) Change onmouseout="HideTooltip(evt)" to onmouseout="HideTooltip(evt); return false;" 3) I think that easy to use jquery instead native js I) Add an id for your shape(in your case rect) II) Make $('#rect_id').on('mouseover',function(e){ // do your stuff here }); $('#rect_id').on('mouseout',function(e){ // do your stuff here }); As an example take a look at http://jqvmap.com/. Tooltip implemented there as i wrote above.

Categories : Javascript

Javascript not removing all elements within a div
That's because you skip items while removing from the live nodelist. When you remove the item at index 0, the item which was at index 1 takes index 0, so you don't remove it as your iteration is already on index 1. Do it like this : function remove_inputs(){ var elements=document.getElementById('thediv').getElementsByTagName('input'); while(elements.length){ elements[0].parentNode.removeChild(elements[0]); } }

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.