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 |
|---|---|---|---|---|---|
109,409 | What are the key strengths of ASP.NET Webforms (2.0-3.5)? I'm not looking for comparisons to other frameworks, I'm just am looking for feedback on ASP.NET as it stands today. | 2008/09/20 | [
"https://Stackoverflow.com/questions/109409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3289/"
] | One key strength (to some) is a drag-and-drop development environment integrated into Visual Studio. This allows you to get simple things up and running quickly, but can also be a liability when the time comes that you actually need to understand the underlying code. | * State Management
* Low learning curve to get started on something simple (However becomes complicated quickly as soon as you have a page with dynamically added elements).
* Huge library of mature controls
* Huge amount of documentation and resources
* Great performance
Despite what other people may have said, it's p... |
7,880,355 | If you are a package author, you are hopefully well aware of upcoming changes in package structure when we move to 2.14 in about a week. One of the changes is that all packages will require a NAMESPACE, and one will be generated for you in the event you do not make one (the R equivalent of your Miranda rights in the US... | 2011/10/24 | [
"https://Stackoverflow.com/questions/7880355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/633251/"
] | CRAN packages have had NAMESPACEs since almost time immortal. Just pick a few of your favorite CRAN packages and look at their NAMESPACE files.
It can be as easy as this one-liner (plus comment) taken from [snow](http://cran.r-project.org/package=snow):
```
# Export all names unless they start with a dot
exportPatter... | I recently worked on this for one of my packages. Here are my new Depends, Imports, and Suggests lines
```
Depends: R (>= 2.15.0)
Imports: nlme, mvtnorm, KFAS (>= 0.9.11), stats, utils, graphics
Suggests: Hmisc, maps, xtable, stringr
```
stats, utils and graphics are part of base R, but the user could detach them an... |
21,918,354 | I want to generate event on start and end of the method to log time stamp for QOS & instrumentation purpose. In spring framework that it is easy to achieve using AOP without writing boiler plate code in each of the methods.
I want to do similar in play. I looked in action & @with annotation however it is not giving d... | 2014/02/20 | [
"https://Stackoverflow.com/questions/21918354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1557197/"
] | You can intercept before and after the request like shown below and log all your requests:
```
public Action onRequest(final Http.Request request, Method method) {
Action action = new Action.Simple() {
public Promise<Result> call(Http.Context ctx) throws Throwable {
Long start = System.curren... | As has been mentioned you want to extend the Global Settings object.
Play's documentation is solid: [Application Global Settings](https://www.playframework.com/documentation/2.0/JavaGlobal) and [Intercepting Requests](https://www.playframework.com/documentation/2.2.x/JavaInterceptors)
```
import play.*;
import play.... |
21,706,256 | I post here a snippet of code where I get a runtime error. The variable `x` changes is value inside an ajax call:
```
$("#acquisto").click(function(){
var x = 0;
for(x = 0; x < numRighe; x++){
if( $("#ch"+x).prop("checked") == true){
alert("#tr"+x);
... | 2014/02/11 | [
"https://Stackoverflow.com/questions/21706256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2337094/"
] | All the anonymous functions passed to `success` in `$.ajax` reference the same `x` variable from the outer scope which is incremented by the for structure. You need each function to have it's own copy of `x`.
```
success:function(copy_x) {
return function(result){
//$("#tr"+copy_x).fadeOut("slow");
alert("#t... | It is because your are using the loop variable `x` in a closure within the loop.
```
$("#acquisto").click(function () {
for (var x = 0; x < numRighe; x++) {
(function (x) {
if ($("#ch" + x).prop("checked") == true) {
alert("#tr" + x);
$.ajax({
... |
24,461 | I have a frying pan with a metal lid. The lid has a small threaded post sticking out of the top of it onto which a wooden knob is screwed. The threads inside the knob have become stripped so the knob will no longer stay attached to the pan lid.
This would seem like a job for either Krazy Glue or Gorilla Glue if not fo... | 2021/02/06 | [
"https://lifehacks.stackexchange.com/questions/24461",
"https://lifehacks.stackexchange.com",
"https://lifehacks.stackexchange.com/users/32967/"
] | I fixed my kettle's wooden knob a while ago.
I used normal white glue (not school glue which doesn't harden completely).
The knob was heavily carboned (burnt). It slid on and off the threaded post easily. I figured that I had nothing left to lose so I filled the burned hole with some white glue and set the lid on it u... | If you are concerned about the glue being exposed to high temperature, automotive stores sell high temperature glue designed to exist near an internal combustion engine when hot. |
122,472 | Why do we usually pre-whiten the data before doing independent components analysis (ICA), like making all eigenvalues equal? Doesn't that take away some information regarding the data? | 2014/11/03 | [
"https://stats.stackexchange.com/questions/122472",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/59859/"
] | ICA assumes that the observed data $\mathbf x$ are a linear combination of independent components: $\mathbf x = \mathbf A \mathbf s$, where $\mathbf A$ is usually called *mixing matrix*.
Covariance matrix of the data is then given by $\mathbf A \mathbf A^\top$, because the covariance matrix of independent components $... | ICA is a invertible problem, so ideally W should be rotation matrix. If you Whiten the signal the covariant matrix will be rotation. So you can take advantage of Natural Stochastic Gradient Descent by using grassmann manifold or stiefel manifold which can promise fast coverage. |
14,648,318 | Is there a key binding to move the point to end of the next string? | 2013/02/01 | [
"https://Stackoverflow.com/questions/14648318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1458283/"
] | If point is at the beginning of the string, you can use `C-M-f` to move past the end:
```
"this is my string"
↑ from here ↑ to here
```
However, this doesn't work if point is inside the string. `C-s "` might be the simplest way. | Most programming modes will define a syntax class for delimiters of string literals. You can use `skip-syntax-forward` to move to these. I don't know exactly the behavior you want, but this is the key to finding where string delimiters are.
```
(skip-syntax-forward "^\"")
```
* <http://www.gnu.org/software/emacs/man... |
3,698 | The review queue presents itself across the top like:

Which when you click on it takes you to:

The numbers almost always are out of sync with what is in the queue, (the pictures ... | 2014/05/18 | [
"https://electronics.meta.stackexchange.com/questions/3698",
"https://electronics.meta.stackexchange.com",
"https://electronics.meta.stackexchange.com/users/11861/"
] | DIP
===
Dual-Inline Package, an integrated packaging style for through-hole assembly | ROM
===
[Read-only memory](https://en.wikipedia.org/wiki/Read-only_memory)
Data persists after power is removed. |
5,913,943 | Hey guys I'm trying to create something similar to the image below. As you can see I have 2 containers both will be of varying sizes. ({DEPARTMENT OF BUSINESS} {-------}) The left container will have text, and the right container a line image. I basically want the 2 to take up 100% of that space. I think my code should... | 2011/05/06 | [
"https://Stackoverflow.com/questions/5913943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/546489/"
] | If I understand correctly what you're trying to do you could probably make the image the same height as the DepartmentHeader div with the line in the center, set that as a background image on DepartmentHeader (which would eliminate the need for the DepartmentHeaderDivider div), style the DepartmentHeaderText div with a... | This can be done with a little CSS Trickery (No Images)
**Live Fiddle:**
<http://jsfiddle.net/Jaybles/zPvv5/>
**HTML**
```
<div class="container">
<div class="line"></div>
<div class="cap">Business Items</div>
</div>
<div class="container">
<div class="line"></div>
<div class="cap">Business Items ... |
238,800 | I have a query:
UPDATE choices SET votes = votes + 1 WHERE choice\_id = '$user\_choice'
But when I execute it in my script, the votes field is updated twice, so the votes will go from 4 to 6 instead to 5. It doesn't seem that it is getting called twice because I echo out stuff to test this and only get one echo. Is t... | 2008/10/26 | [
"https://Stackoverflow.com/questions/238800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | One other option is, if you are using firefox at all and have firbug installed you need to disable your cache. For some reason firbug results in two calls to the dB. Took weeks to figure this out where I work as QA was getting all kinds of strange results when testing. he was the only one with firebug. | You may just need to put brackets around the `votes + 1` such as:
```
UPDATE choices SET votes = (votes + 1) WHERE choice_id = '$user_choice';
```
I might also put a `LIMIT 1` at the end.
Also, have tried running the query outside of your PHP, like through PHPMyAdmin? Also, try echoing out your SQL in whole before ... |
52,042,198 | I am using a split function to separate a column with two street addresses.
The information is separated by `,`.
Some of the rows only have one address associated with them.
In those rows for my Street Address 2, I'm getting `#ERROR` when I want it to be `null`.
I've tried an `IIF()` statement for the expression, b... | 2018/08/27 | [
"https://Stackoverflow.com/questions/52042198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10177680/"
] | (Use a custom function for each Address.
Adapted from: [Split String](https://social.msdn.microsoft.com/Forums/sqlserver/en-US/42757123-d65f-4587-8995-dda2760772f3/split-the-column-into-two-columns-using-custom-code?forum=sqlreportingservices)
```
Public Function GetAddress1(ByVal a as String)
Dim ... | Unlike the If statement, IIf statements evaluate all code paths even though only one code path is used. This means that an error in an unused code-path will bubble up to an error in the IIf statement, preventing it from executing correctly.
To fix this, you need to use functions that won't throw an error when there is... |
15,491,294 | I need to retrieve the current balance of bank Account in Netsuite using SuiteTalk(Netsuite Webservise).In suite talk API there is no field/parameter to refer the balance of account.But There is UI field Balance which shows the current balance of the account.Any help/suggestions on this is appreciated | 2013/03/19 | [
"https://Stackoverflow.com/questions/15491294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1863050/"
] | WinLister from [NirSoft](http://www.nirsoft.net) list all windows active on a machine as well as associated information (title, path, handle, class, position, process ID, thread ID, etc.). It has a GUI interface rather than command-line. | Use powershell. The command is: Get-Process
You can try this:
```
##Method 1: (Gives you all the processes)
Get-Process
## Method 2: Detailed Info On a specific named Process
$ProcessTerm="chrome"
#Run This:
$FindProcess = Get-Process | Where-Object {$_.MainWindowTitle -like "*$processterm*"}
Get-Process -ID $FindPr... |
59,233,133 | Today I have seen a video lecture in which they gave the `foriegn key` by using `ADD INDEX` on a table -
### CASE 1 -
DECRIPTION OF TABLE 1 : **subjects**
```
+-----------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------+------... | 2019/12/08 | [
"https://Stackoverflow.com/questions/59233133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12483634/"
] | A local variable is essentially guaranteed to be fast, whereas there is an unknown amount of overhead involved in accessing the property.
It's almost always a good idea to avoid repeating code whenever possible. Storing the value once means that there is only one thing to change if it needs changing, rather than two o... | You should consider that getting a value from a method that is calculated from an I/O-bound or CPU-bound process can be irrational. Therefore, it's better to define a var and store the result to avoid multiple same processing.
In the case that you are using a value like `object.Id`, utilizing a variable decorated with ... |
3,832,089 | I have a third-party program installed, and I want to find out what version of the [.NET](http://en.wikipedia.org/wiki/.NET_Framework) framework it is using.
How do I figure that out? | 2010/09/30 | [
"https://Stackoverflow.com/questions/3832089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109035/"
] | Load ILDASM and import your DLL. Double click on the 'Manifest' and it will display the framework version. | I found *[How to identify the framework version a DLL is using](http://www.vbdotnetforums.com/net-framework/26246-how-identify-framework-version-dll-using.html)*. It might mean writing a small secondary program to perform the action. |
8,777,216 | I my way to learn Haskell I'm starting to grasp the monad concept and starting to use the known monads in my code but I'm still having difficulties approaching monads from a designer point of view. In OO there are several rules like, "identify nouns" for objects, watch for some kind of state and interface... but I'm no... | 2012/01/08 | [
"https://Stackoverflow.com/questions/8777216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38483/"
] | A helpful rule of thumb is when you see values *in a context*; monads can be seen as layering "effects" on:
* **Maybe:** partiality (uses: computations that can fail)
* **Either:** short-circuiting errors (uses: error/exception handling)
* **[] (the list monad):** nondeterminism (uses: list generation, filtering, ...)... | This is sort of a non-answer, but I feel it is important to say anyways. **Just ask!** StackOverflow, /r/haskell, and the #haskell irc channel are all great places to get quick feedback from smart people. If you are working on a problem, and you suspect that there's some monadic magic that could make it easier, just as... |
1,246,766 | How do you prove that
$$
\Gamma'(1)=-\gamma,
$$
where $\gamma$ is the Euler-Mascheroni constant? | 2015/04/22 | [
"https://math.stackexchange.com/questions/1246766",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/93122/"
] | The Weierstrass product for the $\Gamma$ function gives:
$$\Gamma(z+1)=e^{-\gamma z}\cdot\prod\_{n\geq 1}\left(1+\frac{z}{n}\right)^{-1}e^{z/n}\tag{1}$$
hence by considering $\frac{d}{dz}\log(\cdot)$ of both terms we get:
$$ \psi(z+1)=\frac{\Gamma'(z+1)}{\Gamma(z+1)}=-\gamma+\sum\_{n\geq 1}\left(\frac{1}{n}-\frac{1}{n+... | I was wrong I cannot delete my post because I having trouble singing in sorry for my lapse in judgement and failed math skills I will try to be better the solutions above work just fine.
$$\Gamma^{\prime}(z) = \frac{d}{dz} \int^{\infty}\_{0} e^{-t}t^{z-1}dt = \int^{\infty}\_{0} \frac{d}{dz} e^{-t}t^{z-1}dt =
\int^{\in... |
24,917,832 | I installed Postgres with this command
```
sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev
```
Using `psql --version` on terminal I get `psql (PostgreSQL) 9.3.4`
then I installed `pgadmin` with
```
sudo apt-get install pgadmin3
```
Later I opened the UI and create the server with t... | 2014/07/23 | [
"https://Stackoverflow.com/questions/24917832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3167016/"
] | It helps me:
---
1. **Open the file** `pg_hba.conf`
>
> sudo nano /etc/postgresql/9.x/main/pg\_hba.conf
>
>
>
and change this line:
```
Database administrative login by Unix domain socket
local all postgres md5
```
to
```
Database administrative login by Unix d... | if you open the `psql` console in a terminal window, by typing
$ `psql`
you're super user username will be shown before the `=#`, for example:
`elisechant=#`$
That will be the user name you should use for localhost. |
44,704,705 | I have an **ADD** button that adds a form field when clicked on. I want the new form field button to change when it is added to a **REMOVE** button. How do I change the buttons (keep in mind I'm still learning jquery). Here's my code
HTML
```
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }} inputF... | 2017/06/22 | [
"https://Stackoverflow.com/questions/44704705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5583517/"
] | There are two options. Create two buttons and hide/show them or you can use one button and change its content to what you need. Of cours with the second option you have to check the click event if it should be a delete or an add.
I think this is what you are looking for
```js
$(document).ready(function(){
$(".de... | Add this to your `$('.addbtn').on('click'...);`...
```
$('.addbtn').hide();
$('.removebtn').show();
```
And add this to your html right below your addbtn...
```
<a class="removebtn">
<i class="fa fa-plus-circle fa-2x" aria-hidden="true"></i>
</a>
``` |
103,174 | I work in a Microsoft environment, so I can use my C# hammer on any nails I come across. That being said, what languages (compiled, interpreted, scripting, functional, any types!) complement knowing C#, and for what purposes? For example, I've moved a lot of script functionality away from compiled console apps and into... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212/"
] | Since you are in a MS shop, I would suggest [PowerShell](http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx) as a decent scripting language to learn. It plays well with C#.
I'm a big fan of Ruby too. | While it's a bit of a fringe language, I'm compelled to mention [Erlang](http://www.erlang.org/index.html). Erlang is an excellent language to have in your toolbox since it's unusual strengths tend to compliment other programming platforms. Erlang is very useful for building distributed, concurrent, fault-tolerant syst... |
63,467,816 | I have the following code from SO:
```
import { Injectable } from '@angular/core';
@Injectable()
export class CookieService {
constructor() { }
public getCookie(name: string) {
const ca: Array<string> = document.cookie.split(';');
const caLen: number = ca.length;
const cookieName = `${name}=`;
l... | 2020/08/18 | [
"https://Stackoverflow.com/questions/63467816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12360035/"
] | This is happening because you have used the float left on inner divs, whenever you use the float on the child, and if you do not clear it or used overflow: hidden on its parent, the inner items will not take the height,
just use overflow hidden on the parent or clear the float,
I would suggest you to use Display flex... | Instead of floating your 3 divs (.containerOverview) use `display: inline-block;`.
Voila
`Float` takes elements out of the flow (similar but not the same as `postion: absolute`), which means they have no effect on their parent, so parent's `height` is 0. |
319,970 | For some reason my CentOS VPS refuses all connections except for HTTP, SSH and Telnet. Whenever I try to connect to a port such as 25 (SMTP) or even a random port such as 225 I get a connection refused error :S
netstat -ap shows that the server is listening and iptables is turned off.
However I can interface with the ... | 2011/10/09 | [
"https://serverfault.com/questions/319970",
"https://serverfault.com",
"https://serverfault.com/users/97335/"
] | It looks like there is something upstream of your VPS that is blocking access except for the ports noted. You should contact your VPS provider and ask them about it. | Okay, to make things clear - if you are running CentOS, chances are that you are at release 5 with sendmail as the default. In that case, you will not be to connect externally, because sendmail will only listen to localhost by default. To make it listen on the main IP, you will need to disable the line in /etc/sendmail... |
14,648,062 | I am seeing a lot of code that explains how to centre a subview inside a view. The code examples typically go like this:
```
SubView.center = view.center;
```
Could someone explain to me how this works? I just don't get it.
The `view.center` gives the center point of the view. For example width is 100, height is 10... | 2013/02/01 | [
"https://Stackoverflow.com/questions/14648062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1060500/"
] | So when setting it, it is setting it inside it's superview. When getting the subviews center it gives you the actual views center.
So half of 50 is 25, hence 25,25. You are wanting the subview's center not its parent's center so there is no reason for it to return its parent's center coordinates, just its own.
To be... | The view.center gives the center point of the view *in the view's superviews coordinate space*. So it allows you to reposition a view within it's superview.
If you have a view size {100,100} and set it's center {200,200} - it's centerpoint will be positioned {200,200} from the origin of it's superview. Effectively it... |
142,086 | In the final scene Jack goes to the TET
>
> to blow it up.
>
>
>
The video has spoilers.
And when he gets there he is confronted with something that also looks like the TET with a huge red light in the middle. Jack refers to it as Sally and we are led to believe that this is who has been giving commands to them... | 2016/10/03 | [
"https://scifi.stackexchange.com/questions/142086",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/65457/"
] | This was discussed by the film's Director in an interview for CinemaBlend. In short, the aliens who created the TET **are aboard the ship**, but as uploaded '***digital***' minds rather than as physical forms, that being the only way in which any crew could survive the immense amount of time that it takes to travel fro... | Unknown
=======
Spoilers. Duh.
At the start of the film Tom Cruise's character operates under the assumption that the Tet is a power station for humanity, relocated to Titan after an alien attack and invasion of Earth. The alien invaders, Scavs, are still on Earth and try to destroy the Tet. Sally is the mission cont... |
536,768 | I was trying to make a commutative diagram using something like `\arrow[r, "A"]` at some point, and I kept getting weird errors. I finally found out that I got no errors if I removed "dutch" from `\usepackage[dutch, english]`. Alternatively, I can get it to work by enclosing the tikzcd environment with `\shorthandoff{"... | 2020/04/04 | [
"https://tex.stackexchange.com/questions/536768",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/91138/"
] | First some general words. We invite to present the question with a minimal example of code for several reasons:
* often the question is presented with no hint about the actual error message(s);
* preparing a MWE sometimes helps in spotting the error or in finding a workaround;
* it's kind to whoever wants to help.
Mo... | My answer is off-topic with the tags I hope to have understood your request. I have used `xy` package without the hard tip arrows with the options `[all,cmtip]` leaving your babel `\usepackage[dutch]{babel}`.
PS: I have only thinked an alternative.
```
\documentclass[a4paper,12pt]{article}
\usepackage[a4paper]{geome... |
13,366,708 | I just read this article <http://javascriptweblog.wordpress.com/2011/05/31/a-fresh-look-at-javascript-mixins/>.
In the section entitled "#4 Adding Caching" it says:
>
> By forming a closure around the mixins we can cache the results of the initial definition run and the performance implications are outstanding.
>
>... | 2012/11/13 | [
"https://Stackoverflow.com/questions/13366708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/94958/"
] | basically, without using the closure, the mixin function will be created every
time the mixin is used. By creating a closure, each of the function will be
created once, and the mixin will reference those functions every time it is
called. Since the mixin doesn't have to recreate those functions every time it
runs, its... | In the second case only this code is executed: upon applying the mixin:
```
this.area = area;
this.grow = grow;
this.shrink = shrink;
return this;
```
While in the first case `area`,`grow`, and `shrink` are redefined for each and every `asXXX` call. The definition of the methods and their caching is done at "parsing... |
30,093,115 | So every time I make a website, I have issues with the footer. Now, after some googling, I found the following:
<http://getbootstrap.com/examples/sticky-footer/>
I tried to apply it, but it didn't really work out... Instead of the footer staying in the bottom of the page, it just sticks at the bottom of my screen.
T... | 2015/05/07 | [
"https://Stackoverflow.com/questions/30093115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3216434/"
] | Your oncreateview should be like below:
```
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_find_people, container, false);
listView = (ListView)rootView.findViewById(R.id.card_listView);
... | Fragment does not have findViewById(). You have to use View object to access that method in Fragment (In your case "rootView"). If you are using Activity than you can directly use findViewById() because Activity have that method.
Update your a line in your code as below, it will make it working.
```
listView = (List... |
7,711,068 | >
> **Possible Duplicate:**
>
> [separating keys and objects from NSMutable dictionary and use the values in insert command of sqlite](https://stackoverflow.com/questions/5677396/separating-keys-and-objects-from-nsmutable-dictionary-and-use-the-values-in-inser)
>
>
>
I have an NSDictionary containing parsed JS... | 2011/10/10 | [
"https://Stackoverflow.com/questions/7711068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/970668/"
] | If your design requirements specify sqlite, then I would recommend using Gus Mueller's [FMDB](https://github.com/ccgus/fmdb) so that you do not have to work directly with raw sqlite.
```
NSString $title = [jsonDictionary objectForKey:@"title"];
// other keys, values, etc...
NSString $query = [NSString stringWithForma... | Following code goes to create the dynamic plist file and that file stores into the bundle and that data can be access and the insert the data into the .plist file.
```
NSString *strPathToAudioCache=[NSString stringWithFormat:@"%@/%@",
[(NSArray*)NSSearchPathForDirectoriesInDo... |
61,238,773 | I’m using SwfitUI in my project and I have a NavigationView and List. I’m clicking cell after open the detail view and click navigation back button. I want to remove view (it’s struct, in SwiftUI) after click navigation back button. Because if I click the same cell or button again, it isn’t initialize new view, it’s sh... | 2020/04/15 | [
"https://Stackoverflow.com/questions/61238773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3215402/"
] | You just need to defer your destination creation in your builder, and the `@ViewBuilder` is a good instrument for this.
It can be used the following wrapper for to create real destination only in when `body` will be rendered (ie. explicitly in time of navigation clicked in your case)
Tested with Xcode 11.4 / iOS 13.4... | SwiftUI initialises `NavigationView` links eagerly, so you can't rely on their initialiser to run every time. If you write a custom init() for DetailView
```
init(viewModel: DetailViewModel) {
self.viewModel = viewModel
print("Initialising \(self)")
}
```
you'll see the line print out for every navigatio... |
22,843,734 | I wanna ask about little tricky javascript, this is about if/else if/else question.
I want make question about 'YES' or 'NO', this is the logic : If question1 is 'yes' and question2 is 'yes' and question3 is 'NO' the result is 'good', and if question1 is 'yes' and question2 is 'no' and question3 is 'yes'the result is '... | 2014/04/03 | [
"https://Stackoverflow.com/questions/22843734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3492238/"
] | I'm actually pretty confused by the logic that you're presenting. As many have pointed out, you're trying to compare elements against each other. This won't give you the result that you want. You'll want to use `.innerHTML` or `.value` depending on the element type.
The next problem that I see is that your HTML struc... | Try using this in each case:
```
var question1 = document.getElementById("a").innerHTML;
var answer1 = document.getElementById("d").innerHTML;
if(question1 == answer1 ){
document.write('good');
}
```
Start simple and build up. |
3,456,758 | When I add a .dll file as a reference in C# application it shows an error :
>
> A reference to the "....dll" could not be added.Please make sure that
> the file is accessible and that it is a valid assembly or COM
> component.
>
>
>
ILDissassembler says there is no valid CLR header so I try to register it using... | 2010/08/11 | [
"https://Stackoverflow.com/questions/3456758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20358/"
] | I just ran into that issue and after all the explanations about fixing it with command prompt I found that if you add it directly to the project you can then simply include the library on each page that it's needed | I needed to change architecture to x86 from x64 in configuration manager and copy my 32 bit dll (C language - pcProxAPI.dll) into new folder this created.. This is on top of the steps described by "Sashus" [below](https://stackoverflow.com/a/36566032/3254405).
C:\Projects..\bin\x86\Debug |
690,748 | Is there a way to cast objects in objective-c much like the way objects are cast in VB.NET?
For example, I am trying to do the following:
```
// create the view controller for the selected item
FieldEditViewController *myEditController;
switch (selectedItemTypeID) {
case 3:
myEditController = [[SelectionL... | 2009/03/27 | [
"https://Stackoverflow.com/questions/690748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83724/"
] | Typecasting in Objective-C is easy as:
```
NSArray *threeViews = @[[UIView new], [UIView new], [UIView new]];
UIView *firstView = (UIView *)threeViews[0];
```
However, what happens if first object is not `UIView` and you try to use it:
```
NSArray *threeViews = @[[NSNumber new], [UIView new], [UIView new]];
UIView ... | Sure, the syntax is exactly the same as C - `NewObj* pNew = (NewObj*)oldObj;`
In this situation you may wish to consider supplying this list as a parameter to the constructor, something like:
```
// SelectionListViewController
-(id) initWith:(SomeListClass*)anItemList
{
self = [super init];
if ( self ) {
[se... |
32,502,077 | I am building an application in Xamarin.Forms, on the iOS app I want the status bar color to be white. Here is what I have so far:
**App.cs**
```
public App()
{
NavigationPage _navigationPage = new NavigationPage(new RootPage());
MainPage = _navigationPage;
}
``` | 2015/09/10 | [
"https://Stackoverflow.com/questions/32502077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3571997/"
] | After a recent Xamarin update you are now able to do this by setting the BarTextColorProperty,
`_navigationPage.SetValue(NavigationPage.BarTextColorProperty, Color.White);`
However just like in [pvnak's answer](https://stackoverflow.com/a/32512897/3571997) you still need to add the following to your Info.plist
* Pro... | globaly change status bar text color and background color for ios
in App.xaml.cs:
```
var page = new NavigationPage(new MainPage()) { BarTextColor = Color.White };
```
in Info.plist:
```
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
```
and changing background color
in AppDelegate.cs =... |
258,532 | Yesterday my daughter watched me acting on my favorite SE site. She essentially said:
>
> *"Hey, that's cool. Can you recommend me a me a site there, where I could go to with my bunch of questions I have to ask?"*
>
>
>
I admittedly had to deny her going here, since
1. She's going to get 12 that month (IIRC mi... | 2015/06/11 | [
"https://meta.stackexchange.com/questions/258532",
"https://meta.stackexchange.com",
"https://meta.stackexchange.com/users/186472/"
] | I can see a few problems with this idea, although not *bad*, it would need *a lot* of thought if it was going to be successful.
The main problems:
* What would the site scope be?
Stack Exchange isn't going to change it's model to let children ask and answer questions - so there would need to be a *well-defined scope... | What's wrong with just letting 13-16 yo participate on regular sites? I'm not sure why they need a specific site just for them.
1. Many under-18 year olds participate successfully on SE sites, so it's not like they are excluded from regular sites.
2. I don't think moderation is an issue: Stack Exchange is relatively ... |
598,436 | Does asynchronous call always create a new thread?
Example:
If JavaScript is single threaded then how can it do an async postback? Is it actually blocking until it gets a callback? If so, is this really an async call? | 2009/02/28 | [
"https://Stackoverflow.com/questions/598436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40118/"
] | The Javascript model is *single-threaded*. An asynchronous call is *not* a new thread, but rather interrupts an existing thread. It's analogous to interrupts in a kernel.
Yes it makes sense to have asynchronous calls with a single thread. Here's how to think about it: When you call a function within a single thread, t... | A couple notes about JavaScript in particular:
`XMLHttpRequest`s are non-blocking by default. The `send()` method returns immediately after the request has been relayed to the underlying network stack. A response from the server will schedule an invocation of your callback on the event loop as discussed by the other e... |
23,574,264 | If a parent control asks its children "How big do you want to be?", then what use is the availableSize parameter that's passed along? I've taken a peek via Reflector into the StackPanel's source and I still can't figure it out.
If the child wants to be 150x30, then it still reports 150x30 even if availableSize is 100x... | 2014/05/09 | [
"https://Stackoverflow.com/questions/23574264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/532501/"
] | >
> If the child wants to be 150x30, then it still reports 150x30 even if availableSize is 100x20, doesn't it?
>
>
>
It depends on the control, but generally the answer is no. In any case, the point is to give it the opportunity to fit itself to the container, but it is not required to do so.
Think about the diff... | The point is to give the element the opportunity to size itself correctly. After all the parent control might clip it if it doesn't respect the available size. |
10,914,245 | From my code, I call an SP using:
```
using (var cmd = new SqlCommand("sp_getnotes"))
{
cmd.Parameters.Add("@ndate", SqlDbType.SmallDateTime).Value
= Convert.ToDateTime(txtChosenDate.Text);
cmd.CommandType = commandType;
cmd.Connection = conn;
var dSet = new DataSet();
using (var adapter ... | 2012/06/06 | [
"https://Stackoverflow.com/questions/10914245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/131992/"
] | `smalldatetime` has a time portion which needs to match as well.
Use this:
```
SELECT *
FROM tblNotes
WHERE dateAdded >= CAST(@ndate AS DATE)
AND dateAdded < DATEADD(day, 1, CAST(@ndate AS DATE))
```
`SQL Server 2008` and above also let you use this:
```
SELECT *
FROM tblNotes
WHERE CAST(dateAd... | SQL Server 2008 now has a DATE data type, which doesn't keep the time porttion like SMALLDATETIME does. If you can't change the data type of the column, then you'll have to truncate when doing the compare, or simply cast to DATE:
```
SELECT *
FROM tblNotes
WHERE cast(dateAdded as date) = @ndate
``` |
63,787,476 | I try create a function with a loop for inside. The script work without function but declare the python function don't work. (The original script is is more longer but with this part i think the is enough)
```
import numpy as np
import math as mt
from sympy import*
import fractions
init_printing(use_latex='mathjax')
P... | 2020/09/08 | [
"https://Stackoverflow.com/questions/63787476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13803655/"
] | You can look at the [subprocess](https://docs.python.org/3/library/subprocess.html) library in Python
You must pass the argument as a string. Then you can convert it back in your R script
**Python**:
```
import subprocess
i = 0
with open(result_filename, 'a') as result:
output = subprocess.run(['Rscript', 'RS... | Use [Subprocess](https://docs.python.org/3/library/subprocess.html#subprocess.Popen)
```
import subprocess
i = 0
with open(result_filename, 'a') as result:
command = subprocess.Popen(['Rscript', 'RScriptWeeklyActives.R', 'i'], stdout=result)
```
Rscript will get value 0 as a string you have to convert it to i... |
11,093,884 | this is my code:
```
ViewBag.idprofesor = new SelectList(db.Profesor, "IDProfesor", "nombre");
```
this code generate a dropdown that only shows the name (nombre) of the teachers (profesor) in the database, id like the dropdown to show the name and the lastname of the teacher. | 2012/06/19 | [
"https://Stackoverflow.com/questions/11093884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1462933/"
] | You may have to manually create a ist of SelectListItems that manually specify the fields you want. Like so:
```
List<SelectListItem> professors = new List<SelectListItem>();
foreach(var professor in db.Professors) {
professors.Add( new SelectListItem() { Text = professor.Fn + " " + professor.Ln, Value = professo... | You just have to pass an IEnumerable of *SelectListItem* to the constructor. Using Linq to select from the *Professor* collection:
```
@{
var mySelectList =
db.Professor.Select(prof => new SelectListItem(
Text = prof.lastName + ", " + prof.nombre,
Value = prof.IDProfessor
... |
70,934,723 | I want to be able to get the first and last name always starting with a capital letter... This I've already achieved in a post here on stackoverflow, it's this one:
`[A-Z][a-z]+([ ][A-Z][a-z]+)*`
However, according to my business rules, I need to be able to validate names and surnames with only the first letter of th... | 2022/02/01 | [
"https://Stackoverflow.com/questions/70934723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17075354/"
] | Adapt it as you need ...
```
using System.Xml;
static void GetArtistFromXml()
{
var xml = "<?xml version=\"1.0\" encoding=\"ISO - 8859 - 1\"?><catalog><cd><title>Empire Burlesque</title><artist>Bob Dylan</artist><price>10.90</price></cd><cd><title>Hide your heart</title><artist>Bonnie Tyler</artist><price>10.0</p... | It is better to use **LINQ to XML** API. It is available in the .Net Framework since 2007.
**c#**
```
void Main()
{
const string filename = @"e:\Temp\AmeyP.xml";
XDocument xdoc = XDocument.Load(filename);
string artist = xdoc.Descendants("cd")
.Where(x => x.Element("title").Value.Equals("Greates... |
45,099,420 | Due to label output is coming on the next line
```
while ($row=mysqli_fetch_array($res))
{
echo "<label for='A'> <input type='radio' class='muted pull-left' name ='radio' id='A' value=".$row['dis']."> ".$row['dis']."</label>";
}
```
Output should be :
```
Radio button 1 Radio button 2 ....... | 2017/07/14 | [
"https://Stackoverflow.com/questions/45099420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | That's a CSS problem. Make the `<label>` tag `display:inline`. | Don't put the input inside the label. Furthermore, a radio button doesn't have a value. It's checked or not checked.
```html
<div class="row">
<label for='A'>Label A</label>
<input type='radio' class='muted pull-left' name='radio' value='A' id='A' />
<label for='B'>Label B</label>
<input type='radio' class... |
5,712 | When I want to move data between two databases (e.g source: Oracle, destination: SQL Server), I think I have two options: Linked Server and SQL Server Integration Services. But is there any benefit using Linked Server? Is there any use of Linked Server if I have SSIS in my hand? | 2011/09/13 | [
"https://dba.stackexchange.com/questions/5712",
"https://dba.stackexchange.com",
"https://dba.stackexchange.com/users/2038/"
] | Linked Servers allow you to connect from SQL Server on an adhoc basis to another datasource, be it SQL Server, Oracle, or something else. Adhoc is the key word, so occasional use is fine. You'll see a lot of negative comments online about performance, hopefully Microsoft will fix in the next SQL Server after Denali.
S... | If you want to move data then SSIS is definitely a better choice as it does a lot more. SSIS is an feature rich ETL (Extract/Transform/Load) tool and was built for moving data around. Linked servers on the other hand is more suitable for the occasional quick querying of a remote server.
With SSIS you can even save yo... |
38,207,138 | Problem
-------
I have these panels, which I have successfully changed the colors of:
[](https://i.stack.imgur.com/c22Xq.png)
But when I expand the panels, there is a thin grey border at the bottom of each panel header:
[![enter image description he... | 2016/07/05 | [
"https://Stackoverflow.com/questions/38207138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4581003/"
] | ```
.panel-group .panel-heading + .panel-collapse > .panel-body {
border: none;
}
```
[JSFIDDLE](https://jsfiddle.net/wzepw41a/14/)
--------------------------------------------- | The particular property that you are hunting for is the `border-top-color` property of the `.panel-body` selector. By changing it's value to `transparent` you should remove that, thus:
```
.panel-default>.panel-heading+.panel-collapse>.panel-body {
border-top-color: transparent;
}
``` |
3,435 | Any ideas of how to create such looking logo like this:

This logo in [site](http://designerthemes.com/).
I like this roundness feel around letters. Dribble logo is also with similar effect.
I do not think that it is only shadow (if its shadow at all). | 2011/08/26 | [
"https://graphicdesign.stackexchange.com/questions/3435",
"https://graphicdesign.stackexchange.com",
"https://graphicdesign.stackexchange.com/users/2124/"
] | What you're seeing is anti-aliasing of the curved shapes combined with a bit of artifacting because the image is an 8-bit PNG. It looks a little fuzzy, in other words, because it *is* a little fuzzy. There is no glow or shadow applied to give that effect. | I am agree with mike,
but if you want to create manually you have to really work hard on illustrator, and the good news is, its a font named [Wendy LP](http://new.myfonts.com/fonts/adobe/wendy-lp/) you can use it.
and you can download [dribbble logo vector file here](http://dribbble.com/site/brand) see if it can help.... |
48,757,458 | While crawling through the intrinsics avaiable, I've noticed there's nowhere to be seen an horizontal addsub/subadd intruction avaiable. It's avaiable in the obsolete 3DNow! extension however it's use is impratical for obvious reasons. What is the reason for such "basic" operation not being implemented in the SSE3 exte... | 2018/02/12 | [
"https://Stackoverflow.com/questions/48757458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2054583/"
] | Generally you want to avoid designing your code to use horizontal ops in the first place; try to do the same thing to multiple data in parallel, instead of different things with different elements. But sometimes a local optimization is still worth it, and horizontal stuff can be better than pure scalar.
Intel experime... | How about:
```
__m128d a, b; //your inputs
const __m128d signflip_low_element =
_mm_castsi128_pd(_mm_set_epi64(0,0x8000000000000000));
b = _mm_xor_pd(b, signflip_low_element); // negate b[0]
__m128d res = _mm_hadd_pd(a,b);
```
This builds haddsubpd in terms of haddpd, so it's only one extra instruction. ... |
52,193 | I'm trying to develop a module to create a log for each product visited by a user.
To generate a log, I'm using event observer. But the event never is called.
What could be wrong?
My code:
C:\Users\miudo\AppData\Local\Temp\scp44107\home\sr\localhos.t\app\code\local\Bit\Itemsviewed\Model\Observer.php
```
<?php
class B... | 2015/01/14 | [
"https://magento.stackexchange.com/questions/52193",
"https://magento.stackexchange.com",
"https://magento.stackexchange.com/users/20333/"
] | D Millar try this event
`catalog_controller_product_init_after` instead of `catalog_controller_product_view` event .
```
Mage::dispatchEvent('catalog_controller_product_init_after',
array('product' => $product,
'controller_action' => $controller
)
```
**for Observer code is look like:**
------------... | Use this example to make it work, as I just tested it:
```
<frontend>
<events>
<catalog_controller_product_init_after>
<observers>
<gtm_see_product_details>
<class>gtm/observer</class>
<method>setGTMSeeProductDetails</method>
</gtm_... |
63,713,604 | Spark: 2.4.5 with Scala
I am having a column in my Dataframe which holds the number of days since epoch (1970). I am looking for a way to convert that into a Date Column.
So I am working on writing a function like below:
```
def from_epochday(epochDays: Column):Column = {
date_add(to_date(lit("1970-01-01"), "YY... | 2020/09/02 | [
"https://Stackoverflow.com/questions/63713604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5828621/"
] | Here is another way that you can do it.
```
df = spark.createDataFrame(
[
(1, 18508),
],
schema=StructType(
[
StructField('Id', StringType(), True),
StructField('Epoch_days', LongType(), True)
]
)
)
df.withColumn(
'date',
(col('Epoch_days')*8640... | ```
val df = Seq(1).toDF("seq").select(
from_unixtime(unix_timestamp(),"MM-dd-yyyy").as("date_1"),
from_unixtime(unix_timestamp(),"dd-MM-yyyy HH:mm:ss").as("date_2"),
from_unixtime(unix_timestamp(),"yyyy-MM-dd").as("date_3")
).show(false)
```
* <https://sparkbyexamples.com/spark/spark-epoch-time-to-t... |
10,310,441 | When compiling with ARC, method arguments often appear to be retained at the beginning of the method and released at the end. This retain/release pair seems superfluous, and contradicts the idea that ARC "produces the code you would have written anyway". Nobody in those dark, pre-ARC days performed an extra retain/rele... | 2012/04/25 | [
"https://Stackoverflow.com/questions/10310441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192102/"
] | See [this reply](http://lists.apple.com/archives/objc-language/2011/Nov/msg00005.html) from the Objc-language mailing list:
>
> When the compiler doesn't know anything about the
> memory management behavior of a function or method (and this happens a
> lot), then the compiler must assume:
>
>
> 1) That the functi... | Passing as a parameter does not, in general, increase the retain count. However, if you're passing it to something like `NSThread`, it is specifically documented that it *will* retain the parameter for the new thread.
So without an example of how you're intending to start this new thread, I can't give a definitive ans... |
667,412 | I'm trying to organize my Music better m4a, mp3, etc. Since the files are tagged I thought I could make a script to read the file and pull the album and artist info from the file then mv the file in the proper folder. I also wanted to learn some AWK in the process.
I started with:
```
for file in *.m4a; do
tagedi... | 2021/09/03 | [
"https://unix.stackexchange.com/questions/667412",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/475899/"
] | You can use `sub()` function to remove unwanted part from the beginning of each line:
```
for file in ./*.m4a; do
tageditor get artist -f "$file" | awk 'sub(/^Artist */, "")'
done
```
I'm also thinking the output of the `tageditor` command is Tab delimited output; if that was, you can restrict awk's default whit... | Is this what you're trying to do (using `cat file` in place of `tageditor...` which I don't have)?
```
$ cat file | awk 'sub(/^Artist[[:space:]]+/,""){sub(/,.*/,""); print}'
Periphery
Meshuggah
Varials
Cannibal Corpse
Lamb of God
Ingested
Linkin Park
Car Bomb
Whitechapel
Divine Destruction
Ingested
```
Don't use `/A... |
35,989 | >
> **Related Question**
>
> [Free Antivirus solutions for Windows](https://superuser.com/questions/2/free-antivirus-solutions-for-windows)
>
>
>
I am looking for a free native 64 Bit Anti virus package. I know lots / nearly all packages will run in 32bit emulated mode, but I can't seem to find a truly native 6... | 2009/09/04 | [
"https://superuser.com/questions/35989",
"https://superuser.com",
"https://superuser.com/users/6938/"
] | [Microsoft Security Essentials](http://www.softpedia.com/get/Antivirus/Microsoft-Security-Essentials.shtml)
-----------------------------------------------------------------------------------------------------------
Link is to Softpedia. It's in beta right now but I've been using it for about a month and so far it wor... | I've always used [AVAST](http://www.avast.com/eng/x64.html) and never had any problems. The link provides you information on a 64BIT AVAST. |
11,066,080 | I'm beginning to analyse datas for my thesis. I first need to count consecutive occurences of strings as one. Here's a sample vector :
```
test <- c("vv","vv","vv","bb","bb","bb","","cc","cc","vv","vv")
```
I would like to simply extract unique values, as in the unix command uniq. So expected output would be a vecto... | 2012/06/16 | [
"https://Stackoverflow.com/questions/11066080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/645118/"
] | What you probably want is some kind of bound service.
<http://developer.android.com/guide/topics/fundamentals/bound-services.html>
You can send messages to and receive messages from it.
So when your activity is started again, it can bind to the service again and receive callbacks when downloads have finished.
Plus the... | possible answer to your question 1 and also question 2:
use broadcastReceivers: <http://developer.android.com/reference/android/content/BroadcastReceiver.html>
for question 1: you can register your activity to some kind of receiver you'll define, and send whenever you'd like a broadcast to it. if the activity is regi... |
122,686 | I bought a turkey right after thanksgiving to turn into broth but didn’t the day of so I froze it and now I don’t know if I can put the frozen turkey into a pot as is or if I’d have to thaw it like normal first. I’m considering cutting the turkey in half to put in two pots to make more broth and have more space.
So, c... | 2022/12/18 | [
"https://cooking.stackexchange.com/questions/122686",
"https://cooking.stackexchange.com",
"https://cooking.stackexchange.com/users/102124/"
] | >
> Are whole dried Shiitake sufficient for complete flavour extraction in my stock
>
>
>
Of course! Don't bother cutting them up, as that would make them prone to releasing too much of their flavor long before the stock is ready. | This comes down to one simple question: Is the flavor you are getting while leaving them whole sufficiently strong for your tastes?
If the answer is yes, then just keep doing what you’re doing.
If the answer is no, then you *might* consider increasing the surface area, or you might consider adding more of them, or yo... |
10,187,659 | I'd like to get the following layout:
```
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
[ ][ ][ ][ ][ ][ ]
```
where each `[ ]` should be at most 300x150px, but scale down to the
bounding box as needed, conserving aspect ratio.
```
.field {
width: 16%;
}
.field .placeholder{
float: left;
wid... | 2012/04/17 | [
"https://Stackoverflow.com/questions/10187659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/411944/"
] | Yes you can via multipart uploading: <http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMPphpAPI.html>
Multipart uploading is a three-step process: You initiate the upload, you upload the object parts, and after you have uploaded all the parts, you complete the multipart upload. Upon receiving the complete multipart... | Yes,you can do this by modifying s3.php like this,
```
<?php
class S3Withprogressbar {
// ACL flags
const ACL_PRIVATE = 'private';
const ACL_PUBLIC_READ = 'public-read';
const ACL_PUBLIC_READ_WRITE = 'public-read-write';
private static $__accessKey; // AWS Access key
private static $__secretKey; // AWS Secret key
publ... |
17,843,622 | I measure cpu time and wall time of sorting algorithms on linux. Im using `getrusage` to measure a cpu time and `clock_gettime CLOCK_MONOTONIC` to get a wall time. Althought I noticed that a cpu time is bigger than wall time - is that correct? I always thought that cpu time MUST be less than wall time. My example resul... | 2013/07/24 | [
"https://Stackoverflow.com/questions/17843622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1367705/"
] | If a computation requires two seconds of processor time, then two processors can (ideally) complete it in one second. Hence a two-processor system has two CPU seconds for every wall-clock second. Even if you do not use multi-threading explicitly in your process, a library you use or the operating system may use multipl... | Depending on the argument you use, `getrusage` may return the sum of CPU time across all threads in your process. If you have more than one thread this can cause the CPU time to be higher than the wall clock time.
Also, while the result structure stores the values in microseconds, the actual precision may be much lowe... |
6,062,306 | Looking for a jQuery ninja's assistance. My jQuery below works but I have a strong suspicion that how I have selected these elements can be much improved. How best to select these elements? Can my code be improved? (See purpose below, important to note I only want to select the first div class results and image within)... | 2011/05/19 | [
"https://Stackoverflow.com/questions/6062306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337529/"
] | You'd need an Objective-C class to handle Objective-C notifications. *Core Foundation to the rescue!*
In.. wherever you start listening for notifications, e.g. your constructor:
```
static void notificationHandler(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef us... | You can't add a C++ method as an observer because of how Objective-C method handles method invocation vs C++. You must have an Objective-C class (Declared with `@interface Class` .. `@end`) to respond to those methods.
Your only option is to wrap your C++ class in an Objective-C class, or just have a very light wrappe... |
44,211,253 | I have two numpy arrays (with different lengths)
The first one is (n) like:
```
a = [0, 1, 2, 5, 6, 7]
```
The second one is (n,3) like:
```
b = [[0, 1, 3],[8, 3, 9],[9, 8, 4],[0, 4, 5],[1, 7, 3],[1, 5, 7],[2, 3, 7],[4, 2, 6],[5, 4, 6],[5, 6, 7]]
```
Now I want to check every column of the second array whether i... | 2017/05/26 | [
"https://Stackoverflow.com/questions/44211253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7580878/"
] | List **b** is to be understood as a matrix where the sublists are *rows*, NOT *columns*.
That being said, and considering the examples you have provided, I assume that what you actually want to do is finding the matches in the rows of b. Then we would proceed as follows:
1. Check if any of the numbers within **a** ma... | You can do it simply with `list comprehension` and using `any()` like this example:
```
a = [0, 1, 2, 5, 6, 7]
b = [[0, 1, 3],[8, 3, 9],[9, 8, 4],[0, 4, 5],[1, 7, 3],[1, 5, 7],[2, 3, 7],[4, 2, 6],[5, 4, 6],[5, 6, 7]]
final = [k for k in range(len(b)) if any(j in b[k] for j in a)]
print(final)
```
Output:
```
[0, 3... |
261,974 | How much overhead does x86/x64 virtualization (I'll probably be using VirtualBox, possbly VMWare, definitely not paravirtualization) have for each of the following operations a Win64 host and Linux64 guest using Intel hardware virtualization?
* Purely CPU-bound, user mode 64-bit code
* Purely CPU-bound, user mode 32-b... | 2011/04/20 | [
"https://serverfault.com/questions/261974",
"https://serverfault.com",
"https://serverfault.com/users/43050/"
] | I found that there isn't simple and absolute answer for questions like yours. Each virtualization solution behaves differently on specific performance tests. Also, tests like disk I/O throughput can be split in many different tests (read, write, rewrite, ...) and the results will vary from solution to solution, and fro... | There are too many variables in your question, however I could try to narrow it down. Let's assume that you go with VMware ESX, you do everything right - latest CPU with support for virtualaization, VMware tools with paravirtualized storage and network drivers, plenty of memory. Now let's assume that you run a single v... |
59,576,578 | Very new to React and I keep getting the warning above. Have tried various methods to fix it, but had no luck, code is where I'm up to now. Probably something very simple, but I just cannot see it. I'm not running React through NodeJs and it's working apart from this warning.
**BuildList.js file**
```
const ListI... | 2020/01/03 | [
"https://Stackoverflow.com/questions/59576578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/717192/"
] | Try this
```
render() {
return (
<div>
<p style={{'fontWeight': '700'}}>{this.props.intro}</p>
<ul className="list-unstyled">
{this.state.items.map((item, index) => {
return (
<ListItem key={index} title={item} onDelete={th... | [Codesandbox Link](https://codesandbox.io/embed/unruffled-colden-o66t2?fontsize=14&hidenavigation=1&theme=dark)
I have reproduced a minimal example using your code. After adding `key={index}`, i do not see any warnings. However if you remove "key" attribute, you will see warnings. |
10,404,067 | I have a UITextField that when clicked brings up a number pad with a decimal point in the bottom left. I am trying to limit the field so that a user can only place 1 decimal mark
e.g.
2.5 OK
2..5 NOT OK | 2012/05/01 | [
"https://Stackoverflow.com/questions/10404067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1282180/"
] | Implement the shouldChangeCharactersInRange method like this:
```
// Only allow one decimal point
// Example assumes ARC - Implement proper memory management if not using.
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSString *newSt... | **Swift 3** Implement this UITextFieldDelegate method to prevent user from typing an invalid number:
```
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
let text = (textField.text ?? "") as NSString
let newText = text.replacingCharac... |
139,716 | In theory what is 'cheaper': buying a home or building one?.
For simplicity we could assume that the terrain size is the same, in the same area, using the same house model (to calculate the material used to build the home).
***What I'm looking for is for a simple formula to evaluate if it's more convenient buy or buil... | 2021/04/09 | [
"https://money.stackexchange.com/questions/139716",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/39200/"
] | The question is "in theory," so the answer may be that custom house building is more expensive in theory than the semi-automated house building by a professional homebuilder, even including the professional homebuilder's profit.
However, if you enjoy the process of haggling with landowners, lenders and contractors, ge... | It's much cheaper to buy a house than build one. Modern house builders take lots of shortcuts to try to make their products competitive with older houses in price and the result of this is that modern houses are much lower quality than houses made in the 1950s or before. The only houses that are worse than the houses n... |
17,775,772 | I have the following...
```
var request = require('request');
exports.list = function(req, res){
res.send("Listing");
};
exports.get = function(req, res){
request.get("<URL>", function (err, res, body) {
if (!err) {
res.send(body,"utf8");
}
});
};
```
This fails with the following....
```
TypeE... | 2013/07/21 | [
"https://Stackoverflow.com/questions/17775772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/125212/"
] | Problem was with scope of variables, my response output was the same name as the response object I got back in my callback. Changing this around (resp vs res) made it work....
```
exports.get = function(req, res){
request.get("<url>", function (err, resp, body) {
if (!err) {
res.send(body);
}
});
};
... | I wasn't aware OP is using Express. You will encounter a similar error if you attempt to use `req.send` with the vanilla HTTP module instead of Express.
```
var http = require('http');
function requestHandler(req, res){
//res.send(200, '<html></html>'); // not a valid method without express
res.setHeader('Cont... |
2,568,842 | All,
I am trying to use JQuery's URL Validator plugin.
<http://docs.jquery.com/Plugins/Validation/Methods/url>
I have a text box that has a URL. I want to write a function which takes the textbox value, uses the jquery's validator plugin to validate urls and returns true or false.
Something like Ex:
```
function ... | 2010/04/02 | [
"https://Stackoverflow.com/questions/2568842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/229853/"
] | The validate() jQuery is made to validate a form itself I believe, not just an individual field.
I think you would be better off using a regex to validate a single textbox if you are not trying to a do a form validation.
Here's an example of a SO question that works.
```
function validateURL(textval) {
var urlrege... | While validating URLs you should consider that there are new TLDs being approved and now you can use non-Latin characters in domain names (e.g. [http://пример.испытание](http://%D0%BF%D1%80%D0%B8%D0%BC%D0%B5%D1%80.%D0%B8%D1%81%D0%BF%D1%8B%D1%82%D0%B0%D0%BD%D0%B8%D0%B5) is a valid URL). So proper regex which complies wi... |
538,996 | I have installed 3 new packages recently through NPM and none of them are executing.
I ran `sudo npm install -g ionic` and the installation looked like normal.
Then I can run `which ionic` and I get `/usr/local/bin/ionic` which looks good.
But if I run `ionic start myApp tabs` according to the documentation this sho... | 2014/10/19 | [
"https://askubuntu.com/questions/538996",
"https://askubuntu.com",
"https://askubuntu.com/users/340229/"
] | 1. Run
```
which node
```
and in my case it displayed `/usr/sbin/node`.
2. If it says `command not found`, skip to 3. Remove it by
```
sudo rm /usr/sbin/node
```
3. Run
```
which nodejs
```
in my case it displayed `/usr/bin/nodejs`.
4. Make a link
```
sudo ln -s /usr/bin/nodejs /usr/bin/node
```
OR
```
... | it also can be because of outdated nodejs installed
according to <https://stackoverflow.com/questions/21362636/phonegap-cli-on-linux-doesnt-do-anything> it can be fixed in next way:
```
sudo apt-get install curl
npm update npm -g
sudo npm install n -g
sudo n stable
```
and then `npm remove -g ionic && npm install -g... |
49,796,312 | I'm trying to convert an existing callback based function from the crypto library to be used with es6 `async/await` in the method above it. Whenever I make a call to `generateSubkey(password,salt)` it returns `[function]`. Inside this if I call `toString()` it shows my methods code as opposed to executing it.
```
impo... | 2018/04/12 | [
"https://Stackoverflow.com/questions/49796312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3342835/"
] | If I understood you correctly, you just want to print every occurrence of the first item regardless of repetitions, and print it only once? To do so, you can use a `set`:
```
print(", ".join(set(e[0] for e in rows)))
# python, html, PHP
```
If you need to keep the order, then it's a bit more difficult - you'll have ... | you can use a list ( as checklist )
```
rows = (('python', 'kivy'), ('python', 'tkinter'),("python","wxpython"),('PHP', 'bootstrap'),('html', 'ajax'),('html', 'css') )
lista=[]
for i in rows:
if i[0] not in lista:
lista.append(i[0])
print(i[0])
```
or
```
rows = (('python', 'kivy'), ('python'... |
60,845,822 | A bit of background, I mainly work in .Net/C# and never did any PHP my whole life and my company gave me an existing PHP code and asked me add some feature to it.
The webpage I need to work on is a catering system. The page recalculates the total price when there are changes to the number of pax. This worked fine if e... | 2020/03/25 | [
"https://Stackoverflow.com/questions/60845822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6459097/"
] | To quote from psycopg2's [documentation](https://www.psycopg.org/docs/usage.html):
*Warning Never, never, NEVER use Python string concatenation (+) or string parameters interpolation (%) to pass variables to a SQL query string. Not even at gunpoint.*
Now, for an upsert operation you can do this:
```
insert_sql = '''... | Try:
```
INSERT INTO tablename (col1, col2, col3,col4)
VALUES (val1,val2,val3,val4)
ON CONFLICT (col1)
DO UPDATE SET
(col2, col3, col4)
= (val2, val3, val4) ; '''
``` |
4,927,860 | I'm making a little chat messenger program, which needs a list of chat channels the user has joined. To represent this list graphically, I have made a list of `QPushButtons`, which all represent a different channel. These buttons are made with the following method, and that's where my problem kicks in:
```
void Messen... | 2011/02/07 | [
"https://Stackoverflow.com/questions/4927860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/598639/"
] | Use `QSignalMapper` to pass variables;
```
QSignalMapper* signalMapper = new QSignalMapper (this) ;
QPushButton *button = new QPushButton();
signalMapper -> setMapping (button, <data>) ;
connect (signalMapper, SIGNAL(mapped(QString)), this,
SLOT(buttonClicked(QS... | Don't use the sender method unless you absolutely have to. It ties the function directly to being used only as a slot (can't be called directly). Retain the behavior of having the function accept a string and simply make a mechanism by which you can call it.
One method, among others you might find, is to leverage use ... |
49,685,217 | Suppose I have the following DataFrame:
```
scala> val df1 = Seq("a", "b").toDF("id").withColumn("nums", array(lit(1)))
df1: org.apache.spark.sql.DataFrame = [id: string, nums: array<int>]
scala> df1.show()
+---+----+
| id|nums|
+---+----+
| a| [1]|
| b| [1]|
+---+----+
```
And I want to add elements to the array... | 2018/04/06 | [
"https://Stackoverflow.com/questions/49685217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2251463/"
] | ```
import org.apache.spark.sql.functions.{lit, array, array_union}
val df1 = Seq("a", "b").toDF("id").withColumn("nums", array(lit(1)))
val df2 = df1.withColumn("nums", array_union($"nums", lit(Array(5))))
df2.show
+---+------+
| id| nums|
+---+------+
| a|[1, 5]|
| b|[1, 5]|
+---+------+
```
The `array_union()... | If you are, like me, searching how to do this in a Spark SQL statement; here's how:
```
%sql
select array_union(array("value 1"), array("value 2"))
```
You can use array\_union to join up two arrays. To be able to use this, you have to turn your value-to-append into an array. Do this by using the array() function.
... |
15,296,637 | Why after the first loop, the switch will execute twice before it stop to wait for my input? Is there any char left in the standard input? How can I fix the issue?
```
while(true)
{
int choice = System.in.read();
switch(choice)
{
case '1':
break;
default:
break;
}
}
``` | 2013/03/08 | [
"https://Stackoverflow.com/questions/15296637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1701045/"
] | If you again print choice somewhere, probably you will get 10 and 13.
* '10' is LF (line feed control char).
* '13' is CR (carriage return control char).
This is why the switch is executing twice.
And the better way of taking input already have been shown by Reimeus, Chris Cooney. | You can use **Break to Labeled Statement** in this case. for more information <http://www.javaspecialists.eu/archive/Issue110.html>
**Here is workign code:**
```
import java.io.IOException;
public class Switch {
public static void main(String[] args) throws IOException {
exitWhile: {
while ... |
65,338,957 | For a school project, I'm trying to re-create the `printf` function of the `stdio.h` library in C.
I'm currently working on getting the `unsigned int` printing part working, but for some reason, why I try the real `printf` to print an unsigned int, it gives me a warning (which is considered as an error in my school). ... | 2020/12/17 | [
"https://Stackoverflow.com/questions/65338957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14608442/"
] | All integer constants such as `4294967295` have a type, just like declared variables. The C compiler assigns a type to such a constant based on various intricate rules. A simplified explanation is that these rules basically boil down to:
* "Does it fit in an `int`? If so, make it `int`."
* "Otherwise does it fit in a ... | The type of an integer literal is taken as the first type in the list in the standard that fits. The list for literals without the any suffix is `int`, `long int`, `long long int`/`unsigned long int`. As 4294967295 doesn't fit in `int`, it'll be `long` if `long` is a type wider than 32-bit (which is the case on your pl... |
28,391,798 | How can I change the supported TLS versions on my HttpClient?
I'm doing:
```
SSLContext sslContext = SSLContext.getInstance("TLSv1.1");
sslContext.init(
keymanagers.toArray(new KeyManager[keymanagers.size()]),
null,
null);
SSLSocketFactory socketFactory = new SSLSocketFactory(sslContext, new String[]{"TL... | 2015/02/08 | [
"https://Stackoverflow.com/questions/28391798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/719153/"
] | This is how I got it working on httpClient 4.5 (as per Olive Tree request):
```
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope(AuthScope.ANY_HOST, 443),
new UsernamePasswordCredentials(this.user, this.password));
SSLContext sslContext = ... | If you have a [javax.net.ssl.SSLSocket](https://docs.oracle.com/javase/8/docs/api/index.html?javax/net/ssl/SSLSocket.html) class reference in your code, you can set the enabled TLS protocols by a call to [SSLSocket.setEnabledProtocols()](https://docs.oracle.com/javase/8/docs/api/javax/net/ssl/SSLSocket.html#setEnabledP... |
58,743,664 | I have been trying to install `PySide2` on my PC (`Windows 10 64bits`) with `Python 3.8` installed, but I keep getting errors every time.
I used the command `pip install PySide2`. It is not working for me.
Any help will be appreciated.
**Error:**
```
ERROR: Could not find a version that satisfies the requirement py... | 2019/11/07 | [
"https://Stackoverflow.com/questions/58743664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12336141/"
] | If you check the available files on the [pypi page](https://pypi.org/project/PySide2/#files), you will see that there are only wheels for `cp35.cp36.cp37` so python 3.5 to 3.7, no files for 3.8. That is why `pip` cannot find a version, since there is no compatible version on `pypi`.
There is also no python 3.8 release... | Additionally for anyone trying to install this on Raspbian (maybe also other Linux
systems):
You can install PySide2 without pip wheel using the following command
```
$sudo apt-get install python3-pyside2.qt3dcore python3-pyside2.qt3dinput python3-pyside2.qt3dlogic python3-pyside2.qt3drender python3-pyside2.qtcharts ... |
12,201,487 | I have been working on the problem sets at [Project Euler](http://projecteuler.net/) for some time and have enjoyed the challenges presented. I am currently on [Problem 59](http://projecteuler.net/problem=59) which involves the process of encryption and decryption.
The problem is, by any reasonable standard, a very s... | 2012/08/30 | [
"https://Stackoverflow.com/questions/12201487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1465011/"
] | Well, you can assume only valid ASCII values are permitted (since it should be plaintext). So for every letter you decode, just check that the resulting XOR results in a valid value: `if(dataCopy[l] < 32 || dataCopy[l] > 122) continue;` This should help to eliminate a vast majority of the possible key combinations.
A... | Can you send a checksum of the original message along with the encrypted message? After decryption, compute the checksum and see if they match.
If that is not available, what about a test message? You could send a test message first such as "This is my test message" and check to see if the decrypted message matches ve... |
67,481,342 | I am trying to solve a problem where I have to find all the sub pairs which sum to zero.
In my solution when sum == 0, it goes into an infinite loop. What I am doing wrong here.
```
function sumZero(data) {
let left = 0;
let right = data.length - 1;
let finalArray = [];
while (left < right) {
let sum = dat... | 2021/05/11 | [
"https://Stackoverflow.com/questions/67481342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10636599/"
] | If sum==0, you push the items in finalArray, but you don't manage the left or right, thus it will be forever the same items and the same sum. Try to increase left (left++) if sum ==0 | Your main issue lies in here:
```
else if (sum > 0) {
right--;
} else {
right++;
}
```
You might either want to replace a `right` with a `left`. The reason why your are getting an infinite loop is when the sum < 0. The right will increment, thus, having the same behavior as the previous iteration and hence, the ... |
43,774,129 | I wanted to check if variable is there or not in blade ..for that i have used following lines:
```
@if(is_null($products))
<div class="alert alert-warning">
<strong>Sorry!</strong> No Product Found.
</div>
@else
@foreach($products as $product)
//
@... | 2017/05/04 | [
"https://Stackoverflow.com/questions/43774129",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6196521/"
] | As of Laravel 5.7, You can also do this:
```
@empty(!$products)
<div class="alert alert-warning">
<strong>Sorry!</strong> No Product Found.
</div>
@endempty
``` | ```
@forelse($products as $product)
<p>do some thing</p>
@empty
<p>No Products</p>
@endforelse
```
[Refer](https://laravel.com/docs/5.1/blade#control-structures) |
56,408,020 | This portion of my assignment is instructing me to change the src attribute of a collection of star images to another image file.
I've tried numerous combinations of **removeAttribute()** and **setAttribute()**, but no luck. I'm probably thinking down the wrong path here.
```
function lightStars () {
var starNumbe... | 2019/06/01 | [
"https://Stackoverflow.com/questions/56408020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11511460/"
] | We can make extensive use of `pandas` + `numpy` here:
1. Mask all values which are greater than `0`
```
m = df.gt(0)
A B C D
0 True False False True
1 False True False False
2 False False False False
```
2. Mask rows which dont contain any values above 0:
```
s1 = m.any(axis=1... | You could apply a custom function which will process each row of the DataFrame and return a list. Then to sum returned lists.
```
In [1]: import pandas as pd
In [2]: df = pd.read_clipboard()
In [3]: df
Out[3]:
A B C D
0 1 0 0 2
1 0 1 0 0
2 0 0 0 0
In [4]: def get_positive_values(row):
...: ... |
62,525 | I'm looking for some way to run a batch file (.bat) without anything visible to the user (no window, no taskbar name, .etc..).
I don't want to use some program to do that, I'm looking for something cleaner. I've found [a solution](http://www.computing.net/answers/dos/run-batch-file-invisiblestealth/14270.html) that us... | 2009/10/29 | [
"https://superuser.com/questions/62525",
"https://superuser.com",
"https://superuser.com/users/1799/"
] | To Hide batch files or command files or any files.... Use Windows XP built in `IExpress.exe` utility to build a .EXE out of the batch file. When using `IExpress` make sure you check the run hidden option and check mark all the boxes about not showing anything. After you create your .exe place it in whatever run command... | You do not need to do any special.
If you are running the batch files from a windows service, they should be hidden by default unless you enable the "Allow service to interact with desktop" option on the service. |
50,007,055 | I'm trying to make a request in a local file, but I don't know when I try to do on my computer show me an error. Is possible make a fetch to a file inside your project?
```
// Option 1
componentDidMount() {
fetch('./movies.json')
.then(res => res.json())
.then((data) => {
console.log(data)
... | 2018/04/24 | [
"https://Stackoverflow.com/questions/50007055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/989470/"
] | The error
```
Unexpected token < in JSON at position 0
```
comes from the HTML file that is returned if the request is unsuccessful. The first element (at position 0) of an HTML file is typically a '<'. Instead of a JSON, an attempt is made to read in an HTML file.
You can find the returned HTML File in the Inspect... | You can place your json file in the public folder. In your React component you can use userEffect (). You don't need Express.js for this case.
```
React.useEffect(() => {
fetch("./views/util/cities.json")
.then(function(response) {
return response.json();
})
.then(function(myJson) {
... |
460,172 | I have a simple html block like:
```
<span id="replies">8</span>
```
Using jquery I'm trying to add a 1 to the value (8).
```
var currentValue = $("#replies").text();
var newValue = currentValue + 1;
$("replies").text(newValue);
```
What's happening is it is appearing like:
81
then
811
not 9, which would be t... | 2009/01/20 | [
"https://Stackoverflow.com/questions/460172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50711/"
] | parseInt didn't work for me in IE. So I simply used + on the variable you want as an integer.
```
var currentValue = $("#replies").text();
var newValue = +currentValue + 1;
$("replies").text(newValue);
``` | You can use parseInt() method to convert string to integer in javascript
You just change the code like this
```
$("replies").text(parseInt($("replies").text(),10) + 1);
``` |
294,428 | My server is under DDoS attacks. I see my access log and get something:
```
968966 93-97-53-41.zone5.bethere.co.uk - - [27/Jul/2011:12:13:58 +0700] "GET /forum/forum.php HTTP/1.1" 200 91231 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5. 1)"
968967 61.120.148.12 - - [27/Jul/2011:12:13:39 +0700] "GET /fo... | 2011/07/27 | [
"https://serverfault.com/questions/294428",
"https://serverfault.com",
"https://serverfault.com/users/89091/"
] | As [Jason](https://serverfault.com/a/294432/101655) already pointed out, your best current option is to call your ISP/Hoster for help.
After that, sign up for a CDN, if possible - they thwart most DDoS'es by design, or at least, make them only a localized nuisance. There are many CDN's which provide some free plan, wh... | Theoretically, u can use Client Puzzle to solve DDos attack. Depend on the situation, you may use different kind of puzzle to solve your problems.
[May I know, how do you know if you are under DDos attack from above log?] |
8,011 | Let's say I shoot with [Canon EF 35mm f/1.4L](http://www.the-digital-picture.com/reviews/canon-ef-35mm-f-1.4-l-usm-lens-review.aspx), [Canon EF 50mm f/1.4](http://www.the-digital-picture.com/reviews/canon-ef-50mm-f-1.4-usm-lens-review.aspx), and a [Canon EF 85mm f/1.8](http://www.the-digital-picture.com/reviews/canon-e... | 2011/02/01 | [
"https://photo.stackexchange.com/questions/8011",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/1635/"
] | I'd say, based on your criteria, the answer is yes. However, the fact is, primes are usually a better option at a given focal length versus a zoom, a result of less complex optical construction. In terms of the lens range, it's good for portrait/street, but I think a little too long for landscape and architecture, thou... | Besides the DoF that most people talked about, for the sizes you will be printing, i really don't think you will be noticing a LOT of difference in image quality.
The 24-70 will have more chromatic aberration and such, being a zoom lens, but it's also a 1200$ Canon L lens, it certainly won't be rubbish.
And f2.8 give... |
62,028,537 | I use VS as my IDE.
I set all up for web development and the command `flutter doctor` doesn't state any errors.
When I run my project with Chrome as device, VS gets stuck in "Syncing files to device Chrome".
I also tried running my project through terminal with `flutter run -d chrome --verbose`, the strange thing th... | 2020/05/26 | [
"https://Stackoverflow.com/questions/62028537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12248145/"
] | In UWP, access to files by path is restricted. The recommended practice is to use FileOpenPicker to select files.
But if you just save the data locally, you can use `ApplicationData.Current.LocalFolder` to access the local application folder.
like this:
```cs
private async void Save()
{
BinaryFormatter bf = new ... | I managed to get the following to work:
```
private void Save()
{
BinaryFormatter bf = new BinaryFormatter();
// Serialize the Binary Object and save to file
using (Stream fsout = new FileStream(System.IO.Path.GetTempPath() + "viewModel.txt", FileMode.Create, FileAccess.ReadWrite, File... |
11,695,556 | I trying to write a Prolog script that can create a list of strings that would after a simple procedure result in a given string. My knowledge of Prolog is very limited and I am not sure it is even able to perform this, so please tell me if it's impossible.
I got this so far
```
replace_word(Old, New, Orig, Replaced)... | 2012/07/27 | [
"https://Stackoverflow.com/questions/11695556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1558704/"
] | Here's my super duper solution:
The HTML
```
<div class="ratioBox">
<div class="dummy"></div>
<div class="el">This is the super duper ratio element </div>
</div>
```
The CSS
```
.ratioBox{
position: relative;
overflow: hidden; /* to hide any content on the .el that might not fit in it */
... | Resize a div like an image with CSS
-----------------------------------
**[DEMO](http://jsfiddle.net/webtiki/p78y4/)** : resize the result window (width and height) to see the div resize like the image.
In the demo you can see both image and div resize the same way according to the height and the width of the result ... |
45,808,662 | I'm trying to pass data forward from a table view cell button to a view controller. Depending on which row the button is selected in I want the following view controller label's text to be set accordingly. However, when I try to do so, my labels in the following view controller stay blank and don't change. How can I ch... | 2017/08/22 | [
"https://Stackoverflow.com/questions/45808662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8480380/"
] | Your outlets aren't wired up until the view loads.
Try creating a property in your KeysController, say:
```
var keyText: String?
```
Set the property after instantiating the view controller:
```
tipsVC.keyText = firstTips[initialRow]
```
Then in your `KeysController.viewDidLoad` method:
```
key1.text = keyText
... | it's because the label key1 is not loaded yet, it's better to update it on viewdidload instead
```
@IBAction func tipsButton(_ sender: UIButton) {
print(String(initialRow))
let tipsVC = UIStoryboard(name: "main", bundle: nil).instantiateViewController(withIdentifier: "KeysController") as! KeysController
... |
4,313,643 | I want to put an icon on the left and an input type text on the right occupying all the remaining space.
```
----------------------------------------------------
| [ico] ---------------------------------------- |
| | input type="text" | |
| ---------------------------------------- ... | 2010/11/30 | [
"https://Stackoverflow.com/questions/4313643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/340760/"
] | Try `display: table-cell` . | Did you try to use align="absmiddle" in the icon?
```
<img src="img.jpg" align="absmiddle">
``` |
19,716,803 | I have got one big array.
The content of that array is:
```
Array
(
[0] => Array
(
[id] => 12
[user_id] => 1
[date] => 2013-10-21 23:01:52
[type] => 1
[quantity] => 0
[value] => 1700
)
[1] => Array
(
... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19716803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2190042/"
] | If you actually need to create a filtered array, you could use [`array_filter()`](http://php.net/manual/en/function.array-filter.php) with a callback:
```
$filtered = array_filter($this->data, function($element) {
return $element['type'] == 1;
});
```
Otherwise, the simplest solution is probably just to put some... | You can use a simple `IF` statement with `continue` to check to see if `type` equals 1. If it doesn't you can skip it.
```
foreach ( $this->data as $d )
{
if ($d['type'] != 1) continue;
``` |
54,124,051 | I'm doing a hackernet challenge where n is an int input. The conditions are:
* If n is odd, print Weird
* If n is even and in the inclusive range of 2 to 5, print Not Weird
* If n is even and in the inclusive range of 6 to 20, print Weird
* If n is even and greater than 20, print Not Weird.
Im sure the code makes log... | 2019/01/10 | [
"https://Stackoverflow.com/questions/54124051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10893731/"
] | Read this condition :
```
if (N % 2 != 0 || N % 2 == 0 && N >= 6 && N <= 20)
```
as
```
if (N % 2 != 0 || (N % 2 == 0 && N >= 6 && N <= 20))
```
Then see how operator precedence changes the behaviour and yield desired results. | Check the following one
```
public static void main(String[] args)
{
int N = scanner.nextInt();
scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");
if(N%2!=0) {
System.out.print("weird");
}else if(N>=2 && N<=5) {
System.out.print("not weird");
}else ... |
16,058 | The question of [*why* is there religion in Harry Potter](https://scifi.stackexchange.com/q/16030/1234) made me wonder as to whether wizards, any of them, do practice religion. Whether there be magic-person only religions or shared muggle faiths, I do not recall any wizards (born in the wizard world anyway) saying that... | 2012/05/03 | [
"https://scifi.stackexchange.com/questions/16058",
"https://scifi.stackexchange.com",
"https://scifi.stackexchange.com/users/1234/"
] | There are, to the best of my memory, no instances of wizard-raised wizards mentioning religion at all in the books. As you stated, many of them do celebrate Christmas, and one might think that if there was some form of Jewish, Pagan, Muslim, or other Muggle faith with a winter holiday prevalent in the wizarding world, ... | I always think about religion in the wizarding world when the hospital is mentioned. It isn't something like London Memorial Hospital, it's Saint Mungo's. So there had to be a wizard who not only got canonised but also was proud of it. And he got canonised while still alive because he founded the hospital himself. |
63,006,132 | I was able to create a data masking policy for a json column for the top level keys with the following, but couldn't figure out to go to deeper layers in json. Anybody has done that?
```
CREATE OR REPLACE MASKING POLICY json_mask_test AS
(val variant) returns variant ->
CASE
WHEN invoker_role()='ADMIN' THEN val
ELSE o... | 2020/07/21 | [
"https://Stackoverflow.com/questions/63006132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1628812/"
] | `display: flex` makes us happy.
You're HTML should be like this.
```
<div class="wrapper">
<div id="1"></div>
<div class="wrapper_two>
<div id="2"></div>
<div id="3"></div>
</div>
</div>
```
div 1, 2, 3 must have height.
And css code is like
```
.wrapper {
display: flex;
}
.wrapper_two {
display... | ```css
#container{
width:80%;
margin:40px 10%;
background-color:lightgray;
height:auto;
display:flex;
justify-content:space-between;
align-items:center;
}
#left{
width:50%;
height:200px;
background-color:blue;
... |
54,098,448 | So I am reading this excellent [intro](https://medium.freecodecamp.org/demystifying-dynamic-programming-3efafb8d4296) to Dynamic Programming, and I am trying to decipher this python code (DP approach for Fibonacci numbers). I code mainly in C/C#, so its kinda hard for me to understand Python.
So this is the code:
```
... | 2019/01/08 | [
"https://Stackoverflow.com/questions/54098448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9187905/"
] | ```
1: [0]*3 -> [0,0,0] i.e. multiplying an array duplicates it that many times -n+1 in your case-.
2: because you start with [0,1,0,0,0, ...]
the first index you add to is ^
... the last index you add to will be at n+1 because the first index you added to was 2
[0,1,1,2,3,5,8,13,21,...]
``` | What tools are you using for "trying to understand"? A couple of basic `print` commands will help a lot:
```
def fibonacciVal(n):
memo = [0] * (n+1)
print("INIT", memo)
memo[0], memo[1] = 0, 1
for i in range(2, n+1):
memo[i] = memo[i-1] + memo[i-2]
print("TRACE", i, memo)
return mem... |
141,421 | I am looking for a word that is close in meaning to *nostalgia*, but not so passive. Something that is compulsive. It should also be unambiguously negative. A bonus would be a connotation of anxiety.
**Edit:** I am looking for a noun, like *nostalgia*, that describes the state or emotion. | 2013/12/11 | [
"https://english.stackexchange.com/questions/141421",
"https://english.stackexchange.com",
"https://english.stackexchange.com/users/23650/"
] | [*Rumination*](http://en.wikipedia.org/wiki/Rumination_%28psychology%29) is the term I have used in the past to describe the given situation. | Reminiscing
indulge in enjoyable recollection of past events.
It is often more of a positive term than negative, it is a verb (to reminisce).
It is all about you are in the present thinking back on the past. |
3,760,838 | I am trying to evaluate this very long definite integral given below:
$$ \int\_{-\infty}^{+\infty} \frac{\cos(4x)}{x^2 + 2x + 2} \, dx$$
The direction it can go is by decomposing the denominator to $(x−i+1)$ and $(x+i+1)$ and then taking a partial fraction as:
$$ \frac{i\cos(4x)}{2(x−i+1)} - \frac{i\cos(4x)}{2(x−i+1... | 2020/07/18 | [
"https://math.stackexchange.com/questions/3760838",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/407650/"
] | Let $x+1=t$. Then,
\begin{align}
I=& \int\_{-\infty}^{+\infty} \frac{\cos(4x)}{x^2 + 2x + 2} \, dx
=\cos4 \int\_{-\infty}^{+\infty} \frac{\cos(4t)}{t^2 +1} \, dt
\end{align}
where the odd $\sin 4t$ term vanishes upon integration. Denote $J(a)=\int\_{0}^{\infty} \frac{\cos(at)}{t^2 +1} dt$.
Then
$$J’(a)=-\frac\pi2+ \... | $\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,}
\newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace}
\newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack}
\newcommand{\dd}{\mathrm{d}}
\newcommand{\ds}[1]{\displaystyle{#1}}
\newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,}
\new... |
5,880,748 | For the sake of "post processing" on a method, I want to import an extra function into a method.
**How can I import a `Func` that returns an anonymous Type as a parameter for a .Select extension method?**
The expression is anounymous like:
```
p => new
{
ThumnailUrl = p.PicasaEntry.Media.Thumbnails[0].Attributes... | 2011/05/04 | [
"https://Stackoverflow.com/questions/5880748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/400223/"
] | Anonymous types are really only designed for local use. In a strongly typed language types that can't be strongly typed are not really encouraged for general use... They are just a part of c#s little dance in the dynamic world.
You have two choices.
Create a strong type.
```
class Entry
{
public string Thumn... | Did you try this, not sure whether it will work?
```
private void BindControl<T, U, V>(string uri, DataBoundControl target, Func<U,V> selector)
where T : KindQuery, new()
where U : PicasaEntity, new()
{
PicasaFeed feed = CreateFeed<T>(uri);
albumList.DataSource = GetPicasaEntries<U>(feed).Select(select... |
49,334,505 | I am porting my Angular 4 application to Angular 5 and although the application successfully builds the application does not load. I am getting the following error when I run my application: `Uncaught Error: No NgModule metadata found for 'AppModule'.`
**Full Stack Trace**
[ reduces the latter but often increases the former.
Let us briefly examine those concepts.
Static Instruction... | Lets say you have a function thats 100 instructions long and it takes 10 instructions to call it whenever its called.
That means for 10 calls it uses up 100 + 10 \* 10 = 200 instructions in the binary.
Now lets say its inlined everywhere its used. That uses up 100\*10 = 1000 instructions in your binary.
So for point... |
1,298,441 | I am using VS 2005 (C# ). My Webservice returns a type as follow :
```
[WebMethod]
public Employee getEmployee( )
{
Employee emp=new Employee();
emp.EmpID=1000;
emp.EmpName="Wallace";
return emp;
}
```
---
from Client side i have created a Proxy.
```
localhost.Service1 svc = new WindowsApplic... | 2009/08/19 | [
"https://Stackoverflow.com/questions/1298441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/158977/"
] | Your links need valid href values pointing to the alternative non-JavaScript pages, and in your click event, you need to return false, to avoid JavaScript enabled browsers to follow the links:
```
<a id="aboutLink" href="about-us.html">About Us</a>
```
---
```
$('#aboutLink').click(function () {
// ajax content ... | I would simply write down the HTML as it would look like without JavaScript, and then modify the content as it should look with JavaScript enabled.
In case JS is enabled, the site might load a little bit slower and may look a bit weird while it is being built, but the functionality remains.
In case JS is disabled, the... |
49,023,973 | I am new to React.I am facing this error.I have the code which is pasted below.Please help get out of this error.
```
import React from 'react';
import { Card} from 'semantic-ui-react';
import axios from 'axios';
export default class PersonList extends React.Component {
state = {
persons: []
}
componentDidMount(... | 2018/02/28 | [
"https://Stackoverflow.com/questions/49023973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9239986/"
] | You can create an array from the `LOCATION` string using `.split(',')` :
```
function render() {
const locationArr = this.state.persons.LOCATION
? this.state.persons.LOCATION.split(',')
: [];
return (
<div className="ui stackable two column grid">
{locationArr.map((location) => {
if (loca... | you set `this.state.persons` to `res.data` which is probably an object.. you cannot use `map` on an object...
instead you maybe want to push the the object to an array of objects. like this:
```
let persons = this.state.persons.slice()
persons.push(res.data)
this.setState({persons})
``` |
672 | [This question](https://mathoverflow.net/questions/139975/positivity-of-the-norm-of-an-element-of-a-cyclotomic-field) was originally asked in MSE about a year ago.
Nobody has answered it.
So I posted it here.
I wonder why they think it's not of research level. | 2013/08/21 | [
"https://meta.mathoverflow.net/questions/672",
"https://meta.mathoverflow.net",
"https://meta.mathoverflow.net/users/37646/"
] | It is for days I want to write this answer. Now that I've come to write it, your question is not there anymore. Thus please consider my answer as a general impression of another "newcomer" about how MO works. Generally speaking:
>
> People in MO land do not like "naked" questions.
>
>
>
That means, more often th... | I respectfully disagree with Noah Snyder; I think the question makes perfect sense as stated. I would phrase it as follows: "Here is a proof that the norm map $K = \mathbf Q[\alpha]/(1+\alpha+\ldots+\alpha^{p-1}) \to \mathbf Q$ takes only positive values. The proof uses that $K$ embeds in the complex numbers. Is there ... |
49,504,614 | ```
class Feline {
public String type = "f";
public Feline() {
System.out.println("feline");
}
}
public class Cougar extends Feline {
public Cougar() {
System.out.println("cougar");
}
void go() {
type = "c";
System.out.println(this.type + super.type);
}
... | 2018/03/27 | [
"https://Stackoverflow.com/questions/49504614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9334394/"
] | Java objects are constructed from the inside out: When you say `new Cougar()`, first space is allocated for the object, then a Feline object is constructed in that space by calling a Feline constructor, then finally your Cougar constructor is run.
You can specify *which* Cougar constructor is run by calling it explici... | You have created two classes where `Feline` is a super class and `Cougar` is a child class. As `Cougar` extends `Feline`, `Cougar` inherits `type` variable from `Feline`.
Now, `Feline` has a default constructor where `feline` string is printed. `Cougar` also has a default constructor. As per the line `new Cougar().go(... |
30,610,438 | One can declare and initialize an unordered map in a single line like this:
```
std::unordered_map<std::string,std::string> colors({{"sky","blue"}});
```
But is it possible to do it in place of a function argument ?
For example, if I have a function with the following signature:
```
void foo(std::unordered_map<std... | 2015/06/03 | [
"https://Stackoverflow.com/questions/30610438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1266109/"
] | You can just provide an initializer:
```
foo({{"sky", "blue"}});
```
That will be used to construct a temporary `unordered_map`, which will be passed to the function. If the function is overloaded such that there is an ambiguity, then you can spell the name out fully.
```
foo(std::unordered_map<std::string,std::str... | Yes, it is possible. program will create a `rvalue` reference for that parameter.
```
void foo(std::unordered_map<std::string,std::string> colors)
{
for(auto &x : colors)
{
std::cout<< x.first<<"\n";
std::cout<<x.second<<"\n";
}
}
int main()
{
foo({{"sky","blue"}});
}
``` |
70,663,112 | I am trying to create a table. left side image and right side information. i am not sure if it's possible
here is the structure i am trying to make.

here is a rough table structure I came up with
```
<table border="2" bordercolor="green">
<tr>
<td><img src="https:/... | 2022/01/11 | [
"https://Stackoverflow.com/questions/70663112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16499922/"
] | The problem is that `@Pattern` [only works on strings](https://docs.oracle.com/javaee/7/api/javax/validation/constraints/Pattern.html).
You could use a [`@Digits`](https://docs.oracle.com/javaee/7/api/javax/validation/constraints/Digits.html) validator to validate how many digits you must have in the integer part: <ht... | `@Pattern` Annotation works **only** with strings and not integers. You could migrate your `int` to a `String` if that is suitable. Then it would work.
You could also implement your own `Validator` as seen [here](https://www.baeldung.com/spring-mvc-custom-validator). |
65,211,610 | I have this dataset, I want to make triple y axis where "Country" will be X axis. in the y axis I want to do two clustered column with one line graph overlapping.
I am a new user, learning for 16 days
```
dput(data)
structure(list(Country = c("China", "Indonesia", "Vietnam", "Thailand",
"Egypt", "India", "Turkey", "... | 2020/12/09 | [
"https://Stackoverflow.com/questions/65211610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14711964/"
] | Arrow functions with a body may require an ***explicit*** `return` statement if the function is to return a value. Arrow functions without a body (i.e. no `{}`) have an ***implicit*** return.
Solution
========
Return the entire ternary expression.
```
<TableRow>
{tableData.header.map((header) => {
return heade... | So I solved it by using this code:
```
<TableRow>
{
tableData.header.map(header => header.id === "name" ?
<TableCell style={{minWidth: 80}} align="center" key={header.id}>
{
... |
747,518 | Any help would be appreciated, I'm trying to convert the code below to C#, I've never used VB.NET so ReDim is a new one to me.
Thanks
```
Dim inFile As System.IO.FileStream
Dim binaryData() As Byte
Dim strFileName As String
strFileName = "C:\MyPicture.jpeg"
inFile = New System.IO.FileStream(strFileName, System.IO.F... | 2009/04/14 | [
"https://Stackoverflow.com/questions/747518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/88081/"
] | This very easy to convert to C#.
```
FileStream inFile;
byte[] binaryData;
string strFileName;
strFileName = @"C:\MyPicture.jpeg";
inFile = new System.IO.FileStream(strFileName, System.IO.FileMode.Open, System.IO.FileAccess.Read);
binaryData = new byte[inFile.Length];
int bytesRead = inFile.Read(binaryData, 0, bina... | ReDim is used is resize arrays. (You can preserve the content if desired also. This code doesn't do that) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.