qid int64 10 74.7M | question stringlengths 15 26.2k | date stringlengths 10 10 | metadata list | response_j stringlengths 27 28.1k | response_k stringlengths 23 26.8k |
|---|---|---|---|---|---|
14,803,197 | I'm currently building a web-server which can receive request, and send back a response.
I've managed to embed a port of Google's v8 JavaScript engine to c# (javascript.net) to my project and I want to parse a requested file and run the server-sided JavaScript code that in it. I decided that this code will be contained... | 2013/02/10 | [
"https://Stackoverflow.com/questions/14803197",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1319084/"
] | Yes, in Oracle SQL Developer put the statement:
```
SET SERVEROUTPUT ON;
```
just before your `DECLARE` keyword and this should work.
I couldn't find `View -> DBMS Output` and I'm using version 1.5.5. | ```
**SET SERVEROUTPUT ON;**
DECLARE
a INTEGER :=10;
b INTEGER :=20;
c float ;
d real ;
BEGIN
c :=a+b;
dbms_output.put_line('the value of C is :'|| c);
d := 70.0/3.3;
dbms_output.put_line('the value of d is:'|| d);
END;
```
This will give you the output
```
the value of C is: 30
the value of... |
50,694,824 | I am using Notification Extension in my application to change the notification sound.
When the user turns off the `UISwitch` in the settings page I save in the `NSUserDefaults` a `boolean` to keep tracking of the state.
However I have 2 different storyboards for two different languages, each has its own style.
When... | 2018/06/05 | [
"https://Stackoverflow.com/questions/50694824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6532217/"
] | You may copy it from old Xcode(9.4). It should work.
```
cp /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/libstdc++.* /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/lib/
cp /Applications/Xcode.app... | Copy it from old Xcode(9.4) will work for physical iOS devices.
For Simulator issues with `Did find: /usr/lib/libstdc++.6.dylib: mach-o, but not built for iOS simulator`. Looks like apple removed compatibility support for simulator. Just download iOS 11.4 simulator and it can be run on it. |
708,547 | My NVIDIA Control Panel seem to have a lack of settings other than the 3D Settings;

I searched around a bit and found some similar problems on other websites which seemed to either have solutions that didn't work, or no replies at all.
I have a nVi... | 2014/01/29 | [
"https://superuser.com/questions/708547",
"https://superuser.com",
"https://superuser.com/users/148401/"
] | The Intel integrated graphics adapter in your computer is most probably
the source of the problem.
The thread [Force 4:3 ratio / pillarbox with 540M](https://forums.geforce.com/default/topic/526745/force-4-3-ratio-pillarbox-with-540m/?offset=8) explains it :
>
> Your "problem" is not a problem at all but its the nat... | This sometimes happens to me, I have to go into Device Manager and disable/enable one of the card for the control panel to update.
As a side note when it's happening the start bar spans across all my monitors (normally with spanning it is only on the primary screen)
Hope this helps. |
136,570 | I am currently a mobile developer and have been that for about 7 years now and I have been in IT for about 10. So I'm an experienced IT professional. I'm considering changing careers to either cyber security or computer forensics. But I would have to take an entry level position for cyber security or computer forensics... | 2019/05/14 | [
"https://workplace.stackexchange.com/questions/136570",
"https://workplace.stackexchange.com",
"https://workplace.stackexchange.com/users/104688/"
] | You should expect your pay to be based on how well your skills and experiences fit the requirements for the new position.
Specifically, you asked,
>
> If I am at 95,000 a year as a developer would I be able to ask for the same or would I have to accept whatever the entry level pay is for one of those 2 careers?
>
>... | There is no right answer to this question I'm afraid.
To give you an example, I moved from Application Support into Project Management and received a substantial pay increase instead.
If the company you apply for to work in cyber security is mainly a mobile development company, they may pay you more since you not onl... |
37,923,139 | I want to make view or simply to get some data from database but in specific way.
For example if data is :
```
1 | test | test | 0 | test
2 | test | test | 1 | test
3 | test | test | 1 | test
4 | test | test | 1 | test
5 | test | test | 0 | test
```
The output should be:
```
1 | test | test | FALSE | test... | 2016/06/20 | [
"https://Stackoverflow.com/questions/37923139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6330830/"
] | Use [**`CASE`**](https://msdn.microsoft.com/en-us/library/ms181765.aspx?f=255&MSPPError=-2147217396) expression.
**Query**
```
SELECT col1, col2, col3,
CASE col4 WHEN 0 THEN 'False'
WHEN 1 THEN 'TRUE'
ELSE NULL END AS col4, col5
FROM your_table_name;
``` | An `if` condition in SQL is expressed using [`CASE` expression](https://msdn.microsoft.com/en-us/library/ms181765.aspx?f=255&MSPPError=-2147217396):
```
SELECT
id
, a
, b
, CASE c WHEN 0 THEN 'FALSE' ELSE 'TRUE' END AS c
, d
FROM my_table
```
Note that there are two forms of `CASE` expression in SQL Server - ... |
22,256,267 | I'm just trying to get this program to take a number between 1 and 9 and calculate the radius and display it. This program is supposed to loop but all I'm getting is the "Thank you for using the software!" print function, it's not going through the loop at all and I can't seem to understand why.
```
#include <stdio.h>... | 2014/03/07 | [
"https://Stackoverflow.com/questions/22256267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3258789/"
] | You never *initialize* `r` before entering your `while` loop, so this is undefined behavior.
Additionally, you want to use `int` s for equality operators, i.e. `==` or `!=`. In your case, you might want to include an "error" that `r` can be within. | you have not initialize r before using it.
you must initialize it or use i to iterate though the loop.
```
INITIALIZE r here before using
for (i = 0; i <= 4; i++)
{
while (r != 0)
{
//code
}
}
``` |
31,339,762 | I've looked all over the web for this, and nothing I found seems to help.
I made a model and added the model to a data source as an object. I assumed it would work like a data set where I can just drag and drop onto a form and it would bind the data for me. But it keeps showing blank when I drag and drop from the mod... | 2015/07/10 | [
"https://Stackoverflow.com/questions/31339762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5094751/"
] | You need to materialize your query (bring the data to memory). You can do that calling the `ToList()` method, but even better is do this:
```
context.TBLPER.Load();
this.DataContext = context.TBLPER.Local; // set the Window DataContext property
```
`Local` property gets an `ObservableCollection<T>` that represe... | You shouldn't be setting `ItemsSource` twice (just set it in your code behind - remove `ItemsSource="{Binding}"`).
Also, you should set `AutoGenerateColumns="True"` because without that you need to add `DataGrid`X`Column` elements to the `DataGrid`.
Have a look here for more details ... <http://www.wpf-tutorial.com/d... |
528,707 | I'm looking for an editor that has the help from
<http://www.hibernate.org/hib_docs/nhibernate/html/mapping.html>
built in, and allows simple editing of the XML files in a GUI fashion. I realise there's CodeSmith and MyGeneration, but from what I remember these only go one way, and don't allow editing existing HBM f... | 2009/02/09 | [
"https://Stackoverflow.com/questions/528707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21574/"
] | Have you tried Hibernate's own Eclipse plug-in named *Hibernate Tools for Eclipse and Ant*?
<http://www.hibernate.org/255.html>
Even if you dont have expirience with Eclipse and its add-ons it should be fairly straightforward to install and use their addon:
Just download it, unzip it into the eclipse directory, and ... | I'm using VisualStudio and the schema (nhibernate-mapping.xsd) to activate the intellisense.
The plug-in for R# is useful to check the mapping with the class. |
905,729 | I'm building up a new machine with a Supermicro MB equipped with a TPM and a Seagate Constellation ES.3 SED drive (ST200NM0053). The MB has the AMI BIOS which does see the TPM.
I've installed Windows Server 2012 R2 Essentials. I'm now struggling to enable hard drive encryption using the SED feature of the hard drive. ... | 2015/04/24 | [
"https://superuser.com/questions/905729",
"https://superuser.com",
"https://superuser.com/users/359463/"
] | Writing to SSDs isn't necessarily bad. It's the writing and rewriting of a single block that's bad. Meaning if you write a file delete it then write it again, or make small amounts of changes to a file over and over again. This causes wear on the SSD's. Databases would definitely fit into this category.
However accor... | If you are truly interested in figuring out the details then you will need the following question answered:
**On average how many bytes are in each row?**
If you can tell me that there are 10 columns, each column is varchar(100), and the encoding is UTF-8 then I can guess at worst case scenario that you have 4,000 by... |
52,233,250 | I have a list and I want to apply border bottom to it, here is what I want
[](https://i.stack.imgur.com/9rn3O.png)
here is what I have so far.
[](https://i.stack.imgur.com/qj4wE.png)
... | 2018/09/08 | [
"https://Stackoverflow.com/questions/52233250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9964622/"
] | Another option besides Lazar Nikolic's one is to use a CSS table instead of a flexbox. After all, that's what it is; it displays tabular data.
To make it responsive as you wanted, you can always use a media query to turn it back into a series of blocks so that everything is displayed underneath each other.
```css
.... | Maybe you should change the width of your span to 200px (Span are two inside a "li"). |
38,993,733 | So essentially I have two matrices:
```
A<-matrix(runif(10*10),ncol = 10)
B<-matrix(runif(10*10),ncol = 10)
```
I am trying to create a for loop which will:
a)remove the top row of matrix A and and add the top row of matrix B to the bottom of the new matrix A, to create a matrix a.
b)remove the 2 top rows of m... | 2016/08/17 | [
"https://Stackoverflow.com/questions/38993733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6725750/"
] | One idea is to create a function that takes as arguments the matrices and the rows. Then use `lapply` to iterate,
```
fun1 <- function(x, y, n) { rbind(x[n:nrow(x),], y[1:n-1,])}
lapply(2:nrow(A), function(i) fun1(A, B, i))
``` | I made a few change to your solution, and I used the variable `letters` which provide a list, for instance `letters[2]=b`.
To assign each new matrix to a dynamic variable, I used the function `assign`.
```
A<-matrix(runif(10*10),ncol = 10)
B<-matrix(runif(10*10),ncol = 10)
n<-nrow(A)
for (i in 1:(n-1)){
assign... |
352,931 | I'm making the transformation from being a web developer whose pages often contain loads of `<script>` tags to one whose pages contain modular Javascript, encapsulated in functions, etc. I'm trying to work out the best way to handle the situation where the code in a particular script file assumes that another script ha... | 2017/07/17 | [
"https://softwareengineering.stackexchange.com/questions/352931",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/123358/"
] | Based on the clarification, you might be talking about JavaScript package management. The two big ones I know about are Node Package Manager (NPM) and Bower. VisualStudio has Bower integration, so that might be a good match for you.
The JavaScript package managers keep track of the dependencies between your dependenci... | If you don't want to go through the effort of setting up an AMD loader like require.js, MVC 5 comes with a built in way to handle things like this with its BundleCollection library. A new MVC project should automatically setup this up for you in the BundleConfig.cs class in App\_Start and give a very basic example of i... |
21,258,723 | I discovered by accident that an assignment operator returning not a reference, but a copy, serves as a workaround to enable storing objects with `const` members in an STL container.
```
class Test_class
{
public:
int const whatever;
explicit Test_class(int w) : whatever(w) {}
// note the missing &
T... | 2014/01/21 | [
"https://Stackoverflow.com/questions/21258723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/621053/"
] | Most of the accepted practice for operator overloading is not enforced by the standard or the compiler. It's just an expectation on the behaviour. You can check out some of it here: [Operator overloading](https://stackoverflow.com/questions/4421706/operator-overloading) or here: <http://en.cppreference.com/w/cpp/langua... | You don't actually assign anything here. You could even declare that assignment operator as `const` because it does nothing.
```
Test_class a(17);
Test_class b(33);
a = b; // nothing happens.
```
The return value of operator= doesn't really matter, I for one typically declare it as `void`. It only matters if you ... |
22,129,676 | The following code produces nothing on the html page, it seems to break down on 'status':
```
var get_json_file = new XMLHttpRequest();
get_json_file.open("GET", "/Users/files/Documents/time.json", true);
**document.write(get_json_file.status);**
```
keep in mind, that I am on a Mac, so there is no C: drive....howev... | 2014/03/02 | [
"https://Stackoverflow.com/questions/22129676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3134565/"
] | Another basic question about AJAX. I suggest you to read the [MDN article](https://developer.mozilla.org/es/docs/XMLHttpRequest) about using XMLHttpRequest. You can't access the 'status' property until it is ready, and you haven't even called the 'send()' method, which performs the actual request. You can't have a stat... | You can only get the status when the ajax has finished. That is, when the page was loaded, or a 404 was returned.
Because you're trying to call `status` straight after the request was sent *(or not sent, read the P.S)*, you're getting nothing.
You need to make an async call, to check that status only when the request... |
62,678,888 | This is my login.jsp file.
```
<form:form method="POST" action="checklogin" modelAttribute="log">
<form:label path="username">UserName: </form:label>
<form:input path="username" id="username" /><br /><br />
<br />
<form:label path="pswd">Password: </form:label>
<form:passwo... | 2020/07/01 | [
"https://Stackoverflow.com/questions/62678888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13847690/"
] | Change
```
@ModelAttribute Login login
```
To
```
@ModelAttribute Login log
``` | Two way data binding in spring allows user inputs to be dynamically bound to the beans. It is two-way in a sense that it can get the inputs from the beans and it can post the user inputs to the beans using GET and POST api.
Using the `@ModelAttribute` annotation you can bind the user inputs with the beans.
```
@Reque... |
41,877,856 | Suppose i have four pages and two user types. After logged in, user one can access all the four pages but for second user we are restricting to access only 2 pages. How can we achieve this in angular 2..? | 2017/01/26 | [
"https://Stackoverflow.com/questions/41877856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5527668/"
] | You can create a guard. Let's take this example:
```
import {Injectable} from '@angular/core';
import {CanActivate, Router, ActivatedRouteSnapshot, RouterStateSnapshot} from '@angular/router';
import {UserService} from '../auth';
@Injectable()
export class RoleGuard implements CanActivate {
constructor(private user... | You can use Angular2 `guards` (*viz.* `CanActivate`, `CanActivateChild`, `CanDeactivate` & `CanLoad`) to protect/control access to various routes (pages).
For a better understanding, please read this - [PROTECTING ROUTES USING GUARDS IN ANGULAR](https://blog.thoughtram.io/angular/2016/07/18/guards-in-angular-2.html) |
1,998,426 | I don't think a similar question has been asked yet, but I've been stumped by the following problem and was hoping maybe someone could spare a few moments to help me out.
$\lim\_{x\to\:3}\left(\frac{5x^2-8x-13}{x^2-5}\right)ln\left(\frac{4x+2}{4x+5}\right)$
I can't use l'hopital to solve this problem and even online ... | 2016/11/04 | [
"https://math.stackexchange.com/questions/1998426",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/385818/"
] | >
> On the one hand this passage should be valid because it is just the definition of logaritm
>
>
>
No, it is *not* valid in general, since $x^n = e^{n \ln x}$ is *only* valid for $x \gt 0$.
One could technically use $x = |x| \cdot \operatorname{sgn}(x)$ to write it as $$x^n = e^{n \ln |x|} \cdot \operatorname{s... | Of course if you use $e^{x\ln a}$ instead of $a^x$ then $a>0$ because otherwise the exponent $\ln a$ is not real any more.
(1) It's $e^{x\ln a}=a^x$ for $a>0$ ;
(2) it's only $a^x$ (and not $e^{x\ln a}$) valid for $a\in\mathbb{R}\setminus\{0\}$ with $x\in\mathbb{Z}$.
$e^{x\ln a}$ and $a^x$ are two different kind o... |
195,775 | I have a piece of paper whose shape is a regular `n`-gon with side length `1`. Then I fold it through some of its diagonals. What is the area of the shape formed by the (former) edges of the regular polygon?
Illustration
------------
Suppose `n = 8`, i.e. an octagon-shaped paper. Let's name the vertices from A to H (... | 2019/11/13 | [
"https://codegolf.stackexchange.com/questions/195775",
"https://codegolf.stackexchange.com",
"https://codegolf.stackexchange.com/users/78410/"
] | Java 8, ~~123~~ ~~114~~ ~~112~~ 103 bytes
=========================================
```java
a->n->{double t=Math.PI/n,T=Math.sin(t);n/=-Math.tan(t);for(int v:a)n+=Math.sin(2*v*t)/T/T;return n/4;}
```
Port of the Python reference implementation.
-11 bytes by porting [*@Arnauld*'s JavaScript answer](https://codegol... | [R](https://www.r-project.org/), ~~60~~ 57 bytes
================================================
-2 and -1 thanks to Nick Kennedy and CriminallyVulgar!
```r
function(n,l,t=pi/n)(sum(sin(2*t*l)/sin(t)^2)-n/tan(t))/4
```
[Try it online!](https://tio.run/##TcrNCoAgEATge0/RcVcMyX4P9SpBBIJgW9T6/EbSj8xl5mOOYPKhCMbTwnYjI... |
6,992,139 | I have a UITableViewController. When a certain BOOL is set, I want to show another view instead of the UITableView. How can I do this? I need to be able to bring the UITableView back also. | 2011/08/09 | [
"https://Stackoverflow.com/questions/6992139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19875/"
] | I implemented the following method in my Table view controller subclass to reload its background.
```
- (void)reloadBackground
{
if(myBool)
{
//load the view to be displayed from a nib
NSArray* nibs = [[NSBundle mainBundle] loadNibNamed:@"EmptyView" owner:self options:nil];
... | Possibly something like:
```
if (myBool == YES) {
UIView *myView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
[self.view addSubview:myView];
}
```
Now to get rid of it:
```
[myView removeFromSuperview];
```
Of course there are plenty of other methods...
Even: `self.view = myView;` |
15,433,734 | The question has surely already be asked, but I didn't find it.
I am often forced to write code like that in views:
* `<div class="<%= c ? 'my_class' : 'my_other_class' %>">`
* `<div class="<%= 'my class' if c %>">`
* `<div<%= c ? 'class="my_class"' : 'id="my_div"' %>>`
Or (the prettier way, but the less readable) :... | 2013/03/15 | [
"https://Stackoverflow.com/questions/15433734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1611683/"
] | You're correct in assuming there is a nicer way. Putting conditional logic into views is against the spirit of MVC. Based on your examples you would be fine to use a simple helper method rather than any of the more complicated implementations that you might read about around the web.
You could create a helper method ... | Depending on what you're doing, if the condition `c` is somewhat "global" (like the current page's name, or language, or whether the user is currently logged in, or whether it's morning or evening.... ), it can make sense to set these as the `body` element's CSS classes so the output looks like this:
```
<body class="... |
30,056,024 | I have css class that I don't want to add into every li tag. It should be added into one li and next li should be empty and so on...
I tried to add
for example
```
<?php
$css_class = 'class="pull_rigt"';
echo "<ul>";
foreach($posts as $key => $value ) {
echo "<li $css_class>";
echo $value['data'];
... | 2015/05/05 | [
"https://Stackoverflow.com/questions/30056024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1122893/"
] | Most simple solution might be using [nth-child selector](http://www.w3schools.com/cssref/sel_nth-child.asp), so that you don't need to use any classes at all.
Or, use % operator in PHP - it means "remainder after division by some number".
The foreach loop could look like this:
```
foreach ($posts as $key=>$value) {
... | I use the modulus operator `%` for these things.
<http://php.net/language.operators.arithmetic>
For simple even/odd evaluations:
**Even:** `$num % 2 == 0`
**Odd:** `$num % 2 == 1`
Here's a standalone example based on your code:
```
<?php
// Test Data
$posts = array();
for ($i = 0; $i < 10; $i++) {
$posts[] =... |
46,636,056 | I installed ruby on Ubuntu for system-wide use. The `.irbrc_history` file is created in a system directory rather than the user's home directory. This causes an access error when the file is owned by someone else. Here's the error besides a bunch more that I think is irrelevant:
```
irb
/usr/local/rvm/rubies/ruby-2.4.... | 2017/10/08 | [
"https://Stackoverflow.com/questions/46636056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8742573/"
] | Create, or edit your ~/.irbrc file to include:
```
require 'irb/ext/save-history'
IRB.conf[:SAVE_HISTORY] = 200
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history"
```
Source: [How To Persist Rails or IRB Console Command History After Exit](http://%20https://jdc.io/how-to-persist-rails-or-irb-console-command-his... | Do you happen to use RVM?
rvm 1.29.3 (current stable) has a bug where IRB history gets saved in the `RUBY_HOME` instead of `HOME`.
<https://github.com/rvm/rvm/issues/4158>
Here's a fix:
```
rvm get head
rvm reinstall 2.4.1
``` |
4,962,916 | Should I put a Semicolon (`;`) when I use `onclick=""`?
```
<p onclick="closeLightBox();">Click<p>
```
or:
```
<p onclick="closeLightBox()">Click<p>
``` | 2011/02/10 | [
"https://Stackoverflow.com/questions/4962916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/423903/"
] | The semicolon in this position, is valid, but not mandatory. | I prefer a semicolon. I know it is optional (as it is many times in JS), but I like to be uniform and it helps to alert the person that the statement is complete. |
6,496,931 | This is my array:
```
array = [:one,:two,:three]
```
I want to apply `to_s` method to all of my array elements to get `array = ['one','two','three']`.
How can I do this (converting each element of the enumerable to something else)? | 2011/06/27 | [
"https://Stackoverflow.com/questions/6496931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/774177/"
] | This will work:
```
array.map!(&:to_s)
``` | You can use [`map`](http://www.ruby-doc.org/core/classes/Array.html#M000249) or [`map!`](http://www.ruby-doc.org/core/classes/Array.html#M000250) respectively, the first will return a new list, the second will modify the list in-place:
```
>> array = [:one,:two,:three]
=> [:one, :two, :three]
>> array.map{ |x| x.to_s... |
25,054,457 | This is related to this question: [Can I import a TypeScript class from my own module to global?](https://stackoverflow.com/questions/24861405/can-i-import-a-typescript-class-from-my-own-module-to-global)
I have made a module and I want to expose a class to the global scope.
```
module Foo {
export class Bar {
... | 2014/07/31 | [
"https://Stackoverflow.com/questions/25054457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2460034/"
] | This turns out to be a bug in current compiler, and new compiler seems to have fixed this. See: <https://github.com/Microsoft/TypeScript/issues/346>
Corrected declaration:
```
declare module Foo {
class Bar {
x: number;
}
}
import Bar = Foo.Bar;
``` | When you use an import statement, the compiler assumes that the definition is elsewhere.
For example, if you imported something from `fileA.ts` into `fileB.ts`, the generated `fileA.d.ts` would already contain the declaration, which would then conflict with `fileB.d.ts` if it also included the declaration.
So I would... |
154,980 | This seems to work fine, but I'm very new to C++ and would like any suggestions for improvements. Areas I have the most trouble with are:
* Namespacing (honestly, it's still half looking stuff up and making an educated guess with typename blah blah blah). Is there a "cleaner" way to implement this?
* Various C++ idiom... | 2017/02/10 | [
"https://codereview.stackexchange.com/questions/154980",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/130631/"
] | ### LinkedList Header
Don't use identifiers with a leading underscore:
```
#ifndef _NEW_LL_H
#define _NEW_LL_H
```
These two are not valid (reserved for the implementation).
Header inclusion order:
```
#include<memory>
#include "node.h"
```
I always do most specific to least. So your local header files first. T... | In addition to what @MartinYork said, I have a few comments.
```
std::unique_ptr<typename Node<T>::Node> head;
```
Why don't you just say:
```
std::unique_ptr<Node<T>> head;
```
Inside a class, you don't have to specify any template parameters when using that class type. The compiler automatically assumes you are... |
16,779,324 | I want my app to store the user's data remotely when they sign up (possibly in a MySQL database). I have seen tutorials about retrieving data through MySQL and JSON, but I cannot seem to find anything about storing data into the MySQL database. Maybe this isn't the best way to do it? | 2013/05/27 | [
"https://Stackoverflow.com/questions/16779324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/939636/"
] | Your question is a bit too vague to be able to answer implementation details, so I give an outline how I would go about the problem:
1. Determine if you want to create the service yourself or use a cloud data storage provider (some are free and provide iOS libraries. One simple example is Apple's own iCloud).
2. If yo... | I think you can call a .php page from your app like below:
```
NSString *urlWithGetVars=@"http://www.somedomain.com/somepage.php?var1=avar&var2=anothervar";
NSURL *url = [NSURL URLWithString:urlWithGetVars];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
NSURLResponse *response;
NSError *e... |
32,249,416 | I have two folder inside same folder as below :-
1.src (it contains my cpp file)
2.linux (where I am running g++ and executing o file)
now I am running commands as below
```
cd linux
g++ --coverage ../src/example1.cpp -o example1
./example1
cd ..
/opt/gcovr-3.2//scripts/gcovr -v -r .
```
I got output as... | 2015/08/27 | [
"https://Stackoverflow.com/questions/32249416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5272378/"
] | gcovr uses .gcov files for analysis.
I also faced similar issue and overcame it in 2 steps by manually generating .gcov file
1. In the folder which contains gcno files run `gcov -b -l -p -c *.gcno`
This will generate gcov files with all details from gcno and gcda files.
2. Go to Project Root Folder and run `gcovr -g -... | If applicable, turn off [ccache](https://ccache.dev/).
If ccache ever does its thing (let's say you wiped the build directory), it will happily restore the object files from cache while not restoring the `*.gcno` files, because it doesn't know about those. |
3,478,041 | My Python (2.6) installation on a few servers has been compiled without curses support which I now need, although the servers have libncurses5 installed, Python did not compile the bindings for it so when I "import curses" I get:
```
"ImportError: No module named _curses"
```
my /lib/ dir has the following files and... | 2010/08/13 | [
"https://Stackoverflow.com/questions/3478041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/159241/"
] | I'm not sure which of these actions resolved my problem but one of them did. I installed libncurses5-dev and libreadline5-dev, recompiled python and reinstalled (make / make install).
Huzza | Yes, that's right. Installing `libncurses5-dev` and running `'make'` and `'make install'` on the `python` installation did the trick. I had encountered the error with `_curses` first while trying to install and fire up `bpython` on my custom python installation. |
47,817,703 | What would be the most idiomatic way to find the days with a drawdown greater than X bips? I again worked my way through some queries but they become boilerplate ... maybe there is a simpler more elegant alternative:
```
q)meta quotes
c | t f a
----| -----
date| z
sym | s
year| j
bid | f
ask | f
... | 2017/12/14 | [
"https://Stackoverflow.com/questions/47817703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1142881/"
] | I think `maxs` is the key function here, which allows you to maintain a running historical maximum, and you can compare your current value to that maximum. If you have some table `quote` which contains some series of mids (`mids`) and timestamps (`date`), the following query should return the days where you saw a drawd... | Difference between `max` and `min` mids for given date may be both increase and drawdown. Depending on if `max` mid precedes `min`. Also, as far a `sym` columns exists, I assume you may have different symbols in the table and want to get drawdowns for all of them.
For example if there are 3 quotes for given day and sy... |
39,133,983 | I am trying to construct a raw `json` string as below to send it out in http request
```
var requestContent = @"{
""name"": ""somename"",
""address"": ""someaddress""
}";
```
Instead of having name and address value hardcoded I was hoping to supply them from below variables
`... | 2016/08/24 | [
"https://Stackoverflow.com/questions/39133983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258956/"
] | You could use a verbatim string together with interpolation as well:
```
var requestContent = $@"{{
""name"": ""{name}"",
""address"": ""{address}""
}}";
```
EDIT: For this to work you have to make sure that curly braces you want in the output are doubled up (just like the quotes). Also, first `$`, then `@`. | Instead use [`Newtonsoft.JSON JObject()`](http://www.newtonsoft.com/json/help/html/CreateJsonDynamic.htm) like
```
dynamic myType = new JObject();
myType.name = "Elbow Grease";
myType.address = "someaddress";
Console.WriteLine(myType.ToString());
```
Will generate JSON string as
```
{
"name": "Elbow Grease",
... |
6,625,920 | We use SVN for a giant server of design assets at my job. I like to keep the root of our server checked out, so I can get organizational updates to the directory hierarchy as they're made. But their are certain directories within that I won't ever be touching... and they're huge... 15 gb+.
I want to rm these director... | 2011/07/08 | [
"https://Stackoverflow.com/questions/6625920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428741/"
] | What you need is not to ignore these folders (since ignoring means setting them out of repository), but to control the depth of checkout.
You can checkout your root with **--depth immediates** option this will only checkout subfolders of the root dir. Then go inside and do the same with folders you need or checkout w... | ```
svn propset svn:ignore <dir>
```
Will ignore the dir. |
50,377,720 | In Python, i need to split two rows in half, take the first half from row 1 and second half from row 2 and concatenate them into an array which is then saved as a row in another 2d array. for example
```
values=np.array([[1,2,3,4],[5,6,7,8]])
```
will become
```
Y[2,:]= ([1,2,7,8])) // 2 is arbitrarily chosen
``... | 2018/05/16 | [
"https://Stackoverflow.com/questions/50377720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9801877/"
] | Try numpy.append
[numpy.append Documentation](https://docs.scipy.org/doc/numpy-1.14.0/reference/generated/numpy.append.html)
```
np.append(values[temp0,0:int((x-1)/2)],values[temp1,int((x-1)/2):x+1])
``` | You don't need splitting and/or concatenation. Just use [*indexing*](https://docs.scipy.org/doc/numpy-1.13.0/reference/arrays.indexing.html):
```
In [47]: values=np.array([[1,2,3,4],[5,6,7,8]])
In [48]: values[[[0], [1]],[[0, 1], [-2, -1]]]
Out[48]:
array([[1, 2],
[7, 8]])
```
Or ravel to get the flattened ... |
34,530,231 | IntelliJ Idea fold if and other statements in JavaScript, but not in Java. How can I get this feature? Maybe you know some plugin or settings? | 2015/12/30 | [
"https://Stackoverflow.com/questions/34530231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5648942/"
] | In Android Studio, in order to fold a try/catch structure -
1. In the editor window, select the left brace after try
2. Type on keyboard `CTRL` + `Shift` + `.`
Now the complete try { .. } block will be folded. | If I want to reduce a try / catch section, it doesn't work for me on Intellij CI 2016, under Ubuntu 16.04 OS.
Even with shortcut or using menus.
Using menus Code > Folding > Fold Selection / Remove Section ( `Ctrl` + Period, where Period is the `.`), it'll close the entire function where the try/catch block is.
It d... |
52 | Questions such as removing viruses or malware, help installing/uninstalling software, configuring Outlook, etc? | 2009/04/30 | [
"https://meta.serverfault.com/questions/52",
"https://meta.serverfault.com",
"https://meta.serverfault.com/users/-1/"
] | If there related to a multi pc environment - such as having a virus affect your whole network or setting up outlook for multiple pc's then that should be ok. 1 Pc with a virus or email error is not really what SF's about, but they will come, I guess the only way to deal with that is good moderation.
I think this will ... | I think this is the biggest risk for serverfault.
Stackoverflow only has to contend with homework and 'give me teh codes pleez' questions. But the world is full of more or less clueless people with PCs who do know how to use Google...
This is where the low barrier to entry (no login required) could become a problem,... |
24,969,522 | I am trying to write to a txt file from a JAVA Application. I have tried using Buffered Writer, then just FileWriter to create a new file within a potentially new (not indefinitely since more files with different names will be later programatically written there by the same method) subfolder. I get the following error ... | 2014/07/26 | [
"https://Stackoverflow.com/questions/24969522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3855264/"
] | Looking at
```
new FileWriter("src/opinarium3/media/presentaciones/"+title+"/comments/...")
```
I see that you are trying to introduce a directory from variable title. Not sure whether this creates all missing directories. So please make sure that this directory exists and create it before writing to the file two le... | You can try any one based on file location. Just use prefix `/` to start looking into `src` folder.
```
// Read from resources folder parallel to src in your project
File file1 = new File("resources/abc.txt");
System.out.println(file1.getAbsolutePath());
// Read from src/resources folder
File file2 = new File(getClas... |
25,982,325 | I am starting to follow [this](http://ionicframework.com/docs/guide/installation.html) demo for learning the ionic framework.
I made it to the point where it suggests that I type in `ionic platform android`. When I type that, I get this error:
```
C02FF724DF91:todo jcorser$ ionic platform android
Creating android pr... | 2014/09/22 | [
"https://Stackoverflow.com/questions/25982325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3779669/"
] | On windows set the `ANDROID_HOME` in System Variables | If you installed Android SDK via Homebrew, then fix this:
```
export ANDROID_HOME=`brew --prefix android`
``` |
41,537,283 | I'm using a library called DS3231 by rinkydinkelectronics
Link: <http://www.rinkydinkelectronics.com/library.php?id=73> (click on manual)
i'm trying to run the following code
```
String alarmTime = "08:52:00";
void loop(){
if (rtc.getTimeStr() == alarmTime){
alarmState = true;
... | 2017/01/08 | [
"https://Stackoverflow.com/questions/41537283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6229886/"
] | If understood your code right, you want to check whether both strings are equal. Because the standard library is not available in the Arduino IDE, you must choose a different way. Convert the C string (`char*`) to a [`String` object](https://www.arduino.cc/en/Reference/StringLibrary).
Example:
```
if(String(rtc.getTi... | You're trying to compare two different things with confusingly similar names. A [string](https://www.arduino.cc/en/Reference/String)(C style string) is a null terminated char array. This is different from the [String object](https://www.arduino.cc/en/Reference/StringObject). It's generally accepted that with extremely ... |
611,357 | I have a beginners question in T-SQL.
We imported Excel Sheets into a SQL Server 2008. Too bad these Excel files were not formatted the way they should be. We want a phone number to look like this: '012345678', no leading and trailing whitespace and no whitespace within. Even worse sometimes the number is encoded with... | 2009/03/04 | [
"https://Stackoverflow.com/questions/611357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132162/"
] | Something like
```
replace(replace(rtrim(ltrim('0123-2349823')), '-', ''), '/', '')
```
should work. Doesn't look pretty. ;) | I would go about it with an update and use the 'Replace' and LTrim/RTrim functions for SQL.
```
Update Table1
set phonenum = Case
When phonenum like '%-%' Then LTrim(RTrim(Replace(phonenum, '-', '')))
Else LTrim(RTrim(Replace(phonenum, '/', '')))
End
``` |
437,210 | Has anyone ever transcoded music from a high-quality aac to an mp3 (or vice-versa). The internet is full of people who say this should never be done, but apart from the theoretical standpoint that you can only lose information, does it matter in practise?
* is the difference perceivable, except on studio-equipment?
* ... | 2012/06/15 | [
"https://superuser.com/questions/437210",
"https://superuser.com",
"https://superuser.com/users/76106/"
] | It'll really depend on what the nature of the audfio, the hearing of the person involved, the gear *and* both psycological and psycoacoustic models.
Basically different psycoacoustic models discard different types of signals, so you'd lose *different* things.
I'd avoid it personally, but if you *had* to do it, you p... | Information will inevitably be lost, but unless you're an audiophile using top-grade equipment, the difference will likely not be noticeable.
Conversion of any data, whether or not it is already in a lossy format, to another format which is lossy, will result in loss of information as the compression algorithms will a... |
1,084,194 | I'm working on a page using `<canvas>`, which is a HTML5 tag, in Visual Web Developer Express Edition 2008, and the validator in the HTML editor is telling me it's an invalid tag. That's because it's set to validate against XHTML 1.0 Transitional. I'd prefer for it to not do that and tell me what's valid or invalid bas... | 2009/07/05 | [
"https://Stackoverflow.com/questions/1084194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16308/"
] | I created a validation schema that you're free to use:
<http://johndyer.name/post/2009/07/21/HTML5-XHTML5-Validation-Schema-for-Visual-Studio-2008.aspx> | This is now included in [Visual Studio 2010 SP1](http://www.microsoft.com/download/en/details.aspx?id=23691) |
52,223,462 | To help learn about machine learning I am coding up some examples, not to show that one method is better than another, but to illustrate how to use various functions and what parameters to tune. I started with [this blog](https://www.r-craft.org/r-news/boost-series-i-advantage-in-smooth-functions/) that compared BooST ... | 2018/09/07 | [
"https://Stackoverflow.com/questions/52223462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7351478/"
] | ```
String joined = Arrays.stream(myArray)
.mapToObj(String::valueOf)
.collect(Collectors.joining(""));
System.out.println(joined);
``` | I will go old school, which works every time no matter what as follows:
```
String myString = "";
for(int val : myArray)
{
myString += val;
}
System.out.println(myString); // To check the output of myString
```
Will work! Hope this helps!
**Note**: This will work in Embedded Java as well where StringBuilder and ... |
1,475,059 | I have a few that I think are correct. These are background colours for messages.
* ERROR: red;
* INFO: blue;
* SUCCESS: green;
* NOT IMPORTANT INFO: yellow
Have I got the blue and yellow around the wrong way? Any hex values that are a de facto standard for these?
I am curious considering web development, but I thin... | 2009/09/25 | [
"https://Stackoverflow.com/questions/1475059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31671/"
] | There are no standards for hex values to use. In most cases you will want to consider the choice in the context of the site or application. Try a range and you'll find one that sticks.
Colour can mean different things in different countries so you may want to consider alternatives if you need to support users in a co... | Yellow usually means warning. Less important info might be gray text without any special icon or background color.
But ultimately it needs to make sense to your users. |
21,325,661 | How do you convert an image from a path on the user's computer to a base64 string in C#?
For example, I have the path to the image (in the format `C:/image/1.gif`) and would like to have a data URI like `data:image/gif;base64,/9j/4AAQSkZJRgABAgEAYABgAAD..` representing the `1.gif` image returned. | 2014/01/24 | [
"https://Stackoverflow.com/questions/21325661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2398275/"
] | Try this
```
using (Image image = Image.FromFile(Path))
{
using (MemoryStream m = new MemoryStream())
{
image.Save(m, image.RawFormat);
byte[] imageBytes = m.ToArray();
// Convert byte[] to Base64 String
string base64String = Convert.ToBase64String(imageBytes);
return b... | You can use `Server.Map` path to give relative path and then you can either create image using `base64` conversion or you can just add `base64` string to `image src`.
```
byte[] imageArray = System.IO.File.ReadAllBytes(Server.MapPath("~/Images/Upload_Image.png"));
string base64ImageRepresentation = Convert.ToBase64S... |
907,674 | I'm receiving from socket A and writing that to socket B on the fly (like a proxy server might). I would like to inspect and possibly modify data passing through. My question is how to handle border cases, ie where the regular expression I'm searching for would match between two successive socket A read and socket B wr... | 2009/05/25 | [
"https://Stackoverflow.com/questions/907674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In that sense you're talking about (and all senses for, say, TCP) sockets are streams. It follows from your question that you have some structure in the data. So you must do something similar to the following:
1. Buffer (hold) incoming data until a boundary is reached. The boundary might be end-of-line, end-of-record,... | One alternative is to use `poll(2)`-like strategy with non-blocking sockets. On read event grab a buffer from the socket, push it onto incoming queue, call the lexer/parser/matcher that assembles the buffers into a stream, then pushes chunks onto the output queue. On write event, take a chunk from the output queue, if ... |
12,428,185 | I'm working on a project of type "ASP.NET dynamic data LINQ to LINQ application".
When i execute my application I'm getting all labels and DropDownLists dynamically binding.
I'm referring [this](http://www.shubho.net/2011/03/customizing-dynamic-data-application.html) blog.
Now I need to populate those DropDownList b... | 2012/09/14 | [
"https://Stackoverflow.com/questions/12428185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428073/"
] | In order to customize data in `DropDownList` control in Dynamic Data site you should use `FilterUIHintAttribute` class (in your metadata) that allows to replace (or add new filters) default (`built-in filters templates`) filters.
Consider example of implementing new filter template **using built-in filter template** f... | I'm assuming that the data type you are binding is a nullable bool (bool?). When assigning the DataSource property, you can use `myObjects.Where( o => o.TheNullableBool.HasValue )`. |
9,469,537 | Do I need to worry about performance in the case below and save the result of the expensive call, or does the compiler recognise it can do the expensive call once?
```
String name;
if (object.expensiveCall() != null) {
name = object.expensiveCall().getName();
}
``` | 2012/02/27 | [
"https://Stackoverflow.com/questions/9469537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/534994/"
] | You're looking for something called [memoization](http://en.wikipedia.org/wiki/Memoization). [This question](https://stackoverflow.com/questions/3934777/java-automatic-memoization) suggests that Java can't do it natively.
In general, memoization is only possible if the compiler/JIT can prove that the function has no s... | How could the Java compiler know, that `expensiveCall` has no side effects? In the general case - it cannot. Also: You might recompile the class of `object` anytime without recompiling your current class. And what would happen if `expensiveCall` has got side effects *now*? No way for automatic optimization.
BTW: The J... |
9,071,205 | I'm going to make a word wrap algorithm in PHP. I want to split small chunks of text (short phrases) in *n* lines of maximum *m* characters (*n* is not given, so there will be as much lines as needed). The peculiarity is that lines length (in characters) has to be much balanced as possible across lines.
Example of inp... | 2012/01/30 | [
"https://Stackoverflow.com/questions/9071205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/995958/"
] | I've implemented on the same lines of Alex, coding the Wikipedia algorithm, but directly in PHP (an interesting exercise to me). Understanding how to use the optimal cost function *f(j)*, i.e. the 'recurrence' part, is not very easy. Thanks to Alex for the well commented code.
```
/**
* minimumRaggedness
*
* @para... | Here is a bash version:
```
#! /bin/sh
if ! [[ "$1" =~ ^[0-9]+$ ]] ; then
echo "Usage: balance <width> [ <string> ]"
echo " "
echo " if string is not passed as parameter it will be read from STDIN\n"
exit 2
elif [ $# -le 1 ] ; then
LINE=`cat`
else
LINE="$2"
fi
LINES=`echo "$LINE" | fold -s -w... |
8,714,090 | Is there a way to do a wildcard element name match using `querySelector` or `querySelectorAll`?
The XML document I'm trying to parse is basically a flat list of properties
* I need to find elements that have certain strings in their names.
* I see support for wildcards in attribute queries but not for the elements th... | 2012/01/03 | [
"https://Stackoverflow.com/questions/8714090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1128062/"
] | Set the tagName as an explicit attribute:
```
for(var i=0,els=document.querySelectorAll('*'); i<els.length;
els[i].setAttribute('tagName',els[i++].tagName) );
```
I needed this myself, for an XML Document, with Nested Tags ending in `_Sequence`. See *JaredMcAteer* answer for more details.
```
document.que... | i'm looking for **regex + not + multiClass** selector, and this is what I got.
Hope this help someone looking for same thing!
```
// contain abc class
"div[class*='abc']"
// contain exact abc class
"div[class~='abc']"
// contain exact abc & def(case-insensitively)
"div[class~='abc'][class*='DeF'i]"
// contain e... |
16,900,614 | I am curious, if I have two pointers
```
int *x = (int *)malloc(sizeof(int));
int *y;
```
and I want y to point to the address of x, is
```
y = x;
```
the same as
```
y = &*x;
```
? | 2013/06/03 | [
"https://Stackoverflow.com/questions/16900614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1876508/"
] | Your question has two parts, and it's worth noting that they are not both correct:
First, you ask:
>
> is
>
> y = x;
>
> the same as
>
> y = &\*x;
>
>
>
Since the dereference (`*`) and address-of (`&`) operators have the same [precedence](http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Oper... | Here is a handy little function that may help. Not sure that you need all of the "includes".
```
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
#include <typeinfo>
using namespace std;
int main() {
int *x = (int *)malloc(sizeof(int));
int *y = x;
int *z = &*x;
//y = x;
//z = &*x;
cout ... |
8,889,958 | I have an array. One of the values in that array `responses[1]` is an integer. This integer can be from 1 to whatever number you want. I need to get the last number in the integer and determine based on that number if I should end the number with 'st', 'nd', 'rd', or 'th'. How do I do that? I tried:
```
var placeEndin... | 2012/01/17 | [
"https://Stackoverflow.com/questions/8889958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407756/"
] | If all you want is the last digit, just use the modulus operator:
`123456 % 10 == 6`
No need to bother with string conversions or anything. | Alternate way to get lastInt is:
```
var lastInt = parseInt(stringInt)%10;
switch lastInt {
case 1:
placeEnding = 'st';
break;
case 2:
placeEnding = 'nd';
break;
case 3:
placeEnding = 'rd';
break;
default:
placeEnding = 'th';
}
``` |
5,373,107 | Is it possible to implement `static` class member functions in \*.cpp file instead of doing
it in the header file ?
Are all `static` functions always `inline`? | 2011/03/21 | [
"https://Stackoverflow.com/questions/5373107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Yes you can define static member functions in \*.cpp file. If you define it in the header, compiler will by default treat it as inline. However, it does not mean separate copies of the static member function will exist in the executable. Please follow this post to learn more about this:
[Are static member functions in... | @crobar, you are right that there is a dearth of multi-file examples, so I decided to share the following in the hopes that it helps others:
```
::::::::::::::
main.cpp
::::::::::::::
#include <iostream>
#include "UseSomething.h"
#include "Something.h"
int main()
{
UseSomething y;
std::cout << y.getValue() ... |
31,614,645 | I'm starting to learn swift, but ran into an error. Ive just created a very simple app from a course I'm following, that calculates a cats ages based on what the user enters. The first version of the app just times what the user enters by 7, which i managed todo no problem. I thought I would have a play with what I've ... | 2015/07/24 | [
"https://Stackoverflow.com/questions/31614645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3434939/"
] | You have already assigned the value to the `enteredAge` variable like follows:
```
var enteredAge = enterAge.text.toInt()
```
So, you cannot do assignment on the place of this if expression. and you need to have condition on the if expression as follows.
```
if enteredAge == 1 {
var catYears = 15
resultLa... | should look like this :
```
@IBAction func button(sender: AnyObject) {
var inputYears = textField.text.toInt()!
if inputYears == 1 {
var catOld = 15
result.text = "Your cat is \(catOld) years old"
}
else if inputYears == 2 {
var catOld = 25
result.text = "Your cat is \(catOld) years old... |
62,146 | The trackpad on my Macbook Pro just started acting oddly. It's randomly clicking (which might cause me to switch programs), right-clicking and even once my screen even showed the swiping animation as if I was trying to switch to a different desktop.
Part of me fears that this is some sort of joke hacking attempt (I k... | 2012/08/27 | [
"https://apple.stackexchange.com/questions/62146",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/4049/"
] | This was fixed -- and remains fixed -- after a **third internet Reinstall**.
Done through the Recovery Partition, start up with Command R. | Shift/control/option and turn off the computer wait 10 secs and then start-up,it should stop that annoying cursor. |
14,927,085 | This is what I have:
```
public class A1tester {
static String dna = "GCTTTA";
static String dna1 = "GCTAAAAAD";
public static void main(String[] args) {
validChars(dna);
validChars(dna1);
}
private static boolean validChars(String dna) {
try {
for (char c: dna... | 2013/02/17 | [
"https://Stackoverflow.com/questions/14927085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1478804/"
] | `assert` throws [`AssertionError`](http://docs.oracle.com/javase/7/docs/api/java/lang/AssertionError.html) which is not a subclass of [`Exception`](http://docs.oracle.com/javase/7/docs/api/java/lang/Exception.html), but a subclass of [`Error`](http://docs.oracle.com/javase/7/docs/api/java/lang/Error.html). | Assert throws an Error, which is not an Exception!
Try this:
```
...
catch (Throwable e)
```
or to catch only the assertion failure:
```
catch (AssertionError e)
``` |
3,018,123 | **Problem:** I want to determine the original file creation time from a file uploaded to my server via PHP.
My understanding is that the file is copied from the client to a temporary file on my server, which then is referenced in the $\_FILES var. The temporary file is of course of no use because it was just created.... | 2010/06/10 | [
"https://Stackoverflow.com/questions/3018123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/324801/"
] | That data is not sent by the browser, so there's no way to access it. The data sent along with the file is `mime-type`, `filename` and file contents.
If you want the creation date, you'll either need the user to provide it or create a special file uploading mechanism via Flash or Java. | No, the stream of data is written to a file in the tmp dir instead of the file being simple 'copied' to your webserver, to it's technically a 'new' file. |
535,596 | What is your biggest pet peeve related to the windbg debugger from microsoft?
(note: I actually really like windbg if I ignore the unpolished UI.) | 2009/02/11 | [
"https://Stackoverflow.com/questions/535596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5429/"
] | Attempting to dock a window is almost always the wrong kind of dock the first time until :I move the mouse just right. Why can't it have the docking cues that VS2008 has? | Key presses are ignored while the focus is in a source window. It's not like you can edit the source code from inside windbg. At least there's the Alt-1 workaround. |
2,047,793 | What is the difference between override and overload? | 2010/01/12 | [
"https://Stackoverflow.com/questions/2047793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/190623/"
] | * Overloading: picking a method **signature** at compile time based on the number and type of the arguments specified
* Overriding: picking a method **implementation** at execution time based on the actual type of the target object (as opposed to the compile-time type of the expression)
For example:
```
class Base
{
... | On interesting thing to mention:
```
public static doSomething(Collection<?> c) {
// do something
}
public static doSomething(ArrayList<?> l) {
// do something
}
public static void main(String[] args) {
Collection<String> c = new ArrayList<String> ();
doSomething(c); // which method get's called?
}
... |
1,517,718 | Does every infinite field contain a *countably infinite* subfield?
It's easy to see that every field $K$ contains either the rational numbers $\Bbb Q$ (when $K$ has characteristic $0$) or a finite field $\Bbb F\_p$ (when $K$ has characteristic $p$). Thus, in the characteristic $0$ case, the answer is an easy "yes."
B... | 2015/11/07 | [
"https://math.stackexchange.com/questions/1517718",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/80762/"
] | Yes. If $S$ is a countably infinite subset of $K$ then the subfield generated by $S$ is countable.
Since the question got six upvotes before any answers, maybe this is not obvious. Details:
Let $S\_0=S$. Let $S\_{n+1}$ consist of the elements of $S\_n$ together with all the $x+y$, $x-y$, $xy$ and $x^{-1}$ for $x,y\in... | Suppose $K$ has characteristic $p$.
If $K$ has a transcendental element $\alpha$, then $\mathbf{F}\_p(\alpha) \subseteq K$ is countably infinite, being isomorphic to the rational function field $\mathbf{F}\_p(x)$.
Otherwise, $K \subseteq \overline{\mathbf{F}}\_p$ which is countable, so you can just take $K$ itself to... |
20,479,527 | I have a parent class `Parent` and a child class `Child`. `Parent` has a method `doSomething` which is extended by `Child` (it calls `[super doSomething]` before doing its own stuff).
Under certain circumstances the parent checks some details and knows that nothing more should happen so returns. I expected a return st... | 2013/12/09 | [
"https://Stackoverflow.com/questions/20479527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225253/"
] | One way would be to change `doSomething` to have a return value of `BOOL`. If the method completes fully, return `YES`, otherwise return `NO`. Then you can do something like:
Parent:
```
- (BOOL)doSomething {
// lots of processing
if (/* can't finish for some reason */) {
return NO;
} else {
... | One additional solution I am considering is to split the 'test' and the 'action' as follows. `Parent`'s `doSomething` will perform the test. If necessary, it will return. Otherwise, it will call `doThisOtherThing`. `doThisOtherThing` in the parent will be empty.
Each `Child` *will* implement `doThisOtherThing`. It wil... |
13,410,497 | In this case, my xml file shows a certain layout while at runtime another one is generated. I am incredibly confused as to why the layout shown at runtime is completely different from the one given. here is the code for the xml file
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
andro... | 2012/11/16 | [
"https://Stackoverflow.com/questions/13410497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1515921/"
] | This one looks fine. Double check if you are changing any property with your java code. | Try to use this one instead. I have removed the useless LinearLayout and try to make the EditText clickable.
```
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<EditText
... |
48,919,416 | I have two Forms (Form "Sales Order" and Form "Insert Detail Document"). In Form "Sales Order" I have insert some values into several objects, please refer to the following screenshot:
[](https://i.stack.imgur.com/IHiOK.jpg)
After insert some values ... | 2018/02/22 | [
"https://Stackoverflow.com/questions/48919416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5014709/"
] | ```
public class Product_List {
public string Branch { get; set; }
public string InvetoryID { get; set; }
public string Warehouse { get; set; }
public string Quantity { get; set; }
public string Unit { get; set; }
}
public partial class I... | In such cases i prefer to use an event.
You could register the events in your main form.
On the add button, you could inform the grid window.
You could transport your data in some easy to use EventArgs.
This way allows you to easily change your form by just expand your EventArgs |
10,117,258 | I'm querying a table in a db using php. one of the fields is a column called "rank" and has data like the following:
```
none
1-bronze
2-silver
3-gold
...
10-ambassador
11-president
```
I want to be able to sort the results based on that "rank" column. any results where the field is "none" get excluded, so those don... | 2012/04/12 | [
"https://Stackoverflow.com/questions/10117258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/196230/"
] | preamble is a source code comment appearing before the function that documents its behaviour, normally in a way that a tool like doxygen can automatically create useful documentation from it.
A good policy for documentation is to **document everything that isn't obvious and nothing that is**. On that basis, I'd say yo... | If this is homework, I **strongly** suggest you ask this question in class as most teachers have some particular requirements that an online community is unlikely to know about (unless you tell us ;-). That being said, we might be able to get you started in the right direction.
The *preamble* is usually a (short) desc... |
108,484 | As a PhD student in a multidisciplinary subject, I am grouped with a postdoc by my supervisor. In our lab, the usual rule is student do the theory and coding, and postdoc do the experiment.
My collaborator postdoc is highly unmotivated: he badly performed the experimental tasks that I told him to do (most of the time,... | 2018/04/21 | [
"https://academia.stackexchange.com/questions/108484",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/33520/"
] | To motivate someone, or at least not demotivate them, you should make them feel valued and taken seriously. Everything you are saying points in the direction of that not happening.
For example, your postdoc isn't working *for* you; he is working *with* you. Or at least, that's how the situation should be if you want h... | As a postdoc who is often unmotivated, I will try to help you out.
Clearly you are not in ideal academic ambiance for high-quality intellectual output. Your supervisor looks parasitic in relying on others to work on their own albeit in his behalf, and this postdoc is relying on you to do the hard work. Providing the w... |
1,143,335 | I'm designing a .net interface for sending and receiving a HL7 message and noticed on this forum theres a few people with this experience.
My question is.... Would anyone be able to share their experience on **how long** it could take to get a message response back from a hospital HL7 server. (Particularly when reques... | 2009/07/17 | [
"https://Stackoverflow.com/questions/1143335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/138234/"
] | This is quite dependent on the kind of HL7 message sent, typically messages like ADT's are sent as essentially updates to the server, and are acknowledged almost immediately if the hospital system is behaving well. This will result in a protocol level acknowledgement, which indicates that the peer has received the mess... | It depends if the response is generated automatically by a system or if the response is generated after an user does something on the system. For an automatic response it might take less than a second, depending of course on the processing that is done by the system and the current work load of that system. If the syst... |
323,840 | I updated my MacBook Pro 13" to Lion a few weeks ago. I just found out that Apache Bench (apache2.2.19) is not working. It always shows this error, no matter what:
>
> apr\_socket\_recv: Connection reset by peer (54)
>
>
>
I also did a clean install on my Mac Mini and it produced the same error.
How can I fix th... | 2011/08/16 | [
"https://superuser.com/questions/323840",
"https://superuser.com",
"https://superuser.com/users/94354/"
] | This is due to a bug in the Apache software that's bundled with Lion. A more recent version of Apache (beta) fixes the problem. To fix ab, here are the steps:
1. Download the latest version of Apache
```
$ wget http://apache.mirrors.pair.com//httpd/httpd-2.3.16-beta.tar.bz2
```
If 2.3.16 is not available, go to <ht... | Using the method of updating ab through homebrew at [this](http://simon.heimlicher.com/articles/2012/07/08/fix-apache-bench-ab-on-os-x-lion) link worked for me.
```
brew install 'https://raw.github.com/simonair/homebrew-dupes/e5177ef4fc82ae5246842e5a544124722c9e975b/ab.rb'
brew test ab
``` |
16,543,078 | What is the fastest way in Python to replace sequence of 3 and more same characters in utf-8 text?I need to replace sequence of 3 and more same characters with exact 2 characters.
I.e.
```
aaa -> aa
bbbb -> bb
abbbcd -> abbcd
124xyyyz3 -> 124xyyz3
``` | 2013/05/14 | [
"https://Stackoverflow.com/questions/16543078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2000535/"
] | ```
>>> import re
>>> re.sub(r'(\w)\1{2,}', r'\1\1', 'aaa')
'aa'
>>> re.sub(r'(\w)\1{2,}', r'\1\1', 'bbbb')
'bb'
``` | You can use regular expression:
```
import re
re.sub(r'(.)\1{2,}', r'\1\1', 'bbbbbaaacc')
```
Pattern captures any character followed by the same character repeated two or more times and matches this substring. The replacement replaces a matched substring with just two of the captured character. Dot will not replace... |
3,047,010 | The official Redis homepage lists JDBC-Redis and JRedis. What are the advantages / disadvantages of each ? Are there any other options ? | 2010/06/15 | [
"https://Stackoverflow.com/questions/3047010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7111/"
] | just an update: it seems jredis is not that active anymore, jedis however is going strong and had some great features implemented recently, it s also the same developer of JOhm.
extract from their readme on github:
Ok.. so what can I do with Jedis?
[...]
Transactions
Pipelining
Publish/Subscribe
Persistence
con... | JDBC-Redis is just a JDBC wrapper for JRedis database.
If you plan on using your code with different back-ends then JDBC is a good way to go. NOTE: It is not a complete JDBC implementation and the NOSQL will bleed through.
If you are going to stay with Redis then I would suggest using the API, which will give you... |
4,173,787 | I have a string in which the word `local` occurs many times. I used the `find()` function to search for this word, but it will also find e.g. `locally`. How can I match `local` exactly? | 2010/11/13 | [
"https://Stackoverflow.com/questions/4173787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1648247/"
] | ```
line1 = "This guy is local"
line2 = "He lives locally"
if "local" in line1.split():
print "Local in line1"
if "local" in line2.split():
print "Local in line2"
```
Only line1 will match. | If you want to check for existence, try to think the other way...
and you can make something like this...
check for a pattern not equal to what you want exactly and if there's a match
then check if the result is equal to what you want.
```
st1:str ='local!'
st2:str =' locally!'
match1 = re.search(r'local\... |
66,050,982 | This is a noob question but how come when I assign 'john.residence?.numberOfRooms = 5' and then attempt to unwrap the value with optional-chaining, it prints "no rooms"??
I would think by assigning (numberOfRooms = 5) that it would contain that value???
```
class Residence {
var numberOfRooms = 1
}
class Person ... | 2021/02/04 | [
"https://Stackoverflow.com/questions/66050982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Have you added few lines of configuration on AndroidManifest.xml ?
You should add:
```
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
```
check this url: <https://pub.dev/packages/image_cropper/versions/... | Any Feedback on this?
It seems it happening every time i call pickImage.
Future getImage() async {
final \_imageFiles =
await ImagePicker().getImage(source: ImageSource.gallery);
```
if (_imageFiles != null) {
File _imageFile = await Navigator.of(context).push(
MaterialPageRoute(
builder: (_) => ImageC... |
39,797,552 | I'm currently working my way through a "List" unit and in one of the exercises we need to create an anagram (for those who don't know; *two words are an anagram if you can rearrange the letters from one to spell the other*).
The easier solution that comes to mind is:
```
def is_anagram(a, b):
return sorted(a) == ... | 2016/09/30 | [
"https://Stackoverflow.com/questions/39797552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5337929/"
] | If you need to check if `a` word could be created from `b` you can do this
```
def is_anagram(a,b):
b_list = list(b)
for i_a in a:
if i_a in b_list:
b_list.remove(i_a)
else:
return False
return True
```
**UPDATE(Explanation)**
`b_list = list(b)` makes a `list` of ... | ```
def is_anagram(a, b):
test = sorted(a) == sorted(b)
testset = b in a
testset1 = a in b
if testset == True:
return True
if testset1 == True:
return True
else:
return False
```
No better than the other solution. But if you like verbose code, here's mine. |
8,772,570 | Is there a project online that I can download and study that covers unit testing (Nunit or VS)?
I'm new to unit testing and thought it could be helpful to learn by real example. | 2012/01/07 | [
"https://Stackoverflow.com/questions/8772570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194076/"
] | There are multiple samples installed with NUnit already.
See the [list of NUnit samples](http://www.nunit.org/index.php?p=samples&r=2.5.10). | Sharp Architectue's [Northwind sample project has NUnit tests](https://github.com/sharparchitecture/Northwind/tree/master/Solutions/Northwind.Tests)
[Their Who-Can-Help-Me sample project has MSpec tests](https://github.com/sharparchitecture/Northwind/tree/master/Solutions/Northwind.Tests)
There are really tons of pr... |
174,278 | Is it possible (how) to mount an VHD file created by Windows 7 in OS X?
I found some information about how to do this on linux. There is a fuse fs "vdfuse" which uses virtualbox libs to mount filesystems supported by virtualbox. However I was unable to compile the package on osx because nearly all headers are missing ... | 2010/08/25 | [
"https://serverfault.com/questions/174278",
"https://serverfault.com",
"https://serverfault.com/users/52273/"
] | Finally I got it working. So in summary here are the steps to perform
1. Install macfuse
2. Install Virtual Box
3. Compile vdfuse as mentioned in the question
4. Mount the vhd disk
sudo ./vdfuse -tVHD -w -f/Path/To/VHD /Path/To/Mountpoint
5. Attach the virtual partition blockfiles
hdiutil attach -imagekey diskimage-... | FUSE works on MacOSX, however you would need the headers. |
72,128,276 | I essentially want recode and rename a range of variables in a dataframe. I am looking for a way to do this in the single step.
Example in pseudo-code:
```
require(dplyr)
df <- iris %>% head()
df %>% mutate(
paste0("x", 1:3) = across( # In the example I want to rename
Sepal.Length:Petal.Length, #... | 2022/05/05 | [
"https://Stackoverflow.com/questions/72128276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9434803/"
] | Maybe `rename_with()` is what you want. After that you can manipulate these renamed columns with `mutate(across(...))`.
```r
library(dplyr)
df %>%
rename_with(~ paste0("x", seq_along(.x)), Sepal.Length:Petal.Length) %>%
mutate(across(x1:x3, ~ .x * 10))
x1 x2 x3 Petal.Width Species
1 51 35 14 0.2 setos... | You could add consecutive numbers to `n` columns with the same prefix this way:
```
df <- iris %>% head()
n <- 3
colnames(df)[1:n] <- sprintf("x%s",1:n)
```
output:
```
# x1 x2 x3 Petal.Width Species
# 1 5.1 3.5 1.4 0.2 setosa
# 2 4.9 3.0 1.4 0.2 setosa
# 3 4.7 3.2 1.3 0.2 setosa
# 4 4... |
28,248,496 | Since the Apple "Users & Roles" update to iTunesConnect end of november 2015 some people have been experiencing an error message "iTunes Store operation Failed" and "You are not authorized to use this service".
This happens when using XCode 6 and 7
... | 2015/01/31 | [
"https://Stackoverflow.com/questions/28248496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4044969/"
] | I know it is an old question, but maybe I noticed something that it might help you.
Today when I try to login to **Itunes Connect** via browser, Apple returns me a message "*Your Apple ID or password was entered incorrectly.*" , but I'm sure that my id and pass was correct . It seems apple side problem, not ours.
I t... | Delete your Apple ID from xocde and add it again, make sure you quite beta Xcode if you have opened, then open it again, clean, archive, validate, it works for me |
30,798,794 | I am writing a WPF application which uses a number of unmanaged DLL's. Something in the program is causing memory leak and I monitored the application using Redgate ANTS 8 Memory Profiler. ANTS shows that the memory usage of MSVCR110.dll is constantly increasing.
The question is that can managed code cause this leak b... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30798794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3670437/"
] | Take a few Snapshots and see if there is any growth in any managed objects. You can select objects with source options in ANTS memory profiler and if instance count it growing for any of your objects. And then, you can have a look at the ‘Instance Retention graph’ for any of growing instance and see which holds the ref... | The answer was not easy to find. I had tried each DLL that I suspected one by one. The leak was an undeleted array in a C++/CLI wrapper class. Since it is a managed dll, I think, the native "new" calls are traced through msvcr110.dll, and ANTS shows leak in that dll. |
76,245 | Throughout *Logan* we see that Charles does not have the same control of his powers as he did in previous movies.
He has these seizures that keeps everyone paralyzed and harms people. He talks to himself (people that don't exist?!).
We also see that Wolverine does not have the same healing efficiency, his claws do no... | 2017/07/13 | [
"https://movies.stackexchange.com/questions/76245",
"https://movies.stackexchange.com",
"https://movies.stackexchange.com/users/42976/"
] | There are a couple of ways to interpret the series of events and how each mutant has lost their powers.
**1. They're both getting old.**
At the time of Logan, Xavier is about 97 years old. Logan's physical body is reaching about 150 years old (although depending on the timeline shenanigans he could mentally be a lot ... | He wasn't. At least not specifically his powers. He was having seizures and losing control *period*. Just like if you had a seizure and your legs lashed out. |
9,204,706 | I have simple node js http server.
```
var http = require("http");
http.createServer(function(request, response) {
response.writeHead(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
```
If I run
```
node basicserver.js
```
I get
```
node.js:201
... | 2012/02/09 | [
"https://Stackoverflow.com/questions/9204706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/929701/"
] | The port you are listening to is already being listened by another process. In this case I got a feeling that it is your self. You can do a `ps aux | grep node` and then using `kill <pid>` kill your node process. Beside that you can also try another port.
--Update--
In case if you want to find which process is listen... | The port you are listening to is already being listened by another process.
When I faced to this error I killed the process using Windows PowerShell (because I used Windows)
1. open the windows powershell
2. type `ps` and then you can get list of processes
3. find the process named `node`, and note the `Id`
4. type `... |
7,820,809 | Why does this work:
```
a = np.random.rand(10, 20)
x_range = np.arange(10)
y_range = np.arange(20)
a_tmp = a[x_range<5,:]
b = a_tmp[:, np.in1d(y_range, [3,4,8])]
```
and this does not:
```
a = np.random.rand(10,20)
x_range = np.arange(10)
y_range = np.arange(20)
b = a[x_range<5, np.in1d(y_range,[3,4,8])]
``` | 2011/10/19 | [
"https://Stackoverflow.com/questions/7820809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/235617/"
] | The Numpy reference documentation's [page on indexing](http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html#boolean) contains the answers, but requires a bit of careful reading.
The answer here is that indexing with booleans is equivalent to indexing with integer arrays obtained by first transforming the boo... | Another way to achieve this is to select the per-axis indices you want separately, i.e.:
```py
A[rows, :][:, cols]
```
Concrete example:
```py
>>> A = np.arange(9).reshape(3, 3)
>>> A
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])
# Slicing works as expected.
>>> A[1:, :2]
array([[3, 4],
[6, 7]])
#... |
684,506 | I recently tried installing surfshark-vpn and openvpn3 using the following guides.
<https://surfshark.com/blog/how-to-set-up-a-vpn-on-linux>
<https://openvpn.net/cloud-docs/openvpn-3-client-for-linux/> (I feel like something in this guide might be the problem)
But since then, `apt` and `apt-get` fail giving the foll... | 2021/12/31 | [
"https://unix.stackexchange.com/questions/684506",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/508218/"
] | I'm not familiar with pop-os. Meaning I have no idea where exactly the ubuntu repositories are selected, but I think from /etc/apt/sources.list like ubuntu.
[ubuntu wiki](https://help.ubuntu.com/community/EOLUpgrades/)
the sources from code `#EOL upgrade sources.list` you can use also to install the software. For groo... | It isn't `apt` and `apt-get` that are failing. The error messages are due to `apt update` and/or `apt-get update`. You should still be able to install `ppa-purge` with `apt install ppa-purge`.
>
> Delete a line in /etc/apt/sources.list but it looks like everything in that file is already commented out. (Will show it'... |
65,847,773 | I have a dataframe with the following values. I want to dedect dates, when the Low is crossing below the SMA8Low.
```
df['SMA10High'] = df.loc[:,'High'].rolling(window=10).mean()
df['SMA8Low'] = df.loc[:,'Low'].rolling(window=8).mean()
df['yesterday'] = df['Low'].shift(1) >= df['SMA8Low'].shift(1) #yesterdays
... | 2021/01/22 | [
"https://Stackoverflow.com/questions/65847773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9107254/"
] | The "official" answer is `freopen()`. Theoretically you can call
```
freopen("somefile", "r", stdin);
```
and now `stdin` is reading from `"somefile"`. However, once you've done this it's either tricky or impossible to get `stdin` pointing back at standard input (or, as you called it, "the console") when you're done... | Save it in another variable first.
```
FILE *save_stdin = stdin;
stdin = fp;
...
stdin = save_stdin;
```
Of course, there may be no need to change `stdin` in the first case. You could just use `getc(fp)` instead of `getchar()`. Reassigning `stdin` would only be necessary if you're calling code that uses `stdin` and ... |
114,424 | There are a ton of questions on Programmers.SE about whether or not taking extended time off is a good idea and what to do during that time off to maintain your skill level:
<https://softwareengineering.stackexchange.com/questions/31536/will-taking-two-years-off-for-school-in-a-related-field-destroy-a-mid-level-devel>... | 2011/10/14 | [
"https://softwareengineering.stackexchange.com/questions/114424",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/38677/"
] | Honestly I think you're over thinking it a bit. If you were gaining relevant experience during your time off, then your resume should not even show a break in your work timeline. Instead of a company name just put something like **Entrepreneurial Pursuits**.
You don't even have to explain in detail each project. The i... | I'm on a sabbatical myself right now so maybe we can share notes. I'm going to start by agreeing with other answers that you're thinking too much.
First step is to **have a plan** and if you have a favorite recruiter or linkedin/monster/dice etc... accounts announce your plan and time off. Even if your plan is to surf... |
35,570,040 | I have a question about how to define a method from a subclass or a parent class. For example:
```
public class Thought
{
//-----------------------------------------------------------------
// Prints a message.
//-----------------------------------------------------------------
public void message()
{
... | 2016/02/23 | [
"https://Stackoverflow.com/questions/35570040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5673084/"
] | I think you need to go back and study OO a bit more...
Yes you can create an object just of the child, but it still `isA` instance of the parent too.
`super.method()` calls the superclass method. It does not copy the superclass method into the subclass.
The superclass implementation of a method might use private var... | ```
Thought t1 = new Thought();
t1.message(); // invokes Thought#message()
Thought t2 = new Advice();
t2.message(); // invokes Advice#message()
Advice a1 = new Advice();
a1.message(); // invokes Advice#message()
Advice a1 = new Thought(); //COMPILATION ERROR
```
As you are calling *instance methods*, at runtime w... |
42 | We've all had them, managers who have either come from sales or last looked at code 10 or more years ago but think they know how to write code.
What can I do to give the impression that I'm grateful for their intervention, but keep it as short as possible so I can get on with my work?
Or, should I be engaging more wi... | 2010/09/01 | [
"https://softwareengineering.stackexchange.com/questions/42",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/47/"
] | It can be very difficult, especially if the manager thinks they're a l33t h@x0r but hasn't coded anything in the last 10 years.
Start by using [active listening](http://en.wikipedia.org/wiki/Active_listening). Make sure you understand exactly what point they're trying to get across. Rephrase it and shoot it back to th... | **The problem here is that your manager obviously feels COMPETENT, when he IS NOT.**
I've had such experience before and for me it worked if I subtly showed the guy that programming wasn't his domain.
For example, I might go at great lengths to explain a specific piece of code, descending all the way into talking ab... |
12,385,109 | >
> **Possible Duplicate:**
>
> [C# Not Disposing controls like I told it to](https://stackoverflow.com/questions/1493309/c-sharp-not-disposing-controls-like-i-told-it-to)
>
>
>
I use this to delete all Pictureboxes I created on my Winform
```
foreach (PictureBox pb in this.Controls)
{
pb.Dispose();
}
``... | 2012/09/12 | [
"https://Stackoverflow.com/questions/12385109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1278704/"
] | [`Control.Dispose`](http://msdn.microsoft.com/en-us/library/3cc9y48w) is removing the control from the collection, changing the index and messing up the foreach.
You can solve this problem by using a reverse for loop or by creating a separate array holding the references.
**Solution #0**
```
for (int i = Controls.Co... | Try With:
```
foreach(Control c in this.Controls)
{
if(c is PictureBox)
{
c.Dispose();
this.Controls.Remove(c);
}
}
``` |
3,729,674 | Can anybody explain me, what is use of vector class? My Professor mentioned about below sentence in the lecture.
Template: Each vector has a class parameter that determines which object type will be used by that instance, usually called T. I don't understand what exactly class parameters means? | 2010/09/16 | [
"https://Stackoverflow.com/questions/3729674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/448456/"
] | The vector is defined as a template like:
```
template<typename T>
class Vector;
```
To use it you need to instantiate the template like:
```
Vector<char> myVector;
```
Instantiating a vector effectively creates a new class. which is equivalent to what you would get if you'd replaced every occurrence of T in the ... | these two videos give very good explaination about stl and its containers iterators usages.
<http://channel9.msdn.com/shows/Going+Deep/C9-Lectures-Introduction-to-STL-with-Stephan-T-Lavavej/>
<http://channel9.msdn.com/shows/Going+Deep/C9-Lectures-Stephan-T-Lavavej-Standard-Template-Library-STL-2-of-n/> |
1,039,138 | I have a hidden input element that I am using as a counter to use to name more input elements generated by JavaScript. To get the value of the counter i use
```
parseInt($('#counter').val());
```
However I use this code snippet several times in my code, so I thought it would be good to put it in a function
```
fun... | 2009/06/24 | [
"https://Stackoverflow.com/questions/1039138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/98917/"
] | Add "return" to your return statement :)
```
function getCounter(){
return parseInt($('#counter').val());
}
``` | How about adding a return
```
function getCounter(){
return parseInt($('#counter').val());
}
``` |
54,035,722 | I have this class with only the foreign key references:
```
public class Device
{
[Required]
[DataMember(Name = "key")]
[Key]
public Guid Key { get; set; }
[ForeignKey("DeviceType")]
[IgnoreDataMember]
public virtual DeviceType DeviceType { get; set; }
[ForeignKey("Model")]
[Ignor... | 2019/01/04 | [
"https://Stackoverflow.com/questions/54035722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1407094/"
] | For my situation, I misused ForeignKey attribute:
```
[IgnoreMap]
public long? PLCalculationMasterId { get; set; }
[ForeignKey("PLCalculationMaster"), IgnoreMap, IgnoreDataMember]
public PLCalculationMaster PLCalculationMaster{ get; set; }
```
whereas it should have been:
```
[IgnoreMap]
public long? PLCalculationM... | If all solutions provided above fails, just delete the migrations folder and recreate the migrations.
This error may arise due to visual studio cache references.
One could alternatively rename the property on the target entity. |
37,551,193 | When I try to transfer the form data to PHP file with this code:
**index.html** (the form):
```html
<!DOCTYPE html>
<html>
<body>
<form action="welcome.php" method="post">
First name:<br>
<input type="text" name="fname" value="Mickey">
<br>
Last name:<br>
<input type="text"... | 2016/05/31 | [
"https://Stackoverflow.com/questions/37551193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6187810/"
] | I was facing the same error message and the thread at <https://github.com/desktop/desktop/issues/9293> got me to try the command `git config --global http.sslbackend schannel` which resolved the issue. | one of the easiest way is to unset the proxy.
**Command :** git config --global --unset http.proxy |
43,238 | 18-year-old teen here with no children, I'm asking this question here on how to better communicate with my parents.
My mental health took a massive dip during the Pandemic and I'm still working on it. It got to a point where I had a crippling internet addiction just to fill the void of being socially isolated for so l... | 2023/02/07 | [
"https://parenting.stackexchange.com/questions/43238",
"https://parenting.stackexchange.com",
"https://parenting.stackexchange.com/users/44106/"
] | Maybe your parents aren't the right people to talk with about it. Not that they don't care, but there might be better chance to get what you need from other people - friends, or a support group. I have a friend who's been in a support group of equal peers for 20 years - their purpose is to help each other navigate the ... | Communication is difficult. Communicating with someone you expect know you intimately is filled with assumptions, which does not simplify the situation.
Different points of view
========================
You may experience something with someone else and come away with two different points of view, and you may with ti... |
21,226,188 | I'm very new to programming. And I've been trying to get the string.count function to work.
This is what I have so far:
```
def trial ():
a = raw_input ("Enter a string:").lower()
print a
b = raw_input ("Enter a substring:").lower()
print b
print "The total character count is:" + a.count('b')
`... | 2014/01/20 | [
"https://Stackoverflow.com/questions/21226188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3213742/"
] | You haven't saved your code or are otherwise using `print a.count` and not `print a.count()`. The former means that you are printing the representation of the `count` method in the string object,hence the print out:
```
<built-in method count of str object at 0x0181B500>
```
As for what the `sub,start,end` means, mi... | For testing purposes it's good practice to separate logic from the I/O
eg:.
```
def trial(a, b):
return "The total character count is:" + a.count('b')
```
Now you can quickly test like this
```
>>> trial("foo bar", "oo")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>",... |
162,078 | I am undergoing world building for a story I am writing. In this story, the school system is level based, where there are no grades(as in grades 1-12), just accomplishments in terms of level.
--Example Clarification; Mary is nearly ending her first year of schooling:
- She has taken and passed Basic Arithmetic( +,-... | 2014/04/07 | [
"https://english.stackexchange.com/questions/162078",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/71280/"
] | Testing of students is often divided into two major categories of measurement - **normative** and **criterion based**
**Normative** measurement has to do with the comparison of pupils in a similar category. A common measure is *grade level*. Testing along these lines examines how all students in a given grade score on... | I think this is just a **rating** system/schema. Lexile does the same thing for children reading levels. |
54,428,608 | I'm attempting to Dockerize a Vue.js application. I'm using the `node:10.15-alpine` Docker image as a base. The image build fails with the following error:
```
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.f... | 2019/01/29 | [
"https://Stackoverflow.com/questions/54428608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10205096/"
] | I resolve this problem by add **RUN apk add --no-cache python2 g++ make** before **npm install**
```
# Stage 1, based on Node.js, to build and compile the react app
FROM node:12-alpine as build
RUN mkdir -p /app
WORKDIR /app
COPY package*.json /app/
COPY ./ /app/
#### => add this script to resolve that problem
RUN a... | I started having this problem when I went to Alpine 3.15 (I MAY have skipped 3.14; I can't remember). Instead of using a node base image, I'm using Microsoft.
It looks like in Alpine 3.13, the `npm` package was more aligned to the `nodejs` package. In Alpine 3.14, they changed `npm` to be the actual `npm` version. So,... |
27,336,890 | I have class `Product`
```
public class Product
{
public string Name{get;set;}
public int Quantity{get;set;}
// and other
}
```
After some operation i get `List<Product>`.
How can i create string in format `productName1(productQuantity1), productName2(productQuantity2), ...` from that list?
I supposed ... | 2014/12/06 | [
"https://Stackoverflow.com/questions/27336890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3625486/"
] | ```
String.Join(", ", list.Select(p => String.Format("{0}({1})", p.Name, p.Quantity)))
``` | ```
string.Join(", ", products.Select(p=>string.Format("{0}({1})",p.Name, p.Quantity)))
``` |
58,314,459 | I use docker to build a web app (a Rails app specifically).
Each build is tagged with the git SHA value and the `:latest` tag points to the latest SHA value (e.g. `4bfcf8d`) in this case.
```
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
feeder_web 4bf... | 2019/10/10 | [
"https://Stackoverflow.com/questions/58314459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2490003/"
] | >
> Each version only differs by some minor copy in the app's frontend, but other than that they are largely the same. Each one is listed at 1.61GB. Does it really require an additional 1.61GB for each build if I just change a few lines in the web app?
>
>
>
Whether or not you can benefit from layer caching depen... | If one build requires 1.6G then just changing a few lines is not going to change the size.
If you are not planning to use them anymore, I would suggest clearing out the old builds. Every so often I do a `docker system prune -a` which removes unused data (images, containers, volumes, etc.). |
28,415,781 | I'm coding a script for my forum which generates a preview of the given string.
Here is my js code
```
function MakePreview() {
var getText = document.getElementById('inputText').value;
document.getElementById('outputText').innerHTML = getText;}
```
Here is my HTML code
```
<article>
<h2>What are you doing?</... | 2015/02/09 | [
"https://Stackoverflow.com/questions/28415781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4547314/"
] | I'm not sure, if it's possible to achieve exactly what you want (due to the different font size and family), but this snippet is very close to it.
```js
function makePreview() {
var text = document.getElementById('inputText').value;
document.getElementById('outputText').innerHTML = text;
}
```
```css
.wrap... | In html multiple whitespaces are replaced by single space so if you want to preview in paragraph you need to replace newlines with `<br/>`
```
function MakePreview() {
var getText = document.getElementById('inputText').value;
document.getElementById('outputParagraph').innerHTML = getText.replace('\n', '<br/>')... |
147,839 | If I go to Settings --> Sound, then there's a checkmark that says "Play feedback when volume is changed." I unchecked it, but the sound effect is still there. | 2014/10/01 | [
"https://apple.stackexchange.com/questions/147839",
"https://apple.stackexchange.com",
"https://apple.stackexchange.com/users/21186/"
] | Use shift while changing volume. There shouldn't be any sound. | The setting for "Play feedback when volume is changed" in stored in ~/Library/Preferences/.GlobalPreferences.plist file with the key com.apple.sound.beep.feedback.
If the key value is set to 0 then feedback sound is disabled. If they key value is set to 1 then the feedback sound is enabled.
If you want to see the cur... |
40,803,023 | I'm using the `javax.persistence` package to map my Java classes.
I have entities like these:
```
public class UserEntity extends IdEntity {
}
```
which extends a *mapped superclass* named `IdEntity`:
```
@MappedSuperclass
public class IdEntity extends VersionEntity {
@Id
@GeneratedValue(strategy = Gener... | 2016/11/25 | [
"https://Stackoverflow.com/questions/40803023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4032222/"
] | I would pick a solution that didn't enforce a class-based object model like you've outlined. What happens when you don't need optimistic concurrency checking and no timestamps, or timestamps but no OCC, or the next semi-common piece of functionality you want to add? The permutations will become unmanageable.
I would a... | >
> I wish there was some way I could make the relevant classes inherit these fields in some way.
>
>
>
You *could* make a custom annotation `@Timed` and use an annotation processor to add the timestamp field and annotations, either by using a bytecode manipulation framework or creating a delegating subclass. Or, ... |
36,385 | I recently had reason to move a hard drive from a computer that blew up to another computer for the purpose of recovering data. Under the (unfortunate) circumstances, both the donor and the recipient were Windows XP SP3 machines. I wanted to be sure that the transplanted drive would not be altered by the recipient comp... | 2009/07/06 | [
"https://serverfault.com/questions/36385",
"https://serverfault.com",
"https://serverfault.com/users/7302/"
] | I'm answering quite late, but it might help someone else.
Everett's [solution](https://superuser.com/a/213015) on superuser explains how to modify the volume attributes to make it read-only. | I've got this bookmarked from a while back, but I've never tried it:
<http://www.microsoft.com/communities/newsgroups/list/en-us/default.aspx?dg=microsoft.public.windows.file_system&tid=4b1a14f7-6bd2-4c9f-ae64-df57c35712bf&cat=&lang=&cr=&sloc=&p=1>
The 4th post (by Edwin) has the solution I am talking about. |
8,023,323 | I have implemented a function in a singleton class with an optional parameter.
```
private function MyFunction($Name = "")
{
$localCopy = $Name;
//this check fails, EMPTY is printed!
if (empty($Name))
echo "EMPTY";
else
echo "NOT EMPTY";
//this is working, NOT EMPTY is printed
if (empty($localCopy))
echo "EMP... | 2011/11/05 | [
"https://Stackoverflow.com/questions/8023323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/451089/"
] | If you have a member variable which is initialized to an instance of the same class, then when that instance is created, it will also have a member variable which is initialized to an instance of the same class, and when that instance is created, it will also have a member variable which is initialized to an instance o... | It's a stack overflow.
It's similar to calling a function from the same function, like this:
```
void func(){
func();
}
```
It will repeat until the stack fills, and then the program will crash.
Cheers. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.