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 |
|---|---|---|---|---|---|
41,892,006 | Is there a way to make the background of an ionic 2 `<ion-item>` be transparent?
I have tried this CSS but it doesn't make the item transparent:
```
.list .item, .item-content .item-inner .item-block .item-ios
{
background: transparent !important;
}
```
**ADDED CODE**
My HTML looks like this:
```html
<ion-conte... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41892006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726579/"
] | For the ionic 2 item sliding background color you can change the main sass variable
```
$item-ios-sliding-content-background(transprent);
$item-md-sliding-content-background(transprent);
```
In your src -> theme -> variables.scss file
you can find all the variables [here](https://ionicframework.com/docs/v2/themin... | Try this in **Ionic 5** using CSS Custom Properties.
For `ion-item`
```css
ion-item {
--ion-item-background: transparent;
}
```
For `ion-list`
```css
ion-list {
--ion-item-background: transparent;
}
``` |
41,892,006 | Is there a way to make the background of an ionic 2 `<ion-item>` be transparent?
I have tried this CSS but it doesn't make the item transparent:
```
.list .item, .item-content .item-inner .item-block .item-ios
{
background: transparent !important;
}
```
**ADDED CODE**
My HTML looks like this:
```html
<ion-conte... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41892006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726579/"
] | For Android
```
.item-md {
background: transparent;
}
```
For iOS
```
.item-ios {
background: transparent;
}
``` | Create a new variable in variable.scss like this:
```
--ion-color-transparent: rgba(0, 0, 0, 0.0);
```
and use it like this:
```
<ion-item color="transparent" padding="0px"><ion-input type="email" placeholder="username"></ion-input></ion-item>.
``` |
41,892,006 | Is there a way to make the background of an ionic 2 `<ion-item>` be transparent?
I have tried this CSS but it doesn't make the item transparent:
```
.list .item, .item-content .item-inner .item-block .item-ios
{
background: transparent !important;
}
```
**ADDED CODE**
My HTML looks like this:
```html
<ion-conte... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41892006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726579/"
] | Try this in **Ionic 5** using CSS Custom Properties.
For `ion-item`
```css
ion-item {
--ion-item-background: transparent;
}
```
For `ion-list`
```css
ion-list {
--ion-item-background: transparent;
}
``` | You are using sliding item. Try using the below code
```
.pu-item-list ion-item-sliding{
background: transparent !important;
}
``` |
41,892,006 | Is there a way to make the background of an ionic 2 `<ion-item>` be transparent?
I have tried this CSS but it doesn't make the item transparent:
```
.list .item, .item-content .item-inner .item-block .item-ios
{
background: transparent !important;
}
```
**ADDED CODE**
My HTML looks like this:
```html
<ion-conte... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41892006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726579/"
] | Here is a solution in Ionic 4:
**HTML:**
```
<ion-list class="bg-transparent">
<ion-item color="none" lines="none">
Some random text
</ion-item>
<ion-item color="none" lines="none">
Some random text
</ion-item>
</ion-list>
```
**CSS:**
```
.bg-transparent {
background: transparent... | Try this:
`<ion-item color="transparent">
</ion-item>` |
41,892,006 | Is there a way to make the background of an ionic 2 `<ion-item>` be transparent?
I have tried this CSS but it doesn't make the item transparent:
```
.list .item, .item-content .item-inner .item-block .item-ios
{
background: transparent !important;
}
```
**ADDED CODE**
My HTML looks like this:
```html
<ion-conte... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41892006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726579/"
] | You are using sliding item. Try using the below code
```
.pu-item-list ion-item-sliding{
background: transparent !important;
}
``` | Create a new variable in variable.scss like this:
```
--ion-color-transparent: rgba(0, 0, 0, 0.0);
```
and use it like this:
```
<ion-item color="transparent" padding="0px"><ion-input type="email" placeholder="username"></ion-input></ion-item>.
``` |
41,892,006 | Is there a way to make the background of an ionic 2 `<ion-item>` be transparent?
I have tried this CSS but it doesn't make the item transparent:
```
.list .item, .item-content .item-inner .item-block .item-ios
{
background: transparent !important;
}
```
**ADDED CODE**
My HTML looks like this:
```html
<ion-conte... | 2017/01/27 | [
"https://Stackoverflow.com/questions/41892006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726579/"
] | For Android
```
.item-md {
background: transparent;
}
```
For iOS
```
.item-ios {
background: transparent;
}
``` | This worked for me.
```
ion-item {
--ion-item-background: transparent;
box-shadow: none !important;
}
ion-list {
--ion-item-background: transparent;
box-shadow: none !important;
}
``` |
20,062,544 | I'm currently trying to get the first and last day of any year. I have data from 1950 and I want to get the first day of the year in the dataset to the last day of the year in the dataset (note that the last day of the year might not be December 31rst and same with the first day of the year).
Initially I thought I cou... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20062544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2445226/"
] | You want something like this for the first day of the year:
```
dateadd(year, datediff(year,0, c.Date), 0)
```
and this for the last day of the year:
```
--first day of next year -1
dateadd(day, -1, dateadd(year, datediff(year,0, c.Date) + 1, 0)
``` | `try this`
for getting first day ,last day of the year && firstofthe next\_year
```
SELECT
DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) AS Start_Of_Year,
dateadd(yy, datediff(yy,-1, getdate()), -1) AS Last_Day_Of_Year,
DATEADD(yy, DATEDIFF(yy,0,getdate()) + 1, 0) AS FirstOf_the_NextYear
```
so putting this in ... |
20,062,544 | I'm currently trying to get the first and last day of any year. I have data from 1950 and I want to get the first day of the year in the dataset to the last day of the year in the dataset (note that the last day of the year might not be December 31rst and same with the first day of the year).
Initially I thought I cou... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20062544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2445226/"
] | You want something like this for the first day of the year:
```
dateadd(year, datediff(year,0, c.Date), 0)
```
and this for the last day of the year:
```
--first day of next year -1
dateadd(day, -1, dateadd(year, datediff(year,0, c.Date) + 1, 0)
``` | I should refrain from developing in the evenings because I solved it, and it's actually quite simple:
```
SELECT MIN(Date)
, MAX(Date)
FROM Table
GROUP BY YEAR(Date)
```
I can put these values into a `CTE` and then `JOIN` on the dates and get what I need:
```
;WITH CT AS(
SELECT MIN(Date) Mi
, MAX(D... |
20,062,544 | I'm currently trying to get the first and last day of any year. I have data from 1950 and I want to get the first day of the year in the dataset to the last day of the year in the dataset (note that the last day of the year might not be December 31rst and same with the first day of the year).
Initially I thought I cou... | 2013/11/19 | [
"https://Stackoverflow.com/questions/20062544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2445226/"
] | `try this`
for getting first day ,last day of the year && firstofthe next\_year
```
SELECT
DATEADD(yy, DATEDIFF(yy,0,getdate()), 0) AS Start_Of_Year,
dateadd(yy, datediff(yy,-1, getdate()), -1) AS Last_Day_Of_Year,
DATEADD(yy, DATEDIFF(yy,0,getdate()) + 1, 0) AS FirstOf_the_NextYear
```
so putting this in ... | I should refrain from developing in the evenings because I solved it, and it's actually quite simple:
```
SELECT MIN(Date)
, MAX(Date)
FROM Table
GROUP BY YEAR(Date)
```
I can put these values into a `CTE` and then `JOIN` on the dates and get what I need:
```
;WITH CT AS(
SELECT MIN(Date) Mi
, MAX(D... |
38,516,885 | where the user enter a series of integers in a loop. The user enter -99 to signal the end of the series.Where all of the integer will be save in a file. After all the numbers have been entered, the program should read all of the integers save in the file and display all of numbers from smallest to largest.
I been try... | 2016/07/22 | [
"https://Stackoverflow.com/questions/38516885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6158177/"
] | >
> "the column\_name is variable it can be column1 if parameter a but can be column2 if parameter b"
>
>
>
Writing such a statement is not possible with regular SQL: you'll need to go dynamic and that means PL/SQL. [Find out more](https://docs.oracle.com/cloud/latest/db112/LNPLS/executeimmediate_statement.htm#LNP... | Use dynamic SQL to design a query in runtime and then EXECUTE IMMEDIATE clause. |
57,117,361 | The ruby ERB class will silently continue if a value is missing in a template.
For example `@config['bar']` and `ENV['DOESNTEXIST']` are undefined.
```
require 'erb'
@config = {}
@config['foo'] = 42
template = ERB.new <<-EOF
FOO=<%= @config['foo'] %>
BAR=<%= @config['bar'] %>
LANG=<%= ENV['LANG'] %>
BAD=<%= ... | 2019/07/19 | [
"https://Stackoverflow.com/questions/57117361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1626687/"
] | Use `fetch`. From the docs:
>
> Returns a value from the hash for the given key. If the key can’t be found, there are several options: With no other arguments, it will raise a KeyError exception; if default is given, then that will be returned; if the optional code block is specified, then that will be run and its re... | One option is to use regex to filter out all patterns like `<%= -%>` and `<%= %>`.
```
text.scan(/<%= ?([^>]+) -?%>/)
```
Which will return
```
=> [["@config['foo']"], ["@config['bar']"], ["ENV['LANG']"], ["ENV['DOESNTEXIST']"]]
```
Then use `eval()` to verify the variable `@config['foo']` exists. Because `eval... |
23,732,399 | how to get list A where not use in domain B?
Domain A
```
Class A{
String name
String code
}
```
Domain B
```
Class B{
A aaa
String description
}
```
example data:
```
**domain A**
id+versioin+name +code+|
1 | 0 |Bobby |bob |
2 | 0 |anto |ant |
3 | 0 |Jessica|jes |
4 | 0 |hera |he... | 2014/05/19 | [
"https://Stackoverflow.com/questions/23732399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
def b = B.list()
def c = A.createCriteria()
def results = c.list {
not { 'in'("id",b*.aaa.id) }
}
``` | For completeness, note in Grails 2.4 (which is at the RC phase and about to go GA) you can write this query as a single query using a subquery, which will perform better:
```
def c = A.createCriteria()
def results = c.list {
notIn new DetachedCriteria(B).id
}
``` |
57,350,356 | I want to display RecyclerView Grid items in the middle of the screen (Both horizontally and verically) and when the items expand, the view doesn't scroll, however it should resize the elements to fit the new available screen size.
I hope this image tells what I want in a short message:
[Image](https://i.stack.imgur.... | 2019/08/04 | [
"https://Stackoverflow.com/questions/57350356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11881795/"
] | `number % 2` is an expression that can't be evaluated to a boolean by any means.
>
> 15.17.3. Remainder Operator %
> -----------------------------
>
>
> The binary % operator is said **to yield the remainder of its operands from an implied division**; the left-hand operand is the dividend and the right-hand operand... | The modulus operator returns an `int`, in this case but it could return a `double` or `long` depending on the operands. An `if` statement requires a boolean. So the reason why you can't do `if(number % 2)` is because there is no boolean. With `if(number % 2 == 0)` you are checking if the result of the modulo operator i... |
9,484,714 | I need to store data's change histories in database. For example some time some user modify some property of some data. The expected result is we can get the change histories for one data like
```
Tom changed title to 'Title one;'
James changed name to 'New name'
Steve added new_tag 'tag23'
```
Based on these ... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9484714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/416767/"
] | These are commonly called audit tables. How I generally manage this is using triggers on the database. For every insert/update from a source table the trigger copies the data into another table called the same table name with an \_AUDIT appended to it (the naming convention does not matter, it's just what I use). ORACL... | I wrote an article about various options: <http://blog.schauderhaft.de/2009/11/29/versioned-data/>
If you are not tied to a relational database, there are things called 'append only' databases (I think), which never change data, but only append new versions. For your case this sounds kind of perfect. Unfortunately I d... |
2,239,032 | Using induction, prove that:
(1-x)Ex^i=1-x^n
In this question, E is the summation symbol, going from i=0 to n-1.
I have gotten all the way to the inductive step but I am unsure how to re arrange the final part to get to 1-x^(k+1)
Any help is appreciated | 2017/04/17 | [
"https://math.stackexchange.com/questions/2239032",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Suppose for some $k \in \mathbb{N}$ we have $(1 - x)\sum\_{i = 0}^{k - 1} x^i= 1- x^k$. Then
\begin{align}
(1 - x)\sum\_{i = 0}^k x^i &= (1 - x)\sum\_{i = 0}^{k - 1} x^i + (1-x)x^k \\
&= (1-x^k) + (1-x)x^k && \text{By the inductive hypothesis}\\
&= 1 - x^k + x^k - x^{k + 1}
\\&= 1 - x^{k + 1}
\end{align}
This complet... | **Hint:** Try distributing the multiplication. For finite sums, $(a-b)\sum c\_i = \sum ac\_i - \sum bc\_i$.
Do you see that there will be cancellation of many terms in this expansion of your expression? |
2,239,032 | Using induction, prove that:
(1-x)Ex^i=1-x^n
In this question, E is the summation symbol, going from i=0 to n-1.
I have gotten all the way to the inductive step but I am unsure how to re arrange the final part to get to 1-x^(k+1)
Any help is appreciated | 2017/04/17 | [
"https://math.stackexchange.com/questions/2239032",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Suppose for some $k \in \mathbb{N}$ we have $(1 - x)\sum\_{i = 0}^{k - 1} x^i= 1- x^k$. Then
\begin{align}
(1 - x)\sum\_{i = 0}^k x^i &= (1 - x)\sum\_{i = 0}^{k - 1} x^i + (1-x)x^k \\
&= (1-x^k) + (1-x)x^k && \text{By the inductive hypothesis}\\
&= 1 - x^k + x^k - x^{k + 1}
\\&= 1 - x^{k + 1}
\end{align}
This complet... | for $n+1$, you get
$$(1-x)(\frac {1-x^n}{1-x}+x^n)=$$
$$1-x^n+x^n-x^{n+1}=1-x^{n+1} $$ |
2,239,032 | Using induction, prove that:
(1-x)Ex^i=1-x^n
In this question, E is the summation symbol, going from i=0 to n-1.
I have gotten all the way to the inductive step but I am unsure how to re arrange the final part to get to 1-x^(k+1)
Any help is appreciated | 2017/04/17 | [
"https://math.stackexchange.com/questions/2239032",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/-1/"
] | Suppose for some $k \in \mathbb{N}$ we have $(1 - x)\sum\_{i = 0}^{k - 1} x^i= 1- x^k$. Then
\begin{align}
(1 - x)\sum\_{i = 0}^k x^i &= (1 - x)\sum\_{i = 0}^{k - 1} x^i + (1-x)x^k \\
&= (1-x^k) + (1-x)x^k && \text{By the inductive hypothesis}\\
&= 1 - x^k + x^k - x^{k + 1}
\\&= 1 - x^{k + 1}
\end{align}
This complet... | Since you said that you have gone to the inductive step already:
HINT:
$$
(1-x)\sum\_{i=0}^{n}x^i = (1-x)\sum\_{i=0}^{n-1}x^i + (1-x)x^n
$$ |
40,661,581 | I need to anonymize names but in a very specific way so that the format of the entire string is still the same (spaces, hyphens, periods are preserved) but all the letters are scrambled. I want to consistently replace say all A's with C's, all D's with Z's, and so on. How would I do that? | 2016/11/17 | [
"https://Stackoverflow.com/questions/40661581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1813321/"
] | We can use `chartr`
```
chartr('AD', 'CZ', str1)
#[1] "CZ,ZC. C"
```
### data
```
str1 <- c('AD,DA. C')
``` | Maybe use `gsub`?
```
string <- "ABCDEFG"
text <- gsub('A', 'C', string )
string <- gsub('D', 'Z', string )
string
[1] "CBCZEFG"
``` |
47,512,921 | I would like to do this JavaScript code in C++:
```
class Example {
constructor(myArr) {
this.myArr = myArr;
}
test() {
console.log(myArr[0])
}
}
var myArr = [1,2,3,4]
var example = new Example(myArr)
example.test()
// prints `1`
```
My C++ attempt:
```
#include <iostream>
class Exa... | 2017/11/27 | [
"https://Stackoverflow.com/questions/47512921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2879085/"
] | ```
#include <iostream>
#include <vector>
class Example {
public:
std::vector<int> myArr;
Example(const std::vector<int> & myArr);
void test();
};
Example::Example(const std::vector<int>& myArr) {
this->myArr = myArr;
}
void Example::test() {
std::cout << this->myArr[0];
}
int main() {
std::v... | I feel it might be a good idea to share with you a more C++ oriented way to do this:
```
#include <iostream>
#include <array> // uses same amount of memory as a standard array
// but has a set size unlike std::vector
class Example {
public:
std::array<int, 4> myArr;
... |
9,243,130 | ```
int pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
```
I understand that `pcap_dispatch` calls the callback routine upon receiving a packet and the first argument passed on to the callback routine is the last argument to the `pcap_dipatch` function. So what about the remaining two argument... | 2012/02/11 | [
"https://Stackoverflow.com/questions/9243130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/667657/"
] | Tested, and seems to work:
```
$('img').each(
function(){
var w = $(this).attr('width').match(/\d+/);
var percent = (w/600)*100;
$(this).removeAttr('width').css('width',percent + '%');
});
```
[JS Fiddle demo](http://jsfiddle.net/davidThomas/F6nFU/1/). | Try this simple code:
```
$('img').removeAttr('height').attr('width', function() {
return Math.round((this.width * 100)/600) + '%';
});
```
Or another variant:
```
$('img').css('width', function() {
return Math.round((this.width * 100)/600) + '%';
}).removeAttr('width height');
``` |
9,243,130 | ```
int pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
```
I understand that `pcap_dispatch` calls the callback routine upon receiving a packet and the first argument passed on to the callback routine is the last argument to the `pcap_dipatch` function. So what about the remaining two argument... | 2012/02/11 | [
"https://Stackoverflow.com/questions/9243130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/667657/"
] | Tested, and seems to work:
```
$('img').each(
function(){
var w = $(this).attr('width').match(/\d+/);
var percent = (w/600)*100;
$(this).removeAttr('width').css('width',percent + '%');
});
```
[JS Fiddle demo](http://jsfiddle.net/davidThomas/F6nFU/1/). | If you don't like to use regexes, you could use DOMDocument to parse your HTML into an object. See here: [Regex & PHP - isolate src attribute from img tag](https://stackoverflow.com/questions/2120779/regex-php-isolate-src-attribute-from-img-tag) |
9,243,130 | ```
int pcap_dispatch(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
```
I understand that `pcap_dispatch` calls the callback routine upon receiving a packet and the first argument passed on to the callback routine is the last argument to the `pcap_dipatch` function. So what about the remaining two argument... | 2012/02/11 | [
"https://Stackoverflow.com/questions/9243130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/667657/"
] | Try this simple code:
```
$('img').removeAttr('height').attr('width', function() {
return Math.round((this.width * 100)/600) + '%';
});
```
Or another variant:
```
$('img').css('width', function() {
return Math.round((this.width * 100)/600) + '%';
}).removeAttr('width height');
``` | If you don't like to use regexes, you could use DOMDocument to parse your HTML into an object. See here: [Regex & PHP - isolate src attribute from img tag](https://stackoverflow.com/questions/2120779/regex-php-isolate-src-attribute-from-img-tag) |
6,577,490 | I am trying to call a PL/SQL script with the following header:
PL/SQL:
```
CREATE OR REPLACE PROCEDURE GETQUOTE(i_QUOTEID IN HR.QUOTEID,
o_QUOTE OUT HR.QUOTE)
```
Execute command:
```
DECLARE c VARCHAR2(100);
BEGIN
HR.GETQUOTE("001", c);
END;
/
```
Error:
```
declare
c ... | 2011/07/05 | [
"https://Stackoverflow.com/questions/6577490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/321862/"
] | You are using the wrong types of quotes. If you want `001` to be string literal, you need to use single quotes.
Try this:
```
SELECT '001' FROM dual;
SELECT "001" FROM dual;
``` | Try this :
```
declare c varchar2(100);
begin
hr.getquote('001', c);
end;
/
```
In pl/sql single quotes must be used for strings. |
6,577,490 | I am trying to call a PL/SQL script with the following header:
PL/SQL:
```
CREATE OR REPLACE PROCEDURE GETQUOTE(i_QUOTEID IN HR.QUOTEID,
o_QUOTE OUT HR.QUOTE)
```
Execute command:
```
DECLARE c VARCHAR2(100);
BEGIN
HR.GETQUOTE("001", c);
END;
/
```
Error:
```
declare
c ... | 2011/07/05 | [
"https://Stackoverflow.com/questions/6577490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/321862/"
] | use the single quotes:
then
check that the first value is a string not a number inside the procedure.
you may also try to\_number('001') as the argument | Try this :
```
declare c varchar2(100);
begin
hr.getquote('001', c);
end;
/
```
In pl/sql single quotes must be used for strings. |
72,102,097 | i am trying to steam a video in my android app made with jetpack compose. To stream i using ExoPlayer but i can't really understand how to implement a full screen button, some advice?
```
@Composable
private fun VideoPlayer() {
val videoURI = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuc... | 2022/05/03 | [
"https://Stackoverflow.com/questions/72102097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17280945/"
] | To make an app go full-screen, there's
```kotlin
with(WindowCompat.getInsetsController(window, window.decorView)) {
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
hide(WindowInsetsCompat.Type.systemBars())
}
```
Which I've tailored to Kotlin, so all you need to do is ... | use this code
```
AndroidView(factory = {
StyledPlayerView(context).apply {
player = exoPlayer
setFullscreenButtonClickListener { isFullScreen ->
with(context) {
if (isFullScreen) {
setScreenOrientation(orientation = ActivityI... |
72,102,097 | i am trying to steam a video in my android app made with jetpack compose. To stream i using ExoPlayer but i can't really understand how to implement a full screen button, some advice?
```
@Composable
private fun VideoPlayer() {
val videoURI = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuc... | 2022/05/03 | [
"https://Stackoverflow.com/questions/72102097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17280945/"
] | To make an app go full-screen, there's
```kotlin
with(WindowCompat.getInsetsController(window, window.decorView)) {
systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
hide(WindowInsetsCompat.Type.systemBars())
}
```
Which I've tailored to Kotlin, so all you need to do is ... | I have an example which implements fullscreen toggling with [compose-media](https://github.com/fengdai/compose-media). You don't have to use this library. But the solution is similar.
1. Implement a composable `MediaContent` for media playback, and you can encapsulate fullscreen toggling relative logic inside it. Belo... |
72,102,097 | i am trying to steam a video in my android app made with jetpack compose. To stream i using ExoPlayer but i can't really understand how to implement a full screen button, some advice?
```
@Composable
private fun VideoPlayer() {
val videoURI = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuc... | 2022/05/03 | [
"https://Stackoverflow.com/questions/72102097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17280945/"
] | use this code
```
AndroidView(factory = {
StyledPlayerView(context).apply {
player = exoPlayer
setFullscreenButtonClickListener { isFullScreen ->
with(context) {
if (isFullScreen) {
setScreenOrientation(orientation = ActivityI... | I have an example which implements fullscreen toggling with [compose-media](https://github.com/fengdai/compose-media). You don't have to use this library. But the solution is similar.
1. Implement a composable `MediaContent` for media playback, and you can encapsulate fullscreen toggling relative logic inside it. Belo... |
2,556,591 | Heyy Everybody!
I am trying to create a memory management system, so that a user can call myMalloc, a method I created. I have a linked list keeping track of my free memory. My problem is when I am attempting to find the end of a free bit in my linked list. I am attempting to add the size of the memory free in that sec... | 2010/03/31 | [
"https://Stackoverflow.com/questions/2556591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/214730/"
] | Pointer arithmetic uses the size of the underlying type. If int is 4 bytes:
```
int *p = some_address;
p++;
```
will increment p by 4 bytes. void can't be used in pointer arithmetic because void has no size associated with. If you want to do byte-sized arithmetic on void pointers, you need to cast the pointers to a... | ```
int *tailEnd = ( int* ) ( previousPlace->head_ptr + ((previousPlace->size+1)*(sizeof(int)) );
``` |
40,076,670 | I'm trying to render lines one by one using `QTextLayout`. I've tried to set `wrapMode` to `QTextOption::ManualWrap` and call `QTextLine::setNumColumns` for each line but the whole text appears in a single line.
I've also tried to set `wrapMode` to `QTextOption::WrapAnywhere` and this time the text is broken into line... | 2016/10/16 | [
"https://Stackoverflow.com/questions/40076670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213297/"
] | Simply call a `Shell` command using the automated *Rscript.exe*. However first, you may need to export your query data into a format R can read such as csv or txt file. Alternatively, have R connect to database via RODBC.
In the command line call you can send parameters such as query name (for RODBC SQL statement) or ... | You can run R code from Microsoft Access using VBA, see <https://www.r-bloggers.com/a-million-ways-to-connect-r-and-excel/>
To create a command button for your VBA code, see <https://social.technet.microsoft.com/Forums/office/en-US/d3640d72-e91f-4d86-a52e-6d3a66888bf8/how-to-create-a-button-in-access-2010-that-runs-vb... |
71,103 | For example, an IC or "microchip" where everything must be micro-engineered on to it uses the same electrical components such as resistors, transistors, etc.
But I looked around online and noticed that transistors are actually eyes-observable(i.e., you can see and touch them, and there are some on my comp's motherboar... | 2013/05/30 | [
"https://electronics.stackexchange.com/questions/71103",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/24612/"
] | Firstly, what you can see is an opaque black epoxy *package* protecting the component.
Transistors have a unique property in that the production process can be scaled down in much the same way as reducing or enlarging a photograph. Consider this picture of a MOSFET from wikipedia: .
 and using the script without any luck. My question is very much the same.
I have a bunch of files with the a file extension that I want to change. I have used the following code but cannot... | 2020/02/15 | [
"https://Stackoverflow.com/questions/60240751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12855035/"
] | The full answer here, including comment from @StephaneLaurent: make sure that you have `full.names = TRUE` inside the `list.files()`; otherwise the path to the file will not be captured, just the file name.
Full working snippet:
```
old = list.files(startingDir,
pattern = "\\.zipwblibcurl",
... | Like @StéphaneLaurent said, it's most likely that R tries to look in the current working directory for the files and can't find them. You can correct this by adding
`file.rename(paste(startingDir, old_files, sep = "/"), paste(newDir, new_files, sep = "/"))` |
42,260,821 | I'm using Tooltips and Modals in a nested component, and in my spec file, I'm importing `NgbModule.forRoot()` in the testing module.
This seems to work everywhere except in this one component, and if I add this import, many of my unit tests suddenly start failing with this error:
```
TypeError: this._unregisterListen... | 2017/02/15 | [
"https://Stackoverflow.com/questions/42260821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2200576/"
] | The relevant [`ItemLabelPosition`](http://www.jfree.org/jfreechart/api/javadoc/org/jfree/chart/labels/ItemLabelPosition.html) constructor expects the `angle` in *radians*; you probably want something like this:
```
ItemLabelPosition itemlabelposition = new ItemLabelPosition(
ItemLabelAnchor.CENTER, TextAnchor.CENT... | Convert degrees to Radian and pass the converted value as parameter(angle) for ItemLabelPosition
ItemLabelPosition(ItemLabelAnchor.OUTSIDE12,TextAnchor.BASELINE\_CENTER,TextAnchor.BASELINE\_CENTER,-1.5708); -- here 1.5708(Radian) is for 90° |
529,054 | I have two x 2TB external HDD drives with their individual 12 external power adapters and their usb outputs connected to a media player, which also has a 12 v external power adapter. What I'd like to know is - Can I purchase a single 12v power supply with three plugs for the 2 drives and the media player. I currently u... | 2013/01/06 | [
"https://superuser.com/questions/529054",
"https://superuser.com",
"https://superuser.com/users/184972/"
] | You can use the Conditional Formatting option in Excel, its located in the home tab in 'Styles' section.
here is a good [video](https://www.youtube.com/watch?v=jTztUryXNx0) from youtube that can help you get things started.
You can format your cells however you like according to the conditions your create. | Apply conditional formatting to column B and set the formatting to change the cell color when it detects "call off" in the next cell. I don't have Excel available at the moment, so I can't tell you exactly how to do it. |
529,054 | I have two x 2TB external HDD drives with their individual 12 external power adapters and their usb outputs connected to a media player, which also has a 12 v external power adapter. What I'd like to know is - Can I purchase a single 12v power supply with three plugs for the 2 drives and the media player. I currently u... | 2013/01/06 | [
"https://superuser.com/questions/529054",
"https://superuser.com",
"https://superuser.com/users/184972/"
] | Apply conditional formatting to column B and set the formatting to change the cell color when it detects "call off" in the next cell. I don't have Excel available at the moment, so I can't tell you exactly how to do it. | In Excel 2010 you can make the data a table which will give allow the formatting to grow with the table. To add to the table, simply type data into the next row down and the table will automatically include it and format it.
**Here's how:**
Highlight your data, (assuming B6 to G24) and press `Ctrl` + `T` to insert th... |
529,054 | I have two x 2TB external HDD drives with their individual 12 external power adapters and their usb outputs connected to a media player, which also has a 12 v external power adapter. What I'd like to know is - Can I purchase a single 12v power supply with three plugs for the 2 drives and the media player. I currently u... | 2013/01/06 | [
"https://superuser.com/questions/529054",
"https://superuser.com",
"https://superuser.com/users/184972/"
] | You can use the Conditional Formatting option in Excel, its located in the home tab in 'Styles' section.
here is a good [video](https://www.youtube.com/watch?v=jTztUryXNx0) from youtube that can help you get things started.
You can format your cells however you like according to the conditions your create. | In Excel 2010 you can make the data a table which will give allow the formatting to grow with the table. To add to the table, simply type data into the next row down and the table will automatically include it and format it.
**Here's how:**
Highlight your data, (assuming B6 to G24) and press `Ctrl` + `T` to insert th... |
102,336 | I've been given a question to solve:
`Given a set of non-negative distinct integers, and a value m, determine if there is a subset of the given set with sum divisible by m.`
For this, I used the dynamic programming approach which is not optimized and takes **O(m \* m \* n)** where `n` is the no. of distinct elements.... | 2019/01/03 | [
"https://cs.stackexchange.com/questions/102336",
"https://cs.stackexchange.com",
"https://cs.stackexchange.com/users/93995/"
] | Let’s use $a\_i$ for the array. You are interested in
$$
\begin{align\*}
\max\_{i,j} a\_i + a\_j + |i-j| &= \max\_{i,j} a\_i + a\_j + \max(i-j,j-i) \\ &=
\max\_{i,j} \max((a\_i+i)+(a\_j-j), (a\_j+j)+(a\_i-i)) \\ &=
\max \left[ \max\_{i,j} (a\_i+i) + (a\_j-j), \max\_{i,j} (a\_j+j) + (a\_i-i) \right] \\ &\stackrel{(\*)}=... | Something was bothering me about Yuval Filmus's answer so I wrote it down in detail to convince myself that it was right. Perhaps someone else might also find it useful so I'm posting it as an answer.
$$
\begin{eqnarray}
\max\_{i,j} a\_i + a\_j + |i-j| &=& \max\_{i,j} (a\_i + a\_j + \max(i-j,j-i)) \nonumber \\
&=& \... |
19,697,638 | I have written a quite complex script which calls a server handler to refresh elements in a grid at the press of a button.
For code re-use and consistent behaviour, I am wanting to call that server handler directly during the initial painting of the grid.
When the server handler gets called by clicking on the button,... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19697638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2939801/"
] | I have faced the same issue when I was working with java server and iPhone application and my work around was as below.
1. Generate p12 on java server. [Remember to note down the password.]
2. Convert raw bytes of p12 file into base 64 string.
3. Send those data to iOS application no matter how you want.
3.1 You can ... | You have store your private key and the certificate in the keychain. Otherwise `SecItemCopyMatching` will not do anything. You only have to import this once.
```
/* importing client identity (private key) */
NSData* certificateData = ... ; // decoded pkcs21 certificate from base64 pem
NSString* passcode = @"passphrase... |
19,697,638 | I have written a quite complex script which calls a server handler to refresh elements in a grid at the press of a button.
For code re-use and consistent behaviour, I am wanting to call that server handler directly during the initial painting of the grid.
When the server handler gets called by clicking on the button,... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19697638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2939801/"
] | Unfortunately the Security framework on iOS requires that private keys be in the PKCS12 format, with a passphrase. Public keys can be in X509 armored DER or PKCS12, but private keys are required to be PKCS12. The private key you are trying to use is a PEM-formatted RSA key.
If you have access to the key it can be conv... | You have store your private key and the certificate in the keychain. Otherwise `SecItemCopyMatching` will not do anything. You only have to import this once.
```
/* importing client identity (private key) */
NSData* certificateData = ... ; // decoded pkcs21 certificate from base64 pem
NSString* passcode = @"passphrase... |
19,697,638 | I have written a quite complex script which calls a server handler to refresh elements in a grid at the press of a button.
For code re-use and consistent behaviour, I am wanting to call that server handler directly during the initial painting of the grid.
When the server handler gets called by clicking on the button,... | 2013/10/31 | [
"https://Stackoverflow.com/questions/19697638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2939801/"
] | Unfortunately the Security framework on iOS requires that private keys be in the PKCS12 format, with a passphrase. Public keys can be in X509 armored DER or PKCS12, but private keys are required to be PKCS12. The private key you are trying to use is a PEM-formatted RSA key.
If you have access to the key it can be conv... | I have faced the same issue when I was working with java server and iPhone application and my work around was as below.
1. Generate p12 on java server. [Remember to note down the password.]
2. Convert raw bytes of p12 file into base 64 string.
3. Send those data to iOS application no matter how you want.
3.1 You can ... |
72,081,021 | **Hi all,
I am trying to figure out where is went wrong.
The question is:**
Write a program whose inputs are three integers, and whose output is the smallest of the three values.
Ex: If the input is:
7
15
3
the output is:
3
**So I wrote this:**
```
num_1 = int(input()
num_2 = int(input()
num_3 = int(input()
def ... | 2022/05/01 | [
"https://Stackoverflow.com/questions/72081021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19011083/"
] | numbers in one line separated by space character
```
max(map(int, input().split()))
```
each number in separate line
```
N = 3
max(map(int, (input() for _ in range(N))))
``` | close the `brackets` properly and put `:` at the end of `def fun(...):`
```
num_1 = int(input())
num_2 = int(input())
num_3 = int(input())
def smallest (num_1, num_2, num_3):
return min (num_1, num_2, num_3)
if num_1 < num_2 and num_1 < num_3:
smallest_num = num_1
elif num_2 < num_1 and num_2 < num_3:
... |
20,842,548 | I am using the same style for my dropdown box, and a textbox, which is working fine, except that they are different lengths, only by ~10px
<http://jsfiddle.net/PkWVg/>

I can't seem to get them the same length without using seperate classes for each. It actually se... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20842548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012826/"
] | Apply [`box-sizing`](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing)
```
.form-textbox, .form-dropdown{
border: 0;
outline: 0;
height: 20px;
width:100%;
padding-left: 10px;
background-color: rgb(204, 204, 204);
color: #666;
-moz-box-sizing: border-box; // Added rule
-webk... | Add this:
```
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
``` |
20,842,548 | I am using the same style for my dropdown box, and a textbox, which is working fine, except that they are different lengths, only by ~10px
<http://jsfiddle.net/PkWVg/>

I can't seem to get them the same length without using seperate classes for each. It actually se... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20842548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012826/"
] | Apply [`box-sizing`](https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing)
```
.form-textbox, .form-dropdown{
border: 0;
outline: 0;
height: 20px;
width:100%;
padding-left: 10px;
background-color: rgb(204, 204, 204);
color: #666;
-moz-box-sizing: border-box; // Added rule
-webk... | The `padding-left:10px` appears to be the problem. If you remove that, the fields are the same length. |
20,842,548 | I am using the same style for my dropdown box, and a textbox, which is working fine, except that they are different lengths, only by ~10px
<http://jsfiddle.net/PkWVg/>

I can't seem to get them the same length without using seperate classes for each. It actually se... | 2013/12/30 | [
"https://Stackoverflow.com/questions/20842548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012826/"
] | Add this:
```
-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;
``` | The `padding-left:10px` appears to be the problem. If you remove that, the fields are the same length. |
54,158,949 | I am trying to replicate the analysis for lda given in: <http://www.statslab.cam.ac.uk/~tw389/teaching/SLP18/Practical06.pdf>
When I try to use their code for removing white pixels on margins my code throws out error-
```
> identical <- apply(tr_data, 2, function(v){all(v==v[1])})
> tr_data_n <- tr_data[,!identical]
... | 2019/01/12 | [
"https://Stackoverflow.com/questions/54158949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8829238/"
] | Your code works fine in the reproducible data. I guess there are some missing values in your data so that NA will exist in your `identical`.
For example:
```
df <- data.frame(V1 = c(0, 0), V2 = c(0, NA), V3 = c(0, 1))
df
# V1 V2 V3
# 1 0 0 0
# 2 0 NA 1
identical <- apply(df, 2, function(v){all(v == v[1])})
... | You must have made a typo somewhere. Running the code below works fine. Also the structure of your data is different from that in your "example" link.
```
filePath <- "http://www.statslab.cam.ac.uk/~tw389/teaching/SLP18/data/"
fileName <- "mnist.csv"
mnist <- read.csv(paste0(filePath, fileName), header = TRUE)
train <... |
375,304 | I am on Ubuntu 13.10 Gnome shell 3.10.I want to automatically restore tabs in gedit that were open in previous session (without any manual work) - Just like a web browser - FF/Chrome.
Any such compatible plugin ? | 2013/11/11 | [
"https://askubuntu.com/questions/375304",
"https://askubuntu.com",
"https://askubuntu.com/users/25414/"
] | For Gedit 3.10 (included in Ubuntu 14.04 too) you can use [gedit-restore-tabs](https://github.com/raelgc/gedit-restore-tabs):
>
> Upon starting Gedit, this plugin will try restore all open documents from the last Gedit window that was closed.
>
>
>
For older versions, you might want to try the [reopen-tabs-gedit-... | If you looking for the latest version check out <https://github.com/jefferyto/gedit-restore-tabs/tree/gedit3.8>
He has updated it to use python3 and a couple other fixes |
16,948,185 | When a div is opnened i want to load html content into it via ajax. This is the code im working with:
<http://jsfiddle.net/uhEgG/2/>
```
$(document).ready(function () {
$('#country').click(function () {
$("#country_slide").slideToggle();
});
$('#close').click(function (e) {
e.preventDefa... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1738522/"
] | There are three broad reasons that queries take longer at different times. Either you are getting different performance because the system is under a different sort of load, you are getting different performance because of data volume changes, or you are getting different performance because you are getting different q... | One possibility is that your execution plan is cached so it takes a short amount of time to rerun the query, but when the plan is no longer cached (like after the DB is restarted) it might take significantly longer.
I had a similar issue with Oracle a long while ago where a very complex query for a report ran against ... |
16,948,185 | When a div is opnened i want to load html content into it via ajax. This is the code im working with:
<http://jsfiddle.net/uhEgG/2/>
```
$(document).ready(function () {
$('#country').click(function () {
$("#country_slide").slideToggle();
});
$('#close').click(function (e) {
e.preventDefa... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16948185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1738522/"
] | There are three broad reasons that queries take longer at different times. Either you are getting different performance because the system is under a different sort of load, you are getting different performance because of data volume changes, or you are getting different performance because you are getting different q... | this is not an answer, this is a reply to Justin Cave, i couldn't format it in any readable way in the comments.
Different Data Volume
When ….. data.
**Yes, I’m using the same archive tables that I then use for months to come. Of course, data changes but it’s a pretty consistent rise, for example, if a table has 10M... |
34,896,815 | ```
NSString* jsString = [NSString stringWithFormat:@"alert('ok');"];[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];
```
I wrote it in cordova appdelegate.m! | 2016/01/20 | [
"https://Stackoverflow.com/questions/34896815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5815119/"
] | On cordova-ios@3.x you should be able to do:
```
[self.webView stringByEvaluatingJavaScriptFromString:jsString];
```
On cordova-ios@4+ you will need to cast the Webview class as it also supports WKWebView:
```
if ([self.webView isKindOfClass:[UIWebView class]]) {
[(UIWebView*)self.webView stringByEvaluatingJava... | May want to try `NSString* jsString = [NSString stringWithString:@"alert('ok');"];[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];`
or `NSString* jsString = @"alert('ok');"[self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString];` |
34,910,812 | ```
SELECT 'delete schema.'||table_name||' where code =''XYZ'';'||'
commit;' FROM users
```
Here is what I am seeing
```
select delete scheme.table_name where code = 'xyz'; commit; from users
```
Thanks! | 2016/01/20 | [
"https://Stackoverflow.com/questions/34910812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2637474/"
] | I can see the confusion. But the result should be simple
You arent executing a delete statment you are creating a string
You are using table `user` and there is a field called `table_name`
But your final result is wrong
that is ~ equivalent to
```
select 'delete scheme.table_name where code = 'xyz'; commit;'
from... | `SELECT c FROM t` returns a table with one column named c with a row for each row of table t. An output row contains its input row's column c value.
`SELECT 'pq' FROM t` returns a table with one column and one row. The value for the column is the string formed by a character `p` then a character `q`.
`SELECT 'p''q' F... |
117,028 | I have a file that consists of a single line:
```
a,x,b,c,d,e
```
I want to convert this into
```
a,x,b,x,c,x,d,x,e,x
```
Which is the easiest way to achieve this? A solution based on Python will be most helpful
Also supposing that this file is a csv file will python make the work easier? | 2014/02/26 | [
"https://unix.stackexchange.com/questions/117028",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/33793/"
] | Using `sed`:
```
echo 'a,x,b,c,d,e' | sed 's/,\([^x]\)/,\1,x/g'
``` | A Perl way:
```
echo "a,x,b,c,d,e" |
perl -lpe '@_= map { $_ => "x" } grep !/x/, split /,/,;$_=join ",",@_;'
a,x,b,x,c,x,d,x,e,x
``` |
117,028 | I have a file that consists of a single line:
```
a,x,b,c,d,e
```
I want to convert this into
```
a,x,b,x,c,x,d,x,e,x
```
Which is the easiest way to achieve this? A solution based on Python will be most helpful
Also supposing that this file is a csv file will python make the work easier? | 2014/02/26 | [
"https://unix.stackexchange.com/questions/117028",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/33793/"
] | Python
------
```
#!/usr/bin/env python
from sys import stdin
for line in stdin:
parts = line.split(',')
glue = parts.pop(1)
print(',{0},'.format(glue).join(parts) + ',' + glue)
``` | Using `sed`:
```
echo 'a,x,b,c,d,e' | sed 's/,\([^x]\)/,\1,x/g'
``` |
117,028 | I have a file that consists of a single line:
```
a,x,b,c,d,e
```
I want to convert this into
```
a,x,b,x,c,x,d,x,e,x
```
Which is the easiest way to achieve this? A solution based on Python will be most helpful
Also supposing that this file is a csv file will python make the work easier? | 2014/02/26 | [
"https://unix.stackexchange.com/questions/117028",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/33793/"
] | ```
sed 's/,x,/,/g;s/[^,]*/&,x/g'
``` | A Perl way:
```
echo "a,x,b,c,d,e" |
perl -lpe '@_= map { $_ => "x" } grep !/x/, split /,/,;$_=join ",",@_;'
a,x,b,x,c,x,d,x,e,x
``` |
117,028 | I have a file that consists of a single line:
```
a,x,b,c,d,e
```
I want to convert this into
```
a,x,b,x,c,x,d,x,e,x
```
Which is the easiest way to achieve this? A solution based on Python will be most helpful
Also supposing that this file is a csv file will python make the work easier? | 2014/02/26 | [
"https://unix.stackexchange.com/questions/117028",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/33793/"
] | Python
------
```
#!/usr/bin/env python
from sys import stdin
for line in stdin:
parts = line.split(',')
glue = parts.pop(1)
print(',{0},'.format(glue).join(parts) + ',' + glue)
``` | ```
sed 's/,x,/,/g;s/[^,]*/&,x/g'
``` |
117,028 | I have a file that consists of a single line:
```
a,x,b,c,d,e
```
I want to convert this into
```
a,x,b,x,c,x,d,x,e,x
```
Which is the easiest way to achieve this? A solution based on Python will be most helpful
Also supposing that this file is a csv file will python make the work easier? | 2014/02/26 | [
"https://unix.stackexchange.com/questions/117028",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/33793/"
] | I assume that your data is not actually what you show and instead, you want to repeat the 2nd column of a csv file, whatever that column may be, not only if it is an `x`. If so, these should work:
```
$ echo "a,x,b,c,d,e" |
perl -lpe 's/^(.+?),([^,]+)/$1/; $n=$2; s/([^,]+)/$1,$n/g; '
a,x,b,x,c,x,d,x,e,x
```
And... | A Perl way:
```
echo "a,x,b,c,d,e" |
perl -lpe '@_= map { $_ => "x" } grep !/x/, split /,/,;$_=join ",",@_;'
a,x,b,x,c,x,d,x,e,x
``` |
117,028 | I have a file that consists of a single line:
```
a,x,b,c,d,e
```
I want to convert this into
```
a,x,b,x,c,x,d,x,e,x
```
Which is the easiest way to achieve this? A solution based on Python will be most helpful
Also supposing that this file is a csv file will python make the work easier? | 2014/02/26 | [
"https://unix.stackexchange.com/questions/117028",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/33793/"
] | Python
------
```
#!/usr/bin/env python
from sys import stdin
for line in stdin:
parts = line.split(',')
glue = parts.pop(1)
print(',{0},'.format(glue).join(parts) + ',' + glue)
``` | A Perl way:
```
echo "a,x,b,c,d,e" |
perl -lpe '@_= map { $_ => "x" } grep !/x/, split /,/,;$_=join ",",@_;'
a,x,b,x,c,x,d,x,e,x
``` |
117,028 | I have a file that consists of a single line:
```
a,x,b,c,d,e
```
I want to convert this into
```
a,x,b,x,c,x,d,x,e,x
```
Which is the easiest way to achieve this? A solution based on Python will be most helpful
Also supposing that this file is a csv file will python make the work easier? | 2014/02/26 | [
"https://unix.stackexchange.com/questions/117028",
"https://unix.stackexchange.com",
"https://unix.stackexchange.com/users/33793/"
] | Python
------
```
#!/usr/bin/env python
from sys import stdin
for line in stdin:
parts = line.split(',')
glue = parts.pop(1)
print(',{0},'.format(glue).join(parts) + ',' + glue)
``` | I assume that your data is not actually what you show and instead, you want to repeat the 2nd column of a csv file, whatever that column may be, not only if it is an `x`. If so, these should work:
```
$ echo "a,x,b,c,d,e" |
perl -lpe 's/^(.+?),([^,]+)/$1/; $n=$2; s/([^,]+)/$1,$n/g; '
a,x,b,x,c,x,d,x,e,x
```
And... |
69,991,682 | I'm following a SwiftUI course, and I want to animate my view with multiple values. In the tutorial, the `animation` modifier is used without the value parameter but XCode says it's deprecated. `animation` modifier requires a `value` now.
My goal is to add multiple values to that animation, I think of Array for it. I ... | 2021/11/16 | [
"https://Stackoverflow.com/questions/69991682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9779791/"
] | You need to apply various animations separately, e.g.
```
.animation(.easeInOut(duration: 0.3), value: show)
.animation(.easeInOut(duration: 0.3), value: showCard)
.animation(.easeInOut(duration: 0.3), value: viewState)
```
That is: each modifier applies the same animation to the view, but on different conditions. | the problem here is that you the array that you need to transmit should be conform to equatable :
<https://developer.apple.com/documentation/swift/equatable>
When your array contains Bool and CGSize , swift can't perform equality between a Bool and CGSize. And In this context it doesn't make sens to make them equatab... |
63,655,599 | I have a column of dates in my table (referred as org\_day).
I try to add a new column that represent the day after, that is
day\_after = org\_day + day (or 24 hours) (for all rows of org\_day)
From what I've read, the DATE\_ADD function of SQL does not
work on the entire column, so trying to do something like:
DATE\_... | 2020/08/30 | [
"https://Stackoverflow.com/questions/63655599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12898712/"
] | IIUC:
```
df1.update(df2[df2.ne(-1)])
print (df1)
a b c
0 0.0 11 1.0
1 2.0 22 2.0
2 3.0 33 333.0
``` | One way using `pandas.DataFrame.mask`:
```
df1.mask(df2.ne(-1), df2)
```
Output:
```
a b c
0 0 11 1
1 2 22 2
2 3 33 333
``` |
63,655,599 | I have a column of dates in my table (referred as org\_day).
I try to add a new column that represent the day after, that is
day\_after = org\_day + day (or 24 hours) (for all rows of org\_day)
From what I've read, the DATE\_ADD function of SQL does not
work on the entire column, so trying to do something like:
DATE\_... | 2020/08/30 | [
"https://Stackoverflow.com/questions/63655599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12898712/"
] | ```
df1[df2.eq(-1)].fillna(df2)
```
output
```
a b c
0 0.0 11 1.0
1 2.0 22 2.0
2 3.0 33 333.0
``` | One way using `pandas.DataFrame.mask`:
```
df1.mask(df2.ne(-1), df2)
```
Output:
```
a b c
0 0 11 1
1 2 22 2
2 3 33 333
``` |
37,440,950 | I am trying to write a function that takes in a vector of integers and returns the indexes where 1 and -1 alternate. I thought this would be a simple function but it is proving devilishly hard to write!
Example:
```
index: 1 2 3 4 5 6 7 8 9 10
string: 1 0 0 0 1 -1 -1 0 1 -1 #this is input to function
returns ind... | 2016/05/25 | [
"https://Stackoverflow.com/questions/37440950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1634753/"
] | You could use @MockBean instead of @Mock and @InjectionMock.
```
@RunWith(SpringRunner.class)
@SpringBootTest
class Test {
@MockBean
NestedDao nestedDao;
@Autowired
TestedService testedSevice;
@Test
void test() {
Mockito.when(nestedDao.method()).thenReturn(1);
//data preparation omitted
test... | It makes sense to me, you are so wrong,
why?
It's because you're testing TestedService and the interaction with NestedService, not with the Dao, the Dao interaction should be verified on the NestedService tests
Look this:
```
@Component
class TestedService {
@Autowired
NestedService nestedService;
String s... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | 1. Pick a project that you're genuinely interested in.
2. Spend a little time up front defining your goals for the project.
3. Break the project up into small phases so that it doesn't take hours and hours of work to feel a sense of accomplishment. | It'll be good to have a group for a project... find some fellow programmers with same interest as yours... It feels tempting when your fella has done some advancement in that project and you haven't. This is surely motivating. |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | Yep. I burn out on coding too. I love coding and making software, but after a long day (or week, or year) of programming at work ... firing up the ol' IDE at home gets harder and harder.
Lately there have been only two types of side-project that I can stay active with:
1) Contributions to a few open source projects w... | I don't always stay motivated, but I find that when I tell other folks what I'm working on, I frequently end up spending so much energy discussing (aka arguing why I'm doing it X-way and not Y-way like the arguer thinks it should be done) that I lose interest in working on the project. So my "secret" is to not talk abo... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | Given that you already have an idea for your hobby project, I would suggest
1. Write good documentations
2. Schedule your hobby project in some sense
First of all, it's a hobby project. You may only spend 1-2 hours a day at most, or even only 1-2 hours a week, on your hobby project. It's difficult to remember all th... | To stay motivated of something that doesn't bring you money you must have at least one of the element below:
* you are proud of what you do (others can see it)
* you are deeply interested of passionated by it. The simple fact that you achieve things give you high satisfaction
* doing it allows you interesting social i... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | Yep. I burn out on coding too. I love coding and making software, but after a long day (or week, or year) of programming at work ... firing up the ol' IDE at home gets harder and harder.
Lately there have been only two types of side-project that I can stay active with:
1) Contributions to a few open source projects w... | Nice question, particularly since I'm planning on starting a hobby project myself (not the first hobby project, but projects in the past have tended to fall flat on their face when I get bored of them, which is dissatisfying to say the least).
My tips, though:
1. Develop something you care about. Pretty obvious reall... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | The only way I ever stay motivated on anything is by having a *genuine interest* in it (And yes, this can be a problem in commercial work where you're forced to work on stuff which you *don't* find internally satisfying, but I digress...).
I used to do contrived hobby projects for the sake of learning a new language o... | 1. Make sure no-one implemented what you're trying to do at home.
2. Make sure you're interested in what would be the result of your work at home.
3. Make sure other people than you think they would be interested to see the result of your work at home.
---
1. is to make your initial motivation boost enough to make yo... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | The only way I ever stay motivated on anything is by having a *genuine interest* in it (And yes, this can be a problem in commercial work where you're forced to work on stuff which you *don't* find internally satisfying, but I digress...).
I used to do contrived hobby projects for the sake of learning a new language o... | That happens to me as well, all the time. I'd say if you lose interest in something, just let it go and start something else. If you really, really like an idea or a project you wouldn't lose interest. If you lose interest, you didn't really like it in the first place. So in the spare time, do what you feel like doing.... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | 1. Pick a project that you're genuinely interested in.
2. Spend a little time up front defining your goals for the project.
3. Break the project up into small phases so that it doesn't take hours and hours of work to feel a sense of accomplishment. | The only way I ever stay motivated on anything is by having a *genuine interest* in it (And yes, this can be a problem in commercial work where you're forced to work on stuff which you *don't* find internally satisfying, but I digress...).
I used to do contrived hobby projects for the sake of learning a new language o... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | 1. Pick a project that you're genuinely interested in.
2. Spend a little time up front defining your goals for the project.
3. Break the project up into small phases so that it doesn't take hours and hours of work to feel a sense of accomplishment. | To stay motivated of something that doesn't bring you money you must have at least one of the element below:
* you are proud of what you do (others can see it)
* you are deeply interested of passionated by it. The simple fact that you achieve things give you high satisfaction
* doing it allows you interesting social i... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | The best advice I can give is don't feel guilty when your hobby projects don't receive attention for a considerable amount of time. It is supposed to be fun, and working on something when you don't feel like working on it is hardly entertaining. I have a few such projects and a couple of them have quite a few users. Pe... | I agree with a lot of the other comments, like picking topics you love, and working with technologies not used at work.
Other than those, the biggest things that keeps me going are leaving a broken test when I leave, so I have an easy starting point the next time, and looking at some aspect of the project everyday, ev... |
16,708 | I started seriously programming as a hobbiest, student and then intern about 4 years ago and I've always done small projects on the side as a learning exercise. Schools over now though, and I spend my days at work as a software developer. I would still love to do projects on the side to learn about areas in computer sc... | 2010/11/04 | [
"https://softwareengineering.stackexchange.com/questions/16708",
"https://softwareengineering.stackexchange.com",
"https://softwareengineering.stackexchange.com/users/5323/"
] | Given that you already have an idea for your hobby project, I would suggest
1. Write good documentations
2. Schedule your hobby project in some sense
First of all, it's a hobby project. You may only spend 1-2 hours a day at most, or even only 1-2 hours a week, on your hobby project. It's difficult to remember all th... | I don't. If I'm not motivated to code on a particular day or week or month, I go and do something I am motivated to do.
It's your free time, you shouldn't be forcing yourself to do things you don't want to do - that's what work is for... |
20,125,763 | i have al little code and i need to reload a block of the code every 10 seconds. Is that possible?
Code:
```
<?php
session_start();
$site_host = "hollander-ict.nl";
$sql_port = 3306;
$web_port = 80;
if (!fsockopen($site_host,$sql_port)) {
echo "SQLi machine error: Unreachable SQL server. Try again!";
}
if (!fsockope... | 2013/11/21 | [
"https://Stackoverflow.com/questions/20125763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3018332/"
] | Something very basic to get you started. You might want to add a timeout in your code.
```
setInterval(function(){
$.get('file.php', function(data){
$('#div').html(data);
});
},10000);
``` | If you want to do this with Ajax, you can use the answer of Ben Fortune.
When you just want the page to be refreshed every 10 seconds, you can also use `header()`
```
header( 'refresh: 10; url=url-to-refresh.php' );
``` |
24,950,918 | I want to perform some numerical changes in the file 'test'. As I did not how to do it with 'sed' I tried to do it with 'awk'. In this case, I want to multiply the numbers in the third line by certain number. The file test is described in the following:
```
xxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyy
0.08 0.11 0.14 ... | 2014/07/25 | [
"https://Stackoverflow.com/questions/24950918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3683062/"
] | You need to step forward to the next line, otherwise the following block with the `print` statement would being executed. Use `next` like this:
```
/0.08/ {printf " %.2f %.2f %.2f %.2f %.2f %s\n",
$1*var, $2*var, $3*var, $4*var, $5*var, $6; next}
```
Btw, `awk` is the right tool for this. Ther... | You can just replace the field:
```
awk -v var=2 'NR==3 {$1=$1*var}1' file
xxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyy
0.16 0.11 0.14 0.19 0.24 TERM
zzzzzzzzzzzzzzzzz
```
---
This solution keep the formatting of the input:
```
awk 'NR==3 {f="";n=split($0,d,/[^[:space:]]*/);$1*=var;$2*=var;$3*=var;$4*=var;$5*=var;for(i=1... |
24,950,918 | I want to perform some numerical changes in the file 'test'. As I did not how to do it with 'sed' I tried to do it with 'awk'. In this case, I want to multiply the numbers in the third line by certain number. The file test is described in the following:
```
xxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyy
0.08 0.11 0.14 ... | 2014/07/25 | [
"https://Stackoverflow.com/questions/24950918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3683062/"
] | You need to step forward to the next line, otherwise the following block with the `print` statement would being executed. Use `next` like this:
```
/0.08/ {printf " %.2f %.2f %.2f %.2f %.2f %s\n",
$1*var, $2*var, $3*var, $4*var, $5*var, $6; next}
```
Btw, `awk` is the right tool for this. Ther... | Similar to Jotnes answer replacing the field.
```
awk '!/08/||$1=$1*2' file
```
With a variable from shell
```
var=2;awk '!/08/||$1=$1*'"$var" file
```
If it is just the third line that needs changing
```
var=2;awk 'NR!=3||$1=$1*'"$var" file
``` |
24,950,918 | I want to perform some numerical changes in the file 'test'. As I did not how to do it with 'sed' I tried to do it with 'awk'. In this case, I want to multiply the numbers in the third line by certain number. The file test is described in the following:
```
xxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyy
0.08 0.11 0.14 ... | 2014/07/25 | [
"https://Stackoverflow.com/questions/24950918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3683062/"
] | You can just replace the field:
```
awk -v var=2 'NR==3 {$1=$1*var}1' file
xxxxxxxxxxxxxxxxxx
yyyyyyyyyyyyyyyyyy
0.16 0.11 0.14 0.19 0.24 TERM
zzzzzzzzzzzzzzzzz
```
---
This solution keep the formatting of the input:
```
awk 'NR==3 {f="";n=split($0,d,/[^[:space:]]*/);$1*=var;$2*=var;$3*=var;$4*=var;$5*=var;for(i=1... | Similar to Jotnes answer replacing the field.
```
awk '!/08/||$1=$1*2' file
```
With a variable from shell
```
var=2;awk '!/08/||$1=$1*'"$var" file
```
If it is just the third line that needs changing
```
var=2;awk 'NR!=3||$1=$1*'"$var" file
``` |
11,123,188 | Relatively new to WinForms but I'm working on a small business app. Anyway, where should I be storing strings and other resources for the form? I will have labels like Name, Address, etc. Should I just hard-code them in the designer? Or store them in a .resx file? If so, which .resx file (Form or Properties)?
I'm just... | 2012/06/20 | [
"https://Stackoverflow.com/questions/11123188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1296840/"
] | Typically fields like Name and Address will not be changed unless it will be a multilingual application. If it is an English only application and the labels are unlikely to change, I would leave it hard coded. | To follow up on the other answers: if you are going to localise this application (or at least anticipate localising this application) then typically you'd use the built-in Resources features in .NET (Project > Add New Item > Resources) you can get WinForms controls to load properties such as .Text from resources automa... |
13,602,259 | i write bellow code to display images from database
```
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$qry = "select id from image";
$res = mysql_query($qry) or die(mysql_error());
while($row = mysql_fetch_array($res))
{
echo "<img src=image.php?id='$row[0]'>";
}
?>
```
Image.php
```
<?php
... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13602259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1249363/"
] | `jpeg` is not a valid Content-Type, it should be `image/jpeg` | As above
+ be sure to pass the `replace = true` parameter to the header function.
`header( 'Content-Type: image/jpeg', true );` |
13,602,259 | i write bellow code to display images from database
```
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$qry = "select id from image";
$res = mysql_query($qry) or die(mysql_error());
while($row = mysql_fetch_array($res))
{
echo "<img src=image.php?id='$row[0]'>";
}
?>
```
Image.php
```
<?php
... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13602259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1249363/"
] | You also might [use base64 encoding](http://webcodertools.com/imagetobase64converter/Create) to build in the image. Like
```
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAWgBaAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAAB..." />
```
**UPDATE, base64 encoding example**
You can do that easily:
```
<?php
$imageId... | `jpeg` is not a valid Content-Type, it should be `image/jpeg` |
13,602,259 | i write bellow code to display images from database
```
<?php
mysql_connect("localhost","root","");
mysql_select_db("test");
$qry = "select id from image";
$res = mysql_query($qry) or die(mysql_error());
while($row = mysql_fetch_array($res))
{
echo "<img src=image.php?id='$row[0]'>";
}
?>
```
Image.php
```
<?php
... | 2012/11/28 | [
"https://Stackoverflow.com/questions/13602259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1249363/"
] | You also might [use base64 encoding](http://webcodertools.com/imagetobase64converter/Create) to build in the image. Like
```
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAWgBaAAD/4gxYSUNDX1BST0ZJTEUAAQEAAAxITGlubwIQAAB..." />
```
**UPDATE, base64 encoding example**
You can do that easily:
```
<?php
$imageId... | As above
+ be sure to pass the `replace = true` parameter to the header function.
`header( 'Content-Type: image/jpeg', true );` |
13,884,105 | How can we add an object to a marker in the new **Google Maps Android API v2**?
So if we click on the `InfoWindow`, we can do something with the object?
```
public void addSpotOnMap(Spot spot) {
getMap().addMarker(new MarkerOptions()
.position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getP... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13884105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388116/"
] | Not really sure if this is the correct answer, but take a look at this blogpost I made about this problem:
Since `Marker` is `final`, it's this can easily be solved by linking the data with the `Marker` in a `Map`, for example `HashMap<Marker, YourDataClass>` or `HashMap<Marker, String>`
Here's a tutorial that explai... | Try [android-maps-extensions](https://github.com/mg6maciej/android-maps-extensions) its library where you can add object to mark by setdata method and retrieve data call method getData
[Read more](https://github.com/mg6maciej/android-maps-extensions/wiki)
```
Object getData() and setData(Object) on Marker, Circle, G... |
13,884,105 | How can we add an object to a marker in the new **Google Maps Android API v2**?
So if we click on the `InfoWindow`, we can do something with the object?
```
public void addSpotOnMap(Spot spot) {
getMap().addMarker(new MarkerOptions()
.position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getP... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13884105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388116/"
] | Not really sure if this is the correct answer, but take a look at this blogpost I made about this problem:
Since `Marker` is `final`, it's this can easily be solved by linking the data with the `Marker` in a `Map`, for example `HashMap<Marker, YourDataClass>` or `HashMap<Marker, String>`
Here's a tutorial that explai... | As of Play Services v9.4.0, you can now set any object directly upon a marker!
To save the data:
```
Marker marker = getMap().addMarker(new MarkerOptions()
.position(lat, lng)
.title(spot.getName());
CustomObject myData = new CustomObject();
marker.setTag(myData);
```
Then to retreive your data:
`... |
13,884,105 | How can we add an object to a marker in the new **Google Maps Android API v2**?
So if we click on the `InfoWindow`, we can do something with the object?
```
public void addSpotOnMap(Spot spot) {
getMap().addMarker(new MarkerOptions()
.position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getP... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13884105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388116/"
] | Not really sure if this is the correct answer, but take a look at this blogpost I made about this problem:
Since `Marker` is `final`, it's this can easily be solved by linking the data with the `Marker` in a `Map`, for example `HashMap<Marker, YourDataClass>` or `HashMap<Marker, String>`
Here's a tutorial that explai... | You can bind an object within the marker after adding it on the map like:
```
MarkerOptions markerOptions = new MarkerOptions().position(YOUR_LANG_LAT).title(YOUR_TITLE);
Marker addedMarker = mMap.addMarker(markerOptions);
CustomObject obj = new CustomObject();
addedMarker.setTag(obj);
```
Then on map click for inst... |
13,884,105 | How can we add an object to a marker in the new **Google Maps Android API v2**?
So if we click on the `InfoWindow`, we can do something with the object?
```
public void addSpotOnMap(Spot spot) {
getMap().addMarker(new MarkerOptions()
.position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getP... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13884105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388116/"
] | As of Play Services v9.4.0, you can now set any object directly upon a marker!
To save the data:
```
Marker marker = getMap().addMarker(new MarkerOptions()
.position(lat, lng)
.title(spot.getName());
CustomObject myData = new CustomObject();
marker.setTag(myData);
```
Then to retreive your data:
`... | Try [android-maps-extensions](https://github.com/mg6maciej/android-maps-extensions) its library where you can add object to mark by setdata method and retrieve data call method getData
[Read more](https://github.com/mg6maciej/android-maps-extensions/wiki)
```
Object getData() and setData(Object) on Marker, Circle, G... |
13,884,105 | How can we add an object to a marker in the new **Google Maps Android API v2**?
So if we click on the `InfoWindow`, we can do something with the object?
```
public void addSpotOnMap(Spot spot) {
getMap().addMarker(new MarkerOptions()
.position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getP... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13884105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388116/"
] | Try [android-maps-extensions](https://github.com/mg6maciej/android-maps-extensions) its library where you can add object to mark by setdata method and retrieve data call method getData
[Read more](https://github.com/mg6maciej/android-maps-extensions/wiki)
```
Object getData() and setData(Object) on Marker, Circle, G... | You can bind an object within the marker after adding it on the map like:
```
MarkerOptions markerOptions = new MarkerOptions().position(YOUR_LANG_LAT).title(YOUR_TITLE);
Marker addedMarker = mMap.addMarker(markerOptions);
CustomObject obj = new CustomObject();
addedMarker.setTag(obj);
```
Then on map click for inst... |
13,884,105 | How can we add an object to a marker in the new **Google Maps Android API v2**?
So if we click on the `InfoWindow`, we can do something with the object?
```
public void addSpotOnMap(Spot spot) {
getMap().addMarker(new MarkerOptions()
.position(new LatLng(spot.getParseGeoPoint().getLatitude(), spot.getP... | 2012/12/14 | [
"https://Stackoverflow.com/questions/13884105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388116/"
] | As of Play Services v9.4.0, you can now set any object directly upon a marker!
To save the data:
```
Marker marker = getMap().addMarker(new MarkerOptions()
.position(lat, lng)
.title(spot.getName());
CustomObject myData = new CustomObject();
marker.setTag(myData);
```
Then to retreive your data:
`... | You can bind an object within the marker after adding it on the map like:
```
MarkerOptions markerOptions = new MarkerOptions().position(YOUR_LANG_LAT).title(YOUR_TITLE);
Marker addedMarker = mMap.addMarker(markerOptions);
CustomObject obj = new CustomObject();
addedMarker.setTag(obj);
```
Then on map click for inst... |
43,522,133 | This should be easy enough... I want to rename a few keys (ideally with jq), whatever I do seems to error though. Here is a json example below:
```
[
{
"fruit": "strawberry",
"veg": "apple",
"worker": "gardener"
}
]
```
I'd like to rename the veg key to fruit2 (or example, whatever is easiest) and also the w... | 2017/04/20 | [
"https://Stackoverflow.com/questions/43522133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486670/"
] | Use the following ***jq*** approach:
```
jq '[.[] | .["fruit2"] = .veg | .["job"] = .worker | del(.veg, .worker)]' file
```
The output:
```
[
{
"fruit": "strawberry",
"fruit2": "apple",
"job": "gardener"
}
]
``` | The key (:-) is with\_entries. E.g., given a single object:
```
with_entries(if .key == "veg" then .key = "fruit2" else . end)
```
In your case, since you have an array of objects, you could wrap the above in `map( ... )`. |
42,885,068 | Is there possibility to obtain 3d graphics quality like from blender or unity3D in qt/juce/gtk+ gui app? | 2017/03/19 | [
"https://Stackoverflow.com/questions/42885068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7727954/"
] | You can put your code as a handler for the Worksheet\_Change event.
[Arrtice on MSDN](https://msdn.microsoft.com/en-us/library/office/ff839775.aspx) | Hey I believe this should help!
good luck .
<http://www.tushar-mehta.com/publish_train/xl_vba_cases/0101%20Create%20a%20self%20adjusting%20range.htm> |
42,885,068 | Is there possibility to obtain 3d graphics quality like from blender or unity3D in qt/juce/gtk+ gui app? | 2017/03/19 | [
"https://Stackoverflow.com/questions/42885068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7727954/"
] | You can change Excel setting to do that :
`File > Options > Proofing > AutoCorrect Options > AutoFormat As You Type` and check `Include new rows and columns in table`
Or run this line only one time:
```
Application.AutoCorrect.AutoExpandListRange = True
``` | Hey I believe this should help!
good luck .
<http://www.tushar-mehta.com/publish_train/xl_vba_cases/0101%20Create%20a%20self%20adjusting%20range.htm> |
9,481,158 | I'm building a chart where the x-axis should be the four weeks of a month. I would like to display only the four Mondays of that month.
I already have the `currentMonth` and the `currentYear` variables, and I know how to get the first day of the month. All I need is to get the four Mondays of a month in an array. And ... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9481158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1237712/"
] | The following `function` will return all Mondays for the current month:
```
function getMondays() {
var d = new Date(),
month = d.getMonth(),
mondays = [];
d.setDate(1);
// Get the first Monday in the month
while (d.getDay() !== 1) {
d.setDate(d.getDate() + 1);
}
// G... | This would return the fourth last monday of month [m] in year [y]
```
function lastmonday(y,m) {
var dat = new Date(y+'/'+m+'/1')
,currentmonth = m
,firstmonday = false;
while (currentmonth === m){
firstmonday = dat.getDay() === 1 || firstmonday;
dat.setDate(dat.getDate()+(firstmonday ? 7 : 1));
... |
9,481,158 | I'm building a chart where the x-axis should be the four weeks of a month. I would like to display only the four Mondays of that month.
I already have the `currentMonth` and the `currentYear` variables, and I know how to get the first day of the month. All I need is to get the four Mondays of a month in an array. And ... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9481158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1237712/"
] | The following `function` will return all Mondays for the current month:
```
function getMondays() {
var d = new Date(),
month = d.getMonth(),
mondays = [];
d.setDate(1);
// Get the first Monday in the month
while (d.getDay() !== 1) {
d.setDate(d.getDate() + 1);
}
// G... | For whoever may need, this is a general function to get every monday, tuesday, etc
```
getDatesOfDayOfWeek (year, month, dayOfWeek) {
const initialDate = new Date(year, month, 1);
const datesOfDayOfWeek = [];
while (initialDate.getDay() !== dayOfWeek) {
initialDate.setDate(initialDate.getDat... |
9,481,158 | I'm building a chart where the x-axis should be the four weeks of a month. I would like to display only the four Mondays of that month.
I already have the `currentMonth` and the `currentYear` variables, and I know how to get the first day of the month. All I need is to get the four Mondays of a month in an array. And ... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9481158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1237712/"
] | The following `function` will return all Mondays for the current month:
```
function getMondays() {
var d = new Date(),
month = d.getMonth(),
mondays = [];
d.setDate(1);
// Get the first Monday in the month
while (d.getDay() !== 1) {
d.setDate(d.getDate() + 1);
}
// G... | I took [Jake's code](https://stackoverflow.com/a/9481478/241211) and generalized it to get the next `N` occurrences of a particular schedule. (e.g. "Get me the next 10 instances of 2nd Mondays and 1st and 3rd Wednesdays.")
* `schedule` is an object with keys for day-of-week whose values are
an array of the incident wi... |
9,481,158 | I'm building a chart where the x-axis should be the four weeks of a month. I would like to display only the four Mondays of that month.
I already have the `currentMonth` and the `currentYear` variables, and I know how to get the first day of the month. All I need is to get the four Mondays of a month in an array. And ... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9481158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1237712/"
] | This would return the fourth last monday of month [m] in year [y]
```
function lastmonday(y,m) {
var dat = new Date(y+'/'+m+'/1')
,currentmonth = m
,firstmonday = false;
while (currentmonth === m){
firstmonday = dat.getDay() === 1 || firstmonday;
dat.setDate(dat.getDate()+(firstmonday ? 7 : 1));
... | For whoever may need, this is a general function to get every monday, tuesday, etc
```
getDatesOfDayOfWeek (year, month, dayOfWeek) {
const initialDate = new Date(year, month, 1);
const datesOfDayOfWeek = [];
while (initialDate.getDay() !== dayOfWeek) {
initialDate.setDate(initialDate.getDat... |
9,481,158 | I'm building a chart where the x-axis should be the four weeks of a month. I would like to display only the four Mondays of that month.
I already have the `currentMonth` and the `currentYear` variables, and I know how to get the first day of the month. All I need is to get the four Mondays of a month in an array. And ... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9481158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1237712/"
] | This would return the fourth last monday of month [m] in year [y]
```
function lastmonday(y,m) {
var dat = new Date(y+'/'+m+'/1')
,currentmonth = m
,firstmonday = false;
while (currentmonth === m){
firstmonday = dat.getDay() === 1 || firstmonday;
dat.setDate(dat.getDate()+(firstmonday ? 7 : 1));
... | I took [Jake's code](https://stackoverflow.com/a/9481478/241211) and generalized it to get the next `N` occurrences of a particular schedule. (e.g. "Get me the next 10 instances of 2nd Mondays and 1st and 3rd Wednesdays.")
* `schedule` is an object with keys for day-of-week whose values are
an array of the incident wi... |
9,481,158 | I'm building a chart where the x-axis should be the four weeks of a month. I would like to display only the four Mondays of that month.
I already have the `currentMonth` and the `currentYear` variables, and I know how to get the first day of the month. All I need is to get the four Mondays of a month in an array. And ... | 2012/02/28 | [
"https://Stackoverflow.com/questions/9481158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1237712/"
] | For whoever may need, this is a general function to get every monday, tuesday, etc
```
getDatesOfDayOfWeek (year, month, dayOfWeek) {
const initialDate = new Date(year, month, 1);
const datesOfDayOfWeek = [];
while (initialDate.getDay() !== dayOfWeek) {
initialDate.setDate(initialDate.getDat... | I took [Jake's code](https://stackoverflow.com/a/9481478/241211) and generalized it to get the next `N` occurrences of a particular schedule. (e.g. "Get me the next 10 instances of 2nd Mondays and 1st and 3rd Wednesdays.")
* `schedule` is an object with keys for day-of-week whose values are
an array of the incident wi... |
194,681 | Rigify rigs rely on their rig\_ui.py file to generate the addon's interface. If you link a character collection into a new file and proxy the rig, the UI does not generate because the rig\_ui.py file is not linked. You need to append that text file as well.
In 2.79, you didn't need to do this. There was a setup using ... | 2020/09/16 | [
"https://blender.stackexchange.com/questions/194681",
"https://blender.stackexchange.com",
"https://blender.stackexchange.com/users/13324/"
] | **Assoc text with rig via a pointer property.**
To test, in a file named "RIG.blend" have asscociated all armatures with an internal text file "foo.py". An object using the armature is added to "Rig" collection.
Ran the script below and saved the file.
```
import bpy
from bpy.props import PointerProperty
from bpy.ty... | Open Blender and go to Preferences then the Add-ons tab.
Click Rigging then Rigify to enable the script.
*How to use Rigify:*
Add a meta-rig structure from the Add ‣ Armature menu.
Edit the bone positions to match the character geometry.
In the armature properties click on the Generate button to generate the rig. |
58,290,971 | I am doing a test with elasticsearch to implement it in my project.
I use CodeIgniter for my website. I found this link:[confact/elasticsearch-codeigniter-library](https://github.com/confact/elasticsearch-codeigniter-library)
I use this library in my project. Which works perfectly. Now my question is how can I return... | 2019/10/08 | [
"https://Stackoverflow.com/questions/58290971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7855946/"
] | Assuming you have your form in your view, you should do something like this:
```
public function search()
{
$param = $this->input->get('q');
$this->elasticsearch->index = 'my_index';
$data = $this->elasticsearch->query_all_wresultSize($param);
$response = json_decode(json_encode($data),tr... | Assuming you are using elasticsearch php lib
```php
public function array_pluck($array, $key) {
return array_map(function($v) use ($key) {
return is_object($v) ? $v->$key : $v[$key];
}, $array);
}
```
For searching through a document you use this
```
$params = [
'index' => 'my_inde... |
2,641 | Primarily for use on Futurama questions, but could be more generally useful for other comedy science fiction.
[In Neutopia why didn't the Borax Kid teleport in Scruffy?](https://scifi.stackexchange.com/questions/31636/in-neutopia-why-didnt-the-borax-kid-teleport-in-scruffy)
We get 4 or 5 of these a month. It's gettin... | 2013/02/10 | [
"https://scifi.meta.stackexchange.com/questions/2641",
"https://scifi.meta.stackexchange.com",
"https://scifi.meta.stackexchange.com/users/7603/"
] | Why do these questions have to be closed? Just downvote the question if you think it is bad/completely obvious.
The problem with "not constructive" is that if you don't get the joke, then you would have no way of knowing that the answer can't be supported by facts, references, etc..
One thing to keep in mind is that ... | A 'not constructive' flag for the question would be my choice of response rather than create a new close reason. |
73,220 | Planet Swamp. As the name suggest, it is a planet fully covered with swamps.
A new kind of carnivorous plant has been discovered on this planet: when its leaves are touched by an animal or moved by the wind they emit a sweet scent, something like vanilla and sugar. This sweet scent attract unaware animals close to the... | 2017/03/07 | [
"https://worldbuilding.stackexchange.com/questions/73220",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/30492/"
] | It'll probably stick with fairly small creatures.
There's a reason why carnivorous plants haven't yet grown to large sizes (or at least the traps created by those plants) - the amount of prey animals decreases as the size grows larger.
Currently the largest carnivorous plants ([pitcher plants](http://www.sarracenia.c... | I like a fungus for the approach you describe.
1: Fungi are mostly underground in mycelial webs. I think I read that the largest organism on earth is a colossal underground mycelium extending for many acres. The above ground pieces are dispensible appendages (like mushrooms). It is no big deal to the fungus if a mushr... |
73,220 | Planet Swamp. As the name suggest, it is a planet fully covered with swamps.
A new kind of carnivorous plant has been discovered on this planet: when its leaves are touched by an animal or moved by the wind they emit a sweet scent, something like vanilla and sugar. This sweet scent attract unaware animals close to the... | 2017/03/07 | [
"https://worldbuilding.stackexchange.com/questions/73220",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/30492/"
] | It'll probably stick with fairly small creatures.
There's a reason why carnivorous plants haven't yet grown to large sizes (or at least the traps created by those plants) - the amount of prey animals decreases as the size grows larger.
Currently the largest carnivorous plants ([pitcher plants](http://www.sarracenia.c... | You plant doesn't want to catch large animals, because a rotting corpse (or slurry) kills the soil macro and micro-fauna which are keeping the plant alive. Decaying corpses turn the soil anaerobic (oxygen-less) as the gloop uses up all the free oxygen. So useful burrowing creatures like worms will flee or die of suffoc... |
73,220 | Planet Swamp. As the name suggest, it is a planet fully covered with swamps.
A new kind of carnivorous plant has been discovered on this planet: when its leaves are touched by an animal or moved by the wind they emit a sweet scent, something like vanilla and sugar. This sweet scent attract unaware animals close to the... | 2017/03/07 | [
"https://worldbuilding.stackexchange.com/questions/73220",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/30492/"
] | It'll probably stick with fairly small creatures.
There's a reason why carnivorous plants haven't yet grown to large sizes (or at least the traps created by those plants) - the amount of prey animals decreases as the size grows larger.
Currently the largest carnivorous plants ([pitcher plants](http://www.sarracenia.c... | Small animals are best for all the reasons above and the fact that the drug needs to affect the animal before it leaves the area. Taking an elephant as an example, the skin is so thick that the toxin may not reach past the layer of dead cells. If it does affect a large animal, it may take too long. It does the plant no... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.