Is there a case insensitive version of the :contains jQuery selector or should I do the work manually by looping over all elements and comparing their .text() to my string?
In ruby, how do I test that one array not only has the elements of another array, but contain them in that particular order?
correct_combination = [1, 2, 3, 4, 5]
[1, 5, 8, 2, 3, 4, 5].function_name(correct_combination) # => false
[8, 10, 1, 2, 3, 4, 5, 9].function_name(correct_combination) # => true
I tried using include, but that is used to test whether [1,2,3].include?(2) is true or not.
I have a multi-dimensional array that looks like this:
The base array is indexed based on category ids from my catalog.
$categories[category_id]
Each base array has two underlying elements:
['parent_category_id']
['sort_order']
I want to create a function that allows us to create a list of categories for a given parent_category_id in the correct sort order. Is this possible? Technically it is the same information, but the array is constructed in a weird way to extract that information.
Hi, I want to send the username and password values which user types in html input elements to server to check if the username and password is valid or not when user click login button, using post request in $.ajax(options) method in jquery, but I don't know how to send those username and password to server. What option should I write in $.ajax(options) method to get those values from server?
Is there any way to stop VS (specifically 2008) automatically inserting WebForms Ids in <asp: elements when pasting code into a view?
E.g. by default pasting this into a view:
<asp:Content ContentPlaceHolderID="TitleContent" runat="server"/>
</asp:Content>
Results, annoyingly, in this:
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"/>
</asp:Content>
I am trying to make a little application to allow to record actions within a Flash and Silverlight application. In such manner that you can compile your interactive application in test-mode and then be able to click on elements which then passed the action to Selenium IDE which then adds this command to the testcase.
I am curious if this even possible and how I can achieve this in Firefox?
I have some legacy html that needs to work on old and new browsers (down to IE7) as well as the iPad. The iPad is the biggest issues because of how text selection is handled. On a page there is a textarea as well as some text instructions. The instructions are in a <div> and the user needs to be able to select the instructions.
The problem is that once focus is placed in the textarea, the user cannot subsequently select the text instructions in the <div>. This is because the text cannot receive focus.
According to the Safari Web Content Guide: Handling Events (especially, "Making Elements Clickable"), you can add a onclick event handler to the div you want to receive focus.
This solution works (although it is not ideal) in iOS 6x but it does not work in iOS 5x.
Does anyone have a suggestion that minimizes changes to our existing code and produces consistant user interaction.
Here is sample code that shows the problem.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<!--
Resources:
Safari Web Content Guide: Handling Events (especially, "Making Elements Clickable")
http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW1
-->
</head>
<body>
<div style="width:550">
<div onclick='function() { void(0); }'>
<p>On the iPad, I want to be able to select this text after the textarea has had focus.</p>
</div>
<textarea rows="20" cols="80">After focus is in the textarea, can you select the text above?</textarea>
</div>
</body>
</html>
I need to determine if I'm on a particular view. My use case is that I'd like to decorate navigation elements with an "on" class for the current view. Is there a built in way of doing this?
I have a rather simple C++ project, which uses boost::regex library. The output I'm getting is 3.5Mb in size. As I understand I'm statically linking all boost .CPP files, including all functions/methods. Maybe it's possible somehow to instruct my linker to use only necessary elements from boost, not all of them? Thanks.
I don't now if this title is very clear, but I would like to understand how this is possible :
And how we can have 2 elements on the same row of the listview, and handle different clicks, as the listview deals with handling the click on a child.
Thanks for anyone who could point me in the right direction.
I am working on a custom CRM form with numerous checkboxes, organized by sections. I would like to implement a 'select all' feature to the form and am trying to understand how to format the JavaScript. My research thus far has pointed me to the possibility of using a FOR statement to iterate through all of the elements in the section I want to process, setting their values accordingly, but am unsure of which document.getElements ... method to utilize.
How do I ensure each and every field of my structures are initialized in GCC when using designated initializers? (I'm especially interested in function pointers.) (I'm using C not C++.)
Here is an example:
typedef struct {
int a;
int b;
} foo_t;
typedef struct {
void (*Start)(void);
void (*Stop)(void);
} bar_t;
foo_t fooo = {
5
};
foo_t food = {
.b=4
};
bar_t baro = {
NULL
};
bar_t bard = {
.Start = NULL
};
-Wmissing-field-initializers does not help at all. It works for fooo only in GCC (mingw 4.7.3, 4.8.1), and clang does only marginally better (no warnings for food and bard).
I'm sure there is a reason for not producing warnings for designated initializer (even when I explicitly ask for them) but I want/need them. I do not want to initialize structures based on order/position because that is more error prone (for example swapping Start and Stop won't even give any warning). And neither gcc nor clang will give any warning that I failed to explicitly initialize a field (when initializing by name). I also don't want to litter my code with if(x.y==NULL) lines for multiple reasons, one of which is I want compile time warnings and not runtime errors.
At least splint will give me warnings on all 4 cases, but unfortunately I cannot use splint all the time (it chokes on some of the code (fails to parse some C99, GCC extensions)).
Note: If I'm using a real function instead of NULL GCC will also show a warning for baro (but not bard).
I searched google and stack overflow but only found related questions and have not found answer for this specific problem.
The best match I have found is 'Ensure that all elements in a structure are initialized'
Ensure that all elements in a structure are initialized
Which asks pretty much the same question, but has no satisfying answer.
Is there a better way dealing with this that I have not mentioned?
(Maybe other code analysis tool? Preferably something (free) that can be integrated into Eclipse or Visual Studio...)
Hi,
I really like the idea of putting forms into a seperate class that manages validation etc, but I don't like everything ending up in a DL and also not being able to use square bracket notation in post elements like <input type='checkbox' name='data[]'>.
Is there another way of generating forms - like in views so I can style them the way I want, but also keeping the validation aspect? Also how would I load this view into my current view (using partial view somehow?)
I have a ListActivity and I want to implement context menu for each of the list elements. I know that the common way to do this is to show the context menu on long click/tap. I want to know if there is a way to show the context menu for each element on a key press(preferably the menu key).
To rephrase my question, how can I trigger the context menu and not the options menu by pressing the menu key(or any other key).
Hi,
Every time when I change some values in form controls, I need to set a property of an object or vice versa. Instead of writing some methods for each control, I want a general solution for GUI elements. I do not use WPF but only C# 3.0.
Any suggestions?
Thanks.
Hey all,
I'm practicing Jquery and I've written this simple Jquery statement:
var someText = $("table tr td").text();
Should this not return all text of td elements found within tr's that are found within tables? How do I fix this? Currently when I run this, it says that table tr td is null, but I have a table on the page I'm testing on.
Thanks!
Here is te code:
<?php
//Starting session
session_start();
//Includes mass includes containing all the files needed to execute the full script
//Also shows homepage elements without customs
require_once ('includes/mass.php');
$username = $_SESSION['username'];
if (isset($username))
{
//Query database for the users networths
$sq_l = "SELECT * FROM user";
$sql_query_worth = mysql_query($sq_l);
while ($row = mysql_fetch_assoc($sql_query_worth))
{
$dbusername = $row['username'];
}
echo $dbusername;
}
?>
It is possible to get the first element of the parameter pack like this
template <typename... Elements>
struct type_list
{
};
template <typename TypeList>
struct type_list_first_element
{
};
template <typename FirstElement, typename... OtherElements>
struct type_list_first_element<type_list<FirstElement, OtherElements...>>
{
typedef FirstElement type;
};
int main()
{
typedef type_list<int, float, char> list;
typedef type_list_first_element<list>::type element;
return 0;
}
but not possible to similary get the last element like this
template <typename... Elements>
struct type_list
{
};
template <typename TypeList>
struct type_list_last_element
{
};
template <typename LastElement, typename... OtherElements>
struct type_list_last_element<type_list<OtherElements..., LastElement>>
{
typedef LastElement type;
};
int main()
{
typedef type_list<int, float, char> list;
typedef type_list_last_element<list>::type element;
return 0;
}
with gcc 4.7.1 complaining:
error: 'type' in 'struct type_list_last_element<type_list<int, float, char>>' does not name a type
What paragraps from the standard describe this behaviour?
It seems to me that template parameter packs are greedy in a sense that they consume all matching arguments, which in this case means that OtherElements consumes all three arguments (int, float and char) and then there is nothing left for LastElement so the compilation fails. Am i correct in the assumption?
EDIT:
To clarify: I am not asking how to extract the last element from the parameter pack, i know how to do that. What i actually want is to pick the pack apart from the back as opposed to the front, and as such recursing all the way to the back for each element would be ineffective. Apparentely reversing the sequence beforehand is the most sensible choice.
Most HTML elements have style properties associated with them - such a "color", "font-size" and "padding". These style properties have default values. For example the "color" style property associated with the "a" (anchor) element seems to have a default value of "#000066".
What are the default style properties values fo in HTML?
Is there a way to Specify a OneWay Binding in HandleBars? bind-attr always calls Ember.bind, which always create a two way binding. This seems to be the case for elements that don't even change:
<img {{bind-attr class=":class-name-to-always-apply"}}>
But even in cases where the element could change, we might have reasons to update it manually (e.g. performance or we don't want to change it on textChanged, but do it manually)
I am trying to install balder - the carrier wave tree
i am getting some errors including:
not seeing the form elements for adding photos.
getting an error message "command exiftool not found"
I think I've installed all the gems and software already.
Anyone here good with troubleshooting code? also - i've got some screenshots handy if you need them. stackoverflow wont let me post images yet :/
also, are there any other alternative photo galleries written for ROR?
Hi all, would the following Jquery selector get all of the 4th td elements of all the tables on the current page, and return their text as an array?:
var isbn = $.makeArray($("table tr td:nth-child(4)").text());
I'm using jQuery to hide and show elements when a radio button group is altered/clicked. It works fine in browsers like Firefox, but in IE 6 and 7, the action only occurs when the user then clicks somewhere else on the page.
To elaborate, when you load the page, everything looks fine. In Firefox, if you click a radio button, one table row is hidden and the other one is shown immediately. However, in IE 6 and 7, you click the radio button and nothing will happen until you click somewhere on the page. Only then does IE redraw the page, hiding and showing the relevant elements.
Here's the jQuery I'm using:
$(document).ready(function(){
$(".hiddenOnLoad").hide();
$("#viewByOrg").change(function () {
$(".visibleOnLoad").show();
$(".hiddenOnLoad").hide();
});
$("#viewByProduct").change(function () {
$(".visibleOnLoad").hide();
$(".hiddenOnLoad").show();
});
});
Here's the part of the XHTML that it affects. Apologies if it's not very clean, but the whole page does validate as XHTML 1.0 Strict:
<tr>
<td>View by:</td>
<td>
<p>
<input type="radio" name="viewBy" id="viewByOrg" value="organisation" checked="checked"/>
Organisation
</p>
<p>
<input type="radio" name="viewBy" id="viewByProduct" value="product"/>
Product
</p>
</td>
</tr>
<tr class="visibleOnLoad">
<td>Organisation:</td>
<td>
<select name="organisation" id="organisation" multiple="multiple" size="10">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
</td>
</tr>
<tr class="hiddenOnLoad">
<td>Product:</td>
<td>
<select name="product" id="product" multiple="multiple" size="10">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
</select>
</td>
</tr>
If anyone has any ideas why this is happening and how to fix it, they would be very much appreciated!
Hi
I have set Mouse Events on a canvas as follows
MouseUp="CanvasUp" MouseDown="CanvasDown" MouseMove="CanvasMove"
But these are active only on the child elements like Images and Rectangles, but not on the empty space.
Please tell me how to solve
Thanks