qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
8,169
I remember reading a book in the 70s, so it could be YA. It is set on modern-day Earth, and the story is about a boy. His mother is sick (maybe cancer?) and he is socially awkward, so he doesn't have much self-esteem. He stumbles upon an old building (maybe a barn?) and somehow meets a person/creature who tells him tha...
2011/12/24
[ "https://scifi.stackexchange.com/questions/8169", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3929/" ]
Data seems the most able to fill that role given that he is shown to clean house with the players in "Time's Arrow". He mentions at some point during the series that he initially memorized virtually every book on the subject but found that the actual game was different than the mere "book" knowledge. Given that he can ...
Data would have to be thrown in there-as a machine of his capability, memorizing and watching where the cards are shuffled would guarantee he knows which card is where at all times.
8,169
I remember reading a book in the 70s, so it could be YA. It is set on modern-day Earth, and the story is about a boy. His mother is sick (maybe cancer?) and he is socially awkward, so he doesn't have much self-esteem. He stumbles upon an old building (maybe a barn?) and somehow meets a person/creature who tells him tha...
2011/12/24
[ "https://scifi.stackexchange.com/questions/8169", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3929/" ]
* If you mean, the luckiest, TVTropes has this to say: > > Whenever a poker game is shown in Star Trek: The Next Generation, you can bet that Riker will always turn out with a possible straight that he's bluffing about. Whether or not the bluff is called, though, depends on which would be more dramatically convenient...
Riker, Geordi, Troi, and Data all have bonuses going for them: * Riker is great at bluffing, and has rather good luck * Geordi could see through the back of the cards * Troi is an empath, and can generally tell when someone is bluffing * Data has memorized an immense number of games and can easily calculate probabilit...
8,169
I remember reading a book in the 70s, so it could be YA. It is set on modern-day Earth, and the story is about a boy. His mother is sick (maybe cancer?) and he is socially awkward, so he doesn't have much self-esteem. He stumbles upon an old building (maybe a barn?) and somehow meets a person/creature who tells him tha...
2011/12/24
[ "https://scifi.stackexchange.com/questions/8169", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3929/" ]
* If you mean, the luckiest, TVTropes has this to say: > > Whenever a poker game is shown in Star Trek: The Next Generation, you can bet that Riker will always turn out with a possible straight that he's bluffing about. Whether or not the bluff is called, though, depends on which would be more dramatically convenient...
Data would have to be thrown in there-as a machine of his capability, memorizing and watching where the cards are shuffled would guarantee he knows which card is where at all times.
8,169
I remember reading a book in the 70s, so it could be YA. It is set on modern-day Earth, and the story is about a boy. His mother is sick (maybe cancer?) and he is socially awkward, so he doesn't have much self-esteem. He stumbles upon an old building (maybe a barn?) and somehow meets a person/creature who tells him tha...
2011/12/24
[ "https://scifi.stackexchange.com/questions/8169", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/3929/" ]
Riker, Geordi, Troi, and Data all have bonuses going for them: * Riker is great at bluffing, and has rather good luck * Geordi could see through the back of the cards * Troi is an empath, and can generally tell when someone is bluffing * Data has memorized an immense number of games and can easily calculate probabilit...
Data would have to be thrown in there-as a machine of his capability, memorizing and watching where the cards are shuffled would guarantee he knows which card is where at all times.
10,820
I have written the following get/set for a username which is stored in local Storage. Do you think this "buys" me anything or even perhaps has major disadvantages? I have never liked relying on global variables so I figured the getter and setter would be tidier and more maintainable. ``` var namespace = {}; namespac...
2012/04/12
[ "https://codereview.stackexchange.com/questions/10820", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/8528/" ]
I think this is a matter of taste, I don't see any major disadvantages but no major advantages either. In these cases I would err on the side of simplicity and go with querying localStorage directly. Now to fully whet my morning CR.SE appetite let's get really nitpicky: * Pros + It will make it marginally easier to...
George Mauer already provided a wonderful answer I totally agree with him. I have only one focus in this review and that is speed. --- Your code is very slow/not very efficient right now, even though it may not totally seem like it. This is because you are interacting with `localStorage` too much, and interacting wit...
227,021
Converting words to morse code and vice versa using dictionaries and that's it. ``` morse_code = {'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', ...
2019/08/28
[ "https://codereview.stackexchange.com/questions/227021", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/203338/" ]
The question could benefit from some context. You don't need to answer every one of the following, but it would be helpful for reviewers. 1. Why have you written a morse code converter? 2. Is this going to be used by anyone else or is it a personal project? Is it a homework question? From this we can tell if the revie...
``` if __name__ == '__main__': ``` use this guard that allows you to import from this script without running the code. ``` if __name__ == '__main__': print(convert_to_morse_code('HI MICHAEL')) print(convert_to_word('.... .. -- .. -.-. .... .- . .-..')) ``` Style ===== check PEP0008 <https://www.python.o...
3,563,941
I have a simple app that consists of: **Model** * Items * Filter criteria applied to that list of items **Views** * WelcomePage * MainItemsPage * FilterEditPage I am using MVVM Light and Windows Phone 7 I currently have 3 ViewModels, one for each View. In the past I have had a single ViewModel which made the comu...
2010/08/25
[ "https://Stackoverflow.com/questions/3563941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/63286/" ]
You can use [contains](http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/DisplayObjectContainer.html#contains%28%29) method > > `public function contains(child:DisplayObject):Boolean` > > Determines whether the specified display object is a child of the `DisplayObjectContainer` instance or t...
``` var mc:MovieClip; while (mc.parent != null && mc.parent != targetParent) { mc = mc.parent; } ```
16,367,346
I have a JPanel with many objects, and one main action that can be performed: a calculation. There is a button to do this, but also a JTextField and other components in which the user might want to press enter in. For example, if you are selecting something from a JComboBox and press enter, the calculation will happen....
2013/05/03
[ "https://Stackoverflow.com/questions/16367346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2274782/" ]
`JPanel` extends `JComponent`, that inherits `Container`. You can use `getComponents()`. You get a `Component[]` array, which you can loop through and add for each component, that is a subclass of `Component` like `Button`, and add the same `ActionListener` for each component. See <http://docs.oracle.com/javase/6/docs/...
@cinhtau has the right approach. It's made a bit more difficult by the fact that there is no common type that has an 'addActionListener' method. You have to check for each case that you want to add the action listener for. ``` public static void addActionListenerToAll( Component parent, ActionListener listener ) { ...
16,367,346
I have a JPanel with many objects, and one main action that can be performed: a calculation. There is a button to do this, but also a JTextField and other components in which the user might want to press enter in. For example, if you are selecting something from a JComboBox and press enter, the calculation will happen....
2013/05/03
[ "https://Stackoverflow.com/questions/16367346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2274782/" ]
`JPanel` extends `JComponent`, that inherits `Container`. You can use `getComponents()`. You get a `Component[]` array, which you can loop through and add for each component, that is a subclass of `Component` like `Button`, and add the same `ActionListener` for each component. See <http://docs.oracle.com/javase/6/docs/...
thats what i did right now and it worked ``` private void setActionListeners() { for (Component c : this.getComponents()){ if (c.getClass() == JMenuItem.class){ JMenuItem mi = (JMenuItem) c; mi.addActionListener(this); } if (c.getClass() == JC...
51,134,864
Using jquery I want to do the following: If a div contains more than 300 (text) characters then hide a particular link outside the div.
2018/07/02
[ "https://Stackoverflow.com/questions/51134864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9437931/" ]
You need to check the length of the text of the `div`: ``` if($('div').text().trim().length > 300) { // stuff here // like: // $('#linkOutsideDiv').hide() } ```
```js $(document).ready(function(){ alert($('#divtext').text().length) if($('#divtext').text().length>300) { $('#link').hide() } }) ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="divtext">asssssssssssssssssssssssssssssddddddddddddddddddddddddddddddd...
51,134,864
Using jquery I want to do the following: If a div contains more than 300 (text) characters then hide a particular link outside the div.
2018/07/02
[ "https://Stackoverflow.com/questions/51134864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9437931/" ]
You mean smth like this: as an example hide when more than 5 symbols (you can change number)? ```js $(document).ready(function() { if($('#test-div').text().length > 5) { $('a').hide(); } }); ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="test...
```js $(document).ready(function(){ alert($('#divtext').text().length) if($('#divtext').text().length>300) { $('#link').hide() } }) ``` ```html <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="divtext">asssssssssssssssssssssssssssssddddddddddddddddddddddddddddddd...
3,848
I was recently investigating some statistics related to the music industry and came across some interesting information that I was not aware of (though I should have been). I started to post a question on H:SE asking for verification of what I found but further searches turned up some additional sources which verified ...
2018/11/15
[ "https://history.meta.stackexchange.com/questions/3848", "https://history.meta.stackexchange.com", "https://history.meta.stackexchange.com/users/33089/" ]
[Self-answered questions](https://history.stackexchange.com/help/self-answer) are fine on Stack Exchange, subject to the usual caveats about being on-topic for the site .etc. You simply click the checkbox that says "Answer your own question" at the bottom of the Ask Question page: ![Question and checkbox](https://i.s...
Sempaiscuba is right that in general there's nothing wrong with doing this. However, for me at least here on this site, I've had some practical problems with that in the past. If you post the correct answer with the question, the problem is that there's no real point in anyone else posting an answer. From my POV as a...
8,843,867
I wonder how to validate the locals passed to render template in controller Controller: ``` def lelf_panel # ... if some_condition locals_hash = some_very_long_hash_A else locals_hash = some_very_long_hash_B end render :partial => "left_panel", :layout => false, :locals => locals_hash end ``` Curr...
2012/01/12
[ "https://Stackoverflow.com/questions/8843867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430376/" ]
Instead of using the `render_template` matcher, you can use an expectation on the controller object. ``` it 'should render correct template for lefl_panel' do # ... allow(controller).to receive(:render).with no_args expect(controller).to receive(:render).with({ :partial => 'system/_left_panel', :layout ...
as far as I know, there is no way to directly examine the locals for a template in the way you're describing. You could change locals\_hash to @locals\_hash and then examine the results through assigns( :locals\_hash). Or, you could use selectors on the resulting HTML and check that some indicative content is there -...
8,843,867
I wonder how to validate the locals passed to render template in controller Controller: ``` def lelf_panel # ... if some_condition locals_hash = some_very_long_hash_A else locals_hash = some_very_long_hash_B end render :partial => "left_panel", :layout => false, :locals => locals_hash end ``` Curr...
2012/01/12
[ "https://Stackoverflow.com/questions/8843867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430376/" ]
as far as I know, there is no way to directly examine the locals for a template in the way you're describing. You could change locals\_hash to @locals\_hash and then examine the results through assigns( :locals\_hash). Or, you could use selectors on the resulting HTML and check that some indicative content is there -...
Same as @ryan-ahearn 's answer with suggestions from @user2490003 's comment - but all put into something more flexible and for RSpec 3. ``` # Safe to set globally, since actions can either render or redirect once or fail anyway before do allow(controller).to receive(:render).and_call_original end describ...
8,843,867
I wonder how to validate the locals passed to render template in controller Controller: ``` def lelf_panel # ... if some_condition locals_hash = some_very_long_hash_A else locals_hash = some_very_long_hash_B end render :partial => "left_panel", :layout => false, :locals => locals_hash end ``` Curr...
2012/01/12
[ "https://Stackoverflow.com/questions/8843867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430376/" ]
Instead of using the `render_template` matcher, you can use an expectation on the controller object. ``` it 'should render correct template for lefl_panel' do # ... allow(controller).to receive(:render).with no_args expect(controller).to receive(:render).with({ :partial => 'system/_left_panel', :layout ...
Same as @ryan-ahearn 's answer with suggestions from @user2490003 's comment - but all put into something more flexible and for RSpec 3. ``` # Safe to set globally, since actions can either render or redirect once or fail anyway before do allow(controller).to receive(:render).and_call_original end describ...
2,470,085
I was wondering if anyone had any insight on how to prove the following identity: > > For all $m \in \mathbb{N}$ $$ \frac{1}{2m-1} + \frac{2m-2}{(2m-1)(2m-3)} + \frac{(2m-2)(2m-4)}{(2m-1)(2m-3)(2m-5)} + \cdots + \frac{(2m-2)!!}{(2m-1)!!} = 1$$ > > > I attempted to rewrite and simplify the left hand side as: $$ \s...
2017/10/13
[ "https://math.stackexchange.com/questions/2470085", "https://math.stackexchange.com", "https://math.stackexchange.com/users/416103/" ]
$$\scriptsize\begin{align} &\;\;\;\frac 1{2m-1}+\frac {2m-2}{(2m-1)(2m-3)}+\frac{(2m-2)(2m-4)}{(2m-1)(2m-3)(2m-5)}+\cdots+\frac {(2m-2)!!}{(2m-1)!!}\\\\ &=\frac 1{2m-1}\left(1+\frac {2m-2}{2m-3}\left(1+\frac {2m-4}{2m-5}\left(1+\;\;\cdots\;\;\ \left(1+\frac 65\left(1+\frac 43\left(1+\frac 21\right)\right)\right)\right)...
I believe this can be proven combinatorially by recasting it as $$(2m-3)!! + (2m-2)(2m-5)!! + (2m-2)(2m-4)(2m-7)!! + \cdots + (2m-2)!! = (2m-1)!!$$ To do this, we note that $(2m-1)!!$ counts the number of perfect matchings of the complete graph $K\_{2m}$. Label the vertices of $K\_{2m}$ with the integers $1 \ldots 2m$...
2,470,085
I was wondering if anyone had any insight on how to prove the following identity: > > For all $m \in \mathbb{N}$ $$ \frac{1}{2m-1} + \frac{2m-2}{(2m-1)(2m-3)} + \frac{(2m-2)(2m-4)}{(2m-1)(2m-3)(2m-5)} + \cdots + \frac{(2m-2)!!}{(2m-1)!!} = 1$$ > > > I attempted to rewrite and simplify the left hand side as: $$ \s...
2017/10/13
[ "https://math.stackexchange.com/questions/2470085", "https://math.stackexchange.com", "https://math.stackexchange.com/users/416103/" ]
$$\scriptsize\begin{align} &\;\;\;\frac 1{2m-1}+\frac {2m-2}{(2m-1)(2m-3)}+\frac{(2m-2)(2m-4)}{(2m-1)(2m-3)(2m-5)}+\cdots+\frac {(2m-2)!!}{(2m-1)!!}\\\\ &=\frac 1{2m-1}\left(1+\frac {2m-2}{2m-3}\left(1+\frac {2m-4}{2m-5}\left(1+\;\;\cdots\;\;\ \left(1+\frac 65\left(1+\frac 43\left(1+\frac 21\right)\right)\right)\right)...
Starting from $$\sum\_{k=1}^m \frac{(2m-2)!!/(2m-2k)!!}{(2m-1)!!/(2m-2k-1)!!}$$ and using $$(2n)!! = 2^n n! \quad\text{and}\quad (2n-1)!! = \frac{(2n)!}{2^n n!}$$ we get for the sum $$\sum\_{k=1}^m \frac{2^{m-1} (m-1)!}{2^{m-k} (m-k)!} \frac{(2m-2k)! / 2^{m-k} / (m-k)!}{(2m)! / 2^{m} / m!} \\ = \frac{(m-1)! m!}{(2...
21,687,170
I would like my app to appear in the `UIActivityViewController` for text, in other apps. For example, when sharing from the Notes app as shown below. ![enter image description here](https://i.stack.imgur.com/WXQ7V.png) Adding the following to the Info.plist didn't produce any visible results (in Notes, Evernote and S...
2014/02/10
[ "https://Stackoverflow.com/questions/21687170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143378/" ]
Short answer: you can't. Currently, you cannot add your app into other `UIActivityViewControllers`, unless you create your own UTI and the app ( Notes, Evernote and Simplenote) add code into their app to show yours. What you are likely referring to, though, is the `UIDocumentInteractionController`, which is differen...
You're `plist` is wrong, see this answer: [Why is my iOS app not showing up in other apps' "Open in" dialog?](https://stackoverflow.com/questions/9266079/why-is-my-ios-app-not-showing-up-in-other-apps-open-in-dialog) but to me it looks like you haven't yet set the `LSHandlerRank`in your `plist`. Also: make sure you fo...
371,611
I solved the problem by using a known series: $\frac{1}{\sqrt{1-x^2}}$, but the solution I got is wrong. Also, I'm not sure what to do with the constant of integration $C$. Where is my mistake? $$ \frac{1}{\sqrt{1-x^2}} = 1 + \frac{x^2}{2} + \frac{3x^4}{8} + \frac{5x^6}{16} +... $$ $$ \int\frac{1}{\sqrt{1-x^2}}dx = \i...
2013/04/24
[ "https://math.stackexchange.com/questions/371611", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
You did a great job: Just small mistakes. 1. To find constant of integration, substitute known value of $\arcsin(x)$, $x=0$ is a good choice. You need to have a well defined interval while dealing with inverse trigonometric functions. 2. The formula to integrate is $$\int x^n \, dx=\frac{x^{n+1}}{n+1}$$
You're integrating the right hand side incorrectly. The integral of $\dfrac{x^2}{2}$ isn't $\dfrac{2x^3}{3}$, it's $\dfrac{x^3}{2\cdot 3} = \dfrac{x^3}{6}.$ :)))
68,774,292
Suppose you have a list class like ``` class Words : List<Word> { ... } ``` and suppose you want to create one of these from an `IEnumerable<Word>` with a function like: ``` public static TList ToTypedList<TList, T>(this IEnumerable<T> list) where TList : IList<T>, new() { var listTyped = new TList(); foreac...
2021/08/13
[ "https://Stackoverflow.com/questions/68774292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349974/" ]
In C#, there is no way to use only one type parameter and keep type safety (excluding solutions using Reflection). Just add a constructor to the `Words` class having an `IEnumerable<Word>` parameter and pass it to the base constructor (`List<T>` happens to have such a [constructor](https://learn.microsoft.com/en-us/do...
I agree with Olivier, that's the cleanest way. But if you would insist on a general extension method, you'll lose the type check for the inner elements. Try this: ``` public static TList ToTypedList<TList>(this IEnumerable list) where TList : IList, new() { TList result = new TList(); foreach (var element in ...
42,495,670
I'm have C++ and Java background. I'm having some trouble understanding function calling in JavaScript. Below is my code example, I declared variable lon and lat #4. and assign it value on line #5 and #6. Here is my question, I made a call to writeToTes() on #1 and it worked. But when I placed writeToTes() on #2 or ...
2017/02/27
[ "https://Stackoverflow.com/questions/42495670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6772698/" ]
It's because `getCurrentPosition()` is an asynchronous operation. The function you pass to `getCurrentPosition()` is called a callback function. Any code put into this function is executed after the current position is retrieved. When you place `writeToTest()` after the call to `getCurrentPosition()`, it is executed B...
It is like adding an `eventhandler` on a button click. The `eventhandler` will only fire once the button is clicked. In this case, your `eventhandler`, or `callback`, is invoked when you get a geolocation. You callback has the position which contains your `lat` and `lon` data.
14,345,697
How can I parse ul elements in a HTML document with a specific class type using Java? I want to pars this section from HTML: ``` <ul class="news-list"> <li> <a onclick="AjaxStatManager('Content','1258')" href="http://www.gyte.edu.tr/icerik/120/1258/kim-101-final-mazeret-sinavi....
2013/01/15
[ "https://Stackoverflow.com/questions/14345697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614065/" ]
You could load it into a [Document](http://docs.oracle.com/javase/1.4.2/docs/api/org/w3c/dom/Document.html) object. This will read in the HTML for you and you can iterate/query using available methods.
I think it is work for an XPATH query. ``` XPath xpath = XPathFactory.newInstance().newXPath(); String expression= "//ul[@class = 'news-list']"; InputSource inputSource = new InputSource("your.html"); NodeSet nodes = (NodeSet) xpath.evaluate(expression, inputSource, XPathConstants.NODESET); ```
14,345,697
How can I parse ul elements in a HTML document with a specific class type using Java? I want to pars this section from HTML: ``` <ul class="news-list"> <li> <a onclick="AjaxStatManager('Content','1258')" href="http://www.gyte.edu.tr/icerik/120/1258/kim-101-final-mazeret-sinavi....
2013/01/15
[ "https://Stackoverflow.com/questions/14345697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/614065/" ]
You could load it into a [Document](http://docs.oracle.com/javase/1.4.2/docs/api/org/w3c/dom/Document.html) object. This will read in the HTML for you and you can iterate/query using available methods.
Here is the JSoup solution: ``` try { Document doc = Jsoup.parse(new URL("http://www.gyte.edu.tr/kategori/120/0/duyurular.aspx"), 1000000); Elements elements = doc.getElementsByAttributeValue("class", "news-list"); System.out.println(elements.size()); for (Element e : elements) { System.out.pr...
46,139,573
I declare a global variable `pos`, anyway the method `printArr()` doesn't see it. The interpreter says: `undifined variable pos`. Why? Thanks ``` import nltk class Analyzer(): """Implements sentiment analysis.""" def __init__(self, positives, negatives): global pos global neg positiv...
2017/09/10
[ "https://Stackoverflow.com/questions/46139573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8578959/" ]
Maybe you should check your `MainApp` component, eg, the render function of it.
May be html tag isn't on the DOM where ng-app or ng-... (container) got a problem of writing and doesn't target the dom for output?
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
What about this? ```none $ sed -r 's/ ([^ ]*)$/-\1/' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ``` * `([^ ]*)$` catches space + "anything not being a space up to the end of line". * `-\...
Your attempt was close. You just needed to capture everything before the space and needed a backslash reference in the replacement. Not sure why you escaped the space and hyphen, though. ``` sed -r 's/(.*) /\1-/g' inputfile ``` For your input, it produces: ``` Carlton-3053 Carlton North-3054 Docklands-3008 East Mel...
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
What about this? ```none $ sed -r 's/ ([^ ]*)$/-\1/' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ``` * `([^ ]*)$` catches space + "anything not being a space up to the end of line". * `-\...
You know how to replace the first space, right? ``` rev inputfile | sed 's/ /-/' | rev ```
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
What about this? ```none $ sed -r 's/ ([^ ]*)$/-\1/' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ``` * `([^ ]*)$` catches space + "anything not being a space up to the end of line". * `-\...
Here is an `awk` variation: ```none awk '{$NF="-"$NF;sub(/ -/,"-")}1' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ```
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
What about this? ```none $ sed -r 's/ ([^ ]*)$/-\1/' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ``` * `([^ ]*)$` catches space + "anything not being a space up to the end of line". * `-\...
The following also works on OSX since `sed -r` is not available there: ``` sed 's/\(.*\) /\1-/' file_containing_your_text.txt ```
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
Your attempt was close. You just needed to capture everything before the space and needed a backslash reference in the replacement. Not sure why you escaped the space and hyphen, though. ``` sed -r 's/(.*) /\1-/g' inputfile ``` For your input, it produces: ``` Carlton-3053 Carlton North-3054 Docklands-3008 East Mel...
Here is an `awk` variation: ```none awk '{$NF="-"$NF;sub(/ -/,"-")}1' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ```
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
Your attempt was close. You just needed to capture everything before the space and needed a backslash reference in the replacement. Not sure why you escaped the space and hyphen, though. ``` sed -r 's/(.*) /\1-/g' inputfile ``` For your input, it produces: ``` Carlton-3053 Carlton North-3054 Docklands-3008 East Mel...
The following also works on OSX since `sed -r` is not available there: ``` sed 's/\(.*\) /\1-/' file_containing_your_text.txt ```
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
You know how to replace the first space, right? ``` rev inputfile | sed 's/ /-/' | rev ```
Here is an `awk` variation: ```none awk '{$NF="-"$NF;sub(/ -/,"-")}1' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ```
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
You know how to replace the first space, right? ``` rev inputfile | sed 's/ /-/' | rev ```
The following also works on OSX since `sed -r` is not available there: ``` sed 's/\(.*\) /\1-/' file_containing_your_text.txt ```
22,862,083
So I have the following file: ``` Carlton 3053 Carlton North 3054 Docklands 3008 East Melbourne 3002 Flemington 3031 Kensington 3031 Melbourne 3000 Melbourne 3004 North Melbourne 3051 St Kilda East 3183 ``` I want to replace the last space just before the numbers with a hyphen, this is the closest I've got ``` cat ...
2014/04/04
[ "https://Stackoverflow.com/questions/22862083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1233777/" ]
Here is an `awk` variation: ```none awk '{$NF="-"$NF;sub(/ -/,"-")}1' file Carlton-3053 Carlton North-3054 Docklands-3008 East Melbourne-3002 Flemington-3031 Kensington-3031 Melbourne-3000 Melbourne-3004 North Melbourne-3051 St Kilda East-3183 ```
The following also works on OSX since `sed -r` is not available there: ``` sed 's/\(.*\) /\1-/' file_containing_your_text.txt ```
12,416,833
I have a class setup in my style sheet for the UI, and a preferences section where the user can use a color-picker to style the page. The values are stored in the db as hex, but when I use those values to update the page via jQuery: ``` $nav.css("background-color", button_bg_color) ``` I lose the NEW :hover colors. ...
2012/09/14
[ "https://Stackoverflow.com/questions/12416833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1222715/" ]
There's a problem here, "Javascript doesn’t support getting or setting the attributes of pseudo selectors, meaning that you cannot get the :hover css style directly." [[source]](http://www.roslindesign.com/2011/05/04/detecting-the-hover-css-selector-style-in-jqueryjavascript/) JQuery, does however have a [.hover() fun...
`:hover` cannot be used in that way as a selector. The idea of a selector is that jquery will find all elements on the page which **currently** match the selector. Though `:hover` I beleive is not a valid selector at all, if it was, the idea would be to find all elements which were **currently** hovered on, as that is ...
10,601,556
All pages that have session\_start() on the page have suddenly stopped loading and it's been working for years like this. Even the host is unsure of what to do, looking for advise. A sample test page with the following code also failed: ``` error_reporting(1); if(!$_REQUEST['disable']=="yes") { session_start(); } ec...
2012/05/15
[ "https://Stackoverflow.com/questions/10601556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1396252/" ]
Looks like you'll need a combination of [MIME::Base64](https://metacpan.org/module/MIME%3a%3aBase64) and [MCrypt](https://metacpan.org/module/Mcrypt).
There is a package in cpan .. MCrypt <http://search.cpan.org/perldoc?MCrypt> Check this out
21,927,713
please help change the type number double -> int. ie I need to drop the fractional part, but do not use split () ``` import time date = time.ctime(int('1223.435'.split('.')[0])) ```
2014/02/21
[ "https://Stackoverflow.com/questions/21927713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3218592/" ]
Convert to float, then convert to int. ``` >>> int(float('1223.435')) 1223 ```
Partition number string by dot character: ``` import time date = time.ctime(int('1223.435'.partition('.')[0])) ```
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
You can't. If you need that functionality you should [file](http://bugreporter.apple.com/) a feature request with Apple, but I suspect it is a hardware limitation that in the screen controller.
As far as Android is concerned, right now I don't believe there's multi-touch support due to Google having removed support for it as per Apple's request.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
I would guess that 5 fingers is the upper limit. I imagine the engineers assumed most people have two hands with five fingers per hand, so the average person holding the phone in one hand only has five fingers to work with. Holding your phone with just your thumbs seems precarious at best, so using it as a trumpet see...
I have no idea if it would work on Android, but there will be an upper limit for the number of simultaneous touches that you can have. Future iPhones/iPods may up that limit, but it's not defined and you shouldn't assume that you can handle more than a few realistically.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
I would guess that 5 fingers is the upper limit. I imagine the engineers assumed most people have two hands with five fingers per hand, so the average person holding the phone in one hand only has five fingers to work with. Holding your phone with just your thumbs seems precarious at best, so using it as a trumpet see...
Just a note: the iPad can recognize 11 touches.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
You can't. If you need that functionality you should [file](http://bugreporter.apple.com/) a feature request with Apple, but I suspect it is a hardware limitation that in the screen controller.
I have no idea if it would work on Android, but there will be an upper limit for the number of simultaneous touches that you can have. Future iPhones/iPods may up that limit, but it's not defined and you shouldn't assume that you can handle more than a few realistically.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
Just a note: the iPad can recognize 11 touches.
As far as Android is concerned, right now I don't believe there's multi-touch support due to Google having removed support for it as per Apple's request.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
I would guess that 5 fingers is the upper limit. I imagine the engineers assumed most people have two hands with five fingers per hand, so the average person holding the phone in one hand only has five fingers to work with. Holding your phone with just your thumbs seems precarious at best, so using it as a trumpet see...
As far as Android is concerned, right now I don't believe there's multi-touch support due to Google having removed support for it as per Apple's request.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
You can't. If you need that functionality you should [file](http://bugreporter.apple.com/) a feature request with Apple, but I suspect it is a hardware limitation that in the screen controller.
I would guess that 5 fingers is the upper limit. I imagine the engineers assumed most people have two hands with five fingers per hand, so the average person holding the phone in one hand only has five fingers to work with. Holding your phone with just your thumbs seems precarious at best, so using it as a trumpet see...
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
I would guess that 5 fingers is the upper limit. I imagine the engineers assumed most people have two hands with five fingers per hand, so the average person holding the phone in one hand only has five fingers to work with. Holding your phone with just your thumbs seems precarious at best, so using it as a trumpet see...
The system is only capable of tracking 5 finger touches at once. You should only ever get 5 touch events at the same time, I think anything over that is ignored. You're probably seeing odd behavior because its not consistently picking the same 5 out of 8 fingers to report touch events on.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
Just a note: the iPad can recognize 11 touches.
The system is only capable of tracking 5 finger touches at once. You should only ever get 5 touch events at the same time, I think anything over that is ignored. You're probably seeing odd behavior because its not consistently picking the same 5 out of 8 fingers to report touch events on.
1,202,484
I would like to develop a multi-touch (up to 8 fingers) application for iPhone/iPod Touch. But during testing on my 1st gen iPod Touch once I put the 6th finger weird things started to happen. I don't get Touch Began for the 6th finger nor Touch Ended/Cancelled for the first 5 fingers. Do you know of any workaround fo...
2009/07/29
[ "https://Stackoverflow.com/questions/1202484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56875/" ]
Just a note: the iPad can recognize 11 touches.
I have no idea if it would work on Android, but there will be an upper limit for the number of simultaneous touches that you can have. Future iPhones/iPods may up that limit, but it's not defined and you shouldn't assume that you can handle more than a few realistically.
16,106,829
I want to obtain the remote client ip by javascript, not querying any external ip resource pools. how could i get the remote ip address, just like the way i get appName by `navigator.appName` also like the ways as follows: PHP:`<?php echo $_SERVER["REMOTE_ADDR"]; ?>` NODE.JS: `req.connection.remoteAddress` so gree...
2013/04/19
[ "https://Stackoverflow.com/questions/16106829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190293/" ]
If you want to use the most current value of the drop-down anywhere in your code, you can just reference it like this: ``` $('#test').val() ``` I've removed the `:selected`, because that's not necessary; `.val()` will give the right value.
You might use custom events to do something based on that event? Example: ``` $('#test').change(function () { $('mysubscriberselectorshere').trigger('gettweet'); }); // do something based on the custom event $('mysubscriberselectorshere').on('gettweet', function { // do good stuff here alert($('#test').v...
29,156,564
I am having trouble getting my ipython to work after a regular python upgrade. If I type: ``` ipython notebook --pylab inline ``` I get the following error: ``` -bash: /usr/local/bin/ipython: No such file or directory ``` If I type: ``` which ipython ``` I get no response, just the command line prompt. if I t...
2015/03/19
[ "https://Stackoverflow.com/questions/29156564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3590131/" ]
Here is a version of `bubble/3` that is deterministic if the first argument is instantiated, so that tail call optimisation (and, more specifically, tail recursion optimisation) applies: ``` bubble([L|Ls0], Ls, Max) :- phrase(bubble_(Ls0, L, Max), Ls). bubble_([], Max, Max) --> []. bubble_([L0|Ls0], Max0, Max) --> ...
Disclaimer: following the hint by @mat could be more rewarding... I've played a bit with your code, in my experiment the local stack overflow was thrown with a list length near 2500. Then I've placed some cut: ``` %% bubble(L, Ls, max):- insert list L and get max member of list by %% swapping members from the start o...
29,156,564
I am having trouble getting my ipython to work after a regular python upgrade. If I type: ``` ipython notebook --pylab inline ``` I get the following error: ``` -bash: /usr/local/bin/ipython: No such file or directory ``` If I type: ``` which ipython ``` I get no response, just the command line prompt. if I t...
2015/03/19
[ "https://Stackoverflow.com/questions/29156564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3590131/" ]
Since there are two answers, and no one pointed out explicitly enough the reason why you get into "out of local stack" trouble (Mat says in the comment to your question that your predicates are not deterministic, but does not explain exactly why). Two of the predicates you have defined, namely, `bubblesort/3` and `bub...
Disclaimer: following the hint by @mat could be more rewarding... I've played a bit with your code, in my experiment the local stack overflow was thrown with a list length near 2500. Then I've placed some cut: ``` %% bubble(L, Ls, max):- insert list L and get max member of list by %% swapping members from the start o...
29,156,564
I am having trouble getting my ipython to work after a regular python upgrade. If I type: ``` ipython notebook --pylab inline ``` I get the following error: ``` -bash: /usr/local/bin/ipython: No such file or directory ``` If I type: ``` which ipython ``` I get no response, just the command line prompt. if I t...
2015/03/19
[ "https://Stackoverflow.com/questions/29156564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3590131/" ]
Since there are two answers, and no one pointed out explicitly enough the reason why you get into "out of local stack" trouble (Mat says in the comment to your question that your predicates are not deterministic, but does not explain exactly why). Two of the predicates you have defined, namely, `bubblesort/3` and `bub...
Here is a version of `bubble/3` that is deterministic if the first argument is instantiated, so that tail call optimisation (and, more specifically, tail recursion optimisation) applies: ``` bubble([L|Ls0], Ls, Max) :- phrase(bubble_(Ls0, L, Max), Ls). bubble_([], Max, Max) --> []. bubble_([L0|Ls0], Max0, Max) --> ...
58,198,863
I have looked at the 2 other posts regarding this, the one with the wrapping around the larger state does not apply whilst the other one with registering multiple forFeature -- I have done some testing around that and even if I import it before or after the forRoot(reducers) in my app.module, it makes no difference. I...
2019/10/02
[ "https://Stackoverflow.com/questions/58198863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10064334/" ]
It looks like it's trying to read from `OrdersState` before it has been initialized. Your reducer doesn't actually return the default state in order to initialize it; At least you don't seem to, at the code you present. Make your reducer return the default state. ```js export function ordersReducer( state: AllOrder...
I had a similar error to that of yours in entity.js (NGRX implementation file). In my case, I had a lazy-loaded module with its own state that was initially undefined. Since entity selectors don't do any null check prior to grabbing the entity related fields (e.g. ids) it causes this error. My solution was to avoid usi...
58,198,863
I have looked at the 2 other posts regarding this, the one with the wrapping around the larger state does not apply whilst the other one with registering multiple forFeature -- I have done some testing around that and even if I import it before or after the forRoot(reducers) in my app.module, it makes no difference. I...
2019/10/02
[ "https://Stackoverflow.com/questions/58198863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10064334/" ]
It looks like it's trying to read from `OrdersState` before it has been initialized. Your reducer doesn't actually return the default state in order to initialize it; At least you don't seem to, at the code you present. Make your reducer return the default state. ```js export function ordersReducer( state: AllOrder...
I had the same error, when I forgot to add the "state" as as a second parameter for adapter.addOne(). So in OPs example if the redcuer was written in following way: ``` return orderAdapter.addMany(action.orders); // !! lack of "state" as 2nd param ``` then the error would be exactly the same. In my case this w...
58,198,863
I have looked at the 2 other posts regarding this, the one with the wrapping around the larger state does not apply whilst the other one with registering multiple forFeature -- I have done some testing around that and even if I import it before or after the forRoot(reducers) in my app.module, it makes no difference. I...
2019/10/02
[ "https://Stackoverflow.com/questions/58198863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10064334/" ]
I had this error because I was setting up my selector with the wrong feature key: ``` export const selectIocState = createFeatureSelector<fromIoc.IocState>('this_key_was_wrong'); ``` it should match what you have loaded in the feature module: ``` StoreModule.forFeature('feature_key', iocReducer), ```
I had a similar error to that of yours in entity.js (NGRX implementation file). In my case, I had a lazy-loaded module with its own state that was initially undefined. Since entity selectors don't do any null check prior to grabbing the entity related fields (e.g. ids) it causes this error. My solution was to avoid usi...
58,198,863
I have looked at the 2 other posts regarding this, the one with the wrapping around the larger state does not apply whilst the other one with registering multiple forFeature -- I have done some testing around that and even if I import it before or after the forRoot(reducers) in my app.module, it makes no difference. I...
2019/10/02
[ "https://Stackoverflow.com/questions/58198863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10064334/" ]
I had a similar error to that of yours in entity.js (NGRX implementation file). In my case, I had a lazy-loaded module with its own state that was initially undefined. Since entity selectors don't do any null check prior to grabbing the entity related fields (e.g. ids) it causes this error. My solution was to avoid usi...
I had the same error, when I forgot to add the "state" as as a second parameter for adapter.addOne(). So in OPs example if the redcuer was written in following way: ``` return orderAdapter.addMany(action.orders); // !! lack of "state" as 2nd param ``` then the error would be exactly the same. In my case this w...
58,198,863
I have looked at the 2 other posts regarding this, the one with the wrapping around the larger state does not apply whilst the other one with registering multiple forFeature -- I have done some testing around that and even if I import it before or after the forRoot(reducers) in my app.module, it makes no difference. I...
2019/10/02
[ "https://Stackoverflow.com/questions/58198863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10064334/" ]
I had this error because I was setting up my selector with the wrong feature key: ``` export const selectIocState = createFeatureSelector<fromIoc.IocState>('this_key_was_wrong'); ``` it should match what you have loaded in the feature module: ``` StoreModule.forFeature('feature_key', iocReducer), ```
I had the same error, when I forgot to add the "state" as as a second parameter for adapter.addOne(). So in OPs example if the redcuer was written in following way: ``` return orderAdapter.addMany(action.orders); // !! lack of "state" as 2nd param ``` then the error would be exactly the same. In my case this w...
62,713,326
``` struct node { int data; node *next; } * save; ``` Can anyone explain what's the difference between below declarations, does stack & heap-based memory allocation is the only difference between them or any other? Can we call both of them as object pointers? ``` node *temp; ``` and ``` node *tmp = new no...
2020/07/03
[ "https://Stackoverflow.com/questions/62713326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9933951/" ]
The new operator denotes a request for memory allocation on the Free Store. If sufficient memory is available, new operator initializes the memory and returns the address of the newly allocated and initialized memory to the pointer variable. Syntax to use new operator: To allocate memory of any data type, the syntax i...
In your example `node* temp` creates an object of type `node*` with *automatic storage* (see [storage duration](https://en.cppreference.com/w/cpp/language/storage_duration)). In the first line this object is uninitialised and in the second you initialise it with a pointer to an object of type `node` that lives in *dyna...
62,713,326
``` struct node { int data; node *next; } * save; ``` Can anyone explain what's the difference between below declarations, does stack & heap-based memory allocation is the only difference between them or any other? Can we call both of them as object pointers? ``` node *temp; ``` and ``` node *tmp = new no...
2020/07/03
[ "https://Stackoverflow.com/questions/62713326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9933951/" ]
The new operator denotes a request for memory allocation on the Free Store. If sufficient memory is available, new operator initializes the memory and returns the address of the newly allocated and initialized memory to the pointer variable. Syntax to use new operator: To allocate memory of any data type, the syntax i...
Well, they are both pointers to objects, specifically `node`. Now, the pointer itself i.e. both `*temp` and `*tmp` are stack allocated variables that are capable of holding a memory address that can point to an object of type `node`. Both of these pointers are capable of holding addresses of both dynamically allocated...
62,713,326
``` struct node { int data; node *next; } * save; ``` Can anyone explain what's the difference between below declarations, does stack & heap-based memory allocation is the only difference between them or any other? Can we call both of them as object pointers? ``` node *temp; ``` and ``` node *tmp = new no...
2020/07/03
[ "https://Stackoverflow.com/questions/62713326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9933951/" ]
In your example `node* temp` creates an object of type `node*` with *automatic storage* (see [storage duration](https://en.cppreference.com/w/cpp/language/storage_duration)). In the first line this object is uninitialised and in the second you initialise it with a pointer to an object of type `node` that lives in *dyna...
Well, they are both pointers to objects, specifically `node`. Now, the pointer itself i.e. both `*temp` and `*tmp` are stack allocated variables that are capable of holding a memory address that can point to an object of type `node`. Both of these pointers are capable of holding addresses of both dynamically allocated...
13,298,921
I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highe...
2012/11/08
[ "https://Stackoverflow.com/questions/13298921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1105970/" ]
``` with avg_price as ( select b.genre, round(avg(b.price),2) as cost from books b group by b.genre ) select genre from avg_price where cost = (select max(cost) from avg_price); ``` (This is ANSI standard SQL and works in all modern DBMS)
In MS-SQL you can do this: ``` SELECT TOP 1 genre, ROUND(AVG(price),2) AS cost FROM books GROUP BY genre ORDER BY ROUND(AVG(price),2) DESC ``` (the TOP clause is MS-SQL specific, but there are similiar constructs in other DBMS)
13,298,921
I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highe...
2012/11/08
[ "https://Stackoverflow.com/questions/13298921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1105970/" ]
``` with avg_price as ( select b.genre, round(avg(b.price),2) as cost from books b group by b.genre ) select genre from avg_price where cost = (select max(cost) from avg_price); ``` (This is ANSI standard SQL and works in all modern DBMS)
``` select top 1 genre, avg(b.price) as cost from books group by genre order by cost desc ```
13,298,921
I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highe...
2012/11/08
[ "https://Stackoverflow.com/questions/13298921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1105970/" ]
On Sql server, you can use the avg aggragate inside the windowing function row\_number ``` with m as( select genre, avg(price) cost, row_number() over(order by avg(price) desc) rw from books group by genre ) select * from m where rw=1 ```
``` with avg_price as ( select b.genre, round(avg(b.price),2) as cost from books b group by b.genre ) select genre from avg_price where cost = (select max(cost) from avg_price); ``` (This is ANSI standard SQL and works in all modern DBMS)
13,298,921
I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highe...
2012/11/08
[ "https://Stackoverflow.com/questions/13298921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1105970/" ]
On Sql server, you can use the avg aggragate inside the windowing function row\_number ``` with m as( select genre, avg(price) cost, row_number() over(order by avg(price) desc) rw from books group by genre ) select * from m where rw=1 ```
In MS-SQL you can do this: ``` SELECT TOP 1 genre, ROUND(AVG(price),2) AS cost FROM books GROUP BY genre ORDER BY ROUND(AVG(price),2) DESC ``` (the TOP clause is MS-SQL specific, but there are similiar constructs in other DBMS)
13,298,921
I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highe...
2012/11/08
[ "https://Stackoverflow.com/questions/13298921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1105970/" ]
On Sql server, you can use the avg aggragate inside the windowing function row\_number ``` with m as( select genre, avg(price) cost, row_number() over(order by avg(price) desc) rw from books group by genre ) select * from m where rw=1 ```
``` select top 1 genre, avg(b.price) as cost from books group by genre order by cost desc ```
40,977,288
I'd like to work to write Realm from JSON in async in background, but I can't understand why my code isn't work as must. ``` override func viewDidLoad() { super.viewDidLoad() myFunc() } ``` and myFunc(): ``` func myFunc() { let realm = try! Realm() // get file JSON from local device and...
2016/12/05
[ "https://Stackoverflow.com/questions/40977288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5928311/" ]
If you installed Go from a package manager before, you might have an old version. Check `go version` and remove the old version if needed.
For MacPorts users with e.g. go 1.10.3 installed, it didn't seem to be correctly installed for me. The runtime standard packages were missing. I even tried uninstalling and reinstalling a clean copy. So I just removed it and got the official darwin binary package from google: <https://golang.org/dl/>
44,551,318
I would like to layout DIV tiles as in file managers. Without any reordering, strightly from left to right then from top to bottom. Automatically wrapping by the width of window. [![enter image description here](https://i.stack.imgur.com/8cJKy.png)](https://i.stack.imgur.com/8cJKy.png) How to do that? Any libraries a...
2017/06/14
[ "https://Stackoverflow.com/questions/44551318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258483/" ]
I think you can try this ``` $query = Post::withCount('comments') ->withTrashed() ->get(); ``` **OR** ``` $query = DB::table('post') ->select('comments', DB::raw('count(*) as comments')) ->get(); ``` Hope this work for you!
You can use the withTrashed method: ``` >withTrashed() ```
44,551,318
I would like to layout DIV tiles as in file managers. Without any reordering, strightly from left to right then from top to bottom. Automatically wrapping by the width of window. [![enter image description here](https://i.stack.imgur.com/8cJKy.png)](https://i.stack.imgur.com/8cJKy.png) How to do that? Any libraries a...
2017/06/14
[ "https://Stackoverflow.com/questions/44551318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258483/" ]
Since laravel doesn't propose a way to filter the relation when using `withCount`, a clean solution would be to declare the relation and add the `withTrashd()` to it. In **Post.php** ```php public function commentsWithTrashed() { return $this->comment()->withTrashed(); } ``` Now you can use the `withCount` on i...
You can use the withTrashed method: ``` >withTrashed() ```
44,551,318
I would like to layout DIV tiles as in file managers. Without any reordering, strightly from left to right then from top to bottom. Automatically wrapping by the width of window. [![enter image description here](https://i.stack.imgur.com/8cJKy.png)](https://i.stack.imgur.com/8cJKy.png) How to do that? Any libraries a...
2017/06/14
[ "https://Stackoverflow.com/questions/44551318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258483/" ]
You can add this to count ``` $query = Post::withCount(['comments'=> function ($query) {$query->onlyTrashed();]) ->get(); ``` it works properly.
You can use the withTrashed method: ``` >withTrashed() ```
48,700
I'm working on a science fiction story in which electricity had been wiped out from earth. I need, though, to sort out how it happened. What I look for * Humanity can no longer use electricity as we do nowadays. * It might be possible to develop a new way to simulate what we do nowadays with electricity, but it'd tak...
2016/07/27
[ "https://worldbuilding.stackexchange.com/questions/48700", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/9526/" ]
**Rogue AI** Sure, the idea of Steampunk Theme park seemed really cool at first, with the most advanced androids posing as a variety of NPCs and all kinds of wonderous contraptions that had been designed to run on steam. Then the managerial AI got a bit out of control and decided that it sure could increase the prof...
a very powerful solar pulse from solar flare could destroy power lines which would destroy the average person's access to electricity. Stuff like cell phones and computers would be unaffected but without any way to charge them it wouldn't last long. Several nuclear weapons detonated high up in the earths atmosphere co...
48,700
I'm working on a science fiction story in which electricity had been wiped out from earth. I need, though, to sort out how it happened. What I look for * Humanity can no longer use electricity as we do nowadays. * It might be possible to develop a new way to simulate what we do nowadays with electricity, but it'd tak...
2016/07/27
[ "https://worldbuilding.stackexchange.com/questions/48700", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/9526/" ]
As has been pointed out in the comments, there are lots of important reasons why we can't prevent *electricity* from working at all. The key, then, is to imagine ways of preventing humans from *harnessing* electricity. Trying to screw with electromagnetism is problematic - again, messes with ecology/biology, and could ...
a very powerful solar pulse from solar flare could destroy power lines which would destroy the average person's access to electricity. Stuff like cell phones and computers would be unaffected but without any way to charge them it wouldn't last long. Several nuclear weapons detonated high up in the earths atmosphere co...
48,700
I'm working on a science fiction story in which electricity had been wiped out from earth. I need, though, to sort out how it happened. What I look for * Humanity can no longer use electricity as we do nowadays. * It might be possible to develop a new way to simulate what we do nowadays with electricity, but it'd tak...
2016/07/27
[ "https://worldbuilding.stackexchange.com/questions/48700", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/9526/" ]
In the *Council Wars* series, Eric Flint introduces *Mother*, a super-AI [with ubiquitous sensors](http://www.baen.com/chapters/W200311/0743471644___0.htm) and effectors1 capable of absorbing remotely most sources of energy. So, low voltages are okay, but as soon as a voltage reaches a given threshold, *zzzzt* it disa...
a very powerful solar pulse from solar flare could destroy power lines which would destroy the average person's access to electricity. Stuff like cell phones and computers would be unaffected but without any way to charge them it wouldn't last long. Several nuclear weapons detonated high up in the earths atmosphere co...
48,700
I'm working on a science fiction story in which electricity had been wiped out from earth. I need, though, to sort out how it happened. What I look for * Humanity can no longer use electricity as we do nowadays. * It might be possible to develop a new way to simulate what we do nowadays with electricity, but it'd tak...
2016/07/27
[ "https://worldbuilding.stackexchange.com/questions/48700", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/9526/" ]
In the *Council Wars* series, Eric Flint introduces *Mother*, a super-AI [with ubiquitous sensors](http://www.baen.com/chapters/W200311/0743471644___0.htm) and effectors1 capable of absorbing remotely most sources of energy. So, low voltages are okay, but as soon as a voltage reaches a given threshold, *zzzzt* it disa...
**Rogue AI** Sure, the idea of Steampunk Theme park seemed really cool at first, with the most advanced androids posing as a variety of NPCs and all kinds of wonderous contraptions that had been designed to run on steam. Then the managerial AI got a bit out of control and decided that it sure could increase the prof...
48,700
I'm working on a science fiction story in which electricity had been wiped out from earth. I need, though, to sort out how it happened. What I look for * Humanity can no longer use electricity as we do nowadays. * It might be possible to develop a new way to simulate what we do nowadays with electricity, but it'd tak...
2016/07/27
[ "https://worldbuilding.stackexchange.com/questions/48700", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/9526/" ]
In the *Council Wars* series, Eric Flint introduces *Mother*, a super-AI [with ubiquitous sensors](http://www.baen.com/chapters/W200311/0743471644___0.htm) and effectors1 capable of absorbing remotely most sources of energy. So, low voltages are okay, but as soon as a voltage reaches a given threshold, *zzzzt* it disa...
As has been pointed out in the comments, there are lots of important reasons why we can't prevent *electricity* from working at all. The key, then, is to imagine ways of preventing humans from *harnessing* electricity. Trying to screw with electromagnetism is problematic - again, messes with ecology/biology, and could ...
34,087,693
I try to add dynamically Items to Item/Menu tree. My XML file look like this: ``` <item android:id="@+id/r2_container" android:title="@string/myR2s"> <menu> <!-- Here I want some new Items... --> <item android:id="@+id/nav_addR2" android:icon="@a...
2015/12/04
[ "https://Stackoverflow.com/questions/34087693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5135523/" ]
An array initializer is not a object and so you can't have a pointer to the start of such and object. If you have at least C99, you could do ``` int* int_arrays2[2] = { (int[]){5, 4, 2}, (int[]){6, 8} }; ``` These are so-called "compound literals" that are objects, and thus in this case covert to the point...
The declaration ``` int* int_arrays[2] ``` declares the variable `int_arrays` to be an array of two pointers to `int`. And you initialize the array to contain two pointers to `int` in the "it works" code. Remember that arrays naturally decays to pointers to their first element, so for example an array of `int` can b...
34,087,693
I try to add dynamically Items to Item/Menu tree. My XML file look like this: ``` <item android:id="@+id/r2_container" android:title="@string/myR2s"> <menu> <!-- Here I want some new Items... --> <item android:id="@+id/nav_addR2" android:icon="@a...
2015/12/04
[ "https://Stackoverflow.com/questions/34087693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5135523/" ]
An array initializer is not a object and so you can't have a pointer to the start of such and object. If you have at least C99, you could do ``` int* int_arrays2[2] = { (int[]){5, 4, 2}, (int[]){6, 8} }; ``` These are so-called "compound literals" that are objects, and thus in this case covert to the point...
Consider the first declaration ``` int* int_arrays[2] = {array, array2}; ``` Here is the initilaizer list contains two expressions that represent array names. Arrays used in expressions are implicitly converted to pointers to their first elements. In fact this declaration is equivalent to the following ``` int* i...
5,135,609
I'm curious if AppleScript can access each specific tab in a browser and execute some javascript in them. Anyone have ideas?
2011/02/27
[ "https://Stackoverflow.com/questions/5135609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5123/" ]
For **Google Chrome**, use `execute` from AppleScript Chromium Suite: > > **execute** v : Execute a piece of javascript. > > > **execute** *specifier* : The tab to execute the command in. > > > **javascript** *text* : The javascript code to execute. > > > Example: ``` tell application "Google Chrome" exe...
Recently Google Chrome disabled the ability to execute JavaScript via AppleScript. I'm having trouble finding a reference link, but in Chrome Canary v59 it doesn't work and gives a message saying it's disabled, and I'm seeing it still work in Chrome v57 so it's got to be very new.
5,135,609
I'm curious if AppleScript can access each specific tab in a browser and execute some javascript in them. Anyone have ideas?
2011/02/27
[ "https://Stackoverflow.com/questions/5135609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5123/" ]
For **Google Chrome**, use `execute` from AppleScript Chromium Suite: > > **execute** v : Execute a piece of javascript. > > > **execute** *specifier* : The tab to execute the command in. > > > **javascript** *text* : The javascript code to execute. > > > Example: ``` tell application "Google Chrome" exe...
The function below runs JavaScript in each tab of the frontmost window in Chrome and concatenates the output. To run JavaScript in in all windows, replace `window 1` with `windows`. ```none xjss(){ osascript -e'on run {a} set o to "" tell app "Google Chrome" to repeat with t in (get tabs of window 1) t...
5,135,609
I'm curious if AppleScript can access each specific tab in a browser and execute some javascript in them. Anyone have ideas?
2011/02/27
[ "https://Stackoverflow.com/questions/5135609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5123/" ]
The function below runs JavaScript in each tab of the frontmost window in Chrome and concatenates the output. To run JavaScript in in all windows, replace `window 1` with `windows`. ```none xjss(){ osascript -e'on run {a} set o to "" tell app "Google Chrome" to repeat with t in (get tabs of window 1) t...
Recently Google Chrome disabled the ability to execute JavaScript via AppleScript. I'm having trouble finding a reference link, but in Chrome Canary v59 it doesn't work and gives a message saying it's disabled, and I'm seeing it still work in Chrome v57 so it's got to be very new.
31,089,893
We are using Symfony to create some webservices. We use Doctrine-ORM to store entities and Doctrine-DBAL to retrive data because it's very light and can reuse the ORM (entity manager) connection. When using Doctrine-DBAL, integer values are returned to PHP as strings and we want to have integer values, specially becau...
2015/06/27
[ "https://Stackoverflow.com/questions/31089893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5052923/" ]
gseric's [answer](https://stackoverflow.com/questions/31089893#answer-35478090) will work but with the effect of hydrating your entities with integers. To still get booleans in your entities you can simply extend Doctrine's `BooleanType`: ``` class BooleanToIntType extends \Doctrine\DBAL\Types\BooleanType { public...
If it's not too late for you, you can fix this issue in your app bootstrap this way: ``` \Doctrine\DBAL\Types\Type::overrideType('boolean', 'Doctrine\\DBAL\\Types\\IntegerType'); ``` After this line is executed Doctrine DBAL will map your PHP boolean values to PDO integers (PDO::PARAM\_INT instead od PDO::PARAM\_BOO...
53,819,335
I want to call a function from a connected component using `ref`, so I used before from `withRef: true` in connected component: ```js export default connect( mapStateToProps, mapDispatchToProps, null, {withRef: true} )(InviteReceiverForm) ``` and in the presentational component: ```js <ExampleComponent ref={ c...
2018/12/17
[ "https://Stackoverflow.com/questions/53819335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2632266/" ]
<https://github.com/reduxjs/react-redux/releases/tag/v6.0.0> > > The `withRef` option to connect has been replaced with `forwardRef`. If `{forwardRef : true}` has been passed to `connect`, adding a ref to the connected wrapper component will actually return the instance of the wrapped component. > > >
This worked for me: ``` connect( mapStateToProps, null, null, { forwardRef: true } ) )(ComponentName); ```
25,560
I have a server with multiple users which each have multiple authorized SSH keys. Is there any effective way (command line utility?) to keep track of which key belongs to who and to quickly remove/add keys (apart from ssh-copy-id)?
2011/02/10
[ "https://askubuntu.com/questions/25560", "https://askubuntu.com", "https://askubuntu.com/users/2331/" ]
You can use the last part of each lines in `.ssh/authorized_keys` is intended for comments. From `man sshd`: > > Protocol 1 public keys consist of the > following space-separated fields: > options, bits, exponent, modulus, > comment. Protocol 2 public key consist > of: options, keytype, base64-encoded > key, co...
There's also [`ssh-import-id`](http://manpg.es/ssh-import-id), which can securely import users' SSH public keys from [Launchpad.net](http://launchpad.net).
25,560
I have a server with multiple users which each have multiple authorized SSH keys. Is there any effective way (command line utility?) to keep track of which key belongs to who and to quickly remove/add keys (apart from ssh-copy-id)?
2011/02/10
[ "https://askubuntu.com/questions/25560", "https://askubuntu.com", "https://askubuntu.com/users/2331/" ]
You can use the last part of each lines in `.ssh/authorized_keys` is intended for comments. From `man sshd`: > > Protocol 1 public keys consist of the > following space-separated fields: > options, bits, exponent, modulus, > comment. Protocol 2 public key consist > of: options, keytype, base64-encoded > key, co...
Bastillion - <https://www.bastillion.io> Users manage their own SSH keys based on profiles that have been assigned to them. <https://www.bastillion.io/docs/using/keymanagement/>
25,560
I have a server with multiple users which each have multiple authorized SSH keys. Is there any effective way (command line utility?) to keep track of which key belongs to who and to quickly remove/add keys (apart from ssh-copy-id)?
2011/02/10
[ "https://askubuntu.com/questions/25560", "https://askubuntu.com", "https://askubuntu.com/users/2331/" ]
I'd checkout the [Monkeysphere](http://web.monkeysphere.info/) project. It uses OpenPGP's web of trust concepts to manage ssh's authorized\_keys and known\_hosts files, without requiring changes to the ssh client or server.
There's also [`ssh-import-id`](http://manpg.es/ssh-import-id), which can securely import users' SSH public keys from [Launchpad.net](http://launchpad.net).
25,560
I have a server with multiple users which each have multiple authorized SSH keys. Is there any effective way (command line utility?) to keep track of which key belongs to who and to quickly remove/add keys (apart from ssh-copy-id)?
2011/02/10
[ "https://askubuntu.com/questions/25560", "https://askubuntu.com", "https://askubuntu.com/users/2331/" ]
I'd checkout the [Monkeysphere](http://web.monkeysphere.info/) project. It uses OpenPGP's web of trust concepts to manage ssh's authorized\_keys and known\_hosts files, without requiring changes to the ssh client or server.
Bastillion - <https://www.bastillion.io> Users manage their own SSH keys based on profiles that have been assigned to them. <https://www.bastillion.io/docs/using/keymanagement/>
45,304,771
My boss recently suggested to me that I use inheritance with the classes in my app. There is one method that I use quite often, but the `.this` class is changed. Here is the base code I use: ``` public class CURRENTCLASS extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { @Over...
2017/07/25
[ "https://Stackoverflow.com/questions/45304771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8155304/" ]
mycursor is an alias and StrToFile() with that alias would be meaningless. Probably what you are trying to achieve is this: ``` StrToFile( Strconv(FileToStr( "c:\test.txt" ),9), "c:\test_utf8.txt" ) ```
By looking over the Google Search results that I suggested above I find the following: ``` func utf8encode( lcString ) local lcUtf, i lcUtf = "" for i = 1 to len(lcString) c = asc(substr(lcString,i,1)) if c < 128 cUtf = cUtf+chr(c) else cUtf = cUtf+chr(bitor(192,bitrshift(c,6)))+chr(bito...
6,635,569
I'm trying to write a simple GUI that renders a number of images using the Graphics' object primitives. What I want to have is a series of areas that I can paint to in isolation of the other areas, so that each painting "canvas" has it's own origin within the global coordinate frame of the top-level form. So far I hav...
2011/07/09
[ "https://Stackoverflow.com/questions/6635569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/836810/" ]
EDIT: < Ignore > The reason you are seeing this behaviour is that, the default wordbreakers for SQL fulltext search are defined by the English language (locale 1033). In English, a comma is a valid word-breaker, thereby breaking your number into two different numbers. However, if you use the Portuguese word-breaker, ...
My suggestion would be to not use the Money data type in the first place. All it buys you is a little formatting ease (which you should be doing at the presentation layer anyway), but brings about other complications and inflexibility. I'm not sure DECIMAL/NUMERIC would solve this particular issue, as I'm not a full-te...
53,253,723
I'm trying to download a photo through a URL passed as a query string using Express, but every time I try to use it, I get `Error: Invalid URI "favicon.ico"` Is there a way I can get my browser to stop requesting a favicon? For downloading images, I'm using the `image-downloader` package ([NPM page](https://www.npmjs.c...
2018/11/11
[ "https://Stackoverflow.com/questions/53253723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6343975/" ]
It's probably easiest to just make a route for favicon.ico in your server. ``` app.get('/favico.ico', (req, res) => { res.sendStatus(404); }); ``` Of course, you could actually send a valid icon too if you wanted, but this will at least keep your Express server from showing an error. FYI, this has nothing to do...
Try using another package like [request module](https://github.com/mikeal/request). I believe it got this type of things handled. ``` var fs = require('fs'), request = require('request'); var download = function(uri, filename, callback){ request.head(uri, function(err, res, body){ console.log('content-type:', ...
16,551,267
I'd like to find all the radio buttons on a form and leave the other input types alone. My code looks like this: ```dart form.queryAll("select, input").forEach((Element el) { if (el is RadioButtonInputElement) { print ('got radio button'); } else { print ('got some other input type'); } } ``` This re...
2013/05/14
[ "https://Stackoverflow.com/questions/16551267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2040310/" ]
Quite understandably, you seem to be presuming that `RadioButtonInputElement` is a subclass of `InputElement`. Things actually work more or less the other way around: [InputElement](http://api.dartlang.org/docs/releases/latest/dart_html/InputElement.html) implements [RadioButtonInputElement](http://api.dartlang.org/doc...
I ended up changing the test: ```dart if ( el.type == 'radio' ) { print ('got radio button'); } ```
16,551,267
I'd like to find all the radio buttons on a form and leave the other input types alone. My code looks like this: ```dart form.queryAll("select, input").forEach((Element el) { if (el is RadioButtonInputElement) { print ('got radio button'); } else { print ('got some other input type'); } } ``` This re...
2013/05/14
[ "https://Stackoverflow.com/questions/16551267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2040310/" ]
You could also write a query selector to only return radio buttons. ```dart List<RadioButtonInputElement> list = element.querySelectorAll("input[type='radio']"); ```
I ended up changing the test: ```dart if ( el.type == 'radio' ) { print ('got radio button'); } ```
38,426,078
There are many popular JavaScript libraries and applications on GitHub and some put their raw source code in a `/src` directory, and others in a `/lib` directory. I'm leaning towards the developers having done this depending on which languages they were taught growing up. So I see a lot of JavaScript developers use `/...
2016/07/17
[ "https://Stackoverflow.com/questions/38426078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/569213/" ]
Interesting question, but it seems to me that some developers just take it by their own **worldview**. It also depends on the project: Some projects are built with smaller components, which are just little pieces of the main functionality: `lib`. `lib/independent-pieces.js` Other projects are monolithic, the compon...
* `/node_modules` - for 3rd party libraries. * `/lib` or `/vendor`- suggested putting your libraries which is not required for compilation. * `/src` - for your code source
40,041,583
I want to change the bitmap that contains an image whenever user tap on the screen. i.e. the default image is shadow1, now what i want is that when user touched on screen then this image changed to shadow2, then again if user touched then shadow3, then on next touch the image again comes as shadow1 and it goes on and o...
2016/10/14
[ "https://Stackoverflow.com/questions/40041583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5907181/" ]
For any path ending in `.html`, this should work: ``` [^\/]+\.html$ ``` Example: <https://regex101.com/r/pauXBb/2> If you want it to be more generic, and accept any file extension, then try: ``` [^\/]+\.[^.]+$ ``` Example: <https://regex101.com/r/pauXBb/3>
``` string your = "/stars/thisisapath/randompage.html"; var match = Regex.Match(input, @"/: (.+?).html").Groups[1].Value; ``` the `match` will have your value of `randompage`. Now to this you can add the html with something like: ``` match+="html" ```
40,041,583
I want to change the bitmap that contains an image whenever user tap on the screen. i.e. the default image is shadow1, now what i want is that when user touched on screen then this image changed to shadow2, then again if user touched then shadow3, then on next touch the image again comes as shadow1 and it goes on and o...
2016/10/14
[ "https://Stackoverflow.com/questions/40041583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5907181/" ]
For any path ending in `.html`, this should work: ``` [^\/]+\.html$ ``` Example: <https://regex101.com/r/pauXBb/2> If you want it to be more generic, and accept any file extension, then try: ``` [^\/]+\.[^.]+$ ``` Example: <https://regex101.com/r/pauXBb/3>
Try this `([\w-\.]+\.)\w+`. It will find even string like this /stars/thisisapath/**random.page-5.html**
40,041,583
I want to change the bitmap that contains an image whenever user tap on the screen. i.e. the default image is shadow1, now what i want is that when user touched on screen then this image changed to shadow2, then again if user touched then shadow3, then on next touch the image again comes as shadow1 and it goes on and o...
2016/10/14
[ "https://Stackoverflow.com/questions/40041583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5907181/" ]
For any path ending in `.html`, this should work: ``` [^\/]+\.html$ ``` Example: <https://regex101.com/r/pauXBb/2> If you want it to be more generic, and accept any file extension, then try: ``` [^\/]+\.[^.]+$ ``` Example: <https://regex101.com/r/pauXBb/3>
Try this regular Expression `([^/]*)$`
40,041,583
I want to change the bitmap that contains an image whenever user tap on the screen. i.e. the default image is shadow1, now what i want is that when user touched on screen then this image changed to shadow2, then again if user touched then shadow3, then on next touch the image again comes as shadow1 and it goes on and o...
2016/10/14
[ "https://Stackoverflow.com/questions/40041583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5907181/" ]
``` string your = "/stars/thisisapath/randompage.html"; var match = Regex.Match(input, @"/: (.+?).html").Groups[1].Value; ``` the `match` will have your value of `randompage`. Now to this you can add the html with something like: ``` match+="html" ```
Try this `([\w-\.]+\.)\w+`. It will find even string like this /stars/thisisapath/**random.page-5.html**
40,041,583
I want to change the bitmap that contains an image whenever user tap on the screen. i.e. the default image is shadow1, now what i want is that when user touched on screen then this image changed to shadow2, then again if user touched then shadow3, then on next touch the image again comes as shadow1 and it goes on and o...
2016/10/14
[ "https://Stackoverflow.com/questions/40041583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5907181/" ]
``` string your = "/stars/thisisapath/randompage.html"; var match = Regex.Match(input, @"/: (.+?).html").Groups[1].Value; ``` the `match` will have your value of `randompage`. Now to this you can add the html with something like: ``` match+="html" ```
Try this regular Expression `([^/]*)$`
54,169
One headline on [the December 21, 2022 episode of *Tucker Carlson Tonight*](https://www.mediamatters.org/fox-news/tucker-carlson-accuses-volodymyr-zelensky-waging-war-against-christianity) claimed that "Zelensky has declared war against Christianity", referring to Ukrainian President [Volodymyr Zelenskyy](https://en.wi...
2022/12/22
[ "https://skeptics.stackexchange.com/questions/54169", "https://skeptics.stackexchange.com", "https://skeptics.stackexchange.com/users/25893/" ]
The best way to tell a lie is to tell a partial truth. It is true that the Ukrainian government has [raided several churches associated with the Russian Orthodox Church](https://www.theguardian.com/world/2022/nov/22/ukraine-security-service-raids-1000-year-old-monastery-in-kyiv). What Carlson failed to mention was tha...
This is an addition to the excellent answer by David Hammen in order to give more historic and local context. During the time of the USSR, Russian Orthodox Church was essentially under a complete control of the state. Specifically, [priests were reporting to KGB and often were KGB officers](https://en.wikipedia.org/wi...
9,346,226
I've searched around for a bit, but haven't been able to find anything useful on this. How do browsers communicate with email programs, such as Thunderbird and Outlook (on the Mac, if that's relevant)? By communicate, I mean the process it goes through to create a new email window with a designated to address, subjec...
2012/02/19
[ "https://Stackoverflow.com/questions/9346226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407248/" ]
On windows, the browser use the "default" email client defined by the system. It's stored in the Windows registry and define the command line to open the mail program. You can find more info and an exemple on the Microsoft website. <http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109%28v=vs.85%29.aspx#sa...
the additional information sent to the mail client is usually (from what i have seen) tacked onto the back of the mailto command. in the following example, the client should automatically fill in the subject as 'greetings from stackoverflow' ``` mailto:hello@example.com?subject=greetings from stackoverflow ``` i h...
9,346,226
I've searched around for a bit, but haven't been able to find anything useful on this. How do browsers communicate with email programs, such as Thunderbird and Outlook (on the Mac, if that's relevant)? By communicate, I mean the process it goes through to create a new email window with a designated to address, subjec...
2012/02/19
[ "https://Stackoverflow.com/questions/9346226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407248/" ]
the additional information sent to the mail client is usually (from what i have seen) tacked onto the back of the mailto command. in the following example, the client should automatically fill in the subject as 'greetings from stackoverflow' ``` mailto:hello@example.com?subject=greetings from stackoverflow ``` i h...
A very useful oldies that explains the surface called [RCDefault](http://www.rubicode.com/Software/RCDefaultApp/) It shows you that the Finder or the Browser uses (can use) URLs to call other applications. I am attaching the screenshot for the Mail application on OSX here: ![mail application url schemes](https://i....
9,346,226
I've searched around for a bit, but haven't been able to find anything useful on this. How do browsers communicate with email programs, such as Thunderbird and Outlook (on the Mac, if that's relevant)? By communicate, I mean the process it goes through to create a new email window with a designated to address, subjec...
2012/02/19
[ "https://Stackoverflow.com/questions/9346226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407248/" ]
On windows, the browser use the "default" email client defined by the system. It's stored in the Windows registry and define the command line to open the mail program. You can find more info and an exemple on the Microsoft website. <http://msdn.microsoft.com/en-us/library/windows/desktop/cc144109%28v=vs.85%29.aspx#sa...
A very useful oldies that explains the surface called [RCDefault](http://www.rubicode.com/Software/RCDefaultApp/) It shows you that the Finder or the Browser uses (can use) URLs to call other applications. I am attaching the screenshot for the Mail application on OSX here: ![mail application url schemes](https://i....
58,956,319
Im trying to figure out how to Post a search object to mongo, and find all documents that matches one or more properties stated in the search object. eg if i have post a json object as this: ``` // searchObject { "kind": "employee" "name": "casper", "email": "daniel@mail.com" } ``` i want to get all documen...
2019/11/20
[ "https://Stackoverflow.com/questions/58956319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8479870/" ]
You can filter only when length is desired length or more, if it's less return an empty array therefore clearing the list: ``` filterSkills() { this.filterCars = this.search.length > 2 ? this.cars.filter(car => car.name.toLowerCase().includes(this.search.toLowerCase())) : []; } ```
Just add a condition in your filterSkills function ``` filterSkills() { if (this.search.length >= 3) { this.filterCars = this.cars.filter(car => { return car.name.toLowerCase().includes(this.search.toLowerCase()); }); }else{ return []; } }; ```
58,956,319
Im trying to figure out how to Post a search object to mongo, and find all documents that matches one or more properties stated in the search object. eg if i have post a json object as this: ``` // searchObject { "kind": "employee" "name": "casper", "email": "daniel@mail.com" } ``` i want to get all documen...
2019/11/20
[ "https://Stackoverflow.com/questions/58956319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8479870/" ]
You can filter only when length is desired length or more, if it's less return an empty array therefore clearing the list: ``` filterSkills() { this.filterCars = this.search.length > 2 ? this.cars.filter(car => car.name.toLowerCase().includes(this.search.toLowerCase())) : []; } ```
``` hey you can do onething, ``` ``` **onInputChange(text) { if (*here you can put the condition if text has atleset 3 alphabets like this.search.length>3*) { filteredData = this.options[0].data.filter(item => { return item.name.toLowerCase().indexOf(text.toLowerCase()) > -1; }).slice(0, this.limi...