selection

Select random string from given list

僤鯓⒐⒋嵵緔 提交于 2019-12-04 14:22:04
问题 I am trying to make Java select 1 random string from a given list. Example of the list of strings: 1153 3494 9509 2 0 0 0 0 1153 3487 9509 2 0 0 0 0 1153 3491 9525 2 0 0 0 0 1153 3464 9513 2 0 0 0 0 Each row is 1 string The idea is that it selects one, waits a certain period (like 7200 seconds) and replaces the previous string with another random string from the list (could be the same). The loop is sort of infinite. Does anyone knows how to do this? Ps. I am pretty much noobie with java :S,

R - Conditional lagging - How to lag a certain amount of cells until a condition is met?

南楼画角 提交于 2019-12-04 14:10:49
Been trying to solve this for weeks, but can't seem to get it. I have the following data frame : post_id user_id 1 post-1 user1 2 post-2 user2 3 comment-1 user1 4 comment-2 user3 5 comment-3 user4 6 post-3 user2 7 comment-4 user2 And want to create a new variable parent_id . So that for each observation it should perform the following steps: Check if post_id is either post or comment If post_id is post then parent_id should equal the earliest post_id of the whole data frame. If post_id is the first post then parent_id should equal NA If post_id is comment then parent_id should equal to the

How to get the selected element inside a contenteditable element

喜欢而已 提交于 2019-12-04 14:06:30
What I've tried I checked out this question , and this one , the problem is it gives me the content of the current selection, but I want the dom element instead. What I want to do I'm looking for a way to get the tagname of an element that is currently being edited with javascript. For example: <article contenteditable=true> <h2>Some List</h2> <ul> <li>Item 1</li> <li>Item *caret here* 2</li> <li>Item 3</li> </ul> </article> I want to be able to put the list item into a javascript el variable. So I that I can do for example: el.tagName el.className Does anyone know how to achieve this? Tx :)

How can I select multiple cells in tableview with javafx only by mouse?

余生颓废 提交于 2019-12-04 13:13:19
I have an application with a tableview in javafx and i want to select multiple cells only by mouse (something like the selection which exists in excel).I tried but i cant'n do something. The correct answer for this question is here https://community.oracle.com/thread/2621389 . 来源: https://stackoverflow.com/questions/21190333/how-can-i-select-multiple-cells-in-tableview-with-javafx-only-by-mouse

unicode implementation: many fonts, or one large font?

﹥>﹥吖頭↗ 提交于 2019-12-04 12:32:57
I'm internationalizing an application into many different languages, and the following languages must be supported: English Spanish German French Russian Mandarin Chinese Thai We're also probably going to add support for: Hindi Portuguese Any other language people at work speak and can translate easily Should I install different fonts for each language, or should I go with one massive font installation of Arial Unicode MS? And if I do the latter, are there any legal implications of adding the font into the installer? This problem is in .NET 3.5, but I think the general problem is (programming)

R multiple conditions in row selection of matrix [duplicate]

孤人 提交于 2019-12-04 11:52:41
This question already has answers here : Closed 6 years ago . Possible Duplicate: R: subset() logical-and operator for combining conditions should be & not && I have a simple question, but I don't know how to solve this... I want to select all rows where value_1 > 0 and value_2 > 0. Now I have this code: dataOnBoth<-data[data$value_1 > 0,][data$value_2 > 0,] When I head this data, ordering on log2_fold_change, I have This output: gene_id sample_1 sample_2 status value_1 value_2 log2_fold_change 86 uc001aen.1 q1 q2 NOTEST 0.0619347 0 -1.79769e+308 150 uc001ahx.1 q1 q2 NOTEST 0.0432199 0 -1

Remove need to click before typing when activating a range via a drawing-launched script

非 Y 不嫁゛ 提交于 2019-12-04 10:48:40
I am writing a simple script for a Google Sheet. I have a button labeled "New Entry" (the button is actually a drawing with my script assigned to it). When the user clicks the button, the script inserts an empty row at a specified location and activates the first column so that the user can begin typing. Everything works great except that after the script finishes, the keyboard doesn't work until after the user manually clicks in the sheet. The correct cell is visibly activated, but I suspect the focus is still (secretly) on the drawing . This theory is supported by the fact that if the user

window.getSelection() offset with HTML tags?

a 夏天 提交于 2019-12-04 09:26:16
If I have the following HTML: <div class="content"> Vivamus <span>luctus</span> urna sed urna ultricies ac tempor dui sagittis. </div> And I run an event on mouseup that sees the ranges of the selected text: $(".content").on("mouseup", function () { var start = window.getSelection().baseOffset; var end = window.getSelection().focusOffset; if (start < end) { var start = window.getSelection().baseOffset; var end = window.getSelection().focusOffset; } else { var start = window.getSelection().focusOffset; var end = window.getSelection().baseOffset; } console.log(window.getSelection()); console.log

Selection changes color when Firefox loses focus

戏子无情 提交于 2019-12-04 09:19:53
I'm setting the selection background color via CSS: ::selection { background:#cc0000; color:#fff; } ::-moz-selection { background:#cc0000; color:#fff; } On most browsers when the focus is somewhere else (like an IFrame), the selection color will stay the same, e.g.: but on Firefox it won't: You can see this in action on jsFiddle here . How can I get Firefox to set the selection color in this case? Is this a bug? How can I get Firefox to set the selection color in this case? Unfortunately, there doesn't appear to be a way to do so. Is this a bug? Nobody (including Mozilla themselves?) can say

Strange shift when Selecting text in richtext box v5 that contains hyperlinks

点点圈 提交于 2019-12-04 07:37:37
When I use the RichTextBox.Select(int start, int length) function to select text in a rich text box that contains hyperlinks, there is some shift in the selection when I try to select any text that is after the hyperlink. When I remove the hyperlink, the selection works properly. Edit: I use RichTextBox 5 (the default in Visual Studio is version 4) public class RichText50W : RichTextBox { [DllImport("kernel32.dll", CharSet = CharSet.Auto)] static extern IntPtr LoadLibrary(string lpFileName); protected override CreateParams CreateParams { get { CreateParams prams = base.CreateParams; if