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
10,769,745
I want to insert some values of type `var dict = new Dictionary<string, int>();`.I have 4 loop and i want to insert another values beside the variables of **var dict** here is my code ``` var dict = new Dictionary<string, int>(); foreach (string word in wordsbeforesoundex) { ...
2012/05/26
[ "https://Stackoverflow.com/questions/10769745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1234453/" ]
You will need to have two columns, one for the dictionary key (word) and another for the dictionary value (frequency) ``` foreach(var pair in dict) { con.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO TableFFF (Word, Frequency) VALUES (@word, @freq)", con); cmd.Parameters.Add(new SqlParameter("@wor...
You NEEd TO USE FOR loop instead of foreach.. to pass the right values you will need for loop and change the pair.key to pair[for loop index].key ``` using (SqlCommand cmd = new SqlCommand("INSERT INTO TableFFF (Word, Frequency) VALUES (@word, @freq)", con)) { con.Open(); for (int i = 0; i < dict.Count; i++) ...
37,201,070
I am getting the error code 1054 Unknown column 'interlake' in 'field list' ``` drop table if exists `Boats`; create table `Boats` ( `bid` int(11) not null, `bname` varchar(45) default null, `color` varchar(15) default null, primary key (`bid`) ) engine=InnoDB default charset=latin1; alter table `Boats` disable keys...
2016/05/13
[ "https://Stackoverflow.com/questions/37201070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4225902/" ]
Use quotes instead of back ticks ``` INSERT INTO `Boats` (`bid`, `bname`, `color`) VALUES (101,"Interlake","blue"), (102,"Interlake","red"), (103,"Clipper","green"), (104,"Marine","red"); ```
Did you try removing back-ticks and using apostrophe ?? ``` insert into `Boats` values (101, 'Interlake', 'blue'),(102, 'Interlake', 'red'),(103, 'Clipper', 'green'),(104, 'Marine', 'red'); ```
37,201,070
I am getting the error code 1054 Unknown column 'interlake' in 'field list' ``` drop table if exists `Boats`; create table `Boats` ( `bid` int(11) not null, `bname` varchar(45) default null, `color` varchar(15) default null, primary key (`bid`) ) engine=InnoDB default charset=latin1; alter table `Boats` disable keys...
2016/05/13
[ "https://Stackoverflow.com/questions/37201070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4225902/" ]
Use quotes instead of back ticks ``` INSERT INTO `Boats` (`bid`, `bname`, `color`) VALUES (101,"Interlake","blue"), (102,"Interlake","red"), (103,"Clipper","green"), (104,"Marine","red"); ```
You are missing "values" and use quotes('' or "") instead of back ticks(``). Try this ``` drop table if exists `Boats`; create table `Boats` ( `bid` int(11) not null, `bname` varchar(45) default null, `color` varchar(15) default null, primary key (`bid`) ) engine=InnoDB default charset=latin1; ALTER TABLE `Boats` d...
3,540
I'm trying to re-implement Neural Networks in Python. I implemented the cost function and the backpropagation algorithm correctly. I have checked them by executing its Octave equivalent code. But when I'm trying to use the `scipy.optimize.fmin_cg` function, the iterations take a very long time to execute. It exits wit...
2012/10/22
[ "https://scicomp.stackexchange.com/questions/3540", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/2156/" ]
As a future hint, use the double question mark ?? to pull the source of the function: Looking at the scipy sources this error message comes up if the internal parameter alpha\_k is zero or None. This value in turn is tied to the internal Wolfe Line search algorithm. In particular it is called when the search doesn't...
I assume you didn't specify the `fprime` parameter. If you don't provide this param `fmin_cg` has to figure out its own solution what usually is much slower than which a provided optimal solution. Your code might look like this: ``` theta = fmin_cg(compute_cost_reg, fprime=compute_gradient_reg, x0=thet...
3,540
I'm trying to re-implement Neural Networks in Python. I implemented the cost function and the backpropagation algorithm correctly. I have checked them by executing its Octave equivalent code. But when I'm trying to use the `scipy.optimize.fmin_cg` function, the iterations take a very long time to execute. It exits wit...
2012/10/22
[ "https://scicomp.stackexchange.com/questions/3540", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/2156/" ]
As a future hint, use the double question mark ?? to pull the source of the function: Looking at the scipy sources this error message comes up if the internal parameter alpha\_k is zero or None. This value in turn is tied to the internal Wolfe Line search algorithm. In particular it is called when the search doesn't...
I know this is an old question, but I've just been struggling with a similar issue and thought I'd post my solution incase anyone else comes across this. I found the problem was that I hadn't properly initialised the $ \Theta $ vector to break the symmetry. After doing this, I ran `fmin_cg` with f **and** fprime, and...
3,540
I'm trying to re-implement Neural Networks in Python. I implemented the cost function and the backpropagation algorithm correctly. I have checked them by executing its Octave equivalent code. But when I'm trying to use the `scipy.optimize.fmin_cg` function, the iterations take a very long time to execute. It exits wit...
2012/10/22
[ "https://scicomp.stackexchange.com/questions/3540", "https://scicomp.stackexchange.com", "https://scicomp.stackexchange.com/users/2156/" ]
I assume you didn't specify the `fprime` parameter. If you don't provide this param `fmin_cg` has to figure out its own solution what usually is much slower than which a provided optimal solution. Your code might look like this: ``` theta = fmin_cg(compute_cost_reg, fprime=compute_gradient_reg, x0=thet...
I know this is an old question, but I've just been struggling with a similar issue and thought I'd post my solution incase anyone else comes across this. I found the problem was that I hadn't properly initialised the $ \Theta $ vector to break the symmetry. After doing this, I ran `fmin_cg` with f **and** fprime, and...
23,231,507
I am trying to implement a button that will increase the font size of text in `TextView` I have came up with the following : ``` Button biggerFont; TextView centerTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activ...
2014/04/22
[ "https://Stackoverflow.com/questions/23231507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/675100/" ]
``` getTextSize() ``` > > the size (in pixels) of the default text size in this TextView. > > > use ``` setTextSize(TypedValue.COMPLEX_UNIT_PX, ++tempSize); ``` `setTextSize` uses `scaled pixel` by default (`setTextSize(int)`), with `setTextSize(int, int)` you say the unit to use.
You are calling `setTextSize(float size)`. According to the documentation, this sets the text size in *scaled pixel* units. But then `getTextSize()` returns it back to you in *pixel* units, not *scaled pixel* units. So the solution is to call the other `setTextSize` method that allows you to explicitly set the unit t...
23,231,507
I am trying to implement a button that will increase the font size of text in `TextView` I have came up with the following : ``` Button biggerFont; TextView centerTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activ...
2014/04/22
[ "https://Stackoverflow.com/questions/23231507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/675100/" ]
``` getTextSize() ``` > > the size (in pixels) of the default text size in this TextView. > > > use ``` setTextSize(TypedValue.COMPLEX_UNIT_PX, ++tempSize); ``` `setTextSize` uses `scaled pixel` by default (`setTextSize(int)`), with `setTextSize(int, int)` you say the unit to use.
``` void setTextSize(int unit, float size) : ``` Sets the default text size to a given unit and value
23,231,507
I am trying to implement a button that will increase the font size of text in `TextView` I have came up with the following : ``` Button biggerFont; TextView centerTextView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activ...
2014/04/22
[ "https://Stackoverflow.com/questions/23231507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/675100/" ]
You are calling `setTextSize(float size)`. According to the documentation, this sets the text size in *scaled pixel* units. But then `getTextSize()` returns it back to you in *pixel* units, not *scaled pixel* units. So the solution is to call the other `setTextSize` method that allows you to explicitly set the unit t...
``` void setTextSize(int unit, float size) : ``` Sets the default text size to a given unit and value
74,446,545
I have a DETAILS table having ``` detail_id, customer_id and type ``` columns. type can either be 'A' or 'B'. customer can have both type. Goal is to find customer of Type B ONLY. i.e output should not give customer details having both type. | detail\_id | customer\_id | type | | --- | --- | --- | | 0 | c1 | A...
2022/11/15
[ "https://Stackoverflow.com/questions/74446545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15914157/" ]
You could do this in this way: 1. for each to change Map <Article Tag(string), keywords(string[])> into Map<keyword(string), Article Tags(string[]) 2. for each on all articles (a,b,c is inside this loop) a. for each on your article text -> count all same words b. remove words with count < 10 c. for each to get a...
First, you need a maintainable specification of what is to happen: Currently, you check keywords for every *article tag* in turn. If enough matches for the current tag are found, all tags are removed and the current one is added?! Instead, remove tags at the start of this article's processing. If you want a s...
51,675,102
Hi i need to remove a white space at the end of each line while printing to a file from a list. Here is my code ``` lst =[['Apple',330.0, 2.2 ,'Kg'],['banana',22,330.0, 2.2 ,'Kg']] g = open('Receipt.txt', 'w') l=0 p='' for i in lst: for j in range(len(lst[l])): print(lst[l][j],end=' ',file=g) l += 1 g...
2018/08/03
[ "https://Stackoverflow.com/questions/51675102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9552258/" ]
You can print the line all at once, using `' '` as a separator ``` lst =[['Apple',330.0, 2.2 ,'Kg'],['banana',22,330.0, 2.2 ,'Kg']] with open('Receipt.txt', 'w+') as g: for i in lst: print(*i, sep=' ', file=g) ``` makes the file ``` Apple 330.0 2.2 Kg banana 22 330.0 2.2 Kg ```
Let's give you another solution, quite close to the @PatrickHaugh's one, but without using the unpacking operator. I use: * `with ... as ...` statements to properly open and close the file * a `for` loop to iterate over the list and manage each sublist one by one * `map(str, i)` to convert each element of the sublist...
26,227
does a good known algorithm exists for this problem? On input I have two series of timestamps "when the event was observed". Theoretically the recorded timestamps should be very well aligned. Visualized ideal situation on two time lines "s" and "r" as recorded from the two devices: ![Ideal input situation](https://i....
2014/05/30
[ "https://cs.stackexchange.com/questions/26227", "https://cs.stackexchange.com", "https://cs.stackexchange.com/users/18040/" ]
Here is a pragmatic approach: 1. Look for matching pairs. Consider a pair $(s,r)$ (where $s$ is from the first device and $r$ from the second device) to be a match if their timestamps are very close, i.e., $|s-r| \le \epsilon$ for some small fixed value of $\epsilon$ that you choose in advance. $\epsilon$ is a toleran...
Your drawing looks like you'll be traversing parallel arrays. You come to s1, c.compare(s1,r1) and have your comparator (c) check against some tolerance value (you'll have to define the compare and tolerance obviously). If they are within the tolerance store them both in some key/value pairing object (which can then ...
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
Works like a charm for type number. ``` yup.number().test('len', 'Max 6 numbers', (val) => val.toString().length <= 6) ```
You can also still use the validation for number but when using test for validation of length you will have convert it to a string before testing it. ``` Yup.object().shape({ zipCode: Yup.number() .required('Zip code is a required field')// optional .typeError('Zip code can only be a number')// optional as w...
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
To add to the other answers, none of them are checking that a value exists (I see some have mentioned this in comments after posting this though)... If it is not present and the field is left empty, it will be trying to get the length of `undefined` or `null` which will then give you a javascript error and prevent oth...
You can also still use the validation for number but when using test for validation of length you will have convert it to a string before testing it. ``` Yup.object().shape({ zipCode: Yup.number() .required('Zip code is a required field')// optional .typeError('Zip code can only be a number')// optional as w...
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
@efru's [answer](https://stackoverflow.com/a/53052084/12707616) works great for numbers that are less than 22 characters. However `val.toString().length` does not work for numbers larger than 22 characters. The reason for this is that larger numbers are converted to exponential format when converted to a string in java...
This is a simple solution, but it is not perfect. ``` Yup.string() .required() .min(5, 'Must be exactly 5 digits') .max(5, 'Must be exactly 5 digits') ``` One of the solutions is: ``` Yup.string().matches(/^[0-9]{5}$/, 'Must be exactly 5 digits') ```
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
@Tamlyn's [answer](https://stackoverflow.com/a/49939186/367586) covers the length validation aspect of the question quite well. In the case of a zip code, you could use a [regex](https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s14.html) to enforce the length and limit to numeral val...
matches(/^[0-9]{8}$/, "Only 8 digits") Now, the Yup will show error if the user input letter and more or less 8 digits
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
This check leads to the best validation experience: ``` Yup.string() .required() .matches(/^[0-9]+$/, "Must be only digits") .min(5, 'Must be exactly 5 digits') .max(5, 'Must be exactly 5 digits') ``` output: ``` 12f1 // Must be only digits 123 // Must be exactly 5 digits 123456 // Must be exactly 5 digits ...
``` import { string, date} from 'yup' // Take out what is needed in import string() .trim() .matches( /^[0-9]{4}[0-9]{2}[0-9]{2}T 0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z$/, 'createdOn is not in correct format', ) .max(24), ```
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
@Tamlyn's [answer](https://stackoverflow.com/a/49939186/367586) covers the length validation aspect of the question quite well. In the case of a zip code, you could use a [regex](https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s14.html) to enforce the length and limit to numeral val...
Works like a charm for type number. ``` yup.number().test('len', 'Max 6 numbers', (val) => val.toString().length <= 6) ```
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
matches(/^[0-9]{8}$/, "Only 8 digits") Now, the Yup will show error if the user input letter and more or less 8 digits
This is a simple solution, but it is not perfect. ``` Yup.string() .required() .min(5, 'Must be exactly 5 digits') .max(5, 'Must be exactly 5 digits') ``` One of the solutions is: ``` Yup.string().matches(/^[0-9]{5}$/, 'Must be exactly 5 digits') ```
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
For future reference, if you're looking to validate a number (zip code), the above solution requires a slight tweak. The function should be : `Yup.number().test('len', 'Must be exactly 5 characters', val => val.toString().length === 5)` `.length` does not work on numbers, only strings.
@Tamlyn's [answer](https://stackoverflow.com/a/49939186/367586) covers the length validation aspect of the question quite well. In the case of a zip code, you could use a [regex](https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s14.html) to enforce the length and limit to numeral val...
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
@Tamlyn's [answer](https://stackoverflow.com/a/49939186/367586) covers the length validation aspect of the question quite well. In the case of a zip code, you could use a [regex](https://www.oreilly.com/library/view/regular-expressions-cookbook/9781449327453/ch04s14.html) to enforce the length and limit to numeral val...
@efru's [answer](https://stackoverflow.com/a/53052084/12707616) works great for numbers that are less than 22 characters. However `val.toString().length` does not work for numbers larger than 22 characters. The reason for this is that larger numbers are converted to exponential format when converted to a string in java...
49,886,881
Is there a yup function that validates a specific length? I tried `.min(5)` and `.max(5)`, but I want something that ensures the number is exactly 5 characters (ie, zip code).
2018/04/17
[ "https://Stackoverflow.com/questions/49886881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/680936/" ]
You can also use [`string.length`](https://github.com/jquense/yup#stringlengthlimit-number--ref-message-string--function-schema). ``` yup.string().length(5) ``` But it doesn't work with numbers starting with zeros: ``` const yup = require('yup') const schema = yup.string().length(5) console.log(schema.isValidSync...
i convert my number to string and store my number in a react state as a string. my solution was this ``` amount: Yup.number() .test('len', maxAmountLength, () => amountState.length <= 50) ```
39,189
This has been bothering me for a while now. I've been trying to create something, using Anvil Studio (perhaps I shouldn't be using it) that doesn't sound mechanical. Specifically, I'm trying to get the violin, piano, and guitar to sound - well, like the violin, piano, and guitar. They don't. Funny thing: I can actually...
2015/11/07
[ "https://music.stackexchange.com/questions/39189", "https://music.stackexchange.com", "https://music.stackexchange.com/users/24497/" ]
the sound quality you get depends on the sound quality of your synthesizer that turns the midi notes into audio. Better samples used by the synthesizer means better audio. for the piano, recording by midi should get you almost perfectly there. providing you can play piano decently. for the violin and guitar, not so mu...
You can use a program such as Synthfont to alter your soundfonts, giving the MIDI output a different sound (usually a much better one). <http://www.synthfont.com/Downloads.html>
39,189
This has been bothering me for a while now. I've been trying to create something, using Anvil Studio (perhaps I shouldn't be using it) that doesn't sound mechanical. Specifically, I'm trying to get the violin, piano, and guitar to sound - well, like the violin, piano, and guitar. They don't. Funny thing: I can actually...
2015/11/07
[ "https://music.stackexchange.com/questions/39189", "https://music.stackexchange.com", "https://music.stackexchange.com/users/24497/" ]
Good quality VSTi's (VST Instruments) will get you about as close as you can get without actually playing the real thing. I have not used Anvil Studio, but from looking at their website it is compatible with VST Instruments, so you could continue using that if you like. There are a lot of VST instruments available and...
the sound quality you get depends on the sound quality of your synthesizer that turns the midi notes into audio. Better samples used by the synthesizer means better audio. for the piano, recording by midi should get you almost perfectly there. providing you can play piano decently. for the violin and guitar, not so mu...
39,189
This has been bothering me for a while now. I've been trying to create something, using Anvil Studio (perhaps I shouldn't be using it) that doesn't sound mechanical. Specifically, I'm trying to get the violin, piano, and guitar to sound - well, like the violin, piano, and guitar. They don't. Funny thing: I can actually...
2015/11/07
[ "https://music.stackexchange.com/questions/39189", "https://music.stackexchange.com", "https://music.stackexchange.com/users/24497/" ]
Good quality VSTi's (VST Instruments) will get you about as close as you can get without actually playing the real thing. I have not used Anvil Studio, but from looking at their website it is compatible with VST Instruments, so you could continue using that if you like. There are a lot of VST instruments available and...
You can use a program such as Synthfont to alter your soundfonts, giving the MIDI output a different sound (usually a much better one). <http://www.synthfont.com/Downloads.html>
34,209,960
Using Node, I'm implementing a ID3 tag parser to get the title, album, and artist from MP3's. Now, I need to take the information I've gotten back, and group them by album name. In my specific usage, I'm trying to go from ### This: ``` [ { title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of ...
2015/12/10
[ "https://Stackoverflow.com/questions/34209960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5665799/" ]
Just use [`Array.prototype.forEach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) > > The `forEach()` method executes a provided function once per array element. > > > ```js var data = [{ title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of The Wake' }, ...
> > OBS: 'Ashes Of The Wake' and 'Traitor' should be arrays, not objects, because they have multiple children. > > > You don't have to, but in case you want to use `underscore`, as @Daniel said, you can use the `groupBy` function. ``` var data = [ { title: 'Break You', artist: 'Lamb Of God', album:...
34,209,960
Using Node, I'm implementing a ID3 tag parser to get the title, album, and artist from MP3's. Now, I need to take the information I've gotten back, and group them by album name. In my specific usage, I'm trying to go from ### This: ``` [ { title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of ...
2015/12/10
[ "https://Stackoverflow.com/questions/34209960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5665799/" ]
Just use [`Array.prototype.forEach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) > > The `forEach()` method executes a provided function once per array element. > > > ```js var data = [{ title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of The Wake' }, ...
You can use [Array.prototype.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce) ``` var output = input.reduce(function(result, value) { result[value.album] = result[value.album] || []; result[value.album].push({ title: value.title, artist: value.artist }); re...
34,209,960
Using Node, I'm implementing a ID3 tag parser to get the title, album, and artist from MP3's. Now, I need to take the information I've gotten back, and group them by album name. In my specific usage, I'm trying to go from ### This: ``` [ { title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of ...
2015/12/10
[ "https://Stackoverflow.com/questions/34209960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5665799/" ]
Just use [`Array.prototype.forEach()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) > > The `forEach()` method executes a provided function once per array element. > > > ```js var data = [{ title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of The Wake' }, ...
As Kieran suggested, using [underscore.js](http://underscorejs.org/) provides you an easy elegant solution. ``` var groupedData = _.groupBy(data, 'album'); ``` Here's the plunker: <http://plnkr.co/edit/a7DhxpGx0C4FVMgIjzPY?p=preview> Edit ---- I would like to add that you would want to use [lodash](https://lodash....
34,209,960
Using Node, I'm implementing a ID3 tag parser to get the title, album, and artist from MP3's. Now, I need to take the information I've gotten back, and group them by album name. In my specific usage, I'm trying to go from ### This: ``` [ { title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of ...
2015/12/10
[ "https://Stackoverflow.com/questions/34209960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5665799/" ]
You can use [Array.prototype.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce) ``` var output = input.reduce(function(result, value) { result[value.album] = result[value.album] || []; result[value.album].push({ title: value.title, artist: value.artist }); re...
> > OBS: 'Ashes Of The Wake' and 'Traitor' should be arrays, not objects, because they have multiple children. > > > You don't have to, but in case you want to use `underscore`, as @Daniel said, you can use the `groupBy` function. ``` var data = [ { title: 'Break You', artist: 'Lamb Of God', album:...
34,209,960
Using Node, I'm implementing a ID3 tag parser to get the title, album, and artist from MP3's. Now, I need to take the information I've gotten back, and group them by album name. In my specific usage, I'm trying to go from ### This: ``` [ { title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of ...
2015/12/10
[ "https://Stackoverflow.com/questions/34209960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5665799/" ]
As Kieran suggested, using [underscore.js](http://underscorejs.org/) provides you an easy elegant solution. ``` var groupedData = _.groupBy(data, 'album'); ``` Here's the plunker: <http://plnkr.co/edit/a7DhxpGx0C4FVMgIjzPY?p=preview> Edit ---- I would like to add that you would want to use [lodash](https://lodash....
> > OBS: 'Ashes Of The Wake' and 'Traitor' should be arrays, not objects, because they have multiple children. > > > You don't have to, but in case you want to use `underscore`, as @Daniel said, you can use the `groupBy` function. ``` var data = [ { title: 'Break You', artist: 'Lamb Of God', album:...
34,209,960
Using Node, I'm implementing a ID3 tag parser to get the title, album, and artist from MP3's. Now, I need to take the information I've gotten back, and group them by album name. In my specific usage, I'm trying to go from ### This: ``` [ { title: 'Break You', artist: 'Lamb Of God', album: 'Ashes Of ...
2015/12/10
[ "https://Stackoverflow.com/questions/34209960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5665799/" ]
You can use [Array.prototype.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce) ``` var output = input.reduce(function(result, value) { result[value.album] = result[value.album] || []; result[value.album].push({ title: value.title, artist: value.artist }); re...
As Kieran suggested, using [underscore.js](http://underscorejs.org/) provides you an easy elegant solution. ``` var groupedData = _.groupBy(data, 'album'); ``` Here's the plunker: <http://plnkr.co/edit/a7DhxpGx0C4FVMgIjzPY?p=preview> Edit ---- I would like to add that you would want to use [lodash](https://lodash....
114,750
I want to focus-stack 10 images of 20MPi each. I do not have a photoshop license and am looking for some light-weighted tool which does not need installation (don't have rights to install). Ideally, there are many online tools out there for different image manipulations (such as resize image online etc...). Is there an...
2020/02/19
[ "https://photo.stackexchange.com/questions/114750", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/89638/" ]
Maybe it helps someone, I have used following site couple of times to focus stack images: <https://focusstackingonline.com/>. I actually tried it also on mobile and it worked.
I haven't used it, but you might look into Picolay. It has a "portable" install capability (i.e., no admin rights needed; run from anywhere) <http://picolay.de/download.htm>
114,750
I want to focus-stack 10 images of 20MPi each. I do not have a photoshop license and am looking for some light-weighted tool which does not need installation (don't have rights to install). Ideally, there are many online tools out there for different image manipulations (such as resize image online etc...). Is there an...
2020/02/19
[ "https://photo.stackexchange.com/questions/114750", "https://photo.stackexchange.com", "https://photo.stackexchange.com/users/89638/" ]
Maybe it helps someone, I have used following site couple of times to focus stack images: <https://focusstackingonline.com/>. I actually tried it also on mobile and it worked.
There is a website [www.Photopea.com](https://www.Photopea.com), which is an advanced photo editor. It can do focus-stacking, as described in [this article](https://www.photopea.com/tuts/focus-stack-images-online/). It runs on your computer, so you don't need to worry about uploading 200 MB of photos on a slow interne...
38,274,406
I have an ASP.NET MVC 5 WEB Application running under a website in IIS 8 where I need to change language programmatically at runtime by a user preference that I read from a DB and store in a session variable, and this value can change during runtime with a dropdown. The problem is language resources sometimes do not c...
2016/07/08
[ "https://Stackoverflow.com/questions/38274406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2912260/" ]
The only way I could ensure to get the correct resources was to make a work around **to override directly over the resources the CurrentThreadUICulture property for all resource lookups at the end of my CultureFilter** ``` Resources.Resource.Culture = cultureInfo; ``` And this did the trick!, taking advantage to hav...
I believe what is happening here is that you are setting the culture in a **different thread** than where you are actually using it. You are setting the culture in an asynchronous method `BeginExecuteCore`, which might not be consistently transferring the culture to your application's UI working thread. This would expl...
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
Result1 is `[Object, "success", Object]` and not the JSON as described in final example here <https://api.jquery.com/jquery.when/>. `result1[0]` should be the response of the ajax request and so it should be the javascript object that map the JSON of the response.
After reading all the comments I understood that your `result1` is an object. Hence no need to parse it, you can directly access the values. Here is a example snippet. ```js var Json = { "result": [{ "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null,...
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
`result1` and `result2` is already the objects, you don't need to `parse` or `stringify` it. Just iterate it: ``` for(var key in result1){ var a = result1[key]; // do something with 'a' } ```
After reading all the comments I understood that your `result1` is an object. Hence no need to parse it, you can directly access the values. Here is a example snippet. ```js var Json = { "result": [{ "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null,...
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
No need to parse by `JSON.parse()` because the answer is already an object itself you can do this. ``` function f() { var request1 = $.ajax({ url: '/a', type: 'GET', }); var request2 = $.ajax({ url : '/b', ...
After reading all the comments I understood that your `result1` is an object. Hence no need to parse it, you can directly access the values. Here is a example snippet. ```js var Json = { "result": [{ "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null,...
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
`JSON.stringify` returns a string. Use: ``` var json = typeof(result1[0]) === 'string' ? JSON.parse(result1[0]) : result1[0]; ``` The `[0]` is because `$.ajax()` returns the data in the first argument in `done` function.
After reading all the comments I understood that your `result1` is an object. Hence no need to parse it, you can directly access the values. Here is a example snippet. ```js var Json = { "result": [{ "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null,...
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
No need to parse by `JSON.parse()` because the answer is already an object itself you can do this. ``` function f() { var request1 = $.ajax({ url: '/a', type: 'GET', }); var request2 = $.ajax({ url : '/b', ...
Result1 is `[Object, "success", Object]` and not the JSON as described in final example here <https://api.jquery.com/jquery.when/>. `result1[0]` should be the response of the ajax request and so it should be the javascript object that map the JSON of the response.
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
Result1 is `[Object, "success", Object]` and not the JSON as described in final example here <https://api.jquery.com/jquery.when/>. `result1[0]` should be the response of the ajax request and so it should be the javascript object that map the JSON of the response.
`JSON.stringify` returns a string. Use: ``` var json = typeof(result1[0]) === 'string' ? JSON.parse(result1[0]) : result1[0]; ``` The `[0]` is because `$.ajax()` returns the data in the first argument in `done` function.
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
No need to parse by `JSON.parse()` because the answer is already an object itself you can do this. ``` function f() { var request1 = $.ajax({ url: '/a', type: 'GET', }); var request2 = $.ajax({ url : '/b', ...
`result1` and `result2` is already the objects, you don't need to `parse` or `stringify` it. Just iterate it: ``` for(var key in result1){ var a = result1[key]; // do something with 'a' } ```
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
`result1` and `result2` is already the objects, you don't need to `parse` or `stringify` it. Just iterate it: ``` for(var key in result1){ var a = result1[key]; // do something with 'a' } ```
`JSON.stringify` returns a string. Use: ``` var json = typeof(result1[0]) === 'string' ? JSON.parse(result1[0]) : result1[0]; ``` The `[0]` is because `$.ajax()` returns the data in the first argument in `done` function.
36,241,389
I have the following json: ``` { "result":[ { "a": 500000, "b": null, "c": 0, "d": 0, "e": 1855 }, { "a": 500001, "b": null, "c": 0, "d": 0, "e": 3770 } ], "host": "43252ed565f9", "time": "Wed Mar 23 09:57:43 UTC 2016", "status": "Ok" } ``` I'm trying to par...
2016/03/26
[ "https://Stackoverflow.com/questions/36241389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3928712/" ]
No need to parse by `JSON.parse()` because the answer is already an object itself you can do this. ``` function f() { var request1 = $.ajax({ url: '/a', type: 'GET', }); var request2 = $.ajax({ url : '/b', ...
`JSON.stringify` returns a string. Use: ``` var json = typeof(result1[0]) === 'string' ? JSON.parse(result1[0]) : result1[0]; ``` The `[0]` is because `$.ajax()` returns the data in the first argument in `done` function.
80,545
I have tried everything to change the PayPal image at checkout in magento 1.9.1 CE. We set up PayPal standard which also enables PayPal Express. We are not using any of the premium products from PayPal, just standard. Apparently you can only change that image if you have one of their premium services, payflow pro, et...
2015/09/01
[ "https://magento.stackexchange.com/questions/80545", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/23492/" ]
You can do it from this template file : ``` /app/design/frontend/base/default/template/paypal/payment/mark.phtml ``` Both paypal logo and text "What is Paypal" is coded in this file. Ideally you should copy this file with same path in your theme and modify this file according to requirements. Like if your theme is...
You can do it from this template file: **app/code/core/Mage/Paypal/Block/Express/from.php** ``` From protected function _construct() { $result = parent::_construct(); $this->setRedirectMessage(Mage::helper('paypal')->__('You will be redirected to the PayPal website.')); return $result; ...
60,580,556
I am looking for best ways of doing this. I have two arrays (array 1d and array 2d object): ``` let keys = [11, 12]; let values = [ [ { name: '1', link: '1', history: '1' }, { name: '2', link: '2', history: '2' } ], [ { name: '3', link: '3', history: '3' }, { name: '4', link: '4', history: '4' } ] ] ``...
2020/03/07
[ "https://Stackoverflow.com/questions/60580556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13017994/" ]
You may simply just use \_.map ```js let keys = [11, 12]; let values = [[{"name":"1","link":"1","history":"1"},{"name":"2","link":"2","history":"2"}],[{"name":"3","link":"3","history":"3"},{"name":"4","link":"4","history":"4"}]] console.log(_.map(values, (v, i) => _.map(v, o => (o.q = keys[i], o)))) ``` ```html <sc...
Not a lodash solution, but a universal approach for more arrays with objects for merging to get a cartesian product. ```js let keys = [11, 12], values = [[{ name: '1', link: '1', history: '1' }, { name: '2', link: '2', history: '2' }], [{ name: '3', link: '3', history: '3' }, { name: '4', link: '4', history: '4' ...
60,580,556
I am looking for best ways of doing this. I have two arrays (array 1d and array 2d object): ``` let keys = [11, 12]; let values = [ [ { name: '1', link: '1', history: '1' }, { name: '2', link: '2', history: '2' } ], [ { name: '3', link: '3', history: '3' }, { name: '4', link: '4', history: '4' } ] ] ``...
2020/03/07
[ "https://Stackoverflow.com/questions/60580556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13017994/" ]
You may simply just use \_.map ```js let keys = [11, 12]; let values = [[{"name":"1","link":"1","history":"1"},{"name":"2","link":"2","history":"2"}],[{"name":"3","link":"3","history":"3"},{"name":"4","link":"4","history":"4"}]] console.log(_.map(values, (v, i) => _.map(v, o => (o.q = keys[i], o)))) ``` ```html <sc...
You can use `Array.flatMap()` (or lodash's `_.flatMap()`) to iterate the values, and then map the sub-arrays, and add the respective key: ```js const keys = [11, 12]; const values = [[{"name":"1","link":"1","history":"1"},{"name":"2","link":"2","history":"2"}],[{"name":"3","link":"3","history":"3"},{"name":"4","link"...
53,473,921
I am trying to solve a coding question that requires the results be returned using a given struct. The struct is defined as: ``` struct Answer { const char* const* lastNames; unsigned numberOfPeople; } ``` Where the lastNames is a pointer to last names that are each terminated by a non-alpha char. I can not...
2018/11/26
[ "https://Stackoverflow.com/questions/53473921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6541156/" ]
The structure being used effectively uses a C-style approach to defining a variable sized array of pointers to `char` (with `const` sprinkled over it). You’ll need storage for both the array of `char const*` as well as the entities pointed to. Here is how you could build it from a `std::vector<std::string>`: ``` std::...
A `const` member variable can only be assigned in the constructor. if you can add to the struct, define a constructor, and use the `: lastname(value)` syntax; or use the `struct Answer myVar{value,number};` initialization, right where you declare your instance. Another - ugly, dangerous, and frowned upon - alternat...
53,473,921
I am trying to solve a coding question that requires the results be returned using a given struct. The struct is defined as: ``` struct Answer { const char* const* lastNames; unsigned numberOfPeople; } ``` Where the lastNames is a pointer to last names that are each terminated by a non-alpha char. I can not...
2018/11/26
[ "https://Stackoverflow.com/questions/53473921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6541156/" ]
The structure being used effectively uses a C-style approach to defining a variable sized array of pointers to `char` (with `const` sprinkled over it). You’ll need storage for both the array of `char const*` as well as the entities pointed to. Here is how you could build it from a `std::vector<std::string>`: ``` std::...
You can't just cast stuff. struct Answer is expecting a char\*\*, so you are going to have to build it and keep it valid as long as the struct Answer is in use. At least they were kind enough to let us know they don't intend to modify it or mess with cleaning up the memory, since it takes "const char \* const \*". ```...
14,910,968
I am creating an application that for some reasons shall only accept PNG images. How can I check if an image is really a PNG image? Currently I am using the JavaFX 2 [Image](http://docs.oracle.com/javafx/2/api/index.html?javafx/scene/image/Image.html) class to load the image. Thanks for any hint!
2013/02/16
[ "https://Stackoverflow.com/questions/14910968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/298288/" ]
This command ``` C:\new>java -cp <C:\new> BankApp.class ``` attempts to redirect input from `C:\new` and redirect output to `BankApp.class`. In a Windows command prompt (and most other command prompts, for that matter), `<` redirects input and `>` redirects output. Separately, when you're running a Java class, you d...
You just need: ``` java BankApp ``` Or ``` java -cp c:\new BankApp ``` Java takes the name of a *class*, not a *file*... and if you use `<` and `>` that's asking the Windows shell to perform redirection, which you don't want.
49,201,226
I'm working on a few illustrations for an event and I have a php that echos certain data at certain times and I was wondering if I could have this PHP script in one of the slides and allow it to echo out the certain data I want. Can anyone help with this and if you don't understand ask me more Thanks in advance!
2018/03/09
[ "https://Stackoverflow.com/questions/49201226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7568137/" ]
You can't execute PHP inside Powerpoint if that's what you're asking; although MS does have a WebBrowser control that you can embed in slide - <https://support.microsoft.com/en-us/help/291926/how-to-use-the-webbrowser-control-on-a-slide> - I have used this in the past, but wouldn't particularly recommend it
The way this could be solved is by uploading the php file to a web server, the use the liveweb plugin for Powerpoint (<http://skp.mvps.org/liveweb.htm>). This definitely works on powerpoint 97 or later however i can't see it being updated for powerpoint 2019.
286,720
I am new to database implementation. I want to know if it is necessary for a foreign key to be primary key of another table. Foreign key is not unique - it may have duplicate entries. If it must be primary key of another table then why it is necessary? I think any column can be a foreign key because you can put condi...
2021/03/09
[ "https://dba.stackexchange.com/questions/286720", "https://dba.stackexchange.com", "https://dba.stackexchange.com/users/225459/" ]
The referencing column may not be unique, as you point out. If the referenced column is also not unique, you have created a many-to-many relationship, which is a right pain to implement and can cause problems maintaining data integrity. For example, I have two rows in table 1 with the same value in the referenced colu...
> > is it necessary for a foreign key to be primary key of another table > > > Yes, foreign key has to be primary key of parent table. > > foreign key is not unique it may have duplicate entries > > > Yes, it may not be unique and may have duplicate entries in child table, but it must be unique and does not ...
53,385,341
I want to make a chat layout. I want to put Edittext and Button on the bottom of the screen. I already tried using gravity : bottom and alignParentBottom : true, but it doesn't give any effect about that. This is my code ``` <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/re...
2018/11/20
[ "https://Stackoverflow.com/questions/53385341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8105545/" ]
If you don't want to modify basic structure of layout file, just modify two places as the following comments: ``` ... <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/myChat" android:layout_alignParentBotto...
Why are you using a RelativeLayout inside of your ConstraintLayout. Firstly I suggest you use either the Relative Layout or the ConstraintLayout. I give you an example for the ConstraintLayout ``` <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="...
53,385,341
I want to make a chat layout. I want to put Edittext and Button on the bottom of the screen. I already tried using gravity : bottom and alignParentBottom : true, but it doesn't give any effect about that. This is my code ``` <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/re...
2018/11/20
[ "https://Stackoverflow.com/questions/53385341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8105545/" ]
If you don't want to modify basic structure of layout file, just modify two places as the following comments: ``` ... <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/myChat" android:layout_alignParentBotto...
Just add `android:layout_alignParentBottom="true"` in your Bottom LinearLayout and remove `android:layout_gravity="center"` from send button. The final code is below. ``` <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/re...
28,280,556
I use this bit of code: ``` <ul class="login-links"> <li> <a href="/wp-login.php?redirect_to=<?php echo $_SERVER['REQUEST_URI']; ?>" class="simplemodal-login"><?php printf(__("Login"))?></a> <span id="space-login-string"><?php printf(__(" or "));?></span> <a href="/wp-login.php?action=regis...
2015/02/02
[ "https://Stackoverflow.com/questions/28280556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1680484/" ]
There are two possibilities: 1. The function `__()` might trim the output or input on its own. 2. The spaces are missing in the translated string. IMHO, the spaces should not be inside the string which is to be translated, since only "or" needs a translation and making sure that the spaces are inserted is not the tra...
You should refer to the [I18n for WordPress Developers docs](http://codex.wordpress.org/I18n_for_WordPress_Developers#Placeholders). The right way of doing this with `printf()` would be: ``` printf( __( 'LOGIN %d REGISTER.', 'your-text-domain' ), 'or' ); ``` There are a lot of other ways you could also do it, such a...
35,836,503
Is it possible to get email address or phone number of user's friends using Twitter API? Im aware i need to ask special permission to get user's email address. But how about the user's friends? I checked [this official](https://dev.twitter.com/rest/reference/get/friends/list) documentation, but cant find any email ad...
2016/03/07
[ "https://Stackoverflow.com/questions/35836503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1203797/" ]
No, its not possible to get email or phone number via Twitter API. Maybe Path is sending invites using DM to your friends.
Yes it is possible to get email address from twitter api ``` TWTRAPIClient *client = [TWTRAPIClient clientWithCurrentUser]; [client requestEmailForCurrentUser:^(NSString *email, NSError *error) { if (email) { NSLog(@"signed in as %@", email); } else { NSLog(@"error: %@", [er...
52,033,009
It is my `test-tab.csv` as below. ``` \data\ hello ``` Notice:there is a `\t` between `\` and `h` in `test-tab.csv`,that is to say ,showing in vim(set list). ``` \data\^Ihello$ ``` Prepare for loading data. ``` create table tab(`f1` varchar(10),`f2` varchar(10)); ``` Load the data into table `tab`. ``` LOAD ...
2018/08/27
[ "https://Stackoverflow.com/questions/52033009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1982032/" ]
The problem seems to be escaping the tab. ``` FIELDS TERMINATED BY '\t' ESCAPED BY '' ``` If that does not work, is there some character that is not used in the data? Say `|`? Then ``` FIELDS TERMINATED BY '\t' ESCAPED BY '|' ```
``` LOAD DATA LOCAL INFILE "f:/test-tab.csv" INTO TABLE tab FIELDS TERMINATED BY '\t' ESCAPED BY '' LINES TERMINATED BY '\n' \W; ``` 1.add `ESCAPED BY ''` 2.`LINES TERMINATED BY '\n'` The csv file was created in linux,i load it in my win-os.
44,354,752
I am new to c and sometimes I get confused by things I see. I have the following code: ``` int sstmm_() {time_t ourtime; time(&ourtime); return (int)(ourtime&0x00000fff); } ``` I do not understand what the meaning of `ourtime&0x00000fff` is? Is it a pointer yet? What is the rule of `0x00000fff`? Thank you so muc...
2017/06/04
[ "https://Stackoverflow.com/questions/44354752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8065276/" ]
`&` does not refer to address-of in this case like you probably are confusing it with, but bitwise AND. The bitwise AND operation takes one left hand side parameter and one right hand side parameter, compares them at the bit level (i.e. the 1s and 0s) and returns a value representing which positions in the LHS and th...
``` & ``` stands for bitwise and operation here, it is not related to addresss and pointers
44,354,752
I am new to c and sometimes I get confused by things I see. I have the following code: ``` int sstmm_() {time_t ourtime; time(&ourtime); return (int)(ourtime&0x00000fff); } ``` I do not understand what the meaning of `ourtime&0x00000fff` is? Is it a pointer yet? What is the rule of `0x00000fff`? Thank you so muc...
2017/06/04
[ "https://Stackoverflow.com/questions/44354752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8065276/" ]
`&` does not refer to address-of in this case like you probably are confusing it with, but bitwise AND. The bitwise AND operation takes one left hand side parameter and one right hand side parameter, compares them at the bit level (i.e. the 1s and 0s) and returns a value representing which positions in the LHS and th...
`ourtime` is of type `time_t` which is normally a typedef of `__time_t` `__time_t` type is in itself not the first thing I would explore if I was new to ANSI C, the standard says it represents the system time since unix epoch, on linux like environment it is usually signed integer, which could be 32 bit or 64 bit long...
2,857,312
I was trying to evaluate the following series, which I know converges: $$\sum\_{k=1}^{\infty} 2\ln{(2k)} - \ln{(2k-1)} - \ln{(2k+1)} \tag{1}\label{1} $$ In a telescoping fashion, I began writing out the terms in hopes to find a pattern: $$= (2\ln{2} - \ln{1} - \ln{3}) + (2\ln{4} - \ln{3} - \ln{5}) + (2\ln{6} - \ln{5}...
2018/07/20
[ "https://math.stackexchange.com/questions/2857312", "https://math.stackexchange.com", "https://math.stackexchange.com/users/324783/" ]
Let $S\_N$ be the sum of the first $N$ terms. Then $$\exp(S\_N)=\prod\_{k=1}^N\frac{(2k)^2}{(2k-1)(2k+1)} =\frac{4^N N!^2}{(2N+1)(1\times 3\times 5\cdots\times (2N-1))^2} =\frac{16^N N!^4}{(2N+1)(2N)!^2}.$$ You can now attack this with Stirling's formula.
Here is the answer of the series. With expansion of $\ln$ we have \begin{align} \sum\_{k=1}^{\infty} 2\ln(2k)-\ln(2k-1)-\ln(2k+1) &= \sum\_{k=1}^{\infty} -\ln\left(1-\dfrac{1}{2k}\right)-\ln\left(1-\dfrac{1}{2k}\right) \\ &= \sum\_{k=1}^{\infty} \sum\_{n\geqslant1} \dfrac{1}{n}\left(\dfrac{1}{2k}\right)^{2n} \\ &= \su...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
Where R1, R2 are random uniform numbers: NORMAL DISTRIBUTION, with SD of 1: ``` sqrt(-2*log(R1))*cos(2*pi*R2) ``` This is exact... no need to do all those slow loops! Reference: [dspguide.com/ch2/6.htm](http://dspguide.com/ch2/6.htm)
I would use Box-Muller. Two things about this: 1. You end up with two values per iteration Typically, you cache one value and return the other. On the next call for a sample, you return the cached value. 2. Box-Muller gives a Z-score You have to then scale the Z-score by the standard deviation and add the mean t...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
The [Ziggurat algorithm](http://en.wikipedia.org/wiki/Ziggurat_algorithm) is pretty efficient for this, although the [Box-Muller transform](http://en.wikipedia.org/wiki/Box-Muller_transform) is easier to implement from scratch (and not crazy slow).
Changing the distribution of any function to another involves using the inverse of the function you want. In other words, if you aim for a specific probability function p(x) you get the distribution by integrating over it -> d(x) = integral(p(x)) and use its inverse: Inv(d(x)). Now use the random probability function ...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
There are plenty of methods: * Do **not** use Box Muller. Especially if you draw many gaussian numbers. Box Muller yields a result which is clamped between -6 and 6 (assuming double precision. Things worsen with floats.). And it is really less efficient than other available methods. * Ziggurat is fine, but needs a tab...
It seems incredible that I could add something to this after eight years, but for the case of Java I would like to point readers to the [Random.nextGaussian()](https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextGaussian--) method, which generates a Gaussian distribution with mean 0.0 and standard devia...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
Use the central limit theorem [wikipedia entry](http://en.wikipedia.org/wiki/Central_limit_theorem) [mathworld entry](http://mathworld.wolfram.com/CentralLimitTheorem.html) to your advantage. Generate n of the uniformly distributed numbers, sum them, subtract n\*0.5 and you have the output of an approximately normal d...
This is a Matlab implementation using the polar form of the [Box-Muller](https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform) transformation: Function `randn_box_muller.m`: ``` function [values] = randn_box_muller(n, mean, std_dev) if nargin == 1 mean = 0; std_dev = 1; end r = gaussR...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
There are plenty of methods: * Do **not** use Box Muller. Especially if you draw many gaussian numbers. Box Muller yields a result which is clamped between -6 and 6 (assuming double precision. Things worsen with floats.). And it is really less efficient than other available methods. * Ziggurat is fine, but needs a tab...
Q How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? 1. For software implementation I know couple random generator names which give you a pseudo uniform random sequence in [0,1] (Mersenne Twister, Linear Congruate Generator). Let's ...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
The [Ziggurat algorithm](http://en.wikipedia.org/wiki/Ziggurat_algorithm) is pretty efficient for this, although the [Box-Muller transform](http://en.wikipedia.org/wiki/Box-Muller_transform) is easier to implement from scratch (and not crazy slow).
I thing you should try this in EXCEL: `=norminv(rand();0;1)`. This will product the random numbers which should be normally distributed with the zero mean and unite variance. "0" can be supplied with any value, so that the numbers will be of desired mean, and by changing "1", you will get the variance equal to the squa...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
Changing the distribution of any function to another involves using the inverse of the function you want. In other words, if you aim for a specific probability function p(x) you get the distribution by integrating over it -> d(x) = integral(p(x)) and use its inverse: Inv(d(x)). Now use the random probability function ...
``` function distRandom(){ do{ x=random(DISTRIBUTION_DOMAIN); }while(random(DISTRIBUTION_RANGE)>=distributionFunction(x)); return x; } ```
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
Changing the distribution of any function to another involves using the inverse of the function you want. In other words, if you aim for a specific probability function p(x) you get the distribution by integrating over it -> d(x) = integral(p(x)) and use its inverse: Inv(d(x)). Now use the random probability function ...
Use the central limit theorem [wikipedia entry](http://en.wikipedia.org/wiki/Central_limit_theorem) [mathworld entry](http://mathworld.wolfram.com/CentralLimitTheorem.html) to your advantage. Generate n of the uniformly distributed numbers, sum them, subtract n\*0.5 and you have the output of an approximately normal d...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
There are plenty of methods: * Do **not** use Box Muller. Especially if you draw many gaussian numbers. Box Muller yields a result which is clamped between -6 and 6 (assuming double precision. Things worsen with floats.). And it is really less efficient than other available methods. * Ziggurat is fine, but needs a tab...
This is a Matlab implementation using the polar form of the [Box-Muller](https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform) transformation: Function `randn_box_muller.m`: ``` function [values] = randn_box_muller(n, mean, std_dev) if nargin == 1 mean = 0; std_dev = 1; end r = gaussR...
75,677
How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?
2008/09/16
[ "https://Stackoverflow.com/questions/75677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8062/" ]
The standard Python library module **random** has what you want: > > normalvariate(mu, sigma) > > Normal distribution. mu is the mean, and sigma is the standard deviation. > > > For the algorithm itself, take a look at the function in random.py in the Python library. The [manual entry is here](http://docs.py...
I thing you should try this in EXCEL: `=norminv(rand();0;1)`. This will product the random numbers which should be normally distributed with the zero mean and unite variance. "0" can be supplied with any value, so that the numbers will be of desired mean, and by changing "1", you will get the variance equal to the squa...
10,065,280
I am using this code to show text in a `JTextArea`: ``` jTextArea1.setText(jTextArea1.getText() + text + "\r\n"); jTextArea1.repaint(); ``` But it shows an exception: ``` java.lang.NullPointerException ```
2012/04/08
[ "https://Stackoverflow.com/questions/10065280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1317153/" ]
You never instantiated your `JTextArea`. Also, you might want to check out [`JTextArea#append`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JTextArea.html#append%28java.lang.String%29).
``` jTextArea1.setText(jTextArea1.getText() + text + "\r\n"); StringBuilder sb = new StringBuilder(); if(jTextArea1.getText().trim().length() > 0){ sb.append(jTextArea1.getText().trim()); } sb.append(text).append("\r\n"); jTextArea1.setText(sb.toString()); ``` Above two friends gave you answer. I want to explai...
10,065,280
I am using this code to show text in a `JTextArea`: ``` jTextArea1.setText(jTextArea1.getText() + text + "\r\n"); jTextArea1.repaint(); ``` But it shows an exception: ``` java.lang.NullPointerException ```
2012/04/08
[ "https://Stackoverflow.com/questions/10065280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1317153/" ]
You never instantiated your `JTextArea`. Also, you might want to check out [`JTextArea#append`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JTextArea.html#append%28java.lang.String%29).
The following code adds text to the text area. Note that the text system uses the '\n' character internally to represent newlines; for details, see the API documentation for DefaultEditorKit. ``` private final static String newline = "\n"; ... textArea.append(text + newline); ``` [Source](http://docs.oracle.com/java...
10,065,280
I am using this code to show text in a `JTextArea`: ``` jTextArea1.setText(jTextArea1.getText() + text + "\r\n"); jTextArea1.repaint(); ``` But it shows an exception: ``` java.lang.NullPointerException ```
2012/04/08
[ "https://Stackoverflow.com/questions/10065280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1317153/" ]
You never instantiated your `JTextArea`. Also, you might want to check out [`JTextArea#append`](http://docs.oracle.com/javase/7/docs/api/javax/swing/JTextArea.html#append%28java.lang.String%29).
As Jeffrey pointed out, you have to create an object instance before you call non-static methods on it. Otherwise, you will get a `NullPointerException`. Also note that appending a text to a `JTextArea` can be done easily by calling its `JTextArea.append(String)` method. See the following example code for more detail. ...
8,488,783
My current query:- ``` select p.id as product_id, p.product_name, child.name as category_name, parent.name as parent_category_name from category child left join products p on FIND_IN_SET(child.id,p.category_ids) left join category parent on parent.id = child.parentid and parent.parentid = 0 where p.id = 7 ``` Cu...
2011/12/13
[ "https://Stackoverflow.com/questions/8488783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603128/" ]
Apache Commons Logging is an abstraction for the concrete implementation. It uses log4j, if present and configured. I would use Commons logging in my code and log4j as logging implementation.
log4j is a logging framework, i.e. it provides the code to log messages. Commons-logging is an abstraction layer for logging frameworks, it doesn't log anything itself. For example if I write code using commons logging and deploy it on JBoss, the logging is done by log4j, but if I deploy it on WebSphere logging is done...
8,488,783
My current query:- ``` select p.id as product_id, p.product_name, child.name as category_name, parent.name as parent_category_name from category child left join products p on FIND_IN_SET(child.id,p.category_ids) left join category parent on parent.id = child.parentid and parent.parentid = 0 where p.id = 7 ``` Cu...
2011/12/13
[ "https://Stackoverflow.com/questions/8488783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603128/" ]
Apache Commons Logging is an abstraction for the concrete implementation. It uses log4j, if present and configured. I would use Commons logging in my code and log4j as logging implementation.
As per java-doc documentation of commons-logging Concrete subclass of LogFactory that implements the following algorithm to dynamically select a logging implementation class to instantiate a wrapper for: * Use a factory configuration attribute named org.apache.commons.logging.Log to identify the requested implementa...
8,488,783
My current query:- ``` select p.id as product_id, p.product_name, child.name as category_name, parent.name as parent_category_name from category child left join products p on FIND_IN_SET(child.id,p.category_ids) left join category parent on parent.id = child.parentid and parent.parentid = 0 where p.id = 7 ``` Cu...
2011/12/13
[ "https://Stackoverflow.com/questions/8488783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/603128/" ]
log4j is a logging framework, i.e. it provides the code to log messages. Commons-logging is an abstraction layer for logging frameworks, it doesn't log anything itself. For example if I write code using commons logging and deploy it on JBoss, the logging is done by log4j, but if I deploy it on WebSphere logging is done...
As per java-doc documentation of commons-logging Concrete subclass of LogFactory that implements the following algorithm to dynamically select a logging implementation class to instantiate a wrapper for: * Use a factory configuration attribute named org.apache.commons.logging.Log to identify the requested implementa...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
While you are missing flags and the other answers aren't necessarily wrong, considering running [adduser](https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt) if you want it more comprehensive in the future. It's a prettier version of useradd. Namely it'll make a home directory by d...
You are missing flags in the useradd command. '-m' to create user directory, '-s /bin/bash' to add the bash shell. The default is to not create a user directory and to assign the default shell. My system did the same thing when I tested it so it looks like ubuntu 14.04 uses blank as the default shell. You can't login b...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
First notice that it's better to use adduser and not useradd. * [What is the difference between adduser and useradd?](https://askubuntu.com/questions/345974/what-is-the-difference-between-adduser-and-useradd) * <https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt> Now back to your...
You are missing flags in the useradd command. '-m' to create user directory, '-s /bin/bash' to add the bash shell. The default is to not create a user directory and to assign the default shell. My system did the same thing when I tested it so it looks like ubuntu 14.04 uses blank as the default shell. You can't login b...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
Thanks everyone. With your answers I've been able to fix the problem using the following command lines. ``` sudo useradd -c "Samwise the Brave" -m -s /bin/bash sam echo -e "hello-1234\nhello-1234" | passwd sam ``` The password is set with `passwd` so it is already encrypted (otherwise "hello-1234" would appear not e...
You are missing flags in the useradd command. '-m' to create user directory, '-s /bin/bash' to add the bash shell. The default is to not create a user directory and to assign the default shell. My system did the same thing when I tested it so it looks like ubuntu 14.04 uses blank as the default shell. You can't login b...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
Create user Create user's home directory Define login shell ``` useradd -m -d /home/username username -s /bin/bash ``` Delete User Deleter User's Home Directory ``` userdel -r username ```
You are missing flags in the useradd command. '-m' to create user directory, '-s /bin/bash' to add the bash shell. The default is to not create a user directory and to assign the default shell. My system did the same thing when I tested it so it looks like ubuntu 14.04 uses blank as the default shell. You can't login b...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
First notice that it's better to use adduser and not useradd. * [What is the difference between adduser and useradd?](https://askubuntu.com/questions/345974/what-is-the-difference-between-adduser-and-useradd) * <https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt> Now back to your...
While you are missing flags and the other answers aren't necessarily wrong, considering running [adduser](https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt) if you want it more comprehensive in the future. It's a prettier version of useradd. Namely it'll make a home directory by d...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
Create user Create user's home directory Define login shell ``` useradd -m -d /home/username username -s /bin/bash ``` Delete User Deleter User's Home Directory ``` userdel -r username ```
While you are missing flags and the other answers aren't necessarily wrong, considering running [adduser](https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt) if you want it more comprehensive in the future. It's a prettier version of useradd. Namely it'll make a home directory by d...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
First notice that it's better to use adduser and not useradd. * [What is the difference between adduser and useradd?](https://askubuntu.com/questions/345974/what-is-the-difference-between-adduser-and-useradd) * <https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt> Now back to your...
Thanks everyone. With your answers I've been able to fix the problem using the following command lines. ``` sudo useradd -c "Samwise the Brave" -m -s /bin/bash sam echo -e "hello-1234\nhello-1234" | passwd sam ``` The password is set with `passwd` so it is already encrypted (otherwise "hello-1234" would appear not e...
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
First notice that it's better to use adduser and not useradd. * [What is the difference between adduser and useradd?](https://askubuntu.com/questions/345974/what-is-the-difference-between-adduser-and-useradd) * <https://unix.stackexchange.com/questions/121071/what-does-adduser-do-that-useradd-doesnt> Now back to your...
Create user Create user's home directory Define login shell ``` useradd -m -d /home/username username -s /bin/bash ``` Delete User Deleter User's Home Directory ``` userdel -r username ```
643,411
I am trying to create a new user in Ubuntu 14.04 LTS from the bash command line. I use the following commands: ``` sudo useradd -c "Samwise the Brave" sam sudo passwd sam Enter new UNIX password: hello-1234 Retype new UNIX password: hello-1234 passwd: password updated successfully ``` After creating ...
2015/07/02
[ "https://askubuntu.com/questions/643411", "https://askubuntu.com", "https://askubuntu.com/users/425606/" ]
Create user Create user's home directory Define login shell ``` useradd -m -d /home/username username -s /bin/bash ``` Delete User Deleter User's Home Directory ``` userdel -r username ```
Thanks everyone. With your answers I've been able to fix the problem using the following command lines. ``` sudo useradd -c "Samwise the Brave" -m -s /bin/bash sam echo -e "hello-1234\nhello-1234" | passwd sam ``` The password is set with `passwd` so it is already encrypted (otherwise "hello-1234" would appear not e...
1,766,888
I have a bunch of columns and some columns which are values I need to add. Lets say I want to sum columnB (which could be $) where column A is banana, how do I do that? Thing is I have a huge dataset and it is something that is going to keep changing. And besides banana, i might have apples, oranges, etc. And I want t...
2009/11/19
[ "https://Stackoverflow.com/questions/1766888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/215018/" ]
Look up the `SUMIF` function <http://office.microsoft.com/en-us/excel/HP052092921033.aspx> You can do somethig like this `=SUMIF(A1:A10, "banana", B1:B10)` To make it dynamic, lets say A11 has "apple", B11 has "banana" and C11 has "orange" and you want the sums in the row below in A12, put `=SUMIF ($A$1:$A$10, A11...
Check out the SUMIF formula. For example: ``` =SUMIF(A1:A5, "banana", B1:B5) ``` In this example, A1:A5 is your value range. "banana" is the value you can evaluate against (this can be a cell reference). And B1:B5 are your values to be summed.
1,766,888
I have a bunch of columns and some columns which are values I need to add. Lets say I want to sum columnB (which could be $) where column A is banana, how do I do that? Thing is I have a huge dataset and it is something that is going to keep changing. And besides banana, i might have apples, oranges, etc. And I want t...
2009/11/19
[ "https://Stackoverflow.com/questions/1766888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/215018/" ]
Look up the `SUMIF` function <http://office.microsoft.com/en-us/excel/HP052092921033.aspx> You can do somethig like this `=SUMIF(A1:A10, "banana", B1:B10)` To make it dynamic, lets say A11 has "apple", B11 has "banana" and C11 has "orange" and you want the sums in the row below in A12, put `=SUMIF ($A$1:$A$10, A11...
you're looking for the sumif function: <http://www.techonthenet.com/excel/formulas/sumif.php> in your case you would use it like this: sumif(A1:A1000, "banana", B1:B1000)
40,961,246
I got infowindows working, but for some reason if I click the same marker multiple clicks it opens multiple of the same infowindow. I have a feeling it has to be something with my code, but I cant quite put my finger on what it is. Any help is appreciated. ``` var map; var markers = []; function initMap() { map =...
2016/12/04
[ "https://Stackoverflow.com/questions/40961246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1486483/" ]
If you don't want an infowindow created every time you click on the marker, don't create a new one every time you click on the marker, create one for the marker (or one for the map, if you only ever want one open), and open it in the click listener. ``` function addMarker(feature) { var marker = new google.maps.Mark...
You are creating a new `InfoWindow` with every marker click: `marker.addListener('click' ... var infoWindow = *new google.maps.InfoWindow( ...*` It is expected that you get multiple instances. If you want one `InfoWindow` for all markers you can follow [this example](https://developers.google.com/maps/documentati...
11,238,091
I newbie in iOS Programming. i Have a cutom navigation bar that have 70 px height and i want that back button and Title is vertically align to middle. I alredy done with the navbar title. But i dont have any idea how to vertically align the back button to middle. thanks. ![Navigation Bar](https://i.stack.imgur.com/5...
2012/06/28
[ "https://Stackoverflow.com/questions/11238091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903350/" ]
In iOS 5 you can customise the position of the back buttons of all of your navigation bars with this magic incantation: ``` [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setBackButtonBackgroundVerticalPositionAdjustment:-10 forBarMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearanceWhe...
Set the back bar button's **center.y** to the imageview's **height/2**.
24,595,158
I have bash scripts `meteostart` and `meteo`. Both scripts run from the command line ok. At 09:32 the light go on but never off, like it does when `/bin/meteo` is run from command line. With cron job `/bin/meteo` also works ok (blinking 5 times on/off). Only when script `meteo` is called from script `meteostart`, it ...
2014/07/06
[ "https://Stackoverflow.com/questions/24595158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3804654/" ]
One way to do this is using `Pipeline`, `SVC(kernel='precomputed')` and wrapping your custom kernel function as a `sklearn` estimator (a subclass of `BaseEstimator` and `TransformerMixin`)). For example, `sklearn` contains a [custom kernel function](http://scikit-learn.org/stable/modules/generated/sklearn.metrics.pair...
As mentioned in the [linked question](https://stackoverflow.com/questions/43470610/how-to-tune-parameters-of-custom-kernel-function-with-pipeline-in-scikit-learn/44277799#44277799)... how about using an automated parameter tuning with [auto-sklearn](https://automl.github.io/auto-sklearn)? It is a drop-in replacement of...
24,595,158
I have bash scripts `meteostart` and `meteo`. Both scripts run from the command line ok. At 09:32 the light go on but never off, like it does when `/bin/meteo` is run from command line. With cron job `/bin/meteo` also works ok (blinking 5 times on/off). Only when script `meteo` is called from script `meteostart`, it ...
2014/07/06
[ "https://Stackoverflow.com/questions/24595158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3804654/" ]
One way to do this is using `Pipeline`, `SVC(kernel='precomputed')` and wrapping your custom kernel function as a `sklearn` estimator (a subclass of `BaseEstimator` and `TransformerMixin`)). For example, `sklearn` contains a [custom kernel function](http://scikit-learn.org/stable/modules/generated/sklearn.metrics.pair...
with scikit-learn 0.19, you can do ``` from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import chi2_kernel reg_kridge=KernelRidge(kernel='chi2') params_grid={"gamma":np.logspace(0,-4,5)} reg=GridSearchCV(reg_kridge,params_grid, n_jobs=-1,cv=10,scoring='neg_mean_squared_error') reg.fit(train,...
24,595,158
I have bash scripts `meteostart` and `meteo`. Both scripts run from the command line ok. At 09:32 the light go on but never off, like it does when `/bin/meteo` is run from command line. With cron job `/bin/meteo` also works ok (blinking 5 times on/off). Only when script `meteo` is called from script `meteostart`, it ...
2014/07/06
[ "https://Stackoverflow.com/questions/24595158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3804654/" ]
with scikit-learn 0.19, you can do ``` from sklearn.kernel_ridge import KernelRidge from sklearn.metrics.pairwise import chi2_kernel reg_kridge=KernelRidge(kernel='chi2') params_grid={"gamma":np.logspace(0,-4,5)} reg=GridSearchCV(reg_kridge,params_grid, n_jobs=-1,cv=10,scoring='neg_mean_squared_error') reg.fit(train,...
As mentioned in the [linked question](https://stackoverflow.com/questions/43470610/how-to-tune-parameters-of-custom-kernel-function-with-pipeline-in-scikit-learn/44277799#44277799)... how about using an automated parameter tuning with [auto-sklearn](https://automl.github.io/auto-sklearn)? It is a drop-in replacement of...
19,506,934
Need to write method calculateBoatSpeed() that takes 2 integer parameters. This first is the amount of money a team spent on their boat in dollars. The second is the number of people on the crew who own houses in New Zealand. The method should return how fast the boat will go in knots (a nautical measure of speed equal...
2013/10/22
[ "https://Stackoverflow.com/questions/19506934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2905118/" ]
You can create a new image, a BufferedImage with the TookitImage. ``` Image toolkitImage = img.getScaledInstance(getWidth(), getHeight(), Image.SCALE_SMOOTH); int width = toolkitImage.getWidth(null); int height = toolkitImage.getHeight(null); // width and height are of the toolkit image BufferedImage newImage ...
`BufferedImage#getScaledInstance` is actually inherited from `java.awt.Image` and only guarantees that it will return an `Image` so I would say it's not a good idea to try and assume the underlying return type in this case. `getScaledInstance` is, also, not normally the fastest or best quality method To scale a `Buff...
55,220,760
i've made this script but it won't work properly, what i want is an input box, and if i use it the site returns some text. ```js function myFunction(); var text_input = document.getElementById("input001").value; if (text_input == "4") { document.getElementById("message001").innerText = "Correct!"; } else { do...
2019/03/18
[ "https://Stackoverflow.com/questions/55220760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11214174/" ]
1-In Xcode >> open Product menu >> then choose clean 2-While you are in iOS folder open terminal and run `pod install` Reference: <https://github.com/flutter/flutter/issues/21989#issuecomment-509193686>
**1.** First do `flutter clean` **2.** Secondly do `flutter build ios` this is automtically run the `pod install`.
55,220,760
i've made this script but it won't work properly, what i want is an input box, and if i use it the site returns some text. ```js function myFunction(); var text_input = document.getElementById("input001").value; if (text_input == "4") { document.getElementById("message001").innerText = "Correct!"; } else { do...
2019/03/18
[ "https://Stackoverflow.com/questions/55220760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11214174/" ]
I was facing this issue from last week. I search a lot but I didn't find anything helpful.I follow the below step to build IPA: <https://flutter.dev/docs/deployment/ios> I was trying to build IPA using projectPath/ios/Runner.xcodeproj in xcode which was wrong and throwing this error "connectivity/ConnectivityPlugin.h...
**1.** First do `flutter clean` **2.** Secondly do `flutter build ios` this is automtically run the `pod install`.
55,220,760
i've made this script but it won't work properly, what i want is an input box, and if i use it the site returns some text. ```js function myFunction(); var text_input = document.getElementById("input001").value; if (text_input == "4") { document.getElementById("message001").innerText = "Correct!"; } else { do...
2019/03/18
[ "https://Stackoverflow.com/questions/55220760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11214174/" ]
The solution worked for me is as follows. First do `flutter clean` then goto `projectDirectory/ios` and open the `Runner.xcworkspace` file instead of `Runner.xcodeproject` Then go to `Product` menu in the opened xcode window and click on on Archive/Build as per your need.
**1.** First do `flutter clean` **2.** Secondly do `flutter build ios` this is automtically run the `pod install`.
45,703
What can be bigger than Absolute Everything or it is the biggest concept, the one-above-all concept, which encompasses all things without exception (tangible, untangible, things that we can imagine and that we can't)? Is it really that «Absolute Everything» means Absolute Everything or it's just a conception which is l...
2017/08/30
[ "https://philosophy.stackexchange.com/questions/45703", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/28428/" ]
You might want to ask yourself whether 'absolutely everything' is even a concept, or if it is simply a placeholder for one. Kant made this objection that 'exists' is not really a property of things: If 'exists' is a property of things, then 'not exists' is a property of things. But although 'not exists' does seem to a...
From a linguistic approach: every-thing just relates to every "thing" which is an object that one need not, cannot, or does not wish to give a specific name to (my dictionary says so). My dictionary defines "object" as anything visible or tangible and relatively stable in form. So, "everything" means: Every material ...
45,703
What can be bigger than Absolute Everything or it is the biggest concept, the one-above-all concept, which encompasses all things without exception (tangible, untangible, things that we can imagine and that we can't)? Is it really that «Absolute Everything» means Absolute Everything or it's just a conception which is l...
2017/08/30
[ "https://philosophy.stackexchange.com/questions/45703", "https://philosophy.stackexchange.com", "https://philosophy.stackexchange.com/users/28428/" ]
You might want to ask yourself whether 'absolutely everything' is even a concept, or if it is simply a placeholder for one. Kant made this objection that 'exists' is not really a property of things: If 'exists' is a property of things, then 'not exists' is a property of things. But although 'not exists' does seem to a...
If by 'Absolutely Everything' you mean the set of all possible entities, then no, there are no possible entities not in that set, by definition. If you mean the set of all existing entities, then, unless you think that all possible entities exist or that only existing items deserve entity status, then there would be a ...
1,198,394
Show if $f\_n$ are non negative measurable functions: $$\int (\sum\_{n=1}^\infty f\_n) d\mu = \sum\_{n=1}^\infty \int f\_n d\mu$$ Does this not just follow from the theorem for two additivity? Say $\int (\sum\_{n=1}^N f\_n) d\mu = \int (\sum\_{n=1}^{N-1} f\_n) + f\_N \mbox{ }d\mu = \int (\sum\_{n=1}^{N-1} f\_n) d\mu ...
2015/03/20
[ "https://math.stackexchange.com/questions/1198394", "https://math.stackexchange.com", "https://math.stackexchange.com/users/215850/" ]
Since $f\_{n} \geq 0$ by assumption, if we let $g\_{m} = \sum \limits\_{n = 1}^{m} f\_{n}$, we have that $0 \leq g\_{m} \leq g\_{m + 1}$ for all $m$ (i.e., {$g\_{m}$} is a monotonically increasing sequence of measurable functions), so by the monotone convergence theorem, we have that $$ \int \lim \limits\_{m \to \infty...
Hint: Let $F\_N(s)=\sum\_{n=1}^N f\_n$ and then use Levi's Theorem.
26,140,789
ServiceStack has delivered on EVERYTHING I've thrown at it, except the SAAS (Multi-tenant) use case where single API instance is using several databases of the same schema, one per tenant. These databases, because of legal reasons need to be housed in separate instances. So, my question is this, "Is it possible to ch...
2014/10/01
[ "https://Stackoverflow.com/questions/26140789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/105788/" ]
I've added an example [Multi Tenant test](https://github.com/ServiceStack/ServiceStack/blob/master/tests/ServiceStack.WebHost.Endpoints.Tests/MultiTennantAppHostTests.cs) showing my preferred approach where I would use a custom `IDbConnectionFactory` wrapper so I have better visibility and control of the Db Connections...
Resolve connection string dynamically ===================================== This method uses a global request filter to determine who is making the request, and sets the connection string into a request item. Then when the IoC tries to resolve the `IDbConnectionFactory` it will retrieve the connection string for that ...
9,240,393
I really need some help on an issue: I'm converting an XML to CSV using a PHP script, but the XML contains some + signs and I don't know how to remove them from the CSV. This is the XML file structure: ``` <PRICES> <PRICE> <WIC>HDE0AAFGRBOX</WIC> <STOCK>100+</STOCK> <MY_PRICE>219.00</MY_PRICE> </PRICE> </PRICES> ```...
2012/02/11
[ "https://Stackoverflow.com/questions/9240393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1203752/" ]
You could try to trim the chars you want to be removed (the '+' char): ``` foreach($xml->PRICES->PRICE as $price) { $price->STOCK = trim($price->STOCK, "+"); fputcsv($f, get_object_vars($price),',','"'); } ```
Try to use str\_replace : ``` $filexml='stock.xml'; if (file_exists($filexml)) { $xml = simplexml_load_file($filexml); $f = fopen('stock.csv', 'w') foreach($xml->PRICES->PRICE as $price) { $price->STOCK = str_replace("+","",$price->STOCK); fputcsv($f, get_object_vars($price),',','"'); } fclose($f); } ```