qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
14,511,655 | There is probably a simple one-liner that I am just not finding here, but this is my question:
How do I check if an ArrayList contains all of the objects in another ArrayList? I am looking (if it exists) for something along the lines of:
```
//INCORRECT EXAMPLE:
if(one.contains(two))
{
return true;
}
else
{
r... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14511655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1889720/"
] | Take a look at `containsAll(Collection<?> c)` method from `List` interface. I think it is what you are looking for. | This can also be done using streams in Java
```
List<String> employeeList = Arrays.asList("Marc","john");
List<String> masterEmployeeList = Arrays.asList("Marc", "Stacy", "john");
System.out.println(employeeList.stream().allMatch(masterEmployeeList::contains));
``` |
14,511,655 | There is probably a simple one-liner that I am just not finding here, but this is my question:
How do I check if an ArrayList contains all of the objects in another ArrayList? I am looking (if it exists) for something along the lines of:
```
//INCORRECT EXAMPLE:
if(one.contains(two))
{
return true;
}
else
{
r... | 2013/01/24 | [
"https://Stackoverflow.com/questions/14511655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1889720/"
] | Take a look at `containsAll(Collection<?> c)` method from `List` interface. I think it is what you are looking for. | You can use `containsAll` method of the list to do the check. However, this is a linear operation. If the list is large, you should convert it to `HashSet` first, and then perform `containsAll`:
```
HashSet tmp = new HashSet(one);
if (tmp.containsAll(two)) {
...
}
```
If the length of `one` is `N` and the length... |
20,167,322 | I've created the forms using Sonata Admin Bundle. Then I've created my own Controller (TestController) and override the CRUD controller,
I've added a new function in the TestController,
```
namespace IFI2\MainProjectBundle\Controller;
use Symfony\Component\Security\Core\SecurityContextInterface;
use Symfony\Bridge\M... | 2013/11/23 | [
"https://Stackoverflow.com/questions/20167322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1543994/"
] | Add new route in your Admin method configureRoutes
```
protected function configureRoutes(RouteCollection $collection)
{
parent::configureRoutes($collection);
$collection->add('get_product_prices');
}
```
Remove your route main\_project.admin.test
New route has $baseRouteName from your admin as prefix and h... | In routing.yml add the following:
```html
main_project.admin.test:
pattern: /getProductPrices/
defaults: { _controller: IFI2MainProjectBundle:Test:getProductPrices,"_sonata_admin": "main_project.admin.cobrand" }
``` |
580,794 | I have two LAN cards in my system. I need to change between the LAN cards using command line. Also I want to know whether I can switch between the LAN cards automatically when one of them goes down.
*How should I proceed?* | 2015/02/02 | [
"https://askubuntu.com/questions/580794",
"https://askubuntu.com",
"https://askubuntu.com/users/374706/"
] | The first clue to the answer lies in the log /var/log/maas/pserv.log on the cluster-controller. The problem was essentially an authentication failure.
```
2015-02-02 20:36:57+0900 [Uninitialized] ClusterClient connection established (HOST:IPv4Address(TCP, '172.16.10.3', 46209) PEER:IPv4Address(TCP, u'172.16.10. 1', 3... | I had this problem due to another process already listening on port 69 (tftpd).
It was reported in the log file for the `maas-clusterd` service in `/var/log/maas/clusterd.log`
>
> 2016-03-15 13:56:15+1000 [-] twisted.internet.error.CannotListenError: Couldn't listen on 10.0.3.1:69: [Errno 98] Address already in use.... |
1,441 | I have heard that recent GPUs all support non-power-of-2 textures and all features just work. However, I don't understand how mip-mapping would work in such a scenario. Can someone explain? | 2015/09/05 | [
"https://computergraphics.stackexchange.com/questions/1441",
"https://computergraphics.stackexchange.com",
"https://computergraphics.stackexchange.com/users/14/"
] | The rule is that to compute the next mipmap size, you divide by two and round down to the nearest integer (unless it rounds down to 0, in which case, it's 1 instead). For example, a 57x43 image would have mipmaps like:
```
level 0: 57x43
level 1: 28x21
level 2: 14x10
level 3: 7x5
level 4: 3x2
level 5: 1x1
```
UV map... | One way to think of it is that graphics cards often implement non-power-of-2 textures simply by padding them until they are a power of 2 in each direction. This makes most things "just work": tiling and hardware filtering, for example. The only thing that needs to change is the conversion from texture coordinates to im... |
3,998,418 | So I'm trying to convert a complex number to the form of $a + bi$. The complex number in question is $$\bbox[5px,border:2px solid #C0A000]{\large 2e^{\frac{-3\pi}{4i}+\ln(3)}}$$ I'm not quite sure how to tackle this to be honest, I would appreciate some help in trying to understand how to convert these expressions into... | 2021/01/24 | [
"https://math.stackexchange.com/questions/3998418",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/840735/"
] | The first thing you can do is factor the expression into $2e^{\ln(3)} \times e^{-3\pi/4i}$.
Then, we can use Euler's formula: $e^{ix} = \cos x + i \sin x$.
If you apply that formula to the expression, you will be able to get your answer with a little bit of arithmetic and simplification. | First, convert it into $re^{i \theta}$. Then we have $a = r \cos \theta$ and $b = r \sin \theta$. In your case, we have $r = 2e^{\ln 3} = 6$ and $\theta = -3 \pi / 4$. |
3,998,418 | So I'm trying to convert a complex number to the form of $a + bi$. The complex number in question is $$\bbox[5px,border:2px solid #C0A000]{\large 2e^{\frac{-3\pi}{4i}+\ln(3)}}$$ I'm not quite sure how to tackle this to be honest, I would appreciate some help in trying to understand how to convert these expressions into... | 2021/01/24 | [
"https://math.stackexchange.com/questions/3998418",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/840735/"
] | there are two standard forms for complex numbers.
Rectangular form $z =a+bi$ where $a = Re(z)$ and $b = Im(z)$.
And, if $z \ne 0$ polar form $z = r e^{\theta i}$ where $r = |z|$ and $\theta =\arg(z)$.
$e^{\theta i}$ is *defined* to be $e^{\theta i} = \cos \theta + i \sin \theta$.
So there is a conversion between th... | First, convert it into $re^{i \theta}$. Then we have $a = r \cos \theta$ and $b = r \sin \theta$. In your case, we have $r = 2e^{\ln 3} = 6$ and $\theta = -3 \pi / 4$. |
3,998,418 | So I'm trying to convert a complex number to the form of $a + bi$. The complex number in question is $$\bbox[5px,border:2px solid #C0A000]{\large 2e^{\frac{-3\pi}{4i}+\ln(3)}}$$ I'm not quite sure how to tackle this to be honest, I would appreciate some help in trying to understand how to convert these expressions into... | 2021/01/24 | [
"https://math.stackexchange.com/questions/3998418",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/840735/"
] | there are two standard forms for complex numbers.
Rectangular form $z =a+bi$ where $a = Re(z)$ and $b = Im(z)$.
And, if $z \ne 0$ polar form $z = r e^{\theta i}$ where $r = |z|$ and $\theta =\arg(z)$.
$e^{\theta i}$ is *defined* to be $e^{\theta i} = \cos \theta + i \sin \theta$.
So there is a conversion between th... | The first thing you can do is factor the expression into $2e^{\ln(3)} \times e^{-3\pi/4i}$.
Then, we can use Euler's formula: $e^{ix} = \cos x + i \sin x$.
If you apply that formula to the expression, you will be able to get your answer with a little bit of arithmetic and simplification. |
64,202 | I am using SQL Server 2000 and I have two databases that both replicate (transactional push subscription) to a single database. I need to know which database the records came from.
So I want to add a fixed column specified in the publication to my table so I can tell which database the row originated from.
How do I g... | 2008/09/15 | [
"https://Stackoverflow.com/questions/64202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2253/"
] | You could use a calculated column Use the following on the two databases:
```
ALTER TABLE TableName ADD
MyColumn AS 'Server1'
```
Then just define the single "master" database to use a VARCHAR column (or whatever you want) that you fill using the calculated columns value. | You can create a view, which adds the "constant" column, and use it as a replication source. |
64,202 | I am using SQL Server 2000 and I have two databases that both replicate (transactional push subscription) to a single database. I need to know which database the records came from.
So I want to add a fixed column specified in the publication to my table so I can tell which database the row originated from.
How do I g... | 2008/09/15 | [
"https://Stackoverflow.com/questions/64202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2253/"
] | So the solution for me was to set up the replication publications to allow transformations and create a DTS package for each site that appends the siteid into the tables to keep the ids unique as I can't use guids. | You can create a view, which adds the "constant" column, and use it as a replication source. |
13,876,838 | how can i return these in this order:
```
1: aaaa
2: bbbb
3: the cccc
4: dddd
```
So ignoreing the leading 'the'
currently im using.
```
select * from houses order by name asc
```
and its returning it in this order.
```
1: aaaa
2: bbbb
3: dddd
4: the cccc
```
Thanks | 2012/12/14 | [
"https://Stackoverflow.com/questions/13876838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1344193/"
] | If you want to remove the `the` for the order by then you can use:
```
select id, name
from yourtable
order by replace(name, 'the ', '')
```
See [SQL Fiddle with Demo](http://sqlfiddle.com/#!2/e926e/3)
Or:
```
select id, name
from yourtable
order by ltrim(replace(name, 'the', ''))
```
See [SQL Fiddle with Demo](... | Hey Man Its ascending order means **`a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z`**. As d comes before t so, thats why it is echoing it first! ORDER BY only checks the first letter of string and then order them. if you want them to order like:
1: aaaaa
2: bbbbb
3: the ccccc
4: ddddd
then make one more colu... |
13,876,838 | how can i return these in this order:
```
1: aaaa
2: bbbb
3: the cccc
4: dddd
```
So ignoreing the leading 'the'
currently im using.
```
select * from houses order by name asc
```
and its returning it in this order.
```
1: aaaa
2: bbbb
3: dddd
4: the cccc
```
Thanks | 2012/12/14 | [
"https://Stackoverflow.com/questions/13876838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1344193/"
] | A more correct, but slower answer is:
```
ORDER BY CASE WHEN SUBSTR(name, 1, 4) = 'the ' THEN SUBSTR(name, 5) ELSE name END;
``` | Hey Man Its ascending order means **`a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z`**. As d comes before t so, thats why it is echoing it first! ORDER BY only checks the first letter of string and then order them. if you want them to order like:
1: aaaaa
2: bbbbb
3: the ccccc
4: ddddd
then make one more colu... |
503,201 | Some applications in Ubuntu don't update automatically, for example VirtualBox, GCC and Git.
I'm afraid of using unofficial PPAs, but I can't find PPAs from official sources. | 2014/07/27 | [
"https://askubuntu.com/questions/503201",
"https://askubuntu.com",
"https://askubuntu.com/users/299677/"
] | **For Finding PPA**:
* Visit [Launchpad **Personal Package Archives for Ubuntu**](https://launchpad.net/ubuntu/+ppas)
* Visit [ubuntu updates](http://www.ubuntuupdates.org/package_metas)
and search with **"Package Search"** then find appropriate package
according to your version of Ubuntu.
* For Browsing all PPAs, vis... | <https://launchpad.net/> seems to host all of the PPAs. You can search for it [here](https://launchpad.net/ubuntu) (or [here](https://launchpad.net/+search?field.text=)) to find various PPAs - e.g:
* [Virtualbox](https://launchpad.net/virtualbox)
* [Git](https://launchpad.net/~git-core/+archive/ubuntu/ppa)
The proble... |
65,238,954 | I've been trying to figure out how to query a Firebase database for a while, but to no avail. Here's what I have right now:
```js
async query(){
const bar = firebase.firestore().collection('foo');
const res = await bar.orderBy('gopher').limit(20).get();
}
```
`res` isn't the actual data, but rather some sort... | 2020/12/10 | [
"https://Stackoverflow.com/questions/65238954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11509588/"
] | `res` is a [QuerySnapshot](https://firebase.google.com/docs/reference/js/firebase.firestore.QuerySnapshot) type object. If you want to see the results of the query, you can get the raw data using the pattern described in the [documentation](https://firebase.google.com/docs/firestore/query-data/queries#execute_a_query).... | It should be `res.docs` not `res.data`
`res.docs` contains array firestore document snapshot.
*To print all the data*
```
console.log(res.docs.map(snap=>snap.data()));
``` |
28,247,022 | I am currently trying to set all `.txt` file types within the test folder to hidden. I have tried running the batch with no luck. What am I missing?
```
@ECHO OFF
for "C:\Users\Ryan\Desktop\test" %%a IN (*.txt) DO attrib +h "%%a"
``` | 2015/01/31 | [
"https://Stackoverflow.com/questions/28247022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4119279/"
] | ```
attrib +h "C:\Users\Ryan\Desktop\test\*.txt"
```
should be easier, but you don't tell us what happened. | The source path goes inside the parentheses.
```
@ECHO OFF
for %%a IN (C:\Users\Ryan\Desktop\test\*.txt) DO attrib +h "%%a"
``` |
28,247,022 | I am currently trying to set all `.txt` file types within the test folder to hidden. I have tried running the batch with no luck. What am I missing?
```
@ECHO OFF
for "C:\Users\Ryan\Desktop\test" %%a IN (*.txt) DO attrib +h "%%a"
``` | 2015/01/31 | [
"https://Stackoverflow.com/questions/28247022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4119279/"
] | ```
attrib +h "C:\Users\Ryan\Desktop\test\*.txt"
```
should be easier, but you don't tell us what happened. | Try this:
```
@echo off
for %%x in ("\path\to\directory\*.txt") do @attrib +h "%%x"
``` |
35,878,177 | I am doing an exercise which consists on checking if two words have the same letters. So far, my code has passed all tests but one. I am trying to understand why.
This is what i have:
```
function mutation(arr) {
var first = arr[0].toLowerCase();
var second = arr[1].toLowerCase();
for(var i = 0; i < first.length... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35878177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6002144/"
] | From Apple documentation "[Thread safety summary](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html)":
>
> Mutable objects are generally not thread-safe. To use mutable objects
> in a threaded application, the application must synchroni... | How about wrapping where you get the keys AND where you set the keys, with `@synchronize`?
[Example](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html):
```
- (void)myMethod:(id)anObj
{
@synchronized(anObj)
{
// Everything between the... |
35,878,177 | I am doing an exercise which consists on checking if two words have the same letters. So far, my code has passed all tests but one. I am trying to understand why.
This is what i have:
```
function mutation(arr) {
var first = arr[0].toLowerCase();
var second = arr[1].toLowerCase();
for(var i = 0; i < first.length... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35878177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6002144/"
] | You can use `@synchronize`. And it will work. But this is mixing up two different ideas:
* Threads have been around for many years. A new thread opens a new control flow. Code in different threads are running potentially concurrently causing conflicts as you had. To prevent this conflicts you have to use locks like `@... | How about wrapping where you get the keys AND where you set the keys, with `@synchronize`?
[Example](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html):
```
- (void)myMethod:(id)anObj
{
@synchronized(anObj)
{
// Everything between the... |
35,878,177 | I am doing an exercise which consists on checking if two words have the same letters. So far, my code has passed all tests but one. I am trying to understand why.
This is what i have:
```
function mutation(arr) {
var first = arr[0].toLowerCase();
var second = arr[1].toLowerCase();
for(var i = 0; i < first.length... | 2016/03/08 | [
"https://Stackoverflow.com/questions/35878177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6002144/"
] | You can use `@synchronize`. And it will work. But this is mixing up two different ideas:
* Threads have been around for many years. A new thread opens a new control flow. Code in different threads are running potentially concurrently causing conflicts as you had. To prevent this conflicts you have to use locks like `@... | From Apple documentation "[Thread safety summary](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html)":
>
> Mutable objects are generally not thread-safe. To use mutable objects
> in a threaded application, the application must synchroni... |
39,382,550 | On the latest update of UCBrowser ( V11.0.0.828 ) android lots of annoying news feeds are there. Is there any way to disable it? | 2016/09/08 | [
"https://Stackoverflow.com/questions/39382550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4932065/"
] | Open your UC Browser then just scroll down after doing that there is a plus sign button at top right side click on that and tap on edit and then select which type of news you want whatever you dont want then tap on × button then click on done.But there is no option to remove recommend from uc news feeds. | Go to home page setting and uc news display change to card now restart automatically now go uc news manage cards turn of all news that time do not use mobile data. |
39,382,550 | On the latest update of UCBrowser ( V11.0.0.828 ) android lots of annoying news feeds are there. Is there any way to disable it? | 2016/09/08 | [
"https://Stackoverflow.com/questions/39382550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4932065/"
] | Seems in the latest update (V11.0.8.885) UC browser is allowing users to disable UC NEWS.
>
> Settings -> Homepage Settings -> UC News Display (On/ Off)
>
>
>
:)
* in home page scroll down to the end. click manage cards unchecked all. | Open your UC Browser then just scroll down after doing that there is a plus sign button at top right side click on that and tap on edit and then select which type of news you want whatever you dont want then tap on × button then click on done.But there is no option to remove recommend from uc news feeds. |
39,382,550 | On the latest update of UCBrowser ( V11.0.0.828 ) android lots of annoying news feeds are there. Is there any way to disable it? | 2016/09/08 | [
"https://Stackoverflow.com/questions/39382550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4932065/"
] | Open your UC Browser then just scroll down after doing that there is a plus sign button at top right side click on that and tap on edit and then select which type of news you want whatever you dont want then tap on × button then click on done.But there is no option to remove recommend from uc news feeds. | Sometimes uc news install s automatically then disconnect data and disable all unknown application... Even fake WhatsApp a application will also be installed which re installs uc news ..then restart phone check for running application if any thing runs disable it.. clear all cache data of disable apps. |
39,382,550 | On the latest update of UCBrowser ( V11.0.0.828 ) android lots of annoying news feeds are there. Is there any way to disable it? | 2016/09/08 | [
"https://Stackoverflow.com/questions/39382550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4932065/"
] | Seems in the latest update (V11.0.8.885) UC browser is allowing users to disable UC NEWS.
>
> Settings -> Homepage Settings -> UC News Display (On/ Off)
>
>
>
:)
* in home page scroll down to the end. click manage cards unchecked all. | Go to home page setting and uc news display change to card now restart automatically now go uc news manage cards turn of all news that time do not use mobile data. |
39,382,550 | On the latest update of UCBrowser ( V11.0.0.828 ) android lots of annoying news feeds are there. Is there any way to disable it? | 2016/09/08 | [
"https://Stackoverflow.com/questions/39382550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4932065/"
] | Seems in the latest update (V11.0.8.885) UC browser is allowing users to disable UC NEWS.
>
> Settings -> Homepage Settings -> UC News Display (On/ Off)
>
>
>
:)
* in home page scroll down to the end. click manage cards unchecked all. | Sometimes uc news install s automatically then disconnect data and disable all unknown application... Even fake WhatsApp a application will also be installed which re installs uc news ..then restart phone check for running application if any thing runs disable it.. clear all cache data of disable apps. |
36,112,144 | A Hashset consist of elements like below
```
[ABAB,BABA,ABBA,AABB,BBAA,BAAB]
```
I need to remove the elements which has adjacent elements as same
```
in this case the elements are ABBA,AABB,BBAA,BAAB
so the resultant output should be [ABAB,BABA]
```
Below is the code i used to get the values of the Hashset whe... | 2016/03/20 | [
"https://Stackoverflow.com/questions/36112144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2686137/"
] | You could use [http.ServeContent](https://golang.org/pkg/net/http/#ServeContent) instead.
Get a [HTTPBox](https://godoc.org/github.com/GeertJohan/go.rice#Box.HTTPBox) and use [HTTPBox.Open](https://godoc.org/github.com/GeertJohan/go.rice#HTTPBox.Open) to get a http.File, which implements io.ReadSeeker, so it can be use... | There is actually a very simple and short solution to achieve what you want:
```
func main() {
box := rice.MustFindBox("../../static")
http.Handle("/", http.FileServer(box.HTTPBox()))
http.ListenAndServe(":8080", nil)
}
``` |
179,601 | I played this module about 25 years back and don't remember much of it, but it did have these features:
There was a 'trap' consisting of a long chain that descended into a pool leading to an underwater tunnel, and eventually dead-ended stapled to a blank rock face, drowning the character who thought they could use the... | 2021/01/15 | [
"https://rpg.stackexchange.com/questions/179601",
"https://rpg.stackexchange.com",
"https://rpg.stackexchange.com/users/67954/"
] | Beneath the Twisted Tower (1993)
--------------------------------
The AD&D 2e *Forgotten Realms Campaign Setting* boxed set (1993) included the sourcebook *Shadowdale*, which contained an adventure module named *Beneath the Twisted Tower*, for players of between 1st and 3rd levels.
A dead-end underwater trap, p.62:
... | May have been from Dungeon Magazine
-----------------------------------
According to [this article](https://www.enworld.org/threads/monster-encyclopedia-drider.662437/), Driders appeared in two AD&D 2E published adventures in the mid 1990s. The first was in an Issue #48 (July/August 1994) adventure called "Honor Lost,... |
1,277,287 | An application regularly polls a directory for input csv files which arrive by FTP, so there is an FTP server (currently Filezilla Server) running on that computer.
The problem is, that if a file is in the middle of being uploaded when the application decides to poll the location, then the file is locked and all sorts... | 2017/12/14 | [
"https://superuser.com/questions/1277287",
"https://superuser.com",
"https://superuser.com/users/369364/"
] | I would recommend the approach where your application does not poll the location that used by other process(FTP server in this case) to write.
Instead, set the process to rnfr/rnto (atomic operation) files after they arrive to the locations that your app polls... Your should try to take readlock on the file and if fai... | I've solved the same problem with below approach:
1. Connect to FTP
2. Gets list of files into an array (filter out .end files)
3. Rename each file in the array (add .end to the filename)
4. If got error while renaming skip that file (means that file is still uploading by other app)
5. Download each \*.end file & dele... |
1,245,929 | I want to remove excess decimals from a string using find/replace with regex.
For example :
```
<xml_taga>145.3345542123</xml_taga>
<xml_tagb>125.1245471</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
Should look like this:
```
<xml_taga>145.33</xml_taga>
<xml_tagb>125.12</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
The... | 2017/08/30 | [
"https://superuser.com/questions/1245929",
"https://superuser.com",
"https://superuser.com/users/766589/"
] | ### Active Window Border
```
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent]
"AccentColorMenu"=dword:ffb16300
```
### Active Window Title Bar
```
[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"AccentColor"=dword:ffb16300
```
### Inactive Window Title Bar
```
[HKEY_CURRENT_USER\... | For the answer above (Drew Chapin) - I suppose that's what you looking for:
**Start Menu Tile**
and
**App Accent Color**
HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\S-1-5-\*\*\*\*\*\*\AnyoneRead\Colors |
1,245,929 | I want to remove excess decimals from a string using find/replace with regex.
For example :
```
<xml_taga>145.3345542123</xml_taga>
<xml_tagb>125.1245471</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
Should look like this:
```
<xml_taga>145.33</xml_taga>
<xml_tagb>125.12</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
The... | 2017/08/30 | [
"https://superuser.com/questions/1245929",
"https://superuser.com",
"https://superuser.com/users/766589/"
] | ### Active Window Border
```
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent]
"AccentColorMenu"=dword:ffb16300
```
### Active Window Title Bar
```
[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"AccentColor"=dword:ffb16300
```
### Inactive Window Title Bar
```
[HKEY_CURRENT_USER\... | I've noticed that "Automatically pick an accent color from my background" option leads to `HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColorBalance` getting a value `0xfffffff3` (i.e. it overrides an actual colorization color balance). |
1,245,929 | I want to remove excess decimals from a string using find/replace with regex.
For example :
```
<xml_taga>145.3345542123</xml_taga>
<xml_tagb>125.1245471</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
Should look like this:
```
<xml_taga>145.33</xml_taga>
<xml_tagb>125.12</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
The... | 2017/08/30 | [
"https://superuser.com/questions/1245929",
"https://superuser.com",
"https://superuser.com/users/766589/"
] | ### Active Window Border
```
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Accent]
"AccentColorMenu"=dword:ffb16300
```
### Active Window Title Bar
```
[HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM]
"AccentColor"=dword:ffb16300
```
### Inactive Window Title Bar
```
[HKEY_CURRENT_USER\... | In the Registry, "Automatically pick an Accent Color from my background" can be enabled/disabled by setting the following key to `0` or `1`:
```powershell
HKCU\Control Panel\Desktop\AutoColorization
```
The Powershell command is:
```powershell
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "AutoColoriza... |
1,245,929 | I want to remove excess decimals from a string using find/replace with regex.
For example :
```
<xml_taga>145.3345542123</xml_taga>
<xml_tagb>125.1245471</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
Should look like this:
```
<xml_taga>145.33</xml_taga>
<xml_tagb>125.12</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
The... | 2017/08/30 | [
"https://superuser.com/questions/1245929",
"https://superuser.com",
"https://superuser.com/users/766589/"
] | For the answer above (Drew Chapin) - I suppose that's what you looking for:
**Start Menu Tile**
and
**App Accent Color**
HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\S-1-5-\*\*\*\*\*\*\AnyoneRead\Colors | I've noticed that "Automatically pick an accent color from my background" option leads to `HKEY_CURRENT_USER\Software\Microsoft\Windows\DWM\ColorizationColorBalance` getting a value `0xfffffff3` (i.e. it overrides an actual colorization color balance). |
1,245,929 | I want to remove excess decimals from a string using find/replace with regex.
For example :
```
<xml_taga>145.3345542123</xml_taga>
<xml_tagb>125.1245471</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
Should look like this:
```
<xml_taga>145.33</xml_taga>
<xml_tagb>125.12</xml_tagb>
<xml_tagc>42.12</xml_tagc>
```
The... | 2017/08/30 | [
"https://superuser.com/questions/1245929",
"https://superuser.com",
"https://superuser.com/users/766589/"
] | For the answer above (Drew Chapin) - I suppose that's what you looking for:
**Start Menu Tile**
and
**App Accent Color**
HKEY\_LOCAL\_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SystemProtectedUserData\S-1-5-\*\*\*\*\*\*\AnyoneRead\Colors | In the Registry, "Automatically pick an Accent Color from my background" can be enabled/disabled by setting the following key to `0` or `1`:
```powershell
HKCU\Control Panel\Desktop\AutoColorization
```
The Powershell command is:
```powershell
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "AutoColoriza... |
33,315,379 | I started creating a basic roleplaying game, and now I work on the basics. I have a code duplication for creating new characters and for existed character, which is a very bad things. I'll explain my problem - At the beginning a player can choose a Character Class (like fighter) by calling using `CharacterCreator`. I h... | 2015/10/24 | [
"https://Stackoverflow.com/questions/33315379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5252187/"
] | suggestions:
1. CharacterCreator.CharacterCreator(). Method should be verb and describe action, i.e createCharacter
2. look ad design pattern Factory. Your Creator is 'Factory'. The method 'createCharacter' should take parameter characterType. That means, that getting info from System.in should be done in class who in... | Whilst this is not a direct solution to your problem, this should help you in the long run. When it comes to games, especially RPG genre, where you have lots of objects which seem to be similar yet different, inheritance isn't best foundation for design. On top of the example you have, one will also have problems when ... |
58,377,089 | I have a ListView (will move to RecyclerView) with a ListView Item XML layout that contains 3 TextViews inside a LinearLayout. My user preferences allow for left-handed or right-handed use. In which case, I want to change the order of the TextViews in the Item Layout file.
What is the preferred Design Pattern here? Ho... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58377089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2184214/"
] | You can try to have 2 sets of TextViews in one xml layout. Changing the visibility for them will make the trick for left- or right-handed people. But, anyway, this is duplication of view.
Or you can use ConstraintLayout and change ConstraintSet for views programmatically depends on what preference is chosen.
```
val... | You can keep one Layout file and alter them from code(based on the conditions):
left -> `child.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);`
right -> `child.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);` |
58,377,089 | I have a ListView (will move to RecyclerView) with a ListView Item XML layout that contains 3 TextViews inside a LinearLayout. My user preferences allow for left-handed or right-handed use. In which case, I want to change the order of the TextViews in the Item Layout file.
What is the preferred Design Pattern here? Ho... | 2019/10/14 | [
"https://Stackoverflow.com/questions/58377089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2184214/"
] | The duplicate post mentioned by Sandi did what I wanted very easily, and without any duplication of XML files or code to rearrange order. Thanks to everyone that responded and got me here. I just wanted to make sure that I posted what easily worked for me.
I have a TAB with two different ListViews each with their own ... | You can keep one Layout file and alter them from code(based on the conditions):
left -> `child.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);`
right -> `child.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_END);` |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | ~~You can't do it in a `switch` unless you're doing **full** string matching; that's doing **substring** matching.~~ *(This isn't* quite *true, as Sean points out in the comments. See note at the end.)*
If you're happy that your regex at the top is stripping away everything that you don't want to compare in your match... | Another option is to use `input` field of a [regexp match result](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match#Description):
```
str = 'XYZ test';
switch (str) {
case (str.match(/^xyz/) || {}).input:
console.log("Matched a string that starts with 'xyz'");
brea... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | Might be too late and all, but I liked this in case assignment :)
```
function extractParameters(args) {
function getCase(arg, key) {
return arg.match(new RegExp(`${key}=(.*)`)) || {};
}
args.forEach((arg) => {
console.log("arg: " + arg);
let match;
switch (arg) {
... | You could also make use of the default case like this:
```
switch (name) {
case 't':
return filter.getType();
case 'c':
return (filter.getCategory());
default:
if (name.startsWith('f-')) {
return filter.getFeatures({type: name})
... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | Another option is to use `input` field of a [regexp match result](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/match#Description):
```
str = 'XYZ test';
switch (str) {
case (str.match(/^xyz/) || {}).input:
console.log("Matched a string that starts with 'xyz'");
brea... | Might be too late and all, but I liked this in case assignment :)
```
function extractParameters(args) {
function getCase(arg, key) {
return arg.match(new RegExp(`${key}=(.*)`)) || {};
}
args.forEach((arg) => {
console.log("arg: " + arg);
let match;
switch (arg) {
... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | ~~You can't do it in a `switch` unless you're doing **full** string matching; that's doing **substring** matching.~~ *(This isn't* quite *true, as Sean points out in the comments. See note at the end.)*
If you're happy that your regex at the top is stripping away everything that you don't want to compare in your match... | Just use the location.host property
```
switch (location.host) {
case "xxx.local":
settings = ...
break;
case "xxx.dev.yyy.com":
settings = ...
break;
}
``` |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | ~~You can't do it in a `switch` unless you're doing **full** string matching; that's doing **substring** matching.~~ *(This isn't* quite *true, as Sean points out in the comments. See note at the end.)*
If you're happy that your regex at the top is stripping away everything that you don't want to compare in your match... | Might be too late and all, but I liked this in case assignment :)
```
function extractParameters(args) {
function getCase(arg, key) {
return arg.match(new RegExp(`${key}=(.*)`)) || {};
}
args.forEach((arg) => {
console.log("arg: " + arg);
let match;
switch (arg) {
... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | ~~You can't do it in a `switch` unless you're doing **full** string matching; that's doing **substring** matching.~~ *(This isn't* quite *true, as Sean points out in the comments. See note at the end.)*
If you're happy that your regex at the top is stripping away everything that you don't want to compare in your match... | ```
var token = 'spo';
switch(token){
case ( (token.match(/spo/) )? token : undefined ) :
console.log('MATCHED')
break;;
default:
console.log('NO MATCH')
break;;
}
```
--> If the match is made the ternary expression returns the original token
----> The original token is evaluated b... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | ~~You can't do it in a `switch` unless you're doing **full** string matching; that's doing **substring** matching.~~ *(This isn't* quite *true, as Sean points out in the comments. See note at the end.)*
If you're happy that your regex at the top is stripping away everything that you don't want to compare in your match... | You could also make use of the default case like this:
```
switch (name) {
case 't':
return filter.getType();
case 'c':
return (filter.getCategory());
default:
if (name.startsWith('f-')) {
return filter.getFeatures({type: name})
... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | ~~You can't do it in a `switch` unless you're doing **full** string matching; that's doing **substring** matching.~~ *(This isn't* quite *true, as Sean points out in the comments. See note at the end.)*
If you're happy that your regex at the top is stripping away everything that you don't want to compare in your match... | Self-contained version that increases job security:
```
switch((s.match(r)||[null])[0])
```
```js
function identifyCountry(hostname,only_gov=false){
const exceptionRe = /^(?:uk|ac|eu)$/ ; //https://en.wikipedia.org/wiki/Country_code_top-level_domain#ASCII_ccTLDs_not_in_ISO_3166-1
const h = hostname.split('.'... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | Just use the location.host property
```
switch (location.host) {
case "xxx.local":
settings = ...
break;
case "xxx.dev.yyy.com":
settings = ...
break;
}
``` | Might be too late and all, but I liked this in case assignment :)
```
function extractParameters(args) {
function getCase(arg, key) {
return arg.match(new RegExp(`${key}=(.*)`)) || {};
}
args.forEach((arg) => {
console.log("arg: " + arg);
let match;
switch (arg) {
... |
2,896,626 | How do I write a switch for the following conditional?
If the url **contains** "foo", then `settings.base_url` is "bar".
The following is achieving the effect required but I've a feeling this would be more manageable in a switch:
```
var doc_location = document.location.href;
var url_strip = new RegExp("http:\/\/.*\... | 2010/05/24 | [
"https://Stackoverflow.com/questions/2896626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150290/"
] | Just use the location.host property
```
switch (location.host) {
case "xxx.local":
settings = ...
break;
case "xxx.dev.yyy.com":
settings = ...
break;
}
``` | It may be easier. Try to think like this:
* first catch a string between regular characters
* after that find "case"
:
```
// 'www.dev.yyy.com'
// 'xxx.foo.pl'
var url = "xxx.foo.pl";
switch (url.match(/\..*.\./)[0]){
case ".dev.yyy." :
console.log("xxx.dev.yyy.com");break;
case ".some.":
... |
49,750,568 | I am using Node.js Sequelize with MySQL (MariaDB) database.
How to check if JSON field contains specified field and this field have value?
Example of my column `data`:
```
{
"a": true,
"b": true,
}
```
I need to select only rows when `b` is defined AND his value is `true` | 2018/04/10 | [
"https://Stackoverflow.com/questions/49750568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9296111/"
] | You cant specify the end time for the Alarm manager directly. What you can do is manually cancel the alarm manager in your broadcast receiver.In order to cancel the Alarm Manager you need to make sure the pending intent has the same request code as the one which you used to set the alarm. Use the `cancel` method of the... | You want to set repetitive alarm within a time range. you can store the timestamp of the end date in SharedPreferences. Every time the Pending Intent starts you need to check if it crosses the end date limit. If it does, cancel the alarm calling the cancel method alarmManager.cancel(pendingIntent); |
5,695,950 | I am attempting a single page application. I understand the main concept of how mvc is used to some extent and am using a lightweight framework called backbone.js. My issue however is not with backbone. I actually am having a problem figuring out how to structure my user interface. I have a bar at the top of the page w... | 2011/04/17 | [
"https://Stackoverflow.com/questions/5695950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365047/"
] | The best way I can think of is to convert your powerpoint file to Flash.
That way you can easily add it to your webpage, iframe or whatever you like.
Here is a link to some free software that you can use to convert your powerpoint presentations.
[Link to Powerpoint to Flash Convertor](http://www.authorgen.com/author... | [Google Docs Viewer](http://docs.google.com/viewer) is a version of Google Docs that supports being included via iframe, and it supports viewing Powerpoint Presentations. |
5,695,950 | I am attempting a single page application. I understand the main concept of how mvc is used to some extent and am using a lightweight framework called backbone.js. My issue however is not with backbone. I actually am having a problem figuring out how to structure my user interface. I have a bar at the top of the page w... | 2011/04/17 | [
"https://Stackoverflow.com/questions/5695950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/365047/"
] | The best way I can think of is to convert your powerpoint file to Flash.
That way you can easily add it to your webpage, iframe or whatever you like.
Here is a link to some free software that you can use to convert your powerpoint presentations.
[Link to Powerpoint to Flash Convertor](http://www.authorgen.com/author... | You can share it if you upload it to [Skydrive](http://office.live.com/), set the share permissions to Everyone and get the Embed code. Note that this is just another way of converting it to HTML. |
65,282,009 | I found this [code](http://gph.is/1KjihQe)
```
function is_old_post($days = 5) {
$days = (int) $days;
$offset = $days*60*60*24;
if ( get_post_time() < date('U') - $offset )
return true;
return false;
}
if ( is_old_post(10) ) {
// do something if the post is old
} else {
// do somethin... | 2020/12/13 | [
"https://Stackoverflow.com/questions/65282009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11529936/"
] | CSS is just CSS, it won't alter the field's value. You need to capitalize the value yourself:
```js
function sendText(){
var input = document.getElementById("input");
var textarea = document.getElementById("textarea");
textarea.value = "My name is " + capitalize(input.value);
}
function capitalize(str) {
ret... | Maybe you could try this? In this code, I simply changed the `textarea` into `contenteditable` for styling. Next, I made it so it would make a new element.
```js
function sendText(){
var input =document.getElementById("input");
var textarea =document.getElementById("textarea");
textarea.innerHTML ="My name is <... |
724,072 | Randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges equals a cell. That is a decrease in entropy.
How does that not violate second law of thermodynamics?
Certainly if I were to say0that particles randomly formed the letters to the first thousand characters of Romeo and... | 2022/08/21 | [
"https://physics.stackexchange.com/questions/724072",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/335431/"
] | So there are a bunch of different answers to this sort of thing. Maybe the simplest is to just take a more stark example.
One would be, “randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges,” equals a crystal. Surely whatever entropy you associate with a living cell, a c... | You are arising many different points, and it is not easy to give a comprehensive answer. I'll limit my answer to stress a few key points you may have underestimated. They could convey to you a hint about how complex are the underlying issues.
1. It is not clear which entropy you are referring to. Thermodynamic entrop... |
724,072 | Randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges equals a cell. That is a decrease in entropy.
How does that not violate second law of thermodynamics?
Certainly if I were to say0that particles randomly formed the letters to the first thousand characters of Romeo and... | 2022/08/21 | [
"https://physics.stackexchange.com/questions/724072",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/335431/"
] | So there are a bunch of different answers to this sort of thing. Maybe the simplest is to just take a more stark example.
One would be, “randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges,” equals a crystal. Surely whatever entropy you associate with a living cell, a c... | You essentially compare:
1. A volume of a suitable nutrient solution.
2. A volume of solution containing a cell built from the above and waste products, etc.
Both volumes have the same size for all practical purposes and contain the same atoms.
Your claim is that Volume 2 has a lower entropy.
To explore your claim, ... |
724,072 | Randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges equals a cell. That is a decrease in entropy.
How does that not violate second law of thermodynamics?
Certainly if I were to say0that particles randomly formed the letters to the first thousand characters of Romeo and... | 2022/08/21 | [
"https://physics.stackexchange.com/questions/724072",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/335431/"
] | So there are a bunch of different answers to this sort of thing. Maybe the simplest is to just take a more stark example.
One would be, “randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges,” equals a crystal. Surely whatever entropy you associate with a living cell, a c... | There are a couple of ways to interpret the word 'abiogenesis' in your question.
Let's first consider the example of a plant's cell converting carbon dioxide, water, dissolved nitrates and a few other trace minerals (all non-living) into living plant material. This reduces entropy, and can only happen if an even great... |
724,072 | Randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges equals a cell. That is a decrease in entropy.
How does that not violate second law of thermodynamics?
Certainly if I were to say0that particles randomly formed the letters to the first thousand characters of Romeo and... | 2022/08/21 | [
"https://physics.stackexchange.com/questions/724072",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/335431/"
] | The second law applies to *closed systems*. The system you described is *not closed*; as you said yourself- you have to add energy to it from outside the system via a variation in the temperature of the system. That energy is used to perform work on it, and that work goes into changing the entropy content of the system... | You are arising many different points, and it is not easy to give a comprehensive answer. I'll limit my answer to stress a few key points you may have underestimated. They could convey to you a hint about how complex are the underlying issues.
1. It is not clear which entropy you are referring to. Thermodynamic entrop... |
724,072 | Randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges equals a cell. That is a decrease in entropy.
How does that not violate second law of thermodynamics?
Certainly if I were to say0that particles randomly formed the letters to the first thousand characters of Romeo and... | 2022/08/21 | [
"https://physics.stackexchange.com/questions/724072",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/335431/"
] | The second law applies to *closed systems*. The system you described is *not closed*; as you said yourself- you have to add energy to it from outside the system via a variation in the temperature of the system. That energy is used to perform work on it, and that work goes into changing the entropy content of the system... | You essentially compare:
1. A volume of a suitable nutrient solution.
2. A volume of solution containing a cell built from the above and waste products, etc.
Both volumes have the same size for all practical purposes and contain the same atoms.
Your claim is that Volume 2 has a lower entropy.
To explore your claim, ... |
724,072 | Randomly traveling molecules plus random changes in temperature, pressure, acidity, electric charges equals a cell. That is a decrease in entropy.
How does that not violate second law of thermodynamics?
Certainly if I were to say0that particles randomly formed the letters to the first thousand characters of Romeo and... | 2022/08/21 | [
"https://physics.stackexchange.com/questions/724072",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/335431/"
] | The second law applies to *closed systems*. The system you described is *not closed*; as you said yourself- you have to add energy to it from outside the system via a variation in the temperature of the system. That energy is used to perform work on it, and that work goes into changing the entropy content of the system... | There are a couple of ways to interpret the word 'abiogenesis' in your question.
Let's first consider the example of a plant's cell converting carbon dioxide, water, dissolved nitrates and a few other trace minerals (all non-living) into living plant material. This reduces entropy, and can only happen if an even great... |
45,888,832 | Let's say I have a table of the following structure:
```
| name | Type |
| ----------- |:-------------:|
| id | primary |
| word | unique |
| frequency | integer |
```
To this table, I am doing inserts, when a duplicate occurs, I'll update the frequency column. Ps... | 2017/08/25 | [
"https://Stackoverflow.com/questions/45888832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/555983/"
] | As `word` already has a unique index you can try to simplify your query by using [`insert or replace`](http://sqlite.org/lang_insert.html):
```
INSERT OR REPLACE into WORDLIST word1
id = last_insert_rowid()
```
Note that in the conflict case a new rowid/ID is created and the old one is dropped. If you need to keep t... | The UPDATE statement cannot return data. If you need the ID, you need to run a SELECT.
Please note that any INSERT or UPDATE must check the `word` column for duplicates, so the SELECT will entirely run from cache. Any slowdown probably comes from running multiple changes with automatic transactions.
Additionally, rel... |
77,770 | I've never really played the first two "Tony Hawk's Pro Skater" games - I've only began to obsessively play it from the third game onward, but Tony Hawk's Pro Skater HD brought me back to the first two games. So, it might be a newbie question, but here goes: is it possible to chain together street and vert tricks witho... | 2012/07/21 | [
"https://gaming.stackexchange.com/questions/77770",
"https://gaming.stackexchange.com",
"https://gaming.stackexchange.com/users/1720/"
] | Back in Tony Hawk Proskater 1(original game, not hd), you were unable to perform a manual. In the second game, they added the manual, but you are still unable to manual after performing a tick from a pipe. Even if you pressed down/up, up/down before landing off a pipe, you cannot combo that trick. Street tricks/rails c... | Revert was given free in a patch before the DLC was released. You do not need to buy the DLC revert pack in order to receive the code adding revert to the game. |
1,826,004 | Let $S$ be the domain defined by $$S=\{(x,y)|\rm{\exists ~}\theta,\beta,x=\sin^2{\theta}+\sin{\beta},y=\cos^2{\theta}+\cos{\beta}\}$$
find the area of $S$
This is middle school problem,so I think it can be solved without integral methods?
$$(x-\sin^2{\theta})^2+(y-\cos^2{\theta})^2=1$$ | 2016/06/14 | [
"https://math.stackexchange.com/questions/1826004",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/58742/"
] | The answer and procedure are correct.
For a notationally simpler approach, think of the positions as a row of $15$ chairs. There are $\binom{15}{2}$ equally likely ways to choose two chairs to put *Reserved* signs on.
There are $14$ ways to choose two contiguous chairs. Thus the probability that $1$ and $2$ are con... | You can solve this problem also in this way. Consider all permutations of the first fifteen numbers that are $15!$. Now we calculate the probability that $1$ and $2$ are contiguous. Consider the number $'1'$ in the first position and $'2'$ in the second position. All possible permutation of other numbers are $13!$. The... |
68,602,157 | after update android studio to arctic fox, I get this warning. But I dont know what is the efficient way to notify data change.
in my code I'm filling the adapter from network call and then I notifydatasetchange, but the compiler gave me this:
*It will always be more efficient to use more specific change events if you... | 2021/07/31 | [
"https://Stackoverflow.com/questions/68602157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15856359/"
] | It means that if you need to change the whole item list at once in the recyclerview, then use `notifyDataSetChanged()`.
If you need to change the specific item, then it's better to use `notifyItemChanged(position)` so that it won't refresh & rebind the whole dataset which can impact the performance if the dataset is l... | The function `notifyDataSetChanged` essentially considers all data in your dataset has changed. This causes all `VISIBLE` views using this data to be redrawn. This is unnecessary when only some data has changed.
You need to identify the position that data has change and notify your adapter to update only those items.
... |
68,602,157 | after update android studio to arctic fox, I get this warning. But I dont know what is the efficient way to notify data change.
in my code I'm filling the adapter from network call and then I notifydatasetchange, but the compiler gave me this:
*It will always be more efficient to use more specific change events if you... | 2021/07/31 | [
"https://Stackoverflow.com/questions/68602157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15856359/"
] | It means that if you need to change the whole item list at once in the recyclerview, then use `notifyDataSetChanged()`.
If you need to change the specific item, then it's better to use `notifyItemChanged(position)` so that it won't refresh & rebind the whole dataset which can impact the performance if the dataset is l... | It's just a suggestion by Android studio to update data in RecyclerView.
This advice to notify change in the Recycler view items using particular postion update only like, notifyItemChanged(int), notifyItemInserted(int), notifyItemRemoved(int) ,notifyItemRangeChanged(int, int), notifyItemRangeInserted(int, int), notif... |
68,602,157 | after update android studio to arctic fox, I get this warning. But I dont know what is the efficient way to notify data change.
in my code I'm filling the adapter from network call and then I notifydatasetchange, but the compiler gave me this:
*It will always be more efficient to use more specific change events if you... | 2021/07/31 | [
"https://Stackoverflow.com/questions/68602157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15856359/"
] | The function `notifyDataSetChanged` essentially considers all data in your dataset has changed. This causes all `VISIBLE` views using this data to be redrawn. This is unnecessary when only some data has changed.
You need to identify the position that data has change and notify your adapter to update only those items.
... | It's just a suggestion by Android studio to update data in RecyclerView.
This advice to notify change in the Recycler view items using particular postion update only like, notifyItemChanged(int), notifyItemInserted(int), notifyItemRemoved(int) ,notifyItemRangeChanged(int, int), notifyItemRangeInserted(int, int), notif... |
55,840,485 | I have made a script, that reads my Instagram profile information by downloading the pagecontent, and then searching for strings in it.
It worked very well, but some months later, the script is sooo slow and results in a white screen. As you can see, I am trying to display 8 values from my Instagram profile. But only i... | 2019/04/25 | [
"https://Stackoverflow.com/questions/55840485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11408094/"
] | I found a solution using curl methods:
```
function curlGetContents($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0... | >
> No, `preg_match` is not a slow function.
>
>
>
There should be some other issues. I'm not really sure, if this might solve your problem, maybe add `memory_limit` to `-1` such as:
```
// error_reporting(E_ALL);
error_reporting(0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '-1');
set_time_limi... |
313,910 | I tried to install Ubuntu with an usb stick. I used unetbootin. Everytime I tried it, there was an error:
"invalid or corrupt kernel"
I tried with several sticks. What could be the problem?
Greetings from Germany
Michael | 2013/06/28 | [
"https://askubuntu.com/questions/313910",
"https://askubuntu.com",
"https://askubuntu.com/users/171003/"
] | If you used that stick to deploy other distrib,
try to clean older install files on the USB stick before applying the ISO (
I personally got problem with old files of previous installation made by Unetbootin). | To install from a USB stick, just:
1. Download [Rufus](http://rufus.akeo.ie/)
2. Run Rufus and select your USB stick as the device
3. Click Start
4. Once Rufus is done, reboot to BIOS on the computer you wish to install on
5. Change the boot order to USB first
6. Plug in your USB if it is not still plugged in and cold... |
3,695 | I just got the lens. I know it doesn't autofocus on my camera body because it doesn't have built in motor but at least it should be usable in manual mode right? | 2010/10/02 | [
"https://photo.stackexchange.com/questions/3695",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/128/"
] | I'm assuming you're talking about the autofocus indicator light in the bottom left of the screen.
When I'm using a manual focus lens on my D3000, this still lights up when the picture is in focus under the selected AF sensor. If I'm very out of focus, or the sensor is over something with no contrast to detect, then th... | The Sigma lens should have an AF/MF selector - if you set it to Manual Focus, your lens should work as usual, because that confirms to the camera body that you're aware that you have to shoot with manual focusing.
If that doesn't work, try flicking the switch back and forth a couple of times; it may be that the sensor... |
3,695 | I just got the lens. I know it doesn't autofocus on my camera body because it doesn't have built in motor but at least it should be usable in manual mode right? | 2010/10/02 | [
"https://photo.stackexchange.com/questions/3695",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/128/"
] | Same here. Got same problem. Pretty sure that the Sigma AF 24-70 F2.8 EX DG has a bug that it won't work with D5000. And it might not work with other non-motor body, e.g., D3000, D3100, etc. However, when used with cheap extension tube to take macro, it works. Damned strange. | I'm assuming you're talking about the autofocus indicator light in the bottom left of the screen.
When I'm using a manual focus lens on my D3000, this still lights up when the picture is in focus under the selected AF sensor. If I'm very out of focus, or the sensor is over something with no contrast to detect, then th... |
3,695 | I just got the lens. I know it doesn't autofocus on my camera body because it doesn't have built in motor but at least it should be usable in manual mode right? | 2010/10/02 | [
"https://photo.stackexchange.com/questions/3695",
"https://photo.stackexchange.com",
"https://photo.stackexchange.com/users/128/"
] | Same here. Got same problem. Pretty sure that the Sigma AF 24-70 F2.8 EX DG has a bug that it won't work with D5000. And it might not work with other non-motor body, e.g., D3000, D3100, etc. However, when used with cheap extension tube to take macro, it works. Damned strange. | The Sigma lens should have an AF/MF selector - if you set it to Manual Focus, your lens should work as usual, because that confirms to the camera body that you're aware that you have to shoot with manual focusing.
If that doesn't work, try flicking the switch back and forth a couple of times; it may be that the sensor... |
66,059,272 | I need to calculate the `Prevdate` as shown below without using CTE or temp tables. I tried using lead it applied for only one row above. Also the number of record for each group might vary. Can anyone suggest a solution here?
Below is the sample data:
```
create table #Sampledata
(
id int
,groupno int
,Date date
)
... | 2021/02/05 | [
"https://Stackoverflow.com/questions/66059272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15150311/"
] | seems you need the sum of the table's union
```
select productId, sum(usedQuantity) usedQuantity
from (
select productId, usedQuantity
from table_one
union all
select productId, usedQuantity
from table_two
union all
select productId, usedQuantity
from table_three ) t
group by productId
``` | try below query, please..
```
select t1.ProductId, Sum(isnull(t1.Quantity,0)+isnull(t2.Quantity,0)+isnull(t3.Quanity,0)) from table1 t1 left join table2 t2 on t1.ProductId=t2,ProductId left join table3 t3 on t1.ProductId=t3.ProductId
group by t1.ProductId
``` |
66,059,272 | I need to calculate the `Prevdate` as shown below without using CTE or temp tables. I tried using lead it applied for only one row above. Also the number of record for each group might vary. Can anyone suggest a solution here?
Below is the sample data:
```
create table #Sampledata
(
id int
,groupno int
,Date date
)
... | 2021/02/05 | [
"https://Stackoverflow.com/questions/66059272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15150311/"
] | seems you need the sum of the table's union
```
select productId, sum(usedQuantity) usedQuantity
from (
select productId, usedQuantity
from table_one
union all
select productId, usedQuantity
from table_two
union all
select productId, usedQuantity
from table_three ) t
group by productId
``` | Use [union all](https://dev.mysql.com/doc/refman/8.0/en/union.html) and [group by](https://dev.mysql.com/doc/refman/8.0/en/group-by-modifiers.html) to get the [aggregated sum()](https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_sum) of a column grouped:
Create tables:
```
CREATE TABLE IF NOT E... |
1,574,512 | I know the code is missing (Someone will give negative numbers). But I only want to know how do you solve constructor injection in this situation?
```
class PresenterFactory
{
public:
template<class TModel>
AbstractPresenter<TModel>*
GetFor(AbstractView<TModel> * view)
{
return new PresenterA(view,... | 2009/10/15 | [
"https://Stackoverflow.com/questions/1574512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/129428/"
] | Why not to use two constructors?
```
// constructor with one argument
ViewA(AbstractPresenter<ModelA> *presenter) : AbstractView<ModelA> (presenter)
{
}
// constructor without arguments
ViewA() : AbstractView<ModelA>(factory.GetFor<ModelA>(this))
{
}
```
By the way, `this` pointer is valid only within nonstatic mem... | ```
public class ConstEx {
String name;
Integer id;
public ConstEx(String name, Integer id) {
System.out.println("--------Constructor Firs -------");
}
public ConstEx(Integer id,String name)
{
System.out.println("-----Second Constructor--------");
}
}
with th Following C... |
13,506,125 | I've worked with Java EE recently and like the idea of struts.xml where I can handle the redirection to pages based on return string from action classes.
In PHP, in my new under-development site, I am trying to follow the MVC standards without an MVC framework used from the internet. So I create the controllers, model... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13506125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464885/"
] | That is correct,
*--password-file* is only applicable when connecting ***to*** a rsync daemon.
You probably haven't set it in the daemon itself though, the password you set and the one you use during that call must match.
Edit /etc/rsyncd.secrets, and set the owner/group of that file to root:root with world readi... | ```
rsync -arv -e \
"sshpass -f '/your/pass.txt' ssh -o StrictHostKeyChecking=no" \
--progress /your/source id@IP:/your/destination
```
Maybe you have to install "sshpass" if you not. |
13,506,125 | I've worked with Java EE recently and like the idea of struts.xml where I can handle the redirection to pages based on return string from action classes.
In PHP, in my new under-development site, I am trying to follow the MVC standards without an MVC framework used from the internet. So I create the controllers, model... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13506125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464885/"
] | That is correct,
*--password-file* is only applicable when connecting ***to*** a rsync daemon.
You probably haven't set it in the daemon itself though, the password you set and the one you use during that call must match.
Edit /etc/rsyncd.secrets, and set the owner/group of that file to root:root with world readi... | After trying a while, I got this to work. Since Im copying from my live server (and routers data) to my local server in my laptop as backup user no problem with password been unencrypted, its secured wired on my laptop at home. First you need to install sshpass if Centos with `yum install sshpass` then create a user ba... |
13,506,125 | I've worked with Java EE recently and like the idea of struts.xml where I can handle the redirection to pages based on return string from action classes.
In PHP, in my new under-development site, I am trying to follow the MVC standards without an MVC framework used from the internet. So I create the controllers, model... | 2012/11/22 | [
"https://Stackoverflow.com/questions/13506125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/464885/"
] | After trying a while, I got this to work. Since Im copying from my live server (and routers data) to my local server in my laptop as backup user no problem with password been unencrypted, its secured wired on my laptop at home. First you need to install sshpass if Centos with `yum install sshpass` then create a user ba... | ```
rsync -arv -e \
"sshpass -f '/your/pass.txt' ssh -o StrictHostKeyChecking=no" \
--progress /your/source id@IP:/your/destination
```
Maybe you have to install "sshpass" if you not. |
8,040,721 | After completing the following code the value of "result1" and "result2" variables (measured width of string) are the same, despite the fact that the "font1" is regular and the "font2" is bold. Interestingly, this error appears for the font "Times New Roman" and "Arial". For example for font "Calibri" returned values ... | 2011/11/07 | [
"https://Stackoverflow.com/questions/8040721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1034240/"
] | I just tried it with different strings and the width does change. I think it just so happens that "WWW" has the same length with/without the bold style. Just try it in an editor and you'll see it's the same size. | Actually draw it in the OnPaint() method and you'll see why:
 |
34,413,794 | I have the following object:
```
var myObj = {
"4":{//The key is a number String.
id:4,name:aaaa
}
"1":{
id:1,name:a
}
"2":{
id:2,name:aa
}
"3":{
... | 2015/12/22 | [
"https://Stackoverflow.com/questions/34413794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5346752/"
] | I don't think any manipulation will do any real performance gain.
Also, since JavaScript works on "reference to-" approach, the real hit here is to create an array and sort it, since you don't really deep-copy the objects.
it shouldn't be real performance hit since the array is small in your example.
in this case... | First of all your JSON is not a valid JSON, Use `,` and `""`. To achieve your task use [Array.prototype.map](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
```js
var myObj = {
"4":{//The key is a number String.
id:4,name:"aaaa"
... |
34,413,794 | I have the following object:
```
var myObj = {
"4":{//The key is a number String.
id:4,name:aaaa
}
"1":{
id:1,name:a
}
"2":{
id:2,name:aa
}
"3":{
... | 2015/12/22 | [
"https://Stackoverflow.com/questions/34413794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5346752/"
] | I don't think any manipulation will do any real performance gain.
Also, since JavaScript works on "reference to-" approach, the real hit here is to create an array and sort it, since you don't really deep-copy the objects.
it shouldn't be real performance hit since the array is small in your example.
in this case... | Just sort the keys:
```js
var myObj = { "4": { id: 4, name: 'aaaa' }, "1": { id: 1, name: 'a' }, "2": { id: 2, name: 'aa' }, "3": { id: 3, name: 'aaa' } },
result = Object.keys(myObj).map(Number).sort(function (a, b) {
return a - b;
}).map(function (k) {
return myObj[k];
});
document... |
34,413,794 | I have the following object:
```
var myObj = {
"4":{//The key is a number String.
id:4,name:aaaa
}
"1":{
id:1,name:a
}
"2":{
id:2,name:aa
}
"3":{
... | 2015/12/22 | [
"https://Stackoverflow.com/questions/34413794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5346752/"
] | I don't think any manipulation will do any real performance gain.
Also, since JavaScript works on "reference to-" approach, the real hit here is to create an array and sort it, since you don't really deep-copy the objects.
it shouldn't be real performance hit since the array is small in your example.
in this case... | Using lodash:
```
var sortedById = _.sortBy(_.values(myObj), 'id');
``` |
63,200,026 | For something to be abstract means to hide data. I don't understand how abstract methods hide any data from the user. An argument can be made that abstract methods require no implementation but in the grand scheme of a class hierarchy that does not hide anything from the user. Abstract methods seem to just force implem... | 2020/07/31 | [
"https://Stackoverflow.com/questions/63200026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | >
> For something to be abstract means to hide data.
>
>
>
I think your confusion comes from this (wrong) premise.
Being *abstract* is better understood as having no implementation. It's the opposite of *concrete* (i.e. with implementation).
See the [abstract type](https://en.wikipedia.org/wiki/Abstract_type) ar... | I think when you use the actual definition of abstract, the nomenclature of Java abstract methods makes more sense:
>
> existing in thought or as an idea but not having a physical or concrete existence
>
>
>
This makes sense since Java abstract methods are method definitions without implementations. |
63,200,026 | For something to be abstract means to hide data. I don't understand how abstract methods hide any data from the user. An argument can be made that abstract methods require no implementation but in the grand scheme of a class hierarchy that does not hide anything from the user. Abstract methods seem to just force implem... | 2020/07/31 | [
"https://Stackoverflow.com/questions/63200026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Although abstract classes and methods can be used for data hiding, "abstract" does not mean "hide data". The [Java language specification](https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html) defines abstract classes and methods like this:
>
> An abstract class is a class that is **incomplete**, or to be con... | >
> For something to be abstract means to hide data.
>
>
>
I think your confusion comes from this (wrong) premise.
Being *abstract* is better understood as having no implementation. It's the opposite of *concrete* (i.e. with implementation).
See the [abstract type](https://en.wikipedia.org/wiki/Abstract_type) ar... |
63,200,026 | For something to be abstract means to hide data. I don't understand how abstract methods hide any data from the user. An argument can be made that abstract methods require no implementation but in the grand scheme of a class hierarchy that does not hide anything from the user. Abstract methods seem to just force implem... | 2020/07/31 | [
"https://Stackoverflow.com/questions/63200026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | >
> For something to be abstract means to hide data.
>
>
>
I think your confusion comes from this (wrong) premise.
Being *abstract* is better understood as having no implementation. It's the opposite of *concrete* (i.e. with implementation).
See the [abstract type](https://en.wikipedia.org/wiki/Abstract_type) ar... | The term **abstract** implies that something isn't tangible but more of a concept. Whereas an implementation is an actual thing that can be used. The word **concrete** is used to describe the latter.
**Abstract classes** are classes that have a **mixture** of zero or more implemented and zero or more non implemented m... |
63,200,026 | For something to be abstract means to hide data. I don't understand how abstract methods hide any data from the user. An argument can be made that abstract methods require no implementation but in the grand scheme of a class hierarchy that does not hide anything from the user. Abstract methods seem to just force implem... | 2020/07/31 | [
"https://Stackoverflow.com/questions/63200026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Although abstract classes and methods can be used for data hiding, "abstract" does not mean "hide data". The [Java language specification](https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html) defines abstract classes and methods like this:
>
> An abstract class is a class that is **incomplete**, or to be con... | I think when you use the actual definition of abstract, the nomenclature of Java abstract methods makes more sense:
>
> existing in thought or as an idea but not having a physical or concrete existence
>
>
>
This makes sense since Java abstract methods are method definitions without implementations. |
63,200,026 | For something to be abstract means to hide data. I don't understand how abstract methods hide any data from the user. An argument can be made that abstract methods require no implementation but in the grand scheme of a class hierarchy that does not hide anything from the user. Abstract methods seem to just force implem... | 2020/07/31 | [
"https://Stackoverflow.com/questions/63200026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I think when you use the actual definition of abstract, the nomenclature of Java abstract methods makes more sense:
>
> existing in thought or as an idea but not having a physical or concrete existence
>
>
>
This makes sense since Java abstract methods are method definitions without implementations. | The term **abstract** implies that something isn't tangible but more of a concept. Whereas an implementation is an actual thing that can be used. The word **concrete** is used to describe the latter.
**Abstract classes** are classes that have a **mixture** of zero or more implemented and zero or more non implemented m... |
63,200,026 | For something to be abstract means to hide data. I don't understand how abstract methods hide any data from the user. An argument can be made that abstract methods require no implementation but in the grand scheme of a class hierarchy that does not hide anything from the user. Abstract methods seem to just force implem... | 2020/07/31 | [
"https://Stackoverflow.com/questions/63200026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Although abstract classes and methods can be used for data hiding, "abstract" does not mean "hide data". The [Java language specification](https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html) defines abstract classes and methods like this:
>
> An abstract class is a class that is **incomplete**, or to be con... | The term **abstract** implies that something isn't tangible but more of a concept. Whereas an implementation is an actual thing that can be used. The word **concrete** is used to describe the latter.
**Abstract classes** are classes that have a **mixture** of zero or more implemented and zero or more non implemented m... |
2,555,383 | I've been writing a lot of one-off SQL queries to return exactly what a certain page needs and no more.
I could reuse existing queries and issue a number of SQL requests linear to the number of records on the page. As an example, I have a query to return People and a query to return Job Details for a person. To return... | 2010/03/31 | [
"https://Stackoverflow.com/questions/2555383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208066/"
] | Architectural decisions such as this one always depend on the exact circumstances. But as a general rule, loops over one dataset in order to retreive additional data should always be avoided. A join normally has a lot better performance - especially if there is network latency between the web server and the DB server.
... | Write new queries for efficiency, and compare the results against the tried and true queries for testing, in order to maintain quality.
If the deadline is short, you'd pick quality over efficiency and use the tried and true ones, since they'll save you from development time and testing. |
2,555,383 | I've been writing a lot of one-off SQL queries to return exactly what a certain page needs and no more.
I could reuse existing queries and issue a number of SQL requests linear to the number of records on the page. As an example, I have a query to return People and a query to return Job Details for a person. To return... | 2010/03/31 | [
"https://Stackoverflow.com/questions/2555383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208066/"
] | If they are available for your programming environment I would consider looking into using O/RM solutions, then you don't have to write much SQL at all, if any. | Write new queries for efficiency, and compare the results against the tried and true queries for testing, in order to maintain quality.
If the deadline is short, you'd pick quality over efficiency and use the tried and true ones, since they'll save you from development time and testing. |
2,555,383 | I've been writing a lot of one-off SQL queries to return exactly what a certain page needs and no more.
I could reuse existing queries and issue a number of SQL requests linear to the number of records on the page. As an example, I have a query to return People and a query to return Job Details for a person. To return... | 2010/03/31 | [
"https://Stackoverflow.com/questions/2555383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208066/"
] | Both. Every decision you make is going to be selecting an appropriate path depending upon requirements.
For example, in most systems, typically you will have two classes of views - views which provide base layers (some joins within a subsystem, minimal work, no aggregations, minimal data masking (no ISNULL(datecol, '1... | Write new queries for efficiency, and compare the results against the tried and true queries for testing, in order to maintain quality.
If the deadline is short, you'd pick quality over efficiency and use the tried and true ones, since they'll save you from development time and testing. |
2,555,383 | I've been writing a lot of one-off SQL queries to return exactly what a certain page needs and no more.
I could reuse existing queries and issue a number of SQL requests linear to the number of records on the page. As an example, I have a query to return People and a query to return Job Details for a person. To return... | 2010/03/31 | [
"https://Stackoverflow.com/questions/2555383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208066/"
] | Architectural decisions such as this one always depend on the exact circumstances. But as a general rule, loops over one dataset in order to retreive additional data should always be avoided. A join normally has a lot better performance - especially if there is network latency between the web server and the DB server.
... | If they are available for your programming environment I would consider looking into using O/RM solutions, then you don't have to write much SQL at all, if any. |
2,555,383 | I've been writing a lot of one-off SQL queries to return exactly what a certain page needs and no more.
I could reuse existing queries and issue a number of SQL requests linear to the number of records on the page. As an example, I have a query to return People and a query to return Job Details for a person. To return... | 2010/03/31 | [
"https://Stackoverflow.com/questions/2555383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208066/"
] | Architectural decisions such as this one always depend on the exact circumstances. But as a general rule, loops over one dataset in order to retreive additional data should always be avoided. A join normally has a lot better performance - especially if there is network latency between the web server and the DB server.
... | Both. Every decision you make is going to be selecting an appropriate path depending upon requirements.
For example, in most systems, typically you will have two classes of views - views which provide base layers (some joins within a subsystem, minimal work, no aggregations, minimal data masking (no ISNULL(datecol, '1... |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | If you are trying to work with in-memory databases and Spring, there is a new [`jdbc` namespace for Spring 3](http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-embedded-database-support) that makes working with embedded databases very easy.
The best part is that it acts as... | In the tutorial you link to, one of the ways of setting things up is this (after obvious correction):
>
> * In-memory from a script: `jdbc:hsqldb:file:path-to-file`
>
>
>
I think that that would appear to be relevant. I suggest replacing `path-to-file` with something that looks like a fully-qualified filename… |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | Nicholas answer is perfectly fine, but you can use `jdbc` namespace to initialize external database as well:
```xml
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/DS"/>
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:/META-INF/database/init.sql"/>
</jdbc:initia... | In the tutorial you link to, one of the ways of setting things up is this (after obvious correction):
>
> * In-memory from a script: `jdbc:hsqldb:file:path-to-file`
>
>
>
I think that that would appear to be relevant. I suggest replacing `path-to-file` with something that looks like a fully-qualified filename… |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | In the tutorial you link to, one of the ways of setting things up is this (after obvious correction):
>
> * In-memory from a script: `jdbc:hsqldb:file:path-to-file`
>
>
>
I think that that would appear to be relevant. I suggest replacing `path-to-file` with something that looks like a fully-qualified filename… | With embedded-database we would only be able to connect to the database from the same JVM. If we have two JVMs, for performance or other constraints, we can:
1. Instead of using an embedded-database, you can use the datasource suggested in [this answer](https://stackoverflow.com/questions/17327853/specify-url-of-jdbce... |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | If you are trying to work with in-memory databases and Spring, there is a new [`jdbc` namespace for Spring 3](http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-embedded-database-support) that makes working with embedded databases very easy.
The best part is that it acts as... | You could get around this by creating a subclass of [`BasicDataSource`](https://commons.apache.org/dbcp/api-1.4/org/apache/commons/dbcp/BasicDataSource.html) with getters/setters for two new properties, `initExecuteSqlFile` and `destroyExecuteSqlFile`, that can have a comma-seperated list of SQL files to execute. The s... |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | Nicholas answer is perfectly fine, but you can use `jdbc` namespace to initialize external database as well:
```xml
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/DS"/>
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:/META-INF/database/init.sql"/>
</jdbc:initia... | You could get around this by creating a subclass of [`BasicDataSource`](https://commons.apache.org/dbcp/api-1.4/org/apache/commons/dbcp/BasicDataSource.html) with getters/setters for two new properties, `initExecuteSqlFile` and `destroyExecuteSqlFile`, that can have a comma-seperated list of SQL files to execute. The s... |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | You could get around this by creating a subclass of [`BasicDataSource`](https://commons.apache.org/dbcp/api-1.4/org/apache/commons/dbcp/BasicDataSource.html) with getters/setters for two new properties, `initExecuteSqlFile` and `destroyExecuteSqlFile`, that can have a comma-seperated list of SQL files to execute. The s... | With embedded-database we would only be able to connect to the database from the same JVM. If we have two JVMs, for performance or other constraints, we can:
1. Instead of using an embedded-database, you can use the datasource suggested in [this answer](https://stackoverflow.com/questions/17327853/specify-url-of-jdbce... |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | If you are trying to work with in-memory databases and Spring, there is a new [`jdbc` namespace for Spring 3](http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-embedded-database-support) that makes working with embedded databases very easy.
The best part is that it acts as... | Nicholas answer is perfectly fine, but you can use `jdbc` namespace to initialize external database as well:
```xml
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/DS"/>
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:/META-INF/database/init.sql"/>
</jdbc:initia... |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | If you are trying to work with in-memory databases and Spring, there is a new [`jdbc` namespace for Spring 3](http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jdbc.html#jdbc-embedded-database-support) that makes working with embedded databases very easy.
The best part is that it acts as... | With embedded-database we would only be able to connect to the database from the same JVM. If we have two JVMs, for performance or other constraints, we can:
1. Instead of using an embedded-database, you can use the datasource suggested in [this answer](https://stackoverflow.com/questions/17327853/specify-url-of-jdbce... |
9,329,283 | I am attempting to do unit testing of my DAO (using Spring and Hibernate). I am using HSQLDB per [this](http://www.informit.com/guides/content.aspx?g=java&seqNum=507) tutorial. The tutorial states that the in-memory HSQLDB database can be initialized using a SQL script but I cannot find information on how to do so in S... | 2012/02/17 | [
"https://Stackoverflow.com/questions/9329283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905762/"
] | Nicholas answer is perfectly fine, but you can use `jdbc` namespace to initialize external database as well:
```xml
<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/DS"/>
<jdbc:initialize-database data-source="dataSource">
<jdbc:script location="classpath:/META-INF/database/init.sql"/>
</jdbc:initia... | With embedded-database we would only be able to connect to the database from the same JVM. If we have two JVMs, for performance or other constraints, we can:
1. Instead of using an embedded-database, you can use the datasource suggested in [this answer](https://stackoverflow.com/questions/17327853/specify-url-of-jdbce... |
13,653,411 | I'm getting multiple erros with this part of my program. What it basically does is read input from an unorganized file, PersonnelInfo.txt, and it sorts it into an array in the EmployeeInfo class (not posted because I don't believe the problem lies in that class, if you guys want, I will post it for reference).
After ... | 2012/11/30 | [
"https://Stackoverflow.com/questions/13653411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1767263/"
] | /usr/local/mysql/data
try it here | phpMyAdmin does not write any database files. It is a php client application which accesses a MySQL server.
On OSX the MySQL server creates its data files in /usr/local/mysql/data as far as I know.
**1. Stop your MySQL server**
```
sudo /usr/local/bin/mysql.server stop
```
**2. Remove new data files**
sudo mv /us... |
26,971,317 | I have many files and I want to add thems in to a new zipfile.
I used this nameespace :
using Ionic.Zip
here my codes:
```
for (int i = 0; i < deliveryList.Count; i++)
{
// System.IO.MemoryStream st = new System.IO.MemoryStream(x.Data.Data);
zip.AddE... | 2014/11/17 | [
"https://Stackoverflow.com/questions/26971317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407309/"
] | These exclamation marks are denoting warnings. This sign will appear on the packages which contains classes with warnings (like unused imports, unused variables, using raw types, etc.). You can reach the class containing warnings and have a look what's causing these warnings. Once found, depending on the warning, you c... | In Eclipse, these are often caused by Java compiler warnings, and can also be caused by various validation warnings (for XML files, JSP files, etc.)
To see the warning messages, go to Window => Show View => Problems.
This is a fairly comprehensive list from the Eclipse documentation. If anyone knows of another list ... |
26,971,317 | I have many files and I want to add thems in to a new zipfile.
I used this nameespace :
using Ionic.Zip
here my codes:
```
for (int i = 0; i < deliveryList.Count; i++)
{
// System.IO.MemoryStream st = new System.IO.MemoryStream(x.Data.Data);
zip.AddE... | 2014/11/17 | [
"https://Stackoverflow.com/questions/26971317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407309/"
] | These exclamation marks are denoting warnings. This sign will appear on the packages which contains classes with warnings (like unused imports, unused variables, using raw types, etc.). You can reach the class containing warnings and have a look what's causing these warnings. Once found, depending on the warning, you c... | Goto windows>showview>and select problems
[](https://i.stack.imgur.com/0pqKG.png)
This will show the details:
[](https://i.stack.imgur.com/DDqBI.png) |
26,971,317 | I have many files and I want to add thems in to a new zipfile.
I used this nameespace :
using Ionic.Zip
here my codes:
```
for (int i = 0; i < deliveryList.Count; i++)
{
// System.IO.MemoryStream st = new System.IO.MemoryStream(x.Data.Data);
zip.AddE... | 2014/11/17 | [
"https://Stackoverflow.com/questions/26971317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407309/"
] | In Eclipse, these are often caused by Java compiler warnings, and can also be caused by various validation warnings (for XML files, JSP files, etc.)
To see the warning messages, go to Window => Show View => Problems.
This is a fairly comprehensive list from the Eclipse documentation. If anyone knows of another list ... | Goto windows>showview>and select problems
[](https://i.stack.imgur.com/0pqKG.png)
This will show the details:
[](https://i.stack.imgur.com/DDqBI.png) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.