qid
int64
1
74.7M
question
stringlengths
0
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
2
48.3k
response_k
stringlengths
2
40.5k
11,300,429
I have an XML file from which I am parsing some content to display in a list: ### Class: ```c public class SampleClass { public string Sample {get; set;} public string Definite {get; set;} public string Random {get; set;} } ``` ### XML File Sample: ```xml <Question> <Sample>This is sample 1</S...
2012/07/02
[ "https://Stackoverflow.com/questions/11300429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1372448/" ]
Do it in 2 passes. The first pass can be identical to what you already have. The second pass will assign a random answer to each item in the list. This is off the top of my head, so forgive any bugs, but it will look something like the following: ``` IList<string> randomAnswers = _list .Select(c => c.Definite) ...
This should be what you're looking for: ``` var rnd = new Random(); //make this a static field, if needed var questions = xmlDoc.Descendants("Question").ToList(); _list = _questions.Select(q => new SampleClass { Sample = q.Element("Sample").Value, Definite = q.Element("Definite").Value, Random = questions[...
281,394
Is it possible for a third party app to access macOS's clipboard content? I am asking in relation to copy & paste sensitive data such as passwords and sensitive file content.
2017/04/20
[ "https://apple.stackexchange.com/questions/281394", "https://apple.stackexchange.com", "https://apple.stackexchange.com/users/234813/" ]
No security for data that is in one of the system clipboards is possible by design. This appears to be changing with 2020 features in publicly announced betas where [Apple potentially will notify us each time an app copies content out of the clipboard](https://www.macrumors.com/2020/06/23/ios-14-clipboard-pasted-notifi...
Any process with sufficient permissions can read your clipboard at any time, and you can't easily prevent this. Security is always a trade-off with usability, and this is the choice that most (but not all) OSes take when implementing the clipboard. Some apps that store sensitive data (e.g. [1Password](https://1passwor...
8,205,965
I have a password lock in my app. The user can save a password in the settings, and choose to only allow a user into the application with a password. When the app starts, the user is presented with a splash screen. In this Activity, if the user has chosen to enable password lock in the settings, I present a dialog that...
2011/11/21
[ "https://Stackoverflow.com/questions/8205965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/413414/" ]
You are looking for the `INDIRECT` [function](http://support.microsoft.com/kb/151323) ``` =INDIRECT("C"&(24-A1)) ```
You can do this with the OFFSET [function](http://office.microsoft.com/en-us/excel-help/offset-HP005209208.aspx) =OFFSET(C24,-A1,0) This will take the location of cell C24, subtract A1 from the row reference, and add 0 to the column reference.
3,738,687
I'm working with Doctrine2 for the first time, but I think this question is generic enough to not be dependent on a specific ORM. **Should the entities in a Data Mapper pattern be aware - and *use* - the Mapper**? I have a few specific examples, but they all seem to boil down to the same general question. If I'm d...
2010/09/17
[ "https://Stackoverflow.com/questions/3738687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45531/" ]
Rule #1: Keep your domain model simple and straightforward. First, don't prematurely optimize something because you think it may be inefficient. Build your domain so that the objects and syntax flow correctly. Keep the interfaces clean: $user->addMessage($message) is clean, precise and unambiguous. Underneath the hoo...
IMO, an Entity should be oblivious of where it came from, who created it and how to populate its related Entities. In the ORM I use (my own) I am able to define joins between two tables and limiting its results by specifying (in C#) : ``` SearchCriteria sc = new SearchCriteria(); sc.AddSort("Message.CREATED_DATE","DES...
3,738,687
I'm working with Doctrine2 for the first time, but I think this question is generic enough to not be dependent on a specific ORM. **Should the entities in a Data Mapper pattern be aware - and *use* - the Mapper**? I have a few specific examples, but they all seem to boil down to the same general question. If I'm d...
2010/09/17
[ "https://Stackoverflow.com/questions/3738687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45531/" ]
Rule #1: Keep your domain model simple and straightforward. First, don't prematurely optimize something because you think it may be inefficient. Build your domain so that the objects and syntax flow correctly. Keep the interfaces clean: $user->addMessage($message) is clean, precise and unambiguous. Underneath the hoo...
No. Here's why: trust. You cannot trust data to act on the benefit of the system. You can only trust the system to act on data. This is a fundamental of programming logic. Let's say something nasty slipped into the data and it was intended for XSS. If a data chunk is performing actions or if it's evaluated, then the ...
60,580
For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?
2022/10/07
[ "https://space.stackexchange.com/questions/60580", "https://space.stackexchange.com", "https://space.stackexchange.com/users/49512/" ]
Ice is very important for future missions. Ice is frozen water so if you send some humans there, you can save a lot of weight by using the water already in the area. Water is H2O. This means that you can split the Hydrogen and oxygen and then converted it into rocket fuel. H would be the fuel and O the oxidiser. The ...
Water is the big one. Why? Because it's made up of Hydrogen and Oxygen, which in turn are the primary materials needed for ongoing spaceflight. Hydrogen/Oxygen can be liquefied and used as rocket fuel. We need oxygen to breathe, water to drink, and you can use both to grow more food. So as long as you have water a...
60,580
For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?
2022/10/07
[ "https://space.stackexchange.com/questions/60580", "https://space.stackexchange.com", "https://space.stackexchange.com/users/49512/" ]
Ice is very important for future missions. Ice is frozen water so if you send some humans there, you can save a lot of weight by using the water already in the area. Water is H2O. This means that you can split the Hydrogen and oxygen and then converted it into rocket fuel. H would be the fuel and O the oxidiser. The ...
Other answers have discussed water already, so I'll mention other ices. Life needs enormous quantities of carbon and nitrogen, respectively found in the ices methane and ammonia, plus nitrogen is itself an ice in some environments. In fact, ammonia is even more useful to life than elemental nitrogen, although certain ...
60,580
For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?
2022/10/07
[ "https://space.stackexchange.com/questions/60580", "https://space.stackexchange.com", "https://space.stackexchange.com/users/49512/" ]
It will cost a lot to send even a few liters of water to the Moon, hundreds of thousands of dollars per liter. Water is also probably the best source of breathable air. Humans on the Moon (or on Mars) will need to consume quite a bit of water per day, so any water obtained *in situ* on the Moon (or on Mars) will repres...
Water is the big one. Why? Because it's made up of Hydrogen and Oxygen, which in turn are the primary materials needed for ongoing spaceflight. Hydrogen/Oxygen can be liquefied and used as rocket fuel. We need oxygen to breathe, water to drink, and you can use both to grow more food. So as long as you have water a...
60,580
For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?
2022/10/07
[ "https://space.stackexchange.com/questions/60580", "https://space.stackexchange.com", "https://space.stackexchange.com/users/49512/" ]
It will cost a lot to send even a few liters of water to the Moon, hundreds of thousands of dollars per liter. Water is also probably the best source of breathable air. Humans on the Moon (or on Mars) will need to consume quite a bit of water per day, so any water obtained *in situ* on the Moon (or on Mars) will repres...
Other answers have discussed water already, so I'll mention other ices. Life needs enormous quantities of carbon and nitrogen, respectively found in the ices methane and ammonia, plus nitrogen is itself an ice in some environments. In fact, ammonia is even more useful to life than elemental nitrogen, although certain ...
60,580
For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?
2022/10/07
[ "https://space.stackexchange.com/questions/60580", "https://space.stackexchange.com", "https://space.stackexchange.com/users/49512/" ]
Water ice is more interesting than ammonia or carbon by a landslide, and *liquid* water would be that much more interesting still! Water (in liquid form) is critical for life on Earth. No form of life that we know of can live without water. Similarly, just about everywhere we find water on Earth we find life. That mak...
Water is the big one. Why? Because it's made up of Hydrogen and Oxygen, which in turn are the primary materials needed for ongoing spaceflight. Hydrogen/Oxygen can be liquefied and used as rocket fuel. We need oxygen to breathe, water to drink, and you can use both to grow more food. So as long as you have water a...
60,580
For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?
2022/10/07
[ "https://space.stackexchange.com/questions/60580", "https://space.stackexchange.com", "https://space.stackexchange.com/users/49512/" ]
Water is the big one. Why? Because it's made up of Hydrogen and Oxygen, which in turn are the primary materials needed for ongoing spaceflight. Hydrogen/Oxygen can be liquefied and used as rocket fuel. We need oxygen to breathe, water to drink, and you can use both to grow more food. So as long as you have water a...
Other answers have discussed water already, so I'll mention other ices. Life needs enormous quantities of carbon and nitrogen, respectively found in the ices methane and ammonia, plus nitrogen is itself an ice in some environments. In fact, ammonia is even more useful to life than elemental nitrogen, although certain ...
60,580
For example, several missions have been launched just to find ice at the lunar poles. Why do astronomers and space agencies care so much about there being ice somewhere?
2022/10/07
[ "https://space.stackexchange.com/questions/60580", "https://space.stackexchange.com", "https://space.stackexchange.com/users/49512/" ]
Water ice is more interesting than ammonia or carbon by a landslide, and *liquid* water would be that much more interesting still! Water (in liquid form) is critical for life on Earth. No form of life that we know of can live without water. Similarly, just about everywhere we find water on Earth we find life. That mak...
Other answers have discussed water already, so I'll mention other ices. Life needs enormous quantities of carbon and nitrogen, respectively found in the ices methane and ammonia, plus nitrogen is itself an ice in some environments. In fact, ammonia is even more useful to life than elemental nitrogen, although certain ...
64,989,285
I have created a social media app and now i am trying t customize my App by and i have added a Search, Chat icons and i would like the search icon to route to the `Search` page with exists in the App. I implemented `MaterialPageRoute` but it just returns a black screen (with a thin green border). No error or log is ma...
2020/11/24
[ "https://Stackoverflow.com/questions/64989285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14374402/" ]
That's because you don't have nothing in your `Search` widget (just a `Container` widget). Try returning a `Scaffold` instead with some `body` set. By default, black screen is "normal" for an *empty* view.
Solved it. The issue was with the `stateless` n `stateful` widget classes ``` class Search extends StatefulWidget { @override __SearchState createState() => __SearchState(); } class __SearchState extends State<Search> { Future<List> users; ``` The issues with the name `Search` which i think then conflicted w...
59,063,192
I want to set up a request once and then use it in multiple tests. This was the best way I could come up to do that, but it seems odd to have to have to declare `req` mutable just so it will be available in an outside scope. ```js describe('GET /password', () => { let req before(() => { req = chai.request(app)...
2019/11/27
[ "https://Stackoverflow.com/questions/59063192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1291990/" ]
You can simply use a function returning a promise: ``` describe('GET /password', () => { function getPassword () { return chai.request(app).get('/password') } it('should get the password page', () => { return getPassword() .then(res => res.should.have.status(200)) .catch(err =>...
In my previous experience, I usually stored the response in a variable then in each test, I accessed that variable. Seems that your case is only care about response so this solution below may fit. ```js describe('GET /password', () => { let response; // create a variable before(() => { return chai.request(ap...
23,421,657
Does anyone know a package/function that can do the following: Assume I have a data frame: ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ``` I want to transform it to: ``` 1 2 3 4 5 6 7 8 9 10 11 12 5 6 7 8 9 10 11 12 13 14 15 16 ``` Thanks
2014/05/02
[ "https://Stackoverflow.com/questions/23421657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1887434/" ]
There are some nice functions in the `base` package that can help you get this done. ``` > d <- read.table(header = FALSE, text = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16") > d ## V1 V2 V3 V4 ## 1 1 2 3 4 ## 2 5 6 7 8 ## 3 9 10 11 12 ## 4 13 14 15 16 > do.call(rbind, lapply(seq(nrow(d)-1, nro...
Not sure if this is exactly what you're looking for, but a possibly more simplistic method: ``` # Recreate the matrix data=t(matrix(1:16,ncol=4)) # [,1] [,2] [,3] [,4] # [1,] 1 2 3 4 # [2,] 5 6 7 8 # [3,] 9 10 11 12 # [4,] 13 14 15 16 # Transform the matri...
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
You can try below - ``` select * from tablename a where value = (select min(value) from tablename b where a.key=b.key) ```
You can use `row_number()` : ``` select t.* from (select t.*, row_number() over (partition by key order by value) as seq from table t ) t where seq = 1; ``` You can also use correlated `subquery` if ranking function not support : ``` select t.* from table t where t.value = (select min(t1.value) from tabl...
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
You can try below - ``` select * from tablename a where value = (select min(value) from tablename b where a.key=b.key) ```
The canonical way to handle this in MySQL 5.7 or earlier would be to join to a subquery which finds the smallest value for each key: ``` SELECT t1.`Key`, t1.`Value`, t1.Message FROM yourTable t1 INNER JOIN ( SELECT `Key`, MIN(`Value`) AS min_value FROM yourTable GROUP BY `Key` ) t2 ON t1.`Key` = t2.`Ke...
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
You can try below - ``` select * from tablename a where value = (select min(value) from tablename b where a.key=b.key) ```
First create a subquery that returns `min value` for each `key`, then join with the main table: ``` select t.* from tablename t inner join ( select key, min(value) min_value from tablename group by key ) i on i.key = t.key and i.min_value = t.value ```
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
You can try below - ``` select * from tablename a where value = (select min(value) from tablename b where a.key=b.key) ```
Use this Query ``` select * from table_name tab1 where value in ( select MIN(value) from table_name tab2 where tab2.[key] = tab1.[key] ) ```
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
You can use `row_number()` : ``` select t.* from (select t.*, row_number() over (partition by key order by value) as seq from table t ) t where seq = 1; ``` You can also use correlated `subquery` if ranking function not support : ``` select t.* from table t where t.value = (select min(t1.value) from tabl...
First create a subquery that returns `min value` for each `key`, then join with the main table: ``` select t.* from tablename t inner join ( select key, min(value) min_value from tablename group by key ) i on i.key = t.key and i.min_value = t.value ```
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
You can use `row_number()` : ``` select t.* from (select t.*, row_number() over (partition by key order by value) as seq from table t ) t where seq = 1; ``` You can also use correlated `subquery` if ranking function not support : ``` select t.* from table t where t.value = (select min(t1.value) from tabl...
Use this Query ``` select * from table_name tab1 where value in ( select MIN(value) from table_name tab2 where tab2.[key] = tab1.[key] ) ```
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
The canonical way to handle this in MySQL 5.7 or earlier would be to join to a subquery which finds the smallest value for each key: ``` SELECT t1.`Key`, t1.`Value`, t1.Message FROM yourTable t1 INNER JOIN ( SELECT `Key`, MIN(`Value`) AS min_value FROM yourTable GROUP BY `Key` ) t2 ON t1.`Key` = t2.`Ke...
First create a subquery that returns `min value` for each `key`, then join with the main table: ``` select t.* from tablename t inner join ( select key, min(value) min_value from tablename group by key ) i on i.key = t.key and i.min_value = t.value ```
59,748,968
I have a table like this: ``` | Key | Value | Message | |-----|-------|---------| | a | 1 | xx | | a | 2 | yy | | b | 5 | mm | | b | 4 | nn | ``` I would like to group the data by Key, get the minimum Value of each group, and the related Message. The result is expected to ...
2020/01/15
[ "https://Stackoverflow.com/questions/59748968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3986055/" ]
The canonical way to handle this in MySQL 5.7 or earlier would be to join to a subquery which finds the smallest value for each key: ``` SELECT t1.`Key`, t1.`Value`, t1.Message FROM yourTable t1 INNER JOIN ( SELECT `Key`, MIN(`Value`) AS min_value FROM yourTable GROUP BY `Key` ) t2 ON t1.`Key` = t2.`Ke...
Use this Query ``` select * from table_name tab1 where value in ( select MIN(value) from table_name tab2 where tab2.[key] = tab1.[key] ) ```
38,737,294
[![enter image description here](https://i.stack.imgur.com/RyhBh.png)](https://i.stack.imgur.com/RyhBh.png) Here i get mos popular hashtags (mos used hashtags) but problem is with comma my query show this: ``` Popular hashtags: #q7 (2) #q9 (2) #q7 , #q0 (1) #q0 (1) ``` I want this: ``` Popular hashtags: #q7 (3 t...
2016/08/03
[ "https://Stackoverflow.com/questions/38737294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6671105/" ]
Php solution: ``` $query_result = mysqli_query($Connection, "SELECT hashtag FROM tricks"); $popularHashtags = array(); while($row = mysqli_fetch_assoc($query_result)) { $hashtags = explode(',', $row['hashtag']); foreach($hashtags as $hashtag) { $hashtag = trim($hashtag); ...
If you know the number of hastags contained in the field, you can use the [SUBSTRING\_INDEX](http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_substring-index) function, or you can see this answer [MySQL split](https://stackoverflow.com/questions/2696884/split-value-from-one-field-to-two#answer-2696...
38,737,294
[![enter image description here](https://i.stack.imgur.com/RyhBh.png)](https://i.stack.imgur.com/RyhBh.png) Here i get mos popular hashtags (mos used hashtags) but problem is with comma my query show this: ``` Popular hashtags: #q7 (2) #q9 (2) #q7 , #q0 (1) #q0 (1) ``` I want this: ``` Popular hashtags: #q7 (3 t...
2016/08/03
[ "https://Stackoverflow.com/questions/38737294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6671105/" ]
Php solution: ``` $query_result = mysqli_query($Connection, "SELECT hashtag FROM tricks"); $popularHashtags = array(); while($row = mysqli_fetch_assoc($query_result)) { $hashtags = explode(',', $row['hashtag']); foreach($hashtags as $hashtag) { $hashtag = trim($hashtag); ...
Try this out ``` select count(*) as total, hashtag FROM ( SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(hashtag, ',', n.n), ',', -1) hashtag FROM table CROSS JOIN ( SELECT a.N + b.N * 10 + 1 n FROM (SELECT 0 AS N UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4 UNION ALL SELECT 5 U...
44,460,546
I have a simple PowerShell script that using windows.forms for presenting and getting data using GUI. It works when I run it using PowerShell , but doesn't work via CMD. Here is the .ps1 example : ``` [System.Windows.MessageBox]::Show('message','Step 1','YesNoCancel','Question') ``` batch file for executing : ``` p...
2017/06/09
[ "https://Stackoverflow.com/questions/44460546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3006397/" ]
I achieved it by reading this [blog](https://amundtveit.com) :) ``` let data = _currentScaledMotionArrays.reduce([], +) //result is of type [Double] with 480 elements guard let mlMultiArray = try? MLMultiArray(shape:[40,12], dataType:MLMultiArrayDataType.double) else { fatalError("Unexpected runtime error. MLMulti...
This is how I did it. Probably not the best way to handle optionals but gets the job done for testing Create an instance of the `MLMultiArray` object with shape and data type ``` let mlArray = try? MLMultiArray(shape: [3], dataType: MLMultiArrayDataType.float32) ``` `mlArray` does not have an append function so you...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
I think you mean double pointer as in "pointer to a pointer" which is very efficient for inserting at the end of a **singly linked list** or a **tree structure**. The idea is that you don't need a special case or a "trailing pointer" to follow your traversal pointer once you find the end (a NULL pointer). Since you can...
I think you mean [doubly-linked lists](http://en.wikipedia.org/wiki/Doubly-linked_list) where a node is something like: ``` struct Node { (..) data // The data being stored in the node, it can be of any data type Node *next; // A pointer to the next node; null for last node Node *prev; // A pointer to the previous nod...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
I think you mean [doubly-linked lists](http://en.wikipedia.org/wiki/Doubly-linked_list) where a node is something like: ``` struct Node { (..) data // The data being stored in the node, it can be of any data type Node *next; // A pointer to the next node; null for last node Node *prev; // A pointer to the previous nod...
You probably mean a doubly-linked list, with one of the pointers going forward and the other going backward. This allows you to get to the next and previous nodes for a given node without having to remember the last one or two nodes encountered (as in a singly-linked list). But the one thing I discovered which made th...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
By "double-pointer", I think you mean "pointer-to-pointer". This is useful because it allows you to eliminate special cases for either the head or tail pointers. For example, given this list: ``` struct node { struct node *next; int key; /* ... */ }; struct node *head; ``` If you want to search for a no...
I think you mean [doubly-linked lists](http://en.wikipedia.org/wiki/Doubly-linked_list) where a node is something like: ``` struct Node { (..) data // The data being stored in the node, it can be of any data type Node *next; // A pointer to the next node; null for last node Node *prev; // A pointer to the previous nod...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
I think you mean double pointer as in "pointer to a pointer" which is very efficient for inserting at the end of a **singly linked list** or a **tree structure**. The idea is that you don't need a special case or a "trailing pointer" to follow your traversal pointer once you find the end (a NULL pointer). Since you can...
You probably mean a doubly-linked list, with one of the pointers going forward and the other going backward. This allows you to get to the next and previous nodes for a given node without having to remember the last one or two nodes encountered (as in a singly-linked list). But the one thing I discovered which made th...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
I think you mean double pointer as in "pointer to a pointer" which is very efficient for inserting at the end of a **singly linked list** or a **tree structure**. The idea is that you don't need a special case or a "trailing pointer" to follow your traversal pointer once you find the end (a NULL pointer). Since you can...
By "double-pointer", I think you mean "pointer-to-pointer". This is useful because it allows you to eliminate special cases for either the head or tail pointers. For example, given this list: ``` struct node { struct node *next; int key; /* ... */ }; struct node *head; ``` If you want to search for a no...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
I think you mean double pointer as in "pointer to a pointer" which is very efficient for inserting at the end of a **singly linked list** or a **tree structure**. The idea is that you don't need a special case or a "trailing pointer" to follow your traversal pointer once you find the end (a NULL pointer). Since you can...
I agree with the comments about using the STL containers for handling your list dirty work. However, this being Stack Overflow, we're all here to learn something. Here's how you would normally insert into a list: ``` typedef struct _Node { void * data; Node * next; } Node; Node * insert( Node * root, void * ...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
By "double-pointer", I think you mean "pointer-to-pointer". This is useful because it allows you to eliminate special cases for either the head or tail pointers. For example, given this list: ``` struct node { struct node *next; int key; /* ... */ }; struct node *head; ``` If you want to search for a no...
You probably mean a doubly-linked list, with one of the pointers going forward and the other going backward. This allows you to get to the next and previous nodes for a given node without having to remember the last one or two nodes encountered (as in a singly-linked list). But the one thing I discovered which made th...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
I agree with the comments about using the STL containers for handling your list dirty work. However, this being Stack Overflow, we're all here to learn something. Here's how you would normally insert into a list: ``` typedef struct _Node { void * data; Node * next; } Node; Node * insert( Node * root, void * ...
You probably mean a doubly-linked list, with one of the pointers going forward and the other going backward. This allows you to get to the next and previous nodes for a given node without having to remember the last one or two nodes encountered (as in a singly-linked list). But the one thing I discovered which made th...
3,182,733
Ten years ago, I was shown a technique for traversing a linked list: instead of using a single pointer, you used a double pointer (pointer-to-pointer). The technique yielded smaller, more elegant code by eliminating the need to check for certain boundary/edge cases. Does anyone know what this technique actually is?
2010/07/05
[ "https://Stackoverflow.com/questions/3182733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
By "double-pointer", I think you mean "pointer-to-pointer". This is useful because it allows you to eliminate special cases for either the head or tail pointers. For example, given this list: ``` struct node { struct node *next; int key; /* ... */ }; struct node *head; ``` If you want to search for a no...
I agree with the comments about using the STL containers for handling your list dirty work. However, this being Stack Overflow, we're all here to learn something. Here's how you would normally insert into a list: ``` typedef struct _Node { void * data; Node * next; } Node; Node * insert( Node * root, void * ...
34,318,934
I'm currently using the Qt Installer Framework and managed to set up an online repository. What I want to know is: Does the Framework provide some kind of "auto-update" mechanism, e.g. a plugin/service that checks for updates every time the program/system starts? Check for updates would be enough, since the install...
2015/12/16
[ "https://Stackoverflow.com/questions/34318934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3767076/" ]
What I do, is run the maintenance tool using QProcess, and then check the output. It has a mode where it doesn't run the GUI but only outputs update information if available. Note that I set the working directory to the application's path when the applications starts, so I can just run maintenancetool. ``` QProcess p...
There's a section in the guide about how to do it, but they call it promoting updates rather than auto updates, [IFW Updates on doc.qt.io](http://doc.qt.io/qtinstallerframework/ifw-updates.html).
34,318,934
I'm currently using the Qt Installer Framework and managed to set up an online repository. What I want to know is: Does the Framework provide some kind of "auto-update" mechanism, e.g. a plugin/service that checks for updates every time the program/system starts? Check for updates would be enough, since the install...
2015/12/16
[ "https://Stackoverflow.com/questions/34318934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3767076/" ]
I just found a pretty nice implementation on GitHub: <https://github.com/ioriayane/TheArtOfQt2/blob/master/src/HelloWorld/maintenancetool.cpp> It takes care of handling Windows, MacOS and Linux. + It is written to use in QML / Qt Quick bindings (+ example). It has some Japanese comments, but is Apache 2.0 licensed, ...
There's a section in the guide about how to do it, but they call it promoting updates rather than auto updates, [IFW Updates on doc.qt.io](http://doc.qt.io/qtinstallerframework/ifw-updates.html).
34,318,934
I'm currently using the Qt Installer Framework and managed to set up an online repository. What I want to know is: Does the Framework provide some kind of "auto-update" mechanism, e.g. a plugin/service that checks for updates every time the program/system starts? Check for updates would be enough, since the install...
2015/12/16
[ "https://Stackoverflow.com/questions/34318934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3767076/" ]
In the latest Qt Installer Framework 4.1 `--checkupdates` returns nothing, use `ch` or `check-updates` instead. ``` Commands: in, install - install default or selected packages - <pkg ...> ch, check-updates - show available updates information on maintenance tool up, update - update all or selected packages - <p...
There's a section in the guide about how to do it, but they call it promoting updates rather than auto updates, [IFW Updates on doc.qt.io](http://doc.qt.io/qtinstallerframework/ifw-updates.html).
34,318,934
I'm currently using the Qt Installer Framework and managed to set up an online repository. What I want to know is: Does the Framework provide some kind of "auto-update" mechanism, e.g. a plugin/service that checks for updates every time the program/system starts? Check for updates would be enough, since the install...
2015/12/16
[ "https://Stackoverflow.com/questions/34318934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3767076/" ]
What I do, is run the maintenance tool using QProcess, and then check the output. It has a mode where it doesn't run the GUI but only outputs update information if available. Note that I set the working directory to the application's path when the applications starts, so I can just run maintenancetool. ``` QProcess p...
I just found a pretty nice implementation on GitHub: <https://github.com/ioriayane/TheArtOfQt2/blob/master/src/HelloWorld/maintenancetool.cpp> It takes care of handling Windows, MacOS and Linux. + It is written to use in QML / Qt Quick bindings (+ example). It has some Japanese comments, but is Apache 2.0 licensed, ...
34,318,934
I'm currently using the Qt Installer Framework and managed to set up an online repository. What I want to know is: Does the Framework provide some kind of "auto-update" mechanism, e.g. a plugin/service that checks for updates every time the program/system starts? Check for updates would be enough, since the install...
2015/12/16
[ "https://Stackoverflow.com/questions/34318934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3767076/" ]
What I do, is run the maintenance tool using QProcess, and then check the output. It has a mode where it doesn't run the GUI but only outputs update information if available. Note that I set the working directory to the application's path when the applications starts, so I can just run maintenancetool. ``` QProcess p...
In the latest Qt Installer Framework 4.1 `--checkupdates` returns nothing, use `ch` or `check-updates` instead. ``` Commands: in, install - install default or selected packages - <pkg ...> ch, check-updates - show available updates information on maintenance tool up, update - update all or selected packages - <p...
82,447
I have some kidney beans that I soaked overnight to cook the next day but didn't get a chance and accidentally left them out and it's been fairly hot lately. Some of the beans started to get little sprouts poking out. There's also a little bit of a smell. Is it still safe to cook the batch or have I wasted a bunch of b...
2017/06/17
[ "https://cooking.stackexchange.com/questions/82447", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/58619/" ]
This is totally safe to eat as long as you cook them. The taste and the texture would be a little bit different than what you use to though. Here is an [article](http://www.living-foods.com/articles/largebeans.html) about the safety of eating sprouted beans.
Personally, I would *not* cook & serve those beans. Beans have such an "acid-y" (not a word, I know) kind of taste anyways, which can & does show up in the final result despite the salt and spices you add... Then there's the gas issue from those little buggers! Suppose the chemical changes in the bean which resulted ...
82,447
I have some kidney beans that I soaked overnight to cook the next day but didn't get a chance and accidentally left them out and it's been fairly hot lately. Some of the beans started to get little sprouts poking out. There's also a little bit of a smell. Is it still safe to cook the batch or have I wasted a bunch of b...
2017/06/17
[ "https://cooking.stackexchange.com/questions/82447", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/58619/" ]
This is totally safe to eat as long as you cook them. The taste and the texture would be a little bit different than what you use to though. Here is an [article](http://www.living-foods.com/articles/largebeans.html) about the safety of eating sprouted beans.
Whether they're okay to eat depends on whether they've started to spoil. You said there's a bit of a smell. Sprouting beans shouldn't have a bad smell. If any feel at all slimy or mushy (not just softer like soaked beans are), I'd err on the side of caution and discard them. You posted your question on June 17 and it's...
82,447
I have some kidney beans that I soaked overnight to cook the next day but didn't get a chance and accidentally left them out and it's been fairly hot lately. Some of the beans started to get little sprouts poking out. There's also a little bit of a smell. Is it still safe to cook the batch or have I wasted a bunch of b...
2017/06/17
[ "https://cooking.stackexchange.com/questions/82447", "https://cooking.stackexchange.com", "https://cooking.stackexchange.com/users/58619/" ]
Whether they're okay to eat depends on whether they've started to spoil. You said there's a bit of a smell. Sprouting beans shouldn't have a bad smell. If any feel at all slimy or mushy (not just softer like soaked beans are), I'd err on the side of caution and discard them. You posted your question on June 17 and it's...
Personally, I would *not* cook & serve those beans. Beans have such an "acid-y" (not a word, I know) kind of taste anyways, which can & does show up in the final result despite the salt and spices you add... Then there's the gas issue from those little buggers! Suppose the chemical changes in the bean which resulted ...
63,193,488
How can i implement properly this HTTP Request with Axios and DeepL API ? ``` POST /v2/translate?auth_key=xxxxxxxxxxxxxxxxxxxxxxxxxxx> HTTP/1.0 Host: api.deepl.com User-Agent: MyApp Accept: */* Content-Length: 54 Content-Type: application/x-www-form-urlencoded auth_key=xxxxxxxxxxxxxxxxxxxxxxxxxxx&text=Hello, world&ta...
2020/07/31
[ "https://Stackoverflow.com/questions/63193488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11429164/" ]
My request with Axios: ``` getTranslation ({ commit }, params) { axios .get(`https://api.deepl.com/v2/translate?auth_key=xxxxxxxxxxxxxxxxxxxxxxxxxx&text=Hello,%20world&target_lang=DE`, {headers: { 'Cache-Control': 'no-cache', 'Access-Control-Allow-Origin': '*' }}) ....
Finally, it is a very bad idea to use an API key in front because the key is visible in the request, I passed everything in back and it works perfectly, like a charm
4,188,337
I have a unit test that uses the hamcrest library (1.2). It's important that it's 1.2 because I want to include a namespace context in the hasXPath matcher. This is a maven project and I have all my dependencies set up to work correctly. (I make sure that I only use junit-dep and not junit - a pain but I've confirmed t...
2010/11/15
[ "https://Stackoverflow.com/questions/4188337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/316745/" ]
I fixed this by configuring my build path and moving the hacrest 1.2 libraries to the top of the order. Of course, if I ever do a `mvn eclipse:eclipse` again, I have to go in and fix it again, so it's not a terribly nice solution, but it works for now.
Press Ctrl+Shift+T to bring up the type search box. type org.hamcrest.Matchers This will show you all the locations on the project classpath that contains this class. You should see more than one entry under 'Matching items:', and you will find that they are different versions of hamcrest.
60,188,984
I have a project with just one class library. I'm now trying to generate a migration in the class library. Herer is my `DbContext`: ``` public class DatabaseContext : DbContext, IDatabaseContext { public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options) { } public DbSet<Security...
2020/02/12
[ "https://Stackoverflow.com/questions/60188984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4444267/" ]
I think the best solution is to create a test project with Startup.cs. Where in configure services you register your `DbContext` and use this project for managing migrations. To specify where migrations should be added you can add this option to `DbContext` options: ```cs options.UseSqlServer( connectionString, ...
Are you running your command (dotnet ef migrations add InitialCreate --project SecurityAttribute) in the package manager console? If so do you have the default project set correctly in the package manager console drop down? Is the start up project for the solution set to be the one with the Startup.cs?
42,627
One of the settings I've been working on is a retro-futuristic world with a technology level and aesthetic of the early cold war era, something quite similar to the setting of the Alien franchise in terms of technology. One of the reasons that technology has changed so much since then is the rapid development of comp...
2016/05/31
[ "https://worldbuilding.stackexchange.com/questions/42627", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/10738/" ]
First, we must help the aliens a little, by figuring out how such chip suppression can be done, in order to have a way to find out the possible health effects. There does indeed exist a way to mess up the n-p junctions: [Silicon doping](https://en.wikipedia.org/wiki/Doping_%28semiconductor%29), the proses of creating e...
Does it have to be a suppression field or is any effort by aliens to screw up computer tech ok? Computer chips are difficult and expensive to make. Chip fabs cost billions to build. They're also easily contaminated. Quantities of copper vapor too low to quickly detect with the best instruments can be enough to destro...
27,844,397
I am new to swift. I am not able to get a callback to centralManagerDidUpdateState:: w/ following in playground (i.e.: i thought initialization would call back into centralManagerDidUpdateState): ``` import CoreBluetooth class BTDiscovery:NSObject, CBCentralManagerDelegate { func centralManagerDidUpdateState(cent...
2015/01/08
[ "https://Stackoverflow.com/questions/27844397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1255603/" ]
I think what you're running into is the playground is inherently synchronous while the BlueTooth discovery is asynchronous. To allow it to work you need to add some things to your playground to allow asynchronous operation: ``` import XCPlayground XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true) ...
Either `XCPSetExecutionShouldContinueIndefinitely` nor `PlaygroundPage.current.needsIndefiniteExecution` will work. Please keep in mind CoreBluetooth only works on device. Which means currently it won't work on the Playground.
27,844,397
I am new to swift. I am not able to get a callback to centralManagerDidUpdateState:: w/ following in playground (i.e.: i thought initialization would call back into centralManagerDidUpdateState): ``` import CoreBluetooth class BTDiscovery:NSObject, CBCentralManagerDelegate { func centralManagerDidUpdateState(cent...
2015/01/08
[ "https://Stackoverflow.com/questions/27844397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1255603/" ]
I think what you're running into is the playground is inherently synchronous while the BlueTooth discovery is asynchronous. To allow it to work you need to add some things to your playground to allow asynchronous operation: ``` import XCPlayground XCPSetExecutionShouldContinueIndefinitely(continueIndefinitely: true) ...
It's possible to use Bluetooth in Swift Playground. Please note you have to use `PlaygroundBluetooth`. You can find more informations about it here [Documentation Framework PlaygroundBluetooth](https://developer.apple.com/documentation/playgroundbluetooth) This is how you can scan using the central. ``` let managerD...
27,844,397
I am new to swift. I am not able to get a callback to centralManagerDidUpdateState:: w/ following in playground (i.e.: i thought initialization would call back into centralManagerDidUpdateState): ``` import CoreBluetooth class BTDiscovery:NSObject, CBCentralManagerDelegate { func centralManagerDidUpdateState(cent...
2015/01/08
[ "https://Stackoverflow.com/questions/27844397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1255603/" ]
You can only use Core Bluetooth on an actual iOS device; it is not supported in the simulator, and by extension, it is not supported in a Playground as this is also executing on your Mac rather than on an iOS device.
Either `XCPSetExecutionShouldContinueIndefinitely` nor `PlaygroundPage.current.needsIndefiniteExecution` will work. Please keep in mind CoreBluetooth only works on device. Which means currently it won't work on the Playground.
27,844,397
I am new to swift. I am not able to get a callback to centralManagerDidUpdateState:: w/ following in playground (i.e.: i thought initialization would call back into centralManagerDidUpdateState): ``` import CoreBluetooth class BTDiscovery:NSObject, CBCentralManagerDelegate { func centralManagerDidUpdateState(cent...
2015/01/08
[ "https://Stackoverflow.com/questions/27844397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1255603/" ]
You can only use Core Bluetooth on an actual iOS device; it is not supported in the simulator, and by extension, it is not supported in a Playground as this is also executing on your Mac rather than on an iOS device.
It's possible to use Bluetooth in Swift Playground. Please note you have to use `PlaygroundBluetooth`. You can find more informations about it here [Documentation Framework PlaygroundBluetooth](https://developer.apple.com/documentation/playgroundbluetooth) This is how you can scan using the central. ``` let managerD...
10,721,661
I am pretty new with MVC and Yii framework, therefore there is a good chance that my question is pretty stupid. If so, accept my appologies in advance. I want to have a form in my admin section of the website, where, user can post some content. I followed the tutorial for sample blog however it seems that the content ...
2012/05/23
[ "https://Stackoverflow.com/questions/10721661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353497/" ]
You have to make the attribute safe . Add this to your `Show` models validation rules ``` array('presentation','safe') ```
try this .. ``` public function actionCreate() { $model=new Show; if(isset($_POST['Show'])) { $model->attributes=$_POST['Show']; $save = $model->save(false); // write like this... if($save) { $this->redirect(array('view','id'=>$mod...
10,721,661
I am pretty new with MVC and Yii framework, therefore there is a good chance that my question is pretty stupid. If so, accept my appologies in advance. I want to have a form in my admin section of the website, where, user can post some content. I followed the tutorial for sample blog however it seems that the content ...
2012/05/23
[ "https://Stackoverflow.com/questions/10721661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353497/" ]
You have to make the attribute safe . Add this to your `Show` models validation rules ``` array('presentation','safe') ```
I found the problem for the form not submitting correctly, I add it here in case anybody has the same problem: I'd overwritten the beforeSave, but I wanted to complete it later so it wasn't returing anything: ``` protected function beforeSave() { if(parent::beforeSave()) { if($this->isNewR...
10,721,661
I am pretty new with MVC and Yii framework, therefore there is a good chance that my question is pretty stupid. If so, accept my appologies in advance. I want to have a form in my admin section of the website, where, user can post some content. I followed the tutorial for sample blog however it seems that the content ...
2012/05/23
[ "https://Stackoverflow.com/questions/10721661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1353497/" ]
I found the problem for the form not submitting correctly, I add it here in case anybody has the same problem: I'd overwritten the beforeSave, but I wanted to complete it later so it wasn't returing anything: ``` protected function beforeSave() { if(parent::beforeSave()) { if($this->isNewR...
try this .. ``` public function actionCreate() { $model=new Show; if(isset($_POST['Show'])) { $model->attributes=$_POST['Show']; $save = $model->save(false); // write like this... if($save) { $this->redirect(array('view','id'=>$mod...
104,636
Some studies have shown that serif versus sans-serif on a computer display is not what affects readability and the practical differences between the two font styles are largely inconclusive. I observed some designers prefer to use serif fonts only for titles or important elements and that make me ask: The font style o...
2017/02/07
[ "https://ux.stackexchange.com/questions/104636", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/72956/" ]
According to [this](https://blog.kissmetrics.com/how-typography-affects-conversions/) post by Kissmetrics: > > As far as research goes, there is no ironclad answer as to whether serif or sans serif is better. But, as far as general consensus goes, when it comes to reading online, sans serif typefaces are easier to re...
I think you're talking about an [article by Alex Poole](http://alexpoole.info/blog/which-are-more-legible-serif-or-sans-serif-typefaces/). Anyhow, it basically says the same as you: in the battle of serif vs. sans-serif, there is not a decisive winner when it comes to legibility. They both have their pros and cons. Bu...
104,636
Some studies have shown that serif versus sans-serif on a computer display is not what affects readability and the practical differences between the two font styles are largely inconclusive. I observed some designers prefer to use serif fonts only for titles or important elements and that make me ask: The font style o...
2017/02/07
[ "https://ux.stackexchange.com/questions/104636", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/72956/" ]
According to [this](https://blog.kissmetrics.com/how-typography-affects-conversions/) post by Kissmetrics: > > As far as research goes, there is no ironclad answer as to whether serif or sans serif is better. But, as far as general consensus goes, when it comes to reading online, sans serif typefaces are easier to re...
"Will serif or sans-serif fonts change the user decision/behavior on a call-to-action?" The short answer is no. The serif may affect readability, and there is something to be said about aesthetics, but at the time of this post (2017) there is no conclusive evidence that a serif font influences user decisions. The ru...
104,636
Some studies have shown that serif versus sans-serif on a computer display is not what affects readability and the practical differences between the two font styles are largely inconclusive. I observed some designers prefer to use serif fonts only for titles or important elements and that make me ask: The font style o...
2017/02/07
[ "https://ux.stackexchange.com/questions/104636", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/72956/" ]
According to [this](https://blog.kissmetrics.com/how-typography-affects-conversions/) post by Kissmetrics: > > As far as research goes, there is no ironclad answer as to whether serif or sans serif is better. But, as far as general consensus goes, when it comes to reading online, sans serif typefaces are easier to re...
I would avoid using serif for the call to actions unless you have a very good reason! Sans serif is easier to read, more modern. Serif is more likely to be used in a header, where it's larger text and ultimately more legible AND suits the design values of the brand (e.g. perhaps more traditional values)
104,636
Some studies have shown that serif versus sans-serif on a computer display is not what affects readability and the practical differences between the two font styles are largely inconclusive. I observed some designers prefer to use serif fonts only for titles or important elements and that make me ask: The font style o...
2017/02/07
[ "https://ux.stackexchange.com/questions/104636", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/72956/" ]
"Will serif or sans-serif fonts change the user decision/behavior on a call-to-action?" The short answer is no. The serif may affect readability, and there is something to be said about aesthetics, but at the time of this post (2017) there is no conclusive evidence that a serif font influences user decisions. The ru...
I think you're talking about an [article by Alex Poole](http://alexpoole.info/blog/which-are-more-legible-serif-or-sans-serif-typefaces/). Anyhow, it basically says the same as you: in the battle of serif vs. sans-serif, there is not a decisive winner when it comes to legibility. They both have their pros and cons. Bu...
104,636
Some studies have shown that serif versus sans-serif on a computer display is not what affects readability and the practical differences between the two font styles are largely inconclusive. I observed some designers prefer to use serif fonts only for titles or important elements and that make me ask: The font style o...
2017/02/07
[ "https://ux.stackexchange.com/questions/104636", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/72956/" ]
I think you're talking about an [article by Alex Poole](http://alexpoole.info/blog/which-are-more-legible-serif-or-sans-serif-typefaces/). Anyhow, it basically says the same as you: in the battle of serif vs. sans-serif, there is not a decisive winner when it comes to legibility. They both have their pros and cons. Bu...
I would avoid using serif for the call to actions unless you have a very good reason! Sans serif is easier to read, more modern. Serif is more likely to be used in a header, where it's larger text and ultimately more legible AND suits the design values of the brand (e.g. perhaps more traditional values)
104,636
Some studies have shown that serif versus sans-serif on a computer display is not what affects readability and the practical differences between the two font styles are largely inconclusive. I observed some designers prefer to use serif fonts only for titles or important elements and that make me ask: The font style o...
2017/02/07
[ "https://ux.stackexchange.com/questions/104636", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/72956/" ]
"Will serif or sans-serif fonts change the user decision/behavior on a call-to-action?" The short answer is no. The serif may affect readability, and there is something to be said about aesthetics, but at the time of this post (2017) there is no conclusive evidence that a serif font influences user decisions. The ru...
I would avoid using serif for the call to actions unless you have a very good reason! Sans serif is easier to read, more modern. Serif is more likely to be used in a header, where it's larger text and ultimately more legible AND suits the design values of the brand (e.g. perhaps more traditional values)
51,614,331
So, to make a div (navbar) stay on top of the page I need to have a fixed position. This I know and works fine. But on the current web design I am working on this navbar ends up behind all of the other elements. The difference between now and the previous times is that I am using javascript to modify the placement of t...
2018/07/31
[ "https://Stackoverflow.com/questions/51614331", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8960578/" ]
You are missing a semicolon after `let mns = 45` to conclude the statement. Without the semicolon to conclude the statement, it would be like trying to pass `(mns === 1)` as an argument to the `let` statement. It would be like the two lines were combined into one: `let mns = 45(mns === 1) ? (output = "true") : (output ...
That happens because `let` declaration is not concluded yet. To end the declaration use `;` or declare as `var` instead of let. ```js function fd(t) { let output = ''; if (t >= 41) { let mns = 45; // note the semicolan or declare it as var (mns === 1) ? (output = "true") : (output = "false"); } ...
51,822,826
I try to make a NuGet package from a .NET 4.7.2 class library (VS2017), but the resulting NuGet package surprisingly shows no dependencies (which is an error). My setup is like this: * My class library is .NET Framework 4.7.2 * My class library uses *another* NuGet package (that *has* dependencies). * My class librar...
2018/08/13
[ "https://Stackoverflow.com/questions/51822826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/963560/" ]
> > How can I force the system to again include the needed dependencies in my package? > > > This is a known issue about [nuget pack is ignoring dependencies when using PackageReference instead of packages.config](https://github.com/NuGet/Home/issues/5979). To resolve this issue, you can use the following workaro...
I got the same issue and use 2nd way leo Liu mention with [Pattrick'script](https://github.com/NuGet/Home/issues/5979#issuecomment-500761942) and some small modification to overcome this issue. Below are steps: 1. Copy or download powershell script below, name it **NuGetPackDependencies.ps1** and add it to your solu...
4,519
I have some 2D [data](http://www.woofiles.com/dl-302934-u05vLzEl-data.mat) that once plotted looks like the following ``` dat=Import["data.mat","Data"]; picList=ListPlot[,Axes-> None,Frame-> None,AspectRatio-> 1]; e=ColorConvert[Rasterize[picList],"Grayscale"]; Show[picList,Frame-> True] ``` ![enter image descriptio...
2012/04/20
[ "https://mathematica.stackexchange.com/questions/4519", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/240/" ]
You can use image processing like in the example below to find the enclosing circle. I use `FillingTransform` to fill in the binarized image, which gives something like the plot on the left. Then using `ComponentMeasurements`, I obtain the centroid and the radius of a disk that has the same area as the points in the or...
you should have a very careful look at `MorphologicalComponents`, which is part of a really powerful set of functions. You then use `ComponentMeasurements` to determine the "**Bounding disk properties**". Appropriate examples are provided by the Help system. Greetings Ernst
4,519
I have some 2D [data](http://www.woofiles.com/dl-302934-u05vLzEl-data.mat) that once plotted looks like the following ``` dat=Import["data.mat","Data"]; picList=ListPlot[,Axes-> None,Frame-> None,AspectRatio-> 1]; e=ColorConvert[Rasterize[picList],"Grayscale"]; Show[picList,Frame-> True] ``` ![enter image descriptio...
2012/04/20
[ "https://mathematica.stackexchange.com/questions/4519", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/240/" ]
You can use image processing like in the example below to find the enclosing circle. I use `FillingTransform` to fill in the binarized image, which gives something like the plot on the left. Then using `ComponentMeasurements`, I obtain the centroid and the radius of a disk that has the same area as the points in the or...
Here is an alternative approach which uses the `EllipsoidQuantile` function to select points, in this case within two standard deviations. It's not based on image processing, and it could be interesting to see how it compares for your application. In its favour it has a statistical consistency and does not depend on a ...
4,519
I have some 2D [data](http://www.woofiles.com/dl-302934-u05vLzEl-data.mat) that once plotted looks like the following ``` dat=Import["data.mat","Data"]; picList=ListPlot[,Axes-> None,Frame-> None,AspectRatio-> 1]; e=ColorConvert[Rasterize[picList],"Grayscale"]; Show[picList,Frame-> True] ``` ![enter image descriptio...
2012/04/20
[ "https://mathematica.stackexchange.com/questions/4519", "https://mathematica.stackexchange.com", "https://mathematica.stackexchange.com/users/240/" ]
Here is an alternative approach which uses the `EllipsoidQuantile` function to select points, in this case within two standard deviations. It's not based on image processing, and it could be interesting to see how it compares for your application. In its favour it has a statistical consistency and does not depend on a ...
you should have a very careful look at `MorphologicalComponents`, which is part of a really powerful set of functions. You then use `ComponentMeasurements` to determine the "**Bounding disk properties**". Appropriate examples are provided by the Help system. Greetings Ernst
54,875,010
trying to import: ``` from django.core import urlresolvers ``` I get: ``` ImportError: cannot import name 'urlresolvers' from 'django.core' ``` This is because UrlResolvers are deprecated and replaced with Django.Url. However I am looking for the actual UrlResolvers in order to find: ``` urlresolvers.get_res...
2019/02/25
[ "https://Stackoverflow.com/questions/54875010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1169059/" ]
See if the code below suits your needs. I made a simple demo with global variables to give you a feel for the solution. What I do in the demo is check whether the change to the value is the first change and whether it's done from the date view. If both are true, the time is set to 8:00. You can use a similar method t...
I am not sure about your requirement but you can set default date time according to your requirement. ``` $("#dtpXYZ).data('kendoDatePicker').value(kendo.toString(new Date($.now()), 'dd/MM/yyyy HH:mm')); ```
6,993,550
I have to write a new web application and currently am in the process of deciding on the architecture , there are several things i know i want to be able to do : 1. All machine must be symmetric , i.e. : commodity machines no custom build servers (aws) 2. I want a ReST API that is seperated from the UI as i allready h...
2011/08/09
[ "https://Stackoverflow.com/questions/6993550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/190032/" ]
I've had this work for me when I was getting odd characters in place of punctuation: ``` public String getContents(InputStream stream) { String contents = null; try{ contents = new String(IOUtilities.streamToBytes(stream), "UTF-8"); } catch(Exception e) { //encoding error } retu...
Instead of this: ``` raw.append(new String(data, 0, len)); ``` you can use ``` raw.append(new String(data, 0, len, "UTF-8")); ``` passing in the name of a character enconding, in this case UTF-8.
29,548,461
I'm working on the controller for my class, `Project`. It has a `belongs_to` relationship with `Client`. I'm not sure why this is happening, but when I create a new project through the form, it has a `name` assigned to it, but no `fee` and no `client_id`. Here's the relevant code: **Project controller** ``` class...
2015/04/09
[ "https://Stackoverflow.com/questions/29548461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4018787/" ]
You have to call `collection_select` on the form builder: ``` # change this <%= collection_select(:client_id, :name, current_user.clients, :id, :name) %> # to this <%= p.collection_select(:client_id, current_user.clients, :id, :name) %> ``` By using the FormBuilder `p` you are telling the `collection_select` that yo...
For fee to work, you need to fix your typo in your `project_params` For client\_id, try this instead: **inside views/projects/new** ``` <%= collection_select(:project, :client_id, current_user.clients, :id, :name) %> ``` OR ``` <%= p.collection_select(:client_id, current_user.clients, :id, :name) %> ``` when ...
3,381,747
> > d>0. If $AP(1,3)\cap AP(2,5)\cap AP(3,7)=AP(a,d)$, then the value of a+d is > > > Let the common term of the APs be m, n and r. For first and second AP $$1+(m-1)3=2+(n-1)5$$ $$m=\frac{5n-1}{3}$$ And for second and third AP $$2+(n-1)5=3+(r-1)7$$ $$r=\frac{5n+1}{7}$$ I found the relationships between them , but...
2019/10/05
[ "https://math.stackexchange.com/questions/3381747", "https://math.stackexchange.com", "https://math.stackexchange.com/users/690228/" ]
You showed that $m=\frac{5n-1}{3}$. But we also know that $m$ and $n$ are positive integers. The smallest possible solution to that is $m=3,\ n=2$. The third term of $AP(1,3)$ is $7$, as is the second term of $AP(2,5)$. The next solution is $m=8,\ n=5$, which corresponds to $22$. Carrying on like this, it shouldn't be ...
$$3m=5n-1\iff3(m+2)=5(n+1)$$ $\implies\dfrac{5(n+1)}3=m+2$ which is an integer $\implies3|5(n+1)\iff3|(n+1)$ We can write $n+1=3p\iff n=3p-1$ where $p$ is any integer $$3+7(r-1)=2+5(n-1)=2+5(3p-2)$$ $$\iff7r+4=15p-8\iff7r=15p-2(7\cdot3-15)$$ $$\iff\dfrac{15(p+2)}7=r+6$$ which is an integer $\implies7|15(p+2)\iff...
20,862,158
ok i have a lvlcheck.php that compares the players experience and outputs the correct lvl based on experience. yet i cany get it to work. nothing shows up when i echo $lvl. its like all the the statements in lvlcheck.php are failing. below is my code. this is my array to draw user stat experience ``` $sql = 'SELECT ...
2013/12/31
[ "https://Stackoverflow.com/questions/20862158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3078244/" ]
`< 83` means less than 83, so the highest valid value would be 82 `> 83` means greater than 83, so the lowest valid value would be 84 If you checking for 83, you won't get results. `<= 83` means less than or equal, so 83 would be included. For example...
I had to remove the quotation marks surrounding `$stat2` in `$stat3= $row['$stat2'];` Now, it reads `$stat3 = $row[$stat2];`.
34,776,647
I have been researching fgetcsv() and have the following working code: ``` $file = fopen($pathToCsv,"r"); $data = array(); while(! feof($file)) { array_push($data, fgetcsv($file)); } fclose($file); ``` However, when I try to adapt this to dynamically accept an unknown number of csv files stored into an a...
2016/01/13
[ "https://Stackoverflow.com/questions/34776647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2237994/" ]
I found the answer, in the Twitter app settings, the following option was ticked. So, I untucked it and it is now working ``` Enable Callback Locking (It is recommended to enable callback locking to ensure apps cannot overwrite the callback url) ```
you need to set Callback URL in <https://apps.twitter.com/app/xxxxxx/settings> for example, <https://auth.firebase.com/v2/xxxxxxx/auth/twitter/callback>
34,776,647
I have been researching fgetcsv() and have the following working code: ``` $file = fopen($pathToCsv,"r"); $data = array(); while(! feof($file)) { array_push($data, fgetcsv($file)); } fclose($file); ``` However, when I try to adapt this to dynamically accept an unknown number of csv files stored into an a...
2016/01/13
[ "https://Stackoverflow.com/questions/34776647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2237994/" ]
The twitter callback url for your app should be: <https://auth.firebase.com/v2/your-firebase-app-name/auth/twitter/callback>
you need to set Callback URL in <https://apps.twitter.com/app/xxxxxx/settings> for example, <https://auth.firebase.com/v2/xxxxxxx/auth/twitter/callback>
4,762,059
Goal: Validate input data in my e-formulary. Question: What syntax code (dataannotations) do I need to ensure that data is int or decimal?
2011/01/21
[ "https://Stackoverflow.com/questions/4762059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484390/" ]
The default model binder should handle validation automatically if you have specified your properties as int or decimal. You should get the following validation error if an incorrect value is entered: ``` public class MyObject { public int MyProperty { get; set; } } The value 'i am a string' is invalid for MyProp...
Maybe I'm not understanding the question. For data type validation, simply have the property on your model be of the desired type (int or decimal).
4,762,059
Goal: Validate input data in my e-formulary. Question: What syntax code (dataannotations) do I need to ensure that data is int or decimal?
2011/01/21
[ "https://Stackoverflow.com/questions/4762059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484390/" ]
If you are recieving your data from an input box, you can use a `TryParse` on your data. e.g. ``` decimal dec; if(decimal.TryParse(YourInput.Text, out dec)) { // Valid Decimal } else { // Invalid } ``` ...Same goes for an int, with `int.TryParse()`;
Maybe I'm not understanding the question. For data type validation, simply have the property on your model be of the desired type (int or decimal).
7,396,512
Came across this question previously on an interview. The requirements are to write a function that 1. Generates a number between 0..1 2. Never returns the same number 3. Can scale (called every few milliseconds and continuously for years) 4. Can use only 1mb of heap memory 5. Does not need to return as a decimal, can...
2011/09/13
[ "https://Stackoverflow.com/questions/7396512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Pseudo code that can do what you except *guarantee* no repeats. 1. Take your 1 MB allocation. 2. Randomly set every byte. 3. Echo to stdout as "`0.<bytes as integer string>`" (will be very long) 4. Go to #2 Your "Never returns the same number" is not guaranteed but it is extremely unlikely (1 in 2^8192) assuming a go...
Your method would eventually use more than 1mb of heap memory. Every way you represent numbers, if you are constrained by 1mb of heap then there is only a finite number of values. I would take the maximum ammount of memory possible, and increment the least significant bit by one on each call. That would ensure running ...
7,396,512
Came across this question previously on an interview. The requirements are to write a function that 1. Generates a number between 0..1 2. Never returns the same number 3. Can scale (called every few milliseconds and continuously for years) 4. Can use only 1mb of heap memory 5. Does not need to return as a decimal, can...
2011/09/13
[ "https://Stackoverflow.com/questions/7396512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Allocate about a million characters and set them initially to all `0`. Then each call to the function simply increments the number and returns it, something like: ``` # Gives you your 1MB heap space. num = new digit/byte/char/whatever[about a million] # Initialise all digits to zero (1-based arrays). def init(): ...
Your method would eventually use more than 1mb of heap memory. Every way you represent numbers, if you are constrained by 1mb of heap then there is only a finite number of values. I would take the maximum ammount of memory possible, and increment the least significant bit by one on each call. That would ensure running ...
7,396,512
Came across this question previously on an interview. The requirements are to write a function that 1. Generates a number between 0..1 2. Never returns the same number 3. Can scale (called every few milliseconds and continuously for years) 4. Can use only 1mb of heap memory 5. Does not need to return as a decimal, can...
2011/09/13
[ "https://Stackoverflow.com/questions/7396512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Pseudo code that can do what you except *guarantee* no repeats. 1. Take your 1 MB allocation. 2. Randomly set every byte. 3. Echo to stdout as "`0.<bytes as integer string>`" (will be very long) 4. Go to #2 Your "Never returns the same number" is not guaranteed but it is extremely unlikely (1 in 2^8192) assuming a go...
Yes, because there is no random requirement, you have a lot of flexibility. The idea here I think is *very close* to that of enumerating all strings over the regular expression `[0-9]*` with a couple modifications: * the real string starts with the sequence `0.` * you cannot *end* with a 0 So how would you enumerat...
7,396,512
Came across this question previously on an interview. The requirements are to write a function that 1. Generates a number between 0..1 2. Never returns the same number 3. Can scale (called every few milliseconds and continuously for years) 4. Can use only 1mb of heap memory 5. Does not need to return as a decimal, can...
2011/09/13
[ "https://Stackoverflow.com/questions/7396512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Allocate about a million characters and set them initially to all `0`. Then each call to the function simply increments the number and returns it, something like: ``` # Gives you your 1MB heap space. num = new digit/byte/char/whatever[about a million] # Initialise all digits to zero (1-based arrays). def init(): ...
Yes, because there is no random requirement, you have a lot of flexibility. The idea here I think is *very close* to that of enumerating all strings over the regular expression `[0-9]*` with a couple modifications: * the real string starts with the sequence `0.` * you cannot *end* with a 0 So how would you enumerat...
7,396,512
Came across this question previously on an interview. The requirements are to write a function that 1. Generates a number between 0..1 2. Never returns the same number 3. Can scale (called every few milliseconds and continuously for years) 4. Can use only 1mb of heap memory 5. Does not need to return as a decimal, can...
2011/09/13
[ "https://Stackoverflow.com/questions/7396512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Pseudo code that can do what you except *guarantee* no repeats. 1. Take your 1 MB allocation. 2. Randomly set every byte. 3. Echo to stdout as "`0.<bytes as integer string>`" (will be very long) 4. Go to #2 Your "Never returns the same number" is not guaranteed but it is extremely unlikely (1 in 2^8192) assuming a go...
If you are programming in C, the `nextafter()` family of functions are Posix-compatible functions useful for producing the next double after or before any given value. This will give you about 2^64 different values to output, if you output both positive and negative values. If you are required to print out the values...
7,396,512
Came across this question previously on an interview. The requirements are to write a function that 1. Generates a number between 0..1 2. Never returns the same number 3. Can scale (called every few milliseconds and continuously for years) 4. Can use only 1mb of heap memory 5. Does not need to return as a decimal, can...
2011/09/13
[ "https://Stackoverflow.com/questions/7396512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Allocate about a million characters and set them initially to all `0`. Then each call to the function simply increments the number and returns it, something like: ``` # Gives you your 1MB heap space. num = new digit/byte/char/whatever[about a million] # Initialise all digits to zero (1-based arrays). def init(): ...
If you are programming in C, the `nextafter()` family of functions are Posix-compatible functions useful for producing the next double after or before any given value. This will give you about 2^64 different values to output, if you output both positive and negative values. If you are required to print out the values...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
As the accepted answer says, you must look into the way you are using and caching context. Somehow you are leaking context that is causing Null Pointer Exception. --- > > Below Answer is as per the first revision of the question. > > > Use `onAttach()` to get Context. *Most of the cases, you don't need this solu...
So `getContext()` is not called in `onCreateView()`. It's called inside the `onResponse()` callback which can be invoked anytime. If it's invoked when your fragment is not attached to activity, `getContext()` will return null. The ideal solution here is to Cancel the request when the activity/fragment is not active (l...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
As the accepted answer says, you must look into the way you are using and caching context. Somehow you are leaking context that is causing Null Pointer Exception. --- > > Below Answer is as per the first revision of the question. > > > Use `onAttach()` to get Context. *Most of the cases, you don't need this solu...
When you are sure fragment is attached to its host(onResume, onViewCreated, etc) use this instead of **getContext()** : ``` requireContext() ``` It will not be inspected by lint, but it will throw an Exception if context detached! Then you should check nullity by **if clouse** (or some thing) or be sure that if the...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
As the accepted answer says, you must look into the way you are using and caching context. Somehow you are leaking context that is causing Null Pointer Exception. --- > > Below Answer is as per the first revision of the question. > > > Use `onAttach()` to get Context. *Most of the cases, you don't need this solu...
Write a common method that will ensure you will never get null `Context`. ``` public class BaseFragment extends Fragment { private Context contextNullSafe; @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState);...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
First of all, as you can see on this [link](https://developer.android.com/guide/components/fragments.html?hl=en-419), the method onCreateView() inside the fragment's lifecycle comes after onAttach(), so you should have already a context at that point. You may wonder, why does getContext() return null then? the problem ...
So `getContext()` is not called in `onCreateView()`. It's called inside the `onResponse()` callback which can be invoked anytime. If it's invoked when your fragment is not attached to activity, `getContext()` will return null. The ideal solution here is to Cancel the request when the activity/fragment is not active (l...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
First of all, as you can see on this [link](https://developer.android.com/guide/components/fragments.html?hl=en-419), the method onCreateView() inside the fragment's lifecycle comes after onAttach(), so you should have already a context at that point. You may wonder, why does getContext() return null then? the problem ...
When you are sure fragment is attached to its host(onResume, onViewCreated, etc) use this instead of **getContext()** : ``` requireContext() ``` It will not be inspected by lint, but it will throw an Exception if context detached! Then you should check nullity by **if clouse** (or some thing) or be sure that if the...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
First of all, as you can see on this [link](https://developer.android.com/guide/components/fragments.html?hl=en-419), the method onCreateView() inside the fragment's lifecycle comes after onAttach(), so you should have already a context at that point. You may wonder, why does getContext() return null then? the problem ...
Write a common method that will ensure you will never get null `Context`. ``` public class BaseFragment extends Fragment { private Context contextNullSafe; @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState);...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
So `getContext()` is not called in `onCreateView()`. It's called inside the `onResponse()` callback which can be invoked anytime. If it's invoked when your fragment is not attached to activity, `getContext()` will return null. The ideal solution here is to Cancel the request when the activity/fragment is not active (l...
Write a common method that will ensure you will never get null `Context`. ``` public class BaseFragment extends Fragment { private Context contextNullSafe; @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState);...
47,987,649
Why `getContext()` sometimes returns `null`? I pass context to `LastNewsRVAdapter.java` as an argument. But `LayoutInflater.from(context)` sometimes crashes. I'm getting a few crash reports on play console. Below is crash report. ``` java.lang.NullPointerException com.example.adapters.LastNewsRVAdapter.<init> java.la...
2017/12/27
[ "https://Stackoverflow.com/questions/47987649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8942811/" ]
When you are sure fragment is attached to its host(onResume, onViewCreated, etc) use this instead of **getContext()** : ``` requireContext() ``` It will not be inspected by lint, but it will throw an Exception if context detached! Then you should check nullity by **if clouse** (or some thing) or be sure that if the...
Write a common method that will ensure you will never get null `Context`. ``` public class BaseFragment extends Fragment { private Context contextNullSafe; @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState);...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
Is your app for iPhone or Android? I've seen this posted in a few spots as a possible CSS fix for the flickering: ``` #YourApp { -webkit-backface-visibility: hidden; overflow: hidden; } ```
In the of your document, place this code: ``` <script src="disableTransition.js"></script> ``` To disable Flickering transitions, inside of the disableTransition.js file, place this code ``` $(document).bind("mobileinit", function(){ $.extend( $.mobile , { defaultPageTransition: 'none' }); $.mobile.defaultPag...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
There are news (2012-01-10) about the flickering on Android, see <http://jquerymobile.com/blog/2012/01/10/upcoming-releases-1-0-1-1-1-and-beyond/> Quote: *exclude poorly performing platforms like Android 2.x from the more complex slide, pop and and flip transitions so these will fall back to the default fade for all t...
When using CSS solution ``` .ui-page { -webkit-backface-visibility: hidden; } ``` you may encounter other issues, so it's not a good idea. Actually, jQuery mobile v1.1.0 has issues with transitions. Look at [this](https://github.com/jquery/jquery-mobile/issues/4024) and [this](https://github.com/jquery/jquery-m...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
I tried the other suggestions but none of them worked for me. I ended up fixing it by changing the viewport meta tag as follows: ``` <meta name="viewport" content="width=device-width, user-scalable=no" /> ``` Thanks to <http://www.fishycode.com/post/40863390300/fixing-jquery-mobiles-none-transition-flicker-in>
This is a known issue that the team refers to as "blinking". They've said publicly that they will be tackling this soon and have already assigned someone to it. Here's a recent blog post that mentions it: <http://jquerymobile.com/blog/2011/05/06/jquery-mobile-team-update-week-of-may-2/>
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
I tried the other suggestions but none of them worked for me. I ended up fixing it by changing the viewport meta tag as follows: ``` <meta name="viewport" content="width=device-width, user-scalable=no" /> ``` Thanks to <http://www.fishycode.com/post/40863390300/fixing-jquery-mobiles-none-transition-flicker-in>
Check this link , i had same issue so i documented it. Link content: > > I am developing a phoneGap android project which is using JQM. My > Project contains Fixed External header and External Panel. > > > While navigating from one page to another, I see a white blink ( Entire > Page) for a brief moment which is o...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
Is your app for iPhone or Android? I've seen this posted in a few spots as a possible CSS fix for the flickering: ``` #YourApp { -webkit-backface-visibility: hidden; overflow: hidden; } ```
This is a known issue that the team refers to as "blinking". They've said publicly that they will be tackling this soon and have already assigned someone to it. Here's a recent blog post that mentions it: <http://jquerymobile.com/blog/2011/05/06/jquery-mobile-team-update-week-of-may-2/>
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
Is your app for iPhone or Android? I've seen this posted in a few spots as a possible CSS fix for the flickering: ``` #YourApp { -webkit-backface-visibility: hidden; overflow: hidden; } ```
I had the same problem and it was caused by duplicate ids across different pages in my HTML. Even though the duplicate ids were in different html pages, JQuery Mobile compiles all your HTML files into one single HTML document, so that it can perform the page transitions. This was resulting in invalid HTML and causi...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
I got rid of the flicker on iOS! With static header and footer. I have my css as below and no data-position="fixed" on the header and footer. ``` .ui-mobile, .ui-mobile .ui-page, .ui-mobile [data-role="page"], .ui-mobile [data-role="dialog"], .ui-page, .ui-mobile .ui-page-active { overflow: hidden; -webki...
I had the same problem and it was caused by duplicate ids across different pages in my HTML. Even though the duplicate ids were in different html pages, JQuery Mobile compiles all your HTML files into one single HTML document, so that it can perform the page transitions. This was resulting in invalid HTML and causi...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
I tried the other suggestions but none of them worked for me. I ended up fixing it by changing the viewport meta tag as follows: ``` <meta name="viewport" content="width=device-width, user-scalable=no" /> ``` Thanks to <http://www.fishycode.com/post/40863390300/fixing-jquery-mobiles-none-transition-flicker-in>
I had the same problem, but even worse, when wrapping a Jquery mobile app in Phonegap. Not only were the page transitions flickering, but the UI was completely broken. I have tried most of the solutions suggested here, but nothing worked. Then I found [this](http://outof.me/fixing-flickers-jumps-of-jquery-mobile-transi...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
``` .ui-page { -webkit-backface-visibility: hidden; } ``` This worked for me on phonegap / jquery mobile / Android phone.
In the of your document, place this code: ``` <script src="disableTransition.js"></script> ``` To disable Flickering transitions, inside of the disableTransition.js file, place this code ``` $(document).bind("mobileinit", function(){ $.extend( $.mobile , { defaultPageTransition: 'none' }); $.mobile.defaultPag...
5,953,753
My phonegap/jquery mobile application flickers most of the time when I navigate between the pages. Is this normal or is there a solution for this?
2011/05/10
[ "https://Stackoverflow.com/questions/5953753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727282/" ]
``` .ui-page { -webkit-backface-visibility: hidden; } ``` This worked for me on phonegap / jquery mobile / Android phone.
I tried the other suggestions but none of them worked for me. I ended up fixing it by changing the viewport meta tag as follows: ``` <meta name="viewport" content="width=device-width, user-scalable=no" /> ``` Thanks to <http://www.fishycode.com/post/40863390300/fixing-jquery-mobiles-none-transition-flicker-in>
17,500,102
Is there a way in PHP to assign or display a variable if the page URL is equal to a specific value? I have a site with 100 pages. Each page has a list of variables that are echoed through it based on `$page` variable. I would like to have this variable assigned on the fly. I want to be able to set a variable, 1-100 fo...
2013/07/06
[ "https://Stackoverflow.com/questions/17500102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2526699/" ]
Use the following: ``` $page = basename($_SERVER['SCRIPT_FILENAME']); ```
Take advantage of HTTP's pathinfo. ### $DOCUMENT\_ROOT/page/index.php: ``` <? $page = substr($_SERVER['PATH_INFO'], 1); ... ```
17,500,102
Is there a way in PHP to assign or display a variable if the page URL is equal to a specific value? I have a site with 100 pages. Each page has a list of variables that are echoed through it based on `$page` variable. I would like to have this variable assigned on the fly. I want to be able to set a variable, 1-100 fo...
2013/07/06
[ "https://Stackoverflow.com/questions/17500102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2526699/" ]
You can combine `basename($_SERVER['SCRIPT_FILENAME'])` like this: ``` <?php include '../includes/core/overall/header.php'; include '../includes/core/overall/footer.php'; $var = basename($_SERVER['SCRIPT_FILENAME']); //get page with .php $var = preg_replace('/\.php$/', '', $var); //remove .php from end if($var...
Take advantage of HTTP's pathinfo. ### $DOCUMENT\_ROOT/page/index.php: ``` <? $page = substr($_SERVER['PATH_INFO'], 1); ... ```