qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
72,862,776 | I am trying to put together a diagram in CSS of a flow chart. I have attached below a picture. Is there a simple way to do this? I've been Googling around quite a bit looking for examples, but I don't know what to call this.
Can you please let me know how to do this? Or if this is something common, what I can Google t... | 2022/07/04 | [
"https://Stackoverflow.com/questions/72862776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7053813/"
] | By using [CSS Flex](https://developer.mozilla.org/en-US/docs/Web/CSS/flex) you could achieve something like:
```css
body {font: 16px/1.4 sans-serif;}
.chart-row,
.chart-col {
display: flex;
gap: 1em;
}
.chart-row {
flex-direction: row;
}
.chart-col {
flex-direction: column;
}
.chart-pill,
.chart-rect{
p... | I'll just add an answer because I can't write any comments yet, although I'm not new at CSS...
Yes, you can use Flexbox but I will also add CSS Grid, as the combination of both can give you more flexibility if you're planning on making bigger charts...
Once you get it working, it's pretty easy to use...
Copy and pas... |
41,318,581 | I'm using a random number generator and IF Statements to switch between activities. It iterates through the first if statement and stops there. I don't think my random number generator is generating any random numbers. Thanks in advance.
```
package app.com.example.android.oraclethedeciscionmaker;
import android.cont... | 2016/12/25 | [
"https://Stackoverflow.com/questions/41318581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6191311/"
] | The only thing I did was instead of using a path like
```
c:\xyz\desktop\practice
```
and starting http-server, I did the following:
step 1:
```
c:\
```
step 2:
```
http-server c:\xyz\desktop\practice
```
It started working. Thanks for everyone's help. | Instead of
```
127.0.0.1 8081
```
Use this:
```
http://127.0.0.1:8081/wamp/www/Angular_1/contactapp/
``` |
1,451,281 | I'm just starting, and yes, i haven't written any tests yet (I'm not a fundamentalist, I don't like compile errors just because there is no test), but I'm wondering where to get started on doing a project that parses fixed length flat file records according to an XML mapping, into a class that represents the superset o... | 2009/09/20 | [
"https://Stackoverflow.com/questions/1451281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | It's all about decomposing the problem into parts. Some examples:
* File/stream reader
* Input mapper
* Input mapper loader
* File layout
* File layout collection
* Data access layer
Try to give each class a single responsibility, determine its dependencies, and inject those in. That, with the help of mocks/stubs, wi... | Well, you want to do testing but you don't want to mock. I believe that it leaves you to write [integration tests](http://en.wikipedia.org/wiki/Integration_testing) or [acceptance tests](http://en.wikipedia.org/wiki/Acceptance_test). It means that you have to do a lot of setup in your tests that probably will make your... |
1,451,281 | I'm just starting, and yes, i haven't written any tests yet (I'm not a fundamentalist, I don't like compile errors just because there is no test), but I'm wondering where to get started on doing a project that parses fixed length flat file records according to an XML mapping, into a class that represents the superset o... | 2009/09/20 | [
"https://Stackoverflow.com/questions/1451281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Two techniques I've found useful for testing IO-based classes:
* Where possible, talk in general terms like `StreamReader` and `Stream` rather than filenames. It's easy to create a `StringReader` or a `MemoryStream` in tests and provide the data that way.
* Sometimes you need more data than you really want to embed in... | Well, you want to do testing but you don't want to mock. I believe that it leaves you to write [integration tests](http://en.wikipedia.org/wiki/Integration_testing) or [acceptance tests](http://en.wikipedia.org/wiki/Acceptance_test). It means that you have to do a lot of setup in your tests that probably will make your... |
1,451,281 | I'm just starting, and yes, i haven't written any tests yet (I'm not a fundamentalist, I don't like compile errors just because there is no test), but I'm wondering where to get started on doing a project that parses fixed length flat file records according to an XML mapping, into a class that represents the superset o... | 2009/09/20 | [
"https://Stackoverflow.com/questions/1451281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | It's all about decomposing the problem into parts. Some examples:
* File/stream reader
* Input mapper
* Input mapper loader
* File layout
* File layout collection
* Data access layer
Try to give each class a single responsibility, determine its dependencies, and inject those in. That, with the help of mocks/stubs, wi... | Two techniques I've found useful for testing IO-based classes:
* Where possible, talk in general terms like `StreamReader` and `Stream` rather than filenames. It's easy to create a `StringReader` or a `MemoryStream` in tests and provide the data that way.
* Sometimes you need more data than you really want to embed in... |
71,793,245 | Is there a standard algorithm in the library that does the job of the following for-loop?
```
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
int main( )
{
const char oldFillCharacter { '-' };
std::vector<char> vec( 10, oldFillCharacter ); // construct with 10 chars
// modif... | 2022/04/08 | [
"https://Stackoverflow.com/questions/71793245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13407802/"
] | This loop will replace every occurrence of `oldFillCharacter` with `newFillCharacter`. If you don't want to do something more fancy [`std::replace`](https://en.cppreference.com/w/cpp/algorithm/replace) looks good:
```
std::replace(std::begin(vec), std::end(vec), oldFillCharacter, newFillCharacter);
```
Or a bit simp... | You can use `std::for_each`.
```
std::for_each(vec.begin(), vec.end(), [](char& elem) {
if ( elem == oldFillCharacter ) elem = newFillCharacter;
});
``` |
71,793,245 | Is there a standard algorithm in the library that does the job of the following for-loop?
```
#include <iostream>
#include <vector>
#include <iterator>
#include <algorithm>
int main( )
{
const char oldFillCharacter { '-' };
std::vector<char> vec( 10, oldFillCharacter ); // construct with 10 chars
// modif... | 2022/04/08 | [
"https://Stackoverflow.com/questions/71793245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13407802/"
] | This loop will replace every occurrence of `oldFillCharacter` with `newFillCharacter`. If you don't want to do something more fancy [`std::replace`](https://en.cppreference.com/w/cpp/algorithm/replace) looks good:
```
std::replace(std::begin(vec), std::end(vec), oldFillCharacter, newFillCharacter);
```
Or a bit simp... | ```
std::replace(vec.begin(), vec.end(), '_', '#');
``` |
1,648,939 | i ran jconsole, i see some live threads count and daemon threads count .... i run no other java app/classes .... i could see the list of live threads but not daemon thread .... is there a way to know what is the list of deamon threads ? | 2009/10/30 | [
"https://Stackoverflow.com/questions/1648939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | You can create a thread dump (using the `jstack` tool), which will show for each thread whether it is a daemon or not.
Instead of using `jstack` on the command line, you can also trigger a thread dump using visualvm (<http://visualvm.dev.java.net>), and look at the threads over time. | The daemon are included in live threads.
Both in the counter and list.
I don't think jconsole has an option to show only daemon threads.
Must of the "built-in" if not all but the "main" thread are daemon threads. |
64,601,439 | I am new to HTML and CSS. I want to achieve rounded-corner for my table and it is not working. Any ideas how can I make it work?
Here is my CSS for table:
```
table {
border: 1px solid #CCC;
border-collapse: collapse;
font-size:13px;
color:white;
}
td {
border: none... | 2020/10/30 | [
"https://Stackoverflow.com/questions/64601439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11471461/"
] | You can make the rounded table using the `border-radius` CSS attribute based on `border-collapse: separate` as follows.
```css
table {
border: 1px solid #CCC;
font-size: 13px;
color: white;
background: red;
border-collapse: separate;
border-radius: 10px;
-moz-border-radius: 10px;
}
td {
border: none... | Use border radius on the table.
```
table {
border: 1px solid #CCC;
border-collapse: collapse;
border-radius: 20%;
font-size:13px;
color:white;
}
td {
border: none;
}
``` |
64,601,439 | I am new to HTML and CSS. I want to achieve rounded-corner for my table and it is not working. Any ideas how can I make it work?
Here is my CSS for table:
```
table {
border: 1px solid #CCC;
border-collapse: collapse;
font-size:13px;
color:white;
}
td {
border: none... | 2020/10/30 | [
"https://Stackoverflow.com/questions/64601439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11471461/"
] | You can make the rounded table using the `border-radius` CSS attribute based on `border-collapse: separate` as follows.
```css
table {
border: 1px solid #CCC;
font-size: 13px;
color: white;
background: red;
border-collapse: separate;
border-radius: 10px;
-moz-border-radius: 10px;
}
td {
border: none... | you need to give `border-radius` to make table border rounded so try this :
```
table {
border: 1px solid #CCC;
border-radius:50px;
border-collapse: collapse;
font-size:13px;
color:white;
}
td {
border: none;
}
``` |
16,875,356 | I am successfully detecting faces using JavaCV, it's not totally accurate but good enough for the moment.
However, for testing purposes and with a look at the future (this is only part of a bigger group project), I want to write rectangles onto the faces using BufferedImage and Graphics.drawRect().
I am aware of the ... | 2013/06/01 | [
"https://Stackoverflow.com/questions/16875356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1342579/"
] | Quoting from the [paperjs.org tutorial on rasters](http://paperjs.org/tutorials/images/working-with-rasters/):
>
> Images need to already be loaded when they are added to a Paper.js project. Working with local images or images hosted on other websites may throw security exceptions on certain browsers.
>
>
>
So yo... | First, If you want to work with JavaScript directly look at [this tutorial](http://paperjs.org/tutorials/getting-started/using-javascript-directly/).
Once you understand it, you would have something like this to load image in raster
```
paper.install(window);
window.onload = function() {
// Setup directly from ca... |
12,907,167 | >
> **Possible Duplicate:**
>
> [How can I pass command-line arguments in IronPython?](https://stackoverflow.com/questions/5949735/how-can-i-pass-command-line-arguments-in-ironpython)
>
>
>
I am new to ironpython and sharpdevelop and I am trying to run the following code,
```
from sys import argv
script, fir... | 2012/10/16 | [
"https://Stackoverflow.com/questions/12907167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/523960/"
] | In [SharpDevelop](http://www.icsharpcode.net/opensource/sd/) you
* *right-click* on the python *project*
* choose *Properties* in the context-menu
* choose the *Debug*-tab
* append your arguments in the *Command line arguments* field | Does [this article](https://stackoverflow.com/questions/5949735/how-can-i-pass-command-line-arguments-in-ironpython) help you at all?
>
> You need to set the values of sys.argv.
>
>
>
> ```
> engine.Sys.argv = List.Make(args);
>
> ```
>
> |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | To do web-based databases, the best practice\*\*\* is to use HTTP requests to a PHP script. That way you will not have to establish a database connection from the app, leaving Usernames and Passwords excluded from the actual project. Create some PHP scripts that will do what you need by sending POST and GET variables.
... | You need to build out API end points for all the actions that are possible.
E.g posts/view posts/edit posts/add
A popular and well documented architecture to use would be REST
<http://en.wikipedia.org/wiki/Representational_state_transfer>
If you are using a PHP framework there are often helper libraries for creati... |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | To do web-based databases, the best practice\*\*\* is to use HTTP requests to a PHP script. That way you will not have to establish a database connection from the app, leaving Usernames and Passwords excluded from the actual project. Create some PHP scripts that will do what you need by sending POST and GET variables.
... | I am a newbie to iphone development and have been working on Iphone for a month or so. Would like to give some tips on this:
1) First read up on Objective-C since you are making an Iphone app and how Xcode in general works
2) Next the connecting to the web API, you could use AFNetworking. Here is a [Tutorial](http://... |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | To do web-based databases, the best practice\*\*\* is to use HTTP requests to a PHP script. That way you will not have to establish a database connection from the app, leaving Usernames and Passwords excluded from the actual project. Create some PHP scripts that will do what you need by sending POST and GET variables.
... | Your app can connect to your service by issuing HTTP requests to URLs on your server. You can use whatever backend you like, I have personally used PHP with MySQL since virtually all hosting services will support these tools. You form queries by defining URLs that perform a function. Generally, you want to use POST req... |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | To do web-based databases, the best practice\*\*\* is to use HTTP requests to a PHP script. That way you will not have to establish a database connection from the app, leaving Usernames and Passwords excluded from the actual project. Create some PHP scripts that will do what you need by sending POST and GET variables.
... | You just setup a [RESTful webservice](http://www.slimframework.com/), then access to it on Obj-C via [Restkit](http://restkit.org/).
EDIT: btw if you haven't got fancy app needs, just [make your website responsive](http://en.wikipedia.org/wiki/Responsive_web_design) and you'l be done. |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | You need to build out API end points for all the actions that are possible.
E.g posts/view posts/edit posts/add
A popular and well documented architecture to use would be REST
<http://en.wikipedia.org/wiki/Representational_state_transfer>
If you are using a PHP framework there are often helper libraries for creati... | I am a newbie to iphone development and have been working on Iphone for a month or so. Would like to give some tips on this:
1) First read up on Objective-C since you are making an Iphone app and how Xcode in general works
2) Next the connecting to the web API, you could use AFNetworking. Here is a [Tutorial](http://... |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | You need to build out API end points for all the actions that are possible.
E.g posts/view posts/edit posts/add
A popular and well documented architecture to use would be REST
<http://en.wikipedia.org/wiki/Representational_state_transfer>
If you are using a PHP framework there are often helper libraries for creati... | Your app can connect to your service by issuing HTTP requests to URLs on your server. You can use whatever backend you like, I have personally used PHP with MySQL since virtually all hosting services will support these tools. You form queries by defining URLs that perform a function. Generally, you want to use POST req... |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | You just setup a [RESTful webservice](http://www.slimframework.com/), then access to it on Obj-C via [Restkit](http://restkit.org/).
EDIT: btw if you haven't got fancy app needs, just [make your website responsive](http://en.wikipedia.org/wiki/Responsive_web_design) and you'l be done. | I am a newbie to iphone development and have been working on Iphone for a month or so. Would like to give some tips on this:
1) First read up on Objective-C since you are making an Iphone app and how Xcode in general works
2) Next the connecting to the web API, you could use AFNetworking. Here is a [Tutorial](http://... |
13,728,084 | I have made a website (php) and it connects to a database so it can have users and post material. Imagine it like a forum. Now how would I go about making an iPhone app that connects to the same database. I am already teaching myself c++ to make the app, but am not sure how I will connect it to the database. | 2012/12/05 | [
"https://Stackoverflow.com/questions/13728084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1879764/"
] | You just setup a [RESTful webservice](http://www.slimframework.com/), then access to it on Obj-C via [Restkit](http://restkit.org/).
EDIT: btw if you haven't got fancy app needs, just [make your website responsive](http://en.wikipedia.org/wiki/Responsive_web_design) and you'l be done. | Your app can connect to your service by issuing HTTP requests to URLs on your server. You can use whatever backend you like, I have personally used PHP with MySQL since virtually all hosting services will support these tools. You form queries by defining URLs that perform a function. Generally, you want to use POST req... |
133,107 | How can I reduce the size of a `\psdiabox`, for instance:
```
\documentclass[10pt,a4paper,twoside]{scrbook}
\usepackage{pstricks}
\usepackage{pst-all}
\begin{document}
\psset{unit=0.35}
\begin{pspicture}(9.261250,-52.662503)(52.977702,-0.950000)
\begin{psmatrix}[rowsep=1cm,colsep=.5cm]
& \rput[tc](30.5,-19.5)... | 2013/09/13 | [
"https://tex.stackexchange.com/questions/133107",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/35541/"
] | Your best bet would be to convert the pdf to a series of images probably using [imagemagick](http://www.imagemagick.org/script/index.php)'s convert routine, then use [ffmpeg](http://www.ffmpeg.org/) to assemble them into a video. Both tools are free and cross-platform.
[Stack Overflow has more detail](https://stackove... | This is perhaps a bit of a "hacky" solution, but you could try using a screen recording application as you manually play back the PDF (at full screen) at your desired speed and timings. Quicktime X on Mac OS X is excellent, and there is a Linux program `simplescreenrecorder` which looks to do much the same thing.
Don'... |
2,333,897 | **EDIT** - Rewrote my original question to give a bit more information
---
**Background info**
At my work I'm working on a ASP.Net web application for our customers. In our implementation we use technologies like Forms authentication with MembershipProviders and RoleProviders. All went well until I ran into some d... | 2010/02/25 | [
"https://Stackoverflow.com/questions/2333897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/136819/"
] | What you are seeking from the various posts that I see, is a custom role mechanism or said another way, a custom Authorization mechanism. Authentication can still use the standard SqlMembershipProvider.
I'm not sure that the standard role provider will provide you with what you want as authorization requires that you... | Store a value in the profile potentially. Setup a profile entry in the config file and use that to store the value.
More realistically, you may want to store this outside of the ASP.NET tables for ease of use and for ease of accessing the value (maybe outside of the web environment if you need to)...
Not sure what al... |
2,333,897 | **EDIT** - Rewrote my original question to give a bit more information
---
**Background info**
At my work I'm working on a ASP.Net web application for our customers. In our implementation we use technologies like Forms authentication with MembershipProviders and RoleProviders. All went well until I ran into some d... | 2010/02/25 | [
"https://Stackoverflow.com/questions/2333897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/136819/"
] | This is exactly the kind of scenario that calls for a custom RoleProvider. You design the database schema to support your case (you might want to create a table called ProjectRole and a table called CompanyRole).
Here are a couple of things to get you started (with links to help at the bottom):
Add this section to yo... | Store a value in the profile potentially. Setup a profile entry in the config file and use that to store the value.
More realistically, you may want to store this outside of the ASP.NET tables for ease of use and for ease of accessing the value (maybe outside of the web environment if you need to)...
Not sure what al... |
2,333,897 | **EDIT** - Rewrote my original question to give a bit more information
---
**Background info**
At my work I'm working on a ASP.Net web application for our customers. In our implementation we use technologies like Forms authentication with MembershipProviders and RoleProviders. All went well until I ran into some d... | 2010/02/25 | [
"https://Stackoverflow.com/questions/2333897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/136819/"
] | DISCLAIMER: Pursuant to the exchange in comments, in which I make a complete asshat of myself, an *almost out of the box* solution has been arrived at and this answer has been purged of all asshattery and now contains only a *tested* scenario that may or may not address the OP problem. ;-)
Kudos to Thomas for keeping... | Store a value in the profile potentially. Setup a profile entry in the config file and use that to store the value.
More realistically, you may want to store this outside of the ASP.NET tables for ease of use and for ease of accessing the value (maybe outside of the web environment if you need to)...
Not sure what al... |
2,333,897 | **EDIT** - Rewrote my original question to give a bit more information
---
**Background info**
At my work I'm working on a ASP.Net web application for our customers. In our implementation we use technologies like Forms authentication with MembershipProviders and RoleProviders. All went well until I ran into some d... | 2010/02/25 | [
"https://Stackoverflow.com/questions/2333897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/136819/"
] | What you are seeking from the various posts that I see, is a custom role mechanism or said another way, a custom Authorization mechanism. Authentication can still use the standard SqlMembershipProvider.
I'm not sure that the standard role provider will provide you with what you want as authorization requires that you... | This is exactly the kind of scenario that calls for a custom RoleProvider. You design the database schema to support your case (you might want to create a table called ProjectRole and a table called CompanyRole).
Here are a couple of things to get you started (with links to help at the bottom):
Add this section to yo... |
2,333,897 | **EDIT** - Rewrote my original question to give a bit more information
---
**Background info**
At my work I'm working on a ASP.Net web application for our customers. In our implementation we use technologies like Forms authentication with MembershipProviders and RoleProviders. All went well until I ran into some d... | 2010/02/25 | [
"https://Stackoverflow.com/questions/2333897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/136819/"
] | What you are seeking from the various posts that I see, is a custom role mechanism or said another way, a custom Authorization mechanism. Authentication can still use the standard SqlMembershipProvider.
I'm not sure that the standard role provider will provide you with what you want as authorization requires that you... | DISCLAIMER: Pursuant to the exchange in comments, in which I make a complete asshat of myself, an *almost out of the box* solution has been arrived at and this answer has been purged of all asshattery and now contains only a *tested* scenario that may or may not address the OP problem. ;-)
Kudos to Thomas for keeping... |
57,972,255 | I'm convinced someone else must have had this same issue before but I just can't find anything.
Given a table of data:
```
DECLARE @Table TABLE
(
[COL_NAME] nvarchar(30) NOT NULL,
[COL_AGE] int NOT NULL
);
INSERT INTO @Table
SELECT N'Column 1', 4 UNION ALL
SELECT N'Col2', 2 UNION ALL
SELECT N'Col 3', 56 UNIO... | 2019/09/17 | [
"https://Stackoverflow.com/questions/57972255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1538480/"
] | I just used a quick CROSS APPLY to get the length of the buffer you want to use:
```
select
N'''' + LEFT(
[COL_NAME] + SPACE( t2.MLEN )
, t2.MLEN
) + N''''
from @Table
CROSS APPLY ( SELECT MAX(LEN([COL_NAME])) MLEN FROM @Table ) t2
``` | I don't really get, what you are trying to achieve, but I think, this might be what you need:
```
DECLARE @Table TABLE
(
[COL_NAME] nvarchar(30) NOT NULL
);
INSERT INTO @Table
SELECT N'Column 1' UNION ALL
SELECT N'Col2' UNION ALL
SELECT N'Col 3' UNION ALL
SELECT N'Column Four' UNION ALL
SELECT N'Column Number 5' ... |
27,188,342 | I have a random crash in UIKit that happend a couple of times already.
It crashes with `EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000d`
```
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x30e08f46 objc_msgSend + 5
1 UIKit 0x26d1790d -[_UIWebViewScrollViewDeleg... | 2014/11/28 | [
"https://Stackoverflow.com/questions/27188342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4206060/"
] | I think that
```
height: auto;
```
in you CSS declaration could do what you want.
Updated fiddle: <http://jsfiddle.net/3122mts4/4/> | If you don't give height property then it will take height automatically. When you give height to any img tag then image also get distorted so never give fix height to images except some rare condition. Just give width property.
```css
img{
width: 19%;
margin: 0.5%;
background-color:black;
}
```
```h... |
27,188,342 | I have a random crash in UIKit that happend a couple of times already.
It crashes with `EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000d`
```
Thread : Crashed: com.apple.main-thread
0 libobjc.A.dylib 0x30e08f46 objc_msgSend + 5
1 UIKit 0x26d1790d -[_UIWebViewScrollViewDeleg... | 2014/11/28 | [
"https://Stackoverflow.com/questions/27188342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4206060/"
] | I think that
```
height: auto;
```
in you CSS declaration could do what you want.
Updated fiddle: <http://jsfiddle.net/3122mts4/4/> | If you want to save `height`, change `img` to `div` blocks with `background-image`
**HTML**
```
<div style="background-image: url('http://doc.jsfiddle.net/_downloads/jsfiddle-logo-white.svg');"></div>
<div style="background-image: url('http://doc.jsfiddle.net/_downloads/jsfiddle-logo-white.svg');"></div>
<div style=... |
12,992,432 | thanks for looking at my question.
Basically what I'm trying to do is find all images that look like the first and the third image here: <http://imgur.com/a/IhHEC>
and remove all the ones that don't look like that (2,4).
I've tried several libraries to no avail.
Another acceptable way to do this is to check if the... | 2012/10/20 | [
"https://Stackoverflow.com/questions/12992432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/679184/"
] | If those are the actual images you're going to use, it looks like histogram similarity will do the job. The first and third are very contrasty, the second and fourth, especially the fourth, have a wide range of different intensities.
You could easily make a histogram of the shades of grey in the image and then apply ... | Due to my background in working more with text from images than image objects, I would do this in post-OCR process, by searching the text content for 'keywords' or checking for 'regular expression' representing your desired data. This means that the entire job needs to be separated into two stages: image-to-text OCR (f... |
1,952,126 | How do I prove that
$\displaystyle{\sum\_{i=1}^{\infty}{\frac{2^n(n!)^2}{(2n)!}}=1+\frac{\pi}{2}}$ | 2016/10/03 | [
"https://math.stackexchange.com/questions/1952126",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | Challenging question. You may notice that $\frac{n!^2}{(2n)!}=\binom{2n}{n}^{-1}$, then prove that by integration by parts and induction we have
$$ \int\_{0}^{\pi/2}\sin(x)^{2n-1}\,dx = \frac{4^n}{2n\binom{2n}{n}} \tag{1}$$
It follows that
$$ S=\sum\_{n\geq 1}2^n\binom{2n}{n}^{-1} = \int\_{0}^{\pi/2}\sum\_{n\geq 1}\fr... | We have that
$$\sum\_{n=1}^{\infty}\frac{2^n(n!)^2}{(2n)!}=\sum\_{n=1}^{\infty}\frac{4^n (1/2)^n}{\binom{2n}{n}}=\sum\_{n=0}^{\infty}\frac{4^n (1/2)^n}{\binom{2n}{n}}-1\\=Z(1/2)-1=\left(2\cdot\frac{\pi}{4}+2\right)-1=\frac{\pi}{2}+1$$
where we used the fact that for $|t|<1$,
$$Z(t)=\sum\_{n=0}^{\infty}\frac{4^n t^n}{\b... |
1,952,126 | How do I prove that
$\displaystyle{\sum\_{i=1}^{\infty}{\frac{2^n(n!)^2}{(2n)!}}=1+\frac{\pi}{2}}$ | 2016/10/03 | [
"https://math.stackexchange.com/questions/1952126",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | One way to deal with this is notice the factor in the summand is proportional
to a [Beta function](https://en.wikipedia.org/wiki/Beta_function).
$$\frac{n!^2}{(2n)!} = \frac{n}{2}\frac{\Gamma(n)\Gamma(n)}{\Gamma(2n)}
= \frac{n}{2}\int\_0^1 t^{n-1}(1-t)^{n-1} dt$$
This leads to
$$\sum\_{n=1}^\infty \frac{2^n n!^2}{(2n... | We have that
$$\sum\_{n=1}^{\infty}\frac{2^n(n!)^2}{(2n)!}=\sum\_{n=1}^{\infty}\frac{4^n (1/2)^n}{\binom{2n}{n}}=\sum\_{n=0}^{\infty}\frac{4^n (1/2)^n}{\binom{2n}{n}}-1\\=Z(1/2)-1=\left(2\cdot\frac{\pi}{4}+2\right)-1=\frac{\pi}{2}+1$$
where we used the fact that for $|t|<1$,
$$Z(t)=\sum\_{n=0}^{\infty}\frac{4^n t^n}{\b... |
1,952,126 | How do I prove that
$\displaystyle{\sum\_{i=1}^{\infty}{\frac{2^n(n!)^2}{(2n)!}}=1+\frac{\pi}{2}}$ | 2016/10/03 | [
"https://math.stackexchange.com/questions/1952126",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/166193/"
] | Challenging question. You may notice that $\frac{n!^2}{(2n)!}=\binom{2n}{n}^{-1}$, then prove that by integration by parts and induction we have
$$ \int\_{0}^{\pi/2}\sin(x)^{2n-1}\,dx = \frac{4^n}{2n\binom{2n}{n}} \tag{1}$$
It follows that
$$ S=\sum\_{n\geq 1}2^n\binom{2n}{n}^{-1} = \int\_{0}^{\pi/2}\sum\_{n\geq 1}\fr... | One way to deal with this is notice the factor in the summand is proportional
to a [Beta function](https://en.wikipedia.org/wiki/Beta_function).
$$\frac{n!^2}{(2n)!} = \frac{n}{2}\frac{\Gamma(n)\Gamma(n)}{\Gamma(2n)}
= \frac{n}{2}\int\_0^1 t^{n-1}(1-t)^{n-1} dt$$
This leads to
$$\sum\_{n=1}^\infty \frac{2^n n!^2}{(2n... |
5,841,740 | I am trying to do some **method inspection** (in Squeak - Smalltalk).
I wanted to ask what is the way **to check if a method is an abstract method**?
Meaning I want to write,
A method which gets a **class** and a **symbol** and will check if there is such a symbol in
the list of methods in an object which is of this c... | 2011/04/30 | [
"https://Stackoverflow.com/questions/5841740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/550413/"
] | A method is abstract (in the sense Java or C++ people mean) if it looks like this:
```
myMethod
self subclassResponsibility.
```
So all you need to do to answer "is `MyObject>>#myMethod` abstract?" is to answer "is `MyObject>>#myMethod` a sender of `#subclassResponsibility`?"
You can answer *that* question by add... | You can use
>
> (aClass>>aMethod) isAbstract
>
>
>
but it only works if aClass actually contains the method aMethod, and does not work for superclasses.
So you'll have to check it recursively, similarly to how canUnderstand: works. |
5,841,740 | I am trying to do some **method inspection** (in Squeak - Smalltalk).
I wanted to ask what is the way **to check if a method is an abstract method**?
Meaning I want to write,
A method which gets a **class** and a **symbol** and will check if there is such a symbol in
the list of methods in an object which is of this c... | 2011/04/30 | [
"https://Stackoverflow.com/questions/5841740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/550413/"
] | A method is abstract (in the sense Java or C++ people mean) if it looks like this:
```
myMethod
self subclassResponsibility.
```
So all you need to do to answer "is `MyObject>>#myMethod` abstract?" is to answer "is `MyObject>>#myMethod` a sender of `#subclassResponsibility`?"
You can answer *that* question by add... | While I don't know what your ultimate goal is, the Pharo code critics will identify methods where subclass responsibility is not defined. This may already be what you want to do. On the other hand, it's also worth checking out how that test is implemented to see whether you can use some or all of the existing code. |
5,841,740 | I am trying to do some **method inspection** (in Squeak - Smalltalk).
I wanted to ask what is the way **to check if a method is an abstract method**?
Meaning I want to write,
A method which gets a **class** and a **symbol** and will check if there is such a symbol in
the list of methods in an object which is of this c... | 2011/04/30 | [
"https://Stackoverflow.com/questions/5841740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/550413/"
] | You can use
>
> (aClass>>aMethod) isAbstract
>
>
>
but it only works if aClass actually contains the method aMethod, and does not work for superclasses.
So you'll have to check it recursively, similarly to how canUnderstand: works. | While I don't know what your ultimate goal is, the Pharo code critics will identify methods where subclass responsibility is not defined. This may already be what you want to do. On the other hand, it's also worth checking out how that test is implemented to see whether you can use some or all of the existing code. |
1,089,644 | I've just upgraded from Outlook 2013. When I opened my To-Do List view, all flagged emails were displayed in a narrow list on the left hand side. The currently selected email were opened in a reading pane on the right hand side.
Now, after the upgrade to Outlook 2016, the previously narrow list view takes up the whole... | 2016/06/15 | [
"https://superuser.com/questions/1089644",
"https://superuser.com",
"https://superuser.com/users/389544/"
] | Couple suggestions:
1) Ensure the Reading Pane is enabled for the Tasks/To-Do view. Check *View* tab -> *Reading Pane* -> Ensure it's set to something other than "*Off*".
2) Try *View* tab -> *Reset View* while looking a the Tasks/To-Do list. | on windows 10 go to:
"View"
"To-Do Bar"
select "tasks"
you will now be able to see your flagged emails on the right of your screen. |
1,089,644 | I've just upgraded from Outlook 2013. When I opened my To-Do List view, all flagged emails were displayed in a narrow list on the left hand side. The currently selected email were opened in a reading pane on the right hand side.
Now, after the upgrade to Outlook 2016, the previously narrow list view takes up the whole... | 2016/06/15 | [
"https://superuser.com/questions/1089644",
"https://superuser.com",
"https://superuser.com/users/389544/"
] | Couple suggestions:
1) Ensure the Reading Pane is enabled for the Tasks/To-Do view. Check *View* tab -> *Reading Pane* -> Ensure it's set to something other than "*Off*".
2) Try *View* tab -> *Reset View* while looking a the Tasks/To-Do list. | If you are using Outlook Office 365, you can just click the Filter button up and to the right of your email list. Then choose Flagged. It shows all your Flagged emails. Other options to Filter are: Unread, To me, Flagged, Mentions, Attachments and Sort. |
1,089,644 | I've just upgraded from Outlook 2013. When I opened my To-Do List view, all flagged emails were displayed in a narrow list on the left hand side. The currently selected email were opened in a reading pane on the right hand side.
Now, after the upgrade to Outlook 2016, the previously narrow list view takes up the whole... | 2016/06/15 | [
"https://superuser.com/questions/1089644",
"https://superuser.com",
"https://superuser.com/users/389544/"
] | Couple suggestions:
1) Ensure the Reading Pane is enabled for the Tasks/To-Do view. Check *View* tab -> *Reading Pane* -> Ensure it's set to something other than "*Off*".
2) Try *View* tab -> *Reset View* while looking a the Tasks/To-Do list. | Click View- Click Arrange BY. go down to view settings. click sort by. change the first to flag status, and the second sort to by received decending. Flagged emails will now be at the top |
1,089,644 | I've just upgraded from Outlook 2013. When I opened my To-Do List view, all flagged emails were displayed in a narrow list on the left hand side. The currently selected email were opened in a reading pane on the right hand side.
Now, after the upgrade to Outlook 2016, the previously narrow list view takes up the whole... | 2016/06/15 | [
"https://superuser.com/questions/1089644",
"https://superuser.com",
"https://superuser.com/users/389544/"
] | on windows 10 go to:
"View"
"To-Do Bar"
select "tasks"
you will now be able to see your flagged emails on the right of your screen. | If you are using Outlook Office 365, you can just click the Filter button up and to the right of your email list. Then choose Flagged. It shows all your Flagged emails. Other options to Filter are: Unread, To me, Flagged, Mentions, Attachments and Sort. |
1,089,644 | I've just upgraded from Outlook 2013. When I opened my To-Do List view, all flagged emails were displayed in a narrow list on the left hand side. The currently selected email were opened in a reading pane on the right hand side.
Now, after the upgrade to Outlook 2016, the previously narrow list view takes up the whole... | 2016/06/15 | [
"https://superuser.com/questions/1089644",
"https://superuser.com",
"https://superuser.com/users/389544/"
] | on windows 10 go to:
"View"
"To-Do Bar"
select "tasks"
you will now be able to see your flagged emails on the right of your screen. | Click View- Click Arrange BY. go down to view settings. click sort by. change the first to flag status, and the second sort to by received decending. Flagged emails will now be at the top |
1,089,644 | I've just upgraded from Outlook 2013. When I opened my To-Do List view, all flagged emails were displayed in a narrow list on the left hand side. The currently selected email were opened in a reading pane on the right hand side.
Now, after the upgrade to Outlook 2016, the previously narrow list view takes up the whole... | 2016/06/15 | [
"https://superuser.com/questions/1089644",
"https://superuser.com",
"https://superuser.com/users/389544/"
] | If you are using Outlook Office 365, you can just click the Filter button up and to the right of your email list. Then choose Flagged. It shows all your Flagged emails. Other options to Filter are: Unread, To me, Flagged, Mentions, Attachments and Sort. | Click View- Click Arrange BY. go down to view settings. click sort by. change the first to flag status, and the second sort to by received decending. Flagged emails will now be at the top |
44,881,991 | Currently I'm coding a project which has a BunifuProgressBar, but I'm having trouble coding it. Basically it says: `'Increment' is not a member of 'BunifuProgressBar'`, any ideas how to fix that issue (Please put the code in the comment section, which will make it so I don't get that error and the prog bar will work.)
... | 2017/07/03 | [
"https://Stackoverflow.com/questions/44881991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7898892/"
] | `BunifuProgressBar` does not have a `Increment` method,see the [reference page](https://devtools.bunifu.co.ke/bunifu-ui-winforms-docs/). What it does have is a `Value` property, so what you probably need to do is just:
```
BunifuProgressBar1.Value+=1
``` | According to [Here](https://devtools.bunifu.co.ke/bunifu-ui-winforms-docs/), It only has
>
> Value – the progress value
>
> MaximumValue – the maximum allowed progress
>
> value ProgressColor – the color of the progress bar
>
> BorderRadius – the roundness of the corners
>
>
>
You probably want to ... |
44,881,991 | Currently I'm coding a project which has a BunifuProgressBar, but I'm having trouble coding it. Basically it says: `'Increment' is not a member of 'BunifuProgressBar'`, any ideas how to fix that issue (Please put the code in the comment section, which will make it so I don't get that error and the prog bar will work.)
... | 2017/07/03 | [
"https://Stackoverflow.com/questions/44881991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7898892/"
] | `BunifuProgressBar` does not have a `Increment` method,see the [reference page](https://devtools.bunifu.co.ke/bunifu-ui-winforms-docs/). What it does have is a `Value` property, so what you probably need to do is just:
```
BunifuProgressBar1.Value+=1
``` | ```
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
BunifuProgressBar1.Value+=1
If BunifuProgressBar1.Value = BunifuProgressBar1.Maxium Then
```
End Sub |
44,881,991 | Currently I'm coding a project which has a BunifuProgressBar, but I'm having trouble coding it. Basically it says: `'Increment' is not a member of 'BunifuProgressBar'`, any ideas how to fix that issue (Please put the code in the comment section, which will make it so I don't get that error and the prog bar will work.)
... | 2017/07/03 | [
"https://Stackoverflow.com/questions/44881991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7898892/"
] | According to [Here](https://devtools.bunifu.co.ke/bunifu-ui-winforms-docs/), It only has
>
> Value – the progress value
>
> MaximumValue – the maximum allowed progress
>
> value ProgressColor – the color of the progress bar
>
> BorderRadius – the roundness of the corners
>
>
>
You probably want to ... | ```
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
BunifuProgressBar1.Value+=1
If BunifuProgressBar1.Value = BunifuProgressBar1.Maxium Then
```
End Sub |
6,301,506 | I need a working script for prohibiting users from saving images on their machine. (Is it only possible through disabling right-click?)
Yes, I know that it is impossible, and yes I know that it is a bad practice.
Yes, I also know that I am an idiot. But I need this solution for some specific purposes.
Thanks! | 2011/06/10 | [
"https://Stackoverflow.com/questions/6301506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194076/"
] | the only real way to do it is probably to encrypt the images in a flash file or something, but no matter how much time you spend jumping through hoops the user can still just press printscreen. there is no reason to even try doing this. | <http://javascript.about.com/library/blnoright.htm>
```
<body oncontextmenu="return false;">
```
Or...
```
document.body.oncontextmenu = function(){
return false;
}
```
<http://jsfiddle.net/EEMsm/> |
6,301,506 | I need a working script for prohibiting users from saving images on their machine. (Is it only possible through disabling right-click?)
Yes, I know that it is impossible, and yes I know that it is a bad practice.
Yes, I also know that I am an idiot. But I need this solution for some specific purposes.
Thanks! | 2011/06/10 | [
"https://Stackoverflow.com/questions/6301506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194076/"
] | You could try to replace all the `<img>` elements with `<div>` elements that have the same size and use the image as a background:
```
$('img').each(function() {
var $img = $(this);
var $div = $('<div>').css({
width: $img.width(),
height: $img.height(),
backgroundImag... | <http://javascript.about.com/library/blnoright.htm>
```
<body oncontextmenu="return false;">
```
Or...
```
document.body.oncontextmenu = function(){
return false;
}
```
<http://jsfiddle.net/EEMsm/> |
6,301,506 | I need a working script for prohibiting users from saving images on their machine. (Is it only possible through disabling right-click?)
Yes, I know that it is impossible, and yes I know that it is a bad practice.
Yes, I also know that I am an idiot. But I need this solution for some specific purposes.
Thanks! | 2011/06/10 | [
"https://Stackoverflow.com/questions/6301506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194076/"
] | You could try to replace all the `<img>` elements with `<div>` elements that have the same size and use the image as a background:
```
$('img').each(function() {
var $img = $(this);
var $div = $('<div>').css({
width: $img.width(),
height: $img.height(),
backgroundImag... | the only real way to do it is probably to encrypt the images in a flash file or something, but no matter how much time you spend jumping through hoops the user can still just press printscreen. there is no reason to even try doing this. |
6,301,506 | I need a working script for prohibiting users from saving images on their machine. (Is it only possible through disabling right-click?)
Yes, I know that it is impossible, and yes I know that it is a bad practice.
Yes, I also know that I am an idiot. But I need this solution for some specific purposes.
Thanks! | 2011/06/10 | [
"https://Stackoverflow.com/questions/6301506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194076/"
] | the only real way to do it is probably to encrypt the images in a flash file or something, but no matter how much time you spend jumping through hoops the user can still just press printscreen. there is no reason to even try doing this. | One non-js way to make it harder for people is to absolutely position and size a clear png/gif on top of anything you want to make hard to download with a right click. When they try to save the image, they'll just get the clear one.
EDIT
I just saw this question which is related
[How does Flickr prevent people from ... |
6,301,506 | I need a working script for prohibiting users from saving images on their machine. (Is it only possible through disabling right-click?)
Yes, I know that it is impossible, and yes I know that it is a bad practice.
Yes, I also know that I am an idiot. But I need this solution for some specific purposes.
Thanks! | 2011/06/10 | [
"https://Stackoverflow.com/questions/6301506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194076/"
] | You could try to replace all the `<img>` elements with `<div>` elements that have the same size and use the image as a background:
```
$('img').each(function() {
var $img = $(this);
var $div = $('<div>').css({
width: $img.width(),
height: $img.height(),
backgroundImag... | One non-js way to make it harder for people is to absolutely position and size a clear png/gif on top of anything you want to make hard to download with a right click. When they try to save the image, they'll just get the clear one.
EDIT
I just saw this question which is related
[How does Flickr prevent people from ... |
65,224,241 | It is my first time using PHP. I am using XAMPP on a mac.
MySQL, Apache, and localhost:8080 are all working right now.
I created this file called test.php and saved it inside lampp/htdocs:
```
<!DOCTYPE html>
<html lang="en">
<head>
<title>Connection</title>
</head>
<body>
<?php
$servername = "localhost:8080";
... | 2020/12/09 | [
"https://Stackoverflow.com/questions/65224241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14545805/"
] | Okay, partially my bad.
I did re-compile the **EMPTY** sample project and found that despite the compiler error, the solution does build.
```
1>------ Rebuild All started: Project: Microdesk.BIMrxCommon.Infrastructure, Configuration: Debug2020 Any CPU ------
1> Microdesk.BIMrxCommon.Infrastructure -> C:\Work\Microdes... | When I test your issue in your side, I did not face the same behaviors as you described. So I guess that there is some issues on your current vs environment due to the update. And maybe the update broke some tools of VS.
[](https://i.stack.imgur.com/o... |
15,343,487 | I have a css conflict, so I have to go against an absolute positioning property that deals with some class `.myclass`. But in one case, I want a div with `.myclass` class to have a no absolute positioning. So I put `position: initial`, which works in Chrome, but is it cross-browser? I googled it and found nothing reall... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15343487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275959/"
] | The default for position is `position: static;` | The [`initial`](http://www.w3.org/TR/css3-cascade/#initial) keyword was introduced in 2011 in the [Cascading and Inheritance Module](http://www.w3.org/TR/css3-cascade/) -- it's supported in FF 19+, Chrome, Safari, Opera 15+ but is currently [not supported](http://msdn.microsoft.com/en-us/library/hh781508(v=vs.85).aspx#... |
15,343,487 | I have a css conflict, so I have to go against an absolute positioning property that deals with some class `.myclass`. But in one case, I want a div with `.myclass` class to have a no absolute positioning. So I put `position: initial`, which works in Chrome, but is it cross-browser? I googled it and found nothing reall... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15343487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275959/"
] | The default for position is `position: static;` | Even IE 11 gives me the 'squiggles' for this one. Changing to `static` gave me the desired behavior.

Chrome actually suggests it as an acceptable property in its dropdown
 |
15,343,487 | I have a css conflict, so I have to go against an absolute positioning property that deals with some class `.myclass`. But in one case, I want a div with `.myclass` class to have a no absolute positioning. So I put `position: initial`, which works in Chrome, but is it cross-browser? I googled it and found nothing reall... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15343487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275959/"
] | The default for position is `position: static;` | I was having the same issue as `position: unset;` wasn't working for me in IE. I changed `position: static;` and it worked as expected as IE doesn't have unset behavior. |
15,343,487 | I have a css conflict, so I have to go against an absolute positioning property that deals with some class `.myclass`. But in one case, I want a div with `.myclass` class to have a no absolute positioning. So I put `position: initial`, which works in Chrome, but is it cross-browser? I googled it and found nothing reall... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15343487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275959/"
] | The [`initial`](http://www.w3.org/TR/css3-cascade/#initial) keyword was introduced in 2011 in the [Cascading and Inheritance Module](http://www.w3.org/TR/css3-cascade/) -- it's supported in FF 19+, Chrome, Safari, Opera 15+ but is currently [not supported](http://msdn.microsoft.com/en-us/library/hh781508(v=vs.85).aspx#... | Even IE 11 gives me the 'squiggles' for this one. Changing to `static` gave me the desired behavior.

Chrome actually suggests it as an acceptable property in its dropdown
 |
15,343,487 | I have a css conflict, so I have to go against an absolute positioning property that deals with some class `.myclass`. But in one case, I want a div with `.myclass` class to have a no absolute positioning. So I put `position: initial`, which works in Chrome, but is it cross-browser? I googled it and found nothing reall... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15343487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275959/"
] | The [`initial`](http://www.w3.org/TR/css3-cascade/#initial) keyword was introduced in 2011 in the [Cascading and Inheritance Module](http://www.w3.org/TR/css3-cascade/) -- it's supported in FF 19+, Chrome, Safari, Opera 15+ but is currently [not supported](http://msdn.microsoft.com/en-us/library/hh781508(v=vs.85).aspx#... | I was having the same issue as `position: unset;` wasn't working for me in IE. I changed `position: static;` and it worked as expected as IE doesn't have unset behavior. |
15,343,487 | I have a css conflict, so I have to go against an absolute positioning property that deals with some class `.myclass`. But in one case, I want a div with `.myclass` class to have a no absolute positioning. So I put `position: initial`, which works in Chrome, but is it cross-browser? I googled it and found nothing reall... | 2013/03/11 | [
"https://Stackoverflow.com/questions/15343487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1275959/"
] | Even IE 11 gives me the 'squiggles' for this one. Changing to `static` gave me the desired behavior.

Chrome actually suggests it as an acceptable property in its dropdown
 | I was having the same issue as `position: unset;` wasn't working for me in IE. I changed `position: static;` and it worked as expected as IE doesn't have unset behavior. |
39,583,980 | I am making a listing system that updates checking new data from a json file every **3 seconds** by appending the **response.list[i].firstname** to document.getElementById("list"). but i am getting unlimited loop.
**output:**
name1
name2
name1
name2
name1
name2
(to infinity..)
```
<script>
list()... | 2016/09/20 | [
"https://Stackoverflow.com/questions/39583980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6246854/"
] | This is happening because every 3 seconds you read JSON file and append it to the already rendered (with all the data appended in previous runs) list with
```
document.getElementById("list").appendChild(newElement);
```
If you want to show only the content of the file once, then you should clean the target list div... | I have shared how to get length of JSON response.
```
var obj = JSON.parse(response);
var limit=Object.keys(obj).length;
for( var i = 0; i < limit; i++ ) {
}
```
I am not sure about response.**list\_count** you are using. Is that a finite number? |
36,572,968 | I'm trying to write a program to return the amount of rows and columns in a csv file. Below is the code I currently have:
```
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
string line;
ifstream myfile("ETF_Corrsv2.csv");
if (myfile.is_open(... | 2016/04/12 | [
"https://Stackoverflow.com/questions/36572968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4845418/"
] | In fact you can reference the corresponding `ElementRef` using `@ViewChild`. Something like that:
```
@Component({
(...)
template: `
<div #someId>(...)</div>
`
})
export class Render {
@ViewChild('someId')
elt:ElementRef;
ngAfterViewInit() {
let domElement = this.elt.nativeElement;
}
}
```
`el... | For HTML elements added statically to your components template you can use [`@ViewChild()`](https://angular.io/docs/ts/latest/api/core/ViewChild-var.html):
```
@Component({
...
template: `<div><span #item></span></div>`
})
export class SirRender {
@ViewChild('item') item;
ngAfterViewInit() {
passElement(th... |
73,787 | 1. I couldn't afford that **big a** car.
2. It was so **warm a** day that I could hardly work.
The sentences stated above have been taken from *Practical English Usage* by Michael Swan. If I write-
3. I couldn't afford that big car.
4. It was so warm day that I could hardly work.
These make sense. But placement of a... | 2015/11/20 | [
"https://ell.stackexchange.com/questions/73787",
"https://ell.stackexchange.com",
"https://ell.stackexchange.com/users/-1/"
] | **Short answer**
----------------
If an adjective is being modified by a deictic degree adverb such as *so, too, as, this* or *that* then the adjective and adverb must go before, not after, the indefinite article. They can also appear as a postmodifier after the noun:
* a day so warm
**Full answer**
---------------
... | Regarding example (1), I think the emphasis of "that big a car" considerably differs from "that big car." "That big a car" could be rephrased as a "a car as big as that," which shows that you are comparing the car in question to some standard of a car that you have in your mind. "That big car" on the other hand seems t... |
73,286,085 | I want to create a simple plotly chart from a .csv file that I fetched from an API.
I import the library, pass the dataframe, and get the error:
```none
TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class
```
code:
```
import plotly.express as px
df=pd.read_csv('file.csv')
```
Wh... | 2022/08/09 | [
"https://Stackoverflow.com/questions/73286085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15299852/"
] | I got the same error, it is dependency issue, plotly.express (5.9.0) is not working with numpy==1.20, if you upgrade numpy==1.21.6 it will solve your error.
```
pip install numpy==1.21.6
``` | ```
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4960/3694415272.py in <module>
----> 1 plotly.express.__version__
~\anaconda3\lib\site-packages\_plotly_utils\importers.py in __geta... |
73,286,085 | I want to create a simple plotly chart from a .csv file that I fetched from an API.
I import the library, pass the dataframe, and get the error:
```none
TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class
```
code:
```
import plotly.express as px
df=pd.read_csv('file.csv')
```
Wh... | 2022/08/09 | [
"https://Stackoverflow.com/questions/73286085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15299852/"
] | I got the same error, it is dependency issue, plotly.express (5.9.0) is not working with numpy==1.20, if you upgrade numpy==1.21.6 it will solve your error.
```
pip install numpy==1.21.6
``` | I was having same issue when I updated xarray. I tried updating numpy but conda environment was restricting it. Updating the whole conda environment helped me resolve this error.
```
conda update --all
``` |
73,286,085 | I want to create a simple plotly chart from a .csv file that I fetched from an API.
I import the library, pass the dataframe, and get the error:
```none
TypeError: <class 'numpy.typing._dtype_like._SupportsDType'> is not a generic class
```
code:
```
import plotly.express as px
df=pd.read_csv('file.csv')
```
Wh... | 2022/08/09 | [
"https://Stackoverflow.com/questions/73286085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15299852/"
] | I was having same issue when I updated xarray. I tried updating numpy but conda environment was restricting it. Updating the whole conda environment helped me resolve this error.
```
conda update --all
``` | ```
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4960/3694415272.py in <module>
----> 1 plotly.express.__version__
~\anaconda3\lib\site-packages\_plotly_utils\importers.py in __geta... |
41,354,972 | my MYSQL table is as below:
```
id record_nr timestamp
1 931 2014-02-15 6:21:00
2 577 2013-05-03 0:19:00
3 323 2012-08-07 11:26:00
```
in PHP I tried to retrieve a record by comparing time as below:
```
$dateTimeString = "2013-07-28 7:23:34";
$query = "SELECT * FROM mytable... | 2016/12/28 | [
"https://Stackoverflow.com/questions/41354972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109581/"
] | You are sending an ajax request to update the record. So, you should not try to `render` a view or `redirect` user as the response of this request. Instead, you can send back a JSON object with some properties e.g. "status".
Then on client side, you check the returned JSON response and based on "status" parameter ( or... | Your db query says
```
db.none('update cands set name=$1, email=$2 where id=$8', [req.body.name, req.body.email]) ...
```
Shouldn't it be
```
db.none('update cands set name=$1, email=$2 where id=$8', [req.body.name, req.body.email, candID])
``` |
27,025,827 | In this code with pyshark
```
import pyshark
cap = pyshark.FileCapture(filename)
i = 0
for idx, packet in enumerate(cap):
i += 1
print i
print len(cap._packets)
```
`i` and `len(cap._packets)` give two different results. Why is that? | 2014/11/19 | [
"https://Stackoverflow.com/questions/27025827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464277/"
] | Don't know if it works in Python 2.7, but in Python 3.4 `len(cap)` returns 0.
The FileCapture object is a generator, so what worked for me is `len([packet for packet in cap])` | A look at the [source code](https://github.com/KimiNewt/pyshark/blob/master/src/pyshark/capture/file_capture.py) reveals that `_packets` is a list containing packets and is only used internally:
When iterating through a `FileCapture` object with `keep_packets = True` packets are getting added to this list.
---
To ge... |
27,025,827 | In this code with pyshark
```
import pyshark
cap = pyshark.FileCapture(filename)
i = 0
for idx, packet in enumerate(cap):
i += 1
print i
print len(cap._packets)
```
`i` and `len(cap._packets)` give two different results. Why is that? | 2014/11/19 | [
"https://Stackoverflow.com/questions/27025827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464277/"
] | i too, len(cap) is 0, i thinks the answer is fail.
if you want know len(cap), please load packet before print it.
use: cap.load\_packets()
```
cap.load_packets()
packet_amount = len(cap)
print packet_amount
``` | A look at the [source code](https://github.com/KimiNewt/pyshark/blob/master/src/pyshark/capture/file_capture.py) reveals that `_packets` is a list containing packets and is only used internally:
When iterating through a `FileCapture` object with `keep_packets = True` packets are getting added to this list.
---
To ge... |
27,025,827 | In this code with pyshark
```
import pyshark
cap = pyshark.FileCapture(filename)
i = 0
for idx, packet in enumerate(cap):
i += 1
print i
print len(cap._packets)
```
`i` and `len(cap._packets)` give two different results. Why is that? | 2014/11/19 | [
"https://Stackoverflow.com/questions/27025827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464277/"
] | A look at the [source code](https://github.com/KimiNewt/pyshark/blob/master/src/pyshark/capture/file_capture.py) reveals that `_packets` is a list containing packets and is only used internally:
When iterating through a `FileCapture` object with `keep_packets = True` packets are getting added to this list.
---
To ge... | Just adding another way using callback function. Also little bit faster approach.
```
length = 0
def count_callback(pkt):
global length
length = length + 1
cap.apply_on_packets(count_callback)
print(length)
``` |
27,025,827 | In this code with pyshark
```
import pyshark
cap = pyshark.FileCapture(filename)
i = 0
for idx, packet in enumerate(cap):
i += 1
print i
print len(cap._packets)
```
`i` and `len(cap._packets)` give two different results. Why is that? | 2014/11/19 | [
"https://Stackoverflow.com/questions/27025827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464277/"
] | Don't know if it works in Python 2.7, but in Python 3.4 `len(cap)` returns 0.
The FileCapture object is a generator, so what worked for me is `len([packet for packet in cap])` | i too, len(cap) is 0, i thinks the answer is fail.
if you want know len(cap), please load packet before print it.
use: cap.load\_packets()
```
cap.load_packets()
packet_amount = len(cap)
print packet_amount
``` |
27,025,827 | In this code with pyshark
```
import pyshark
cap = pyshark.FileCapture(filename)
i = 0
for idx, packet in enumerate(cap):
i += 1
print i
print len(cap._packets)
```
`i` and `len(cap._packets)` give two different results. Why is that? | 2014/11/19 | [
"https://Stackoverflow.com/questions/27025827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464277/"
] | Don't know if it works in Python 2.7, but in Python 3.4 `len(cap)` returns 0.
The FileCapture object is a generator, so what worked for me is `len([packet for packet in cap])` | Just adding another way using callback function. Also little bit faster approach.
```
length = 0
def count_callback(pkt):
global length
length = length + 1
cap.apply_on_packets(count_callback)
print(length)
``` |
27,025,827 | In this code with pyshark
```
import pyshark
cap = pyshark.FileCapture(filename)
i = 0
for idx, packet in enumerate(cap):
i += 1
print i
print len(cap._packets)
```
`i` and `len(cap._packets)` give two different results. Why is that? | 2014/11/19 | [
"https://Stackoverflow.com/questions/27025827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464277/"
] | i too, len(cap) is 0, i thinks the answer is fail.
if you want know len(cap), please load packet before print it.
use: cap.load\_packets()
```
cap.load_packets()
packet_amount = len(cap)
print packet_amount
``` | Just adding another way using callback function. Also little bit faster approach.
```
length = 0
def count_callback(pkt):
global length
length = length + 1
cap.apply_on_packets(count_callback)
print(length)
``` |
31,962 | I am using this program. However, I am getting garbage values only.
Do revert as to how can I get proper values over my arduino.
```
/*****************************************************************************/
* PrinterCapturePoll.ino
* ------------------
* Monitor a parallel port printer output and capture each ch... | 2016/12/06 | [
"https://arduino.stackexchange.com/questions/31962",
"https://arduino.stackexchange.com",
"https://arduino.stackexchange.com/users/20151/"
] | I think I can see the problem - although I have no way to test it.
According to [Wikipedia](https://en.wikipedia.org/wiki/Parallel_port):
>
> When the data was ready, the host pulled the STROBE pin low, to 0 V. The printer responded by pulling the BUSY line high, printing the character, and then returning BUSY to lo... | Do you know the printer is working properly?
You are trying to fix more than one thing at once and that's never a good idea. What I suggest you do is get a breadboard and make your own printer simulator. You need to connect and LED up to every output pin and a button to every input pin.
Then you can simulate data fro... |
20,730,665 | I want use a common WebDriver instance across all my TestNG tests by extending my test class to use a base class as shown below but it doesn't seem to work :
```
public class Browser {
private static WebDriver driver = new FirefoxDriver();
public static WebDriver getDriver()
{
return driver;
}
public static void... | 2013/12/22 | [
"https://Stackoverflow.com/questions/20730665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2850361/"
] | The problem is that your `getDriver` method is **static**.
Solution #1: Make method non-static (this will either need to make the `driver` variable non-static as well, or use `return Browser.getDriver();` )
```
public WebDriver getDriver() {
return driver;
}
```
**Or,** call the `getDriver` method by using `Bro... | You need to start your driver, one of many solution is to try @Before to add, Junit will autorun it for you.
```
public class Browser {
private WebDriver driver;
@Before
public void runDriver()
{
driver = new FirefoxDriver();
}
public WebDriver getDriv... |
60,823,571 | I have a background image and a box with a title in it. How would I blur part of the image in the box? I tried using web kit filter but it blurred the title
[](https://i.stack.imgur.com/yWjPZ.png)
```
.title {
height: 90px;
margin: auto;
margin-top: 90px;
margin-... | 2020/03/24 | [
"https://Stackoverflow.com/questions/60823571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7559119/"
] | You may need **[backdrop-filter](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter)**
>
> The backdrop-filter CSS property lets you apply graphical effects such as blurring or color shifting to the area behind an element. Because it applies to everything behind the element, to see the effect you must m... | Add another blurred image with a pseudo-element and clip it:
```css
.example {
position: relative;
width: 400px;
height: 400px;
background: #000 url(https://picsum.photos/id/870/400/400) no-repeat center center scroll;
display: flex;
justify-content: center;
align-items: center;
}
.example::b... |
2,619,042 | Here's what i have so far...
I have yet to figure out how i'm going to handle the 11 / 1 situation with an ace, and when the player chooses an option for hit/stand, i get segfault.
HELP!!!
**updated code**
```
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define DECKSIZE 52
#define V... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2619042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/314116/"
] | To fix your segfault, use `scanf("%d",&k);` instead of `scanf("%d",k);` (note the ampersand that I added. You need that because `scanf`'s second argument is a pointer to the location where it should store what gets read in. `k` by itself isn't a pointer--adding the `&` gets a pointer to `k`.
For handling aces, under w... | See [this question](https://stackoverflow.com/questions/837951/is-there-an-elegant-way-to-deal-with-the-ace-in-blackjack) on how to deal with the ace situation.
As a general tip about your code; you have essentially the same struct three times (Card, dealerHand, playerHand). It would suffice to define the struct once ... |
2,619,042 | Here's what i have so far...
I have yet to figure out how i'm going to handle the 11 / 1 situation with an ace, and when the player chooses an option for hit/stand, i get segfault.
HELP!!!
**updated code**
```
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define DECKSIZE 52
#define V... | 2010/04/11 | [
"https://Stackoverflow.com/questions/2619042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/314116/"
] | In general: compiling with warnings enabled tends to be helpful (gcc doesn't help you out much by default!).
Compare:
```
$ gcc -o blackjack blackjack.c
$
```
with:
```
$ gcc -Wall -o blackjack blackjack.c
blackjack.c: In function 'main':
blackjack.c:124: warning: too many arguments for format
blackjack.c:139: w... | See [this question](https://stackoverflow.com/questions/837951/is-there-an-elegant-way-to-deal-with-the-ace-in-blackjack) on how to deal with the ace situation.
As a general tip about your code; you have essentially the same struct three times (Card, dealerHand, playerHand). It would suffice to define the struct once ... |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I'd use observer design pattern and move the update logic to the observer class.
Don't mix logic and GUI. | I like option 4:
```
private int totalCount;
public int TotalCount
{
get { return totalCount; }
set {
totalCount = value;
UpdateTotalCountLabel(totalCount);
}
}
```
Clear delineation of intent and scope, easy-to-follow logic -- what's not to love? |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I'd use observer design pattern and move the update logic to the observer class.
Don't mix logic and GUI. | *(Update: I misread the order of the options and had them reversed - EM)*
Since your code is "doing something" (setting the count label on an outside component), the first form is usually considered better.
However -- and OOP purists will disagree vehemently with me on this -- neither version is terribly wrong. I've ... |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I think using the public accessors is better since it allows more maintanable code in case later on you need to change the way the total value is calculated. In that way, the users of the TotalValue property will not need to worry about your changes since these changes will not affect their code in any way. | I actually favor #1, since it clearly conveys that you are *doing* something, other than setting a field.
However, I agree with Mykola that your UI interaction **should not belong** to the same class that your backing logic does. |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I think using the public accessors is better since it allows more maintanable code in case later on you need to change the way the total value is calculated. In that way, the users of the TotalValue property will not need to worry about your changes since these changes will not affect their code in any way. | I prefer the first or
```
private void UpdateTotalCount(int newValue)
{
totalCount = newValue;
if (labelTotalCount.InvokeRequired)
BeginInvoke((MethodInvoker) delegate() {
labelTotalCount.Text = "Total reports:" + totalcount; });
else
labelTotalCount.Text = "Total reports:" + t... |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I think using the public accessors is better since it allows more maintanable code in case later on you need to change the way the total value is calculated. In that way, the users of the TotalValue property will not need to worry about your changes since these changes will not affect their code in any way. | I like option 4:
```
private int totalCount;
public int TotalCount
{
get { return totalCount; }
set {
totalCount = value;
UpdateTotalCountLabel(totalCount);
}
}
```
Clear delineation of intent and scope, easy-to-follow logic -- what's not to love? |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I'd use observer design pattern and move the update logic to the observer class.
Don't mix logic and GUI. | I prefer the first or
```
private void UpdateTotalCount(int newValue)
{
totalCount = newValue;
if (labelTotalCount.InvokeRequired)
BeginInvoke((MethodInvoker) delegate() {
labelTotalCount.Text = "Total reports:" + totalcount; });
else
labelTotalCount.Text = "Total reports:" + t... |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I think using the public accessors is better since it allows more maintanable code in case later on you need to change the way the total value is calculated. In that way, the users of the TotalValue property will not need to worry about your changes since these changes will not affect their code in any way. | *(Update: I misread the order of the options and had them reversed - EM)*
Since your code is "doing something" (setting the count label on an outside component), the first form is usually considered better.
However -- and OOP purists will disagree vehemently with me on this -- neither version is terribly wrong. I've ... |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I'd use observer design pattern and move the update logic to the observer class.
Don't mix logic and GUI. | I actually favor #1, since it clearly conveys that you are *doing* something, other than setting a field.
However, I agree with Mykola that your UI interaction **should not belong** to the same class that your backing logic does. |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I've always considered Properties to be the equivalent to get/set accessor methods. The rule of thumb for get/set accessors is that they are generally supposed to be for a public interface. If a class is calling it's own accessor methods, they should probably be in another class.
I'd consider it a code smell. | I actually favor #1, since it clearly conveys that you are *doing* something, other than setting a field.
However, I agree with Mykola that your UI interaction **should not belong** to the same class that your backing logic does. |
630,249 | I am working on a multi-threaded app. I'm processing reports and keeping track of the number of reports in the current batch as well as the total number of reports processed. Whenever I update the counters, I also need to update a label on the GUI which, since the process is on a separate thread, requires a call to a d... | 2009/03/10 | [
"https://Stackoverflow.com/questions/630249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19038/"
] | I prefer the first or
```
private void UpdateTotalCount(int newValue)
{
totalCount = newValue;
if (labelTotalCount.InvokeRequired)
BeginInvoke((MethodInvoker) delegate() {
labelTotalCount.Text = "Total reports:" + totalcount; });
else
labelTotalCount.Text = "Total reports:" + t... | I actually favor #1, since it clearly conveys that you are *doing* something, other than setting a field.
However, I agree with Mykola that your UI interaction **should not belong** to the same class that your backing logic does. |
17,610,594 | I'm developing an application to send SMS via AT commands, that part is OK. I have a list of contacts and I want to send a file (which changes in time) to all of my contacts. In order to do that I need to repeat the sending part every 30 minutes.
I found this code using a timer, but I'm not sure if it's useful in my ca... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17610594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2335219/"
] | Whether this code is useful or not depends entirely what you want to do with it. It shows a very basic usage of the Timer-class in .NET, which is indeed one of the timers you can use if you want to implement a repeating action. [I suggest you look at the MSDN-guidance on all timers in .NET](http://msdn.microsoft.com/en... | This is simple but should work for you if you do not need a very accurate time span between firing.
Add a timer to your form (timer1), and a timer tick event .
```
private void btntime_Click(object sender, EventArgs e)
{
timer1.Tick += new EventHandler(timer1_Tick);
timer1.Interval = 30 *1000;... |
17,610,594 | I'm developing an application to send SMS via AT commands, that part is OK. I have a list of contacts and I want to send a file (which changes in time) to all of my contacts. In order to do that I need to repeat the sending part every 30 minutes.
I found this code using a timer, but I'm not sure if it's useful in my ca... | 2013/07/12 | [
"https://Stackoverflow.com/questions/17610594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2335219/"
] | Whether this code is useful or not depends entirely what you want to do with it. It shows a very basic usage of the Timer-class in .NET, which is indeed one of the timers you can use if you want to implement a repeating action. [I suggest you look at the MSDN-guidance on all timers in .NET](http://msdn.microsoft.com/en... | You can start something like this. After all SMS are sent then after 30 seconds the SMS will be sent again.
```
public Form1()
{
InitializeComponent();
timer1.Enabled = true;
timer1.Interval = (30 * 60 * 1000);
timer1.Tick += SendSMS;
}
private void SendSMS(object sende... |
4,607,039 | We have around 3 people working on a project in TFS. Our company set our TFS project to single checkout. But Sometimes, we have 1 person checking out certain files, solution files, etc. Is it bad practice to have multiple checkout enabled and let the merging or diff tool handle the problem if we both accidentally overw... | 2011/01/05 | [
"https://Stackoverflow.com/questions/4607039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/400861/"
] | It is true that having multiple checkout disabled is simpler to work with, and it safeguards you against having to do manual merges and perhaps overwrite work.
However, it can also hinder productivity and development, especially on medium to large teams. If John can't get his feature done before Susan checks her versi... | I worked on a team of 3+ developers for a long time and shared checkout is fantastic. Your team will need the discipline to *communicate with each other* if they run into merge conflicts that aren't straightforward, but I have experienced nothing but upside in enabling shared checkout.
Make sure that you use a merge t... |
9,183 | I managed to get all traffic routed through tor using the following this [documentation](https://trac.torproject.org/projects/tor/wiki/doc/TransparentProxy).
I want now to know if it's possible to turn this on and off on command. I've tried reversing it with the following to no avail:
```
#!/bin/sh
iptables -P INPUT... | 2015/12/07 | [
"https://tor.stackexchange.com/questions/9183",
"https://tor.stackexchange.com",
"https://tor.stackexchange.com/users/10009/"
] | 1. You need to flush the NAT table too, as dingensundso suggests: `iptables -t nat -F`
2. You probably don't want to just `ACCEPT` all `INPUT`, `OUTPUT`, and `FORWARD` traffic, this would disable packet-filtering (your "firewall") entirely.
3. Just switching Tor on and off is a terrible plan for anonymity. Your applica... | Just bind it - if you're using IPTables - to the username. Create a username, let's say `clearnet` and allow all the traffic for it to be direct. |
12,234,050 | For the last 3 weeks we have been testing Nginx as load balance.
Currently, we're not succeeding to handle more than 1000 req/sec and 18K active connections.
When we get to the above numbers, Nginx starts to hang, and returns timeout codes.
The only way to get a response is to reduce the number of connection dramatical... | 2012/09/02 | [
"https://Stackoverflow.com/questions/12234050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1520931/"
] | Here are some good references:
<http://dak1n1.com/blog/12-nginx-performance-tuning>
Server fault:
<https://serverfault.com/questions/221292/tips-for-maximizing-nginx-requests-sec>
A very well documented config from the dak1n1 link:
```
# This number should be, at maximum, the number of CPU cores on your system.
# ... | nginx should definately be able to handle more then 1000 req/s (I get about 2800 req/s in nginx when playing around on my cheap laptop with jmeter using one and a halve of the 2 cores)
You're using epoll which is the optimal option on current linux kernel as I understand it.
You've turned acces\_log off, so you'r di... |
12,234,050 | For the last 3 weeks we have been testing Nginx as load balance.
Currently, we're not succeeding to handle more than 1000 req/sec and 18K active connections.
When we get to the above numbers, Nginx starts to hang, and returns timeout codes.
The only way to get a response is to reduce the number of connection dramatical... | 2012/09/02 | [
"https://Stackoverflow.com/questions/12234050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1520931/"
] | Here are some good references:
<http://dak1n1.com/blog/12-nginx-performance-tuning>
Server fault:
<https://serverfault.com/questions/221292/tips-for-maximizing-nginx-requests-sec>
A very well documented config from the dak1n1 link:
```
# This number should be, at maximum, the number of CPU cores on your system.
# ... | I found that using the least connected algorithm was problematic. I switched to
```
hash $remote_addr consistent;
```
and found the service much quicker. |
10,438,034 | So, I'm writing a menu and I want it to stay a certain color based upon it being on that page.
I've added "class = 'active'" onto the page, and I've tried adding it to CSS, but it's not working. Any ideas?
PHP code:
```
<?php
$currentPage = basename($_SERVER['REQUEST_URI']);
print "<div id = 'submenu-container'>";
p... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10438034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1340238/"
] | I think instead of
```
$memberDisplayList = '<a href= (...etc)
```
you meant to type
```
$memberDisplayList .= '<a href= (...etc)
```
which would append the new links to your string.
Also you don't seem to be echoing your `$user_pic` and `$memberDisplayList` strings anywhere. | Where are you actually constructing the HTML? You're setting a bunch of variables in the code you presented, and that looks okay for what it is. So it's probably in the presentation logic. If that's in the loop, you're in good shape. But if it's outside of the loop, then I can't imagine where you'd ever display anythin... |
10,438,034 | So, I'm writing a menu and I want it to stay a certain color based upon it being on that page.
I've added "class = 'active'" onto the page, and I've tried adding it to CSS, but it's not working. Any ideas?
PHP code:
```
<?php
$currentPage = basename($_SERVER['REQUEST_URI']);
print "<div id = 'submenu-container'>";
p... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10438034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1340238/"
] | I think instead of
```
$memberDisplayList = '<a href= (...etc)
```
you meant to type
```
$memberDisplayList .= '<a href= (...etc)
```
which would append the new links to your string.
Also you don't seem to be echoing your `$user_pic` and `$memberDisplayList` strings anywhere. | Its because your overwriting the variables on each iteration, you need to hold the data within an array then do another foreach loop where ever you output:
```
<?php
while($row = mysql_fetch_array($sql)){
/////// Mechanism to Display Pic. See if they have uploaded a pic or not //////////////////////////
$ch... |
10,438,034 | So, I'm writing a menu and I want it to stay a certain color based upon it being on that page.
I've added "class = 'active'" onto the page, and I've tried adding it to CSS, but it's not working. Any ideas?
PHP code:
```
<?php
$currentPage = basename($_SERVER['REQUEST_URI']);
print "<div id = 'submenu-container'>";
p... | 2012/05/03 | [
"https://Stackoverflow.com/questions/10438034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1340238/"
] | Its because your overwriting the variables on each iteration, you need to hold the data within an array then do another foreach loop where ever you output:
```
<?php
while($row = mysql_fetch_array($sql)){
/////// Mechanism to Display Pic. See if they have uploaded a pic or not //////////////////////////
$ch... | Where are you actually constructing the HTML? You're setting a bunch of variables in the code you presented, and that looks okay for what it is. So it's probably in the presentation logic. If that's in the loop, you're in good shape. But if it's outside of the loop, then I can't imagine where you'd ever display anythin... |
13,740,912 | i have simple chrome extension that opens JQuery dialog box on each tab i open ,
the problem is when web page has iframe in it , the dialog box opens as many iframes are in the page .
i want to avoid this , all i need it open only and only 1 instance of the Dialog box for each page .
how can i avoid the iframes i... | 2012/12/06 | [
"https://Stackoverflow.com/questions/13740912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63898/"
] | How about wrapping all this with
```
if(window==window.top) {
// we're not in an iframe
// your code goes here
}
``` | As PAEz said in a comment, content scripts run in only the top frame by default. To make them run in subframes, you'd need to have '"all\_frames":true' in the [content\_scripts section of your manifest](https://developer.chrome.com/extensions/content_scripts.html). Similarly, if you're injecting script using [tabs.exec... |
101,759 | I was wondering if there are any ledgers to make such entries. I trade regularly and I would like to make a good record of it. | 2018/11/03 | [
"https://money.stackexchange.com/questions/101759",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/78593/"
] | Have a look at the Asset functionality of common accounting packages. It allows you to record prices and quantities of 'things' at purchase and sale. For shares, each stock code can be considered a separate 'thing' with buy and sell prices and quantities held in 'inventory'.
Each accounting package has its own process... | It's fairly easy to set up a spreadsheet that records trades and reconciles the gains and losses. It becomes more time consuming if you trade frequently and scale in and out of positions. And it gets onerous if your trading involves numerous wash sales.
AFAIK, US brokers provide Forms 1099-B and 8949 that break down ... |
101,759 | I was wondering if there are any ledgers to make such entries. I trade regularly and I would like to make a good record of it. | 2018/11/03 | [
"https://money.stackexchange.com/questions/101759",
"https://money.stackexchange.com",
"https://money.stackexchange.com/users/78593/"
] | Have a look at the Asset functionality of common accounting packages. It allows you to record prices and quantities of 'things' at purchase and sale. For shares, each stock code can be considered a separate 'thing' with buy and sell prices and quantities held in 'inventory'.
Each accounting package has its own process... | Since softwares are being recommended I can post my comment as an answer:
The shareware software, KBH Investor Accounting, accounts both long and short positions and computes an overall mark-to-market accounting. The realized buy/sell transactions can be printed out in the form of an IRS 4797 but assumes that no long ... |
31,173,307 | What are the differences between this:
```
if(a && b)
{
//code
}
```
and this:
```
if(a)
{
if(b)
{
//code
}
}
```
From what I know `b` will only get evaluated in the first code block if `a` is true, and the second code block would be the same thing.
Are there any benefits of using o... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31173307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4714970/"
] | They get compiled to the same bytecode. No performance difference.
Readability is the only difference. As a huge generalization, short-circuiting looks better but nesting is slightly clearer. It really boils down to the specific use case. I'd typically short-circuit.
---
I tried this out. Here's the code:
```
publi... | If there is nothing in between two `if` statements in your second example then definitely first one is more cleaner and more readable.
But if there is a piece of code that could fit in between the two if conditions then only way is second example. |
31,173,307 | What are the differences between this:
```
if(a && b)
{
//code
}
```
and this:
```
if(a)
{
if(b)
{
//code
}
}
```
From what I know `b` will only get evaluated in the first code block if `a` is true, and the second code block would be the same thing.
Are there any benefits of using o... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31173307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4714970/"
] | It makes a difference if you have an **else** associated with each **if**.
```
if(a && b)
{
//do something if both a and b evaluate to true
} else {
//do something if either of a or b is false
}
```
and this:
```
if(a)
{
if(b)
{
//do something if both a and b are true
} else {
... | If there is nothing in between two `if` statements in your second example then definitely first one is more cleaner and more readable.
But if there is a piece of code that could fit in between the two if conditions then only way is second example. |
31,173,307 | What are the differences between this:
```
if(a && b)
{
//code
}
```
and this:
```
if(a)
{
if(b)
{
//code
}
}
```
From what I know `b` will only get evaluated in the first code block if `a` is true, and the second code block would be the same thing.
Are there any benefits of using o... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31173307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4714970/"
] | They get compiled to the same bytecode. No performance difference.
Readability is the only difference. As a huge generalization, short-circuiting looks better but nesting is slightly clearer. It really boils down to the specific use case. I'd typically short-circuit.
---
I tried this out. Here's the code:
```
publi... | there shouldn't be a difference, but in readability I would prefer the first one, because it is less verbose and less indented. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.