qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
68,824
I have a Sharepoint 2010 installation and I have troubles getting this works: I have a list with some columns: * Place * Assigned to * Date and time * Comments I want Sharepoint sends an email when a new list item is created. The email must be send to "Assigned to" person, who can be any on the Active Directory. Aft...
2013/05/22
[ "https://sharepoint.stackexchange.com/questions/68824", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/-1/" ]
Maybe I'm thinking too much like a dev and not enough like someone looking for the simplest solution available, but it seems to me that you want to create an event receiver that operates on the list when the ItemAdded trigger is pulled. Here is a guide on how to set up an event receiver for a specific list instance: <...
Sharepoint designer workflow is simplest solution. It will not create any task. On creation of a list item, mail will be triggered to assigned to person and workflow ends. You have to use only "Send an Email" action for this. You can use event handler or receiver too for that , but it will be itemAdded() event. I will ...
68,824
I have a Sharepoint 2010 installation and I have troubles getting this works: I have a list with some columns: * Place * Assigned to * Date and time * Comments I want Sharepoint sends an email when a new list item is created. The email must be send to "Assigned to" person, who can be any on the Active Directory. Aft...
2013/05/22
[ "https://sharepoint.stackexchange.com/questions/68824", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/-1/" ]
Thanks JohnWCraven, that sound great! I have followed your link, creating a breakpoint in the *base.ItemAdding()* line, and the breakpoint is hit when I add a new element to the list. However when I add a few more lines of code, either above or below of *base.ItemAdding()*, **no** breakpoint hit, my code isn't execu...
Creating via workflow and event receiver are both the possible options . Creating a workflow with Sharepoint Designer might be the quickest and easiest way as it can provide u with email UI template to fill in easily. If u need a little more customization apart from just sending the mail then you can go for event re...
68,824
I have a Sharepoint 2010 installation and I have troubles getting this works: I have a list with some columns: * Place * Assigned to * Date and time * Comments I want Sharepoint sends an email when a new list item is created. The email must be send to "Assigned to" person, who can be any on the Active Directory. Aft...
2013/05/22
[ "https://sharepoint.stackexchange.com/questions/68824", "https://sharepoint.stackexchange.com", "https://sharepoint.stackexchange.com/users/-1/" ]
Sharepoint designer workflow is simplest solution. It will not create any task. On creation of a list item, mail will be triggered to assigned to person and workflow ends. You have to use only "Send an Email" action for this. You can use event handler or receiver too for that , but it will be itemAdded() event. I will ...
Creating via workflow and event receiver are both the possible options . Creating a workflow with Sharepoint Designer might be the quickest and easiest way as it can provide u with email UI template to fill in easily. If u need a little more customization apart from just sending the mail then you can go for event re...
9,638,262
``` class ConnectionFactory { private static $factory; public static function getFactory() { if (!self::$factory) self::$factory = new ConnectionFactory(...); return self::$factory; } private $db; public function getConnection() { if (!$db) $db =...
2012/03/09
[ "https://Stackoverflow.com/questions/9638262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/406659/" ]
1. you are right here. 2. ! is a NOT. Which means here that if $db is false then initialise it. Since its in a static method it will stay initialised and next time the existiong $db will be returned since this second time !$db == false. 3. like for $db it is checking if an instance of $factory exists, if not create one...
For 1. yes, a static property of a class is always accessible using ClassName::$staticvarname For 2. there is surely a bug here. it should be if(!$this->db) and all code in getConnection should use $this->db instead of $db. the getFactory() is here an "alias" of the more standard getInstance() of Singleton pattern. I...
9,638,262
``` class ConnectionFactory { private static $factory; public static function getFactory() { if (!self::$factory) self::$factory = new ConnectionFactory(...); return self::$factory; } private $db; public function getConnection() { if (!$db) $db =...
2012/03/09
[ "https://Stackoverflow.com/questions/9638262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/406659/" ]
1. you are right here. 2. ! is a NOT. Which means here that if $db is false then initialise it. Since its in a static method it will stay initialised and next time the existiong $db will be returned since this second time !$db == false. 3. like for $db it is checking if an instance of $factory exists, if not create one...
1. Correct 2. ! is the NOT operator. Basically if (!$db) means if $db is null then execute the if block 3. Get factory is a function which is returning the (single) instance of ConnectionFactory, this instance has a function getConnection() 4. In the singleton pattern only a single instance of class should exist, which...
9,638,262
``` class ConnectionFactory { private static $factory; public static function getFactory() { if (!self::$factory) self::$factory = new ConnectionFactory(...); return self::$factory; } private $db; public function getConnection() { if (!$db) $db =...
2012/03/09
[ "https://Stackoverflow.com/questions/9638262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/406659/" ]
1. you are right here. 2. ! is a NOT. Which means here that if $db is false then initialise it. Since its in a static method it will stay initialised and next time the existiong $db will be returned since this second time !$db == false. 3. like for $db it is checking if an instance of $factory exists, if not create one...
1. Yes, static denotes that it will be the same value for every object that requests it, so no instantiation is needed 2. ! means `NOT`. It is most often seen as !=, denoting `NOT EQUAL`. In this case, it is being checked to find if the db object has been created, so it means db is `NOT NULL`. 3 & 4. The method that y...
25,438,889
When I use: ``` session_name( 'fObj' ); session_start(); $_SESSION['foo'] = 'bar'; ``` Subsequently loading the page and running: ``` session_start(); print_r( $_SESSION ); ``` doe not return the session data. If I remove the session\_name(); it works fine. Does anyone know how to use sessions with a different ...
2014/08/22
[ "https://Stackoverflow.com/questions/25438889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1402304/" ]
In light of nwolybug's post I think this must be due to some environmental settings. I can get this to work via doing the following: ``` if( $_COOKIE['fObj'] ) { session_id( $_COOKIE['fObj'] ); session_start(); } var_dump( $_SESSION ); ```
I am able to get it working fine and returning SESSION data with the following code: ``` session_name( 'fObj' ); $_SESSION['foo'] = 'bar'; session_start(); print_r( $_SESSION ); ``` If I run it with the second session\_start(); It comes back with an error telling me a session is already started. If you are in dev, ...
25,438,889
When I use: ``` session_name( 'fObj' ); session_start(); $_SESSION['foo'] = 'bar'; ``` Subsequently loading the page and running: ``` session_start(); print_r( $_SESSION ); ``` doe not return the session data. If I remove the session\_name(); it works fine. Does anyone know how to use sessions with a different ...
2014/08/22
[ "https://Stackoverflow.com/questions/25438889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1402304/" ]
John Robertson is correct, the statement he mentioned comes straight from the PHP manual (<http://php.net/manual/en/function.session-name.php>). Your session name by default comes from the php.ini variable 'session.name', and this is generally set to 'PHPSESSID'. At each startup request time (as already mentioned) th...
I am able to get it working fine and returning SESSION data with the following code: ``` session_name( 'fObj' ); $_SESSION['foo'] = 'bar'; session_start(); print_r( $_SESSION ); ``` If I run it with the second session\_start(); It comes back with an error telling me a session is already started. If you are in dev, ...
25,438,889
When I use: ``` session_name( 'fObj' ); session_start(); $_SESSION['foo'] = 'bar'; ``` Subsequently loading the page and running: ``` session_start(); print_r( $_SESSION ); ``` doe not return the session data. If I remove the session\_name(); it works fine. Does anyone know how to use sessions with a different ...
2014/08/22
[ "https://Stackoverflow.com/questions/25438889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1402304/" ]
In light of nwolybug's post I think this must be due to some environmental settings. I can get this to work via doing the following: ``` if( $_COOKIE['fObj'] ) { session_id( $_COOKIE['fObj'] ); session_start(); } var_dump( $_SESSION ); ```
John Robertson is correct, the statement he mentioned comes straight from the PHP manual (<http://php.net/manual/en/function.session-name.php>). Your session name by default comes from the php.ini variable 'session.name', and this is generally set to 'PHPSESSID'. At each startup request time (as already mentioned) th...
35,140,312
I have a html document that consists of several text nodes, usually wrapped in p-tags, but some are not. Like this: ``` <div id="container"> <p>"Some text"</p> <p>"Some text"</p> "Some text" "Some text" "Some text" <p>"Some text"</p> "Some text" "Some text" "Some text" </div> ``` I found a way to wrap all ...
2016/02/01
[ "https://Stackoverflow.com/questions/35140312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2903113/" ]
There are too many mistake in your code so I prefer to give you a full example with explanations. Here is what we need : 1. A custom tag to build the HTML structure of this multiple codeblock 2. A CSS file to stylize the code block and code coloration 3. A JS script to animate the codeblock (tabs) Custom tag : `m_c...
You can also create inner tags that are read by the parent one. ``` {% code_with_tabs %} {% code js title="something" class_name="info" %} 1. aosjaojsdoajsdoajsd {% endcode %} {% code js title="something" class_name="info" %} 2. aosjaojsdoajsdoajsd {% endcode %} {% endcode_with_tabs %} ``` And use a ...
62,557,057
Apologies in advance if this has already been asked elsewhere, but I've tried different attempts and nothing has worked so far. In my data frame `Mesure` I would like to split the values of the column `Row.names` into two new columns named `Sample_type` and `Locality`. I try to use a `tidyverse` solution but R returns...
2020/06/24
[ "https://Stackoverflow.com/questions/62557057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13547231/" ]
To separate that with the first "dot" you can use: ``` Mesure %>% separate(Row.names, sep = "\\.", into = c("Sample_type", "Locality"), extra = "merge") ``` Explanation: * You don't need to convert `rownames_to_column()`, because "Row.names" is already a column. * `sep = "."` is not enough as the `.` is taken a...
Apologies. I should read your question properly. The second part of your answer would be: ``` d %>% separate(Row.names, into=c("Sample_type","Locality"), extra="drop") # A tibble: 6 x 6 Sample_type Locality mean_Mesure max_Mesure min_Mesure <chr> <chr> <dbl> <dbl> <dbl> 1 Aquatic moss ...
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
Khovanov homology can be thought of as a braided monoidal 2-category with duals, i.e. a 4-category with duals where the 0- and 1-morphisms are trivial. 0-morphisms: an unmarked point 1-morphisms: an unmarked interval 2-morphisms: a disk with some points in it 3-morphisms: a tangle in a 3-ball 4-morphisms: Given ta...
Just a fun think to check out if you don't know, Crane and Yetter used a braided monoidal 2 category with duals to build their state-sum model for quantum gravity. I am not at a place now to explain how or why this is relevant, but I just wanted to make you aware. Consult their papers on Arxiv for the details.
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
Khovanov homology can be thought of as a braided monoidal 2-category with duals, i.e. a 4-category with duals where the 0- and 1-morphisms are trivial. 0-morphisms: an unmarked point 1-morphisms: an unmarked interval 2-morphisms: a disk with some points in it 3-morphisms: a tangle in a 3-ball 4-morphisms: Given ta...
Looking at $(\infty,2)$ rather than $2$-categories, Luries paper on the cobordism hypothesis [link text](http://arxiv.org/abs/0905.0465) provides hints on how to find examples of categories with duals. Lurie sketches in Section 4.1 how to obtain examples for TQFTs using $E\_n$-algebra objects in *good* symmetric monoid...
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
Khovanov homology can be thought of as a braided monoidal 2-category with duals, i.e. a 4-category with duals where the 0- and 1-morphisms are trivial. 0-morphisms: an unmarked point 1-morphisms: an unmarked interval 2-morphisms: a disk with some points in it 3-morphisms: a tangle in a 3-ball 4-morphisms: Given ta...
One simple way of producing symmetric monoidal $(\infty,n)$-categories with all duals is to form $n$-fold spans/correspondences, hence an [(∞,n)-category of spans](http://ncatlab.org/nlab/show/%28infinity,n%29-category%20of%20spans) $Span\_n(\mathbf{H})$ in some ambient $\infty$-topos $\mathbf{H}$. This is discussed a...
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
One simple way of producing symmetric monoidal $(\infty,n)$-categories with all duals is to form $n$-fold spans/correspondences, hence an [(∞,n)-category of spans](http://ncatlab.org/nlab/show/%28infinity,n%29-category%20of%20spans) $Span\_n(\mathbf{H})$ in some ambient $\infty$-topos $\mathbf{H}$. This is discussed a...
Just a fun think to check out if you don't know, Crane and Yetter used a braided monoidal 2 category with duals to build their state-sum model for quantum gravity. I am not at a place now to explain how or why this is relevant, but I just wanted to make you aware. Consult their papers on Arxiv for the details.
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
Let $A$ be an $E\_3$-algebra, so that $A$ is an $E\_2$-algebra in the category of $E\_1$-algebras by Dunn additivity. The functor $$ E\_1-alg \to Cat $$ $$ A \mapsto A-mod $$ is symmetric monoidal, so it will send a "banana" algebra in $E\_1$-alg to a "banana" algebra in categories. In particular, the category ...
Just a fun think to check out if you don't know, Crane and Yetter used a braided monoidal 2 category with duals to build their state-sum model for quantum gravity. I am not at a place now to explain how or why this is relevant, but I just wanted to make you aware. Consult their papers on Arxiv for the details.
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
One simple way of producing symmetric monoidal $(\infty,n)$-categories with all duals is to form $n$-fold spans/correspondences, hence an [(∞,n)-category of spans](http://ncatlab.org/nlab/show/%28infinity,n%29-category%20of%20spans) $Span\_n(\mathbf{H})$ in some ambient $\infty$-topos $\mathbf{H}$. This is discussed a...
Looking at $(\infty,2)$ rather than $2$-categories, Luries paper on the cobordism hypothesis [link text](http://arxiv.org/abs/0905.0465) provides hints on how to find examples of categories with duals. Lurie sketches in Section 4.1 how to obtain examples for TQFTs using $E\_n$-algebra objects in *good* symmetric monoid...
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
Let $A$ be an $E\_3$-algebra, so that $A$ is an $E\_2$-algebra in the category of $E\_1$-algebras by Dunn additivity. The functor $$ E\_1-alg \to Cat $$ $$ A \mapsto A-mod $$ is symmetric monoidal, so it will send a "banana" algebra in $E\_1$-alg to a "banana" algebra in categories. In particular, the category ...
Looking at $(\infty,2)$ rather than $2$-categories, Luries paper on the cobordism hypothesis [link text](http://arxiv.org/abs/0905.0465) provides hints on how to find examples of categories with duals. Lurie sketches in Section 4.1 how to obtain examples for TQFTs using $E\_n$-algebra objects in *good* symmetric monoid...
4,796
Which categorifications give explicit braided monoidal 2-categories with duals? This question is in response to Ben Webster's questions in recent history. The point is that given a braided monoidal 2-category with duals (other than the 2-category of tangle surfaces) an invariant of knotted surfaces can be constructed....
2009/11/10
[ "https://mathoverflow.net/questions/4796", "https://mathoverflow.net", "https://mathoverflow.net/users/36108/" ]
Let $A$ be an $E\_3$-algebra, so that $A$ is an $E\_2$-algebra in the category of $E\_1$-algebras by Dunn additivity. The functor $$ E\_1-alg \to Cat $$ $$ A \mapsto A-mod $$ is symmetric monoidal, so it will send a "banana" algebra in $E\_1$-alg to a "banana" algebra in categories. In particular, the category ...
One simple way of producing symmetric monoidal $(\infty,n)$-categories with all duals is to form $n$-fold spans/correspondences, hence an [(∞,n)-category of spans](http://ncatlab.org/nlab/show/%28infinity,n%29-category%20of%20spans) $Span\_n(\mathbf{H})$ in some ambient $\infty$-topos $\mathbf{H}$. This is discussed a...
46,874,420
Since I could do the same thing easily in Android and WPF, I thought XCode's Interface Builder would be easy, too. But I was wrong. I have spent hours on the storyboard resetting the constraints multiple times. I know this question seems stupid, but please give me a hint. I want something like this on the storyboard. ...
2017/10/22
[ "https://Stackoverflow.com/questions/46874420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/455796/" ]
In C and C++, the `sizeof` operator tells you how many bytes of *stack* space an instance of the class will occupy. Like the other standard containers (except `std::array`), `map` allocates its elements on the *heap* when using the default allocator. This means that its static size (i.e. what `sizeof` returns) does no...
`std::map` defines the following methods [**max\_size()**](http://en.cppreference.com/w/cpp/container/map/max_size) > > Returns the maximum number of elements the container is able to hold due to system or library implementation limitations > > > [**size()**](http://en.cppreference.com/w/cpp/container/map/size) ...
38,379,026
I have 2 .webm files, one contains video, the other one audio. I need to produce a single mp4 file containing both video and audio, in sync. Here is what i try to do: ``` ffmpeg -ss 00:00:00.33 -i user_17624_1-1762.webm -i user_17624_2-1767.webm -r 15 output_good.mp4 ``` -ss by 0.33s is because video started 0.33s b...
2016/07/14
[ "https://Stackoverflow.com/questions/38379026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4984301/" ]
You have to *cast*: ``` var PropList = P .GetType() .GetProperty("Properties") .GetValue(P, null) as IEnumerable<PropertyInfo>; // notice "as ..." // Since PropList is IEnumerable<T> you can loop over it foreach (var thisProp in PropList) { ... } ``` since `GetValue(...)` alone returns `object`.
After reviewing your code it's clear that ``` var PropList = P.GetType().GetProperty("Properties").GetValue(this, null) ``` does not return an ienumerable due to which you are getting and error. One possible solution To fix this issue you need to cast it to Ienumerable. ``` var PropList = P .GetType() .GetProp...
937,526
As part of some extra credit my professor gave me, I am given this problem: > > Call a subset $A \subseteq \mathbb R$ left-infinite if either $A =\mathbb R$ or $A=(a,\infty)$ for some $a\in\mathbb R$. > > > (a) Give an example of a proper subset of $\mathbb R$ that is left-infinite and an example of a subset that is ...
2014/09/19
[ "https://math.stackexchange.com/questions/937526", "https://math.stackexchange.com", "https://math.stackexchange.com/users/134290/" ]
You seem to be confusing $(a,\infty)$ with $\{a,\infty\}$. The latter is the set having $a$ and $\infty$ as elements, the former is $$ (a,\infty)=\{x\in\mathbb{R}:a<x\} $$ In particular, every left-infinite set (I'd call them *right-infinite*, though) is unbounded and has infinitely many elements. Just to make a picto...
For (a), by your definition, $A=\{1,5,2\}$ is not left infinite. $B=\{\sqrt{-1}, \infty\}$, however, is also not a left infinite subset of $\mathbb R$, simply because it is **not a subset of** $\mathbb R$ at all! For (b): No, it is not possible to say it that way. Elements of a set are not left infinite.The ses themse...
33,885,282
I've been trying to write a fasta parser which takes a fasta text file (DNA) as an input and outputs an AA sequence and I'm only using the biopython SeqIO module for parsing the input fasta file. I get my desired output but the problem is that whenever I run the code, I keep getting blank space on the top of my output...
2015/11/24
[ "https://Stackoverflow.com/questions/33885282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4567739/" ]
You are starting with a blank line, so it prints a blank line. If you want a blank line as a *separator*, include it at the end: ``` fout.write(seq_record.description + '\n') # no more leading newline # fout.write('\n') # moved to above for i in range(0,len(sequence),3): if sequence[i:i+3] in CONST_CODON: ...
The culprit is the line: `fout.write('\n'+seq_record.description)` This will prepend a newline to every sequence record description line, including the first one. One solution is to change to ``` fout.write(seq_record.description) ``` and then just add `fout.write('\n')` after the inner for loop. Of course this wi...
71,007,612
I have a query that generates a `List` of `Tickets` using hibernate like so : ``` Query query = session.createQuery( "SELECT T.id, T.Objet, T.Details, T.Etat,T.Severity, T.createDateTime, T.user, T.Attachment, U.lastName, L.nomLogiciel, V.nomVersion,T.AssignedTo,T.ClosedBy,T.closedDateTime,T.assignedDateTime, ...
2022/02/06
[ "https://Stackoverflow.com/questions/71007612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7396271/" ]
I see you managed to fix it, but i'll add another option for completeness. I managed to recreate your exact exception with two simple classes, whose instances form a circular refference, as in your case. User: ``` public class User { private long id; private Ticket ticket; public User(long id) { ...
You can go with Map. ``` Map<String,Object> mapObject = new HashMap<>(); List allTickets = ticketDao.getTicketsByUserDao(user); mapObject.put("ticket",allTickets); ```
71,007,612
I have a query that generates a `List` of `Tickets` using hibernate like so : ``` Query query = session.createQuery( "SELECT T.id, T.Objet, T.Details, T.Etat,T.Severity, T.createDateTime, T.user, T.Attachment, U.lastName, L.nomLogiciel, V.nomVersion,T.AssignedTo,T.ClosedBy,T.closedDateTime,T.assignedDateTime, ...
2022/02/06
[ "https://Stackoverflow.com/questions/71007612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7396271/" ]
I see you managed to fix it, but i'll add another option for completeness. I managed to recreate your exact exception with two simple classes, whose instances form a circular refference, as in your case. User: ``` public class User { private long id; private Ticket ticket; public User(long id) { ...
The Error : ----------- The `allTickets` List contains an infinitely recursive `User` object, and therefore could not be parsed to a `JSONObject`. What caused it ? ---------------- this query : ``` Query query = session.createQuery( "SELECT T.id, T.Objet, T.Details, T.Etat,T.Severity, T.createDateTime, T.us...
56,503,689
I just started getting back into C++ here recently and learned about Initializer Lists. It seems to be the standard way to initialize members. That being said I have 2 questions regarding it: 1. Is there ever a reason to NOT use this method when setting private member variables (and just using the old fashioned settin...
2019/06/08
[ "https://Stackoverflow.com/questions/56503689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5065860/" ]
Initialization list is about calling ctor of member variables. If you assign, you are altering the value of instance by using assign function. Obviously, these two are different functions. There are a few cases that you cannot assign value to member variable in the ctor. * When the member variable is const. * When t...
You should know that "setting (member data) in the constructor (body)" is assignment to an already-initialized object. That cannot supply constructor arguments. `const` members and references cannot be assigned. The ctor-initializer-list (and since C++11, brace-or-equal-initializers specified at the member point of de...
56,503,689
I just started getting back into C++ here recently and learned about Initializer Lists. It seems to be the standard way to initialize members. That being said I have 2 questions regarding it: 1. Is there ever a reason to NOT use this method when setting private member variables (and just using the old fashioned settin...
2019/06/08
[ "https://Stackoverflow.com/questions/56503689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5065860/" ]
Initialization list is about calling ctor of member variables. If you assign, you are altering the value of instance by using assign function. Obviously, these two are different functions. There are a few cases that you cannot assign value to member variable in the ctor. * When the member variable is const. * When t...
The constructor initializer list is a very useful tool. I would reject your code in code review if you wouldn't be using it. C++ has 2 ways of initializing members. Whenever you declare your member, you can give it a default value: ``` class C { int i = 42; public: C(int j); C() = default; }; ``` This i...
32,160,516
I have 2 scripts which I initially wanted to join in a single script but it doesn't work for some reason. Anyways, once the first script is over, I'd like the second one to start automatically. How can I do that ? (I heard about shell scripts but I don't know to use it). Thanks a lot
2015/08/22
[ "https://Stackoverflow.com/questions/32160516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4180345/" ]
For the simple task you want to do, your shell script would only need: ``` #!/bin/sh ./script1 ./script2 ``` After creating your simple script you need to make it executable by running > > chmod +x **your script** > > > Now you can run your new little shell script!
What if the first one fails? If that's something that needs checking you can do: ``` if script1 then script2 fi ``` or ``` script1 && script2 ``` which is more idiomatic and succinct Or even: ``` script1 && script2 || print "Big failure" 1>&2 ``` as shell && has higher priority than ||, that reports the ...
2,786,992
i want to see the all method in how to get it thanks
2010/05/07
[ "https://Stackoverflow.com/questions/2786992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234322/" ]
Use [the source](http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/users.py#58), luke zjm1126 (or [the docs](http://code.google.com/appengine/docs/python/users/userclass.html)).
``` from google.appengine.api.users import User print dir(User) ```
2,786,992
i want to see the all method in how to get it thanks
2010/05/07
[ "https://Stackoverflow.com/questions/2786992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234322/" ]
As Tamás has answered, you can use the `dir` function, but I think all the methods are well explained in the [docs](http://code.google.com/appengine/docs/python/users/userclass.html#User_nickname): > > Instance Methods > > > A User instance provides the following > methods: > > > **nickname()** > > > Returns t...
``` from google.appengine.api.users import User print dir(User) ```
2,786,992
i want to see the all method in how to get it thanks
2010/05/07
[ "https://Stackoverflow.com/questions/2786992", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234322/" ]
Use [the source](http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/api/users.py#58), luke zjm1126 (or [the docs](http://code.google.com/appengine/docs/python/users/userclass.html)).
As Tamás has answered, you can use the `dir` function, but I think all the methods are well explained in the [docs](http://code.google.com/appengine/docs/python/users/userclass.html#User_nickname): > > Instance Methods > > > A User instance provides the following > methods: > > > **nickname()** > > > Returns t...
62,928,407
I am trying my best to have the code read multiple lines of texts from a text file. A sample output of what the text file contains is shown below (the first is studentID, second is gpa, third is initials): ``` 12345 3.50000 aj 34286 4.10000 be ``` I only need the screen to display to me the studentID and the gpa. I ...
2020/07/16
[ "https://Stackoverflow.com/questions/62928407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13939778/" ]
In C, whenever you need to read a *line-at-a-time*, you use a *line-oriented* input function like `fgets()` or POSIX `getline()`. That way you consume the entire line of input and you do not leave a partial line unread. In your case you attempt to use a *formatted-input* function `fscanf()` with the `"%d %lf"` format ...
This would be my solution to your problem in cpp, please let me know if I should convert it to c for you: ```cpp #define studentCount 2 //change if you have more than 2 students void printStudents(std::string FILENAME) { std::ifstream file(FILENAME); int studentID[studentCount]; double gpa[studentCount];...
11,948,511
I can write a knockoutjs data binding expression in two different ways: ``` 1. <div data-bind="text: FirstName"></div> 2. <div data-bind="text: FistName()"></div> ``` Note the two parens after FirstName in the second example. They both seem to work. Is there a difference?
2012/08/14
[ "https://Stackoverflow.com/questions/11948511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1144473/" ]
There is a difference. They will only work *both* if `FirstName` is a `ko.observable`. If it is a plain value, only the first variant will work. An observable does not hold its value directly. It is a function that *provides access* to the value. Therefore it must be *called* to get the value (i.e., strictly correct ...
I would recommend you to read the following article: [[10 Things to Know About KnockoutJS]](http://www.knockmeout.net/2011/06/10-things-to-know-about-knockoutjs-on.html) Quote from the article: > > Most bindings will call `ko.utils.unwrapObservable` on the value passed > to it, which will safely return the value fo...
12,027,724
When I click on list item, nothing happens. Why is this and how can I solve it? ``` public class SecondActivity extends Activity { TextView selection ; private String[] menus = {"MainActivity","spam"}; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState...
2012/08/19
[ "https://Stackoverflow.com/questions/12027724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1609578/" ]
Since you're using C++11, I suggest using the [`thread` library](http://en.cppreference.com/w/cpp/thread). What you probably want is either [`std::this_thread::sleep_for`](http://en.cppreference.com/w/cpp/thread/sleep_for) or [`std::this_thread::sleep_until`](http://en.cppreference.com/w/cpp/thread/sleep_until), which...
I would suggest downloading the [Boost](http://www.boost.org) libraries and then using [this](http://www.drdobbs.com/cpp/the-boostthreads-library/184401518) extremely simple tutorial on creating a boost thread. If you don't feel like taking the time to download/install/configure Boost, then use [Windows threads](http...
4,102,159
$\sum\limits\_{k=1}^n \frac{\sin(k)}{k}$ [converges as $n$ increases](https://math.stackexchange.com/questions/13490/proving-that-the-sequence-f-nx-sum-limits-k-1n-frac-sinkxk-is), to a limit of $\frac12(\pi-1) \approx 1.0708$ Empirically, it seems to be bounded by about $\frac12(\pi-1) \pm \frac{1.043}{n}$, as shown ...
2021/04/14
[ "https://math.stackexchange.com/questions/4102159", "https://math.stackexchange.com", "https://math.stackexchange.com/users/6460/" ]
This is a twice the bound of the OP: Suppose $c\_n\searrow0$. Fix $M\in\mathbb{N}$ and for $n\geq N$ let $$P\_n(x)=\sum^n\_{k=M}e^{ikx}=\frac{e^{iMx}-e^{i(n+1)}}{1-e^{ix}}=e^{iMx}\frac{1-e^{(n-M+1)ix}}{1-e^{ix}}=\frac{\sin\big((n-M+1)x/2\big)}{\sin(x/2)}e^{i(n-M)x/2}$$ From this, we get that $$ S\_n(x)=\sum^n\_{k=M}\...
Comment: The value of this sum is indeed (pi-1)/2. This is confirmed by noting that the function f(x) = pi-x on (0, pi), extended oddly to (-pi, 0), and then extended to all real numbers periodically and with the usual convention, has Fourier series = sum(sin(nx)/n; n=1,2,...). The extended function is continuous excep...
4,102,159
$\sum\limits\_{k=1}^n \frac{\sin(k)}{k}$ [converges as $n$ increases](https://math.stackexchange.com/questions/13490/proving-that-the-sequence-f-nx-sum-limits-k-1n-frac-sinkxk-is), to a limit of $\frac12(\pi-1) \approx 1.0708$ Empirically, it seems to be bounded by about $\frac12(\pi-1) \pm \frac{1.043}{n}$, as shown ...
2021/04/14
[ "https://math.stackexchange.com/questions/4102159", "https://math.stackexchange.com", "https://math.stackexchange.com/users/6460/" ]
This is a twice the bound of the OP: Suppose $c\_n\searrow0$. Fix $M\in\mathbb{N}$ and for $n\geq N$ let $$P\_n(x)=\sum^n\_{k=M}e^{ikx}=\frac{e^{iMx}-e^{i(n+1)}}{1-e^{ix}}=e^{iMx}\frac{1-e^{(n-M+1)ix}}{1-e^{ix}}=\frac{\sin\big((n-M+1)x/2\big)}{\sin(x/2)}e^{i(n-M)x/2}$$ From this, we get that $$ S\_n(x)=\sum^n\_{k=M}\...
This is a summary of my comments to Gabriel Romon's answer, which gave $\displaystyle\left|\sum\_{k=1}^n \frac{\sin k}k - \frac12(\pi-1)\right| = \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right|$ $= \left|\frac{\cos(n+\frac 12)}{2 \sin(\frac 12)} \frac 1{n+1} + \frac{\sin(n+1)-\sin (1)}{4\sin^2(\frac 12)} \frac 1{(n...
4,102,159
$\sum\limits\_{k=1}^n \frac{\sin(k)}{k}$ [converges as $n$ increases](https://math.stackexchange.com/questions/13490/proving-that-the-sequence-f-nx-sum-limits-k-1n-frac-sinkxk-is), to a limit of $\frac12(\pi-1) \approx 1.0708$ Empirically, it seems to be bounded by about $\frac12(\pi-1) \pm \frac{1.043}{n}$, as shown ...
2021/04/14
[ "https://math.stackexchange.com/questions/4102159", "https://math.stackexchange.com", "https://math.stackexchange.com/users/6460/" ]
A slightly worse estimate may be obtained as follows. If $|\arg z|<\pi$ then $$ \log (1 + z) = \sum\limits\_{k = 1}^N {( - 1)^{k + 1} \frac{{z^k }}{k}} + ( - 1)^N z^{N + 1} \int\_0^1 {\frac{{t^N }}{{1 + zt}}dt} $$ for any $N\geq 0$. Substituting $z = - e^i$, taking the imaginary part of each side and rearranging, we f...
Comment: The value of this sum is indeed (pi-1)/2. This is confirmed by noting that the function f(x) = pi-x on (0, pi), extended oddly to (-pi, 0), and then extended to all real numbers periodically and with the usual convention, has Fourier series = sum(sin(nx)/n; n=1,2,...). The extended function is continuous excep...
4,102,159
$\sum\limits\_{k=1}^n \frac{\sin(k)}{k}$ [converges as $n$ increases](https://math.stackexchange.com/questions/13490/proving-that-the-sequence-f-nx-sum-limits-k-1n-frac-sinkxk-is), to a limit of $\frac12(\pi-1) \approx 1.0708$ Empirically, it seems to be bounded by about $\frac12(\pi-1) \pm \frac{1.043}{n}$, as shown ...
2021/04/14
[ "https://math.stackexchange.com/questions/4102159", "https://math.stackexchange.com", "https://math.stackexchange.com/users/6460/" ]
A slightly worse estimate may be obtained as follows. If $|\arg z|<\pi$ then $$ \log (1 + z) = \sum\limits\_{k = 1}^N {( - 1)^{k + 1} \frac{{z^k }}{k}} + ( - 1)^N z^{N + 1} \int\_0^1 {\frac{{t^N }}{{1 + zt}}dt} $$ for any $N\geq 0$. Substituting $z = - e^i$, taking the imaginary part of each side and rearranging, we f...
This is a summary of my comments to Gabriel Romon's answer, which gave $\displaystyle\left|\sum\_{k=1}^n \frac{\sin k}k - \frac12(\pi-1)\right| = \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right|$ $= \left|\frac{\cos(n+\frac 12)}{2 \sin(\frac 12)} \frac 1{n+1} + \frac{\sin(n+1)-\sin (1)}{4\sin^2(\frac 12)} \frac 1{(n...
4,102,159
$\sum\limits\_{k=1}^n \frac{\sin(k)}{k}$ [converges as $n$ increases](https://math.stackexchange.com/questions/13490/proving-that-the-sequence-f-nx-sum-limits-k-1n-frac-sinkxk-is), to a limit of $\frac12(\pi-1) \approx 1.0708$ Empirically, it seems to be bounded by about $\frac12(\pi-1) \pm \frac{1.043}{n}$, as shown ...
2021/04/14
[ "https://math.stackexchange.com/questions/4102159", "https://math.stackexchange.com", "https://math.stackexchange.com/users/6460/" ]
Note that $\displaystyle\left|\sum\_{k=1}^n \frac{\sin k}k - \frac12(\pi-1)\right| = \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right|$. We prove the following inequality: $$ \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right| \leq \frac{1}{2 \sin(\frac 12)} \frac 1{n+1} + \frac{3}{4\sin^2(\frac 12)} \frac 1{(n+1)(n+2...
Comment: The value of this sum is indeed (pi-1)/2. This is confirmed by noting that the function f(x) = pi-x on (0, pi), extended oddly to (-pi, 0), and then extended to all real numbers periodically and with the usual convention, has Fourier series = sum(sin(nx)/n; n=1,2,...). The extended function is continuous excep...
4,102,159
$\sum\limits\_{k=1}^n \frac{\sin(k)}{k}$ [converges as $n$ increases](https://math.stackexchange.com/questions/13490/proving-that-the-sequence-f-nx-sum-limits-k-1n-frac-sinkxk-is), to a limit of $\frac12(\pi-1) \approx 1.0708$ Empirically, it seems to be bounded by about $\frac12(\pi-1) \pm \frac{1.043}{n}$, as shown ...
2021/04/14
[ "https://math.stackexchange.com/questions/4102159", "https://math.stackexchange.com", "https://math.stackexchange.com/users/6460/" ]
Note that $\displaystyle\left|\sum\_{k=1}^n \frac{\sin k}k - \frac12(\pi-1)\right| = \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right|$. We prove the following inequality: $$ \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right| \leq \frac{1}{2 \sin(\frac 12)} \frac 1{n+1} + \frac{3}{4\sin^2(\frac 12)} \frac 1{(n+1)(n+2...
This is a summary of my comments to Gabriel Romon's answer, which gave $\displaystyle\left|\sum\_{k=1}^n \frac{\sin k}k - \frac12(\pi-1)\right| = \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right|$ $= \left|\frac{\cos(n+\frac 12)}{2 \sin(\frac 12)} \frac 1{n+1} + \frac{\sin(n+1)-\sin (1)}{4\sin^2(\frac 12)} \frac 1{(n...
4,102,159
$\sum\limits\_{k=1}^n \frac{\sin(k)}{k}$ [converges as $n$ increases](https://math.stackexchange.com/questions/13490/proving-that-the-sequence-f-nx-sum-limits-k-1n-frac-sinkxk-is), to a limit of $\frac12(\pi-1) \approx 1.0708$ Empirically, it seems to be bounded by about $\frac12(\pi-1) \pm \frac{1.043}{n}$, as shown ...
2021/04/14
[ "https://math.stackexchange.com/questions/4102159", "https://math.stackexchange.com", "https://math.stackexchange.com/users/6460/" ]
This is a summary of my comments to Gabriel Romon's answer, which gave $\displaystyle\left|\sum\_{k=1}^n \frac{\sin k}k - \frac12(\pi-1)\right| = \left|\sum\_{k=n+1}^\infty \frac{\sin k}k \right|$ $= \left|\frac{\cos(n+\frac 12)}{2 \sin(\frac 12)} \frac 1{n+1} + \frac{\sin(n+1)-\sin (1)}{4\sin^2(\frac 12)} \frac 1{(n...
Comment: The value of this sum is indeed (pi-1)/2. This is confirmed by noting that the function f(x) = pi-x on (0, pi), extended oddly to (-pi, 0), and then extended to all real numbers periodically and with the usual convention, has Fourier series = sum(sin(nx)/n; n=1,2,...). The extended function is continuous excep...
23,644,161
I have been searching high and low for an answer to this problem. Everything I have found so far is *close* to what I need, but not quite. I just can't seem to find the right combination of keywords to search for. I have an array defined with missing keys, like this (the keys are automatically generated from other dat...
2014/05/14
[ "https://Stackoverflow.com/questions/23644161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3338422/" ]
I'm thinking of a better way, but this works: ``` $i = 0; foreach($Array as $k => $v) { if(isset($Array[$k+1])) { $result[$i][] = $k; $result[$i][] = $k+1; $result[$i] = array_unique($result[$i]); } else { $i++; } } ```
Glued this together, needs further testing though: ``` $Array = array( 1 => "A", 2 => "B", 4 => "C", 7 => "D", 8 => "E", 9 => "F", 12 => "G", 15 => "H", 16 => "I" ); $ret = array(); $cur = array(); print_r($Array); $prevKey = NULL; foreach($Array as $k => $v) { if (!isset($pr...
23,644,161
I have been searching high and low for an answer to this problem. Everything I have found so far is *close* to what I need, but not quite. I just can't seem to find the right combination of keywords to search for. I have an array defined with missing keys, like this (the keys are automatically generated from other dat...
2014/05/14
[ "https://Stackoverflow.com/questions/23644161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3338422/" ]
I'm thinking of a better way, but this works: ``` $i = 0; foreach($Array as $k => $v) { if(isset($Array[$k+1])) { $result[$i][] = $k; $result[$i][] = $k+1; $result[$i] = array_unique($result[$i]); } else { $i++; } } ```
It's to specific to have an existing PHP function about it. This should generate the results in the way that you specified... ``` $Array = array( 1 => "A", 2 => "B", 4 => "C", 7 => "D", 8 => "E", 9 => "F", 12 => "G", 15 => "H", 16 => "I" ); $lastNum = -1; $sequences = array(); $curS...
23,644,161
I have been searching high and low for an answer to this problem. Everything I have found so far is *close* to what I need, but not quite. I just can't seem to find the right combination of keywords to search for. I have an array defined with missing keys, like this (the keys are automatically generated from other dat...
2014/05/14
[ "https://Stackoverflow.com/questions/23644161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3338422/" ]
I'm thinking of a better way, but this works: ``` $i = 0; foreach($Array as $k => $v) { if(isset($Array[$k+1])) { $result[$i][] = $k; $result[$i][] = $k+1; $result[$i] = array_unique($result[$i]); } else { $i++; } } ```
The question is tagged PHP but here's a Java solution if anyone is interested ``` import java.util.*; public class FindSequential { public static void main(String args[]) { Map<Integer, String> inputMap = new LinkedHashMap<Integer, String>(); inputMap.put(1,"A"); inputMap.put(2,"B"); inputMap.put(4,...
23,644,161
I have been searching high and low for an answer to this problem. Everything I have found so far is *close* to what I need, but not quite. I just can't seem to find the right combination of keywords to search for. I have an array defined with missing keys, like this (the keys are automatically generated from other dat...
2014/05/14
[ "https://Stackoverflow.com/questions/23644161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3338422/" ]
Glued this together, needs further testing though: ``` $Array = array( 1 => "A", 2 => "B", 4 => "C", 7 => "D", 8 => "E", 9 => "F", 12 => "G", 15 => "H", 16 => "I" ); $ret = array(); $cur = array(); print_r($Array); $prevKey = NULL; foreach($Array as $k => $v) { if (!isset($pr...
The question is tagged PHP but here's a Java solution if anyone is interested ``` import java.util.*; public class FindSequential { public static void main(String args[]) { Map<Integer, String> inputMap = new LinkedHashMap<Integer, String>(); inputMap.put(1,"A"); inputMap.put(2,"B"); inputMap.put(4,...
23,644,161
I have been searching high and low for an answer to this problem. Everything I have found so far is *close* to what I need, but not quite. I just can't seem to find the right combination of keywords to search for. I have an array defined with missing keys, like this (the keys are automatically generated from other dat...
2014/05/14
[ "https://Stackoverflow.com/questions/23644161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3338422/" ]
It's to specific to have an existing PHP function about it. This should generate the results in the way that you specified... ``` $Array = array( 1 => "A", 2 => "B", 4 => "C", 7 => "D", 8 => "E", 9 => "F", 12 => "G", 15 => "H", 16 => "I" ); $lastNum = -1; $sequences = array(); $curS...
The question is tagged PHP but here's a Java solution if anyone is interested ``` import java.util.*; public class FindSequential { public static void main(String args[]) { Map<Integer, String> inputMap = new LinkedHashMap<Integer, String>(); inputMap.put(1,"A"); inputMap.put(2,"B"); inputMap.put(4,...
9,697,281
I am getting this error while simply entering the register page ``` Undefined index: invite ``` But when I enter the same page with ``` url?invite=2000 this error is not shown... ``` The second line of below code shows the error. ``` $mySess = JFactory::getSession(); $_SESSION['fromid'] = $_GET...
2012/03/14
[ "https://Stackoverflow.com/questions/9697281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1237533/" ]
Use the `isset` function, like so: ``` $mySess = JFactory::getSession(); $_SESSION['fromid'] = isset($_GET['invite']) ? $_GET['invite'] : ''; $fromid = $_SESSION['fromid']; ```
This is basically Matt's solution but without the complex `if-then-else`-shorthand. ``` $mySess = JFactory::getSession(); // this value will be used if you did not pass the parameter invite to your script $inviteDefaultValue = -1; // isset checks if the variable exists. // you can also use array_key_exists(...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
I wouldn't use `PropertyInfo`, just like `Reed Copsey` said in his answer, but just for information, you can extract the `PropertyInfo` of an expression with this: ``` public PropertyInfo GetPropertyFromExpression<T>(Expression<Func<T, object>> GetPropertyLambda) { MemberExpression Exp = null; //this line is ...
This is possible, and there's no need to use `PropertyInfo`. You'd design your method like so: ``` public bool Update<T>(int id, Action<T> updateMethod) // where T : SomeDbEntityType { T entity = LoadFromDatabase(id); // Load your "person" or whatever if (entity == null) return false; // If yo...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
This is possible, and there's no need to use `PropertyInfo`. You'd design your method like so: ``` public bool Update<T>(int id, Action<T> updateMethod) // where T : SomeDbEntityType { T entity = LoadFromDatabase(id); // Load your "person" or whatever if (entity == null) return false; // If yo...
Here is a version of @DanielMöller's answer updated for modern syntax, with specified exception messages, and documentation. ``` /// <summary> /// Gets the corresponding <see cref="PropertyInfo" /> from an <see cref="Expression" />. /// </summary> /// <param name="property">The expression that selects the property...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
This is possible, and there's no need to use `PropertyInfo`. You'd design your method like so: ``` public bool Update<T>(int id, Action<T> updateMethod) // where T : SomeDbEntityType { T entity = LoadFromDatabase(id); // Load your "person" or whatever if (entity == null) return false; // If yo...
Even cleaner IMHO (another variant on @DanielMöller's post) ``` /// <summary> /// Gets the corresponding <see cref="PropertyInfo" /> from an <see cref="Expression" />. /// </summary> /// <param name="expression">The expression that selects the property to get info on.</param> ...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
This is possible, and there's no need to use `PropertyInfo`. You'd design your method like so: ``` public bool Update<T>(int id, Action<T> updateMethod) // where T : SomeDbEntityType { T entity = LoadFromDatabase(id); // Load your "person" or whatever if (entity == null) return false; // If yo...
Even cleaner with C# 9 switch expression ```cs public static PropertyInfo GetPropertyInfo<T>(this Expression<Func<T, object>> expression) => expression?.Body switch { null => throw new ArgumentNullException(nameof(expression)), UnaryExpression ue when ue.Operand is MemberExpression me => (Prope...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
I wouldn't use `PropertyInfo`, just like `Reed Copsey` said in his answer, but just for information, you can extract the `PropertyInfo` of an expression with this: ``` public PropertyInfo GetPropertyFromExpression<T>(Expression<Func<T, object>> GetPropertyLambda) { MemberExpression Exp = null; //this line is ...
Here is a version of @DanielMöller's answer updated for modern syntax, with specified exception messages, and documentation. ``` /// <summary> /// Gets the corresponding <see cref="PropertyInfo" /> from an <see cref="Expression" />. /// </summary> /// <param name="property">The expression that selects the property...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
I wouldn't use `PropertyInfo`, just like `Reed Copsey` said in his answer, but just for information, you can extract the `PropertyInfo` of an expression with this: ``` public PropertyInfo GetPropertyFromExpression<T>(Expression<Func<T, object>> GetPropertyLambda) { MemberExpression Exp = null; //this line is ...
Even cleaner IMHO (another variant on @DanielMöller's post) ``` /// <summary> /// Gets the corresponding <see cref="PropertyInfo" /> from an <see cref="Expression" />. /// </summary> /// <param name="expression">The expression that selects the property to get info on.</param> ...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
I wouldn't use `PropertyInfo`, just like `Reed Copsey` said in his answer, but just for information, you can extract the `PropertyInfo` of an expression with this: ``` public PropertyInfo GetPropertyFromExpression<T>(Expression<Func<T, object>> GetPropertyLambda) { MemberExpression Exp = null; //this line is ...
Even cleaner with C# 9 switch expression ```cs public static PropertyInfo GetPropertyInfo<T>(this Expression<Func<T, object>> expression) => expression?.Body switch { null => throw new ArgumentNullException(nameof(expression)), UnaryExpression ue when ue.Operand is MemberExpression me => (Prope...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
Here is a version of @DanielMöller's answer updated for modern syntax, with specified exception messages, and documentation. ``` /// <summary> /// Gets the corresponding <see cref="PropertyInfo" /> from an <see cref="Expression" />. /// </summary> /// <param name="property">The expression that selects the property...
Even cleaner with C# 9 switch expression ```cs public static PropertyInfo GetPropertyInfo<T>(this Expression<Func<T, object>> expression) => expression?.Body switch { null => throw new ArgumentNullException(nameof(expression)), UnaryExpression ue when ue.Operand is MemberExpression me => (Prope...
17,115,634
For example, I have a class: ``` public class Person { public int Id; public string Name, Address; } ``` and I want to call a method to update info in this class base on **Id**: ``` update(myId, myPerson => myPerson.Name = "abc"); ``` explain: This method will query from database and gets `Person` entity give...
2013/06/14
[ "https://Stackoverflow.com/questions/17115634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2487282/" ]
Even cleaner IMHO (another variant on @DanielMöller's post) ``` /// <summary> /// Gets the corresponding <see cref="PropertyInfo" /> from an <see cref="Expression" />. /// </summary> /// <param name="expression">The expression that selects the property to get info on.</param> ...
Even cleaner with C# 9 switch expression ```cs public static PropertyInfo GetPropertyInfo<T>(this Expression<Func<T, object>> expression) => expression?.Body switch { null => throw new ArgumentNullException(nameof(expression)), UnaryExpression ue when ue.Operand is MemberExpression me => (Prope...
50,312,694
Simply trying to allow the user to send emails. At the moment when the button "contact" is clicked, it takes me to a black screen rather than displaying the mailComposers. The debugger responds with 2018-05-14 11:10:59.465952-0400 App[2333:757177] Failed to set (keyPath) user defined inspected property on (UIButton)...
2018/05/13
[ "https://Stackoverflow.com/questions/50312694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3512483/" ]
Please use the code to open mail in swift with an extension like below. ``` extension SendEmailVC: MFMailComposeViewControllerDelegate { func contact() { if !MFMailComposeViewController.canSendMail() { ROAlert.warningAlertUnderNavigation(ROConstants.More.kNoMailConfigured, onView: self.view) retu...
Here is the new updated code that fixed the black screen problem. 1 step closer. But now I am getting the error message from showMailError() when pressing the send button. This is what the debugger displays 2018-05-14 15:03:40.474236-0400 projectName[2510:835559] [MC] Filtering mail sheet accounts for bundle ID: proje...
41,496,585
Say I have a `std::deque<int> d`containing 100 values, from `0` to `99`. Given [the following](http://www.cplusplus.com/reference/deque/deque/): > > Unlike vectors, deques are not guaranteed to store all its elements in > contiguous storage locations: accessing elements in a deque by > offsetting a pointer to anot...
2017/01/05
[ "https://Stackoverflow.com/questions/41496585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/309502/" ]
> > It appears line below is not valid: > > > > ``` > int invalidResult = *(d.begin() + 81); // might give me 81, but NOT GUARANTEED, right? > > ``` > > On the contrary. The statement is perfectly valid and the behaviour is guaranteed (assuming `d.size() >= 82`). This is because `std::deque::begin` returns an i...
According to [this reference here](http://en.cppreference.com/w/cpp/container/deque) a [std::deque](http://en.cppreference.com/w/cpp/container/deque) provides a [RandomAccessIterator](http://en.cppreference.com/w/cpp/concept/RandomAccessIterator) which will certainly work according to your example. ``` std::deque<int>...
47,589,009
Please see below given code: ``` <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind-html="myText"></p> </div> <script> var app = angular.module("myApp", ['ngSanitize']); app.controller("myCtrl", function($scope) { $scope.myText = "My name is: <h1>Joh...
2017/12/01
[ "https://Stackoverflow.com/questions/47589009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4004218/" ]
Please use the `$sce` of `angularjs`. ```js var app = angular.module('myApp', []); app.controller('MyController', function MyController($scope, $sce) { $scope.myText = $sce.trustAsHtml("My name is: <h1>John Doe</h1>"); }); ``` ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular...
Use `ng-bind` instead `ng-bind-html` ``` <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind="myText"></p> </div> ``` Or simply ``` <p>{{myText}}</p> ```
47,589,009
Please see below given code: ``` <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind-html="myText"></p> </div> <script> var app = angular.module("myApp", ['ngSanitize']); app.controller("myCtrl", function($scope) { $scope.myText = "My name is: <h1>Joh...
2017/12/01
[ "https://Stackoverflow.com/questions/47589009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4004218/" ]
Use `ng-bind` instead `ng-bind-html` ``` <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind="myText"></p> </div> ``` Or simply ``` <p>{{myText}}</p> ```
I think you should use like this in your controller ``` $scope.mytext="&lth1&gtJohn Doe&lt/h1&gt" ``` in you html page ``` <p ng-bind-html="myText"></p> ```
47,589,009
Please see below given code: ``` <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind-html="myText"></p> </div> <script> var app = angular.module("myApp", ['ngSanitize']); app.controller("myCtrl", function($scope) { $scope.myText = "My name is: <h1>Joh...
2017/12/01
[ "https://Stackoverflow.com/questions/47589009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4004218/" ]
Please use the `$sce` of `angularjs`. ```js var app = angular.module('myApp', []); app.controller('MyController', function MyController($scope, $sce) { $scope.myText = $sce.trustAsHtml("My name is: <h1>John Doe</h1>"); }); ``` ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular...
I think you should use like this in your controller ``` $scope.mytext="&lth1&gtJohn Doe&lt/h1&gt" ``` in you html page ``` <p ng-bind-html="myText"></p> ```
47,589,009
Please see below given code: ``` <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind-html="myText"></p> </div> <script> var app = angular.module("myApp", ['ngSanitize']); app.controller("myCtrl", function($scope) { $scope.myText = "My name is: <h1>Joh...
2017/12/01
[ "https://Stackoverflow.com/questions/47589009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4004218/" ]
Please use the `$sce` of `angularjs`. ```js var app = angular.module('myApp', []); app.controller('MyController', function MyController($scope, $sce) { $scope.myText = $sce.trustAsHtml("My name is: <h1>John Doe</h1>"); }); ``` ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.14/angular...
First create a filter using `$sce`: ``` app.filter("html", ['$sce', function($sce) { return function(input){ return $sce.trustAsHtml(input); } }]); ``` Then: ``` <div ng-bind-html="myText | html"></div> ```
47,589,009
Please see below given code: ``` <div ng-app="myApp" ng-controller="myCtrl"> <p ng-bind-html="myText"></p> </div> <script> var app = angular.module("myApp", ['ngSanitize']); app.controller("myCtrl", function($scope) { $scope.myText = "My name is: <h1>Joh...
2017/12/01
[ "https://Stackoverflow.com/questions/47589009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4004218/" ]
First create a filter using `$sce`: ``` app.filter("html", ['$sce', function($sce) { return function(input){ return $sce.trustAsHtml(input); } }]); ``` Then: ``` <div ng-bind-html="myText | html"></div> ```
I think you should use like this in your controller ``` $scope.mytext="&lth1&gtJohn Doe&lt/h1&gt" ``` in you html page ``` <p ng-bind-html="myText"></p> ```
16,274
What is the best video size for let's say a 5 minute video. I want to host my own videos. So, I want to understand more. What is an acceptable size?
2015/08/28
[ "https://avp.stackexchange.com/questions/16274", "https://avp.stackexchange.com", "https://avp.stackexchange.com/users/11528/" ]
First off, why host your own videos? YouTube, Vimeo and many others have awesome embed tools, and unless you have a couple of GB to waste on your host, they're very practical. But to your question, 1080x720 is perfectly fine, and creates a reasonable file size. 1920x1080 is pushing it a little, and 4K is just overkill...
I would analyze how YouTube encodes videos, as described in [this answer](https://video.stackexchange.com/q/16361/3481). It also helps you to understand the logic behind it.
48,794,049
I created an navigation drawer activity and found that its content page looks different in the preview. [This is the preview.](https://i.stack.imgur.com/k6R4B.png) [And this is the AVD appearance (it looks like a real device too).](https://i.stack.imgur.com/eXQue.png) XML code is: ``` <?xml version="1.0" encoding="...
2018/02/14
[ "https://Stackoverflow.com/questions/48794049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8228417/" ]
My assumption is you have something like this: ``` Table1 id | UID | action 1 | 1 | bla 1 | 2 | bleck 1 | 3 | floop Table2 id | UID | action 1 | 1 | bla 1 | 2 | bleck 1 | 4 | floop ``` And you hope to update the third row in `Table1` because the `UID` ...
If you put condition Table1.UID <> Table2.UID into WHERE clause, doesn't it solve your problem? ``` UPDATE Table1 SET Action = 'Insert' FROM Table1 JOIN Table2 ON Table1.id = Table2.id WHERE Table1.UID <> Table2.UID ```
4,075,525
I realize this is way too far into the micro-optimization area, but I am curious to understand why Calls to DateTime.Now and DateTime.UtcNow are so "expensive". I have a sample program that runs a couple of scenarios of doing some "work" (adding to a counter) and attempts to do this for 1 second. I have several approac...
2010/11/02
[ "https://Stackoverflow.com/questions/4075525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177651/" ]
`TickCount` just reads a constantly increasing counter. It's just about the simplest thing you can do. `DateTime.UtcNow` needs to query the system time - and don't forget that while `TickCount` is blissfully ignorant of things like the user changing the clock, or NTP, `UtcNow` has to take this into account. Now you'v...
FWIW here is some code that NLog uses to get the timestamp for each log message. In this case, the "work" is the actual retrieval of the current time (granted, it happens in the context of probably a much more expensive bit of "work", the logging of a message). NLog minimizes the cost of getting the current time by onl...
4,075,525
I realize this is way too far into the micro-optimization area, but I am curious to understand why Calls to DateTime.Now and DateTime.UtcNow are so "expensive". I have a sample program that runs a couple of scenarios of doing some "work" (adding to a counter) and attempts to do this for 1 second. I have several approac...
2010/11/02
[ "https://Stackoverflow.com/questions/4075525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177651/" ]
`TickCount` just reads a constantly increasing counter. It's just about the simplest thing you can do. `DateTime.UtcNow` needs to query the system time - and don't forget that while `TickCount` is blissfully ignorant of things like the user changing the clock, or NTP, `UtcNow` has to take this into account. Now you'v...
As far as I can tell, `DateTime.UtcNow` (not to be confused with `DateTime.Now`, which is much slower) is the fastest way you can get time. In fact, caching it the way @wageoghe proposes decreases performance signifficantly (in my tests, that were 3.5 times). In ILSpy, UtcNow looks like this: ``` [__DynamicallyInvoka...
4,075,525
I realize this is way too far into the micro-optimization area, but I am curious to understand why Calls to DateTime.Now and DateTime.UtcNow are so "expensive". I have a sample program that runs a couple of scenarios of doing some "work" (adding to a counter) and attempts to do this for 1 second. I have several approac...
2010/11/02
[ "https://Stackoverflow.com/questions/4075525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177651/" ]
`TickCount` just reads a constantly increasing counter. It's just about the simplest thing you can do. `DateTime.UtcNow` needs to query the system time - and don't forget that while `TickCount` is blissfully ignorant of things like the user changing the clock, or NTP, `UtcNow` has to take this into account. Now you'v...
For an up-to-date look on the profiled speed of `DateTime.UtcNow` / `DateTimeOffset.UtcNow`, see this [dotnet thread](https://github.com/dotnet/coreclr/issues/25728), where `BenchmarkDotNet` was used to profile. There was unfortunately a perf regression with the jump to .NET (Core) 3 compared to 2.2, but even reportin...
4,075,525
I realize this is way too far into the micro-optimization area, but I am curious to understand why Calls to DateTime.Now and DateTime.UtcNow are so "expensive". I have a sample program that runs a couple of scenarios of doing some "work" (adding to a counter) and attempts to do this for 1 second. I have several approac...
2010/11/02
[ "https://Stackoverflow.com/questions/4075525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177651/" ]
FWIW here is some code that NLog uses to get the timestamp for each log message. In this case, the "work" is the actual retrieval of the current time (granted, it happens in the context of probably a much more expensive bit of "work", the logging of a message). NLog minimizes the cost of getting the current time by onl...
As far as I can tell, `DateTime.UtcNow` (not to be confused with `DateTime.Now`, which is much slower) is the fastest way you can get time. In fact, caching it the way @wageoghe proposes decreases performance signifficantly (in my tests, that were 3.5 times). In ILSpy, UtcNow looks like this: ``` [__DynamicallyInvoka...
4,075,525
I realize this is way too far into the micro-optimization area, but I am curious to understand why Calls to DateTime.Now and DateTime.UtcNow are so "expensive". I have a sample program that runs a couple of scenarios of doing some "work" (adding to a counter) and attempts to do this for 1 second. I have several approac...
2010/11/02
[ "https://Stackoverflow.com/questions/4075525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/177651/" ]
For an up-to-date look on the profiled speed of `DateTime.UtcNow` / `DateTimeOffset.UtcNow`, see this [dotnet thread](https://github.com/dotnet/coreclr/issues/25728), where `BenchmarkDotNet` was used to profile. There was unfortunately a perf regression with the jump to .NET (Core) 3 compared to 2.2, but even reportin...
As far as I can tell, `DateTime.UtcNow` (not to be confused with `DateTime.Now`, which is much slower) is the fastest way you can get time. In fact, caching it the way @wageoghe proposes decreases performance signifficantly (in my tests, that were 3.5 times). In ILSpy, UtcNow looks like this: ``` [__DynamicallyInvoka...
225,529
I am trying to deploy the static content but in frontend and backend require js is not being loaded see error : ``` Loading failed for the <script> with source “http://example.com/dev/pub/static/version1525976399/frontend/Sm/market/en_GB/requirejs/require.js”. dev:20 Loading failed for the <script> with source “http:/...
2018/05/10
[ "https://magento.stackexchange.com/questions/225529", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/28348/" ]
If you are using developer or default mode then try to use: ``` php bin/magento setup:upgrade php -d memory_limit=5G bin/magento setup:di:compile php -d memory_limit=5G bin/magento setup:static-content:deploy en_GB en_US -f php bin/magento cache:clean ``` Hope this helps
Run below command and check ``` php bin/magento setup:upgrade php bin/magento setup:static-content:deploy en_GB en_US php bin/magento cache:clean ```
225,529
I am trying to deploy the static content but in frontend and backend require js is not being loaded see error : ``` Loading failed for the <script> with source “http://example.com/dev/pub/static/version1525976399/frontend/Sm/market/en_GB/requirejs/require.js”. dev:20 Loading failed for the <script> with source “http:/...
2018/05/10
[ "https://magento.stackexchange.com/questions/225529", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/28348/" ]
This will happen if you clear the pub/static folder instead of pub/static/frontend. You'll lose the .htaccess in there which messes things up royally! Restore pub/static/.htaccess from your local files/backup and it'll correct.
Run below command and check ``` php bin/magento setup:upgrade php bin/magento setup:static-content:deploy en_GB en_US php bin/magento cache:clean ```
225,529
I am trying to deploy the static content but in frontend and backend require js is not being loaded see error : ``` Loading failed for the <script> with source “http://example.com/dev/pub/static/version1525976399/frontend/Sm/market/en_GB/requirejs/require.js”. dev:20 Loading failed for the <script> with source “http:/...
2018/05/10
[ "https://magento.stackexchange.com/questions/225529", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/28348/" ]
If you are using developer or default mode then try to use: ``` php bin/magento setup:upgrade php -d memory_limit=5G bin/magento setup:di:compile php -d memory_limit=5G bin/magento setup:static-content:deploy en_GB en_US -f php bin/magento cache:clean ``` Hope this helps
This will happen if you clear the pub/static folder instead of pub/static/frontend. You'll lose the .htaccess in there which messes things up royally! Restore pub/static/.htaccess from your local files/backup and it'll correct.
16,786,252
When I create a new android project in Eclipse, and I choose to have a default main activity, my R.java file does not get generated. I have seen some questions online and on this site about R.java not being generated but all are due to some manual action/mistake that had to be corrected during the development of the a...
2013/05/28
[ "https://Stackoverflow.com/questions/16786252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32324/" ]
I think your problem is just the latest update of the SDK. Test the following operations on two projects : * In the project properties (eclipse) -> java build path -> order and export make sure that all your jars in the libs folder are checked. * And "Android Tools -> Fix Project Properties" * And "Project -> Clean" ...
Make sure your project is free of errors and problems. You can use Windows-View to find and rectify them. Common mistakes are in the layout files. Check the AndroidManifest file and see if the activity names match the classes in your source folder. Clean and rebuild.
16,786,252
When I create a new android project in Eclipse, and I choose to have a default main activity, my R.java file does not get generated. I have seen some questions online and on this site about R.java not being generated but all are due to some manual action/mistake that had to be corrected during the development of the a...
2013/05/28
[ "https://Stackoverflow.com/questions/16786252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32324/" ]
I think your problem is just the latest update of the SDK. Test the following operations on two projects : * In the project properties (eclipse) -> java build path -> order and export make sure that all your jars in the libs folder are checked. * And "Android Tools -> Fix Project Properties" * And "Project -> Clean" ...
R.java creates every time when you create android project first time r.java created by default so check for the errors and clean the project.
16,786,252
When I create a new android project in Eclipse, and I choose to have a default main activity, my R.java file does not get generated. I have seen some questions online and on this site about R.java not being generated but all are due to some manual action/mistake that had to be corrected during the development of the a...
2013/05/28
[ "https://Stackoverflow.com/questions/16786252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32324/" ]
I think your problem is just the latest update of the SDK. Test the following operations on two projects : * In the project properties (eclipse) -> java build path -> order and export make sure that all your jars in the libs folder are checked. * And "Android Tools -> Fix Project Properties" * And "Project -> Clean" ...
ADT version 22 requires that you install "build tools". To get it to work i had to update: * SDK Tools * Platform Tools Then install: * Build Tools [This link](https://stackoverflow.com/a/17248270/1459223) recommends you add build tools to your environment path. I had to do the following before the R.java was gener...
16,786,252
When I create a new android project in Eclipse, and I choose to have a default main activity, my R.java file does not get generated. I have seen some questions online and on this site about R.java not being generated but all are due to some manual action/mistake that had to be corrected during the development of the a...
2013/05/28
[ "https://Stackoverflow.com/questions/16786252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32324/" ]
ADT version 22 requires that you install "build tools". To get it to work i had to update: * SDK Tools * Platform Tools Then install: * Build Tools [This link](https://stackoverflow.com/a/17248270/1459223) recommends you add build tools to your environment path. I had to do the following before the R.java was gener...
Make sure your project is free of errors and problems. You can use Windows-View to find and rectify them. Common mistakes are in the layout files. Check the AndroidManifest file and see if the activity names match the classes in your source folder. Clean and rebuild.
16,786,252
When I create a new android project in Eclipse, and I choose to have a default main activity, my R.java file does not get generated. I have seen some questions online and on this site about R.java not being generated but all are due to some manual action/mistake that had to be corrected during the development of the a...
2013/05/28
[ "https://Stackoverflow.com/questions/16786252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32324/" ]
ADT version 22 requires that you install "build tools". To get it to work i had to update: * SDK Tools * Platform Tools Then install: * Build Tools [This link](https://stackoverflow.com/a/17248270/1459223) recommends you add build tools to your environment path. I had to do the following before the R.java was gener...
R.java creates every time when you create android project first time r.java created by default so check for the errors and clean the project.
21,715,533
I am creating a battleship game inside a GUI using Java Swing. For now I am just trying to get this grid working so that a user may drag and drop the battleship from the bottom of the grid onto a spot within the grid above. I would like to save the X & Y integer values inside a DropListener class so that after a button...
2014/02/11
[ "https://Stackoverflow.com/questions/21715533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3299397/" ]
First, pick a API. You are crossing over Drag'n'Drop APIs. You're trying to use the `TransferHandler` API and the core Drag'n'Drop APIs, they don't mix well in this way (the `TransferHandler` API uses the core Drag'n'Drop APIs to perform their actions). Take a look at [Drag and Drop and Data Transfer](http://docs.orac...
Sorry the code doesn't compile you just need to comment out ``` new DropListener(grid[x][y], x, y); ``` along with the DropListener class. But I made a little progress, here it is. Instead of using ``` grid[x][y]=new JButton( waterImage ); //creates new button ``` to create my buttons I made my own Button class a...
37,634,787
I'm working on a web application using netbeans and MS Acces as my database, in my connection class I tried to get the path of my acces file (located inside my project) via the following command: ``` File f = new File("softTech.accdb"); String path = f.getAbsolutePath(); ``` The problem is, as soon as I run the ...
2016/06/04
[ "https://Stackoverflow.com/questions/37634787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3628479/" ]
There are two points: **First: MS Access is really the worst choice as a database for a Java web application.** MS Access is a desktop database not made for using it at the server side. The JDBC-ODBC bridge was never meant for production use and was removed in Java 8. The alternate driver Ucanaccess is nice for dat...
If you are using servlets then following code should work. ``` getServletContext().getRealPath("/yourFileName") ``` In case of normal java class, you can use ``` new File("yourFileName").getCanonicalPath(); ```
212,669
I've tried a lot but can't get current order id from totals.phtml under my adminhtml directory.
2018/02/08
[ "https://magento.stackexchange.com/questions/212669", "https://magento.stackexchange.com", "https://magento.stackexchange.com/users/59631/" ]
``` $orderId = $this->getRequest()->getParam('order_id'); ``` Finally got answer.
You can get current order Id by below code > > echo $block->getOrder()->getId(); > > >
17,074,369
I was wondering if it is possible to control my fan (attached to the raspberry pi board) via the GPIO pins. Basically, I would like to have a script which monitors the temperature of the chip and turn on the fan when beyond 45'C for instance. My fan is externally powered with 12v AC. Is it possible to use the GPIO...
2013/06/12
[ "https://Stackoverflow.com/questions/17074369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1010813/" ]
As @Fredrick says, this question is more suited to <https://raspberrypi.stackexchange.com/>. Since you're switching an AC load, A relay is the easiest solution. You can switch a mechanical relay using a small transistor, but you will hear this click on and off which can be annoying. Another option is a solidstate re...
You can get the CPU temperature with: ```bash /opt/vc/bin/vcgencmd measure_temp ``` The command above returns a value such as `temp=49.4'C` which can be parsed to a float for example with ```bash temp=$(/opt/vc/bin/vcgencmd measure_temp | cut -f2 -d= | cut -f1 -d\') echo $temp ### output: 49.4 ``` Next, 1. Get ...
17,074,369
I was wondering if it is possible to control my fan (attached to the raspberry pi board) via the GPIO pins. Basically, I would like to have a script which monitors the temperature of the chip and turn on the fan when beyond 45'C for instance. My fan is externally powered with 12v AC. Is it possible to use the GPIO...
2013/06/12
[ "https://Stackoverflow.com/questions/17074369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1010813/" ]
You can "switch" it with a relay: <http://www.susa.net/wordpress/2012/06/raspberry-pi-relay-using-gpio/> Here is some instructions on how to program it with Python: <http://lwk.mjhosting.co.uk/?p=343> As gnibbler noted (thanks!), The second link is about a rev1 board. If you have a rev2 board, some of the GPIO pins h...
You can get the CPU temperature with: ```bash /opt/vc/bin/vcgencmd measure_temp ``` The command above returns a value such as `temp=49.4'C` which can be parsed to a float for example with ```bash temp=$(/opt/vc/bin/vcgencmd measure_temp | cut -f2 -d= | cut -f1 -d\') echo $temp ### output: 49.4 ``` Next, 1. Get ...
53,826,432
I have a simple oracle function as below ``` create or replace function get_area( mem_id IN VARCHAR2, P_date DATE DEFAULT SYSDATE) RETURN NUMBER IS v_area_id NUMBER; BEGIN v_area_id := 0; RETURN v_area_id ; end; ``` (its a testing function so just assigning 0 and returning back the variable) We are calling the...
2018/12/18
[ "https://Stackoverflow.com/questions/53826432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2706726/" ]
The module `from django.conf.urls.defaults import *` was removed from Django. You can do: ``` from django.urls import path urlpatterns = path('', (r'^/?$', google.searchengine.views.search), ) ```
`django.conf.urls.defaults` has been removed in Django . If the problem was in your own code, you would fix it by changing the import to ``` from django.urls import include, path urlpatterns = path('', 'google.searchengine.views.search'), ``` )
53,826,432
I have a simple oracle function as below ``` create or replace function get_area( mem_id IN VARCHAR2, P_date DATE DEFAULT SYSDATE) RETURN NUMBER IS v_area_id NUMBER; BEGIN v_area_id := 0; RETURN v_area_id ; end; ``` (its a testing function so just assigning 0 and returning back the variable) We are calling the...
2018/12/18
[ "https://Stackoverflow.com/questions/53826432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2706726/" ]
The module `from django.conf.urls.defaults import *` was removed from Django. You can do: ``` from django.urls import path urlpatterns = path('', (r'^/?$', google.searchengine.views.search), ) ```
the django url dispatcher has changed since django 2.0 ``` from django.urls import path from . import views urlpatterns = [ path('articles/2003/', views.special_case_2003), path('articles/<int:year>/', views.year_archive), path('articles/<int:year>/<int:month>/', views.month_archive), path('articles/...
53,826,432
I have a simple oracle function as below ``` create or replace function get_area( mem_id IN VARCHAR2, P_date DATE DEFAULT SYSDATE) RETURN NUMBER IS v_area_id NUMBER; BEGIN v_area_id := 0; RETURN v_area_id ; end; ``` (its a testing function so just assigning 0 and returning back the variable) We are calling the...
2018/12/18
[ "https://Stackoverflow.com/questions/53826432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2706726/" ]
The module `from django.conf.urls.defaults import *` was removed from Django. You can do: ``` from django.urls import path urlpatterns = path('', (r'^/?$', google.searchengine.views.search), ) ```
Try: ``` from google.searchengine.views import search from django.urls import path urlpatterns = [ path('', search) ] ``` Edit: If you followed the guide I think it would actually be: ``` from searchengine.views import search from django.urls import path urlpatterns = [ path('', search) ] ```
53,826,432
I have a simple oracle function as below ``` create or replace function get_area( mem_id IN VARCHAR2, P_date DATE DEFAULT SYSDATE) RETURN NUMBER IS v_area_id NUMBER; BEGIN v_area_id := 0; RETURN v_area_id ; end; ``` (its a testing function so just assigning 0 and returning back the variable) We are calling the...
2018/12/18
[ "https://Stackoverflow.com/questions/53826432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2706726/" ]
The module `from django.conf.urls.defaults import *` was removed from Django. You can do: ``` from django.urls import path urlpatterns = path('', (r'^/?$', google.searchengine.views.search), ) ```
I guess you have a project called google and app called searchengine, (as per the tutorial) do this, ``` from django.urls import path from . import views urlpatterns = [ path('', views.search, name='search'), ] ```
407,922
I am trying to open the .gdbtable file in QGIS. I have tried: `'open data source' -> vector -> vector databese -> a0000000a.gdbtable -> open` It gives me following error. `a0000000a.gdbtable is not a valid or recognized data source`
2021/08/09
[ "https://gis.stackexchange.com/questions/407922", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/188770/" ]
File geodatabase is not a flat file data source. You cannot point to a single file and have it read by any application (for the reason that the descriptors for the file contents are not present in it). The other 42+ files are critical to the ability to read the file, and the parent directory ***must*** have a suffix of...
Just trying to extend the answer a bit more, and im reading between the lines of what the OP is actually trying to achieve. She mentions 'gdbtable' suggesting that the OP is wanting just the attribute information from the GDB. (im guessing here). As a suggestion - if you have the File Geodatabase open in QGIS, you ca...
9,454
I am submitting a Ph.D. thesis fairly soon and my supervisor has flagged my use of capitalisation in "Section" and "Chapter" as possibly incorrect. I have googled about a bit and I see mixed opinions. So my question is, when writing a computer science Ph.D. thesis, what is the correct way to capitalise "Section", "Cha...
2013/04/17
[ "https://academia.stackexchange.com/questions/9454", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/6838/" ]
> > "In Chapter 3, it was shown that..." > > > This seems correct. "Chapter 3" is the name of the third chapter. Names are capitalised. > > "In the previous Section, a method was presented to..." > > > This seems wrong. "Section" is not referring to the previous section by name, therefore no capital. > > ...
It is a question of style. The most accepted custom is that given by Dave: you capitalize logical divisions if you refer to them by number. However, I've never believed that there is any real logic behind that rule, other than emphasis. Identifying things by a number doesn't make them proper nouns: as an example, you ...
9,454
I am submitting a Ph.D. thesis fairly soon and my supervisor has flagged my use of capitalisation in "Section" and "Chapter" as possibly incorrect. I have googled about a bit and I see mixed opinions. So my question is, when writing a computer science Ph.D. thesis, what is the correct way to capitalise "Section", "Cha...
2013/04/17
[ "https://academia.stackexchange.com/questions/9454", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/6838/" ]
> > "In Chapter 3, it was shown that..." > > > This seems correct. "Chapter 3" is the name of the third chapter. Names are capitalised. > > "In the previous Section, a method was presented to..." > > > This seems wrong. "Section" is not referring to the previous section by name, therefore no capital. > > ...
A search on Google Scholar reveals that both the forms > > in chapter/section 3 > > > and > > in Chapter/Section 3 > > > exist in published scientific articles. For "chapter" the capitalised version seems to be a little more common. For "section" the capitalised version is much more common.
9,454
I am submitting a Ph.D. thesis fairly soon and my supervisor has flagged my use of capitalisation in "Section" and "Chapter" as possibly incorrect. I have googled about a bit and I see mixed opinions. So my question is, when writing a computer science Ph.D. thesis, what is the correct way to capitalise "Section", "Cha...
2013/04/17
[ "https://academia.stackexchange.com/questions/9454", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/6838/" ]
It is a question of style. The most accepted custom is that given by Dave: you capitalize logical divisions if you refer to them by number. However, I've never believed that there is any real logic behind that rule, other than emphasis. Identifying things by a number doesn't make them proper nouns: as an example, you ...
A search on Google Scholar reveals that both the forms > > in chapter/section 3 > > > and > > in Chapter/Section 3 > > > exist in published scientific articles. For "chapter" the capitalised version seems to be a little more common. For "section" the capitalised version is much more common.
2,270
I see there are tags "recommendation" and "recommender-system". My question for discussion is: *Is this on purpose? If not, should we merge them into one, let's say "recommender-system"?* There are 92 questions tagged with "recommendation". There are 59 questions tagged with "recommender-system". There are 12 ques...
2017/05/18
[ "https://datascience.meta.stackexchange.com/questions/2270", "https://datascience.meta.stackexchange.com", "https://datascience.meta.stackexchange.com/users/31513/" ]
Get rid of `recommendation`; it can be construed as an invitation for recommendations, which is a useless tag.
I agree. I did the same thing - untagged questions that weren't about recommender systems, which was only about 10%, and then merged them.
51,157,735
My question is fairly straightforward. I've been trying to write a Cypher query which uses an aggregation function - `min()`. I am trying to obtain the closest node to a particular node using the new Spatial functions offered in Neo4j 3.4. My query currently looks like this: ``` MATCH (a { agency: "Bus", stop_id: "12...
2018/07/03
[ "https://Stackoverflow.com/questions/51157735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4263512/" ]
This should work: ``` MATCH (a { agency: "Bus", stop_id: "1234" }), (b { agency: "Train" }) RETURN a.stop_id AS orig_stop_id, REDUCE( s = NULL, d IN COLLECT({dist: distance(a.location, b.location), sid: b.stop_id}) | CASE WHEN s.dist < d.dist THEN s ELSE {dist: d.dist, dest_stop_id: d.sid} END ) AS ...
You can use COLLECT for aggregation (note this query isn't checked) : ``` MATCH (a { agency: "Bus", stop_id: "1234" }), (b { agency: "Train" }) WITH COLLECT (distance(a.location, b.location)) as distances, a.stop_id as stopId UNWIND distances as distance WITH min(distance) as min, stopId MATCH (bus { agency: "Bus", ...
51,157,735
My question is fairly straightforward. I've been trying to write a Cypher query which uses an aggregation function - `min()`. I am trying to obtain the closest node to a particular node using the new Spatial functions offered in Neo4j 3.4. My query currently looks like this: ``` MATCH (a { agency: "Bus", stop_id: "12...
2018/07/03
[ "https://Stackoverflow.com/questions/51157735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4263512/" ]
Seems like you could skip the aggregation function and just order the distance and take the top: ``` MATCH (a { agency: "Bus", stop_id: "1234" }), (b { agency: "Train" }) WITH distance(a.location, b.location) AS dist, a, b ORDER BY dist DESC LIMIT 1 RETURN a.stop_id as orig_stop_id, b.stop_id AS dest_stop_id, dist `...
You can use COLLECT for aggregation (note this query isn't checked) : ``` MATCH (a { agency: "Bus", stop_id: "1234" }), (b { agency: "Train" }) WITH COLLECT (distance(a.location, b.location)) as distances, a.stop_id as stopId UNWIND distances as distance WITH min(distance) as min, stopId MATCH (bus { agency: "Bus", ...
51,157,735
My question is fairly straightforward. I've been trying to write a Cypher query which uses an aggregation function - `min()`. I am trying to obtain the closest node to a particular node using the new Spatial functions offered in Neo4j 3.4. My query currently looks like this: ``` MATCH (a { agency: "Bus", stop_id: "12...
2018/07/03
[ "https://Stackoverflow.com/questions/51157735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4263512/" ]
This should work: ``` MATCH (a { agency: "Bus", stop_id: "1234" }), (b { agency: "Train" }) RETURN a.stop_id AS orig_stop_id, REDUCE( s = NULL, d IN COLLECT({dist: distance(a.location, b.location), sid: b.stop_id}) | CASE WHEN s.dist < d.dist THEN s ELSE {dist: d.dist, dest_stop_id: d.sid} END ) AS ...
Seems like you could skip the aggregation function and just order the distance and take the top: ``` MATCH (a { agency: "Bus", stop_id: "1234" }), (b { agency: "Train" }) WITH distance(a.location, b.location) AS dist, a, b ORDER BY dist DESC LIMIT 1 RETURN a.stop_id as orig_stop_id, b.stop_id AS dest_stop_id, dist `...
536,975
I am having trouble understanding the behavior of current through an inductor when the direction of applied current is the opposite of what is initially flowing through it. An example is that when an inductor is initially connected to a current source that drives the current clockwise, and then at time t=0, the switch ...
2020/12/12
[ "https://electronics.stackexchange.com/questions/536975", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/270807/" ]
> > *An example is that when an inductor is initially connected to a > current source that drives the current CW* > > > Here's your first problem; connecting an inductor (a pure inductor) to a current source requires that to instantly drive the current, an infinite voltage must be present and things fall apart whe...
Qualitatively, anything that tries to reduce the current in the inductor is also trying to collapse the magnetic field in the inductor. When the magnetic field collapses the energy has to go somewhere and that energy goes towards keeping maintaining current through the inductor as best it can. For example, suddenly in...
536,975
I am having trouble understanding the behavior of current through an inductor when the direction of applied current is the opposite of what is initially flowing through it. An example is that when an inductor is initially connected to a current source that drives the current clockwise, and then at time t=0, the switch ...
2020/12/12
[ "https://electronics.stackexchange.com/questions/536975", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/270807/" ]
The inductor will produce a voltage impulse at the instant the step change in current occurs.
Qualitatively, anything that tries to reduce the current in the inductor is also trying to collapse the magnetic field in the inductor. When the magnetic field collapses the energy has to go somewhere and that energy goes towards keeping maintaining current through the inductor as best it can. For example, suddenly in...
44,886,406
Core-Animation treats angles as described in this image: (image from <http://btk.tillnagel.com/tutorials/rotation-translation-matrix.html>) EDIT: Adding an animated gif to explain better what I'm needing: [![enter image description here](https://i.stack.imgur.com/SWMgZb.png)](https://i.stack.imgur.com/SWMgZb.png)[![e...
2017/07/03
[ "https://Stackoverflow.com/questions/44886406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/913347/" ]
Only a single color =================== If you want to animate the angle of a solid color filled pie segment like the one in your question, then you can do it by animating the `strokeEnd` of a `CAShapeLayer`. The "trick" here is to make a very wide line. More specifically, you can create a path that is just an arc (...
So at last I have found a solution. It took me time to understand that there is **indeed no way to animate the fill** of the shape, but we can trick CA engine by creating a filled circle by making the *stroke* (i.e. the border of the arc) extremely wide, so that it fills the whole circle! ``` extension CGFloat { f...
44,886,406
Core-Animation treats angles as described in this image: (image from <http://btk.tillnagel.com/tutorials/rotation-translation-matrix.html>) EDIT: Adding an animated gif to explain better what I'm needing: [![enter image description here](https://i.stack.imgur.com/SWMgZb.png)](https://i.stack.imgur.com/SWMgZb.png)[![e...
2017/07/03
[ "https://Stackoverflow.com/questions/44886406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/913347/" ]
So at last I have found a solution. It took me time to understand that there is **indeed no way to animate the fill** of the shape, but we can trick CA engine by creating a filled circle by making the *stroke* (i.e. the border of the arc) extremely wide, so that it fills the whole circle! ``` extension CGFloat { f...
I'm adding a slight improvement for David's class. (David - you are welcome to copy into your book-quality answer!) You can add the following init function: ``` convenience init(frame:CGRect, startAngle:CGFloat, endAngle:CGFloat, fillColor:UIColor, strokeColor:UIColor, strokeWidth:CGFloat) { self...
44,886,406
Core-Animation treats angles as described in this image: (image from <http://btk.tillnagel.com/tutorials/rotation-translation-matrix.html>) EDIT: Adding an animated gif to explain better what I'm needing: [![enter image description here](https://i.stack.imgur.com/SWMgZb.png)](https://i.stack.imgur.com/SWMgZb.png)[![e...
2017/07/03
[ "https://Stackoverflow.com/questions/44886406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/913347/" ]
Only a single color =================== If you want to animate the angle of a solid color filled pie segment like the one in your question, then you can do it by animating the `strokeEnd` of a `CAShapeLayer`. The "trick" here is to make a very wide line. More specifically, you can create a path that is just an arc (...
I'm adding a slight improvement for David's class. (David - you are welcome to copy into your book-quality answer!) You can add the following init function: ``` convenience init(frame:CGRect, startAngle:CGFloat, endAngle:CGFloat, fillColor:UIColor, strokeColor:UIColor, strokeWidth:CGFloat) { self...