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
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Если **этруски** и русские - родственные народы, то это должно наблюдаться в языке. А этого как раз нет (кроме созвучия названий). Родственные связи этрусского языка являются дискуссионными. Составление словаря этрусского языка и расшифровка текстов продвигаются медленно и по сей день далеки от завершения. Этрусский яз...
Задорнов тоже не с потолка взял, а от других теоретиков. Этрусский язык, который "не читается", был прочитан одним из ученых изучавших древнерусское письмо. Этрусский язык является более древним, чем сейчас преподаваемая староверами "буквица"(если не изменяет память) из 49 букв.
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Если **этруски** и русские - родственные народы, то это должно наблюдаться в языке. А этого как раз нет (кроме созвучия названий). Родственные связи этрусского языка являются дискуссионными. Составление словаря этрусского языка и расшифровка текстов продвигаются медленно и по сей день далеки от завершения. Этрусский яз...
> > Вот спасибо, порадовали. Я-то дкмал, что он, типа, шутит, а он оказыввается с титиретиками общается. Не иначе как на спиритическом сеансе. Или это у него диагноз такой "теоретик"? > > > --- Нормальные живые теоретики ("мертвые" - это которым сказать нечего. От них один мало чем подкрепленный сарказм). Я видел...
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Если **этруски** и русские - родственные народы, то это должно наблюдаться в языке. А этого как раз нет (кроме созвучия названий). Родственные связи этрусского языка являются дискуссионными. Составление словаря этрусского языка и расшифровка текстов продвигаются медленно и по сей день далеки от завершения. Этрусский яз...
Задорнова люблю давно (лет 30 уже). И сейчас иногда его слушаю, хотя, честно говоря, примелькался. Его лингвистические изыскания никогда всерьёз не воспринимала. Это просто юмор. Не думаю, что он родоначальник т. н. "народной этимологии". Думается, дилетанство у нас в крови. Все знают, как правильно лечить, учить, суди...
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Этру**сс**ки - это очередной шедевр от Задорнова. Этим всё сказано. Честно говоря, не заслуживает оно развернутых комментариев. А вот насчет пруссов... Начнем от печки. Поскольку этнохороним "русские" не имеет ясной этимологии (посмотрите в Интренете, столько всего понаписано) и версии строятся в ориентации на разны...
Задорнов тоже не с потолка взял, а от других теоретиков. Этрусский язык, который "не читается", был прочитан одним из ученых изучавших древнерусское письмо. Этрусский язык является более древним, чем сейчас преподаваемая староверами "буквица"(если не изменяет память) из 49 букв.
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Этру**сс**ки - это очередной шедевр от Задорнова. Этим всё сказано. Честно говоря, не заслуживает оно развернутых комментариев. А вот насчет пруссов... Начнем от печки. Поскольку этнохороним "русские" не имеет ясной этимологии (посмотрите в Интренете, столько всего понаписано) и версии строятся в ориентации на разны...
> > Вот спасибо, порадовали. Я-то дкмал, что он, типа, шутит, а он оказыввается с титиретиками общается. Не иначе как на спиритическом сеансе. Или это у него диагноз такой "теоретик"? > > > --- Нормальные живые теоретики ("мертвые" - это которым сказать нечего. От них один мало чем подкрепленный сарказм). Я видел...
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Этру**сс**ки - это очередной шедевр от Задорнова. Этим всё сказано. Честно говоря, не заслуживает оно развернутых комментариев. А вот насчет пруссов... Начнем от печки. Поскольку этнохороним "русские" не имеет ясной этимологии (посмотрите в Интренете, столько всего понаписано) и версии строятся в ориентации на разны...
Задорнова люблю давно (лет 30 уже). И сейчас иногда его слушаю, хотя, честно говоря, примелькался. Его лингвистические изыскания никогда всерьёз не воспринимала. Это просто юмор. Не думаю, что он родоначальник т. н. "народной этимологии". Думается, дилетанство у нас в крови. Все знают, как правильно лечить, учить, суди...
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
> > Вот спасибо, порадовали. Я-то дкмал, что он, типа, шутит, а он оказыввается с титиретиками общается. Не иначе как на спиритическом сеансе. Или это у него диагноз такой "теоретик"? > > > --- Нормальные живые теоретики ("мертвые" - это которым сказать нечего. От них один мало чем подкрепленный сарказм). Я видел...
Задорнов тоже не с потолка взял, а от других теоретиков. Этрусский язык, который "не читается", был прочитан одним из ученых изучавших древнерусское письмо. Этрусский язык является более древним, чем сейчас преподаваемая староверами "буквица"(если не изменяет память) из 49 букв.
4,649
Есть некоторые научные, а скорее, псевдонаучные теории о том, что якобы русские и этруски - это родственные народы. В качестве доказательства приводят схожесть названий. Действительно ли в названии этих народов есть общий корень "-рус-", или это случайность? А также меня интересуют пруссы. Спасибо.
2012/05/15
[ "https://rus.stackexchange.com/questions/4649", "https://rus.stackexchange.com", "https://rus.stackexchange.com/users/3/" ]
Задорнова люблю давно (лет 30 уже). И сейчас иногда его слушаю, хотя, честно говоря, примелькался. Его лингвистические изыскания никогда всерьёз не воспринимала. Это просто юмор. Не думаю, что он родоначальник т. н. "народной этимологии". Думается, дилетанство у нас в крови. Все знают, как правильно лечить, учить, суди...
Задорнов тоже не с потолка взял, а от других теоретиков. Этрусский язык, который "не читается", был прочитан одним из ученых изучавших древнерусское письмо. Этрусский язык является более древним, чем сейчас преподаваемая староверами "буквица"(если не изменяет память) из 49 букв.
29,278,651
Is the port for "Resource­Manager Web UI" for a yarn machine always set to 8088 or is it possible to change it? I see here in the [documentation of hortonworks](http://docs.hortonworks.com/HDP2Alpha/index.htm#Appendix/Ports_Appendix/YARN_Ports.htm) that the default value is 8088, but it is not written whether it could...
2015/03/26
[ "https://Stackoverflow.com/questions/29278651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3518314/" ]
You can setup the WebUI address in `yarn-default.xml` file. Set property `yarn.resourcemanager.webapp.address` to another port. For more detailed information refer to the documentation <http://docs.hortonworks.com/Hadoop2.0/hadoop-yarn/hadoop-yarn-common/yarn-default.xml>
With last version of YARN as of now (Oct 2018), default port is 8088: <https://hadoop.apache.org/docs/r2.4.1/hadoop-yarn/hadoop-yarn-common/yarn-default.xml>
36,319,083
I'm trying to coordinate data between two separate sheets using the following formula: ``` =LOOKUP(A3,Housed!A:A,Housed!B:B) ``` However, when that formula is applied to destination cells for which "`search_key`" is not found among "`search_range`", the output of "`result_range`" for the previous cell in the destina...
2016/03/30
[ "https://Stackoverflow.com/questions/36319083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6136794/" ]
You need `vlookup`, not `lookup` (suggestion: never use `lookup`). The following function achieves your objective: ``` =IFERROR(VLOOKUP(A2, Sheet2!A:B, 2, False)) ``` Explanation: * Second parameter of vlookup is the range that includes both the column to search (must be the first one), and the column from which r...
Try this `=IF(isna(MATCH(A2,Sheet2!A:A,0))=false,VLOOKUP(A2,Sheet2!A:B,2),"")`
36,319,083
I'm trying to coordinate data between two separate sheets using the following formula: ``` =LOOKUP(A3,Housed!A:A,Housed!B:B) ``` However, when that formula is applied to destination cells for which "`search_key`" is not found among "`search_range`", the output of "`result_range`" for the previous cell in the destina...
2016/03/30
[ "https://Stackoverflow.com/questions/36319083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6136794/" ]
`VLOOKUP` with the last parameter (`IsSorted`) set FALSE can get very slow. ``` =IF(VLOOKUP(A2, other!A:A, 1) = A2, VLOOKUP(A2, other!A:B, 2), "") ```
Try this `=IF(isna(MATCH(A2,Sheet2!A:A,0))=false,VLOOKUP(A2,Sheet2!A:B,2),"")`
36,319,083
I'm trying to coordinate data between two separate sheets using the following formula: ``` =LOOKUP(A3,Housed!A:A,Housed!B:B) ``` However, when that formula is applied to destination cells for which "`search_key`" is not found among "`search_range`", the output of "`result_range`" for the previous cell in the destina...
2016/03/30
[ "https://Stackoverflow.com/questions/36319083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6136794/" ]
You need `vlookup`, not `lookup` (suggestion: never use `lookup`). The following function achieves your objective: ``` =IFERROR(VLOOKUP(A2, Sheet2!A:B, 2, False)) ``` Explanation: * Second parameter of vlookup is the range that includes both the column to search (must be the first one), and the column from which r...
`VLOOKUP` with the last parameter (`IsSorted`) set FALSE can get very slow. ``` =IF(VLOOKUP(A2, other!A:A, 1) = A2, VLOOKUP(A2, other!A:B, 2), "") ```
23,420,057
I'm using Zurb Foundation, and I would like to create a navigation bar fixed to the bottom of the window. I've positioned it properly, but the dropdown menus can't be seen because they are appearing below the bottom of the window. How can I make the menus drop up from the nav rather than drop down? Here is a codepen...
2014/05/02
[ "https://Stackoverflow.com/questions/23420057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2877587/" ]
@bigfish66 got me half way there, but on small screens the data-options value was being ignored. To get the menu to always drop up, I took the css from the drop up at the larger screen, and applied it with !important to overwrite the element styles from placing the menu back underneath the button on the smaller screens...
You can align them with a data-options attribute...so for you align to the top : ``` <section class="top-bar-section"> <ul class="right"> <li class="has-dropdown"> <a href="#" data-options = "align:top" >Right Button Dropdown</a> <ul class="dropdown"> <li><a href="#">First link in dropdown</a></li...
63,747,598
I have created a SQL Server trigger as below. ``` create trigger testtrigger on testdb for insert as declare @sql varchar(8000) SELECT @sql = 'bcp "select * from testdb" queryout c:/test.txt -c -t -T -S localhost' exec xp_cmdshell @sql go ``` But when a row inserted in the testdb, the text file is created, but th...
2020/09/04
[ "https://Stackoverflow.com/questions/63747598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12340627/" ]
Beyond the recommendations regarding not using that approach, I'd ask you if you are sure that the insert is completed. The most probable situation is that you're facing a deadlock, and a kind of deadlock that SQL is not able to handle because of the fact that one of the resources involved is out of SQL scope (command...
Try making the trigger AFTER INSERT and then export from the 'inserted' psuedo-table instead of the actual table 'testdb'. The newly inserted rows will be exported. ``` create trigger testtrigger on testdb after insert as if exists (select * from inserted) begin declare @sql varchar(8000), ...
41,357,330
I have null values in database specifically for Good Expiry Date, which is the field is:`good_expiryDate`. What i want is to handle it in this way: If `good_expiryDate` is null i want to present it as "" or "-", if it has value it will show the value retrieved from database? the LINQ query i write is like this, but i...
2016/12/28
[ "https://Stackoverflow.com/questions/41357330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7279958/" ]
Ensure that `gdExpiryDate` is of type `string`. Then change this line ``` gdExpiryDate =(DateTime) gds.good_expiryDate==null?DateTime.MinValue: (DateTime)gds.good_expiryDate, ``` to ``` gdExpiryDate = gds.good_expiryDate==null? "-" : ((DateTime)gds.good_expiryDate).ToString(), ```
Change `gdExpiryDate` type to `string` type and write like this: ``` select new DataItem { depNumber=(int)cd.cdin_Serial, ItemDesc=gds.good_Name, gdExpiryDate = gds.good_expiryDate == null ? "" : gds.good_expiryDate.Value.ToString("dd.mm.yyyy"), ...
20,398,773
Following code read a piece data from given `DataRow`(modelValue) and parse it to a `nullable` `DateTime` instance. **Question**: Please see the code sections under `L1 & L2` where both are technically equal (If i am not making any schoolboy error). However, `L1` works as expected but not `L2`. I am getting > > the...
2013/12/05
[ "https://Stackoverflow.com/questions/20398773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2346961/" ]
You need to tell the compiler that the null should be treated as `DateTime?`. Otherwise the compiler doesn't know what type `null` is. `CallBack = cdate == DateTime.MinValue ? (DateTime?)null : cdate.Date;`
Why don't you use the [`DataRow.Field`](http://msdn.microsoft.com/en-us/library/bb360891%28v=vs.100%29.aspx) extension method which supports nullable types in the first place? ``` DateTime? CallBack = modelValue.Field<DateTime?>("CallBack"); ``` But since you actually have a `string` column you need to parse it firs...
20,398,773
Following code read a piece data from given `DataRow`(modelValue) and parse it to a `nullable` `DateTime` instance. **Question**: Please see the code sections under `L1 & L2` where both are technically equal (If i am not making any schoolboy error). However, `L1` works as expected but not `L2`. I am getting > > the...
2013/12/05
[ "https://Stackoverflow.com/questions/20398773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2346961/" ]
``` (Z) ? X : Y ``` The ternary operator requires that an implicit conversion exists from the second operand (X) to the third operand (Y), or from Y to X. Since `null` cannot be implicitly converted to `DateTime`, nor `DateTime` to `null`, the expression cannot be evaluated. More on this: [Type inference woes by Eri...
You need to tell the compiler that the null should be treated as `DateTime?`. Otherwise the compiler doesn't know what type `null` is. `CallBack = cdate == DateTime.MinValue ? (DateTime?)null : cdate.Date;`
20,398,773
Following code read a piece data from given `DataRow`(modelValue) and parse it to a `nullable` `DateTime` instance. **Question**: Please see the code sections under `L1 & L2` where both are technically equal (If i am not making any schoolboy error). However, `L1` works as expected but not `L2`. I am getting > > the...
2013/12/05
[ "https://Stackoverflow.com/questions/20398773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2346961/" ]
You need to tell the compiler that the null should be treated as `DateTime?`. Otherwise the compiler doesn't know what type `null` is. `CallBack = cdate == DateTime.MinValue ? (DateTime?)null : cdate.Date;`
You could do the following: ``` DateTime aDateTime = DateTime.MinValue; DateTime? aNullableDateTime = aDateTime == DateTime.MinValue ? null : new DateTime?(aDateTime.Date); ``` which uses the Nullable(Of T) structure.
20,398,773
Following code read a piece data from given `DataRow`(modelValue) and parse it to a `nullable` `DateTime` instance. **Question**: Please see the code sections under `L1 & L2` where both are technically equal (If i am not making any schoolboy error). However, `L1` works as expected but not `L2`. I am getting > > the...
2013/12/05
[ "https://Stackoverflow.com/questions/20398773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2346961/" ]
``` (Z) ? X : Y ``` The ternary operator requires that an implicit conversion exists from the second operand (X) to the third operand (Y), or from Y to X. Since `null` cannot be implicitly converted to `DateTime`, nor `DateTime` to `null`, the expression cannot be evaluated. More on this: [Type inference woes by Eri...
Why don't you use the [`DataRow.Field`](http://msdn.microsoft.com/en-us/library/bb360891%28v=vs.100%29.aspx) extension method which supports nullable types in the first place? ``` DateTime? CallBack = modelValue.Field<DateTime?>("CallBack"); ``` But since you actually have a `string` column you need to parse it firs...
20,398,773
Following code read a piece data from given `DataRow`(modelValue) and parse it to a `nullable` `DateTime` instance. **Question**: Please see the code sections under `L1 & L2` where both are technically equal (If i am not making any schoolboy error). However, `L1` works as expected but not `L2`. I am getting > > the...
2013/12/05
[ "https://Stackoverflow.com/questions/20398773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2346961/" ]
Why don't you use the [`DataRow.Field`](http://msdn.microsoft.com/en-us/library/bb360891%28v=vs.100%29.aspx) extension method which supports nullable types in the first place? ``` DateTime? CallBack = modelValue.Field<DateTime?>("CallBack"); ``` But since you actually have a `string` column you need to parse it firs...
You could do the following: ``` DateTime aDateTime = DateTime.MinValue; DateTime? aNullableDateTime = aDateTime == DateTime.MinValue ? null : new DateTime?(aDateTime.Date); ``` which uses the Nullable(Of T) structure.
20,398,773
Following code read a piece data from given `DataRow`(modelValue) and parse it to a `nullable` `DateTime` instance. **Question**: Please see the code sections under `L1 & L2` where both are technically equal (If i am not making any schoolboy error). However, `L1` works as expected but not `L2`. I am getting > > the...
2013/12/05
[ "https://Stackoverflow.com/questions/20398773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2346961/" ]
``` (Z) ? X : Y ``` The ternary operator requires that an implicit conversion exists from the second operand (X) to the third operand (Y), or from Y to X. Since `null` cannot be implicitly converted to `DateTime`, nor `DateTime` to `null`, the expression cannot be evaluated. More on this: [Type inference woes by Eri...
You could do the following: ``` DateTime aDateTime = DateTime.MinValue; DateTime? aNullableDateTime = aDateTime == DateTime.MinValue ? null : new DateTime?(aDateTime.Date); ``` which uses the Nullable(Of T) structure.
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
For all versions: ``` Replace[a2, Append[Thread[a -> b], _ -> 0], 1] ``` > > > ``` > {10, 20, 0, 50, 80, 0} > > ``` > > If you need speed look at [`Dispatch`](http://reference.wolfram.com/language/ref/Dispatch.html). For versions 10.0 or later Association functionality is fast and concise: ``` Lookup[Associa...
``` Fold[Insert[#1, 0, #2] &, b, Position[Map[Position[a, #] &, a2], {}]] ``` > > {10, 20, 0, 50, 80, 0} > > > Probably faster with large lists: ``` Fold[Insert[#1, 0, #2] &, b, Position[a2, Alternatives @@ Complement[a2, a]]] ```
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
For all versions: ``` Replace[a2, Append[Thread[a -> b], _ -> 0], 1] ``` > > > ``` > {10, 20, 0, 50, 80, 0} > > ``` > > If you need speed look at [`Dispatch`](http://reference.wolfram.com/language/ref/Dispatch.html). For versions 10.0 or later Association functionality is fast and concise: ``` Lookup[Associa...
``` b2 = Sort[Join[{#, 0} & /@ Complement[a2, a], Join[Partition[Riffle[a, b], 2]]]][[All, 2]] ``` > > {10, 20, 0, 50, 80, 0} > > >
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
The most obvious : ``` If[MemberQ[a, #], b[[Position[a, #][[1, 1]]]], 0] & /@ a2 ``` > > {10, 20, 0, 50, 80, 0} > > >
``` b2 = Sort[Join[{#, 0} & /@ Complement[a2, a], Join[Partition[Riffle[a, b], 2]]]][[All, 2]] ``` > > {10, 20, 0, 50, 80, 0} > > >
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
Some pure "mathematical" ad hoc: ``` a2 /. Thread[a -> b] /. Thread[Complement[a2, a] -> 0] ``` > > {10, 20, 0, 50, 80, 0} > > >
``` mia = MapIndexed[Rule[#2, t[#1]] &, a]; mib = MapIndexed[Rule[#2, #1] &, b]; mic = MapIndexed[Rule[t[#1], #2] &, a2]; Normal@SparseArray[mib /. (mia /. mic), Length[a2]] (*{10, 20, 0, 50, 80, 0}*) ```
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
``` mia = MapIndexed[Rule[#2, t[#1]] &, a]; mib = MapIndexed[Rule[#2, #1] &, b]; mic = MapIndexed[Rule[t[#1], #2] &, a2]; Normal@SparseArray[mib /. (mia /. mic), Length[a2]] (*{10, 20, 0, 50, 80, 0}*) ```
``` b2 = Sort[Join[{#, 0} & /@ Complement[a2, a], Join[Partition[Riffle[a, b], 2]]]][[All, 2]] ``` > > {10, 20, 0, 50, 80, 0} > > >
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
``` Fold[Insert[#1, 0, #2] &, b, Position[Map[Position[a, #] &, a2], {}]] ``` > > {10, 20, 0, 50, 80, 0} > > > Probably faster with large lists: ``` Fold[Insert[#1, 0, #2] &, b, Position[a2, Alternatives @@ Complement[a2, a]]] ```
``` b2 = Sort[Join[{#, 0} & /@ Complement[a2, a], Join[Partition[Riffle[a, b], 2]]]][[All, 2]] ``` > > {10, 20, 0, 50, 80, 0} > > >
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
For all versions: ``` Replace[a2, Append[Thread[a -> b], _ -> 0], 1] ``` > > > ``` > {10, 20, 0, 50, 80, 0} > > ``` > > If you need speed look at [`Dispatch`](http://reference.wolfram.com/language/ref/Dispatch.html). For versions 10.0 or later Association functionality is fast and concise: ``` Lookup[Associa...
Some pure "mathematical" ad hoc: ``` a2 /. Thread[a -> b] /. Thread[Complement[a2, a] -> 0] ``` > > {10, 20, 0, 50, 80, 0} > > >
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
For all versions: ``` Replace[a2, Append[Thread[a -> b], _ -> 0], 1] ``` > > > ``` > {10, 20, 0, 50, 80, 0} > > ``` > > If you need speed look at [`Dispatch`](http://reference.wolfram.com/language/ref/Dispatch.html). For versions 10.0 or later Association functionality is fast and concise: ``` Lookup[Associa...
``` mia = MapIndexed[Rule[#2, t[#1]] &, a]; mib = MapIndexed[Rule[#2, #1] &, b]; mic = MapIndexed[Rule[t[#1], #2] &, a2]; Normal@SparseArray[mib /. (mia /. mic), Length[a2]] (*{10, 20, 0, 50, 80, 0}*) ```
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
``` Fold[Insert[#1, 0, #2] &, b, Position[Map[Position[a, #] &, a2], {}]] ``` > > {10, 20, 0, 50, 80, 0} > > > Probably faster with large lists: ``` Fold[Insert[#1, 0, #2] &, b, Position[a2, Alternatives @@ Complement[a2, a]]] ```
``` mia = MapIndexed[Rule[#2, t[#1]] &, a]; mib = MapIndexed[Rule[#2, #1] &, b]; mic = MapIndexed[Rule[t[#1], #2] &, a2]; Normal@SparseArray[mib /. (mia /. mic), Length[a2]] (*{10, 20, 0, 50, 80, 0}*) ```
104,085
I have two lists `a` and `b` of the same length. And another list `a2` which contains all elements from `a` and some others. Now I want to construct a list `b2` so that for the shared elements between `a2` and `a`, the corresponding elements in `b2` and `b` are the same, and for those elements in `a2` but not `a`, the ...
2016/01/14
[ "https://mathematica.stackexchange.com/questions/104085", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/7959/" ]
Some pure "mathematical" ad hoc: ``` a2 /. Thread[a -> b] /. Thread[Complement[a2, a] -> 0] ``` > > {10, 20, 0, 50, 80, 0} > > >
``` b2 = Sort[Join[{#, 0} & /@ Complement[a2, a], Join[Partition[Riffle[a, b], 2]]]][[All, 2]] ``` > > {10, 20, 0, 50, 80, 0} > > >
73,896,431
It's possible to use for loop with double indices in Java, e.g: ```java for (int j = 0, k = myArray.length - 1; j < myArray.length; j++, k--) ``` To iterate myArray elements from the first element using j and from the last element using k simultaneously without using inner loop. How can we do this in Kotlin without ...
2022/09/29
[ "https://Stackoverflow.com/questions/73896431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17574835/" ]
You don't need an inner loop. Just create an additional variable inside for loop. ```kotlin for(j in myArray.indices) { val k = myArray.size - 1 - j // Use j and k here } ``` Or alternatively, ```kotlin var k = myArray.size - 1 for(j in myArray.indices) { // Use j and k here k-- } ```
`generateSequence()` is powerful alternative for complex loops. Not so fast as pure for/while loop but very flexible and easy. ```kotlin generateSequence( 0 to myArray.size - 1 // initial values ) { it.first + 1 to it.second - 1 // new values after each iteration }.takeWhile { it.first < myArray.size // li...
73,896,431
It's possible to use for loop with double indices in Java, e.g: ```java for (int j = 0, k = myArray.length - 1; j < myArray.length; j++, k--) ``` To iterate myArray elements from the first element using j and from the last element using k simultaneously without using inner loop. How can we do this in Kotlin without ...
2022/09/29
[ "https://Stackoverflow.com/questions/73896431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17574835/" ]
**Kotlin doesn't provide a way to permit what you attempt to do.** Because I imagine your case is purely for exemple, I purpose you two solutions: 1. The good old way ------------------- The most optimized for the exemple you give. ``` for (i in a.indices) { val j = a.size - 1 - i println("($i, $j)") } ```...
`generateSequence()` is powerful alternative for complex loops. Not so fast as pure for/while loop but very flexible and easy. ```kotlin generateSequence( 0 to myArray.size - 1 // initial values ) { it.first + 1 to it.second - 1 // new values after each iteration }.takeWhile { it.first < myArray.size // li...
9,135
[Here is a video of Miami reliever Carter Capps pitching.](http://m.mlb.com/video/v73287783/miaatl-capps-hopstep-delivery-analyzed) As you can see, he basically jumps off the rubber, and delivers from the front of the mound. [Apparently](http://m.mlb.com/news/article/118060152/marlins-reliever-carter-capps-clears-up-c...
2015/04/17
[ "https://sports.stackexchange.com/questions/9135", "https://sports.stackexchange.com", "https://sports.stackexchange.com/users/6240/" ]
There are other relievers that "jump" off the rubber in their delivery. One I recall in particular is an 8th inning set up guy for Atlanta. He was traded in the off season to St. Louis. I believe his name is Jordan Walden. I never saw umpires call a balk on him or other such deliveries
Yes, It should be legal as multiple pitchers have been doing similar things. The reason Capps is not being busted is because of a possible bending of the balk rules - saying that he is not *really* attempting to bait anyone off base, so his other foot can come off the bag in one clear sweeping motion.
9,135
[Here is a video of Miami reliever Carter Capps pitching.](http://m.mlb.com/video/v73287783/miaatl-capps-hopstep-delivery-analyzed) As you can see, he basically jumps off the rubber, and delivers from the front of the mound. [Apparently](http://m.mlb.com/news/article/118060152/marlins-reliever-carter-capps-clears-up-c...
2015/04/17
[ "https://sports.stackexchange.com/questions/9135", "https://sports.stackexchange.com", "https://sports.stackexchange.com/users/6240/" ]
The baseball rulebook is rather ambiguous when it comes to launch points for pitchers. I have a strong feeling that within the next few years we see pitchers try to take advantage of whatever they can will happen and then eventually we might see actual rules that define exact things that need to happen. Right now ump...
Yes, It should be legal as multiple pitchers have been doing similar things. The reason Capps is not being busted is because of a possible bending of the balk rules - saying that he is not *really* attempting to bait anyone off base, so his other foot can come off the bag in one clear sweeping motion.
9,135
[Here is a video of Miami reliever Carter Capps pitching.](http://m.mlb.com/video/v73287783/miaatl-capps-hopstep-delivery-analyzed) As you can see, he basically jumps off the rubber, and delivers from the front of the mound. [Apparently](http://m.mlb.com/news/article/118060152/marlins-reliever-carter-capps-clears-up-c...
2015/04/17
[ "https://sports.stackexchange.com/questions/9135", "https://sports.stackexchange.com", "https://sports.stackexchange.com/users/6240/" ]
The baseball rulebook is rather ambiguous when it comes to launch points for pitchers. I have a strong feeling that within the next few years we see pitchers try to take advantage of whatever they can will happen and then eventually we might see actual rules that define exact things that need to happen. Right now ump...
There are other relievers that "jump" off the rubber in their delivery. One I recall in particular is an 8th inning set up guy for Atlanta. He was traded in the off season to St. Louis. I believe his name is Jordan Walden. I never saw umpires call a balk on him or other such deliveries
220,020
Is there a difference between wubi install and doing an install of Ubuntu alongside windows7? I ask because I used wubi, but I'm having trouble with certain things like being unable to change my brightness settings and I'm wondering if installing from a usb drive would change anything. Also, I've tried to do a usb driv...
2012/11/21
[ "https://askubuntu.com/questions/220020", "https://askubuntu.com", "https://askubuntu.com/users/109616/" ]
**Format and enable LZO** I would avoid using any GUI to format;-) `mkfs.btrfs device` is good enough, depending on how you would like to make use of Btrfs features: 1. use the external USB HDD as 1 single partition/block device 2. create 2 partitions (2 block devices) and form a raid1 or raid0 for data (-d), metada...
As the formatting and enabling LZO compression question is answered already, here is the answer to the Question how to automatically set the compression mount option on automount. This solution also works if you have btrfs on a LUKS-encrypted disk. **USB Automount** 1. Connect the disk and let your automounter mount...
1,211,937
I am quite new to SSH and Ubuntu. I am trying to connect to a server (e.g. `server1.com`) via SOCKS5 proxy host (e.g. `proxy1.com`) for which username and password is already given. I am including the jump host directives and path to proxy username and password in the SSH config file but no luck until now as I am alway...
2017/05/23
[ "https://superuser.com/questions/1211937", "https://superuser.com", "https://superuser.com/users/731129/" ]
Any large-sector disks, such as 4K native, 512E, or any non-512 native disks, are **not supported** on any Windows XP version. However, WD quick format can fix this: Please check the [WD official documentation](https://support.wdc.com/knowledgebase/answer.aspx?ID=3868) Just follow the guide and select Window XP comp...
I disagree slightly with @Overmind. While Microsoft may not officially support large sectors on XP, that doesn't mean it won't work. I can successfully use a Seagate 8TB drive on Windows XP SP3 *because* it has 4K Native sectors. In other words, because it identifies as having 4K sectors, Windows XP is able to use it n...
12,011,926
I have this perl script ``` #!/usr/bin/perl use lib "/home/gdanko/test/perl"; use Main; Plugins::Plug1::devices; ``` The module Main looks like this ``` package Main; use lib "/home/gdanko/test/perl"; use Plugins::Plug1; use DBI; @ISA = ('Exporter'); @EXPORT = qw(); @EXPORT_OK = qw($dbh &load_devices); our $db...
2012/08/17
[ "https://Stackoverflow.com/questions/12011926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/589254/" ]
You describe your module variously as `Plugins::Plug1`, `Plugins::Plug`, `Plug1` and `plug1`. You must be clear which it is, and a module `Plugins::Plug1` must be in a file named `Plugins/Plug1.pm` starting with the statement `package Plugins::Plug1` It is unclear from your question what is going wrong. What should ha...
`Plugins::Plug1` must declare that it "is a" `Main` (hint: Just like they both declare that they have an "is a" relationship to `Exporter`.) . Then the methods will be immediately available. However, you should read the perldoc on objects (start with [perlobj](http://perldoc.perl.org/perlobj.html)) if you're asking how...
7,037,875
I have a short code to get the results of a db\_query into an array: ``` $r = db_query('SELECT vid FROM {node_revisions} WHERE nid = %d', $node->nid); while ($vids[] = db_result($r)); ``` The only problem is, that I get an empty array value: ``` Array( [] => 105 [] => 409 [] => ) ``` How can I prevent th...
2011/08/12
[ "https://Stackoverflow.com/questions/7037875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/488794/" ]
I found the shortest code to get all results from db\_query in an array: ``` for ($vid; $vid = db_result($r); $vids[] = $vid); ``` The resulted array looks now like this: ``` Array( [0] => 105 [1] => 409 ) ```
Perhaps something like. ``` $next_result = db_result($r); while ($next_result) { $vids[] = $next_result; $next_result = db_result($r); } ``` Edit: Single line using short-circuit syntax. ``` while ($next = db_result($r) && $vids[] = $next); ```
28,122,856
i have xml file like this ``` > <?xml version='1.0' ?> <config> <app> <app version="1.1.0" /> > </app> </config> ``` and i want to read attribute version from node app without any loop like this while(reader.read()) or foreach etc. Thanks
2015/01/24
[ "https://Stackoverflow.com/questions/28122856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4487740/" ]
You can do it this way. ``` XmlDocument doc = new XmlDocument(); string str = "<config><app><app version=" + "\"1.1.0\"" + "/></app></config>"; doc.LoadXml(str); var nodes = doc.GetElementsByTagName("app"); foreach (XmlNode node in nodes) { if (node.Attr...
You can use linq to do ``` string stringXml= "yourXml Here"; XElement xdoc = XElement.Parse(stringXml); var result= xdoc.Descendants("app").FirstOrDefault(x=> x.Attribute("version") != null).attribute("version").Value; ``` or: ``` var result = xdoc.Descendants("app").Where(x => x.Attribute("versio...
28,122,856
i have xml file like this ``` > <?xml version='1.0' ?> <config> <app> <app version="1.1.0" /> > </app> </config> ``` and i want to read attribute version from node app without any loop like this while(reader.read()) or foreach etc. Thanks
2015/01/24
[ "https://Stackoverflow.com/questions/28122856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4487740/" ]
``` XmlDocument document = new XmlDocument(); document.Load("D:/source.xml"); XmlNode appVersion1 = document.SelectSingleNode("//app[@version]/@version"); XmlNode appVersion2 = document["config"]["app"]["app"].Attributes["version"]; Console.WriteLine("{0}, {1}", appVersion1.Value, appVersion2.Value); ```
You can use linq to do ``` string stringXml= "yourXml Here"; XElement xdoc = XElement.Parse(stringXml); var result= xdoc.Descendants("app").FirstOrDefault(x=> x.Attribute("version") != null).attribute("version").Value; ``` or: ``` var result = xdoc.Descendants("app").Where(x => x.Attribute("versio...
69,219
I have a Web App that i have developed I am looking to develop a plugin for this app so that i can pull information from the users accounts package such as sage or quickbooks(offline version). Ideally I would like to do this without them having to have a static ip etc. Unfortunately this is way over my head I currentl...
2011/04/18
[ "https://softwareengineering.stackexchange.com/questions/69219", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/23282/" ]
Bottom line: you need to write some`thing` that the user installs on his computer (either write a Browser plug in or an active x control.) That `Thing` will get data from the local comp and push it to you.. (This can be trigged by your web app.)
Could you get the users to upload a file? In other words they need to save the data locally from their application, then in your web application they can upload it to you. If this would work there is more info on SO: <https://stackoverflow.com/questions/116353/uploading-files-in-ruby-on-rails>
69,219
I have a Web App that i have developed I am looking to develop a plugin for this app so that i can pull information from the users accounts package such as sage or quickbooks(offline version). Ideally I would like to do this without them having to have a static ip etc. Unfortunately this is way over my head I currentl...
2011/04/18
[ "https://softwareengineering.stackexchange.com/questions/69219", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/23282/" ]
Bottom line: you need to write some`thing` that the user installs on his computer (either write a Browser plug in or an active x control.) That `Thing` will get data from the local comp and push it to you.. (This can be trigged by your web app.)
Have you consider using the WebSockets in order to allows users to send information to the server? I know, it needs HTML 5 ready browsers, but its a small price to pay. Here is an interesting link [HTML5 - Web Sockets](http://net.tutsplus.com/tutorials/javascript-ajax/start-using-html5-websockets-today/)
726,117
I want to print the first and the last non-empty or non-whitespace-only line in a file, idally using `sed` or `awk`. * Input File: ``` 123 345 456 087 er 56 32 78 ``` Note that there is a blank line after `32 78`. * Desired output: ``` 123 345 32 78 ```
2022/11/24
[ "https://unix.stackexchange.com/questions/726117", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/431343/" ]
Note that I'm answering two questions here as the text in the question was modified: 1. How may we output the first and the penultimate lines from a file (the initial question contained the wording "second last line")? 2. How may we output the first line, and the last non-empty, non-blank line? --- Using the `ed` ed...
The following `awk` program will do this: ``` awk 'NF{last=$0; if (!c++) print;} END {if (c>1) print last}' file.txt ``` * `awk` by default splits input lines into fields at "whitespace", i.e. contiguous runs of space and tabs. The number of fields is stored in `NF`. If a line is completely empty, or only consists o...
726,117
I want to print the first and the last non-empty or non-whitespace-only line in a file, idally using `sed` or `awk`. * Input File: ``` 123 345 456 087 er 56 32 78 ``` Note that there is a blank line after `32 78`. * Desired output: ``` 123 345 32 78 ```
2022/11/24
[ "https://unix.stackexchange.com/questions/726117", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/431343/" ]
Note that I'm answering two questions here as the text in the question was modified: 1. How may we output the first and the penultimate lines from a file (the initial question contained the wording "second last line")? 2. How may we output the first line, and the last non-empty, non-blank line? --- Using the `ed` ed...
``` sed -n '/^$/d; p; :a; n; /^$/!h; $!ba; g; /^$/!p' file.txt ``` **Test files content:** ``` ==> file_1.txt <== 123 345 456 087 er 56 32 78 ==> file_2.txt <== 123 345 456 087 er 56 32 78 ==> file_3.txt <== 123 345 456 087 er 56 32 78 ==> file_4.txt <== 123 345 456 087 er 56 32 78 ==> file_5....
726,117
I want to print the first and the last non-empty or non-whitespace-only line in a file, idally using `sed` or `awk`. * Input File: ``` 123 345 456 087 er 56 32 78 ``` Note that there is a blank line after `32 78`. * Desired output: ``` 123 345 32 78 ```
2022/11/24
[ "https://unix.stackexchange.com/questions/726117", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/431343/" ]
The following `awk` program will do this: ``` awk 'NF{last=$0; if (!c++) print;} END {if (c>1) print last}' file.txt ``` * `awk` by default splits input lines into fields at "whitespace", i.e. contiguous runs of space and tabs. The number of fields is stored in `NF`. If a line is completely empty, or only consists o...
``` sed -n '/^$/d; p; :a; n; /^$/!h; $!ba; g; /^$/!p' file.txt ``` **Test files content:** ``` ==> file_1.txt <== 123 345 456 087 er 56 32 78 ==> file_2.txt <== 123 345 456 087 er 56 32 78 ==> file_3.txt <== 123 345 456 087 er 56 32 78 ==> file_4.txt <== 123 345 456 087 er 56 32 78 ==> file_5....
2,529,663
Lets say I have the following: ``` data Greek = Alpha | Beta | Gamma | Phi deriving Show ``` I want to use the default showing of all items except Beta, which I want to say "two". Can I do this?
2010/03/27
[ "https://Stackoverflow.com/questions/2529663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169404/" ]
`deriving Show` uses the standard instantiation mechanism (simply returning the definition). If you want any special things, you will have to instantiate it manually: ``` data Greek = Alpha | Beta | Gamma | Phi instance Show Greek where show Alpha = "Alpha" show Beta = "2" show Gamma = "G...
As far as I know, you can't. The deriving mechanism doesn't support anyway to alter or extend the derived instances.
2,529,663
Lets say I have the following: ``` data Greek = Alpha | Beta | Gamma | Phi deriving Show ``` I want to use the default showing of all items except Beta, which I want to say "two". Can I do this?
2010/03/27
[ "https://Stackoverflow.com/questions/2529663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169404/" ]
Not that this is entirely satisfactory, but you could do: ``` data Greek = Alpha | Beta | Gamma | Phi deriving (Show) showGreek Beta = "2" showGreek x = show x ``` And use showGreek instead of show. If you needed a real show instance (in my code I find that I need this less than beginners tend to think), you co...
As far as I know, you can't. The deriving mechanism doesn't support anyway to alter or extend the derived instances.
2,529,663
Lets say I have the following: ``` data Greek = Alpha | Beta | Gamma | Phi deriving Show ``` I want to use the default showing of all items except Beta, which I want to say "two". Can I do this?
2010/03/27
[ "https://Stackoverflow.com/questions/2529663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169404/" ]
`deriving Show` uses the standard instantiation mechanism (simply returning the definition). If you want any special things, you will have to instantiate it manually: ``` data Greek = Alpha | Beta | Gamma | Phi instance Show Greek where show Alpha = "Alpha" show Beta = "2" show Gamma = "G...
Not that this is entirely satisfactory, but you could do: ``` data Greek = Alpha | Beta | Gamma | Phi deriving (Show) showGreek Beta = "2" showGreek x = show x ``` And use showGreek instead of show. If you needed a real show instance (in my code I find that I need this less than beginners tend to think), you co...
2,529,663
Lets say I have the following: ``` data Greek = Alpha | Beta | Gamma | Phi deriving Show ``` I want to use the default showing of all items except Beta, which I want to say "two". Can I do this?
2010/03/27
[ "https://Stackoverflow.com/questions/2529663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169404/" ]
`deriving Show` uses the standard instantiation mechanism (simply returning the definition). If you want any special things, you will have to instantiate it manually: ``` data Greek = Alpha | Beta | Gamma | Phi instance Show Greek where show Alpha = "Alpha" show Beta = "2" show Gamma = "G...
Some of the other suggestions work great in your particular example, and I would suggest to use those. But in a more general case you might want to use [datatype-generic programming](http://www.haskell.org/haskellwiki/Research_papers/Generics). Using generic programming, you can write functions that work on multiple ...
2,529,663
Lets say I have the following: ``` data Greek = Alpha | Beta | Gamma | Phi deriving Show ``` I want to use the default showing of all items except Beta, which I want to say "two". Can I do this?
2010/03/27
[ "https://Stackoverflow.com/questions/2529663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/169404/" ]
Not that this is entirely satisfactory, but you could do: ``` data Greek = Alpha | Beta | Gamma | Phi deriving (Show) showGreek Beta = "2" showGreek x = show x ``` And use showGreek instead of show. If you needed a real show instance (in my code I find that I need this less than beginners tend to think), you co...
Some of the other suggestions work great in your particular example, and I would suggest to use those. But in a more general case you might want to use [datatype-generic programming](http://www.haskell.org/haskellwiki/Research_papers/Generics). Using generic programming, you can write functions that work on multiple ...
20,740,442
I've come across a useful repo, but it's unmaintained and there are some good pull requests with bug fixes etc. that haven't been implemented. Is there anyway I can fork the repo and implement the pull requests into my forked repo?
2013/12/23
[ "https://Stackoverflow.com/questions/20740442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1437296/" ]
By using service you can achieve this.. ``` public void checkActivity() { handler = new Handler(); activityRunnable = new ActivityRunnable(); handler.postDelayed(activityRunnable, 500); } private class ActivityRunnable implements Runnable { @Override public void run() { ActivityManager man...
You should use Service for this. Then only you can achieve the background process..Please Go through about Services <http://developer.android.com/guide/components/services.html> and you can see this also <http://www.vogella.com/articles/AndroidServices/article.html> both URLs will help you
20,740,442
I've come across a useful repo, but it's unmaintained and there are some good pull requests with bug fixes etc. that haven't been implemented. Is there anyway I can fork the repo and implement the pull requests into my forked repo?
2013/12/23
[ "https://Stackoverflow.com/questions/20740442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1437296/" ]
By using service you can achieve this.. ``` public void checkActivity() { handler = new Handler(); activityRunnable = new ActivityRunnable(); handler.postDelayed(activityRunnable, 500); } private class ActivityRunnable implements Runnable { @Override public void run() { ActivityManager man...
The approach you are taking is wrong and prone to have your app rejected from the Google Play Store (plus it may stop working). Check [this thread](https://stackoverflow.com/questions/4414171/how-to-detect-when-an-android-app-goes-to-the-background-and-come-back-to-the-fo) to see possible ways to detect wether your ap...
20,740,442
I've come across a useful repo, but it's unmaintained and there are some good pull requests with bug fixes etc. that haven't been implemented. Is there anyway I can fork the repo and implement the pull requests into my forked repo?
2013/12/23
[ "https://Stackoverflow.com/questions/20740442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1437296/" ]
By using service you can achieve this.. ``` public void checkActivity() { handler = new Handler(); activityRunnable = new ActivityRunnable(); handler.postDelayed(activityRunnable, 500); } private class ActivityRunnable implements Runnable { @Override public void run() { ActivityManager man...
instead of service Use receiver to receive the launch event and there you can implement this code.
70,610,424
This works: ``` mtcars[, c("mpg"), drop = F] mpg Mazda RX4 21.0 Mazda RX4 Wag 21.0 Datsun 710 22.8 Hornet 4 Drive 21.4 Hornet Sportabout 18.7 Valiant 18.1 Duster 360 14.3 Merc 240D 24.4 Merc 230 22.8 Merc 280 19....
2022/01/06
[ "https://Stackoverflow.com/questions/70610424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14802285/" ]
You can't make a string negative. `-"mpg"` causes an error. (`-` is a *unary operator*, as it only takes one argument. `-x` tries to make `x` negative, but `x` must be numeric or you will get this error. There are a handful of functions that allow you to use `-` on a column name like `base::subset` and `dplyr::select`,...
Another suggestion: ``` names = names(mtcars) mtcars[, !names %in% names[1]] ``` **Output:** ``` cyl disp hp drat wt qsec vs am gear carb Mazda RX4 6 160.0 110 3.90 2.620 16.46 0 1 4 4 Mazda RX4 Wag 6 160.0 110 3.90 2.875 17.02 0 1 4 4 Datsun 710 ...
229,818
I am trying to chunk the results of a query of mine, but I am noticing the batches stop after 50,000 records (25 batches of 2000 records). I read iterable has a limit of 50,000 but I thought that was 50,000 records per batch. What are my options for being able to query and process all of my case records when recordty...
2018/08/22
[ "https://salesforce.stackexchange.com/questions/229818", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/51210/" ]
Your start method is limited to 50,000 SOQL rows, except for your Database.QueryLocator, if you choose to use one. To get past this limit, use a Database.QueryLocator: ``` return (Iterable<Case>)Database.getQueryLocator([ select Id, Owner.Id from case where RecordType.Id = :exampleRecordTypeIds ]); ``...
A batch can process up to 50 million records. Based on [documentation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_batch_interface.htm) , I think you may want to change your code in the following ways: 1. Create a global string variable, call it "queryString" for example - which holds...
4,432
I have several lines, and each line has 2 quoted string, and I want to replace all space with "\_" for the first quoted string. How to do that? Could I use macro? ``` select 'a b c','a b c' union all select 'a e1 c d','a e1 c d' union all select 'a f11 c','a f11 c' union all select 'a g1 c','a g1 c' union ``` resul...
2015/08/21
[ "https://vi.stackexchange.com/questions/4432", "https://vi.stackexchange.com", "https://vi.stackexchange.com/users/3262/" ]
You can create a new empty buffer in a new tab and then populate it with the result of a grep search on the previous file: ``` :tabnew|0r!grep -n pattern # ``` In a mapping: ``` nnoremap <key> :tabnew\|0r!grep -n #<Left><Left> ``` Which works like this: [![enter image description here](https://i.stack.imgur.com...
First clear an register: `qaq` second, append all matching lines using the `:g` command: ``` :g/pattern/y A ``` Third, put all matches on a new page ``` :tabnew +$put\ A ``` If you want to be able to make changes on those filtered mached, have a look at my [NrrwRgn Plugin](https://github.com/chrisbra/NrrwRgn). Th...
12,769,823
I'm re-implementing an app to support a national engineering contest, moving it from a local server to the cloud. In order to tell a team where they stand at the moment, the query has the form ``` select 1 + count(*) from team where where score < ? ``` Teams scores change very dynamically. There may be up to 2 mill...
2012/10/07
[ "https://Stackoverflow.com/questions/12769823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1161878/" ]
Create a rank table and update as frequently as adequate. Include the category (open or official) and score so you don't have to join it to the team table at query time: ``` create table "rank" ( team integer primary key, category integer, score integer, rank_consolidated integer, rank_category in...
Putting an index on score should avoid the full table scan.
12,769,823
I'm re-implementing an app to support a national engineering contest, moving it from a local server to the cloud. In order to tell a team where they stand at the moment, the query has the form ``` select 1 + count(*) from team where where score < ? ``` Teams scores change very dynamically. There may be up to 2 mill...
2012/10/07
[ "https://Stackoverflow.com/questions/12769823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1161878/" ]
Use [redis](http://redis.io) to store your team data in a `sorted set`. Then the [`ZRANK`](http://redis.io/commands/zrank) function will return the count you need. Redis is very fast in general, and the `ZRANK` function is O(log N) expected. It is implemented with skip lists.
Putting an index on score should avoid the full table scan.
12,769,823
I'm re-implementing an app to support a national engineering contest, moving it from a local server to the cloud. In order to tell a team where they stand at the moment, the query has the form ``` select 1 + count(*) from team where where score < ? ``` Teams scores change very dynamically. There may be up to 2 mill...
2012/10/07
[ "https://Stackoverflow.com/questions/12769823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1161878/" ]
Create a rank table and update as frequently as adequate. Include the category (open or official) and score so you don't have to join it to the team table at query time: ``` create table "rank" ( team integer primary key, category integer, score integer, rank_consolidated integer, rank_category in...
If it's read from a lot more heavily than it's written to and it always has to be up to date, then this is an ideal job for a trigger-maintained summary table (sort of a materialized view). Have a trigger on the `team` table that, `AFTER EACH INSERT OR UPDATE OR DELETE FOR EACH ROW` executes a trigger function that up...
12,769,823
I'm re-implementing an app to support a national engineering contest, moving it from a local server to the cloud. In order to tell a team where they stand at the moment, the query has the form ``` select 1 + count(*) from team where where score < ? ``` Teams scores change very dynamically. There may be up to 2 mill...
2012/10/07
[ "https://Stackoverflow.com/questions/12769823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1161878/" ]
Use [redis](http://redis.io) to store your team data in a `sorted set`. Then the [`ZRANK`](http://redis.io/commands/zrank) function will return the count you need. Redis is very fast in general, and the `ZRANK` function is O(log N) expected. It is implemented with skip lists.
Create a rank table and update as frequently as adequate. Include the category (open or official) and score so you don't have to join it to the team table at query time: ``` create table "rank" ( team integer primary key, category integer, score integer, rank_consolidated integer, rank_category in...
12,769,823
I'm re-implementing an app to support a national engineering contest, moving it from a local server to the cloud. In order to tell a team where they stand at the moment, the query has the form ``` select 1 + count(*) from team where where score < ? ``` Teams scores change very dynamically. There may be up to 2 mill...
2012/10/07
[ "https://Stackoverflow.com/questions/12769823", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1161878/" ]
Use [redis](http://redis.io) to store your team data in a `sorted set`. Then the [`ZRANK`](http://redis.io/commands/zrank) function will return the count you need. Redis is very fast in general, and the `ZRANK` function is O(log N) expected. It is implemented with skip lists.
If it's read from a lot more heavily than it's written to and it always has to be up to date, then this is an ideal job for a trigger-maintained summary table (sort of a materialized view). Have a trigger on the `team` table that, `AFTER EACH INSERT OR UPDATE OR DELETE FOR EACH ROW` executes a trigger function that up...
56,318,103
I have a React-TypeScript SSR app where I used SCSS files for my styling. I need to write a rule in Webpack to load the SCSS and I haven't been able to do it. I found various solutions online, all of which are extremely complex and use things like mini-css-extract-plugin. I couldn't get any of them to work. I current...
2019/05/26
[ "https://Stackoverflow.com/questions/56318103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9448339/" ]
You are on right track with 2 web config file you can use <https://gist.github.com/mburakerman/629783c16acf5e5f03de60528d3139af> But don't set any other config file like babel.rc .yaml etc or other definition in project.json **try this** ``` test: /\.scss$/, use: [ MiniCssExtractPlugin....
A boilerplate for server-side rendering using `react`, `webpack`, `Sass` (for both css-modules and pure sass) webpack.config.js ``` const path = require('path'); const isDevelopment = true; module.exports = [ { name: 'client', target: 'web', entry: './client.jsx', output: { path: path.join(__...
56,318,103
I have a React-TypeScript SSR app where I used SCSS files for my styling. I need to write a rule in Webpack to load the SCSS and I haven't been able to do it. I found various solutions online, all of which are extremely complex and use things like mini-css-extract-plugin. I couldn't get any of them to work. I current...
2019/05/26
[ "https://Stackoverflow.com/questions/56318103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9448339/" ]
You are on right track with 2 web config file you can use <https://gist.github.com/mburakerman/629783c16acf5e5f03de60528d3139af> But don't set any other config file like babel.rc .yaml etc or other definition in project.json **try this** ``` test: /\.scss$/, use: [ MiniCssExtractPlugin....
Webpack Community now details an approach for SSR sass compiled via webpack in [mini-css-extract-plugin/#recommend](https://webpack.js.org/plugins/mini-css-extract-plugin/#recommend) ``` const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const devMode = process.env.NODE_ENV !== "production"; module.expor...
11,409,201
I'm writing an application in Java/Android.In my application I consume a wcf web service using KSOAP2.My problem is that there are times that instead of a single string I could receive an object (or arrays of objects) which are defined in the c# web services.Is there any way I can process these objects?If it helps I ca...
2012/07/10
[ "https://Stackoverflow.com/questions/11409201", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1514105/" ]
Okay I figured this out in fact I found out 2 articles about it with really explicit tutorials I will just post them here in case anyone stumbles upon this post [link](http://seesharpgears.blogspot.gr/2010/10/ksoap-android-web-service-tutorial-with.html?commentPage=2) and [link](http://seesharpgears.blogspot.gr/2010/10...
> > Is there any way I can process these objects? > > > Define "process". Using webservices, you transmit serialized objects, which are (usually) an XML representation of the objects in the language at either end (service or client). If you define a class `Person` with a property `Name`, you can return an object ...
2,377,602
I am asked if the ideal $I = \left \{ \left ( x,7y \right ): x,y \in \mathbb{Z} \right \}$ of a ring R= $\mathbb{Z}\oplus \mathbb{Z}$ is a prime ideal. Looking at the factor ring, $\mathbb{Z}\oplus \mathbb{Z} / I $, there exists zero-divisors; in particular $\left ( x\_{1},0 \right ) and \left ( 0,y\_{2} \right ) \i...
2017/07/31
[ "https://math.stackexchange.com/questions/2377602", "https://math.stackexchange.com", "https://math.stackexchange.com/users/227967/" ]
Note that the zero element of $\mathbb{Z}\oplus \mathbb{Z} / I $ is $I=0+I.$ Let $$((x\_1,y\_1)+I)((x\_2,y\_2)+I)=0+I$$ Then $$(x\_1x\_2,y\_1y\_2)\in I$$ Thus $$7\mid y\_1y\_2$$ As $7$ is prime, therefore $7 \mid y\_1$ or $7 \mid y\_2$. Hence, $(x\_1,y\_1) \in I$ or $(x\_2,y\_2)\in I$. So, $(x\_1,y\_1)+I = 0 + I$ ...
It would be a good exercise to prove the following results. > > **Result-1:** In $\Bbb Z \times \Bbb Z$ the prime ideals are of the form, $\Bbb Z/p\Bbb Z\times \Bbb Z$ or $\Bbb Z\times\Bbb Z/p\Bbb Z $ where $p$ is prime. > > > In fact you can generalize the above result as follows. > > **Result-2:** Let $R\_i$ ...
50,906,497
Since the update from 4.2.0 to 4.3.0, publishing the sonar qube results fail with this error for my react application: ``` 2018-06-18T07:35:56.8644128Z ##[section]Starting: Publish Quality Gate Result 2018-06-18T07:35:56.8648466Z ============================================================================== 2018-06-18...
2018/06/18
[ "https://Stackoverflow.com/questions/50906497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/551698/" ]
The SonarQube extension make various http requests to the SonarQube server for various reasons. If your SonarQube server is using a custom/self-signed SSL certificate, it will fail for security reasons. You have to tell node.js that you trust this certificate using [NODE\_EXTRA\_CA\_CERTS](https://nodejs.org/api/cli.ht...
Seems it SSL issues, i have faced the same issues when try to use http service connection.
9,511,380
I have added the Devise gem to the ruby on rails app version 1.8.7. I using devise to authenticate and also I have created a model called user which will connect another database, I have mentioned/specified the database configurations in the create\_connection,whenever I run the app in the local host, I am getting this...
2012/03/01
[ "https://Stackoverflow.com/questions/9511380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/449344/" ]
i had this error once before, try the following **1.Re-run your migrations again** ``` rake db:migrate VERSION=0 #to rollback migrations to the first one if needed<br /> ``` Just in case you have forgotten, uncomment the following line ``` t.string :password_salt ``` then migrate your database ``` rake db...
You will need to add the `password_salt` column to your users table. It appears to be missing.
35,474,417
Consider the following set of examples. 1. The function `takeOnlyVoidFunction` takes a function with zero arguments and simply executes it. 2. The function `takeVariableArguments` takes a variable number of arguments and executes the function using the arguments. 3. The function `captureVariableArgs` attempts to conv...
2016/02/18
[ "https://Stackoverflow.com/questions/35474417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391161/" ]
I put together a test, and it seems to work well. I updated the load event to add a second series, using the same `series.data[len -1]` values; then in the setInterval portion, we update that new point at each iteration. That way, by updating the existing marker rather than destroying one marker and creating another,...
You can try this : ``` series: [{ name: 'Random data', marker : { enabled : false, lineWidth: 0, radius: 0 }, data: (function () { // generate an array of random data var data = [], time = (new D...
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
Be wary of `invalidateOptionsMenu()`. It recreates the entire menu. This has a lot of overhead and will reset embedded components like the `SearchView`. It took me quite a while to track down why my `SearchView` would "randomly" close. I ended up capturing the menu as posted by Dark and then call `onPrepareOptionsMenu...
Android now has the [Toolbar](https://developer.android.com/reference/android/widget/Toolbar) widget which was a Menu you can set/get. Set the Toolbar in your Activity with some variation of setSupportActionBar(Toolbar) for stuff like onCreateOptionsMenu from a Fragment for example. Thread revived!
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
Be wary of `invalidateOptionsMenu()`. It recreates the entire menu. This has a lot of overhead and will reset embedded components like the `SearchView`. It took me quite a while to track down why my `SearchView` would "randomly" close. I ended up capturing the menu as posted by Dark and then call `onPrepareOptionsMenu...
As far as I could understand what you want here is which may help you: **1.** Refer this tutorial over [option menu](http://developer.android.com/guide/topics/ui/menus.html#options-menu). **2.** Every time user presses menu button you can check it's title thru `getTitle()`. **3.** Or if you want to know the last men...
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
Call invalidateOptionsMenu() instead of passing menu object around.
Android now has the [Toolbar](https://developer.android.com/reference/android/widget/Toolbar) widget which was a Menu you can set/get. Set the Toolbar in your Activity with some variation of setSupportActionBar(Toolbar) for stuff like onCreateOptionsMenu from a Fragment for example. Thread revived!
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
you could do it by passing the Menu object to your Activity class ``` public class MainActivity extends Activity { ... ... private Menu _menu = null; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. ...
There several callback methods that provide menu as a parameter. You might wanna manipulate it there. For example: ``` onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) onCreateOptionsMenu(Menu menu) onCreatePanelMenu(int featureId, Menu menu) ``` There several more, best you t...
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
Be wary of `invalidateOptionsMenu()`. It recreates the entire menu. This has a lot of overhead and will reset embedded components like the `SearchView`. It took me quite a while to track down why my `SearchView` would "randomly" close. I ended up capturing the menu as posted by Dark and then call `onPrepareOptionsMenu...
you could do it by passing the Menu object to your Activity class ``` public class MainActivity extends Activity { ... ... private Menu _menu = null; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. ...
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
Be wary of `invalidateOptionsMenu()`. It recreates the entire menu. This has a lot of overhead and will reset embedded components like the `SearchView`. It took me quite a while to track down why my `SearchView` would "randomly" close. I ended up capturing the menu as posted by Dark and then call `onPrepareOptionsMenu...
Call invalidateOptionsMenu() instead of passing menu object around.
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
Call invalidateOptionsMenu() instead of passing menu object around.
There several callback methods that provide menu as a parameter. You might wanna manipulate it there. For example: ``` onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) onCreateOptionsMenu(Menu menu) onCreatePanelMenu(int featureId, Menu menu) ``` There several more, best you t...
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
There several callback methods that provide menu as a parameter. You might wanna manipulate it there. For example: ``` onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) onCreateOptionsMenu(Menu menu) onCreatePanelMenu(int featureId, Menu menu) ``` There several more, best you t...
Android now has the [Toolbar](https://developer.android.com/reference/android/widget/Toolbar) widget which was a Menu you can set/get. Set the Toolbar in your Activity with some variation of setSupportActionBar(Toolbar) for stuff like onCreateOptionsMenu from a Fragment for example. Thread revived!
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
you could do it by passing the Menu object to your Activity class ``` public class MainActivity extends Activity { ... ... private Menu _menu = null; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. ...
As far as I could understand what you want here is which may help you: **1.** Refer this tutorial over [option menu](http://developer.android.com/guide/topics/ui/menus.html#options-menu). **2.** Every time user presses menu button you can check it's title thru `getTitle()`. **3.** Or if you want to know the last men...
10,579,333
In some methods of my Activity I want to check the title of menu or know if it is checked or not. How can I get Activity's menu. I need something like `this.getMenu()`
2012/05/14
[ "https://Stackoverflow.com/questions/10579333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779408/" ]
Be wary of `invalidateOptionsMenu()`. It recreates the entire menu. This has a lot of overhead and will reset embedded components like the `SearchView`. It took me quite a while to track down why my `SearchView` would "randomly" close. I ended up capturing the menu as posted by Dark and then call `onPrepareOptionsMenu...
There several callback methods that provide menu as a parameter. You might wanna manipulate it there. For example: ``` onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) onCreateOptionsMenu(Menu menu) onCreatePanelMenu(int featureId, Menu menu) ``` There several more, best you t...
33,529,678
I am new to javascript and want to use C3.js for streaming time series data visualization. I want to display the 5 most recent data points on the chart. The new data point is streamed every 2 seconds. So, the display should discard the oldest data point and refresh the graph with this additional data point. Example: ...
2015/11/04
[ "https://Stackoverflow.com/questions/33529678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253795/" ]
This code will never exit the loop. The reason for this is that adding `1` to a sufficiently large `double` number does not change its value: ``` double a = 1.7976931348623155E308; double old = a; a++; System.out.println(a); // prints 1.7976931348623155E308 System.out.println(old); // prints 1.797693134862315...
At some point, `i++` will stop having any effect, because for very large values of `i`, consecutive `double` values are far apart. Therefore it is an infinite loop. To prove there are `double` values for which `i == i + 1` try this: ``` for (double i = 1;; i *= 2){ if (i == i + 1) { System.out.println(i)...
4,508,376
I'm trying to find analytically all the integer points of $y^2 = x^3 - 4x + 9$. The integer solutions I found so far are $\{-2, 3\}, \{0, 3\}, \{2, 3\}, \{7, 18\}, \{11, 36\}, \{646, 16419\}$ The first five are easy to find with modulo considerations, but how can I find $\{646, 16419\}$? How to prove there are no mor...
2022/08/08
[ "https://math.stackexchange.com/questions/4508376", "https://math.stackexchange.com", "https://math.stackexchange.com/users/967210/" ]
All integral points are given by $$ (-2,\pm 3), (0,\pm 3), (2,\pm 3), (7,\pm 18), (11,\pm 36), (646,\pm 16419) $$ see the reference for the database in [LMFDB](https://www.lmfdb.org/EllipticCurve/Q/7724/a/1).
In SageMath 8.0: ``` R.<x,y> = QQ[] E = EllipticCurve(x^3-4*x+9-y^2) E.integral_points(both_signs=true): ``` $$\eqalign{&[(-2 : -3 : 1),\cr &(-2 : 3 : 1),\cr &(0 : -3 : 1),\cr &(0 : 3 : 1),\cr &(2 : -3 : 1),\cr &(2 : 3 : 1),\cr &(7 : -18 : 1),\cr &(7 : 18 : 1),\cr &(11 : -36 : 1),\cr &(11 : 36 : 1),\cr &(6...
4,508,376
I'm trying to find analytically all the integer points of $y^2 = x^3 - 4x + 9$. The integer solutions I found so far are $\{-2, 3\}, \{0, 3\}, \{2, 3\}, \{7, 18\}, \{11, 36\}, \{646, 16419\}$ The first five are easy to find with modulo considerations, but how can I find $\{646, 16419\}$? How to prove there are no mor...
2022/08/08
[ "https://math.stackexchange.com/questions/4508376", "https://math.stackexchange.com", "https://math.stackexchange.com/users/967210/" ]
For your first question > > ,but how can I find $(646,16419)$? > > > There is an easy method using lines intersecting the curve $y^2 = x^3-4x+9.$ Given any two points on the curve, the unique line they determine intersects the curve in another point. In the case of the points $(2,3)$ and $(-2,-3)$ this third poin...
In SageMath 8.0: ``` R.<x,y> = QQ[] E = EllipticCurve(x^3-4*x+9-y^2) E.integral_points(both_signs=true): ``` $$\eqalign{&[(-2 : -3 : 1),\cr &(-2 : 3 : 1),\cr &(0 : -3 : 1),\cr &(0 : 3 : 1),\cr &(2 : -3 : 1),\cr &(2 : 3 : 1),\cr &(7 : -18 : 1),\cr &(7 : 18 : 1),\cr &(11 : -36 : 1),\cr &(11 : 36 : 1),\cr &(6...
42,075
I want to use Bebas Neue in my commercial html5-based game for mobile devices. 1. My game mechanics implies the *use of letters as sprites*. 2. The fact that this game is html5-based game means, that *I'll put the whole font in the application distributive*. But Dharma Type EULA imposes some restrictions: 1. You may...
2014/11/12
[ "https://graphicdesign.stackexchange.com/questions/42075", "https://graphicdesign.stackexchange.com", "https://graphicdesign.stackexchange.com/users/33458/" ]
Your use of the font file *implies* that you aren't re-distributing the font file, as you aren't putting the file itself into your app. Will downloading your app allow me to extract the font file and use it on my own machine? Are you copying the font file as-is into the app? If the answer to either is 'no', then you s...
Take a look at this: I have given the link just as example.You have to check the licensing with your font type whether it is available for the particular use or not. <http://www.myfonts.com/fonts/flat-it/dharma-gothic/licensing.html> Font for application uses and see the EULA.
46,582,242
I would like to change the color of the text value based on the value of a switch statement. For example if the value equals 'Hello' then make it green. I have included some code and would be grateful if someone could offer some assistance as to how I can achieve this. Many thanks. ``` switch ($row['destroydate']) { ...
2017/10/05
[ "https://Stackoverflow.com/questions/46582242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1532468/" ]
you can try using ``` switch ($row['destroydate']) { case NULL: $destroydate = '<span style="color:#FF0000">No Date Set</span>'; <---MAKE RED //echo $destroyeddate; break; case "0000-00-00": $destroydate = '<span style="color:#39CD0D">No Date Set</span>'; <--- MAKE GREEN break; default:...
You should use this below. Create a function and use it with sending the Date data. The switch will return a result, always. This way you can always use your new function at any file. If there is anything needs to be added/changed, you don't need to change all the files who are using this switch, but only have to chang...
581,716
I see a couple of tutorials here on using `dd`, but I wanted to ask to make 100% sure. Can I clone my XBox360 hdd over to a larger hdd using dd? I just dont want to lose my current data thats there. Also, is it really as simple as ``` dd if=/dev/sdb of=/dev/sdc ``` If it matters, Im running Lubuntu 14.04 64bit
2015/02/04
[ "https://askubuntu.com/questions/581716", "https://askubuntu.com", "https://askubuntu.com/users/301105/" ]
That depends. If you have two original Xbox 360 drives you can clone one to the other and everything should work just fine. Using a regular 2,5" drive in an Xbox 360 does not work. Unless you have a drive that can be *"hacked"*, e.g. you copy the *"security sector"* with a DOS tool onto the drive's firmware so that th...
I would be very careful when cloning disks with dd, as you have to pay attention to the disc's labels, as described by [this question](https://stackoverflow.com/questions/18874441/hard-drive-clone-using-dd). I don't know exactly how the XboX handles this, but I prefer using [Clonezilla](http://www.clonezilla.org/) for ...
43,813,032
I am recently working on a project which has an algorithm to tell whether a point is inside an area. The area looks like this: ``` {"state": "Washington", "border": [[-122.402015, 48.225216], [-117.032049, 48.999931], [-116.919132, 45.995175], [-124.079107, 46.267259], [-124.717175, 48.377557], [-122.92315, 47.04796...
2017/05/05
[ "https://Stackoverflow.com/questions/43813032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7970767/" ]
First of all, very interesting question!! Although it might be a duplicated question, but I am still going to post another workable answer different from that post to encourage this new guy. The idea is to use the sum of angles to decide whether the target is inside or outside. If the target is inside an area, the sum...
Here is a pseudo code: ``` var point = [x,y] // Point to evaluate int i, j, c = 0 int size = border.count for (i = 0, j = size-1; i < size; j = i++) { var ii = border[i] var jj = border[j] if ( ((ii.[1] > point.[1]) != (jj.[1] > point.[1])) && (point.[0] < (jj.[0]-ii.[0]) * (point.[1]-ii.[1]) / (j...
43,813,032
I am recently working on a project which has an algorithm to tell whether a point is inside an area. The area looks like this: ``` {"state": "Washington", "border": [[-122.402015, 48.225216], [-117.032049, 48.999931], [-116.919132, 45.995175], [-124.079107, 46.267259], [-124.717175, 48.377557], [-122.92315, 47.04796...
2017/05/05
[ "https://Stackoverflow.com/questions/43813032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7970767/" ]
First of all, very interesting question!! Although it might be a duplicated question, but I am still going to post another workable answer different from that post to encourage this new guy. The idea is to use the sum of angles to decide whether the target is inside or outside. If the target is inside an area, the sum...
Sounds like a good use case for a modified [convex hull](https://en.wikipedia.org/wiki/Convex_hull) algorithm. 1. Start out with all points inside of the "area" (since no hull is yet created). 2. Then, as you progress through your chosen algorithm (e.g. Graham scan is `O(nlog(n))` performance), if the point is chosen...
43,813,032
I am recently working on a project which has an algorithm to tell whether a point is inside an area. The area looks like this: ``` {"state": "Washington", "border": [[-122.402015, 48.225216], [-117.032049, 48.999931], [-116.919132, 45.995175], [-124.079107, 46.267259], [-124.717175, 48.377557], [-122.92315, 47.04796...
2017/05/05
[ "https://Stackoverflow.com/questions/43813032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7970767/" ]
Sounds like a good use case for a modified [convex hull](https://en.wikipedia.org/wiki/Convex_hull) algorithm. 1. Start out with all points inside of the "area" (since no hull is yet created). 2. Then, as you progress through your chosen algorithm (e.g. Graham scan is `O(nlog(n))` performance), if the point is chosen...
Here is a pseudo code: ``` var point = [x,y] // Point to evaluate int i, j, c = 0 int size = border.count for (i = 0, j = size-1; i < size; j = i++) { var ii = border[i] var jj = border[j] if ( ((ii.[1] > point.[1]) != (jj.[1] > point.[1])) && (point.[0] < (jj.[0]-ii.[0]) * (point.[1]-ii.[1]) / (j...
239,808
I'm looking for a closed form for the expression $$ \sum\_{k=1}^{\infty}\frac{1}{(2k)^5-(2k)^3} $$ I know that Ramanujan gave the following closed form for a similar expression $$ \sum\_{k=1}^{\infty}\frac{1}{(2k)^3-2k}= \ln(2)-\frac{1}{2} $$ I wonder if it is possible to find such a similarly simple and nice closed f...
2016/05/26
[ "https://mathoverflow.net/questions/239808", "https://mathoverflow.net", "https://mathoverflow.net/users/6842/" ]
$$  \frac{1}{(2k)^5 - (2k)^3} + \frac{1}{(2k)^3} = \frac{1 + (2k)^2 - 1}{(2k)^5 - (2k)^3} = \frac{1}{(2k)^3 -2k}$$ So by Ramanujan's result: $$\sum\_{k=1}^{\infty} \frac{1}{(2k)^5 - (2k)^3} = \ln(2) - \frac{1}{2} - \frac{1}{8}\zeta(3)$$
Not an answer, but if you want to look for different solutions in the future in the same vein as these you posed, this might be a general method. For an alternate representation for $$: $$\frac{1}{a-b}=\frac{1}{a}+\frac{b}{a^2}+\frac{a^2}{b^3}+\frac{b^3}{a^4}+\cdots\qquad(1)$$ Plugging in $a=(2k)^{5}$ and $b=(2k)^3$...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Sort the array by date, and then get the front value of the array. ``` $dates = array(5) { /** omitted to keep code compact */ } $dates = array_combine($dates, array_map('strtotime', $dates)); arsort($dates); echo $dates[0]; ```
``` $arrayy = array( "2012-06-11 08:30:49","2012-06-07 08:03:54","2012-05-26 23:04:04", "2012-05-27 08:30:00","2012-06-08 08:30:55" ); function getMostRecent($array){ $current = date("Y-m-d h:i:s"); $diff1 = NULL; $recent = NULL; foreach($array as $date){ if($diff = strcmp($current,$da...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Sort the array by date, and then get the front value of the array. ``` $dates = array(5) { /** omitted to keep code compact */ } $dates = array_combine($dates, array_map('strtotime', $dates)); arsort($dates); echo $dates[0]; ```
After nearly 10 years and nearly 50,000 page views, it seems that no one could see the forest from the trees. The array of datetime stamps is perfectly formatted for simple string comparison. There is absolutely NO reason to call anything other than `max()` to get the highest/latest string. Your `Y-m-d H:i:s` formatte...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Do a loop, convert the values to date, and store the most recent, in a var. ``` $mostRecent= 0; foreach($dates as $date){ $curDate = strtotime($date); if ($curDate > $mostRecent) { $mostRecent = $curDate; } } ``` something like that... you get the idea If you want most recent BEFORE today : ``` $mostRec...
**Try this works 100%** ``` function getRecentDate($date_list,$curDate){ $curDate = strtotime($curDate); $mostRecent = array(); foreach($date_list as $date){ $diff = strtotime($date)-$curDate; if($diff>0){ $mostRecent[$diff] = $date; } ...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Sort the array by date, and then get the front value of the array. ``` $dates = array(5) { /** omitted to keep code compact */ } $dates = array_combine($dates, array_map('strtotime', $dates)); arsort($dates); echo $dates[0]; ```
**Try this works 100%** ``` function getRecentDate($date_list,$curDate){ $curDate = strtotime($curDate); $mostRecent = array(); foreach($date_list as $date){ $diff = strtotime($date)-$curDate; if($diff>0){ $mostRecent[$diff] = $date; } ...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Thats my variant. It works with date in future. ``` $Dates = array( "2012-06-11 08:30:49", "2012-06-07 08:03:54", "2012-05-26 23:04:04", "2012-05-27 08:30:00", "2012-06-08 08:30:55", "2012-06-12 07:45:45" ); $CloseDate = array(); $TimeNow = time(); foreach ($Dates as $Date) { $DateToCompa...
Here is my suggestion: ``` $most_recent = 0; foreach($array as $key => $date){ if( strtotime($date) < strtotime('now') && strtotime($date) > strtotime($array[$most_recent]) ){ $most_recent = $key; } } print $array[$most_recent]; //prints most recent day ```
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Use [`max()`](http://php.net/max), [`array_map()`](http://php.net/array_map), and [`strtotime()`](http://php.net/strtotime). ``` $max = max(array_map('strtotime', $arr)); echo date('Y-m-j H:i:s', $max); // 2012-06-11 08:30:49 ```
After nearly 10 years and nearly 50,000 page views, it seems that no one could see the forest from the trees. The array of datetime stamps is perfectly formatted for simple string comparison. There is absolutely NO reason to call anything other than `max()` to get the highest/latest string. Your `Y-m-d H:i:s` formatte...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Here is my suggestion: ``` $most_recent = 0; foreach($array as $key => $date){ if( strtotime($date) < strtotime('now') && strtotime($date) > strtotime($array[$most_recent]) ){ $most_recent = $key; } } print $array[$most_recent]; //prints most recent day ```
After nearly 10 years and nearly 50,000 page views, it seems that no one could see the forest from the trees. The array of datetime stamps is perfectly formatted for simple string comparison. There is absolutely NO reason to call anything other than `max()` to get the highest/latest string. Your `Y-m-d H:i:s` formatte...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
``` $arrayy = array( "2012-06-11 08:30:49","2012-06-07 08:03:54","2012-05-26 23:04:04", "2012-05-27 08:30:00","2012-06-08 08:30:55" ); function getMostRecent($array){ $current = date("Y-m-d h:i:s"); $diff1 = NULL; $recent = NULL; foreach($array as $date){ if($diff = strcmp($current,$da...
After nearly 10 years and nearly 50,000 page views, it seems that no one could see the forest from the trees. The array of datetime stamps is perfectly formatted for simple string comparison. There is absolutely NO reason to call anything other than `max()` to get the highest/latest string. Your `Y-m-d H:i:s` formatte...
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Do a loop, convert the values to date, and store the most recent, in a var. ``` $mostRecent= 0; foreach($dates as $date){ $curDate = strtotime($date); if ($curDate > $mostRecent) { $mostRecent = $curDate; } } ``` something like that... you get the idea If you want most recent BEFORE today : ``` $mostRec...
Here is my suggestion: ``` $most_recent = 0; foreach($array as $key => $date){ if( strtotime($date) < strtotime('now') && strtotime($date) > strtotime($array[$most_recent]) ){ $most_recent = $key; } } print $array[$most_recent]; //prints most recent day ```
11,012,891
I have the array of dates in `Y-m-d H:i:s` format like: ``` array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } ``` I would like to kno...
2012/06/13
[ "https://Stackoverflow.com/questions/11012891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1453373/" ]
Sort the array by date, and then get the front value of the array. ``` $dates = array(5) { /** omitted to keep code compact */ } $dates = array_combine($dates, array_map('strtotime', $dates)); arsort($dates); echo $dates[0]; ```
Here is my suggestion: ``` $most_recent = 0; foreach($array as $key => $date){ if( strtotime($date) < strtotime('now') && strtotime($date) > strtotime($array[$most_recent]) ){ $most_recent = $key; } } print $array[$most_recent]; //prints most recent day ```