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
1,671
Are there any tools specifically designed for compressing floating point scientific data? If a function is smooth, there's obviously a lot of correlation between the numbers representing that function, so the data should compress well. Zipping/gzipping binary floating point data doesn't compress it that well though. I...
2012/03/17
[ "https://scicomp.stackexchange.com/questions/1671", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/605/" ]
Arguably, you can interpret regression or transform methods (Fourier transform, Chebyshev transform) methods as "compression" for time-series or 1D function data. Remez's algorithm would be another candidate. In that case, using something like regression, FFT, or Chebyshev via FFT would work for your purposes. That sai...
> > If a function is smooth, there's obviously a lot of correlation between the numbers representing that function, so the data should compress well. > > > Perhaps the format you require need to store just the offsets from value to neighboring value. Alternately, maybe you could make use of the frequency domain, ...
1,671
Are there any tools specifically designed for compressing floating point scientific data? If a function is smooth, there's obviously a lot of correlation between the numbers representing that function, so the data should compress well. Zipping/gzipping binary floating point data doesn't compress it that well though. I...
2012/03/17
[ "https://scicomp.stackexchange.com/questions/1671", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/605/" ]
We have been using [ZFP](https://computation.llnl.gov/projects/floating-point-compression "ZFP") with HDF5 for our medical imaging data. It is made for lossy, floating point compression. We're running it on literally everything, and have more than 40TB of data stored (and being used!). It is fast enough to save our d...
This is one of the first results that come up when you search in google. My use case is whole slide images (i.e. huge TIFF files with JPEG compression) over which I had to perform some post-processing and save the results. So I have huge images (e.g. 100000 x 90000 pixels), 2 channels w/. float16 information. For my s...
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
There is a new index method called [`difference`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Index.difference.html). It returns the original columns, with the columns passed as argument removed. Here, the result is used to remove columns `B` and `D` from `df`: ``` df2 = df[df.columns.difference(['B...
You don't really need to convert that into a set: ``` cols = [col for col in df.columns if col not in ['B', 'D']] df2 = df[cols] ```
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
There is a new index method called [`difference`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Index.difference.html). It returns the original columns, with the columns passed as argument removed. Here, the result is used to remove columns `B` and `D` from `df`: ``` df2 = df[df.columns.difference(['B...
You have 4 columns A,B,C,D Here is a better way to select the columns you need for the new dataframe:- ``` df2 = df1[['A','D']] ``` if you wish to use column numbers instead, use:- ``` df2 = df1[[0,3]] ```
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
You have 4 columns A,B,C,D Here is a better way to select the columns you need for the new dataframe:- ``` df2 = df1[['A','D']] ``` if you wish to use column numbers instead, use:- ``` df2 = df1[[0,3]] ```
Here's how to create a *copy* of a `DataFrame` excluding a list of columns: ``` df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD')) df2 = df.drop(['B', 'D'], axis=1) ``` But be careful! You mention views in your question, suggesting that if you changed `df`, you'd want `df2` to change too. (Like a view ...
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
**Another option, without dropping or filtering in a loop:** ``` import numpy as np import pandas as pd # Create a dataframe with columns A,B,C and D df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD')) # include the columns you want df[df.columns[df.columns.isin(['A', 'B'])]] # or more simply include c...
You have 4 columns A,B,C,D Here is a better way to select the columns you need for the new dataframe:- ``` df2 = df1[['A','D']] ``` if you wish to use column numbers instead, use:- ``` df2 = df1[[0,3]] ```
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
There is a new index method called [`difference`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Index.difference.html). It returns the original columns, with the columns passed as argument removed. Here, the result is used to remove columns `B` and `D` from `df`: ``` df2 = df[df.columns.difference(['B...
Here's how to create a *copy* of a `DataFrame` excluding a list of columns: ``` df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD')) df2 = df.drop(['B', 'D'], axis=1) ``` But be careful! You mention views in your question, suggesting that if you changed `df`, you'd want `df2` to change too. (Like a view ...
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
Also have a look into the built-in [`DataFrame.filter`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.filter.html) function. Minimalistic but greedy approach (sufficient for the given df): ``` df.filter(regex="[^BD]") ``` Conservative/lazy approach (exact matches only): ```py df.filter(reg...
In a similar vein, when reading a file, one may wish to exclude columns upfront, rather than wastefully reading unwanted data into memory and later discarding them. As of pandas 0.20.0, [`usecols` now accepts callables](https://pandas-docs.github.io/pandas-docs-travis/generated/pandas.read_csv.html?highlight=read_csv#...
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
You don't really need to convert that into a set: ``` cols = [col for col in df.columns if col not in ['B', 'D']] df2 = df[cols] ```
You have 4 columns A,B,C,D Here is a better way to select the columns you need for the new dataframe:- ``` df2 = df1[['A','D']] ``` if you wish to use column numbers instead, use:- ``` df2 = df1[[0,3]] ```
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
There is a new index method called [`difference`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Index.difference.html). It returns the original columns, with the columns passed as argument removed. Here, the result is used to remove columns `B` and `D` from `df`: ``` df2 = df[df.columns.difference(['B...
In a similar vein, when reading a file, one may wish to exclude columns upfront, rather than wastefully reading unwanted data into memory and later discarding them. As of pandas 0.20.0, [`usecols` now accepts callables](https://pandas-docs.github.io/pandas-docs-travis/generated/pandas.read_csv.html?highlight=read_csv#...
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
You have 4 columns A,B,C,D Here is a better way to select the columns you need for the new dataframe:- ``` df2 = df1[['A','D']] ``` if you wish to use column numbers instead, use:- ``` df2 = df1[[0,3]] ```
You just need to convert your `set` to a `list` ``` import pandas as pd df = pd.DataFrame(np.random.randn(100, 4), columns=list('ABCD')) my_cols = set(df.columns) my_cols.remove('B') my_cols.remove('D') my_cols = list(my_cols) df2 = df[my_cols] ```
14,940,762
I have a DynamicJsonObject like: ``` var obj = new DynamicJsonObject(); obj.Field1 = "field1"; obj.Field2 = "field2"; ``` I need the obj's json string. I tried using `JavaScriptSerializer`: ``` var json = JavaScriptSerializer.Serialize(obj); ``` But the result is always `json == '{}'` Is there a workaround for t...
2013/02/18
[ "https://Stackoverflow.com/questions/14940762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/901200/" ]
You can either Drop the columns you do not need OR Select the ones you need ``` # Using DataFrame.drop df.drop(df.columns[[1, 2]], axis=1, inplace=True) # drop by Name df1 = df1.drop(['B', 'C'], axis=1) # Select the ones you want df1 = df[['a','d']] ```
In a similar vein, when reading a file, one may wish to exclude columns upfront, rather than wastefully reading unwanted data into memory and later discarding them. As of pandas 0.20.0, [`usecols` now accepts callables](https://pandas-docs.github.io/pandas-docs-travis/generated/pandas.read_csv.html?highlight=read_csv#...
57,590,904
I'm having problems trying to make a simple setup to run. I have used "react-router-dom" because it claims to be the most documented router around. Unfortunately, the documentation samples are using functions instead of classes and I think a running sample will not explain how routes have changed from previous versions...
2019/08/21
[ "https://Stackoverflow.com/questions/57590904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8044750/" ]
I think it's because of the `exact` flag on the Route for home. It does not match the /home exact so it goes to the default not found page.
``` try to add this in App.js <Switch> <Route exact path='/' component={Home} /> <Route path='/recipes' component={Recipes} /> <Route path='/ingredients' component={Ingredients} /> <Route path='/login' component={Login} /> <Route path='...
15,555,656
If I have a whitelist of strings that I want to check everything the user inputs into my javascript program, what's the most efficient way to do that? I could just have an array and loop through it until a match has been found but that's O(N). Is there an yway to do it that's better and doesn't involve any sort of key ...
2013/03/21
[ "https://Stackoverflow.com/questions/15555656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1369331/" ]
The counterpart of [`basic_consume`](https://pika.readthedocs.io/en/latest/modules/channel.html#pika.channel.Channel.basic_consume) is [`basic_cancel`](https://pika.readthedocs.io/en/latest/modules/channel.html#pika.channel.Channel.basic_cancel). `basic_cancel` will fire the provided `on_basic_cancel_ok` callback funct...
You should be consuming in a Thread so just interrupt the that thread and leave the rest of your program running ``` Thread t = new Thread(){ public void run(){ //consumer is in here } }; t.start(); // somewhere else later t.interrupt(); ``` You may need to make the `Thread t` available elsewhere buy having...
130,927
Would it be possible to wear 2 (or more) magical items of the same type, e.g. a *[Belt of Dwarvenkind](https://www.dndbeyond.com/magic-items/belt-of-dwarvenkind)* and a *[Belt of Giant Strength](https://www.dndbeyond.com/magic-items/belt-of-giant-strength)*, and gain the benefits of both?
2018/09/01
[ "https://rpg.stackexchange.com/questions/130927", "https://rpg.stackexchange.com", "https://rpg.stackexchange.com/users/47871/" ]
DMG page 141 (and the [corresponding section of the basic rules](https://www.dndbeyond.com/compendium/rules/basic-rules/magic-items#MultipleItemsoftheSameKind)) states: > > Multiple Items of the Same Kind > ------------------------------- > > > Use common sense to determine whether more than one of a given kind of ...
Other than the limitations on attuned items, and common sense, there is no reason you cannot wear two belts. It is frequently done for stylistic purposes. Two cloaks is also not specifically prohibited, or necklaces, or rings. If they can fit, they can be worn, always under teh authority of rule 0. I myself have severa...
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
You can do this: ``` void foo(int flagA) { int flagB; if(flagA) { getFlagB(&flagB); if(flagB) { // Code block 0 return ; } } // code block 1 } ```
I cannot definitively say anything because I have not seen any actual code but it seems to me the flagA is irrelevant and can be ignored. While flagB must be evaluated because it is relevant and causes the code to change. ``` void foo() { getFlagB(&flagB) if(flagB) { //Code 1 } else { ...
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
You can do this: ``` void foo(int flagA) { int flagB; if(flagA) { getFlagB(&flagB); if(flagB) { // Code block 0 return ; } } // code block 1 } ```
**EDIT** You can also do the following, so long as flagB is initialized to 0. This avoids a bug in the code I posted earlier that assumes the flags aren't modified inside code block 0, which can cause both code blocks 0 and 1 to execute. I'd recommend this new one only because you may at some point want to modify the ...
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
You can do this: ``` void foo(int flagA) { int flagB; if(flagA) { getFlagB(&flagB); if(flagB) { // Code block 0 return ; } } // code block 1 } ```
If you really do not want to either encapsulate the getFlagB call or split your if, you can abuse the comma operator: ``` if(flagA && (getFlagB(&flagB), flagB)) { ``` Even though it does not look nice, it does precisely what you want.
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
Wrap `getFlagB()` in another method, then let the compiler sort it out for you. ``` int myGetFlagB() { int b; getFlagB(&b); return b; } void foo(int flagA) { /* note: assume you mean && and not &, otherwise there is no way * to short circuit - you always need to call getFlagB for a * bitwise AND. *...
I cannot definitively say anything because I have not seen any actual code but it seems to me the flagA is irrelevant and can be ignored. While flagB must be evaluated because it is relevant and causes the code to change. ``` void foo() { getFlagB(&flagB) if(flagB) { //Code 1 } else { ...
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
Wrap `getFlagB()` in another method, then let the compiler sort it out for you. ``` int myGetFlagB() { int b; getFlagB(&b); return b; } void foo(int flagA) { /* note: assume you mean && and not &, otherwise there is no way * to short circuit - you always need to call getFlagB for a * bitwise AND. *...
**EDIT** You can also do the following, so long as flagB is initialized to 0. This avoids a bug in the code I posted earlier that assumes the flags aren't modified inside code block 0, which can cause both code blocks 0 and 1 to execute. I'd recommend this new one only because you may at some point want to modify the ...
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
Wrap `getFlagB()` in another method, then let the compiler sort it out for you. ``` int myGetFlagB() { int b; getFlagB(&b); return b; } void foo(int flagA) { /* note: assume you mean && and not &, otherwise there is no way * to short circuit - you always need to call getFlagB for a * bitwise AND. *...
If you really do not want to either encapsulate the getFlagB call or split your if, you can abuse the comma operator: ``` if(flagA && (getFlagB(&flagB), flagB)) { ``` Even though it does not look nice, it does precisely what you want.
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
Compute the condition explicitly before the `if`. ``` _Bool condition = flagA; if ( flagA ) { /* First decide what to do. */ _Bool flagB; GetFlagB( & flagB ); condition = flagA && flagB; /* Prefer && over &. */ } if ( condition ) { /* Then do it. */ Code1(); } else { Code2(); } ```
I cannot definitively say anything because I have not seen any actual code but it seems to me the flagA is irrelevant and can be ignored. While flagB must be evaluated because it is relevant and causes the code to change. ``` void foo() { getFlagB(&flagB) if(flagB) { //Code 1 } else { ...
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
Compute the condition explicitly before the `if`. ``` _Bool condition = flagA; if ( flagA ) { /* First decide what to do. */ _Bool flagB; GetFlagB( & flagB ); condition = flagA && flagB; /* Prefer && over &. */ } if ( condition ) { /* Then do it. */ Code1(); } else { Code2(); } ```
**EDIT** You can also do the following, so long as flagB is initialized to 0. This avoids a bug in the code I posted earlier that assumes the flags aren't modified inside code block 0, which can cause both code blocks 0 and 1 to execute. I'd recommend this new one only because you may at some point want to modify the ...
17,757,122
I'm trying to make the below code both readable and performant. I want to avoid any unnecessary call to `getFlagB()` while also not repeating anything. Below I have written two methods, each which satisfies exactly one of these criteria. Assume `getFlagB()` cannot be altered in any way. Is there a way to meet both the...
2013/07/19
[ "https://Stackoverflow.com/questions/17757122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343381/" ]
Compute the condition explicitly before the `if`. ``` _Bool condition = flagA; if ( flagA ) { /* First decide what to do. */ _Bool flagB; GetFlagB( & flagB ); condition = flagA && flagB; /* Prefer && over &. */ } if ( condition ) { /* Then do it. */ Code1(); } else { Code2(); } ```
If you really do not want to either encapsulate the getFlagB call or split your if, you can abuse the comma operator: ``` if(flagA && (getFlagB(&flagB), flagB)) { ``` Even though it does not look nice, it does precisely what you want.
223,642
I don't know if this site does general human geography, but since it's the only geography site I found this is the question. Population change takes into account 'growth rate' (which includes births and immigration) whilst taking away 'death rate' (which seems to only include death). So does population change take into...
2017/01/07
[ "https://gis.stackexchange.com/questions/223642", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/89255/" ]
The [OECD defines](https://stats.oecd.org/glossary/detail.asp?ID=6638) it as follows: > > The difference between the size of the population at the end and the beginning of a period. It is equal to the algebraic sum of natural increase and net migration (including corrections). There is negative change when both of th...
Usually demographers use net-migration which is the difference between in and out migration. Note in many countries (such as the UK) this is a (poor) guess as they don't have an easy way of checking when citizens leave the country or return, and often don't know this for other nationals with visa free travel (e.g. Eu...
56,193,732
I am trying to sum up the COUNT(IHID.RSID\_PROD\_N) by IHID.CS\_ID but facing a problem. How to solve it? ``` SELECT IHID.CS_ID ,IHID.RSID_PROD_N,COUNT(IHID.RSID_PROD_N), RSPF.RSPF_PROD_N,COUNT(RSPF.RSPF_PROD_N),sum(COUNT(IHID.RSID_PROD_N)) from IHIH JOIN IHID ON ihih.rsih_invoice_n = ihid.rsih_invoice_n AND i...
2019/05/17
[ "https://Stackoverflow.com/questions/56193732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
this should work : ``` LinearLayout mainTable = findViewById(R.id.mainTableLayout); DisplayMetrics metrics = getResources().getDisplayMetrics(); int DeviceTotalWidth = metrics.widthPixels; int with = DeviceTotalWidth / 5; for (int i = 0; i < 5; i++) { LinearLayout row = new LinearLayout(this)...
You can use RecyclerView instead of programmatically adding button in linearlayout. Use RecyclerView of GridLayoutManager with span count 5 & orientation vertical.
49,905,171
I have a test.txt file that contains: ``` yellow.blue.purple.green red.blue.red.purple ``` And i'd like to have on output.txt just the second and the third part of each line, like this: ``` blue.purple blue.red ``` Here is python code: ``` with open ('test.txt', 'r') as file1, open('output.txt', 'w') as file2: ...
2018/04/18
[ "https://Stackoverflow.com/questions/49905171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9099133/" ]
You may want ``` with open('test.txt', 'r') as file1, open('output.txt', 'w') as file2: for line in file1: file2.write(".".join(line.split('.')[1:3])+ '\n') ``` --- When you apply `split('.')` to the line e.g. `yellow.blue.purple.green`, you get a list of values ``` ["yellow", "blue", "purple", "green...
First I created a .txt file that had the same data that you entered in your original .txt file. I used the 'w' mode to write the data as you already know. I create an empty list as well that we will use to store the data, and later write to the output.txt file. ``` output_write = [] with open('test.txt', 'w') as fi...
471,893
I'm on Ubuntu 14.04 and I am using an HP Pavilion Notebook PC. I downloaded Ubuntu by booting from USB and replaced Vista with Ubuntu. I found out about Playonlinux but I was just left unsatisfied by it's performance. I have decided to do a factory reset and use Vista (factory OS) as my gaming platform and Ubuntu as th...
2014/05/25
[ "https://askubuntu.com/questions/471893", "https://askubuntu.com", "https://askubuntu.com/users/284773/" ]
If you installed Ubuntu removing Windows, you have to reinstall it. If you wish to keep Ubuntu as is and install Windows alongside, you have to boot Ubuntu from DVD/USB and select "Try Ubuntu", then use GParted to resize Ubuntu and create a new partition. After reinstalling Windows you need to use [Boot-Repair](https:/...
If you did one of the automatic installations of Ubuntu, you most likely deleted all of the earlier partitions on your hard disk. You will need to request from HP the source CDs for reinstalling all of the software. Cost is about $19, was my experience, for a pavilion running windows 7. You mention poor performance un...
52,451,998
I tried to create an image file, like this: ``` uint8_t raw_r[pixel_width][pixel_height]; uint8_t raw_g[pixel_width][pixel_height]; uint8_t raw_b[pixel_width][pixel_height]; uint8_t blue(uint32_t x, uint32_t y) { return (rand()%2)? (x+y)%rand() : ((x*y%1024)%rand())%2 ? (x-y)%rand() : rand(); } uint8_t green(uint3...
2018/09/21
[ "https://Stackoverflow.com/questions/52451998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9764443/" ]
I was initially going to have the same answer as everyone else had and chalk this up to the issues with `rand()`. However, I thought better of doing so and instead analyzed the distribution your math is actually producing. TL;DR: The pattern you see has nothing to do with the underlying random number generator and ins...
Many of the calculations that you're doing in your code won't lead to truly random values. Those sharp lines that you're seeing correspond to places where the relative values of your x and y coordinates trade with one another, and when that happens you're using fundamentally different formulas. For example, computing `...
4,601,669
I am planning to study geometry (I know this is very vague, but I can't exactly explain what I mean, because I don't fully understand the distinction between various terms, which is the reason for this question). I'm confused by titles of books. As I understand, there are books which have "Smooth Manifolds" in their t...
2022/12/19
[ "https://math.stackexchange.com/questions/4601669", "https://math.stackexchange.com", "https://math.stackexchange.com/users/774121/" ]
Yes, you could use induction to prove things about a sequence of real numbers. Although the sequence and the proposition would have to be pretty special, as you would have to be able to prove $S(a\_{n+1})$ from $S(a\_n)$. The other point is that, if you're only going to prove things for a particular sequence of real n...
If you are willing to use the Axiom of Choice (AC), which implies the [Well-ordering theorem](https://en.wikipedia.org/wiki/Well-ordering_theorem), you could. But why would you want to make a statement about an uncountably large sequence of real numbers using induction? I don't know what specific question you are attac...
18,807,765
i am having some problems with getting SDL 2.0 to work for me in sublime text 2 using mingw. The code im trying to compile(from lazy foo's SDL 2.0 tutorial): ``` #include <SDL2/SDL.h> #include <stdio.h> // scrren dimension constraints const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main(int argc, c...
2013/09/15
[ "https://Stackoverflow.com/questions/18807765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2586644/" ]
I appear to have (finally) fixed my problem. Updating to the latest version of MinGW and SDL2.0 and changing ``` "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}.exe" ,"-std=c++0x", "-lSDL2", "-lSDL2main"], ``` to ``` "cmd": ["g++", "${file}", "-o", "${file_path}/${file_base_name}.exe","-lmingw32"...
Your linker settings "-lSDL2", "-lSDL2main" may be the wrong way round, try reversing them
138,097
I'd like to be able to filter my sidebar widgets (tag cloud, category, archive) to only show those tags/categories/months that apply to a given author on the author template. What is the correct way to filter or modify these widgets? I found [this page](http://codex.wordpress.org/Plugin_API/Filter_Reference#Widgets) i...
2014/03/16
[ "https://wordpress.stackexchange.com/questions/138097", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12870/" ]
It's a bit unwieldy to just grab all posts by an author and filter through them to only return a category list. If you wish to use the default widgets in the sidebar and have them filtered by the author only on the author template then I'd suggest using the following approach. First, filter the tag and category widge...
There is no built in way to do this, and I don't know that it's been tried before. That being said, the tools are all there, you have to put them together. You can get the current User ID with [`$userid = wp_get_current_user()`](https://codex.wordpress.org/Function_Reference/wp_get_current_user) You can then get all ...
138,097
I'd like to be able to filter my sidebar widgets (tag cloud, category, archive) to only show those tags/categories/months that apply to a given author on the author template. What is the correct way to filter or modify these widgets? I found [this page](http://codex.wordpress.org/Plugin_API/Filter_Reference#Widgets) i...
2014/03/16
[ "https://wordpress.stackexchange.com/questions/138097", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12870/" ]
There is no built in way to do this, and I don't know that it's been tried before. That being said, the tools are all there, you have to put them together. You can get the current User ID with [`$userid = wp_get_current_user()`](https://codex.wordpress.org/Function_Reference/wp_get_current_user) You can then get all ...
I haven't tested this but you could try ``` add_action('pre_get_posts', callback); function callback( &$query ) { if ( is_author() ) { $query->set('author', get_the_author_meta('ID') ); } } ```
138,097
I'd like to be able to filter my sidebar widgets (tag cloud, category, archive) to only show those tags/categories/months that apply to a given author on the author template. What is the correct way to filter or modify these widgets? I found [this page](http://codex.wordpress.org/Plugin_API/Filter_Reference#Widgets) i...
2014/03/16
[ "https://wordpress.stackexchange.com/questions/138097", "https://wordpress.stackexchange.com", "https://wordpress.stackexchange.com/users/12870/" ]
It's a bit unwieldy to just grab all posts by an author and filter through them to only return a category list. If you wish to use the default widgets in the sidebar and have them filtered by the author only on the author template then I'd suggest using the following approach. First, filter the tag and category widge...
I haven't tested this but you could try ``` add_action('pre_get_posts', callback); function callback( &$query ) { if ( is_author() ) { $query->set('author', get_the_author_meta('ID') ); } } ```
50,418,651
I want to create a simple form builder with Vue where users click on buttons from a menu to add different form fields to a form. I know that if there was just one type of form field to add, I could do it with something like this (<https://jsfiddle.net/u6j1uc3u/32/>): ``` <div id="app"> <form-input v-for="field in fi...
2018/05/18
[ "https://Stackoverflow.com/questions/50418651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1193304/" ]
Ok, so I looked into dynamic elements and managed to pull this together: ```js Vue.component('form-input', { template: '#form-input' }); Vue.component('form-select', { template: '#form-select' }); Vue.component('form-textarea', { template: '#form-textarea' }); new Vue({ el: '#app', data: { ...
You can pass the field object as props of your `form-input` component and make the `type` dynamic: ```js Vue.component('form-input', { template: '#form-input', props: ['field'] }) new Vue({ el: '#app', data: { fields: [], inputType: '', count: 0 }, methods: { addFormElement(val...
50,418,651
I want to create a simple form builder with Vue where users click on buttons from a menu to add different form fields to a form. I know that if there was just one type of form field to add, I could do it with something like this (<https://jsfiddle.net/u6j1uc3u/32/>): ``` <div id="app"> <form-input v-for="field in fi...
2018/05/18
[ "https://Stackoverflow.com/questions/50418651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1193304/" ]
Ok, so I looked into dynamic elements and managed to pull this together: ```js Vue.component('form-input', { template: '#form-input' }); Vue.component('form-select', { template: '#form-select' }); Vue.component('form-textarea', { template: '#form-textarea' }); new Vue({ el: '#app', data: { ...
Based on the code from the answer, one could add dynamic content for each one of those form controls as well ( the full concept could be seen from the following [site](https://qto.fi)): ```js Vue.component('form-input', { template: '#form-input' , props: ['label','cnt'] }); Vue.component('form-select',...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
Normally you output to a table variable or temp table, then use that to insert to the final table.
According to [technet](http://technet.microsoft.com/en-us/library/ms177564.aspx) > > There is no guarantee that the order in which the changes are applied to the table and the order in which the rows are inserted into the output table or table variable will correspond. > > > Based on this there are a number of re...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
According to [technet](http://technet.microsoft.com/en-us/library/ms177564.aspx) > > There is no guarantee that the order in which the changes are applied to the table and the order in which the rows are inserted into the output table or table variable will correspond. > > > Based on this there are a number of re...
You're correct, output statements won't work on tables under foreign key constraints. Another option would be to temporarily disable the constraints while you insert the data. Though this shouldn't be the norm, it works well for one time loads of data. ``` ALTER TABLE dbo.forn NOCHECK CONSTRAINT FK_forn_prim GO INS...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
According to [technet](http://technet.microsoft.com/en-us/library/ms177564.aspx) > > There is no guarantee that the order in which the changes are applied to the table and the order in which the rows are inserted into the output table or table variable will correspond. > > > Based on this there are a number of re...
The documentation does indicate that the output table may not participate in foreign key constraints (or check constraints, nor may it have enabled triggers defined on it--but those cases aren't considered here). The Msg 332 error is the manifestation of that. (***THIS IS NOT RECOMMENDED.*** See update below) However...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
According to [technet](http://technet.microsoft.com/en-us/library/ms177564.aspx) > > There is no guarantee that the order in which the changes are applied to the table and the order in which the rows are inserted into the output table or table variable will correspond. > > > Based on this there are a number of re...
Use insert into table variable DECLARE @HISTORY\_EXTENSION TABLE ( HISTORY\_ID INT NOT NULL, NUMBER NVARCHAR(50) NOT NULL ) -- Move From INSERT INTO [dbo].[HISTORY] ([CODE] ,[STAMP] ) OUTPUT INSERTED.Id, DATE INTO @HISTORY\_EXTENSION ( [HISTORY\_ID] ,[NUMBER] ) SELECT ...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
Normally you output to a table variable or temp table, then use that to insert to the final table.
You're correct, output statements won't work on tables under foreign key constraints. Another option would be to temporarily disable the constraints while you insert the data. Though this shouldn't be the norm, it works well for one time loads of data. ``` ALTER TABLE dbo.forn NOCHECK CONSTRAINT FK_forn_prim GO INS...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
Normally you output to a table variable or temp table, then use that to insert to the final table.
The documentation does indicate that the output table may not participate in foreign key constraints (or check constraints, nor may it have enabled triggers defined on it--but those cases aren't considered here). The Msg 332 error is the manifestation of that. (***THIS IS NOT RECOMMENDED.*** See update below) However...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
Normally you output to a table variable or temp table, then use that to insert to the final table.
Use insert into table variable DECLARE @HISTORY\_EXTENSION TABLE ( HISTORY\_ID INT NOT NULL, NUMBER NVARCHAR(50) NOT NULL ) -- Move From INSERT INTO [dbo].[HISTORY] ([CODE] ,[STAMP] ) OUTPUT INSERTED.Id, DATE INTO @HISTORY\_EXTENSION ( [HISTORY\_ID] ,[NUMBER] ) SELECT ...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
You're correct, output statements won't work on tables under foreign key constraints. Another option would be to temporarily disable the constraints while you insert the data. Though this shouldn't be the norm, it works well for one time loads of data. ``` ALTER TABLE dbo.forn NOCHECK CONSTRAINT FK_forn_prim GO INS...
The documentation does indicate that the output table may not participate in foreign key constraints (or check constraints, nor may it have enabled triggers defined on it--but those cases aren't considered here). The Msg 332 error is the manifestation of that. (***THIS IS NOT RECOMMENDED.*** See update below) However...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
You're correct, output statements won't work on tables under foreign key constraints. Another option would be to temporarily disable the constraints while you insert the data. Though this shouldn't be the norm, it works well for one time loads of data. ``` ALTER TABLE dbo.forn NOCHECK CONSTRAINT FK_forn_prim GO INS...
Use insert into table variable DECLARE @HISTORY\_EXTENSION TABLE ( HISTORY\_ID INT NOT NULL, NUMBER NVARCHAR(50) NOT NULL ) -- Move From INSERT INTO [dbo].[HISTORY] ([CODE] ,[STAMP] ) OUTPUT INSERTED.Id, DATE INTO @HISTORY\_EXTENSION ( [HISTORY\_ID] ,[NUMBER] ) SELECT ...
3,344,891
The following snippet fails with error: > > The target table 'dbo.forn' of the OUTPUT INTO clause cannot be on either side of a (primary key, foreign key) relationship. Found reference constraint 'FK\_forn\_prim'." > > > I can only use output by disabling foreign key constraints? How can this be done? ``` IF OB...
2010/07/27
[ "https://Stackoverflow.com/questions/3344891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74000/" ]
The documentation does indicate that the output table may not participate in foreign key constraints (or check constraints, nor may it have enabled triggers defined on it--but those cases aren't considered here). The Msg 332 error is the manifestation of that. (***THIS IS NOT RECOMMENDED.*** See update below) However...
Use insert into table variable DECLARE @HISTORY\_EXTENSION TABLE ( HISTORY\_ID INT NOT NULL, NUMBER NVARCHAR(50) NOT NULL ) -- Move From INSERT INTO [dbo].[HISTORY] ([CODE] ,[STAMP] ) OUTPUT INSERTED.Id, DATE INTO @HISTORY\_EXTENSION ( [HISTORY\_ID] ,[NUMBER] ) SELECT ...
15,259,673
I use an `iframe` to display HTML email contents by writing a HTML string to it's content document via JS. I don't want the user to navigate inside that `iframe` if he clicks a link in the displayed email. Now I have these options: 1. Open links in a new browser window or tab (**preferred**) 2. Prevent all navigation ...
2013/03/06
[ "https://Stackoverflow.com/questions/15259673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
You could loop through all the links in the iframe and add `target="_blank"` to them. (Excuse me but I only know how to do this in JQuery so sorry for linking the example in this without it being tagged in the question): ``` $("#iframeID").contents().find("a").each(function() { $(this).attr("target", "_blank"); }...
You should be able to replace all links with their displayed text, something like: ``` var links = document.links; var i = links.length; var link, text, node; while (i--) { link = links[i]; text = link.textContent || link.innerText || ''; node = document.createTextNode(text); link.parentNode.replaceChild(node...
15,259,673
I use an `iframe` to display HTML email contents by writing a HTML string to it's content document via JS. I don't want the user to navigate inside that `iframe` if he clicks a link in the displayed email. Now I have these options: 1. Open links in a new browser window or tab (**preferred**) 2. Prevent all navigation ...
2013/03/06
[ "https://Stackoverflow.com/questions/15259673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If the iframe is from a different origin, this method will prevent navigation by resetting the iframe source if it changes: ``` var $iframe = $('iframe'); var iframeUrl = 'http://example.com/foo'; var iframeLoaded = false; $iframe.on('load', function () { if (!iframeLoaded) { # Allow initial load of ifram...
You should be able to replace all links with their displayed text, something like: ``` var links = document.links; var i = links.length; var link, text, node; while (i--) { link = links[i]; text = link.textContent || link.innerText || ''; node = document.createTextNode(text); link.parentNode.replaceChild(node...
15,259,673
I use an `iframe` to display HTML email contents by writing a HTML string to it's content document via JS. I don't want the user to navigate inside that `iframe` if he clicks a link in the displayed email. Now I have these options: 1. Open links in a new browser window or tab (**preferred**) 2. Prevent all navigation ...
2013/03/06
[ "https://Stackoverflow.com/questions/15259673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For the page the iframe is hosted in, define a [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) that restricts the [`child-src`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/child-src) to a specific source, such as a domain. FYI this doesn't work for Internet Explorer. H...
You should be able to replace all links with their displayed text, something like: ``` var links = document.links; var i = links.length; var link, text, node; while (i--) { link = links[i]; text = link.textContent || link.innerText || ''; node = document.createTextNode(text); link.parentNode.replaceChild(node...
434,369
This is error: [ERROR] no such file to load -- readline [TIP] Try to run 'gem install readline' or 'gem install --user-install readline'. If you still get an error, Please see README file or <https://github.com/wpscanteam/wpscan> Then i run those command but again i got error: ERROR: Could not find a valid gem 'read...
2014/03/14
[ "https://askubuntu.com/questions/434369", "https://askubuntu.com", "https://askubuntu.com/users/252548/" ]
After command: ``` sudo gem install rb-readline ``` I was still getting an error. I added to the Gemfile ``` gem "rb-readline" ``` And it worked.
The [readline](https://rubygems.org/gems/rb-readline) library for Ruby is called `rb-readline`. Try ``` sudo gem install rb-readline ``` for a system-wide installation, or ``` gem install --user-install rb-readline ``` for a local installation inside your user's home directory.
21,139,698
First the big picture: I'm trying to synchronize two external devices through a console program on Windows 7 (64-bit). That is, Device 1 should trigger Device 2. (For the curious, Device 1 is the NI USB-6525, and I'm using its Change Detection function.) I'm using GetMessage() in a while loop to wait for a message tha...
2014/01/15
[ "https://Stackoverflow.com/questions/21139698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3198108/" ]
Indeed, 'console app' does not have a 'window', hence they can't receive any messages (in a easy way). If I remember correctly, you actually can write code that will create an invisible window with message pump, so that all 'messages' will be dispatched. \*) But then, you've got tons of window-related code to researc...
Here is a *normal* message loop taken from the MSDN site: <http://msdn.microsoft.com/en-us/library/windows/desktop/ms644928%28v=vs.85%29.aspx> ``` while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) { if (bRet == -1) { // handle the error and possibly exit } else { TranslateMessa...
42,158,091
On WooCommerce product single pages, if a product owns a sales price, the normal price is crossed out and behind it, the sale price is highlighted. My question: How can I add a label like **`"Old Price: XX Dollar"`** and **`"New Price: XX Dollar"`** instead of only the crossed out and the new price (sale price)?
2017/02/10
[ "https://Stackoverflow.com/questions/42158091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6573193/" ]
> > **Update 2 (for simple and variable products + solved the bug on same variations prices)** > > > when products are on sale, you can add custom labels just as you want using a custom function hooked in **`woocommerce_sale_price_html`** and **`woocommerce_variation_sale_price_html`** filters hooks (for simple an...
In admin side you need to define your sale price and actual price so it will automatically reflect in front side as your old price and new price alternatively. Also you need to do some code for this.
18,685,523
I have a cocoa application core library is C++ which cocoa app uses. I need to put logs in both parts of the app so that I can easily diagnose the issues when the logs are reported from users via crash log reporter (a separate component). The cocoa part of the app the logs are like ``` NSLog(@"something.."); ``` In...
2013/09/08
[ "https://Stackoverflow.com/questions/18685523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1185422/" ]
It's not clear how and from where your crash log reporter is collecting the logs. `NSLog()` writes the logs to two destinations, stderr and the ASL (Apple System Log) database. So, one step to getting the C++ logs to go to a similar location as `NSLog()` would be to use `cerr` instead of `cout`. However, the most reli...
you can use fprintf, but it only show up from XCode ``` fprintf(stderr, "Log string: %s", aStringVariable); ``` While printf will show up if you're debugging from XCode, it won't show up in the Organizer Console. You can run the following command to print only to device's console: ``` syslog(LOG_WARNING, "log strin...
18,685,523
I have a cocoa application core library is C++ which cocoa app uses. I need to put logs in both parts of the app so that I can easily diagnose the issues when the logs are reported from users via crash log reporter (a separate component). The cocoa part of the app the logs are like ``` NSLog(@"something.."); ``` In...
2013/09/08
[ "https://Stackoverflow.com/questions/18685523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1185422/" ]
It's not clear how and from where your crash log reporter is collecting the logs. `NSLog()` writes the logs to two destinations, stderr and the ASL (Apple System Log) database. So, one step to getting the C++ logs to go to a similar location as `NSLog()` would be to use `cerr` instead of `cout`. However, the most reli...
Ref to <https://github.com/flyskywhy/react-native-gcanvas/blob/master/core/src/support/Log.h> ``` typedef void (*GCanvasSystemLog)(const char *tag, const char *log); API_EXPORT extern GCanvasSystemLog gcanvasSystemLog; ``` and <https://github.com/flyskywhy/react-native-gcanvas/blob/master/core/src/support/Log.c...
2,064,803
If $r < 1$ and positive and m is a positive integer, show that $(2m+1)r^m(1-r)<1-r^{2m+1}$. Hence show that $nr^n$ is indefinitely small when $n$ is indefinitely great. I have tried by taking $\frac{1-r^{2m+1}}{1-r}$ as the sum of the series $1 + r + r^2 ... + r^{2m}$ and then we may try to prove that $(2m+1)r^m > 1 +...
2016/12/19
[ "https://math.stackexchange.com/questions/2064803", "https://math.stackexchange.com", "https://math.stackexchange.com/users/321525/" ]
Before trying to solve this equation, I think it is better to get a sense of the possible solutions. Maybe this graph could help: [![graph](https://i.stack.imgur.com/7pDRn.png)](https://i.stack.imgur.com/7pDRn.png) As you see, the solution is not unique for some values of $A$ and $K$, while it doesn't have any soluti...
$x!$ is not defined for arbitrary real positive $x$, just for nonnegative integers. You could replace it by $\Gamma(x+1)$. But still your equation can't be solved in "closed form". Numerical methods might be tried.
2,064,803
If $r < 1$ and positive and m is a positive integer, show that $(2m+1)r^m(1-r)<1-r^{2m+1}$. Hence show that $nr^n$ is indefinitely small when $n$ is indefinitely great. I have tried by taking $\frac{1-r^{2m+1}}{1-r}$ as the sum of the series $1 + r + r^2 ... + r^{2m}$ and then we may try to prove that $(2m+1)r^m > 1 +...
2016/12/19
[ "https://math.stackexchange.com/questions/2064803", "https://math.stackexchange.com", "https://math.stackexchange.com/users/321525/" ]
Before trying to solve this equation, I think it is better to get a sense of the possible solutions. Maybe this graph could help: [![graph](https://i.stack.imgur.com/7pDRn.png)](https://i.stack.imgur.com/7pDRn.png) As you see, the solution is not unique for some values of $A$ and $K$, while it doesn't have any soluti...
Here's a possible solution - not sure if it will be of particularly good numerical stability. Take logs: $$ \ln{(e^{-A} A^x)} = \ln{(x! K)} \implies - A + x \ln{A} = \ln{x!} + \ln{K}.$$ You might be able to solve this numerically if you use a an accurate enough approximation for $\ln x!,$ using the Stirling series: ...
20,606
``` <apex:repeat value="{!Requests}" var="request"> <tr> <td>{!request.Subject}</td> <td>{!request.Type}</td> <td>{!request.Location__r.Name}</td> <td> <apex:outputText value="{0,date,MM/dd/yyyy}" > <apex:param value="{!request.CreatedDate}"/> ...
2013/11/12
[ "https://salesforce.stackexchange.com/questions/20606", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/3390/" ]
Try to use `apex:actionFunction` Controller ``` public String mySubject {get;set;} public PageReference myMethod(){ System.debug('mySubject: ' + mySubject); } ``` Page ``` <apex:actionFunction name="send" action="{!myMethod}" reRender="none"> <apex:param name="p1"...
You can also try using the actionSupport tag. See [here](http://www.salesforce.com/us/developer/docs/pages/index_Left.htm#CSHID=pages_compref_actionSupport.htm%7CStartTopic=Content/pages_compref_actionSupport.htm%7CSkinName=webhelp) for the docs. ``` <apex:repeat value="{!Requests}" var="request"> <tr> ...
1,671,158
Assuming either $|z|=1$ or $|w|=1$ and $\bar z w$ $\neq 1$, prove that |$\frac{z-w}{1-\bar zw}$| $=1$ Any hint? I don't have a clue
2016/02/25
[ "https://math.stackexchange.com/questions/1671158", "https://math.stackexchange.com", "https://math.stackexchange.com/users/310025/" ]
Hint: If $|z|=1$, then $\overline z=1/z$. Use this to show that $|z-w|=|1-\overline zw|$. So, $$|1-\overline zw|=\left|1-\frac wz\right|=\left|\frac 1z\right||z-w|=|z-w|.$$
Consider $z=x+iy$ and $w=a+bi$ Given $|z| = x^2 + y^2 = 1$ and $|w| = a^2+b^2 = 1$ Hence $$\left|\frac{z-w}{1-\bar{z}w}\right| = 1$$ $$ \left|z-w\right| = \left|1-\bar{z}w\right| $$ Substituting in $z=x+iy$ , $w=a+bi$ and $\bar{z} = x-iy$ $$ \left|x+iy-(a+bi)\right| = \left|1-((x-iy)(a+bi))\right| $$ $$ \le...
59,080,675
I want to configure the babel options in my Ember app to either ignore the `data-stubs` folder, or set `compact` to false so I can silence the following error during builds: ``` [Babel: my-app > applyPatches][BABEL] Note: The code generator has deoptimised the styling of dev/my-app/tests/data-stubs/foo.js as it exc...
2019/11/28
[ "https://Stackoverflow.com/questions/59080675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/963980/" ]
Unfortunately, [scalatest docs](http://www.scalatest.org/user_guide/using_matchers#expectedExceptions) aren't that detailed about that, but it's more or less like this: You should use `a` when you just want to assert on the type of exception thrown, but not it's contents (e.g. message, nested exception, etc.), but the...
As you can see from the library source code `a` and `an` are exactly the same: ``` /** * This method enables the following syntax: * * <pre class="stHighlight"> * a [RuntimeException] should be thrownBy { ... } * ^ * </pre> */ def a[T: ClassTag]: ResultOfATypeInvocation[T] = new ResultOfA...
443,146
I found line `sed 's~ ~~g'` in a shell script on a Linux system. What is this `~`?
2018/05/11
[ "https://unix.stackexchange.com/questions/443146", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/289083/" ]
It's an alternative delimiter for the `sed` substitute (`s`) command. Usually, the slash is used, as in `s/pattern/replacement/`, but `sed` allows for almost any character to be used. The main reason for using another delimiter than `/` in the `sed` substitution expression is when the expression will act on literal `/...
It's a substitution delimiter. The most often used delimiter is a forward slash `/`. But `sed` can use any character as a delimiter - it will automatically use the character following the `s` as a delimiter: ``` sed 's@ @@g' sed 's+ ++g' sed 's\ \\g' sed 's* **g' ``` Also it is possible to use space as delimiter: `...
35,440,858
I figured out how to do this in css : ``` .dl-menuwrapper li > a(:only-child) ``` But I don't manage to make this work in a jQuery selector : ``` $(document).on('click', '.dl-menuwrapper li a(:only-child)', function () {console.log('it works');}); ``` I don't get what I am missing here and a little help would be ...
2016/02/16
[ "https://Stackoverflow.com/questions/35440858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2175173/" ]
You typed two extra parenthesis. correct version: ``` $(document).on('click', '.dl-menuwrapper li a:only-child', function () {console.log('it works');}); ``` and your css would be like this: ``` .dl-menuwrapper li > a:only-child{ /* some styles */ } ```
Why are you using `()` around `:only-child`. Remove it like following. **CSS** ``` .dl-menuwrapper li > a:only-child ``` **jQuery** ``` $(document).on('click', '.dl-menuwrapper li a:only-child', function () { console.log('it works'); }); ```
388,721
While creating the architecture of a new project I struggle to come up with a good solution to handle public IDs. For example our users will receive a membership card. Each card has the membership ID printed on it. But because in our branch of industry we expect cooperation with other businesses the format of those mem...
2019/03/15
[ "https://softwareengineering.stackexchange.com/questions/388721", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/192757/" ]
You cannot look into the future - accept that. So better go ahead with a simple, but sufficient solution for today, and add more complexity when you know the requirements, not beforehand. If you invest too much design efforts into things which you will expect to happen "once in few years", and you don't know yet how t...
As for good/bad practice in this case, that is mostly subjective, because it depends on factors concerning the application(s) and data. For example, if you were only to have one business for the initial product launch, and there are no schedules or plans to add other businesses, then there isn't a point to come up wit...
388,721
While creating the architecture of a new project I struggle to come up with a good solution to handle public IDs. For example our users will receive a membership card. Each card has the membership ID printed on it. But because in our branch of industry we expect cooperation with other businesses the format of those mem...
2019/03/15
[ "https://softwareengineering.stackexchange.com/questions/388721", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/192757/" ]
You cannot look into the future - accept that. So better go ahead with a simple, but sufficient solution for today, and add more complexity when you know the requirements, not beforehand. If you invest too much design efforts into things which you will expect to happen "once in few years", and you don't know yet how t...
You're right; the membership ID is *not* part of your Primary Key. That's why **synthetic keys** exist. A synthetic key is one that is automatically generated, either by you or the database. It usually takes the form of either an incrementing number or a globally-unique identifier. Synthetic keys are never re-used, ev...
388,721
While creating the architecture of a new project I struggle to come up with a good solution to handle public IDs. For example our users will receive a membership card. Each card has the membership ID printed on it. But because in our branch of industry we expect cooperation with other businesses the format of those mem...
2019/03/15
[ "https://softwareengineering.stackexchange.com/questions/388721", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/192757/" ]
You're right; the membership ID is *not* part of your Primary Key. That's why **synthetic keys** exist. A synthetic key is one that is automatically generated, either by you or the database. It usually takes the form of either an incrementing number or a globally-unique identifier. Synthetic keys are never re-used, ev...
As for good/bad practice in this case, that is mostly subjective, because it depends on factors concerning the application(s) and data. For example, if you were only to have one business for the initial product launch, and there are no schedules or plans to add other businesses, then there isn't a point to come up wit...
83,348
I have Raspberry Pi 3 B board and I was install latest Raspbian image with desktop based on Debian Stretch. Now, when I connect my usb rfid rc10c-usb-8h10d 125kHz to rbPi3 board on usb, and in command prompt, when I issue command `lsusb`, I get this ``` root@raspberrypi:/dev# lsusb Bus 001 Device 004: ID 08ff:0009 Au...
2018/04/27
[ "https://raspberrypi.stackexchange.com/questions/83348", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/79889/" ]
I think Milliways has right. You should try hidraw0 or similar. Try to observe ls /dev/ when rfid isn't connect and ls /dev/ when rfid is connect to usb.
I suggest you try a terminal application. If you scan a RFID tag the reader should respond as if the card number had been typed on a keyboard. Most such devices claim to be readable on Windows. It should be possible to read input from the specific device, but I have never tried this.
83,348
I have Raspberry Pi 3 B board and I was install latest Raspbian image with desktop based on Debian Stretch. Now, when I connect my usb rfid rc10c-usb-8h10d 125kHz to rbPi3 board on usb, and in command prompt, when I issue command `lsusb`, I get this ``` root@raspberrypi:/dev# lsusb Bus 001 Device 004: ID 08ff:0009 Au...
2018/04/27
[ "https://raspberrypi.stackexchange.com/questions/83348", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/79889/" ]
You could try the script from [this answer](https://unix.stackexchange.com/a/144735/106927) which lists USB device files along with human-readable device names: ``` #!/bin/bash for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do ( syspath="${sysdevpath%/dev}" devname="$(udevadm info...
I suggest you try a terminal application. If you scan a RFID tag the reader should respond as if the card number had been typed on a keyboard. Most such devices claim to be readable on Windows. It should be possible to read input from the specific device, but I have never tried this.
83,348
I have Raspberry Pi 3 B board and I was install latest Raspbian image with desktop based on Debian Stretch. Now, when I connect my usb rfid rc10c-usb-8h10d 125kHz to rbPi3 board on usb, and in command prompt, when I issue command `lsusb`, I get this ``` root@raspberrypi:/dev# lsusb Bus 001 Device 004: ID 08ff:0009 Au...
2018/04/27
[ "https://raspberrypi.stackexchange.com/questions/83348", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/79889/" ]
I think Milliways has right. You should try hidraw0 or similar. Try to observe ls /dev/ when rfid isn't connect and ls /dev/ when rfid is connect to usb.
observe the change of the output of this command before and after pluggig in the USB device: ``` ls -lrtd /dev/*|tail ``` it will usually be something like `/dev/hidraw4`
83,348
I have Raspberry Pi 3 B board and I was install latest Raspbian image with desktop based on Debian Stretch. Now, when I connect my usb rfid rc10c-usb-8h10d 125kHz to rbPi3 board on usb, and in command prompt, when I issue command `lsusb`, I get this ``` root@raspberrypi:/dev# lsusb Bus 001 Device 004: ID 08ff:0009 Au...
2018/04/27
[ "https://raspberrypi.stackexchange.com/questions/83348", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/79889/" ]
You could try the script from [this answer](https://unix.stackexchange.com/a/144735/106927) which lists USB device files along with human-readable device names: ``` #!/bin/bash for sysdevpath in $(find /sys/bus/usb/devices/usb*/ -name dev); do ( syspath="${sysdevpath%/dev}" devname="$(udevadm info...
observe the change of the output of this command before and after pluggig in the USB device: ``` ls -lrtd /dev/*|tail ``` it will usually be something like `/dev/hidraw4`
184,130
I'm a beginner in OOP in JavaScript. I have programmed a Tic-Tac-Toe game. The program works, but I don't know if I followed the principles of OOP in this case. I know, that's functions in methods - that's wrong. How can I get rid of functions in methods? Thank you. ```js var ceil = document.getElementsByClassName("ga...
2018/01/02
[ "https://codereview.stackexchange.com/questions/184130", "https://codereview.stackexchange.com", "https://codereview.stackexchange.com/users/157095/" ]
OOP is about Encapsulation. =========================== Function placement ------------------ > > I know, that's functions in methods - that's wrong. > > > OMDG who would tell you such. Javascript works best with functions in functions. A function inside function is protected. It can not be called with bad varia...
> > How can I get rid of functions in methods? > > > You can start by making those in-line functions methods. For example, `currentStep` (the click handler) can be a method that accepts a click event argument: ``` currentStep(clickEvent) { ``` Then use [Function.bind()](https://developer.mozilla.org/en-US/docs/...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
You could use a [trie](http://en.wikipedia.org/wiki/Trie) to hold the list of strings; tries were designed for fast re*trie*val. Here's [one example](http://www.kerrywong.com/2006/04/01/implementing-a-trie-in-c/) of implementing a trie in C#. **Update**: [Powerpoint presentation on folded tries for Unicode](http://icu...
Re your "when the list is small" concern; if you don't mind using non-generic collections, `System.Collections.Specialized.HybridDictionary` does something like this; it encapsulates a `System.Collections.Specialized.ListDictionary` when small, or a `System.Collections.Hashtable` when it gets bigger (`>10`). Worth a lo...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
Check out these: [Jomo Fisher - Fast Switching with LINQ](http://blogs.msdn.com/jomo_fisher/archive/2007/03/28/fast-switching-with-linq.aspx) [Gustavo Guerra - StaticStringDictionary - Fast Switching with LINQ revisited](http://functionalflow.co.uk/blog/2008/08/28/staticstringdictionary-fast-switching-with-linq-revis...
You could use string interning to do this very quickly. When building the list, you have to store your required string's interned format (the result of [`string.Intern()`](http://msdn.microsoft.com/en-us/library/system.string.intern.aspx)). Then, you need to compare against an interned string with [`object.ReferenceEqu...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
Have you considered using the [HashSet](http://msdn.microsoft.com/en-us/library/bb359438.aspx) class (in .NET 3) instead?
As an aside, if memory serves, when a String is constructed, its HashValue is precomputed and stored with the String as an optimization for this type of use case. If you're using a character array or StringBuilder, this obviously doesn't apply, but for an immutable String it should. EDIT: I am incorrect... Java does c...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
Have you considered using the [HashSet](http://msdn.microsoft.com/en-us/library/bb359438.aspx) class (in .NET 3) instead?
You could use string interning to do this very quickly. When building the list, you have to store your required string's interned format (the result of [`string.Intern()`](http://msdn.microsoft.com/en-us/library/system.string.intern.aspx)). Then, you need to compare against an interned string with [`object.ReferenceEqu...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
Check out these: [Jomo Fisher - Fast Switching with LINQ](http://blogs.msdn.com/jomo_fisher/archive/2007/03/28/fast-switching-with-linq.aspx) [Gustavo Guerra - StaticStringDictionary - Fast Switching with LINQ revisited](http://functionalflow.co.uk/blog/2008/08/28/staticstringdictionary-fast-switching-with-linq-revis...
As an aside, if memory serves, when a String is constructed, its HashValue is precomputed and stored with the String as an optimization for this type of use case. If you're using a character array or StringBuilder, this obviously doesn't apply, but for an immutable String it should. EDIT: I am incorrect... Java does c...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
Check out these: [Jomo Fisher - Fast Switching with LINQ](http://blogs.msdn.com/jomo_fisher/archive/2007/03/28/fast-switching-with-linq.aspx) [Gustavo Guerra - StaticStringDictionary - Fast Switching with LINQ revisited](http://functionalflow.co.uk/blog/2008/08/28/staticstringdictionary-fast-switching-with-linq-revis...
I ended up doing this: ``` private static bool Contains(List<string> list, string value) { bool contains = null != list.Find(str => str.ToLower().Equals(value.ToLower())); return contains; } ``` I'm guessing you could create an extension method for `List<string>`, but this was sufficient for my needs.
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
Check out these: [Jomo Fisher - Fast Switching with LINQ](http://blogs.msdn.com/jomo_fisher/archive/2007/03/28/fast-switching-with-linq.aspx) [Gustavo Guerra - StaticStringDictionary - Fast Switching with LINQ revisited](http://functionalflow.co.uk/blog/2008/08/28/staticstringdictionary-fast-switching-with-linq-revis...
Have you considered using the [HashSet](http://msdn.microsoft.com/en-us/library/bb359438.aspx) class (in .NET 3) instead?
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
You could use a [trie](http://en.wikipedia.org/wiki/Trie) to hold the list of strings; tries were designed for fast re*trie*val. Here's [one example](http://www.kerrywong.com/2006/04/01/implementing-a-trie-in-c/) of implementing a trie in C#. **Update**: [Powerpoint presentation on folded tries for Unicode](http://icu...
As an aside, if memory serves, when a String is constructed, its HashValue is precomputed and stored with the String as an optimization for this type of use case. If you're using a character array or StringBuilder, this obviously doesn't apply, but for an immutable String it should. EDIT: I am incorrect... Java does c...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
I ended up doing this: ``` private static bool Contains(List<string> list, string value) { bool contains = null != list.Find(str => str.ToLower().Equals(value.ToLower())); return contains; } ``` I'm guessing you could create an extension method for `List<string>`, but this was sufficient for my needs.
You could use string interning to do this very quickly. When building the list, you have to store your required string's interned format (the result of [`string.Intern()`](http://msdn.microsoft.com/en-us/library/system.string.intern.aspx)). Then, you need to compare against an interned string with [`object.ReferenceEqu...
1,153,152
I'd like to have 'b' be equally distributed along 'a' like this : ``` [1 2 3 4] ``` It would be nice that if there is not enough space, then 'a' block extends to the next line. Here is the html structure, I'd like, but its not fixed in stone and can be modified. ``` <html> <head> <...
2009/07/20
[ "https://Stackoverflow.com/questions/1153152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4508/" ]
You could use a [trie](http://en.wikipedia.org/wiki/Trie) to hold the list of strings; tries were designed for fast re*trie*val. Here's [one example](http://www.kerrywong.com/2006/04/01/implementing-a-trie-in-c/) of implementing a trie in C#. **Update**: [Powerpoint presentation on folded tries for Unicode](http://icu...
I ended up doing this: ``` private static bool Contains(List<string> list, string value) { bool contains = null != list.Find(str => str.ToLower().Equals(value.ToLower())); return contains; } ``` I'm guessing you could create an extension method for `List<string>`, but this was sufficient for my needs.
9,275,786
Currently on OSX 10.7 Lion openssl 0.9.8r is installed. This build is from Feb 2011 and I want to update it to the newest version. I can't use the autoupdate because I need the enable-cms option so I built it from the source, run `./Configure darwin64-x86_64-cc`and `./config enable-cms --openssldir=~/usr/local/ssl`. Th...
2012/02/14
[ "https://Stackoverflow.com/questions/9275786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1174532/" ]
Okay, I found a solution. Before starting: 1. download sources 2. unpack sources 3. go into the unpacked source directory The *prefix* has to be set on the `/usr/` folder. ``` sudo ./configure --prefix=/usr/ darwin64-x86_64-cc enable-cms sudo make sudo make install ``` **Note**: To perform just a normal update yo...
brew version (installed in '/usr/local/opt/openssl/bin') has such support for me. <https://formulae.brew.sh/formula/openssl@1.1>
62,110
What does "be out" mean in this excerpt: > > So just to recap real quick, make sure your car’s back into drive, signal to the left so that you're indicating which way you're pulling out, you're going to check your left side mirror to make sure you have enough room, and then right before you actually pull out, you mus...
2015/07/18
[ "https://ell.stackexchange.com/questions/62110", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/5036/" ]
Rather than grouping "be out" together, it is probably easier to understand if you read it like "[You will be] [out there] [driving safely again]". By "out there", he means, "on the road". "Out there" could refer to any location, though. You could say, "Get out there and have an adventure!" if you were telling someone...
It's simply an informal way of saying you will be out on the road.
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
This is almost the precise definition of ***foolhardy.*** > > Recklessly bold or rash. > > > *‘it would be foolhardy to go into the scheme without support’* > > > –Oxford via [Lexico](https://www.lexico.com/en/definition/foolhardy) > > > The etymology shows its appropriateness, too: > > Middle English from ...
**pugnacious** describes a person who is willing to fight for fighting's sake, even with no prospect of winning the fight > > pugnacious > > > adj. Combative in nature. synonym: belligerent. > > > Disposed to fight; quarrelsome; given to fighting: as, a pugnacious fellow; a pugnacious disposition. > > > Synonym...
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
**"To bite off more than you can chew"** means "to take on more responsibility than one can handle" or "to decide or agree to do more than one can finally accomplish", according to [the Free Dictionary](https://idioms.thefreedictionary.com/bite+off+more+than+can+chew). In this context, it would be saying that they star...
The word used could imply foolishness, bravery, courage, ignorance or perhaps something else that did not occur to me. If you could be more specific about how you view or regard or assess that person it would be easier to supply an appropriate word.
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
What about *poking the bear*? From [google](https://www.google.com/search?q=poke+the+bear4) (emphasis mine): > > deliberately provoke or antagonize someone, **especially someone more powerful than oneself**. > > > As a noncontroversial example: "By threatening British shipping, Sealand is really poking the bear"....
This is almost the precise definition of ***foolhardy.*** > > Recklessly bold or rash. > > > *‘it would be foolhardy to go into the scheme without support’* > > > –Oxford via [Lexico](https://www.lexico.com/en/definition/foolhardy) > > > The etymology shows its appropriateness, too: > > Middle English from ...
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
What about *poking the bear*? From [google](https://www.google.com/search?q=poke+the+bear4) (emphasis mine): > > deliberately provoke or antagonize someone, **especially someone more powerful than oneself**. > > > As a noncontroversial example: "By threatening British shipping, Sealand is really poking the bear"....
The word used could imply foolishness, bravery, courage, ignorance or perhaps something else that did not occur to me. If you could be more specific about how you view or regard or assess that person it would be easier to supply an appropriate word.
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
Edit: Seeing @Zack's answer, I'll leave it out here. "Poking a/the bear" is right on the money. I'll leave in my bit about "sleeping giants" though since it has more links and the Napoleon context. --- As far as countries poking at each other, a minor part or player forcing action from its superior is "[the tail wagg...
The word used could imply foolishness, bravery, courage, ignorance or perhaps something else that did not occur to me. If you could be more specific about how you view or regard or assess that person it would be easier to supply an appropriate word.
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
What about *poking the bear*? From [google](https://www.google.com/search?q=poke+the+bear4) (emphasis mine): > > deliberately provoke or antagonize someone, **especially someone more powerful than oneself**. > > > As a noncontroversial example: "By threatening British shipping, Sealand is really poking the bear"....
**pugnacious** describes a person who is willing to fight for fighting's sake, even with no prospect of winning the fight > > pugnacious > > > adj. Combative in nature. synonym: belligerent. > > > Disposed to fight; quarrelsome; given to fighting: as, a pugnacious fellow; a pugnacious disposition. > > > Synonym...
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
This is almost the precise definition of ***foolhardy.*** > > Recklessly bold or rash. > > > *‘it would be foolhardy to go into the scheme without support’* > > > –Oxford via [Lexico](https://www.lexico.com/en/definition/foolhardy) > > > The etymology shows its appropriateness, too: > > Middle English from ...
The word used could imply foolishness, bravery, courage, ignorance or perhaps something else that did not occur to me. If you could be more specific about how you view or regard or assess that person it would be easier to supply an appropriate word.
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
A weak person's action of fighting stronger opponents is [punching up](https://en.wiktionary.org/wiki/punch_up) ====================================================== > > To attack or target a group of greater power and/or status than oneself. > > > Instead of criticizing a foolhardy action like you're looking f...
The word used could imply foolishness, bravery, courage, ignorance or perhaps something else that did not occur to me. If you could be more specific about how you view or regard or assess that person it would be easier to supply an appropriate word.
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
What about *poking the bear*? From [google](https://www.google.com/search?q=poke+the+bear4) (emphasis mine): > > deliberately provoke or antagonize someone, **especially someone more powerful than oneself**. > > > As a noncontroversial example: "By threatening British shipping, Sealand is really poking the bear"....
**"To bite off more than you can chew"** means "to take on more responsibility than one can handle" or "to decide or agree to do more than one can finally accomplish", according to [the Free Dictionary](https://idioms.thefreedictionary.com/bite+off+more+than+can+chew). In this context, it would be saying that they star...
502,451
I was looking for a word, a verb specifically, to describe the situation or action when a weak person challenges a stronger opponent into fight, although they know they have no chance of winning. What verb can best be used to describe the act of a party challenging the other stronger side to fight? For example, we c...
2019/06/20
[ "https://english.stackexchange.com/questions/502451", "https://english.stackexchange.com", "https://english.stackexchange.com/users/63425/" ]
A weak person's action of fighting stronger opponents is [punching up](https://en.wiktionary.org/wiki/punch_up) ====================================================== > > To attack or target a group of greater power and/or status than oneself. > > > Instead of criticizing a foolhardy action like you're looking f...
**pugnacious** describes a person who is willing to fight for fighting's sake, even with no prospect of winning the fight > > pugnacious > > > adj. Combative in nature. synonym: belligerent. > > > Disposed to fight; quarrelsome; given to fighting: as, a pugnacious fellow; a pugnacious disposition. > > > Synonym...
1,090,066
I've come across 2 different styles when adding button listeners in UI. I use SWT as example. But nonetheless I saw the similar code in J2ME, Flash Actionscript as well. style 1: ``` b1.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { Sy...
2009/07/07
[ "https://Stackoverflow.com/questions/1090066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125470/" ]
I generally dislike the second style, because it creates a coupling between the two buttons and also with their container. If the functionality of B1 and B2 is independent, B1 shouldn't know anything about B2 and vice versa. By sharing the event handler, not only are you doing a wasteful check, but you also break thi...
In my opinion this is one of those things where 'it depends' might be the best answer you're going to get. If you're doing something quick and dirty the first is going to be faster and easier. If you're developing a real application you're going to value the separation of concerns the second buys you (although I'd prob...
1,090,066
I've come across 2 different styles when adding button listeners in UI. I use SWT as example. But nonetheless I saw the similar code in J2ME, Flash Actionscript as well. style 1: ``` b1.addSelectionListener(new SelectionListener() { public void widgetSelected(SelectionEvent e) { Sy...
2009/07/07
[ "https://Stackoverflow.com/questions/1090066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/125470/" ]
I generally dislike the second style, because it creates a coupling between the two buttons and also with their container. If the functionality of B1 and B2 is independent, B1 shouldn't know anything about B2 and vice versa. By sharing the event handler, not only are you doing a wasteful check, but you also break thi...
Answer from Uri gave me some idea about matching the action with listener. I've just come out with a modified version of the first approach. ``` private Map<Control, ICommand> commandMap = new HashMap<Control, ICommand>(); private HelloCommand helloCommand = new HelloCommand(); private WorldCommand worldCo...
21,349,053
what is the replacement of this super(); statement in my code ...because its showing me an error called: Constructor Call must be the first statement in a constructor. ``` class c implements android.view.View.OnClickListener { final b a; private final Dialog b; c(b b1, Dialog dialog) { a = b1; b = dialog; ...
2014/01/25
[ "https://Stackoverflow.com/questions/21349053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2779049/" ]
It should be: ``` c(b b1, Dialog dialog) { super(); a = b1; b = dialog; } ```
Change c to this: ``` c(b b1, Dialog dialog) { super(); a = b1; b = dialog; } ``` If you call the superclass constructor, you always have to do that before doing your own initialization.
21,349,053
what is the replacement of this super(); statement in my code ...because its showing me an error called: Constructor Call must be the first statement in a constructor. ``` class c implements android.view.View.OnClickListener { final b a; private final Dialog b; c(b b1, Dialog dialog) { a = b1; b = dialog; ...
2014/01/25
[ "https://Stackoverflow.com/questions/21349053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2779049/" ]
It should be: ``` c(b b1, Dialog dialog) { super(); a = b1; b = dialog; } ```
You could also for convenience change variable names like: ``` class C implements android.view.View.OnClickListener { final B a; private final Dialog b; c(B a, Dialog b) { super(); this.a = a; this.b = b; } public void onClick(View view) { b.cancel(); } } ```
21,349,053
what is the replacement of this super(); statement in my code ...because its showing me an error called: Constructor Call must be the first statement in a constructor. ``` class c implements android.view.View.OnClickListener { final b a; private final Dialog b; c(b b1, Dialog dialog) { a = b1; b = dialog; ...
2014/01/25
[ "https://Stackoverflow.com/questions/21349053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2779049/" ]
It should be: ``` c(b b1, Dialog dialog) { super(); a = b1; b = dialog; } ```
`super();` refers to the extended class constructor i.e. `Object`.. To avoid getting such error,modify your code such that `super();` should be the first statement in constructor of `c` class. ``` c(b b1,Dialog dialog) { super(); a = b1; b = dialog; } ``` P.S. Your compiler itself giving you the answe...
15,186,433
Here is the source of a function I use get HTML code for further proccessing: ``` Public Function DownloadTextFile(url As String) As String Dim oHTTP As WinHttp.WinHttpRequest Set oHTTP = New WinHttp.WinHttpRequest oHTTP.Open Method:="GET", url:=url, async:=False oHTTP.setRequestHeader "User-Agent", "...
2013/03/03
[ "https://Stackoverflow.com/questions/15186433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2127981/" ]
Solution that worked for me: ``` responseText = VBA.Strings.StrConv(oHTTP.ResponseBody, vbUnicode) ``` Note the use of ResponseBody instead of ResponseText
Try to use StrConv: ``` DownloadTextFile = VBA.Strings.StrConv(responseText, vbUnicode) ``` vbUnicode: Converts the string to Unicode using the default code page of the system. (Not available on the Macintosh.)
3,134
We know that if a Devil Fruit user dies, their fruit reappears (see [In One Piece, does a Devil Fruit reappear after the user dies?](https://anime.stackexchange.com/q/2979/24)). However, this doesn't answer the question of what happens when the fruit gets destroyed without being eaten. I don't know if that's even possi...
2013/04/01
[ "https://anime.stackexchange.com/questions/3134", "https://anime.stackexchange.com", "https://anime.stackexchange.com/users/24/" ]
I don't think you can separate destroyed and *being eaten*, eating a devil fruit in One Piece pretty much [*destroys*](https://anime.stackexchange.com/a/932/1528) it. So destruction by power, physical force and or being eaten could be considered as being the same. That being said, I would think the same thing would h...
The only way you can get a canon answer is from the source. Yet, seeing as there is no way to just *destroy* anything, this situation is completely void, since it would never happen, and would have no reason to. Since canon won't happen, here's some speculation: Since nothing can be destroyed, whatever remains of the ...
3,134
We know that if a Devil Fruit user dies, their fruit reappears (see [In One Piece, does a Devil Fruit reappear after the user dies?](https://anime.stackexchange.com/q/2979/24)). However, this doesn't answer the question of what happens when the fruit gets destroyed without being eaten. I don't know if that's even possi...
2013/04/01
[ "https://anime.stackexchange.com/questions/3134", "https://anime.stackexchange.com", "https://anime.stackexchange.com/users/24/" ]
I don't think you can separate destroyed and *being eaten*, eating a devil fruit in One Piece pretty much [*destroys*](https://anime.stackexchange.com/a/932/1528) it. So destruction by power, physical force and or being eaten could be considered as being the same. That being said, I would think the same thing would h...
This question has been already answered here: [In One Piece, does a Devil Fruit reappear after the user dies?](https://anime.stackexchange.com/questions/2979/in-one-piece-does-the-devil-fruit-reappear-after-the-user-dies) In summary, when the ability user dies, the ability reborns in another fruit.
3,134
We know that if a Devil Fruit user dies, their fruit reappears (see [In One Piece, does a Devil Fruit reappear after the user dies?](https://anime.stackexchange.com/q/2979/24)). However, this doesn't answer the question of what happens when the fruit gets destroyed without being eaten. I don't know if that's even possi...
2013/04/01
[ "https://anime.stackexchange.com/questions/3134", "https://anime.stackexchange.com", "https://anime.stackexchange.com/users/24/" ]
The only way you can get a canon answer is from the source. Yet, seeing as there is no way to just *destroy* anything, this situation is completely void, since it would never happen, and would have no reason to. Since canon won't happen, here's some speculation: Since nothing can be destroyed, whatever remains of the ...
This question has been already answered here: [In One Piece, does a Devil Fruit reappear after the user dies?](https://anime.stackexchange.com/questions/2979/in-one-piece-does-the-devil-fruit-reappear-after-the-user-dies) In summary, when the ability user dies, the ability reborns in another fruit.