selection

Select Top N Records Ordered by X, But Have Results in Reverse Order

一曲冷凌霜 提交于 2019-12-04 03:21:41
问题 I'm trying to get the top N records (when ordered by some column X), but have the result set in reverse order. The following statement is incorrect , but probably demonstrates what I'm after: SELECT * FROM (SELECT TOP 10 * FROM FooTable ORDER BY X DESC) ORDER BY X ASC For example, column X could be an ID or a timestamp; I want the latest 10 records but want them returned in forward chronological order. 回答1: SELECT * FROM (SELECT TOP 10 * FROM FooTable ORDER BY X DESC) as myAlias ORDER BY X

horizontal menu inflater on long click for web view

一曲冷凌霜 提交于 2019-12-04 03:15:32
问题 Hy, I am having a problem with the webview selection on longClick. I already had an implementation of a customized menu that launches on longClick. But the default menu is launching as well. I am trying to customize the default menu, but I'm not knowing how to capture the click of the user on an item. I have tried the following, but the menu is becoming vertical and hiding the selection, so I cannot select more words or change the selection. @Override public void onCreateContextMenu

Prevent selection being greyed out in iframe in Firefox without using contenteditable

╄→尐↘猪︶ㄣ 提交于 2019-12-04 00:45:59
In Firefox 3 and later (and probably older versions), selecting content within an iframe always seems to use the grey selection background colour used for a document that doesn't currently have focus, even if the iframe does have focus. The only exception I have been able to find is when the content within the iframe is editable. This is not the case in other browsers. Here's an example illustrating this: http://jsfiddle.net/97Vjz/ This unfortunately prevents styling the selection within an iframe using the ::-moz-selection CSS pseudo-element because it only applies to non-grey selections:

Java: Selected rows's index does not changes when sorted

。_饼干妹妹 提交于 2019-12-04 00:25:32
I have a Jtable on which I called the method table1.setAutoCreateRowSorter(true); . So this works on well. But I also have a methos in my JFrame class which is fired when i push a button. It gets the selected rows indexes using this code int selectedRows[] = this.table1.getSelectedRows(); . And displays an edit window for the first row corresponding in the selected interval. The problem is that if I don't click on column's headers (I mean i don't sorte them at all) my method works perfect. But when I sort the row, the indexes of the rows doesn't seems to change at all - thus resulting an edit

UIWebView Text Highlighting solution

萝らか妹 提交于 2019-12-03 21:25:32
Has anyone found a solution for highlighting user-selected blocks of text in a UIWebView? I have a partial solution in place, however I have been unable to get it to work when the selection includes multiple elements in the DOM. In that case, I can find and highlight the first element in the selection, but javascript seems unable to tell me where the end of the selection is in this case. It may be that I just don't understand the selection objects completely. It's difficult to find good documentation on them. Tim Down You can use document.execCommand("HiliteColor") . I answered a similar

Non-continuous selections in chrome?

孤者浪人 提交于 2019-12-03 20:44:56
问题 Update I recently discovered you can programatically create selections with Chrome which aren't continuous, by either replacing elements / textnodes inbetween in the parts you want unselected or hiding and then showing them. Example of non-continuous selections for Chrome: http://jsfiddle.net/niklasvh/YKJBW/ var t = $('div').contents().get(0); $.each(t.nodeValue.split(" "),function(i,e){ t = t.splitText(e.length); if (t.length>0){ t = t.splitText(1); } }); var c = $('div').contents(); $.each

How to return the kth element in TreeSet in Java

好久不见. 提交于 2019-12-03 19:17:33
问题 Maybe I am not using the right data structure. I need to use a set, but also want to efficiently return the kth smallest element. Can TreeSet in java do this? There seems no built-in method of TreeSet to do this. Please help me. 回答1: I don't believe that TreeSet has a method that directly does this. There are binary search trees that do support O(log n) random access (they are sometimes called order statistic trees ), and there are Java implementations of this data structure available. These

Get the selected text of a web page in google chrome extension

孤街浪徒 提交于 2019-12-03 17:22:07
I am developing a Google Chrome extension. When a popup is clicked, I would like the input box present in the popup.html file to contain the selected text of the current webpage. Example textbox: <input id="searchBox" type="text" /> When text is selected in a webpage, the textbox should contain the selected word. I tried with chrome.extension.getBackgroundPage().getSelection() but it is not working. There was a thread about this on google groups: how to get HTML code from selection? var selection = window.getSelection(); var range = selection.getRangeAt(0); if (range) { var div = document

Set spinner width to current item width

断了今生、忘了曾经 提交于 2019-12-03 16:57:01
By default the spinner width is set to fit the largest item in the dropdown but I want it to be the same width as the selected item. <android.widget.Spinner android:id="@+id/tab_spinner" android:layout_width="wrap_content" android:layout_height="match_parent" android:entries="@array/countries" /> As you can see in the right side image, the spinner is way too long, because of the long item in the list. How can I resize it to the selected item width ? By default, Spinner will try to measure some of your dropdown views and use the max width found. This happens in Spinner#measureContentWidth() , a

How to search pandas data frame by index value and value in any column

风格不统一 提交于 2019-12-03 16:39:17
I am trying to select data, read in from a file, represented by the values one and zero. I want to be able to select rows from a list of values and at the same time select for any column in which each of the selected rows has a value of one. To make it more complex I also want to select rows from a list of values where all values in a column for these rows is zero. Is this possible? Ultimately if another method besides pandas data frame would work better I would be willing to try that. To be clear, any column may be selected and I do not know which ones ahead of time. Thanks! You can use all()