Search is not available for this dataset
qid
int64
1
74.7M
question
stringlengths
1
70k
date
stringlengths
10
10
metadata
sequence
response_j
stringlengths
0
115k
response_k
stringlengths
0
60.5k
60,428
In my novel there's a diplomatic accident that will deteriorate relationships of two European countries: Germany and Spain. How would e-commerce be affected in case of an embargo between those 2 countries (I'm thinking of Amazon, but also other e-commerce sites)? Would it be possible for someone to sell an item in Germany and buy it in Spain, for example? Are there real examples of problems of this kind? (There is no longer the EU "we know" in the novel; only 3 countries left after 20 years of Referendum for Countrexit)
2016/11/04
[ "https://worldbuilding.stackexchange.com/questions/60428", "https://worldbuilding.stackexchange.com", "https://worldbuilding.stackexchange.com/users/4995/" ]
What is your definition of "genius"? When I think of a genius, I generally think of a great scientist. But there's no reason to believe that a brilliant nuclear physicist would make a good king or president, or that he would make a particularly bad king or president. Knowledge of physics has very little to do with ability to lead a nation. Presumably such a person is generally smarter than the average person, so maybe he wouldn't make the sort of dumb mistakes real leaders do. On the other hand he might know he's smarter than the average person, and he gets egotistical and thinks he knows everything, and so he makes stupid mistakes that someone with practical experience wouldn't have made. Like, suppose we are considering what sort of government assistance to the poor we should have. Some say we are encouraging people to not bother to work and just live off welfare; others say that's a non-issue and only a tiny minority would accept welfare if they could get a decent job. Whose opinion would be more valuable in such a debate: A brilliant nuclear physicist who has spent his life doing research at a prestigious university? Or a waitress making minimum wage who has been on welfare in the past and knows many poor people? But I wouldn't be surprised if the brilliant nuclear physicist gets it in his head that because his IQ is 160 and hers is 85, that he needn't bother listening to her opinion. Are geniuses, as a whole, more or less moral than the average person? Fiction is full of "mad scientists" who think the pursuit of knowledge is more important than the lives of the peasants. And in real life there have certainly been such people: the Nazi scientists who performed barbaric experiments on concentration camp inmates are an extreme but certainly real example. On the other hand there have been medical researchers who devoted their lives to curing disease. And in the middle are many scientists who are absorbed in their work, who don't really care very much about people besides their own friends and family, but who wouldn't be thoughtlessly cruel. Some geniuses get fanatical about their ideas. There have been plenty of political leaders in history who were so devoted to the utopia they wanted to create that they would crush and destroy anyone who stood in their way. They loved humanity so much that they hated people. So all told ... I doubt that genius scientists would be particularly good rulers. I'd be very nervous about genius politicians with visions of utopia. What I'd really like, of course, are rulers who are so smart that they agree with me on all political issues but are more capable at turning them into reality. :-)
I suggest reading Socrates and Plato and their discussion of the advantages of philosopher-kings and rule by the most intelligent. These two thinkers definitely did not believe it would lead to dystopia. But they never had the chance to test their theories.
8,363,790
I am doing this: ``` <form action="processform.php" type="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ``` When the submit button is hit, this is what shows in the address bar of the process page: ``` https://www.domain.com/processform.php?sample=&how=&fields= ```
2011/12/02
[ "https://Stackoverflow.com/questions/8363790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441049/" ]
Change to `<form method="post" />`
The `method` attribute specifies the submission type (e.g. "get" or "post"), but you've used the `type` attribute...and this is incorrect. You need something like: ``` <form action="processform.php" method="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ```
8,363,790
I am doing this: ``` <form action="processform.php" type="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ``` When the submit button is hit, this is what shows in the address bar of the process page: ``` https://www.domain.com/processform.php?sample=&how=&fields= ```
2011/12/02
[ "https://Stackoverflow.com/questions/8363790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441049/" ]
Change to `<form method="post" />`
Your markup is wrong Try ``` <form action="processform.php" method="post"> <input type="text" name="sample" value='VALUE' /> <input type="text" name="how" value='VALUE' /> <label for='fields'>Something</label> <input id='fields' type="checkbox" name="fields" value="Something" /> </form> ```
8,363,790
I am doing this: ``` <form action="processform.php" type="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ``` When the submit button is hit, this is what shows in the address bar of the process page: ``` https://www.domain.com/processform.php?sample=&how=&fields= ```
2011/12/02
[ "https://Stackoverflow.com/questions/8363790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441049/" ]
Change to `<form method="post" />`
`<form action="processform.php" method="post">` `type` needs to be `method`
8,363,790
I am doing this: ``` <form action="processform.php" type="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ``` When the submit button is hit, this is what shows in the address bar of the process page: ``` https://www.domain.com/processform.php?sample=&how=&fields= ```
2011/12/02
[ "https://Stackoverflow.com/questions/8363790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441049/" ]
Change to `<form method="post" />`
change `type="post"` to `method="post"` for starters
8,363,790
I am doing this: ``` <form action="processform.php" type="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ``` When the submit button is hit, this is what shows in the address bar of the process page: ``` https://www.domain.com/processform.php?sample=&how=&fields= ```
2011/12/02
[ "https://Stackoverflow.com/questions/8363790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441049/" ]
change `type="post"` to `method="post"` for starters
The `method` attribute specifies the submission type (e.g. "get" or "post"), but you've used the `type` attribute...and this is incorrect. You need something like: ``` <form action="processform.php" method="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ```
8,363,790
I am doing this: ``` <form action="processform.php" type="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ``` When the submit button is hit, this is what shows in the address bar of the process page: ``` https://www.domain.com/processform.php?sample=&how=&fields= ```
2011/12/02
[ "https://Stackoverflow.com/questions/8363790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441049/" ]
change `type="post"` to `method="post"` for starters
Your markup is wrong Try ``` <form action="processform.php" method="post"> <input type="text" name="sample" value='VALUE' /> <input type="text" name="how" value='VALUE' /> <label for='fields'>Something</label> <input id='fields' type="checkbox" name="fields" value="Something" /> </form> ```
8,363,790
I am doing this: ``` <form action="processform.php" type="post"> <input type="text" name="sample"> <input type="text" name="how"> <input type="checkbox" name="fields" value="fields">Something</input> </form> ``` When the submit button is hit, this is what shows in the address bar of the process page: ``` https://www.domain.com/processform.php?sample=&how=&fields= ```
2011/12/02
[ "https://Stackoverflow.com/questions/8363790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441049/" ]
change `type="post"` to `method="post"` for starters
`<form action="processform.php" method="post">` `type` needs to be `method`
267,536
This is a follow-up from this [question](https://movies.stackexchange.com/questions/118433/how-did-voyager-know-the-pilot-was-a-he) over on Movies/TV Stack Exchange. In [my answer to that question](https://movies.stackexchange.com/a/118434/18230), I speculate that it's not a stretch to imagine that sensors sophisticated enough to be capable of detecting *life signs* (which itself is just a convenient plot device anyway) are also capable of detecting biological sex of those life signs. Now of course, not all species have the same concept of biological sex, which has been shown in canon. So the sensors are only going to be able to make a best guess, based on some sort of probability determination, which could also include failing to make a determination whatsoever. I feel like I remember hearing dialog reminiscent of "I'm detecting male life signs", or "I'm detecting female life signs", etc in the past. But it's possible I'm just confusing it with species life signs ("Human" vs "Klingon" life signs, etc). Prior to [Vis à Vis](https://en.wikipedia.org/wiki/Vis_%C3%A0_Vis_(Star_Trek:_Voyager)), has it been established in canon that sensors can distinguish, or at least guess at, the biological sex of a life sign? Even an example post that episode would be useful, if we could infer that the technology would have existed in Voyager's time. Supplementary information from sources like the Technical Manuals would also be acceptable.
2022/09/08
[ "https://scifi.stackexchange.com/questions/267536", "https://scifi.stackexchange.com", "https://scifi.stackexchange.com/users/73478/" ]
In a word, yes. We've seen at least one other occasion when the sensors are used to pick out a particular *gender* > > **JANEWAY:** *On screen.* > > > **KIM:** *Showing one life sign, **adult Kazon male**. He's in critical condition.* > > > **JANEWAY:** *Janeway to Sickbay. Prepare to receive an emergency transport.* > > > [VOY: Basics, Part 1](http://www.chakoteya.net/Voyager/222.htm) > > > As to the capacity of the sensors, we're told in the [TNG Technical Manual](https://memory-alpha.fandom.com/wiki/Star_Trek:_The_Next_Generation_Technical_Manual) that they can ascertain the 'gross' structure of a bioform. I'd assume that if you're particularly close that it's possible that an adult male or female is sufficiently different to allow them to be distinguished. > > **Remote lifeform analysis.** A sophisticated array of charged cluster > quark resonance scanners provide detailed biological data across > orbital distances. When used in conjunction with optical and chemical > analysis sensors, **the lifeform analysis software is typically able to > extrapolate a bioform's gross structure** and deduce the basic chemical > composition. > > > Additionally, we have multiple instances within the Extended Universe novels where the sensors have picked out a particular individual by their sex > > "O’Brien looked at Sloan for confirmation. The lean, fair-haired man checked his console, then nodded at O’Brien. **“One life sign, Cardassian female.** The ship’s clean" > > > [ST - Mirror Universe: Rise Like Lions](https://memory-beta.fandom.com/wiki/Rise_Like_Lions) > > > and > > It’d been more than five years, but Miles O’Brien worked the Defiant’s console like he hadn’t missed a day. “In the chamber adjacent to you, I’m reading nine Bajorans, three Cardassians, and **two humans—one child, one adult female** —but I can’t get a lock on them. There’s some kind of force field around them preventing transport.” > > > [Strange New Worlds (2016)](https://memory-beta.fandom.com/wiki/Strange_New_Worlds_2016) > > > --- That all being said, we also have a couple of instances where someone has been detected by sensors and it's then *assumed* by the crew that they're male, for example in *VOY: Vis à Vis*, but also in *TNG: Lower Decks.* > > **TAURIK:** *Bio readings indicate that passenger's humanoid. Attempting life form identification.* > > > **LAFORGE:** *No one told you to do that, Ensign. Let's just get **him** aboard safely. There, that should do it.* > > > [TNG: Lower Decks](http://www.chakoteya.net/NextGen/267.htm) > > > In this case Geordi is making an assumption about the identity of the occupant but doesn't have proof-positive that it's who he thinks it is. You need to refer to them as *something*, and it's as good one way as the other.
I think it is safe to depend on the sensor. I would expect a tricorder can tell you roughly what is nearby and a ship's a near range can identify individuals if necessary. Note [the transcript](http://www.chakoteya.net/StarTrek/59.htm) of *Star Trek: The Enterprise Incident* (Season 3, Episode 2). > > **Chekov**: You're alive! > > > **Uhura**: They said you'd been killed, sir. > > > **Kirk**: The report was premature. > > > **Chekov**: Captain, your ears. What happened? > > > **Kirk**: We'll discuss it later. Mister Sulu, lay in a course for home. Mister Chekov, take the sensors. Mister Spock is still aboard the Romulan flagship. I want his body readings pinpointed and isolated. That was not a request, gentlemen. > > > **Chekov**: Aye, sir. > > > **[Bridge]** > > > **Kirk**: Mister Chekov, there's only one Vulcan aboard that ship. He should be easy enough to locate. > > > **Chekov**: Romulans and Vulcans appear to read almost exactly alike. There is just a slight difference which. Got him, sir. > > > **Kirk**: Feed the co-ordinates to the transporter room on the double. Have them prepare to beam him aboard on my signal. > > >
26,885,665
it is such that I must have built such that when kommmer into articles that sends up the database +1 each time you load the page, I have done like this: ``` int id = Convert.ToInt32(Request.QueryString["Id"]); string viewSet = "1"; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "UPDATE Artikler SET viewSet = @viewSet++1 WHERE Id = @id;"; cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@viewSet", viewSet); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); ``` **comes nothing into the database**
2014/11/12
[ "https://Stackoverflow.com/questions/26885665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4190980/" ]
Let's break this down piece by piece. First of all the command is commented out so it won't run until you remove the starting `#` ``` chkCount=`ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l` ``` The output of the command `ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l` will be stored in the variable `chkCount`. `grep -i "File_Transfer.sh"` looks for lines containing "File\_Transfer.sh" but grep will ignore the case of the string. That means that grep will match "File\_Transfer.sh", "File\_TRANSFER.SH", or any other combination. `grep -v grep` will match any line that DOESN'T contain the word `grep`. `-v` inverts the match. The purpose of this is to eliminate the command you issued. In other words `ps` will list a process called `File_Transer.sh` and it will list your command `ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l`. `grep -v` will ignore `ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l` and just match any process matching `File_Transfer.sh` Lastly, `wc -l` will count the number of lines fed into `wc`. So the result will be the number of processes running that matches "File\_Transfer.sh"
This line lists all running processes and filters lines that include "File\_Transfer.sh". The output is then further filtered to remove lines that include "grep", since the grep command itself will show up as a running process with the text "File\_Transfer.sh". wc -l counts how many lines found.
26,885,665
it is such that I must have built such that when kommmer into articles that sends up the database +1 each time you load the page, I have done like this: ``` int id = Convert.ToInt32(Request.QueryString["Id"]); string viewSet = "1"; SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString()); SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "UPDATE Artikler SET viewSet = @viewSet++1 WHERE Id = @id;"; cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@viewSet", viewSet); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); ``` **comes nothing into the database**
2014/11/12
[ "https://Stackoverflow.com/questions/26885665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4190980/" ]
Let's break this down piece by piece. First of all the command is commented out so it won't run until you remove the starting `#` ``` chkCount=`ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l` ``` The output of the command `ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l` will be stored in the variable `chkCount`. `grep -i "File_Transfer.sh"` looks for lines containing "File\_Transfer.sh" but grep will ignore the case of the string. That means that grep will match "File\_Transfer.sh", "File\_TRANSFER.SH", or any other combination. `grep -v grep` will match any line that DOESN'T contain the word `grep`. `-v` inverts the match. The purpose of this is to eliminate the command you issued. In other words `ps` will list a process called `File_Transer.sh` and it will list your command `ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l`. `grep -v` will ignore `ps -aef | grep -i "File_Transfer.sh"|grep -v grep| wc -l` and just match any process matching `File_Transfer.sh` Lastly, `wc -l` will count the number of lines fed into `wc`. So the result will be the number of processes running that matches "File\_Transfer.sh"
Multiple use of grep (in a piped combination like this) is like a two-stage filter; whatever lines are passed from the first instance will be filtered again according to the second instance's arguments. In this case, the result of `ps -aef` is piped to grep, which does a case-insensitive search for "File\_Transfer.sh"; then all the lines output by grep are fed to grep again, which passes all lines that don't contain `grep` (-v means "invert match", look for what doesn't match, rather than what does) to wc -- at the end, the final result (a count of occurrences) is assigned to variable chkCount.
44,710,489
I would like to know if it is possible to loop through a list of values in SimpleTemplateEngine groovy. For example: ``` def values = [ "1", "2", "3" ] def engine = new groovy.text.SimpleTemplateEngine() def text = '''\ ??? ''' def template = engine.createTemplate(text).make(values) println template.toString() ``` How can I get: ``` 1 2 3 ``` by changing the variable `text`?
2017/06/22
[ "https://Stackoverflow.com/questions/44710489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161012/" ]
Did you mean? ``` def values = [ "1", "2", "3" ] def engine = new groovy.text.SimpleTemplateEngine() def text = ''' ${values.each { println it} } ''' println engine.createTemplate(text).make([values: values]) ```
``` def values = [ "1", "2", "3" ] def engine = new groovy.text.SimpleTemplateEngine() def text = '''<% values.each { println it} %>''' println engine.createTemplate(text).make([values: values]) ```
44,710,489
I would like to know if it is possible to loop through a list of values in SimpleTemplateEngine groovy. For example: ``` def values = [ "1", "2", "3" ] def engine = new groovy.text.SimpleTemplateEngine() def text = '''\ ??? ''' def template = engine.createTemplate(text).make(values) println template.toString() ``` How can I get: ``` 1 2 3 ``` by changing the variable `text`?
2017/06/22
[ "https://Stackoverflow.com/questions/44710489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161012/" ]
Did you mean? ``` def values = [ "1", "2", "3" ] def engine = new groovy.text.SimpleTemplateEngine() def text = ''' ${values.each { println it} } ''' println engine.createTemplate(text).make([values: values]) ```
if you want an elegant template without many quotes and without a lot of imperative programming, you can do the following ``` def text = ''' <% for (item in values) { %> <%= item %> <% } %> ''' ``` The rule is simple: * Use `<%= ..%>` if there is rendering of value. * Use `<% .. %>` if there is flow control handling ( if/else, for loop,... )
44,710,489
I would like to know if it is possible to loop through a list of values in SimpleTemplateEngine groovy. For example: ``` def values = [ "1", "2", "3" ] def engine = new groovy.text.SimpleTemplateEngine() def text = '''\ ??? ''' def template = engine.createTemplate(text).make(values) println template.toString() ``` How can I get: ``` 1 2 3 ``` by changing the variable `text`?
2017/06/22
[ "https://Stackoverflow.com/questions/44710489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/161012/" ]
``` def values = [ "1", "2", "3" ] def engine = new groovy.text.SimpleTemplateEngine() def text = '''<% values.each { println it} %>''' println engine.createTemplate(text).make([values: values]) ```
if you want an elegant template without many quotes and without a lot of imperative programming, you can do the following ``` def text = ''' <% for (item in values) { %> <%= item %> <% } %> ''' ``` The rule is simple: * Use `<%= ..%>` if there is rendering of value. * Use `<% .. %>` if there is flow control handling ( if/else, for loop,... )
195,005
Context ======= I'm trying to use [AMC](http://home.gna.org/auto-qcm/) to produce an exam with code in it. However, the use of [verbatim code inside the questions is beyond the scope of the package](http://project.auto-multiple-choice.net/projects/auto-multiple-choice/wiki/Verbatim_inside_questions). They suggest to declare boxes and used them inside each question. But, I found problematic to create a `\newbox` per question and insert it by hand. Thus, I searched for a solution on how to create and insert boxes automatically (following [this question](https://tex.stackexchange.com/questions/73120/savebox-equivalent-of-csname) and [this answer](https://tex.stackexchange.com/a/46477/7561)). Problem ======= But now, I'm stuck with the expansion of the macros. As the macro I'm using inserts always the last created box. As it seems that the AMC package post processes all the elements (questions) in the `\onecopy` macro, and it expands my macro `\insertbox` then. However, I need to insert the expanded version of the macro in every element, in order to insert the expanded name of the box I created. Thus, how can I expand the definition of the box and insert it in each question? I tried to store the `\savebox` definition in another macro an insert it after, using `\edef` but that doesn't work either. I will like to redefine `\insertbox` in such a way that is expanded with the name of the temporal box I created, instead of being expanded until the call of `\onecopy`. Code ==== ``` \documentclass{article} \usepackage[box]{automultiplechoice} \usepackage{listings} % a simple wrapper to create boxes automatically \makeatletter \newcounter{myboxcounter} \newenvironment{mybox}{% \addtocounter{myboxcounter}{1}% \expandafter\newsavebox\csname foobox\roman{myboxcounter}\endcsname \global\expandafter\setbox\csname foobox\roman{myboxcounter}\endcsname\hbox\bgroup\color@setgroup\ignorespaces }{% \color@endgroup\egroup } % first try % \newcommand{\insertbox}{\expandafter\usebox\csname\name\endcsname} % second one \newcommand{\insertbox}{\edef\name{foobox\roman{myboxcounter}}\edef\x{\expandafter\usebox\csname\name\endcsname}\x} \makeatother \begin{document} %%% preparation of the groups \begin{mybox} \begin{lstlisting}[language=C++] int a = 10; a = a + 10; \end{lstlisting} \end{mybox} \element{code}{ \begin{question}{code 1} Which is the result of \texttt{a}? \insertbox \begin{choices} \correctchoice{10} \wrongchoice{20} \wrongchoice{0} \wrongchoice{30} \end{choices} \end{question} } \begin{mybox} \begin{lstlisting}[language=C++] int a = 10; a = a++; \end{lstlisting} \end{mybox} \element{code}{ \begin{question}{code 2} Which is the result of \texttt{a}? \insertbox \begin{choices} \correctchoice{10} \wrongchoice{11} \wrongchoice{12} \wrongchoice{0} \end{choices} \end{question} } %%% copies \onecopy{1}{ \insertgroup{code} } \end{document} ``` As you can see in the image below, both inserted codes belong to the last box created. As the macro seems to expand later, instead of when called in the `\element` macro. ![enter image description here](https://i.stack.imgur.com/MojIc.jpg)
2014/08/05
[ "https://tex.stackexchange.com/questions/195005", "https://tex.stackexchange.com", "https://tex.stackexchange.com/users/7561/" ]
I suspect the shadowing uses PDF features, which are not available in PostScript. From the documentations, [`pgf-blur`](http://mirrors.ctan.org/graphics/pgf/contrib/pgf-blur/pgf-blur.pdf): > > This effect can be achieved in TikZ/PGF with the circular drop shadow > key, > > > And from the [PGF manual](http://mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf): > > In addition to the general `shadow` option, there exist special options > like `circular shadow`. These can only (sensibly) be used with a special > kind of path (for `circular shadow`, a circle) and, thus, they are not > as general. The advantage is, however, that they are more visually > pleasing since these shadows blend smoothly with the background. Note > that these special shadows use fadings, which few printers will > support. > > > Export the image as PDF and pdfTeX can include it directly without the need to run a converter for the down-graded PostScript file (the conversion is actually done by ghostscript).
I solved this problem (so happy, and I share): Step 1: Remove the entire MikTeX exists on your computer using the Control Panel, after removing deleted folder named MikTeX in C:\ Program files (x86 ) to avoid errors when resetting because the same name folder (uninstall is complete without restarting the computer) Step 2: Reinstall the MikTeX below (no need to install the program editor as texstudio, Texmaker, viettex, ...), this error is due to foundation MikTeX MikTeX file download link: click [here](http://www.mediafire.com/file/bnv2g6paahb91vh/MikTex_2.8_NHC.rar/file) After downloading, you unzip. Installation file named setup-2.8.3553.exe in directory MikTeX /setup Step 3: Install the file setup-2.8.3553.exe as usual, remember to tick select Complete MikTeX to install the full version. Note when using: Note 1: The order declaring the package ordered to order from top to bottom as follows: \ usepackage {graphicx} \ usepackage {epstopdf} \ usepackage {subfigure} Note 2: Before running TeX files, please ensure that you have deleted the corrupted PDF files are output from run error before (just leave a tail .eps image file) Please vote me if it works !!!! Coppy right: <https://nhcan.wordpress.com/2020/04/05/loi-khi-bien-dich-file-latex-co-hinh-anh-dinh-dang-eps/>
169,934
So I recently did my PhD project approval which is the process where I agree my objectives with my supervisor and present a short overview to a review panel. All that went well and my project has been approved and I can finally make a start on the work I need to do. I'm feeling a bit swamped and unsure about how to proceed tackling the objectives we need to achieve and this has left me feeling quite overwhelmed and overworked. My supervisor sent me a one line email last week basically saying "do objective 1 now" but I wanted to spend some time with them discussing the theory and devising a suitable way to do this objective. I know it's all about independent work but I feel I could benefit from a short meeting just to straighten up my work plan and ensure we're both on the same page. To clarify, the problem isn't that I don't understand the theory- I just need to clarify what my workplan should look like. Would I be dumb if I asked for a sit down to talk through the objectives and clarify what I should be working on? I feel very out of my depth
2021/06/14
[ "https://academia.stackexchange.com/questions/169934", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/134761/" ]
No, it would not be dumb: it is absolutely crucial for you and your supervisor to have clear expectations about each other, as early as possible. It is well-known that the majority of problems during a PhD result from miscommunications between student and supervisor. So send your supervisor an email as soon as possible, saying something to the effect of (note: check transitionsynthesis' comment below this post): "I apologize if this is burdensome, but I sincerely feel like I need to have a short meeting with you in this early phase to help clarify my workplan, because I've been struggling with it recently". I'm very confident that your supervisor will be 100% fine (unless they are the kind of people who abandon their students from day one, in which case you should not have selected them as supervisors in the first place). I also strongly recommend you to read as soon as possible the book "How to get a PhD: A Handbook for Students and their Supervisors" by Estelle Phillips, which will be of great help to you.
In a **worst-case** scenario, your choice is between * asking your question and looking dumb now **or** * not asking your question and looking much dumber later, after you've wasted time going in and out of dead-ends I would always opt for the first choice, except for one catch: It's a good idea to spend *some* time trying to figure out a questions by yourself. Not so much to avoid looking bad in front of your supervisor (best to leave behind such a debilitating attitude), but because every interesting question is a learning opportunity. However, here's a more **realistic scenario**: Your particular question seems to be one where you need high-level guidance by someone with practical research experience. You can't possibly acquire that kind of knowledge on your own by a few weeks of reading and poking. That is why you have a supervisor. Also, your supervisor is an adult, and **"no" is a full sentence**. If they think your question is not for them to answer, they will (should at least) simply tell you, without thinking badly of you. That's how you learn which questions to ask and which ones to solve alone.
25,519,222
I need to set all elements with a specific class to have a certain background-color. Here is my code: ``` /*var elements = $(".km-flat"); var elements1 = $(".km-view"); var elements2 = $(".km-navbar"); var elements3 = $(".km-content"); elements.style.background-color = "red"; elements1.style.background-color = "red"; elements2.style.background-color = "red"; elements3.style.background-color = "red";*/ var myElements = document.querySelectorAll(".km-content"); for (var i = 0; i < myElements.length; i++) { myElements[i].style.background-color = "red"; } ``` As you can see my first attempt was no good and is commented out. My second attempt is saying `Uncaught ReferenceError: Invalid left-hand side in assignment javascript`. What syntax should I be using? Thanks.
2014/08/27
[ "https://Stackoverflow.com/questions/25519222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3935156/" ]
You cannot use `-`, say like bellow ``` myElements[i].style.backgroundColor = "red"; ``` OR ``` myElements[i].style["background-color"] = "red"; ``` **NOTE:-** If you will go through the comments bellow, you'll get to know the second way gives some problem in FF.
Here's the code that works: ``` var myElements = document.querySelectorAll(".km-content"); for (var i = 0; i < myElements.length; i++) { myElements[i].style.backgroundColor = "red"; } ```
9,943,119
*Context: I was discussing C# vs. Java at work when the following question came up, and I wondered how (or if) it could be elegantly resolved in C++.* Let's say you have two classes `A` and `B` (whose details are not important) and then two templated class `G` and `H` described as something like: ``` template <typename T> | template <typename T> class G | class H { | { public : | public : T * foo() ; | virtual T * foo() = 0 ; // etc. | // etc. } ; | } ; ``` Then we have the class `C` and `D` described like: ``` class A { /* ... */ } ; class B { /* ... */ } ; class C : public G<A>, public G<B> { } ; class D : public H<A>, public H<B> { // ??? } ; ``` I want to be able to call for `C` the method `foo` from `G<A>` and foo from `G<B>`. And I want to be able to override for `D` the method `foo` from `H<A>` and `H<B>`. In the end, I want to be able to use C and D like in the following examples: ``` C c ; A * a = c.??? ; (I want to call G<A>::foo()) B * b = c.??? ; (I want to call G<B>::foo()) D d ; A * a = c.??? ; (I want to call H<A>::foo()) B * b = c.??? ; (I want to call H<B>::foo()) ``` There always are ways to do it (and I have some ideas), but I'm interested a list of elegant and safe ways to do it, including pros/cons. So, **how would you do it?**
2012/03/30
[ "https://Stackoverflow.com/questions/9943119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14089/" ]
The two ways I can think of: ``` C x; x.G<A>::foo(); // 1 static_cast<G<A>&>(x).foo(); // 2 ``` That is: either explicitly qualifying the function’s name, or upcast in the type hierarchy.
How about, overloading and using different arguments : ``` template <typename T> class G { public: T * foo(T &a) {/* ... */}; // etc. }; class A { public: /* ... */ }; class B { public: /* ... */ }; class C : public G<A>, public G<B> { public: using G<A>::foo; using G<B>::foo; }; int main() { C c; A a; B b; c.foo(a); c.foo(b); return 0; } ```
26,538,636
I'd like to write a regular expression for following type of strings in Pyhton: > > 1 100 > > > 1 567 865 > > > 1 474 388 346 > > > i.e. numbers separated from thousand. Here's my regexp: > > r"(\d{1,3}(?:\s\*\d{3})\*) > > > and it works fine. However, I also wanna parse > > 1 100,34848 > > > 1 100 300,8 > > > 19 328 383 334,23499 > > > i.e. separated numbers with decimal digits. I wrote > > rr=r"(\d{1,3}(?:\s\*\d{3})\*)(,\d+)?\s > > > It doesn't work. For instance, if I make > > sentence = "jsjs 2 222,11 dhd" > > > re.findall(rr, sentence) > > > [('2 222', ',11')] > > > Any help appreciated, thanks.
2014/10/23
[ "https://Stackoverflow.com/questions/26538636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4175888/" ]
How about ``` SELECT COUNT(*) FROM (SELECT DISTINCT * FROM Table) ```
I think you want a count of all distinct rows from a table like this ``` select count(1) as c from ( select distinct * from tbl ) distinct_tbl; ```
26,538,636
I'd like to write a regular expression for following type of strings in Pyhton: > > 1 100 > > > 1 567 865 > > > 1 474 388 346 > > > i.e. numbers separated from thousand. Here's my regexp: > > r"(\d{1,3}(?:\s\*\d{3})\*) > > > and it works fine. However, I also wanna parse > > 1 100,34848 > > > 1 100 300,8 > > > 19 328 383 334,23499 > > > i.e. separated numbers with decimal digits. I wrote > > rr=r"(\d{1,3}(?:\s\*\d{3})\*)(,\d+)?\s > > > It doesn't work. For instance, if I make > > sentence = "jsjs 2 222,11 dhd" > > > re.findall(rr, sentence) > > > [('2 222', ',11')] > > > Any help appreciated, thanks.
2014/10/23
[ "https://Stackoverflow.com/questions/26538636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4175888/" ]
How about ``` SELECT COUNT(*) FROM (SELECT DISTINCT * FROM Table) ```
``` SELECT DISTINCT **col_name**, count(*) FROM **table_name** group by **col_name** ```
26,538,636
I'd like to write a regular expression for following type of strings in Pyhton: > > 1 100 > > > 1 567 865 > > > 1 474 388 346 > > > i.e. numbers separated from thousand. Here's my regexp: > > r"(\d{1,3}(?:\s\*\d{3})\*) > > > and it works fine. However, I also wanna parse > > 1 100,34848 > > > 1 100 300,8 > > > 19 328 383 334,23499 > > > i.e. separated numbers with decimal digits. I wrote > > rr=r"(\d{1,3}(?:\s\*\d{3})\*)(,\d+)?\s > > > It doesn't work. For instance, if I make > > sentence = "jsjs 2 222,11 dhd" > > > re.findall(rr, sentence) > > > [('2 222', ',11')] > > > Any help appreciated, thanks.
2014/10/23
[ "https://Stackoverflow.com/questions/26538636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4175888/" ]
How about ``` SELECT COUNT(*) FROM (SELECT DISTINCT * FROM Table) ```
It depends on what you are trying to accomplish. To get a count of the distinct rows by specific column, so that you know what data exists, and how many of that distinct data there are: ``` SELECT DISTINCT A_CODE, COUNT(*) FROM MY_ARCHV GROUP BY A_CODE ``` --This informs me there are 93 unique codes, and how many of each of those codes there are. Another method --How to count how many of a type value exists in an oracle table: `select A_CDE`, --the value you need to count `count(*) as numInstances` --how many of each value `from A_ARCH` -- the table where it resides `group by A_CDE` -- sorting method Either way, you get something that looks like this: ``` A_CODE Count(*) 1603 32 1600 2 1605 14 ```
26,538,636
I'd like to write a regular expression for following type of strings in Pyhton: > > 1 100 > > > 1 567 865 > > > 1 474 388 346 > > > i.e. numbers separated from thousand. Here's my regexp: > > r"(\d{1,3}(?:\s\*\d{3})\*) > > > and it works fine. However, I also wanna parse > > 1 100,34848 > > > 1 100 300,8 > > > 19 328 383 334,23499 > > > i.e. separated numbers with decimal digits. I wrote > > rr=r"(\d{1,3}(?:\s\*\d{3})\*)(,\d+)?\s > > > It doesn't work. For instance, if I make > > sentence = "jsjs 2 222,11 dhd" > > > re.findall(rr, sentence) > > > [('2 222', ',11')] > > > Any help appreciated, thanks.
2014/10/23
[ "https://Stackoverflow.com/questions/26538636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4175888/" ]
I think you want a count of all distinct rows from a table like this ``` select count(1) as c from ( select distinct * from tbl ) distinct_tbl; ```
``` SELECT DISTINCT **col_name**, count(*) FROM **table_name** group by **col_name** ```
26,538,636
I'd like to write a regular expression for following type of strings in Pyhton: > > 1 100 > > > 1 567 865 > > > 1 474 388 346 > > > i.e. numbers separated from thousand. Here's my regexp: > > r"(\d{1,3}(?:\s\*\d{3})\*) > > > and it works fine. However, I also wanna parse > > 1 100,34848 > > > 1 100 300,8 > > > 19 328 383 334,23499 > > > i.e. separated numbers with decimal digits. I wrote > > rr=r"(\d{1,3}(?:\s\*\d{3})\*)(,\d+)?\s > > > It doesn't work. For instance, if I make > > sentence = "jsjs 2 222,11 dhd" > > > re.findall(rr, sentence) > > > [('2 222', ',11')] > > > Any help appreciated, thanks.
2014/10/23
[ "https://Stackoverflow.com/questions/26538636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4175888/" ]
It depends on what you are trying to accomplish. To get a count of the distinct rows by specific column, so that you know what data exists, and how many of that distinct data there are: ``` SELECT DISTINCT A_CODE, COUNT(*) FROM MY_ARCHV GROUP BY A_CODE ``` --This informs me there are 93 unique codes, and how many of each of those codes there are. Another method --How to count how many of a type value exists in an oracle table: `select A_CDE`, --the value you need to count `count(*) as numInstances` --how many of each value `from A_ARCH` -- the table where it resides `group by A_CDE` -- sorting method Either way, you get something that looks like this: ``` A_CODE Count(*) 1603 32 1600 2 1605 14 ```
I think you want a count of all distinct rows from a table like this ``` select count(1) as c from ( select distinct * from tbl ) distinct_tbl; ```
26,538,636
I'd like to write a regular expression for following type of strings in Pyhton: > > 1 100 > > > 1 567 865 > > > 1 474 388 346 > > > i.e. numbers separated from thousand. Here's my regexp: > > r"(\d{1,3}(?:\s\*\d{3})\*) > > > and it works fine. However, I also wanna parse > > 1 100,34848 > > > 1 100 300,8 > > > 19 328 383 334,23499 > > > i.e. separated numbers with decimal digits. I wrote > > rr=r"(\d{1,3}(?:\s\*\d{3})\*)(,\d+)?\s > > > It doesn't work. For instance, if I make > > sentence = "jsjs 2 222,11 dhd" > > > re.findall(rr, sentence) > > > [('2 222', ',11')] > > > Any help appreciated, thanks.
2014/10/23
[ "https://Stackoverflow.com/questions/26538636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4175888/" ]
It depends on what you are trying to accomplish. To get a count of the distinct rows by specific column, so that you know what data exists, and how many of that distinct data there are: ``` SELECT DISTINCT A_CODE, COUNT(*) FROM MY_ARCHV GROUP BY A_CODE ``` --This informs me there are 93 unique codes, and how many of each of those codes there are. Another method --How to count how many of a type value exists in an oracle table: `select A_CDE`, --the value you need to count `count(*) as numInstances` --how many of each value `from A_ARCH` -- the table where it resides `group by A_CDE` -- sorting method Either way, you get something that looks like this: ``` A_CODE Count(*) 1603 32 1600 2 1605 14 ```
``` SELECT DISTINCT **col_name**, count(*) FROM **table_name** group by **col_name** ```
69,268,010
good day. There is a code for generating passwords. ```vb Dim i_keys As Integer Dim numKeys As Integer = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim stringChars = New Char(7) {} Dim random = New Random() For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i Dim finalString = New String(stringChars) For i_keys = 1 To numKeys ListBox1.Items.Add(finalString) Next ``` But as a result, I get the following: ``` 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf ``` Tell me how you can make it so that you get 10 random (not repeated) passwords at the output.
2021/09/21
[ "https://Stackoverflow.com/questions/69268010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15895460/" ]
You need the last loop to encompass a bit more code. ``` Dim i_keys As Integer Dim numKeys As Integer = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim random = New Random() For i_keys = 1 To numKeys Dim stringChars = New Char(7) {} For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i Dim finalString = New String(stringChars) ListBox1.Items.Add(finalString) Next ```
Your password generator is outside of the loop. This code is not very elegant but here you go (including a check if the password is unique): ``` Dim i_keys As Integer Dim numKeys As Integer = 10 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim stringChars = New Char(7) {} Dim random = New Random() Dim finalString = New String(stringChars) For i_keys = 1 To numKeys For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i finalString = New String(stringChars) If ListBox1.Items.Contains(finalString) then i_keys = i_keys -1 else ListBox1.Items.Add(finalString) End if Next ``` Please try using datatypes like List(Of String) instead.
69,268,010
good day. There is a code for generating passwords. ```vb Dim i_keys As Integer Dim numKeys As Integer = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim stringChars = New Char(7) {} Dim random = New Random() For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i Dim finalString = New String(stringChars) For i_keys = 1 To numKeys ListBox1.Items.Add(finalString) Next ``` But as a result, I get the following: ``` 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf ``` Tell me how you can make it so that you get 10 random (not repeated) passwords at the output.
2021/09/21
[ "https://Stackoverflow.com/questions/69268010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15895460/" ]
You need the last loop to encompass a bit more code. ``` Dim i_keys As Integer Dim numKeys As Integer = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim random = New Random() For i_keys = 1 To numKeys Dim stringChars = New Char(7) {} For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i Dim finalString = New String(stringChars) ListBox1.Items.Add(finalString) Next ```
The work can be done in one line of LINQ, using Enumerable.Range and Select in place of the loops. ```vb Dim numKeys = 8 Dim numChars = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim rnd = New Random() Dim result = Enumerable.Range(0, numKeys).Select(Function(i) New String(Enumerable.Range(0, numChars).Select(Function(j) chars(rnd.Next(chars.Length))).ToArray())) ListBox1.DataSource = result.ToArray() ```
69,268,010
good day. There is a code for generating passwords. ```vb Dim i_keys As Integer Dim numKeys As Integer = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim stringChars = New Char(7) {} Dim random = New Random() For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i Dim finalString = New String(stringChars) For i_keys = 1 To numKeys ListBox1.Items.Add(finalString) Next ``` But as a result, I get the following: ``` 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf ``` Tell me how you can make it so that you get 10 random (not repeated) passwords at the output.
2021/09/21
[ "https://Stackoverflow.com/questions/69268010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15895460/" ]
See inline comments. The first method employs the .net random number generator. The second method the .net `Guid` which stands for Global Unique Identifier. I think either of these methods would be adequate for your purposes. Since we are truncating the `Guid`, the guaranteed uniqueness dissapears. ``` Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim random = New Random() Dim charsLength = chars.Length 'Resove this once outside the loop Dim sb As New StringBuilder Dim lst As New List(Of String) For p = 0 To 9 'Number of passwords to put into ListBox is 10 For i = 0 To 7 'password length is 8 sb.Append(chars(random.Next(charsLength))) 'Next Next lst.Add(sb.ToString) sb.Clear() Next ListBox1.Items.AddRange(lst.ToArray) 'Update the user interface once after the loop End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim lst As New List(Of String) For i = 0 To 9 'Number of passwords Dim pWord = Guid.NewGuid().ToString.Substring(0, 8) lst.Add(pWord) Next ListBox1.Items.AddRange(lst.ToArray) End Sub ```
Your password generator is outside of the loop. This code is not very elegant but here you go (including a check if the password is unique): ``` Dim i_keys As Integer Dim numKeys As Integer = 10 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim stringChars = New Char(7) {} Dim random = New Random() Dim finalString = New String(stringChars) For i_keys = 1 To numKeys For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i finalString = New String(stringChars) If ListBox1.Items.Contains(finalString) then i_keys = i_keys -1 else ListBox1.Items.Add(finalString) End if Next ``` Please try using datatypes like List(Of String) instead.
69,268,010
good day. There is a code for generating passwords. ```vb Dim i_keys As Integer Dim numKeys As Integer = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim stringChars = New Char(7) {} Dim random = New Random() For i As Integer = 0 To stringChars.Length - 1 stringChars(i) = chars.Chars(random.Next(chars.Length)) Next i Dim finalString = New String(stringChars) For i_keys = 1 To numKeys ListBox1.Items.Add(finalString) Next ``` But as a result, I get the following: ``` 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf 0EbrQ4Pf ``` Tell me how you can make it so that you get 10 random (not repeated) passwords at the output.
2021/09/21
[ "https://Stackoverflow.com/questions/69268010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15895460/" ]
See inline comments. The first method employs the .net random number generator. The second method the .net `Guid` which stands for Global Unique Identifier. I think either of these methods would be adequate for your purposes. Since we are truncating the `Guid`, the guaranteed uniqueness dissapears. ``` Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim random = New Random() Dim charsLength = chars.Length 'Resove this once outside the loop Dim sb As New StringBuilder Dim lst As New List(Of String) For p = 0 To 9 'Number of passwords to put into ListBox is 10 For i = 0 To 7 'password length is 8 sb.Append(chars(random.Next(charsLength))) 'Next Next lst.Add(sb.ToString) sb.Clear() Next ListBox1.Items.AddRange(lst.ToArray) 'Update the user interface once after the loop End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Dim lst As New List(Of String) For i = 0 To 9 'Number of passwords Dim pWord = Guid.NewGuid().ToString.Substring(0, 8) lst.Add(pWord) Next ListBox1.Items.AddRange(lst.ToArray) End Sub ```
The work can be done in one line of LINQ, using Enumerable.Range and Select in place of the loops. ```vb Dim numKeys = 8 Dim numChars = 8 Dim chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*" Dim rnd = New Random() Dim result = Enumerable.Range(0, numKeys).Select(Function(i) New String(Enumerable.Range(0, numChars).Select(Function(j) chars(rnd.Next(chars.Length))).ToArray())) ListBox1.DataSource = result.ToArray() ```
68,082,864
I'm currently building a "formula editor" in a GUI application in python. I use sympy to parse and check the validity of the typed formula, based on a dictionary of `subs`. No problem with that. Sometimes, user will need to type "complex" formulae with redundant parameters. See this example below: ``` Array([0.9, 0.8, 1.0, 1.1])[Mod(p-1, 4)] ``` The list `[0.9, 0.8, 1.0, 1.1]` is chosen by the user and can be of any length. Given the value of `p` variable, il will result in one of the four elements of the list. The number `4` is obviously `len([0.9, 0.8, 1.0, 1.1]`. The user can easily mistype the formula... Rather, I would like to create my own function, eg. `userlist()`, taking the list as argument and behaving as needed. I have read [this](https://stackoverflow.com/questions/49306092/parsing-a-symbolic-expression-that-includes-user-defined-functions-in-sympy) which helped me start with functions taking numbers as argument. It did not help me much with arguments which are lists. Thank you in advance. --- **EDIT:** In a nutshell, I need to define `userlist()` in some way so that this line ``` parse_expr("userlist(p, [8, 4, 6, 7])").evalf(subs={'p': 10}) ``` returns the `Mod(p-1, len(list))`th element of the list (here the 2nd element: `4`).
2021/06/22
[ "https://Stackoverflow.com/questions/68082864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16283580/" ]
After adding the base case, as recommended by @DavidTonhofer, you can change the order of the first two arguments of the predicate to avoid **spurious choice points** (since Prolog apply first argument indexing to quickly narrow down applicable clauses): ``` addZ([], _, []). addZ([X|Xs], Z, [Y|Ys]):- Y is X + Z, addZ(Xs, Z, Ys). ``` Example: ``` ?- addZ([1,2,3], 1, Z). Z = [2, 3, 4]. ?- ```
Here's another solution using [`maplist/3`](https://www.swi-prolog.org/pldoc/doc_for?object=maplist/3) and library [`yall`](https://www.swi-prolog.org/pldoc/man?section=yall): ``` addZ(Z, Xs, Ys):- maplist({Z}/[X, Y]>>(Y is X+Z), Xs, Ys). ``` Sample runs ``` ?- addZ(1, [1,2,3], X). X = [2, 3, 4]. ?- addZ(5, [1,2,3], X). X = [6, 7, 8]. ```
68,082,864
I'm currently building a "formula editor" in a GUI application in python. I use sympy to parse and check the validity of the typed formula, based on a dictionary of `subs`. No problem with that. Sometimes, user will need to type "complex" formulae with redundant parameters. See this example below: ``` Array([0.9, 0.8, 1.0, 1.1])[Mod(p-1, 4)] ``` The list `[0.9, 0.8, 1.0, 1.1]` is chosen by the user and can be of any length. Given the value of `p` variable, il will result in one of the four elements of the list. The number `4` is obviously `len([0.9, 0.8, 1.0, 1.1]`. The user can easily mistype the formula... Rather, I would like to create my own function, eg. `userlist()`, taking the list as argument and behaving as needed. I have read [this](https://stackoverflow.com/questions/49306092/parsing-a-symbolic-expression-that-includes-user-defined-functions-in-sympy) which helped me start with functions taking numbers as argument. It did not help me much with arguments which are lists. Thank you in advance. --- **EDIT:** In a nutshell, I need to define `userlist()` in some way so that this line ``` parse_expr("userlist(p, [8, 4, 6, 7])").evalf(subs={'p': 10}) ``` returns the `Mod(p-1, len(list))`th element of the list (here the 2nd element: `4`).
2021/06/22
[ "https://Stackoverflow.com/questions/68082864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16283580/" ]
After adding the base case, as recommended by @DavidTonhofer, you can change the order of the first two arguments of the predicate to avoid **spurious choice points** (since Prolog apply first argument indexing to quickly narrow down applicable clauses): ``` addZ([], _, []). addZ([X|Xs], Z, [Y|Ys]):- Y is X + Z, addZ(Xs, Z, Ys). ``` Example: ``` ?- addZ([1,2,3], 1, Z). Z = [2, 3, 4]. ?- ```
As always the most fun starts when you use CLP, like ``` :- use_module(library(clpz)). addZ(_, [], []). addZ(I, [X|Xs], [Y|Ys]) :- Y #= I + X, addZ(I, Xs, Ys). ``` And now you can do stuff like: ``` ?- addZ(1, [1, 2, 3], C). C = [2,3,4]. ?- addZ(1, [1, 2, X], [X, Y, 9]). false. ?- addZ(4, [1, 2, X], [A, Y, 9]). A = 5, Y = 6, X = 5. ?- addZ(I, [1, 2, X], [5|Ys]). I = 4, Ys = [6,_A], clpz:(4+X#=_A). ```
68,082,864
I'm currently building a "formula editor" in a GUI application in python. I use sympy to parse and check the validity of the typed formula, based on a dictionary of `subs`. No problem with that. Sometimes, user will need to type "complex" formulae with redundant parameters. See this example below: ``` Array([0.9, 0.8, 1.0, 1.1])[Mod(p-1, 4)] ``` The list `[0.9, 0.8, 1.0, 1.1]` is chosen by the user and can be of any length. Given the value of `p` variable, il will result in one of the four elements of the list. The number `4` is obviously `len([0.9, 0.8, 1.0, 1.1]`. The user can easily mistype the formula... Rather, I would like to create my own function, eg. `userlist()`, taking the list as argument and behaving as needed. I have read [this](https://stackoverflow.com/questions/49306092/parsing-a-symbolic-expression-that-includes-user-defined-functions-in-sympy) which helped me start with functions taking numbers as argument. It did not help me much with arguments which are lists. Thank you in advance. --- **EDIT:** In a nutshell, I need to define `userlist()` in some way so that this line ``` parse_expr("userlist(p, [8, 4, 6, 7])").evalf(subs={'p': 10}) ``` returns the `Mod(p-1, len(list))`th element of the list (here the 2nd element: `4`).
2021/06/22
[ "https://Stackoverflow.com/questions/68082864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16283580/" ]
As always the most fun starts when you use CLP, like ``` :- use_module(library(clpz)). addZ(_, [], []). addZ(I, [X|Xs], [Y|Ys]) :- Y #= I + X, addZ(I, Xs, Ys). ``` And now you can do stuff like: ``` ?- addZ(1, [1, 2, 3], C). C = [2,3,4]. ?- addZ(1, [1, 2, X], [X, Y, 9]). false. ?- addZ(4, [1, 2, X], [A, Y, 9]). A = 5, Y = 6, X = 5. ?- addZ(I, [1, 2, X], [5|Ys]). I = 4, Ys = [6,_A], clpz:(4+X#=_A). ```
Here's another solution using [`maplist/3`](https://www.swi-prolog.org/pldoc/doc_for?object=maplist/3) and library [`yall`](https://www.swi-prolog.org/pldoc/man?section=yall): ``` addZ(Z, Xs, Ys):- maplist({Z}/[X, Y]>>(Y is X+Z), Xs, Ys). ``` Sample runs ``` ?- addZ(1, [1,2,3], X). X = [2, 3, 4]. ?- addZ(5, [1,2,3], X). X = [6, 7, 8]. ```
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
As of right now there is no way to use an embedded framework to share code between an app and widget and have it run on iOS 8 as well as iOS 7 & previous. Here's some more reading on that <http://atomicbird.com/blog/ios-app-extension-tips> > > Frameworks vs. iOS 7 > > > If you are sharing code between an app and an extension, one nice way to do so is to create your own embedded framework to hold the code. On iOS 8 it'll load dynamically for both cases, so you're set. > > > If you still support iOS 7 (or earlier), it's not so clear cut. Embedded frameworks don't work there. The App Extension Programming Guide breezily notes that you can use dlopen to deal with this. With that approach you write code to load the framework dynamically at run time rather than rely on iOS loading it for you, if you've verified that the code is running on a version of iOS that supports doing so. > > > But how do you use that code on iOS 7? You don't. If your shared code is in an embedded framework, there's no way to execute it on iOS 7. It's just unavailable. > > > The dlopen approach might be handy if you only need the shared code on iOS 8. If you need it on iOS 7, you'll need to include it in the app target. And once you do that, you have no need of the framework. You could still use a framework for the app extension, but doing so is not actually useful. You'd be doing the work of creating the framework but not getting any benefit from it. Just include the shared code in both targets. > > > And from Apple's extension guide <https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensibilityPG.pdf> > > If you link to an embedded framework from your containing app, you can still deploy it to versions of iOS older than 8.0, even though embedded frameworks are not available in those versions. > > >
I set the Mach-O Type to EXECUTABLE and it worked for me. Setting it to Static, Dynamic or Bundle created other errors when I ran it. Target > "Your App" > Build Settings > Linking > Mach-O Type > Executable
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
I set the Mach-O Type to EXECUTABLE and it worked for me. Setting it to Static, Dynamic or Bundle created other errors when I ran it. Target > "Your App" > Build Settings > Linking > Mach-O Type > Executable
I solve this problem following way : **Use same deployment target in both target "Embedded Framework" and "main App" target.**
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
Going deeper on [Apple Documentation](https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW1) I found out about ***dlopen*** command, which is used to make the linking of the libraries on some conditions, depending on system versions and libraries supported. > > dlopen example of use: > [Is the function 'dlopen()' private API?](https://stackoverflow.com/questions/6530701/is-the-function-dlopen-private-api) > > > So let's look at the solution provided by Apple Docs: Deploying a Containing App to Older Versions of iOS =================================================== > > If you link to an embedded framework from your containing app, you can > still deploy it to versions of iOS older than 8.0, even though > embedded frameworks are not available in those versions. > > > The mechanism that lets you do this is the ***dlopen*** command, which you use to conditionally link and load a framework bundle. You employ this command as an alternative to the build-time linking you can specify in the **Xcode General** or **Build Phases** target editor. The main idea is to ***link embedded frameworks into your containing app only when running in iOS 8.0 or newer***. **You must use Objective-C, not Swift**, in your code statements that conditionally load a framework bundle. The rest of your app can be written in either language, and the embedded framework itself can likewise be written in either language. After calling ***dlopen***, access the embedded framework classes using the following type of statement: ``` MyLoadedClass *loadedClass = [[NSClassFromString (@"MyClass") alloc] init]; ``` > > IMPORTANT > > > If your containing app target links to an embedded framework, it must > include the arm64 architecture or it will be rejected by the App > Store. > > > To set up an app extension Xcode project to take advantage of conditional linking --------------------------------------------------------------------------------- 1. For each of your contained app extensions, set the deployment target to be iOS 8.0 or later, as usual. Do this in the “Deployment info” section of the General tab in the Xcode target editor. 2. For your containing app, set the deployment target to be the oldest version of iOS that you want to support. 3. In your containing app, conditionalize calls to the dlopen command within a runtime check for the iOS version by using the systemVersion method. Call the dlopen command only if your containing app is running in iOS 8.0 or later. Be sure to use Objective-C, not Swift, when making this call. --- Certain iOS APIs use embedded frameworks via the dlopen command. You must conditionalize your use of these APIs just as you do when calling ***dlopen*** directly. These APIs are from the **CFBundleRef** opaque type: **CFBundleGetFunctionPointerForName CFBundleGetFunctionPointersforNames** And from the NSBundle class: **load loadAndReturnError: classNamed:** > > In a containing app you are deploying to versions of iOS older than > 8.0, call these APIs only within a runtime check that ensures you are running in iOS 8.0 or newer, and call these APIs using Objective-C. > > >
I was running into an issue where i needed to include some libraries as embedded frameworks otherwise i received the above error and when I did just that, I received errors when submitting to the app store. My solution was to use Pods and make sure you uncomment the "use\_frameworks!" line.
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
For some time I was thinking that this is my problem as well, but for normal apps (**non-iOS-8-extension**) you just need to change one build setting in your casual Xcode 6 iOS Universal Framework target (**set Mach-O Type to Static Library**): ![Set it to Static Library](https://i.stack.imgur.com/itgBr.png) There should be no problem with iTunes Connect and iOS 7 after that :)
So, temporary, i said no to dynamic library, while many devices on iOS 7. How i solved my problem. I was need lib for transferring model between app and extension. So, i put my model to JSON string into shared container. And it works like a charm.
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
I solve this problem following way : **Use same deployment target in both target "Embedded Framework" and "main App" target.**
Remove the use frameworks! from your PodFile if you want the Framework to work in iOS 7.0. i.e. run pod deintegrate command, modify your PodFile and then rerun the pod install command Also after this, I had to add all the .h file's of the Framework in the Bridging file, that fixed the issue. Also remove the import TestLibrary from the swift files
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
We tried running the latest code on the following configurations: iOS 8+ — iPhone 5s iOS 7.1.2 — iPhone 4 iOS 6.1.3 — iPad 4 The App is working fine on all the three devices but the warning is present in the Xcode while compiling . "embedded dylibs/frameworks only run on iOS 8 or later” Also I tried to Archive the App in order to submit it to the app store it went on fine. Also, found out a link where in an apple developer stated this to be a bug <https://devforums.apple.com/message/999579#999579>
I had a bug when updating to xcode 7.3. And I had solution for me. - Change targets in pods project -> 7.0 - Hope it useful! [![attack](https://i.stack.imgur.com/YCmTJ.png)](https://i.stack.imgur.com/YCmTJ.png)
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
So, after digging around I came out with the solution Supposed to have yours MyEmbeddedFramework.framework to add to the app, do this 1. Remove MyEmbeddedFramework.framework in the tab General > Embedded Binaries 2. Remove the Build Phases > Copy Phase "Frameworks" if you have MyEmbeddedFramework.framework there. 3. Clean Build Folder 4. Move the MyEmbeddedFramework.framework in the void Embedded Frameworks section. 5. You will see now that a new Build Phase > Embedded Frameworks is created by XCode6 (not you, it is done automatically) 6. Now if you have 5, it should run without erros. So to recap, to make it works you should see MyEmbeddedFramework.framework in A) General > Embedded Binaries ![General > Embedded Binaries](https://i.stack.imgur.com/oqUOV.jpg) B) Build Phase > Embedded Frameworks ![Build Phase > Embedded Frameworks](https://i.stack.imgur.com/R64DV.jpg) It worked fine on **iPhone5/iOS8** not on **iPhone4S/iOS7** where I get: dyld: Library not loaded: @rpath/ObjectiveLyricsTouch2.framework/ObjectiveLyricsTouch2 Referenced from: /var/mobile/Applications/739D9C44-3B91-4D4F-805B-83BE66C9CBCA/musiXmatch.app/musiXmatch Reason: no suitable image found. Did find: /private/var/mobile/Applications/739D9C44-3B91-4D4F-805B-83BE66C9CBCA/musiXmatch.app/Frameworks/ObjectiveLyricsTouch2.framework/ObjectiveLyricsTouch2: **incompatible cpu-subtype: 0x0000000B** in /private/var/mobile/Applications/739D9C44-3B91-4D4F-805B-83BE66C9CBCA/musiXmatch.app/Frameworks/ObjectiveLyricsTouch2.framework/ObjectiveLyricsTouch2 The problem was in the EmbeddedFramework. I had to 1) Set Architecture to default 2) Set Valid Architectures to: armv7, armv7s and armv64 (as Apple suggests armv64 is needed to have Embedded Frameworks working). Then I was able to run the app with an embedded framework on * iPhone5S/iPhone5C iOS8 * iPhone5S/iPhone5C iOS7 * iPod 5th gen / iOS7 * iPhone4S / iOS7 * iPhone4 / iOS7 Anyways when submitting to iTunesConnect I get some errors for the Minimum Required Version: * The MinimumOSVersion of framework "..." is invalid. The minimum value is iOS 8.0; * Invalid Architecture: Apps that include and app extension and a framework must support arm64; ![Embedded Framework Issues](https://i.stack.imgur.com/e5qbl.jpg)
So, temporary, i said no to dynamic library, while many devices on iOS 7. How i solved my problem. I was need lib for transferring model between app and extension. So, i put my model to JSON string into shared container. And it works like a charm.
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
Fixed the error in xcode 6.1.1 using vim or vi open the project.pbxproj file. At the end of the file (search for 8.1) , there would be Begin XCBuildConfiguration section Look for your framework. In out case even though the deployment target was set to 7.1 via Xcode -> general in target settings, the entry in the file had 8.1 for both debug & release Here's the old file section looks like: ``` CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = ENFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 8.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; ``` New section looks like : ``` CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); INFOPLIST_FILE = ENFramework/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 7.1; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; ``` Now we don't get error just a warning (but works on iOS 7.1 device) : ld: warning: embedded dylibs/frameworks only run on iOS 8 or later This looks like an xcode bug which incorrectly sets different ios targets and then causes error.
I solve this problem following way : **Use same deployment target in both target "Embedded Framework" and "main App" target.**
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
Going deeper on [Apple Documentation](https://developer.apple.com/library/ios/documentation/General/Conceptual/ExtensibilityPG/ExtensionScenarios.html#//apple_ref/doc/uid/TP40014214-CH21-SW1) I found out about ***dlopen*** command, which is used to make the linking of the libraries on some conditions, depending on system versions and libraries supported. > > dlopen example of use: > [Is the function 'dlopen()' private API?](https://stackoverflow.com/questions/6530701/is-the-function-dlopen-private-api) > > > So let's look at the solution provided by Apple Docs: Deploying a Containing App to Older Versions of iOS =================================================== > > If you link to an embedded framework from your containing app, you can > still deploy it to versions of iOS older than 8.0, even though > embedded frameworks are not available in those versions. > > > The mechanism that lets you do this is the ***dlopen*** command, which you use to conditionally link and load a framework bundle. You employ this command as an alternative to the build-time linking you can specify in the **Xcode General** or **Build Phases** target editor. The main idea is to ***link embedded frameworks into your containing app only when running in iOS 8.0 or newer***. **You must use Objective-C, not Swift**, in your code statements that conditionally load a framework bundle. The rest of your app can be written in either language, and the embedded framework itself can likewise be written in either language. After calling ***dlopen***, access the embedded framework classes using the following type of statement: ``` MyLoadedClass *loadedClass = [[NSClassFromString (@"MyClass") alloc] init]; ``` > > IMPORTANT > > > If your containing app target links to an embedded framework, it must > include the arm64 architecture or it will be rejected by the App > Store. > > > To set up an app extension Xcode project to take advantage of conditional linking --------------------------------------------------------------------------------- 1. For each of your contained app extensions, set the deployment target to be iOS 8.0 or later, as usual. Do this in the “Deployment info” section of the General tab in the Xcode target editor. 2. For your containing app, set the deployment target to be the oldest version of iOS that you want to support. 3. In your containing app, conditionalize calls to the dlopen command within a runtime check for the iOS version by using the systemVersion method. Call the dlopen command only if your containing app is running in iOS 8.0 or later. Be sure to use Objective-C, not Swift, when making this call. --- Certain iOS APIs use embedded frameworks via the dlopen command. You must conditionalize your use of these APIs just as you do when calling ***dlopen*** directly. These APIs are from the **CFBundleRef** opaque type: **CFBundleGetFunctionPointerForName CFBundleGetFunctionPointersforNames** And from the NSBundle class: **load loadAndReturnError: classNamed:** > > In a containing app you are deploying to versions of iOS older than > 8.0, call these APIs only within a runtime check that ensures you are running in iOS 8.0 or newer, and call these APIs using Objective-C. > > >
Remove the use frameworks! from your PodFile if you want the Framework to work in iOS 7.0. i.e. run pod deintegrate command, modify your PodFile and then rerun the pod install command Also after this, I had to add all the .h file's of the Framework in the Bridging file, that fixed the issue. Also remove the import TestLibrary from the swift files
25,909,917
I'm researching about SDN and NFV. In the concept of NFV on Wikipedia , it says : "Network Functions Virtualization (NFV) is a network architecture concept that proposes using IT virtualization related technologies, to virtualize entire classes of network node functions into building blocks that may be connected, or chained, together to create communication services."==> first thing to consider that it will reduce the cost of facilities. So in real life implementation, for example, how can we virtualize a network nodes like a router? NFV was created for the networks to be capable to extend in a dynamically way(virtualize the router) , not a static way(buy a new router), that is we must implement the router functions in the server or a computer instead of buying and then adapting the new router to the current nextwork , in this case I don't see any different in this implementation , because buying a server to implement a virtualized router is not cheaper than buying a new router. Can anyone explain this for me , or Am i wrong understanding the NFV concept? Thanks.
2014/09/18
[ "https://Stackoverflow.com/questions/25909917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2760331/" ]
I set the Mach-O Type to EXECUTABLE and it worked for me. Setting it to Static, Dynamic or Bundle created other errors when I ran it. Target > "Your App" > Build Settings > Linking > Mach-O Type > Executable
I had a bug when updating to xcode 7.3. And I had solution for me. - Change targets in pods project -> 7.0 - Hope it useful! [![attack](https://i.stack.imgur.com/YCmTJ.png)](https://i.stack.imgur.com/YCmTJ.png)
41,107,555
My app is using `spring-data-rest` and `spring-restdocs`. My setup is really standard; copied from the docs almost entirely, but I've included the samples below in case I'm missing something. When my mvc test runs, it fails with: ``` org.springframework.restdocs.snippet.SnippetException: The following parts of the payload were not documented: { "_links" : { "self" : { "href" : "https://my-api/item/10" }, "item" : { "href" : "https://my-api/item/10" } } } ``` This is my test code: ``` @Rule public JUnitRestDocumentation restDocs = new JUnitRestDocumentation("target/generated-snippets"); // ... mockMvc = webAppContextSetup(wac) //WebApplicationContext .apply(documentationConfiguration(restDocs) .uris() .withHost("my-api") .withPort(443) .withScheme("https")) .build(); // .... mockMvc.perform(get("/items/{id}", "10")) .andDo(documentation) ``` Here's the stack: ``` at org.springframework.restdocs.payload.AbstractFieldsSnippet.validateFieldDocumentation(AbstractFieldsSnippet.java:176) at org.springframework.restdocs.payload.AbstractFieldsSnippet.createModel(AbstractFieldsSnippet.java:100) at org.springframework.restdocs.snippet.TemplatedSnippet.document(TemplatedSnippet.java:64) at org.springframework.restdocs.generate.RestDocumentationGenerator.handle(RestDocumentationGenerator.java:196) at org.springframework.restdocs.mockmvc.RestDocumentationResultHandler.handle(RestDocumentationResultHandler.java:55) at org.springframework.test.web.servlet.MockMvc$1.andDo(MockMvc.java:177) at com.example.my.api.domain.MyRepositoryRestTest.findOne(MyRepositoryRestTest.java:36) ``` How do I get `spring-restdocs` and `spring-data-rest` to play nice? --- **EDIT(S):** My `documentation` instance is defined as follows: ``` ResultHandler documentation = document("items/findOne", preprocessRequest(prettyPrint(), maskLinks()), preprocessResponse(prettyPrint()), responseFields( fieldWithPath("name").description("Item name.") // Bunch more )); ``` As @meistermeier indicated, (and following [the restdocs docs for ignoring links](http://docs.spring.io/spring-restdocs/docs/current/reference/html5/#documenting-your-api-hypermedia-ignoring-common-links), I can add ``` links(linkWithRel("self").ignored(), linkWithRel("_self").ignored().optional()) // docs suggest this. /shrug ``` But that still leaves me with: ``` SnippetException: Links with the following relations were not documented: [item] ``` Seems like the `_links` are always going to have that self-reference back to the same entity, right? How do I cleanly handle this without ignoring an entity-specific link for every test, like: ``` links(linkWithRel("item").ignored()) ``` Even if I **do** add the above line (so that all fields `self` `_self` `curies` and `item` are all `ignored()` and/or `optional()`), the result of the test returns to the original error at the top of this question.
2016/12/12
[ "https://Stackoverflow.com/questions/41107555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1281468/" ]
> > Seems like the \_links are always going to have that self-reference back to the same entity, right? > > > Yes, that's right. I may have your solution for ignoring some links in [a small github sample](https://github.com/meistermeier/spring-rest-docs-sample/blob/master/src/test/java/com/meistermeier/BeerRepositoryTest.java#L106). Especially the part: ``` mockMvc.perform(RestDocumentationRequestBuilders.get(beerLocation)).andExpect(status().isOk()) .andDo(document("beer-get", links( linkWithRel("self").ignored(), linkWithRel("beerapi:beer").description("The <<beers, Beer resource>> itself"), linkWithRel("curies").ignored() ), responseFields( fieldWithPath("name").description("The name of the tasty fresh liquid"), fieldWithPath("_links").description("<<beer-links,Links>> to other resources") ) )); ``` where I completely ignore all *"generated"* fields and only create a documentation entry for the domain. Your `item` link would be my `beerapi:beer`. I really don't know what is best practice here, but I would always document as much as possible since you can use asciidoctor links (like `<<beer-links,Links>>`) wherever possible to reference other parts with more documentation.
canonical way seems to be using things from restdocs documentation. Approach is in line with approach from <https://stackoverflow.com/users/2650436/meistermeier> solution. Documentation can be found on <https://docs.spring.io/spring-restdocs/docs/current/reference/html5/#documenting-your-api-hypermedia-link-formats> Sample code: ``` .consumeWith(document("items", links( halLinks(), // <- this shorten things a bit linkWithRel("self").ignored(), linkWithRel("profile").ignored() ), ```
45,070,283
I want to make ActionBarDrawerToggle(Hamburger) Icon bigger. I have try changing the width of bar, but it can't change. And what should I do?
2017/07/13
[ "https://Stackoverflow.com/questions/45070283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8299049/" ]
Try this: ``` for (int i = 0; i < mToolbar.getChildCount(); i++) { if(mToolbar.getChildAt(i) instanceof ImageButton){ mToolbar.getChildAt(i).setScaleX(1.5f); mToolbar.getChildAt(i).setScaleY(1.5f); } } ```
Adding to Yaw's Answer. You should write like this: ``` toolbar.post(new Runnable() { @Override public void run() { for (int i = 0; i < toolbar.getChildCount(); i++) { if(toolbar.getChildAt(i) instanceof ImageButton){ toolbar.getChildAt(i).setScaleX(1.5f); toolbar.getChildAt(i).setScaleY(1.5f); } } } }); ```
89,968
I am still not sure what should be considered as "literature" for inclusion in a literature review and what are not when writing a research proposal. For instance: > > A research proposal: 500-1000 words outlining your plans for your PhD > Please include a 'literature review’ of works you’ve consulted and > where your ‘contribution to new knowledge’ may > potentially be made. > > > Can books be considered as "literature" for inclusion in literature reviews? For instance: * Michio Kaku. (2011) Physics of the Future: The Inventions That Will -Transform Our Lives. Reprint, Penguin, 2012. * Carl Sagan. (1995) The Demon-Haunted World: Science as a Candle in the Dark. Reprint, New York: Ballantine Books, 2000. I googled and found [this](https://laverne.libguides.com/c.php?g=34942&p=222059) and it says: > > "The Literature" refers to the collection of scholarly writings on a > topic. This includes peer-reviewed articles, books, dissertations and > conference papers. > > > It mentions books but does *The Literature* above mean *literature review*? Also, what about online sources/ articles? Are they "literature" for literature reviews? For example: * <https://www.brainpickings.org/2014/01/03/baloney-detection-kit-carl-sagan/> * <https://www.theguardian.com/culture/2009/jul/05/can-artists-save-the-world> * <http://www.theoryculturesociety.org/elinor-carmi-cookies-meets-eye/>
2017/05/25
[ "https://academia.stackexchange.com/questions/89968", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/73965/" ]
Note carefully the word *scholarly* in that description. It refers to works whose intended audience is experts in the field, and which either present novel research or interpret existing results in a novel way. Books can fit that description; often they will have been published by an academic publisher and reviewed for academic merit by expert editors or referees, prior to publication. Scholarly books are sometimes called *monographs*, especially in the sciences. The books you mentioned by Kaku and Sagan are not *scholarly* books. They are intended for a non-expert popular audience, and they don't present new research or expand the state of the art. The same goes for the online sources you listed; they are newspaper articles or blog posts intended for a popular audience. A literature review is how you show that you are familiar with the state of the art. It convinces the reader that they should believe you when you say that your proposed project is feasible, novel, and interesting. You want to show that you are an expert, or are on your way to becoming one. Citing a popular book won't achieve that; it puts you at the same level as any random person interested in science who can read a bestseller list.
A literature review describes what is already known (and what is not known about a particular topic). So, given your research question, your literature review needs to explain to the reader what previous original research (especially empirical work) has concluded on this question and what is still unknown. This previous research will include findings from both books and papers, but will likely be light on blog posts (unless they present an important argument that is not made elsewhere). At the end of the literature review you need to drive home how your work will help to fill the holes in the literature.
89,968
I am still not sure what should be considered as "literature" for inclusion in a literature review and what are not when writing a research proposal. For instance: > > A research proposal: 500-1000 words outlining your plans for your PhD > Please include a 'literature review’ of works you’ve consulted and > where your ‘contribution to new knowledge’ may > potentially be made. > > > Can books be considered as "literature" for inclusion in literature reviews? For instance: * Michio Kaku. (2011) Physics of the Future: The Inventions That Will -Transform Our Lives. Reprint, Penguin, 2012. * Carl Sagan. (1995) The Demon-Haunted World: Science as a Candle in the Dark. Reprint, New York: Ballantine Books, 2000. I googled and found [this](https://laverne.libguides.com/c.php?g=34942&p=222059) and it says: > > "The Literature" refers to the collection of scholarly writings on a > topic. This includes peer-reviewed articles, books, dissertations and > conference papers. > > > It mentions books but does *The Literature* above mean *literature review*? Also, what about online sources/ articles? Are they "literature" for literature reviews? For example: * <https://www.brainpickings.org/2014/01/03/baloney-detection-kit-carl-sagan/> * <https://www.theguardian.com/culture/2009/jul/05/can-artists-save-the-world> * <http://www.theoryculturesociety.org/elinor-carmi-cookies-meets-eye/>
2017/05/25
[ "https://academia.stackexchange.com/questions/89968", "https://academia.stackexchange.com", "https://academia.stackexchange.com/users/73965/" ]
Whereas pretty much everyone recognizes that a literature review needs to be **scholarly**, people often seem to get confused about whether it is the literature review itself or its source studies that have to be scholarly. Many people argue that both need to be scholarly, but I disagree: whereas the literature review itself needs to be scholarly (that is, you need to do your review with scholarly rigour), I believe it is sometimes quite appropriate to include source studies in your review that might themselves not be scholarly works. So, to directly answer your question, **yes, it might sometimes be appropriate to include non-scholarly books as part of the literature that you review in a literature review**. The challenge, though, with including non-scholarly sources is that a lot of them (maybe over 80% of books and magazines, and maybe 99% of web pages, just to make up some numbers) are garbage as far as scholarly usefulness is concerned. So, if you want to include such sources, it is absolutely critical that you carefully evaluate their quality before deciding to incorporate their arguments and conclusions in your literature review. The advantage of peer-reviewed scholarly sources is that some scholars have already done that work for you. If you use practitioner sources, then you have to do that work yourself. And if you don't, then garbage in, garbage out: your resulting literature review will be just as trashy as the sources you included. Because of this, some scholars refuse to ever include non-scholarly sources in their literature reviews and advice against doing so. However, practitioner sources can sometimes provide excellent insights and data, and are often much more up-to-date and relevant than any available scholarly source. Thus, I think it's worth the trouble. For an excellent example of a scholarly literature review that incorporates many non-scholarly sources, see Elliot, Steve. "[Transdisciplinary perspectives on environmental sustainability: a resource base and framework for IT-enabled business transformation.](https://scholar.google.fr/scholar?cluster=17327364595480483719&hl=en&as_sdt=0,5)" MIS Quarterly 35.1 (2011): 197-236. For your specific situation, the books you mentioned seem to be written by respectable physicists (I don't know, though, since I'm not a physicist). If so, they should cite their sources for their claims and arguments. These sources that the books cite should be peer-reviewed. So, if you only repeat claims from these books that cite peer-reviewed sources (and in your literature review, you should cite both the book and the book's source), you should be safe. So, if you do that, then you can benefit from including in your literature review the exciting ideas of a popular book written by a serious scholar. However, if the book doesn't cite peer-reviewed sources, then you should question the reliability of its claims. I talk about these issues in more detail in a [working paper I wrote about how to build theory using literature reviews](https://ssrn.com/abstract=2699362). Caveat: Some of my ideas have changed since I wrote it, but the sections on the Practical Screen and Quality Appraisal are quite relevant to the points I've raised here.
A literature review describes what is already known (and what is not known about a particular topic). So, given your research question, your literature review needs to explain to the reader what previous original research (especially empirical work) has concluded on this question and what is still unknown. This previous research will include findings from both books and papers, but will likely be light on blog posts (unless they present an important argument that is not made elsewhere). At the end of the literature review you need to drive home how your work will help to fill the holes in the literature.
40,478,159
I'm trying to create a new `Business Notebook` over PHP but I'm having no luck. I've tried following [this documentation](https://dev.evernote.com/doc/articles/business.php) and adapting the code to what is available to me using the [Thrift module: NoteStore](https://dev.evernote.com/doc/reference/NoteStore.html#Fn_NoteStore_createNotebook). From my understanding of how the flow is meant to be, it's; create a new notebook, using the returned notebook get its shareKey, shareID, and businessId, use that information to create a linked notebook in the business note store. I first tried to creating a new notebook using the non business note store, however the new notebook returned did not contain a shareKey, or any other information needed for creating a linked notebook. Instead I found creating a new notebook using the business note store returned a new notebook with some of this the required information under the 'sharedNotebooks' feild however the businessNotebook parameter was null, and there was no shareId within sharedNotebooks. And even though this new notebook is returned successfull, it is not visable in my personal or business accounts. The returned notebook looks like ``` { "guid": "d341cd12-9f98-XXX-XXX-XXX", "name": "Hello World", "updateSequenceNum": 35838, "defaultNotebook": false, "serviceCreated": 1478570056000, "serviceUpdated": 1478570056000, "publishing": null, "published": null, "stack": null, "sharedNotebookIds": [603053], "sharedNotebooks": [{ "id": 603053, "userId": 40561553, "notebookGuid": "d341cd12-9f98-XXX-XXX-XXX", "email": "jack@businessEvernoteAccountEmail", "notebookModifiable": true, "requireLogin": null, "serviceCreated": 1478570056000, "serviceUpdated": 1478570056000, "shareKey": "933ad-xxx", "username": "xxx", "privilege": 5, "allowPreview": null, "recipientSettings": { "reminderNotifyEmail": null, "reminderNotifyInApp": null } }], "businessNotebook": null, "contact": { "id": 111858676, "username": "XXX", "email": "jack@personalEvernoteAccountEmail", "name": "Jack XXXX", "timezone": null, "privilege": null, "created": null, "updated": null, "deleted": null, "active": true, "shardId": null, "attributes": null, "accounting": null, "premiumInfo": null, "businessUserInfo": null }, "restrictions": { "noReadNotes": null, "noCreateNotes": null, "noUpdateNotes": null, "noExpungeNotes": true, "noShareNotes": null, "noEmailNotes": true, "noSendMessageToRecipients": null, "noUpdateNotebook": null, "noExpungeNotebook": true, "noSetDefaultNotebook": true, "noSetNotebookStack": true, "noPublishToPublic": true, "noPublishToBusinessLibrary": null, "noCreateTags": null, "noUpdateTags": true, "noExpungeTags": true, "noSetParentTag": true, "noCreateSharedNotebooks": null, "updateWhichSharedNotebookRestrictions": null, "expungeWhichSharedNotebookRestrictions": null } } ``` Thus far, my code flow is as follows //Try catches left out for sortness ``` //Check if business user $ourUser = $this->userStore->getUser($authToken); if(!isset($ourUser->accounting->businessId)){ $returnObject->status = 400; $returnObject->message = 'Not a buisness user'; return $returnObject; } // authenticateToBusiness and get business token $bAuthResult = $this->userStore->authenticateToBusiness($authToken); $bAuthToken = $bAuthResult->authenticationToken; //Create client and set up business note store $client = new \Evernote\AdvancedClient($authToken, false); $bNoteStore = $client->getBusinessNoteStore(); //Create a new notebook in business note store- example result is json above $newNotebook = new Notebook(); $newNotebook->name = $title; $newNotebook = $bNoteStore->createNotebook($bAuthToken, $newNotebook); //Look at new notebook and get information needed to create linked notebook $sharedNotebooks = $newNotebook->sharedNotebooks[0]; $newLinkedNotebook = new LinkedNotebook(); $newLinkedNotebook->shareName = $title; $newLinkedNotebook->shareKey = $sharedNotebooks->shareKey; $newLinkedNotebook->username = $sharedNotebooks->username; //$newLinkedNotebook->shardId = $sharedNotebooks->shardId; //isnt there //This is where I think the trouble is happening ??? $newLinkedNotebook = $bNoteStore->createLinkedNotebook($bAuthToken, $newLinkedNotebook); //Trying with business token throws //{"errorCode":3,"parameter":"authenticationToken"} //Even though within Evernote itself, I can add notebooks to this business //Alternatively trying with the regular $authToken i receive //{"errorCode":12,"message":"s570","rateLimitDuration":null} // error code 12 being SHARD_UNAVAILABLE //and trying on the regular noteStore $newLinkedNotebook = $noteStore->createLinkedNotebook($authToken, $newLinkedNotebook); //returns {"errorCode":5,"parameter":"LinkedNotebook.shardId"} ```
2016/11/08
[ "https://Stackoverflow.com/questions/40478159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5531521/" ]
You just need to start from limit and ends when it reaches 11 ``` for(int x = limit; x > 10; x--){ if(x! = 44 && x != 22){ System.out.print(x + " "); } } ```
You start the loop at the upper limit (`66`) and decrements down to the lower limit (`1`). Then you check if they are `even` or `odd` but only output the even numbers. ``` int lowerLimit = 1; int upperLimit = 66; System.out.println("Printing Even numbers between " + lowerLimit + " and " + upperLimit); for (int x = upperLimit; x >= lowerLimit; x--) { if ((x & 1) == 0) { // even System.out.print(x + " "); } else { // odd } } ```
37,374,652
The title says it all! but to be more clear, please check this screenshot. This is a 360 video playback using the Google VR <https://developers.google.com/vr/ios/> but I want to know if it is possible to remove this little (info) button? and instead overlay our own set of video controlers? [![enter image description here](https://i.stack.imgur.com/peX8C.jpg)](https://i.stack.imgur.com/peX8C.jpg)
2016/05/22
[ "https://Stackoverflow.com/questions/37374652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247658/" ]
Google allow you to create a custom GVRView which doesn't have the (i) icon - but it involves creating your own OpenGL code for viewing the video. A hack working on v0.9.0 is to find an instance of QTMButton: ```js let videoView = GVRVideoView(frame: self.view.bounds) for subview in self.videoView.subviews { let className = String(subview.dynamicType) if className == "QTMButton" { subview.hidden = true } } ``` It is a hack though so it might have unintended consequences and might not work in past or future versions.
Well, I have an answer to my own question. Alright, the (i) button cannot be removed. at leased not for now. check this answer > > Hi. The (i) is intentional and designed to let users and other > developers understand the feature. It links to a Google help center > article. We do not currently allow developers to disable it. > > > <https://github.com/googlevr/gvr-ios-sdk/issues/9#issuecomment-208993643>
37,374,652
The title says it all! but to be more clear, please check this screenshot. This is a 360 video playback using the Google VR <https://developers.google.com/vr/ios/> but I want to know if it is possible to remove this little (info) button? and instead overlay our own set of video controlers? [![enter image description here](https://i.stack.imgur.com/peX8C.jpg)](https://i.stack.imgur.com/peX8C.jpg)
2016/05/22
[ "https://Stackoverflow.com/questions/37374652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247658/" ]
Google allow you to create a custom GVRView which doesn't have the (i) icon - but it involves creating your own OpenGL code for viewing the video. A hack working on v0.9.0 is to find an instance of QTMButton: ```js let videoView = GVRVideoView(frame: self.view.bounds) for subview in self.videoView.subviews { let className = String(subview.dynamicType) if className == "QTMButton" { subview.hidden = true } } ``` It is a hack though so it might have unintended consequences and might not work in past or future versions.
``` GVRVideoView *videoView = [[GVRVideoView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)]; for (UIView *view in videoView.subviews) { if ([view isKindOfClass:[UIButton class]] ) { if ([NSStringFromClass([view class]) isEqualToString:@"QTMButton"] ) { [view removeFromSuperview]; } } } ```
37,929,067
In every tutorial I've seen dealing with keeping track of submitted user data, table views / collection views are used in conjunction with arrays + indexPath.row to keep track of which post is which. I'm working on an app where multiple users are able to make posts, but instead of a tableview, I'm wanting the posts to be contained in buttons that can be moved around on the screen freely. I'm having a hard time wrapping my head around how to keep track of which post is which when it's outside of a structured tableview where the indexes match up. I'm using firebase as a backend, and so ideally when a user clicks on a post button it'd load up the corresponding post..which would normally be done by grabbing the indexpath.row out of a saved array from firebase. I've got a working app using tableviews so I'm definitely not asking on how to retrieve data from firebase or anything, but moreso how to transition to the button concept. So basically, how do you keep track of posts or "things" on a screen when they're not in a list-format? This sort of thing is done all of the time in games seemingly?.. but I'm not sure how to apply that same kind of logic into a non-game app.
2016/06/20
[ "https://Stackoverflow.com/questions/37929067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4988582/" ]
* You should use -Dsonar.gitlab... instead of -Psonar.gitlab... etc. (see <https://groups.google.com/forum/#!topic/sonarqube/dx8UIkcz55c> ) * In the newest version of the plugin you can enable to add a comment when no issue is found. This helps with debugging. @1: The comments will be added to your commits and will then show up in the discussion section of a merge request @2: We are running a full analysis on master and a preview on any branches.
I had the same problem than yours. Comments were not showing in the GitLab MR. I made it work with two fixes: * make sure the preview mode is used. If it is not, the issues are not reported to GitLab * for issues to appear as GitLab comments, they have to be "new" issues. If you launched an analysis of your project before pushing to GitLab, the issues will not be considered as new by SonarQube, and no comment will be added to the MR. If this does not solve your problem, try cloning the plugin repo, adding traces to the code (CommitIssuePostJob.java is the place to look), package the jar with maven and deploy the patched jar to your Sonar installation. That is how I saw that I had no new issues to report.
61,684,418
I have a query that selects specific items as a keyword as shown below. ``` SELECT system_title as Request, Description.Words as Changes, Projects.ProjectNodeName as ProjectName, COALESCE(Engineer.Name + ' <' + UPPER(Engineer.Domain + '\' + Engineer.Alias) + '>', 'N/A') as Engineer ``` I want to use `ORDER BY Request` to order each selected item basted off of `Request` Where would I put the `ORDER BY Request` in here to make the syntax work and do what I want?
2020/05/08
[ "https://Stackoverflow.com/questions/61684418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13090977/" ]
You need the license so that they can keep an eye on you if you are making more than 1 million USD. however you don't need to download the installer, just import `registerLicense` like so and then put your API key within the `registerLicense('api key')` and you're good to use the component without any popup on the application. ``` import { registerLicense } from '@syncfusion/ej2-base' registerLicense('api key'); ``` You can grab the API key from your syncfusion dashboard "Downloads and keys" -> "Get License key".
Yes, you can download our npm package. However, to use our package legally they needed to get license from us by visiting syncfusion.com and signing up for license. This is also mentioned in our licensing document in npm package. Please find its content from GitHub link Link: <https://github.com/syncfusion/ej2-javascript-ui-controls/blob/master/controls/grids/license> Documentation: <https://ej2.syncfusion.com/angular/documentation/installation/> Online Demo: <https://ej2.syncfusion.com/angular/demos/#/material/grid/overview> We don’t have any source level license validation, so you don’t have to do anything in your application for license validation. Our current license validation are fully based on support and new feature requests. Please get back to us if you require any more assistance on this.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Have you looked at [IKVM](http://www.ikvm.net/)?
From what I gather, you would like to build a client application that you can deploy and run on any platform. That sounds a bit like magic. If you find something that works for Windows and Android, it may very well not run on the next platform you need to deploy your application on (iOS?). Not clear what the application does or how heavy it needs to be, but if you move all the weight of your client application to a server, you can then quickly build thin distinct clients that are compatible with the platforms they need to run on, and you can ask the server to do all the heavy lifting and communicate results back over standard protocols like JSON/XML over HTTP.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Python, perhaps? Jython for Java, and IronPython for .NET Another option is Scala, however I have yet to actually play with that...
From what I gather, you would like to build a client application that you can deploy and run on any platform. That sounds a bit like magic. If you find something that works for Windows and Android, it may very well not run on the next platform you need to deploy your application on (iOS?). Not clear what the application does or how heavy it needs to be, but if you move all the weight of your client application to a server, you can then quickly build thin distinct clients that are compatible with the platforms they need to run on, and you can ask the server to do all the heavy lifting and communicate results back over standard protocols like JSON/XML over HTTP.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Can you describe better your requirements? if you need to port a program across platforms ( aka Mac, Linux, Windows... ) it does not mean you need it to run inside JVM and also inside .NET For example, if you would use pure Java, by definition it would run inside a specific JVM in all those environments, to do kind of the same with .NET, there is Mono for non windows platforms. what do you want to do exactly with your program?
From what I gather, you would like to build a client application that you can deploy and run on any platform. That sounds a bit like magic. If you find something that works for Windows and Android, it may very well not run on the next platform you need to deploy your application on (iOS?). Not clear what the application does or how heavy it needs to be, but if you move all the weight of your client application to a server, you can then quickly build thin distinct clients that are compatible with the platforms they need to run on, and you can ask the server to do all the heavy lifting and communicate results back over standard protocols like JSON/XML over HTTP.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
[Clojure](http://clojure.org) can be run on the JVM and CLR, but the JVM support is currently much better.
From what I gather, you would like to build a client application that you can deploy and run on any platform. That sounds a bit like magic. If you find something that works for Windows and Android, it may very well not run on the next platform you need to deploy your application on (iOS?). Not clear what the application does or how heavy it needs to be, but if you move all the weight of your client application to a server, you can then quickly build thin distinct clients that are compatible with the platforms they need to run on, and you can ask the server to do all the heavy lifting and communicate results back over standard protocols like JSON/XML over HTTP.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Python via Jython and IronPython probably has the best support. There are others such as Ruby, Fantom, Scala etc but the .Net support is often lagging behind Java.
From what I gather, you would like to build a client application that you can deploy and run on any platform. That sounds a bit like magic. If you find something that works for Windows and Android, it may very well not run on the next platform you need to deploy your application on (iOS?). Not clear what the application does or how heavy it needs to be, but if you move all the weight of your client application to a server, you can then quickly build thin distinct clients that are compatible with the platforms they need to run on, and you can ask the server to do all the heavy lifting and communicate results back over standard protocols like JSON/XML over HTTP.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Have you looked at [IKVM](http://www.ikvm.net/)?
Python via Jython and IronPython probably has the best support. There are others such as Ruby, Fantom, Scala etc but the .Net support is often lagging behind Java.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Python, perhaps? Jython for Java, and IronPython for .NET Another option is Scala, however I have yet to actually play with that...
Can you describe better your requirements? if you need to port a program across platforms ( aka Mac, Linux, Windows... ) it does not mean you need it to run inside JVM and also inside .NET For example, if you would use pure Java, by definition it would run inside a specific JVM in all those environments, to do kind of the same with .NET, there is Mono for non windows platforms. what do you want to do exactly with your program?
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
[Clojure](http://clojure.org) can be run on the JVM and CLR, but the JVM support is currently much better.
Can you describe better your requirements? if you need to port a program across platforms ( aka Mac, Linux, Windows... ) it does not mean you need it to run inside JVM and also inside .NET For example, if you would use pure Java, by definition it would run inside a specific JVM in all those environments, to do kind of the same with .NET, there is Mono for non windows platforms. what do you want to do exactly with your program?
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Python, perhaps? Jython for Java, and IronPython for .NET Another option is Scala, however I have yet to actually play with that...
Python via Jython and IronPython probably has the best support. There are others such as Ruby, Fantom, Scala etc but the .Net support is often lagging behind Java.
6,562,988
I need something that can be run both on JVM and .NET. What is the best option to achieve that?
2011/07/03
[ "https://Stackoverflow.com/questions/6562988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/826887/" ]
Have you looked at [IKVM](http://www.ikvm.net/)?
Can you describe better your requirements? if you need to port a program across platforms ( aka Mac, Linux, Windows... ) it does not mean you need it to run inside JVM and also inside .NET For example, if you would use pure Java, by definition it would run inside a specific JVM in all those environments, to do kind of the same with .NET, there is Mono for non windows platforms. what do you want to do exactly with your program?
15,559,218
I have a chrome extension that pulls down the RSS feed of Hacker News, which uses HTTPS. Ever since I upgraded to the newest version of the chrome extension manifest, I can't get it to work. The ajax request fails without any explanation. I'm 99% sure that my javascript code that makes the request is correct, so I think it's a permissions issue. Here is the permissions and content security policy section from my manifest: ``` "permissions": [ "tabs", "https://news.ycombinator.com/", "http://news.ycombinator.com/", "notifications" ], "content_security_policy": "script-src 'self' 'unsafe-eval' https://news.ycombinator.com; object-src 'self' 'unsafe-eval' https://news.ycombinator.com" ``` Any ideas? Thanks! --- Edit: Here's a link to the Github Repo: <https://github.com/adamalbrecht/hacker-news-for-chrome/>
2013/03/21
[ "https://Stackoverflow.com/questions/15559218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/138265/" ]
I think you should do `"permissions": [ "tabs", "https://news.ycombinator.com/*", "http://news.ycombinator.com/*", "notifications" ],` because Chrome wants a pattern of permitted hosts. See [this](http://developer.chrome.com/extensions/match_patterns.html).
It's working for me on Chrome 27.0.1438.8, but you didn't post your code so it's not easy to compare results. Here's what I did: 1. Start with the Chrome kittens sample extension. 2. Change manifest permissions to... "permissions": [ "<https://news.ycombinator.com/rss>" ] 3. In popup.js, change searchOnFlickr\_ to that same URL. 4. Change showPhotos\_ to log e.target. Then I loaded the extension, right-clicked the browser-action popup, and inspected the element. In the log I saw the expected RSS content in responseText.
50,133,887
Example HTML ``` <a class="accordion-item__link" href="/identity-checking/individual"><!-- react-text: 178 -->Australia<!-- /react-text --></a> ``` When I run ``` soup.find("a", text="Australia") ``` it returns nothing. If I run `soup.find("a", href="/identity-checking/individual")` it finds the tag. `soup.find("a", href="/identity-checking/individual").text` also returns 'Australia' is it something to do with the comments?
2018/05/02
[ "https://Stackoverflow.com/questions/50133887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9730072/" ]
For some reason, detecting the tag text gets flipped when there is an `xml` comment. You can use this as a workaround: ``` [ele for ele in soup('a') if ele.text == 'Australia'] ```
Try to extract the text after finding the tag, that is: ``` result = "" for tag in soup.find_all('a'): if tag.text == "Australia": result = tag ```
50,133,887
Example HTML ``` <a class="accordion-item__link" href="/identity-checking/individual"><!-- react-text: 178 -->Australia<!-- /react-text --></a> ``` When I run ``` soup.find("a", text="Australia") ``` it returns nothing. If I run `soup.find("a", href="/identity-checking/individual")` it finds the tag. `soup.find("a", href="/identity-checking/individual").text` also returns 'Australia' is it something to do with the comments?
2018/05/02
[ "https://Stackoverflow.com/questions/50133887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9730072/" ]
I'm trying to find a method that sticks to the `find` method as it is the most convenient & adaptable. The problem here is that the HTML comments mess up the engine. Manually remove comments would be helpful. ``` from bs4 import BeautifulSoup, Comment bs = BeautifulSoup( """ <a class="accordion-item__link" href="/identity-checking/individual"><!-- react-text: 178 -->Australia<!-- /react-text --></a> """, "lxml" ) # find all HTML comments and remove comments = bs.findAll(text=lambda text:isinstance(text, Comment)) [comment.extract() for comment in comments] r = bs.find('a', text='Australia') print(r) # <a class="accordion-item__link" href="/identity-checking/individual">Australia</a> ``` The method to remove comments came from here [How can I strip comment tags from HTML using BeautifulSoup?](https://stackoverflow.com/questions/3507283/how-can-i-strip-comment-tags-from-html-using-beautifulsoup/3507360) If the comments are meant to be preserved, you may work on a copy of soup.
Try to extract the text after finding the tag, that is: ``` result = "" for tag in soup.find_all('a'): if tag.text == "Australia": result = tag ```
10,871,651
My current PHP code is working and styling my "*Theme Options*" page (located under the WP API Appearance menu) the way I want it to look, however... The CSS stylesheet is also being applied to every other menu in the WP dashboard (such as affecting the "Settings > General-Options") page too. How am I able to go about applying the stylesheet just to my "*Theme Options*" page only and not tamper with anything else? My stylesheet is named 'theme-options.css", located within a folder called "include" > include/theme-options.css. The code below is placed within a "theme-options.php" page. ``` <?php // Add our CSS Styling add_action( 'admin_menu', 'admin_enqueue_scripts' ); function admin_enqueue_scripts() { wp_enqueue_style( 'theme-options', get_template_directory_uri() . '/include/theme-options.css' ); wp_enqueue_script( 'theme-options', get_template_directory_uri() . '/include/theme-options.js' ); } ```
2012/06/03
[ "https://Stackoverflow.com/questions/10871651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356483/" ]
I was placing the CSS & JS files separately from the building blocks of my page (just above that function). The code is now ***inside*** my page build function and I am now getting the results I was after. Previously: ``` ... // Add our CSS Styling function theme_admin_enqueue_scripts( $hook_suffix ) { wp_enqueue_style( 'theme-options', get_template_directory_uri() . '/include/theme-options.css', false, '1.0' ); wp_enqueue_script( 'theme-options', get_template_directory_uri() . '/include/theme-options.js', array( 'jquery' ), '1.0' ); // Build our Page function build_options_page() { ob_start(); ?> <div class="wrap"> <?php screen_icon();?> <h2>Theme Options</h2> <form method="post" action="options.php" enctype="multipart/form-data"> ... ... ``` Solution: ``` // Build our Page function build_options_page() { // Add our CSS Styling wp_enqueue_style( 'theme-options', get_template_directory_uri() . '/include/theme-options.css' ); wp_enqueue_script( 'theme-options', get_template_directory_uri() . '/include/theme-options.js' ); ob_start(); ?> <div class="wrap"> <?php screen_icon();?> <h2>Theme Options</h2> <form method="post" action="options.php" enctype="multipart/form-data"> ... ... ```
You could only add the css file if the current page is your special page by [checking the page](http://codex.wordpress.org/Function_Reference/is_page) before, e.g.: ``` if (is_page('Theme Options')) { // check post_title, post_name or ID here add_action( 'admin_menu', 'admin_enqueue_scripts' ); } ``` === UPDATE === Maybe it is better to check in the function: ``` <?php // Add our CSS Styling add_action( 'admin_menu', 'admin_enqueue_scripts' ); function admin_enqueue_scripts() { if (is_page('Theme Options')) { // check post_title, post_name or ID here wp_enqueue_style( 'theme-options', get_template_directory_uri() . '/include/theme-options.css' ); } wp_enqueue_script( 'theme-options', get_template_directory_uri() . '/include/theme-options.js' ); } ```
50,822,946
i'm new to sql and having trouble joining a query result table with an existing table. i've been trying to name the query result as res\_tab but it doesn't seem to work.i just want to be able to join the query result with an existing table. here's what i have so far: ``` (select distinct op_id from cmpr_dept_vmdb.cust_promotion where promo_id in ('TB4M40', 'TB4M41', 'TB4M42') and regstrn_status_cd = 'R') as res_tab; select elite_hist.op_id from cmpr_dept_vmdb.elite_hist_detail as elite_hist where elite_hist.instant_elt_promo_cd in ('F1', 'F2', 'F3') inner join elite_hist on res_tab.op_id = elite_hist.op_id ``` it's returning the following error: Syntax error: expected something between ')' and the 'as' keyword
2018/06/12
[ "https://Stackoverflow.com/questions/50822946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9424545/" ]
SQL `select` syntax is ``` [SELECT] ... [FROM] ..... [JOIN] .... [WHERE] .... [GROUP BY] ..... ``` You seem like want to `join` like this. ``` select elite_hist.op_id from cmpr_dept_vmdb.elite_hist_detail as elite_hist inner join ( select distinct op_id from cmpr_dept_vmdb.cust_promotion where promo_id in ('TB4M40', 'TB4M41', 'TB4M42') and regstrn_status_cd = 'R' ) as res_tab; on res_tab.op_id = elite_hist.op_id where elite_hist.instant_elt_promo_cd in ('F1', 'F2', 'F3') ```
You seems to want `subquery` with *correlation* approach correctly ``` select distinct elite_hist.op_id from cmpr_dept_vmdb.elite_hist_detail as elite_hist where instant_elt_promo_cd in ('F1', 'F2', 'F3') and exists (select 1 from cmpr_dept_vmdb.cust_promotion as res_tab where res_tab.op_id = elite_hist.op_id and res_tab.instant_elt_promo_cd in ('F1', 'F2', 'F3') and res_tab.regstrn_status_cd = 'R ); ```
444
I'm planning a whitewater rafting trip, and I'm worried what I should do if the raft flips over. Is there a standard set of procedures I should go through to get back on the raft?
2012/01/26
[ "https://outdoors.stackexchange.com/questions/444", "https://outdoors.stackexchange.com", "https://outdoors.stackexchange.com/users/39/" ]
Generally if someone asks this question they don't have a lot of experience and are going with a guide so I will approach it from that point of view. The first thing to do is bring your feet up to the top of the water and get to the raft as fast as you can. You want to keep your feet up to help against hitting any debris you may be floating over and or getting drawn by hydraulics (basically strong pulling water that is caused by passing over obstacles). The guide will probably crawl on top of the raft and flip it over by grabbing a side and using his weight as leverage. However, if the rapids are particularly strong at this point, it's not uncommon to get on the raft upside down and wait until you have reached a more docile point in the river to right it. Something that may go against your natural instincts, it's generally advised not to leave the raft and help others. This may end up in you getting separated from the raft and probably the other person. Biggest things to remember are: * Stay Calm * Stay with the raft * Do exactly as the guide says. He knows the river and knows what he is talking about.
Before leaving, make sure you know about white-water swimming techniques (float on your back with your feet at the surface pointing downstream). When you fall in, make sure you aren't tangled up in anything. Your biggest danger is getting something caught in the river bed (like loose rope catching between rocks) and being pushed down by the current. Where to aim for will depend on the situation, but in general, you want to stay close to, but upstream of the raft so you can't get "squashed" between the raft and any obstacle in the river. Another good thing to remember is keeping your paddle in your hands. Don't drop it as you fall in. First, you don't want to lose it, do you? But mostly, it can help you swim, and you can use it to push off rocks and direct yourself into a clearer part of the stream. You can also use it for extra stability while walking in waist-high flowing water, for example.
54,104,062
Here is a link to my github repo: <https://github.com/hertweckhr1/api_foodcycle> My user endpoints work great. However when I try to reach my endpoint localhost:8000/api/donation/donations, I get back the error: ProgrammingError at api/donation/donations relation "core\_donation" does not exist Line 1: ...n"."pickup\_endtime", "core\_donation"....: [Link to Error Message](https://i.stack.imgur.com/VTYsD.png) I have tried makemigrations donation and migrate several times. It says my migrations are up to date. Other posts similar to this, I have not been able to find a solution that works for me. Thanks in advance!
2019/01/09
[ "https://Stackoverflow.com/questions/54104062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10887957/" ]
It depends on which http module you are using. For "@angular/common/http", `this.http.get('https://yourapi.com').subscribe(data => { this.trackingorder = data; console.log(this.trackingorder.ShipmentData); }` For '@ionic-native/http', `this.http.get('https://yourapi.com').subscribe(data => { this.trackingorder = JSON.parse(data); console.log(this.trackingorder.ShipmentData); }`
If your using angular http then replace this line of code in your project. change this line to this.trackingorder = data; Below line ``` this.trackingorder = data.json(); ``` Should solve your problem. All the best.
54,104,062
Here is a link to my github repo: <https://github.com/hertweckhr1/api_foodcycle> My user endpoints work great. However when I try to reach my endpoint localhost:8000/api/donation/donations, I get back the error: ProgrammingError at api/donation/donations relation "core\_donation" does not exist Line 1: ...n"."pickup\_endtime", "core\_donation"....: [Link to Error Message](https://i.stack.imgur.com/VTYsD.png) I have tried makemigrations donation and migrate several times. It says my migrations are up to date. Other posts similar to this, I have not been able to find a solution that works for me. Thanks in advance!
2019/01/09
[ "https://Stackoverflow.com/questions/54104062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10887957/" ]
I found the following method working . Inside your .ts file use ``` this.http.get("https://track.delhivery.com/api/packages/json/?token=c7ac81cde31a5ea69d38cb098cab16cf7f909062&waybill=2285210000022") .subscribe((userData) => { console.log("shipment data" +userData); this.users.push(userData); }); ``` Inside the HTML file , use the following ``` <div *ngFor ="let Scan of users[0].ShipmentData[0].Shipment.Scans" class="item h5"> <div *ngIf="Scan.ScanDetail.Scan=='Manifested'"> <h5 style="font-size:12px;color:black;">• {{Scan.ScanDetail.ScannedLocation}}</h5> </div> ```
If your using angular http then replace this line of code in your project. change this line to this.trackingorder = data; Below line ``` this.trackingorder = data.json(); ``` Should solve your problem. All the best.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
If you highlight some code, you can right-click or run the command, `Run Selection/Line in Python Terminal`. We are also planning on [implementing Ctrl-Enter](https://github.com/Microsoft/vscode-python/issues/1349) to do the same thing and looking at [Ctr-Enter executing the current line](https://github.com/Microsoft/vscode-python/issues/480).
One way you can do it is through the Integrated Terminal. Here is the guide to open/use it: <https://code.visualstudio.com/docs/editor/integrated-terminal> After that, type `python3` or `python` since it is depending on what version you are using. Then, copy and paste the fraction of code you want to run into the terminal. It now has the same functionality as the console in Spyder. Hope this helps.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
In my ver of VSCode (1.25), shift+enter will run selection. Note that you will want to have your integrated terminal running python.
One way you can do it is through the Integrated Terminal. Here is the guide to open/use it: <https://code.visualstudio.com/docs/editor/integrated-terminal> After that, type `python3` or `python` since it is depending on what version you are using. Then, copy and paste the fraction of code you want to run into the terminal. It now has the same functionality as the console in Spyder. Hope this helps.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
You can: 1. open a terminal at *Terminal>New Terminal* 2. Highlight the code you want to run 3. Hit *Terminal>Run Selected Text* As for R you can hit `CTRL Enter` to execute the highlighted code. For python there's apparently no default shortcut (see below), but I am quite sure you can add yours. [![enter image description here](https://i.stack.imgur.com/GKgeh.png)](https://i.stack.imgur.com/GKgeh.png)
One way you can do it is through the Integrated Terminal. Here is the guide to open/use it: <https://code.visualstudio.com/docs/editor/integrated-terminal> After that, type `python3` or `python` since it is depending on what version you are using. Then, copy and paste the fraction of code you want to run into the terminal. It now has the same functionality as the console in Spyder. Hope this helps.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
If you highlight some code, you can right-click or run the command, `Run Selection/Line in Python Terminal`. We are also planning on [implementing Ctrl-Enter](https://github.com/Microsoft/vscode-python/issues/1349) to do the same thing and looking at [Ctr-Enter executing the current line](https://github.com/Microsoft/vscode-python/issues/480).
In my ver of VSCode (1.25), shift+enter will run selection. Note that you will want to have your integrated terminal running python.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
If you highlight some code, you can right-click or run the command, `Run Selection/Line in Python Terminal`. We are also planning on [implementing Ctrl-Enter](https://github.com/Microsoft/vscode-python/issues/1349) to do the same thing and looking at [Ctr-Enter executing the current line](https://github.com/Microsoft/vscode-python/issues/480).
I'm still trying to figure out how to make vscode do what I need (interactive python plots), but I can offer a more complete answer to the question at hand than what has been given so far: 1- Evaluate current selection in debug terminal is an option that is not enabled by default, so you may want to bind the 'editor.debug.action.selectionToRepl' action to whatever keyboard shortcut you choose (I'm using F9). As of today, there still appears to be no option to evaluate current line while debugging, only current selection. 2- Evaluate current line or selection in python terminal is enabled by default, but I'm on Windows where this isn't doing what I would expect - it evaluates in a new runtime, which does no good if you're trying to debug an existing runtime. So I can't say much about how useful this option is, or even if it is necessary since anytime you'd want to evaluate line-by-line, you'll be in debug mode anyway and sending to debug console as in 1 above. The Windows issue might have something to do with the settings.json entry "terminal.integrated.inheritEnv": true, not having an affect in Windows as of yet, per vscode documentation.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
You can: 1. open a terminal at *Terminal>New Terminal* 2. Highlight the code you want to run 3. Hit *Terminal>Run Selected Text* As for R you can hit `CTRL Enter` to execute the highlighted code. For python there's apparently no default shortcut (see below), but I am quite sure you can add yours. [![enter image description here](https://i.stack.imgur.com/GKgeh.png)](https://i.stack.imgur.com/GKgeh.png)
In my ver of VSCode (1.25), shift+enter will run selection. Note that you will want to have your integrated terminal running python.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
In my ver of VSCode (1.25), shift+enter will run selection. Note that you will want to have your integrated terminal running python.
I'm still trying to figure out how to make vscode do what I need (interactive python plots), but I can offer a more complete answer to the question at hand than what has been given so far: 1- Evaluate current selection in debug terminal is an option that is not enabled by default, so you may want to bind the 'editor.debug.action.selectionToRepl' action to whatever keyboard shortcut you choose (I'm using F9). As of today, there still appears to be no option to evaluate current line while debugging, only current selection. 2- Evaluate current line or selection in python terminal is enabled by default, but I'm on Windows where this isn't doing what I would expect - it evaluates in a new runtime, which does no good if you're trying to debug an existing runtime. So I can't say much about how useful this option is, or even if it is necessary since anytime you'd want to evaluate line-by-line, you'll be in debug mode anyway and sending to debug console as in 1 above. The Windows issue might have something to do with the settings.json entry "terminal.integrated.inheritEnv": true, not having an affect in Windows as of yet, per vscode documentation.
49,771,589
I just made the transition from Spyder to VScode for my python endeavours. Is there a way to run individual lines of code? That's how I used to do my on-the-spot debugging, but I can't find an option for it in VScode and really don't want to keep setting and removing breakpoints. Thanks.
2018/04/11
[ "https://Stackoverflow.com/questions/49771589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4482349/" ]
You can: 1. open a terminal at *Terminal>New Terminal* 2. Highlight the code you want to run 3. Hit *Terminal>Run Selected Text* As for R you can hit `CTRL Enter` to execute the highlighted code. For python there's apparently no default shortcut (see below), but I am quite sure you can add yours. [![enter image description here](https://i.stack.imgur.com/GKgeh.png)](https://i.stack.imgur.com/GKgeh.png)
I'm still trying to figure out how to make vscode do what I need (interactive python plots), but I can offer a more complete answer to the question at hand than what has been given so far: 1- Evaluate current selection in debug terminal is an option that is not enabled by default, so you may want to bind the 'editor.debug.action.selectionToRepl' action to whatever keyboard shortcut you choose (I'm using F9). As of today, there still appears to be no option to evaluate current line while debugging, only current selection. 2- Evaluate current line or selection in python terminal is enabled by default, but I'm on Windows where this isn't doing what I would expect - it evaluates in a new runtime, which does no good if you're trying to debug an existing runtime. So I can't say much about how useful this option is, or even if it is necessary since anytime you'd want to evaluate line-by-line, you'll be in debug mode anyway and sending to debug console as in 1 above. The Windows issue might have something to do with the settings.json entry "terminal.integrated.inheritEnv": true, not having an affect in Windows as of yet, per vscode documentation.
70,438,651
I have Amazon AWS S3 Bucket and images inside. Every object in my bucket has its own link. When I open it a browser ask me to download the image. So, it is a download link, but not directly the link of the image in the Internet. Of course, when I put it to `<img src="https://">` it doesn't works. So my question is *how I can display images from S3 on my client so that I will not be forced to download images instead of just watching them on the site*. My Stack: Nest.js & React.js (TypeScript) How I upload images: one service: ``` const svgBuffer = Buffer.from(svgString, 'utf-8'); mainRes = await uploadFile(currency, svgBuffer); ``` another service I got uploadFile function from: ``` uploadFile = (currency: string, svg: Buffer) => { const uploadParams = { Bucket: this.config.S3_BUCKET_NAME, Body: svg, Key: `${currency}-chart`, }; return this.s3.upload(uploadParams).promise(); }; ``` How I supposed to get my images: ``` <img src=`https://${s3bucketPath}/${imagePath}`> ```
2021/12/21
[ "https://Stackoverflow.com/questions/70438651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13284630/" ]
It could be a problem with object metadata. Check the metadata and validate the Content type. For example for an PNG image should be: ``` Content-Type='image/png' ``` If object's Content-Type is 'binary/octet-stream' then it will download instead of display. Add the corresponding parameter when uploading through JavaScript SDK: ``` const uploadParams = { Bucket: this.config.S3_BUCKET_NAME, Body: svg, Key: `${currency}-chart`, ContentType: 'image/png', }; ``` UPD from the author: Add this and all gonna work ``` ContentType: 'image/svg+xml' ```
After the image is uploaded you have multiple options to get them without downloading them to your application. --- The easiest one but not the best is getting them directly from the S3 Bucket. Let's say We have the bucket: `bucket-test`, You can get URL directly in the browser: [![ s3 bucket](https://i.stack.imgur.com/nsOkq.png)](https://i.stack.imgur.com/nsOkq.png) But Your object must be public which is unsafe. Moreover, it will be generating additional costs in the form of the transfer. --- The next option is to set up CloudFront which will create a CDN for your Then you are creating the CloudFront which points to S3 objects Some pros * Your bucket objects may be private. * This is also faster as images are cached in the AWS Cloudfront edges. * You can also set alternative names for your Cloudfront distribution and hide objects. Your traffic looks like this: ##### When an image is not cached USER <-> Cloudfront Edge <-> S3 ##### When the image is cached: USER <-> Cloudfront Edge Here is how to setup the CDN: <https://aws.amazon.com/cloudfront/getting-started/S3/>
661,575
I need to solve this: $y'' + ay' + by = x(t)$ where nothing about the form of $x$ is known, except that it is bounded and non-negative. In addition it is known that $y(0) = 0$ and $y'(0) = 0$ (and $y''(0) = 0$ as well). I plugged this into the [Wolfram ODE solver](http://www.wolframalpha.com/widgets/view.jsp?id=66d47ae0c1f736b76f1df86c0cc9205) and got back a 'possible Lagrangian', which I really don't know how to use. (I have an undergraduate degree in math but I never took differential equations.) I also found this resource [pt1](http://www.math.psu.edu/tseng/class/Math251/Notes-2nd%20order%20ODE%20pt1.pdf), [pt2](http://www.math.psu.edu/tseng/class/Math251/Notes-2nd%20order%20ODE%20pt2.pdf), but it assumes that the solution is exponential in nature, which seems to violate my initial conditions since exponentials are never 0. I'm hoping there's a way to get my head around this without putting myself through the full course of diff eq so any help would be much appreciated. **Update:** So actually Wolfram Alpha [will solve this equation](http://www.wolframalpha.com/input/?i=Solve%20the%20differential%20equation%20y%27%27%28t%29%20%2b%20a%2ay%27%28t%29%20%2b%20b%2ay%28t%29%20=%20x%28t%29) (simplified slightly in this edit), it was just the 'widget' that stopped short. However, it, as well as the techniques given in the references, explicitly assumes that the solution has an exponential form. Apparently this is a standard assumption but it is not the case for my data. $y$ is roughly sigmoidal. Coding up Wolfram's solution and choosing arbitrary constants $c\_1$, $c\_2$ so as to minimize the error in a case where $y$ was known produced a clearly wrong answer. So, I will sharpen my question: How to solve the above differential question *without* assuming that $y$ is proportional to $e^{\lambda t}$?
2014/02/03
[ "https://math.stackexchange.com/questions/661575", "https://math.stackexchange.com", "https://math.stackexchange.com/users/116930/" ]
Let $f\_\pm (t) := \exp(\lambda\_\pm t)$ where $\lambda\_\pm := (-a \pm \sqrt{a^2 - 4 b})/2$ be the fundamental solutions to the homogenous equation. Then the solution to the ODE, subject to $y(0)=r\_0$ and $y^{'}(0)= \mu\_0$, reads: \begin{equation} y(t) = \left(\begin{array}{cc} f\_+(t) & f\_-(t) \end{array}\right) \cdot \left( \begin{array}{cc} f\_+(0) & f\_-(0) \\ f\_+^{'}(0) & f\_-^{'}(0) \end{array} \right)^{-1} \cdot \left( \begin{array}{c} r\_0 \\ \mu\_0 \end{array} \right) + \int\limits\_0^t \left(\frac{f\_+(\xi) f\_-(t)-f\_-(\xi) f\_+(t)}{f\_+(\xi) f\_-^{'}(\xi) - f\_-(\xi) f\_+^{'}(\xi)}\right) x(\xi) d\xi \end{equation} This can be proven using the Green's function method, for instance. Now, the first term on the right hand side is the generic solution to the homogenous equation and the second term is a specific solution to the inhomogenous equation.The quantity in the denominator in the integrand is called the Wronskian $W(\xi)$ and it reads: \begin{equation} W(\xi) = (\lambda\_- - \lambda\_+) e^{(\lambda\_- + \lambda\_+) \xi} = - \sqrt{a^2 - 4 b} e^{-a \xi} \end{equation} In our case $r\_0=0$ and $\mu\_0 = 0$ and so the solution reads: \begin{equation} y(t) = \frac{-1}{\sqrt{a^2 - 4 b}} \left( e^{\lambda\_- t} \int\limits\_0^t e^{(\lambda\_++a) \xi} x(\xi) d \xi - e^{\lambda\_+ t} \int\limits\_0^t e^{(\lambda\_-+a) \xi} x(\xi) d \xi \right) \end{equation}
How about using variation of parameters? If you name $y\_i(t)$ as the two parts of the homogeneous solution, obtained by assuming exponentials, so $$y(t) = A y\_1(t) + B y\_2(t) + y\_p(t),$$ where $y\_p(t)$ is the particular solution of the ODE, then by using variation of parameters as follows: $$y(t) = A(t) y\_1(t),$$ you will conclude that: $$y\_p(t) = y\_1(t) \int M(t) \, dt, $$ where $M(t)$ is given by the following expression: $$M(t) = \frac{e^{-at}}{y\_1^2(t)} \int e^{at} y\_1(t) x(t) \, dt.$$ You should apply now the initial conditions to the final solution, $y(t)$. If you want me to elaborate some more on my answer, please let me know. Cheers!
661,575
I need to solve this: $y'' + ay' + by = x(t)$ where nothing about the form of $x$ is known, except that it is bounded and non-negative. In addition it is known that $y(0) = 0$ and $y'(0) = 0$ (and $y''(0) = 0$ as well). I plugged this into the [Wolfram ODE solver](http://www.wolframalpha.com/widgets/view.jsp?id=66d47ae0c1f736b76f1df86c0cc9205) and got back a 'possible Lagrangian', which I really don't know how to use. (I have an undergraduate degree in math but I never took differential equations.) I also found this resource [pt1](http://www.math.psu.edu/tseng/class/Math251/Notes-2nd%20order%20ODE%20pt1.pdf), [pt2](http://www.math.psu.edu/tseng/class/Math251/Notes-2nd%20order%20ODE%20pt2.pdf), but it assumes that the solution is exponential in nature, which seems to violate my initial conditions since exponentials are never 0. I'm hoping there's a way to get my head around this without putting myself through the full course of diff eq so any help would be much appreciated. **Update:** So actually Wolfram Alpha [will solve this equation](http://www.wolframalpha.com/input/?i=Solve%20the%20differential%20equation%20y%27%27%28t%29%20%2b%20a%2ay%27%28t%29%20%2b%20b%2ay%28t%29%20=%20x%28t%29) (simplified slightly in this edit), it was just the 'widget' that stopped short. However, it, as well as the techniques given in the references, explicitly assumes that the solution has an exponential form. Apparently this is a standard assumption but it is not the case for my data. $y$ is roughly sigmoidal. Coding up Wolfram's solution and choosing arbitrary constants $c\_1$, $c\_2$ so as to minimize the error in a case where $y$ was known produced a clearly wrong answer. So, I will sharpen my question: How to solve the above differential question *without* assuming that $y$ is proportional to $e^{\lambda t}$?
2014/02/03
[ "https://math.stackexchange.com/questions/661575", "https://math.stackexchange.com", "https://math.stackexchange.com/users/116930/" ]
I use the Laplace transform (see e.g. [here](http://en.wikipedia.org/wiki/Laplace_transform) ). Taking the Laplace transform of both sides we obtain $$ (as^2+bs+c)Y(s)=X(s), $$ $Y(s),X(s)$ are the Laplace transform of $y(t),x(t)$, respectively. (In fact, $x(t)$ can be distribution also, the so-called generalized function.) So we have $$ Y(s)=\frac{X(s)}{as^2+bs+c}. $$ Using the convolution theorem we obtain $$ y(t)=x(t)\*\mathcal{L}^{-1}\left(\frac{1}{as^2+bs+c} \right), $$ where $(f\*g)(t)=\int\_0^t f(t-v)g(v)\,dv$, and $f,g$ are piecewise continuous on $[0,\infty)$ (but this assumption can be relaxed). Using the partial fraction decomposition $$ \frac{1}{as^2+bs+c}=\frac{1}{a}\left(\frac{c\_1}{s-s\_1}+\frac{c\_2}{s-s\_2} \right), $$ or $$ \frac{1}{as^2+bs+c}=\frac{1}{a(s-s\_1)^2}. $$ Here $$ \mathcal{L}^{-1}\left(\frac{1}{s-A} \right)=e^{At}, \qquad\mathcal{L}^{-1}\left(\frac{1}{(s-A)^2} \right)=e^{At}t. $$
How about using variation of parameters? If you name $y\_i(t)$ as the two parts of the homogeneous solution, obtained by assuming exponentials, so $$y(t) = A y\_1(t) + B y\_2(t) + y\_p(t),$$ where $y\_p(t)$ is the particular solution of the ODE, then by using variation of parameters as follows: $$y(t) = A(t) y\_1(t),$$ you will conclude that: $$y\_p(t) = y\_1(t) \int M(t) \, dt, $$ where $M(t)$ is given by the following expression: $$M(t) = \frac{e^{-at}}{y\_1^2(t)} \int e^{at} y\_1(t) x(t) \, dt.$$ You should apply now the initial conditions to the final solution, $y(t)$. If you want me to elaborate some more on my answer, please let me know. Cheers!
661,575
I need to solve this: $y'' + ay' + by = x(t)$ where nothing about the form of $x$ is known, except that it is bounded and non-negative. In addition it is known that $y(0) = 0$ and $y'(0) = 0$ (and $y''(0) = 0$ as well). I plugged this into the [Wolfram ODE solver](http://www.wolframalpha.com/widgets/view.jsp?id=66d47ae0c1f736b76f1df86c0cc9205) and got back a 'possible Lagrangian', which I really don't know how to use. (I have an undergraduate degree in math but I never took differential equations.) I also found this resource [pt1](http://www.math.psu.edu/tseng/class/Math251/Notes-2nd%20order%20ODE%20pt1.pdf), [pt2](http://www.math.psu.edu/tseng/class/Math251/Notes-2nd%20order%20ODE%20pt2.pdf), but it assumes that the solution is exponential in nature, which seems to violate my initial conditions since exponentials are never 0. I'm hoping there's a way to get my head around this without putting myself through the full course of diff eq so any help would be much appreciated. **Update:** So actually Wolfram Alpha [will solve this equation](http://www.wolframalpha.com/input/?i=Solve%20the%20differential%20equation%20y%27%27%28t%29%20%2b%20a%2ay%27%28t%29%20%2b%20b%2ay%28t%29%20=%20x%28t%29) (simplified slightly in this edit), it was just the 'widget' that stopped short. However, it, as well as the techniques given in the references, explicitly assumes that the solution has an exponential form. Apparently this is a standard assumption but it is not the case for my data. $y$ is roughly sigmoidal. Coding up Wolfram's solution and choosing arbitrary constants $c\_1$, $c\_2$ so as to minimize the error in a case where $y$ was known produced a clearly wrong answer. So, I will sharpen my question: How to solve the above differential question *without* assuming that $y$ is proportional to $e^{\lambda t}$?
2014/02/03
[ "https://math.stackexchange.com/questions/661575", "https://math.stackexchange.com", "https://math.stackexchange.com/users/116930/" ]
It's simple with [Operator Calculus](http://www.alternatievewiskunde.nl/jaar2004/uitboek.pdf) . Quite analogous to Example 1 on page 3 of this PDF we have: $$ y'' + a y' + b y = x(t)$$ Operator Calculus enables us to "abstract" as much as possible from the solution $y(t)$ : $$ \left[ \left(\frac{d}{dt}\right)^2 + a \frac{d}{dt} + b \right] y(t) = x(t)$$ What we are going to do next is *decompose into factors*. We are (almost) forced to do so, because the operator $(d/dt)$ and the constants $a$ and $b$ mutually behave *as if* they were ordinary numbers: the commutator of a differentiation and a constant is zero. But the commutative law for ( linear ) operators is the only thing which *could* be deviant from algebra with ordinary numbers. $$ \left(\frac{d}{dt} \right)^2 + a \left(\frac{d}{dt} \right) + b = \left(\frac{d}{dt} - \lambda\_1 \right) \left(\frac{d}{dt} - \lambda\_2 \right) $$ $\lambda\_1$ and $\lambda\_2$ are roots of the so-called *characteristic equation* : $$ \lambda^2 + a \lambda + b = 0 \quad \Longrightarrow \quad \lambda\_{12}= (-a \pm \sqrt{a^2 - 4 b})/2 $$ Herewith, the differential equation can be rewritten as: $$ \left(\frac{d}{dt} - \lambda\_1 \right) \left(\frac{d}{dt} - \lambda\_2 \right) y(t) = x(t) $$ We are going to use now the "very useful formula" from Operator Calculus (please find it on page 2 of the abovementioned document) : $$ \frac{d}{dt} + f = e^{-\int f\,dt}\; \frac{d}{dt} \; e^{+\int f\,dt} $$ In our case: $$ \frac{d}{dt} - \lambda\_{1,2} = e^{ - \int - \lambda\_{1,2} \, dt} \ \frac{d}{dt}\ e^{ + \int - \lambda\_{1,2} \, dt} = e^{\, \lambda\_{1,2} t } \ \frac{d}{dt}\ e^{\, - \lambda\_{1,2} t } $$ Giving, at last, for the O.D.E. : $$ e^{ \lambda\_1 t } \frac{d}{dt}\ e^{ - \lambda\_1 t }\; e^{ \lambda\_2 t } \frac{d}{dt}\ e^{ - \lambda\_2 t } \; y(t) = x(t) $$ Systematic integration is possible now: $$ e^{-\lambda\_1 t} e^{\lambda\_2 t} \frac{d}{dt}\ e^{-\lambda\_2 t} y(t) = \int x(t) e^{ - \lambda\_1 t }\,dt $$ $$ y(t) = e^{\lambda\_2 t} \int e^{(\lambda\_1-\lambda\_2) t} \left[ \int x(t) e^{ - \lambda\_1 t }\,dt \right] \, dt $$ As has been said, $\lambda$ can be solved from $\lambda^2 + a\lambda + b = 0$, a quadratic equation with discriminant: $ D=a^2-4b$. Real valued as well as complex solutions are possible. A special case for $D=0$ may be distinguished; in this case $ \lambda\_1 = \lambda\_2 $ and $e^{(\lambda\_1-\lambda\_2)t} = 1$ . EDIT. Almost forgot the boundary conditions $y(0)=y'(0)=0$ to take into account: $$ y(t) = e^{\lambda\_2 t} \int\_0^t e^{(\lambda\_1-\lambda\_2) u} \left[ \int\_0^u x(v) e^{ - \lambda\_1 v }\,dv \right] \, du $$ **Note.** If "nothing about the form of x is known" - but why a bounded & non-negative requirement - then $y''(0) = 0$ is in general **not true** , unless $x(0) = 0$ : $$ y''(t) = \lambda\_2^2 e^{\lambda\_2 t} \int\_0^t e^{(\lambda\_1-\lambda\_2) u} \left[ \int\_0^u x(v) e^{ - \lambda\_1 v }\,dv \right] \, du + (\lambda\_1 + \lambda\_2) e^{\lambda\_1 t} \int\_0^t x(v) e^{ - \lambda\_1 v }\,dv \; + \; x(t) $$ With differential equations of the kind, $\,y''(0) = 0\,$ cannot serve as a boundary condition anyway.
How about using variation of parameters? If you name $y\_i(t)$ as the two parts of the homogeneous solution, obtained by assuming exponentials, so $$y(t) = A y\_1(t) + B y\_2(t) + y\_p(t),$$ where $y\_p(t)$ is the particular solution of the ODE, then by using variation of parameters as follows: $$y(t) = A(t) y\_1(t),$$ you will conclude that: $$y\_p(t) = y\_1(t) \int M(t) \, dt, $$ where $M(t)$ is given by the following expression: $$M(t) = \frac{e^{-at}}{y\_1^2(t)} \int e^{at} y\_1(t) x(t) \, dt.$$ You should apply now the initial conditions to the final solution, $y(t)$. If you want me to elaborate some more on my answer, please let me know. Cheers!
337,258
For example, > > In NoSQL, ***technically*** replication and sharding ***approach*** is used for supporting **large data**. > > > Was reading [this article](http://highscalability.com/blog/2010/12/6/what-the-heck-are-you-actually-using-nosql-for.html) about NoSQL use cases. It mentions that NoSQL can be used for **faster key-value access**: > > This is probably the second most cited virtue of NoSQL in the general mind set. When latency is important it's hard to beat hashing on a key and reading the value directly from memory or in as little as one disk seek. Not every NoSQL product is about fast access, some are more about reliability, for example. but what people have wanted for a long time was a better memcached and many NoSQL systems offer that. > > > What ***technical approach*** does Key-Value NoSQL databases take to provide **faster key-value access**? `replication and sharding` is to `large data` `???` is to `faster key-value access`
2016/12/01
[ "https://softwareengineering.stackexchange.com/questions/337258", "https://softwareengineering.stackexchange.com", "https://softwareengineering.stackexchange.com/users/255180/" ]
The first big difference is that key-value stores require the user to have the entire key for lookup, and can *only* be looked up by the key. Contrast that with relational databases which can typically be looked up by partial values of any column. This means a key-value store can create a hash of that key and use that hash to determine a *precise* node and disk location where the record is stored. Relational databases have a much more involved process to locate and retrieve a record, because of inherent extra complexity. This single key also makes possible a single ordering on disk. Key-value stores typically keep a memory cache, an append-only commit log, then occasionally write out a more permanent compacted and sorted storage to disk. Relational databases don't have a single ordering that makes sense, so they can't take advantage of this optimization. Most key-value stores also offer the ability to tune the consistency level, so if you have 3 replicas of each record, you can accept a write as complete after only 2 nodes have reported complete, for example, or even 1, if you like to live on the edge and the data isn't critical. All 3 replicas will be written eventually, but the client doesn't wait for it. This is called *eventual consistency*. Most relational databases maintain absolute consistency at all times, which keeps your data somewhat safer, but also costs speed. Last but not least, since key-value stores can only be looked up by their keys, users end up trading storage space for speed. Where relational database users might do a join that is relatively slow to execute at query time, key-value users will have written redundant tables in parallel at write time, and can query just as fast as any other single-table query. For example, a relational join of a `players` and `location` table would end up as a query using a `(player, location)` tuple for a key, with completely redundant records to a table containing just the `player` key. In summary, key-value stores accept limitations like requiring full keys for lookup, lack of joins, eventual consistency, and need for extra storage in exchange for greater speed.
If you're just looking at `NoSQL` generally, versus confined to key-value stores, the possible answers increase. Certainly with `BaseX`, and I'm sure other `XML`, or, even some `JSON` based databases, `XQuery` provides most of the [general](https://en.wikipedia.org/wiki/FLWOR) functionality of `SQL`: > > The programming language XQuery defines FLWOR (pronounced 'flower') as > an expression that supports iteration and binding of variables to > intermediate results. FLWOR is an acronym: FOR, LET, WHERE, ORDER BY, > RETURN.[1](https://en.wikipedia.org/wiki/FLWOR) FLWOR is loosely analogous to SQL's SELECT-FROM-WHERE and > can be used to provide join-like functionality to XML documents. > > > But, that's primarily for, at least, `XML` databases, and explicitly not key-value stores. Looking at the history of `SQL`, today's cheap storage, memory and processing would've no doubt changed how that language was designed. For, probably, some very large databases, any `XQuery` processing might very well be sufficiently fast.
820
I often hear people say "less than", but shouldn't it be "lesser than"? Which one is correct?
2013/01/31
[ "https://ell.stackexchange.com/questions/820", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
*Less*, *lesser*, and *littler* are all comparative forms of *little*. They are used like this: * **little - littler - littlest** when you mean "small in size" * **little - less - least** when you mean "small in amount" * **little - lesser - least** when you mean "inferior or smaller in importance" So if you mean one quantity or number is smaller than another, you say "less than".
You would say **less than** or **the lesser of**. Not **lesser than**. However, it largely depends on the sentence in which you're using your particular example, as it may be that using '**fewer than**' instead of '**less than**' is correct. * 'Less' means not as much * 'Fewer' means 'not as many' For example, if I'm holding three apples I have '*fewer than 4 apples*'. If I'm holding half a kilogram of sugar, I have '*less than a kilogram of sugar*'. Here's a BBC article highlighting this often-made mistake: <http://news.bbc.co.uk/1/hi/magazine/7591905.stm>
820
I often hear people say "less than", but shouldn't it be "lesser than"? Which one is correct?
2013/01/31
[ "https://ell.stackexchange.com/questions/820", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
*Less*, *lesser*, and *littler* are all comparative forms of *little*. They are used like this: * **little - littler - littlest** when you mean "small in size" * **little - less - least** when you mean "small in amount" * **little - lesser - least** when you mean "inferior or smaller in importance" So if you mean one quantity or number is smaller than another, you say "less than".
"Lesser than" would be incorrect since "lesser" and "than" both imply a comparison, which makes them redundant when used together. It would have to either be "less than" or "lesser" only.
820
I often hear people say "less than", but shouldn't it be "lesser than"? Which one is correct?
2013/01/31
[ "https://ell.stackexchange.com/questions/820", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
"Lesser than" would be incorrect since "lesser" and "than" both imply a comparison, which makes them redundant when used together. It would have to either be "less than" or "lesser" only.
You would say **less than** or **the lesser of**. Not **lesser than**. However, it largely depends on the sentence in which you're using your particular example, as it may be that using '**fewer than**' instead of '**less than**' is correct. * 'Less' means not as much * 'Fewer' means 'not as many' For example, if I'm holding three apples I have '*fewer than 4 apples*'. If I'm holding half a kilogram of sugar, I have '*less than a kilogram of sugar*'. Here's a BBC article highlighting this often-made mistake: <http://news.bbc.co.uk/1/hi/magazine/7591905.stm>
3,283,984
In Python 2, converting the hexadecimal form of a string into the corresponding unicode was straightforward: ``` comments.decode("hex") ``` where the variable 'comments' is a part of a line in a file (the rest of the line does *not* need to be converted, as it is represented only in ASCII. Now in Python 3, however, this doesn't work (I assume because of the bytes/string vs. string/unicode switch. I feel like there should be a one-liner in Python 3 to do the same thing, rather than reading the entire line as a series of bytes (which I don't want to do) and then converting each part of the line separately. If it's possible, I'd like to read the entire line as a unicode string (because the rest of the line is in unicode) and only convert this one part from a hexadecimal representation.
2010/07/19
[ "https://Stackoverflow.com/questions/3283984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391126/" ]
Something like: ``` >>> bytes.fromhex('4a4b4c').decode('utf-8') 'JKL' ``` Just put the actual encoding you are using.
``` import codecs decode_hex = codecs.getdecoder("hex_codec") # for an array msgs = [decode_hex(msg)[0] for msg in msgs] # for a string string = decode_hex(string)[0] ```
3,283,984
In Python 2, converting the hexadecimal form of a string into the corresponding unicode was straightforward: ``` comments.decode("hex") ``` where the variable 'comments' is a part of a line in a file (the rest of the line does *not* need to be converted, as it is represented only in ASCII. Now in Python 3, however, this doesn't work (I assume because of the bytes/string vs. string/unicode switch. I feel like there should be a one-liner in Python 3 to do the same thing, rather than reading the entire line as a series of bytes (which I don't want to do) and then converting each part of the line separately. If it's possible, I'd like to read the entire line as a unicode string (because the rest of the line is in unicode) and only convert this one part from a hexadecimal representation.
2010/07/19
[ "https://Stackoverflow.com/questions/3283984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391126/" ]
Something like: ``` >>> bytes.fromhex('4a4b4c').decode('utf-8') 'JKL' ``` Just put the actual encoding you are using.
The answers from @unbeli and @Niklas are good, but @unbeli's answer does not work for all hex strings and it is desirable to do the decoding without importing an extra library (codecs). The following should work (but will not be very efficient for large strings): ```py >>> result = bytes.fromhex((lambda s: ("%s%s00" * (len(s)//2)) % tuple(s))('4a82fdfeff00')).decode('utf-16-le') >>> result == '\x4a\x82\xfd\xfe\xff\x00' True ``` Basically, it works around having invalid utf-8 bytes by padding with zeros and decoding as utf-16.
3,283,984
In Python 2, converting the hexadecimal form of a string into the corresponding unicode was straightforward: ``` comments.decode("hex") ``` where the variable 'comments' is a part of a line in a file (the rest of the line does *not* need to be converted, as it is represented only in ASCII. Now in Python 3, however, this doesn't work (I assume because of the bytes/string vs. string/unicode switch. I feel like there should be a one-liner in Python 3 to do the same thing, rather than reading the entire line as a series of bytes (which I don't want to do) and then converting each part of the line separately. If it's possible, I'd like to read the entire line as a unicode string (because the rest of the line is in unicode) and only convert this one part from a hexadecimal representation.
2010/07/19
[ "https://Stackoverflow.com/questions/3283984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391126/" ]
``` import codecs decode_hex = codecs.getdecoder("hex_codec") # for an array msgs = [decode_hex(msg)[0] for msg in msgs] # for a string string = decode_hex(string)[0] ```
The answers from @unbeli and @Niklas are good, but @unbeli's answer does not work for all hex strings and it is desirable to do the decoding without importing an extra library (codecs). The following should work (but will not be very efficient for large strings): ```py >>> result = bytes.fromhex((lambda s: ("%s%s00" * (len(s)//2)) % tuple(s))('4a82fdfeff00')).decode('utf-16-le') >>> result == '\x4a\x82\xfd\xfe\xff\x00' True ``` Basically, it works around having invalid utf-8 bytes by padding with zeros and decoding as utf-16.
2,053,854
Let $0 < p < 1$ and $f: X \longrightarrow (0,\infty)$ measuarable with $\int\_X f d\mu = 1$. Prove that $\int\_A f^p d\mu \leq \mu(A)^{1-p}$. Someone please help?
2016/12/11
[ "https://math.stackexchange.com/questions/2053854", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
It's a direct application of Hölder's inequality, using the exponents $1/p $ and $1/(1-1/(1/p))=1-p $. So $$ \int\_A f^p\,d\mu\leq\left (\int\_A (f^p)^{1/p}\,d\mu\right)^p\left (\int\_A1^{1/(1-p)}\,d\mu\right)^{1-p}\leq\mu (A)^{1-p}. $$
This is just an application of Holder's inequality. Try using it to bound $$\int\_Af^pd\mu = \int\_{X} f^p \cdot \mathbb{1}\_{A} d \mu.$$ Edit: extra clarification. Holder's inequality states $\|hg\|\_1 \le \|h\|\_r\|g\|\_s =\left(\int\_X |h|^r d\mu\right)^{1/r} \cdot \left(\int\_X |g|^s d\mu\right)^{1/s}$ if $r,s \in [1,\infty]$ satisfy $1/r + 1/s =1$. We are taking $h = f^p$, $g=1\_A$ and $r=1/p$ (notice that $r \in [1,\infty]$ since $0<p<1$). To use Holder's we need $1/s = 1 - 1/r = 1-p $ i.e. $s = 1/(1-p)$. Combining all of this (and noticing that $f$ is positive so we need not worry about absolute values), \begin{align\*} \int\_A f^p d\mu &= \int\_X f^p \cdot 1\_A d\mu\\ &\le \left(\int\_X(f^p)^{1/p}d\mu\right)^p \cdot\left(\int\_X (1\_A)^{1/(1-p)} d\mu\right)^{1-p}\\ &= 1 \cdot \left(\int\_X 1\_A d\mu\right)^{1-p}\\ &= \mu(A)^{1-p} \end{align\*}
26,835,786
I think I am getting a vector overflow.(?) However I do not know how to solve it. The exercise I am trying to complete states the following: Exercise 3.20 Part 1: Read a set of integers into a vector. Print the sum of each pair of adjacent elements. location of run time error: ``` for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1]. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. ``` The code for the whole program is below. ``` #include "stdafx.h" #include <iostream> #include <vector> using namespace std; int main(){ vector<int> ivec; decltype (ivec.size()) v1 = 0; unsigned int i1 = 0; while (cin >> i1){ ivec.push_back(i1);} // receive input and stores into ivec. for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1], v1 is now = 1. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. } system("pause"); return 0; } ```
2014/11/10
[ "https://Stackoverflow.com/questions/26835786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3089453/" ]
It will update your entity. The Sugar ORM overwriting your existing e.g Name and updated it with "new name" after the save() method call.
Updating a saved object is pretty straightforward. Retrieve the object; ``` Object object= Object.findById(Object.class, ID); ``` Set the attributes you need to; ``` object.setAttr("new value"); ``` Then finally call save; ``` object.save(); ``` Alternatively, as someone mentioned above one can choose to use update() which works slightly differently and would ideally be used when changing several attributes; First create the object and set the necessary attributes; ``` Object object= new Object(); object.setAttr("some data"); ``` Then set an ID for the Object that **ideally already exists** in the database in order to target that item for replacement; ``` object.setID(ID); ``` And finally; ``` object.update(); ```
26,835,786
I think I am getting a vector overflow.(?) However I do not know how to solve it. The exercise I am trying to complete states the following: Exercise 3.20 Part 1: Read a set of integers into a vector. Print the sum of each pair of adjacent elements. location of run time error: ``` for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1]. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. ``` The code for the whole program is below. ``` #include "stdafx.h" #include <iostream> #include <vector> using namespace std; int main(){ vector<int> ivec; decltype (ivec.size()) v1 = 0; unsigned int i1 = 0; while (cin >> i1){ ivec.push_back(i1);} // receive input and stores into ivec. for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1], v1 is now = 1. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. } system("pause"); return 0; } ```
2014/11/10
[ "https://Stackoverflow.com/questions/26835786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3089453/" ]
It will update your entity. The Sugar ORM overwriting your existing e.g Name and updated it with "new name" after the save() method call.
Save and Object methods are completely different and both are really useful. If you have an object and you say: ``` Object.save(); ``` That will override all of the other fields as well for example: ``` column1 column2 1 1 ``` if in your object you have only set column1 corresponding field a number like 2 you will get: **Object.save();** ``` column1 column2 2 NULL ``` **Object.update();** ``` column1 column2 2 1 ``` You don't need to use .setId() explicitly to get update working it looks for a unique item if it's found it will update that,if not it will create a new row.By default an auto increment ID column is added to each of your tables and used as unique ids for update.If you need your own fields to be unique use: ``` @Unique String MyID ``` or for multiple of the same thing you can use: ``` @MultiUnique("MyFirstID,MySecondID") public class MyClass extends SugarRecord {... ``` which both are name of your fields in the table.
26,835,786
I think I am getting a vector overflow.(?) However I do not know how to solve it. The exercise I am trying to complete states the following: Exercise 3.20 Part 1: Read a set of integers into a vector. Print the sum of each pair of adjacent elements. location of run time error: ``` for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1]. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. ``` The code for the whole program is below. ``` #include "stdafx.h" #include <iostream> #include <vector> using namespace std; int main(){ vector<int> ivec; decltype (ivec.size()) v1 = 0; unsigned int i1 = 0; while (cin >> i1){ ivec.push_back(i1);} // receive input and stores into ivec. for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1], v1 is now = 1. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. } system("pause"); return 0; } ```
2014/11/10
[ "https://Stackoverflow.com/questions/26835786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3089453/" ]
Your code should update the row without issue. [From the docs - Update Entity](http://satyan.github.io/sugar/getting-started.html): ``` Book book = Book.findById(Book.class, 1); book.title = "updated title here"; // modify the values book.edition = "3rd edition"; book.save(); // updates the previous entry with new values. ```
Updating a saved object is pretty straightforward. Retrieve the object; ``` Object object= Object.findById(Object.class, ID); ``` Set the attributes you need to; ``` object.setAttr("new value"); ``` Then finally call save; ``` object.save(); ``` Alternatively, as someone mentioned above one can choose to use update() which works slightly differently and would ideally be used when changing several attributes; First create the object and set the necessary attributes; ``` Object object= new Object(); object.setAttr("some data"); ``` Then set an ID for the Object that **ideally already exists** in the database in order to target that item for replacement; ``` object.setID(ID); ``` And finally; ``` object.update(); ```
26,835,786
I think I am getting a vector overflow.(?) However I do not know how to solve it. The exercise I am trying to complete states the following: Exercise 3.20 Part 1: Read a set of integers into a vector. Print the sum of each pair of adjacent elements. location of run time error: ``` for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1]. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. ``` The code for the whole program is below. ``` #include "stdafx.h" #include <iostream> #include <vector> using namespace std; int main(){ vector<int> ivec; decltype (ivec.size()) v1 = 0; unsigned int i1 = 0; while (cin >> i1){ ivec.push_back(i1);} // receive input and stores into ivec. for (int sum; v1 < ivec.size();++v1){ //executes for statement as long as v1 < ivec.size() is true. sum = ivec[v1] + ivec[v1 + 1]; // same as sum = ivec[0] + ivec[1], v1 is now = 1. cout << sum << endl; sum = 0; // prints the result of sum = ivec[v1] + ivec[v1 + 1]. } system("pause"); return 0; } ```
2014/11/10
[ "https://Stackoverflow.com/questions/26835786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3089453/" ]
Your code should update the row without issue. [From the docs - Update Entity](http://satyan.github.io/sugar/getting-started.html): ``` Book book = Book.findById(Book.class, 1); book.title = "updated title here"; // modify the values book.edition = "3rd edition"; book.save(); // updates the previous entry with new values. ```
Save and Object methods are completely different and both are really useful. If you have an object and you say: ``` Object.save(); ``` That will override all of the other fields as well for example: ``` column1 column2 1 1 ``` if in your object you have only set column1 corresponding field a number like 2 you will get: **Object.save();** ``` column1 column2 2 NULL ``` **Object.update();** ``` column1 column2 2 1 ``` You don't need to use .setId() explicitly to get update working it looks for a unique item if it's found it will update that,if not it will create a new row.By default an auto increment ID column is added to each of your tables and used as unique ids for update.If you need your own fields to be unique use: ``` @Unique String MyID ``` or for multiple of the same thing you can use: ``` @MultiUnique("MyFirstID,MySecondID") public class MyClass extends SugarRecord {... ``` which both are name of your fields in the table.
33,081,454
In my application I have splitted my classes into files: One class for example looks like: ``` module App.Classes.Bootgrid { import DefaultJQueryAjaxSettings = App.Classes.JQuery.DefaultJQueryAjaxSettings; export class DefaultBootgridOptions implements IBootgridOptions { ajax = true; columnSelection= false; ajaxSettings= new DefaultJQueryAjaxSettings(); } } ``` Whereas DefaultJQueryAjaxSettings.ts looks like ``` module App.Classes.JQuery { export class DefaultJQueryAjaxSettings implements JQueryAjaxSettings { async =false; contentType = "application/x-www-form-urlencoded; charset=UTF-8"; method = "GET"; statusCode: { [index: string]: any; }; type = "GET"; } } ``` At runtime I always get the the error: > > Uncaught TypeError: Cannot read property 'DefaultJQueryAjaxSettings' of undefined > > > as of App.Classes.JQuery is `undefined` at point of execution. Looking at the `Network` tab in Chromes Developer tools, it shows me, that `DefaultJQueryAjaxSettings.js` file is loaded **after** the `DefaultBootgridOptions.js` which causes for sure the described error. How can I set the order of the file to be loaded?
2015/10/12
[ "https://Stackoverflow.com/questions/33081454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615288/" ]
If you are just dealing with an `int` and `double` then you could just overload the function for the differnt types of vectors. ``` int getValue(vector<int> & data) { return 0; } int getValue(vector<double> & data) { return 1; } ``` If you want to keep `getValue` as a template function and specialize for `int` and `double` then you could use ``` template<typename T> int getValue(std::vector<T> & data) { return -1; } template <> int getValue(std::vector<int> & data) { return 0; } template <> int getValue(std::vector<double> & data) { return 1; } ``` `[Live Example](http://coliru.stacked-crooked.com/a/e3100ae63360d5b5)`
You can provide non-template overloads while keeping the template. Since function resolution prefers non-template matches over templates. Example: ``` template <typename T> int getValue( std::vector<T> & data ) { return -1; // default template } int getValue( std::vector<int> & data ) { return 0; // int overload } int getValue( std::vector<double> & data ) { return 1; // double overload } ``` Here's an example using specialization: ``` template <typename T> int getValue( std::vector<T> & data ) { return -1; // default template } template <> int getValue<int>( std::vector<int> & data ) { return 0; // int specialization } template <> int getValue<double>( std::vector<double> & data ) { return 1; // double specialization } ```
33,081,454
In my application I have splitted my classes into files: One class for example looks like: ``` module App.Classes.Bootgrid { import DefaultJQueryAjaxSettings = App.Classes.JQuery.DefaultJQueryAjaxSettings; export class DefaultBootgridOptions implements IBootgridOptions { ajax = true; columnSelection= false; ajaxSettings= new DefaultJQueryAjaxSettings(); } } ``` Whereas DefaultJQueryAjaxSettings.ts looks like ``` module App.Classes.JQuery { export class DefaultJQueryAjaxSettings implements JQueryAjaxSettings { async =false; contentType = "application/x-www-form-urlencoded; charset=UTF-8"; method = "GET"; statusCode: { [index: string]: any; }; type = "GET"; } } ``` At runtime I always get the the error: > > Uncaught TypeError: Cannot read property 'DefaultJQueryAjaxSettings' of undefined > > > as of App.Classes.JQuery is `undefined` at point of execution. Looking at the `Network` tab in Chromes Developer tools, it shows me, that `DefaultJQueryAjaxSettings.js` file is loaded **after** the `DefaultBootgridOptions.js` which causes for sure the described error. How can I set the order of the file to be loaded?
2015/10/12
[ "https://Stackoverflow.com/questions/33081454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615288/" ]
If you are just dealing with an `int` and `double` then you could just overload the function for the differnt types of vectors. ``` int getValue(vector<int> & data) { return 0; } int getValue(vector<double> & data) { return 1; } ``` If you want to keep `getValue` as a template function and specialize for `int` and `double` then you could use ``` template<typename T> int getValue(std::vector<T> & data) { return -1; } template <> int getValue(std::vector<int> & data) { return 0; } template <> int getValue(std::vector<double> & data) { return 1; } ``` `[Live Example](http://coliru.stacked-crooked.com/a/e3100ae63360d5b5)`
Two important operators to type manipulation is typeid and decltype. [typeid](http://en.cppreference.com/w/cpp/language/typeid) return a object type\_info with type information. Some ways of verify types is: * std::is\_same * typeid * function overload If you are using c++11 the better option should be std::is\_same with a delctype (detects the type of variable), because it's compile time resolution. ``` vector<int> integers; vector<double> doubles; cout << is_same<vector<int>, decltype(integers)>::value << endl; cout << is_same<vector<int>, decltype(doubles)>::value << endl; cout << is_same<vector<double>, decltype(integers)>::value << endl; cout << is_same<vector<double>, decltype(doubles)>::value << endl; ``` If you are using standard C++ (c++98), you can use typeid operator ``` vector<int> vectorInt; vector<int> integers; vector<double> doubles; cout << ( typeid(integers) == typeid(vectorInt) ) << endl; cout << ( typeid(doubles) == typeid(vectorInt) ) << endl; ``` You can use function overload and templates to resolve this types without unexpected broke. At this way do you need write a function to each type to identify or the template function will return -1 (unknow) like identification. ``` template<typename T> int getTypeId(T) { return -1; } int getTypeId(vector<int>) { return 1; } main() { vector<int> integers; vector<double> doubles; vector<char> chars; cout << getTypeId(integers) << endl; cout << getTypeId(doubles) << endl; cout << getTypeId(chars) << endl; } ```
33,081,454
In my application I have splitted my classes into files: One class for example looks like: ``` module App.Classes.Bootgrid { import DefaultJQueryAjaxSettings = App.Classes.JQuery.DefaultJQueryAjaxSettings; export class DefaultBootgridOptions implements IBootgridOptions { ajax = true; columnSelection= false; ajaxSettings= new DefaultJQueryAjaxSettings(); } } ``` Whereas DefaultJQueryAjaxSettings.ts looks like ``` module App.Classes.JQuery { export class DefaultJQueryAjaxSettings implements JQueryAjaxSettings { async =false; contentType = "application/x-www-form-urlencoded; charset=UTF-8"; method = "GET"; statusCode: { [index: string]: any; }; type = "GET"; } } ``` At runtime I always get the the error: > > Uncaught TypeError: Cannot read property 'DefaultJQueryAjaxSettings' of undefined > > > as of App.Classes.JQuery is `undefined` at point of execution. Looking at the `Network` tab in Chromes Developer tools, it shows me, that `DefaultJQueryAjaxSettings.js` file is loaded **after** the `DefaultBootgridOptions.js` which causes for sure the described error. How can I set the order of the file to be loaded?
2015/10/12
[ "https://Stackoverflow.com/questions/33081454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615288/" ]
You can provide non-template overloads while keeping the template. Since function resolution prefers non-template matches over templates. Example: ``` template <typename T> int getValue( std::vector<T> & data ) { return -1; // default template } int getValue( std::vector<int> & data ) { return 0; // int overload } int getValue( std::vector<double> & data ) { return 1; // double overload } ``` Here's an example using specialization: ``` template <typename T> int getValue( std::vector<T> & data ) { return -1; // default template } template <> int getValue<int>( std::vector<int> & data ) { return 0; // int specialization } template <> int getValue<double>( std::vector<double> & data ) { return 1; // double specialization } ```
Two important operators to type manipulation is typeid and decltype. [typeid](http://en.cppreference.com/w/cpp/language/typeid) return a object type\_info with type information. Some ways of verify types is: * std::is\_same * typeid * function overload If you are using c++11 the better option should be std::is\_same with a delctype (detects the type of variable), because it's compile time resolution. ``` vector<int> integers; vector<double> doubles; cout << is_same<vector<int>, decltype(integers)>::value << endl; cout << is_same<vector<int>, decltype(doubles)>::value << endl; cout << is_same<vector<double>, decltype(integers)>::value << endl; cout << is_same<vector<double>, decltype(doubles)>::value << endl; ``` If you are using standard C++ (c++98), you can use typeid operator ``` vector<int> vectorInt; vector<int> integers; vector<double> doubles; cout << ( typeid(integers) == typeid(vectorInt) ) << endl; cout << ( typeid(doubles) == typeid(vectorInt) ) << endl; ``` You can use function overload and templates to resolve this types without unexpected broke. At this way do you need write a function to each type to identify or the template function will return -1 (unknow) like identification. ``` template<typename T> int getTypeId(T) { return -1; } int getTypeId(vector<int>) { return 1; } main() { vector<int> integers; vector<double> doubles; vector<char> chars; cout << getTypeId(integers) << endl; cout << getTypeId(doubles) << endl; cout << getTypeId(chars) << endl; } ```
21,457,105
I'm trying to click on state link given url then print title of next page and go back, then click another state link dynamically using for loop. But loop stops after initial value. My code is as below: ``` public class Allstatetitleclick { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.get("http://www.adspapa.com/"); WebElement catBox = driver.findElement(By.xpath("html/body/table[1]/tbody/tr/td/table/tbody/tr/td[1]/table")); List<WebElement> catValues = catBox.findElements(By.tagName("a")); System.out.println(catValues.size()); for(int i=0;i<catValues.size();i++){ //System.out.println(catValues.get(i).getText()); catValues.get(i).click(); System.out.println(driver.getTitle()); driver.navigate().back(); } System.out.println("TEST"); } } ```
2014/01/30
[ "https://Stackoverflow.com/questions/21457105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3253148/" ]
The problem is after navigating back the elements found previously will be expired. Hence we need to update the code to refind the elements after navigate back. Update the code below : ``` WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.get("http://www.adspapa.com/"); WebElement catBox = driver.findElement(By.xpath("html/body/table[1]/tbody/tr/td/table/tbody/tr/td[1]/table")); List<WebElement> catValues = catBox.findElements(By.tagName("a")); for(int i=0;i<catValues.size();i++) { catValues.get(i).click(); System.out.println(driver.getTitle()); driver.navigate().back(); catBox = driver.findElement(By.xpath("html/body/table[1]/tbody/tr/td/table/tbody/tr/td[1]/table")); catValues = catBox.findElements(By.tagName("a")); } driver.quit(); ``` I have tested above code at my end and its working fine.You can improve the above code as per your use.
Note: I have executed this and its working fine now.It will give you the size and clicking on every link.It was a issue where you need to go inside the Frame. It has a Frame where you need to switch. Please copy and paste and execute it. Hope you find your answer.
29,677,339
I'm getting an `InvalidStateError` at the blob creation line on IE 11. Needless to say, it works in Chrome and Firefox. I can see that the binary data is my client side. Are there any alternatives to download this as a file? ``` var request = new ActiveXObject("MicrosoftXMLHTTP"); request.open("post", strURL, true); request.setRequestHeader("Content-type", "text/html"); addSecureTokenHeader(request); request.responseType = 'blob'; request.onload = function(event) { if (request.status == 200) { var blob = new Blob([request.response], { type: 'application/pdf' }); var url = URL.createObjectURL(blob); var link = document.querySelector('#sim'); link.setAttribute('href', url); var filename = request.getResponseHeader('Content-Disposition'); $('#sim').attr("download", filename); $(link).trigger('click'); fireEvent(link, 'click'); } else { // handle error } } ```
2015/04/16
[ "https://Stackoverflow.com/questions/29677339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709463/" ]
After instantiating an `XmlHttpRequest` with `xhr.responseType = "blob"` I was getting an `InvalidStateError`. However, moving `xhr.responseType = "blob"` to `onloadstart` solved it for me! :) ``` xhr.onloadstart = function(ev) { xhr.responseType = "blob"; } ```
Is not a elegant way but it works on IE8 - IE11: ```js var myForm = document.createElement("form"); myForm.method = "POST"; myForm.action = strURL; myForm.target = "_blank"; var myInput = document.createElement("input"); myInput.type = "text"; myInput.name = "sim"; myInput.value = JSON.stringify(/*data to post goes here*/); myForm.appendChild(myInput); document.body.appendChild(myForm); myForm.submit(); $(myForm).hide(); ```
29,677,339
I'm getting an `InvalidStateError` at the blob creation line on IE 11. Needless to say, it works in Chrome and Firefox. I can see that the binary data is my client side. Are there any alternatives to download this as a file? ``` var request = new ActiveXObject("MicrosoftXMLHTTP"); request.open("post", strURL, true); request.setRequestHeader("Content-type", "text/html"); addSecureTokenHeader(request); request.responseType = 'blob'; request.onload = function(event) { if (request.status == 200) { var blob = new Blob([request.response], { type: 'application/pdf' }); var url = URL.createObjectURL(blob); var link = document.querySelector('#sim'); link.setAttribute('href', url); var filename = request.getResponseHeader('Content-Disposition'); $('#sim').attr("download", filename); $(link).trigger('click'); fireEvent(link, 'click'); } else { // handle error } } ```
2015/04/16
[ "https://Stackoverflow.com/questions/29677339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709463/" ]
Is not a elegant way but it works on IE8 - IE11: ```js var myForm = document.createElement("form"); myForm.method = "POST"; myForm.action = strURL; myForm.target = "_blank"; var myInput = document.createElement("input"); myInput.type = "text"; myInput.name = "sim"; myInput.value = JSON.stringify(/*data to post goes here*/); myForm.appendChild(myInput); document.body.appendChild(myForm); myForm.submit(); $(myForm).hide(); ```
After much searching this worked for me on IE, Edge and Chrome ``` var xhr = new XMLHttpRequest(); xhr.onloadstart = function (ev) { xhr.responseType = "blob"; }; xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { if (!window.navigator.msSaveOrOpenBlob) { var url = (window.URL || window.webkitURL).createObjectURL(xhr.response); var aLink = document.createElement("a"); document.body.appendChild(aLink); aLink.href = url; aLink.download = filename; aLink.click(); } else { var fileData = [xhr.response]; blobObject = new Blob(fileData); window.navigator.msSaveOrOpenBlob(blobObject, filename); } } }; ```
29,677,339
I'm getting an `InvalidStateError` at the blob creation line on IE 11. Needless to say, it works in Chrome and Firefox. I can see that the binary data is my client side. Are there any alternatives to download this as a file? ``` var request = new ActiveXObject("MicrosoftXMLHTTP"); request.open("post", strURL, true); request.setRequestHeader("Content-type", "text/html"); addSecureTokenHeader(request); request.responseType = 'blob'; request.onload = function(event) { if (request.status == 200) { var blob = new Blob([request.response], { type: 'application/pdf' }); var url = URL.createObjectURL(blob); var link = document.querySelector('#sim'); link.setAttribute('href', url); var filename = request.getResponseHeader('Content-Disposition'); $('#sim').attr("download", filename); $(link).trigger('click'); fireEvent(link, 'click'); } else { // handle error } } ```
2015/04/16
[ "https://Stackoverflow.com/questions/29677339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709463/" ]
After instantiating an `XmlHttpRequest` with `xhr.responseType = "blob"` I was getting an `InvalidStateError`. However, moving `xhr.responseType = "blob"` to `onloadstart` solved it for me! :) ``` xhr.onloadstart = function(ev) { xhr.responseType = "blob"; } ```
You need to use a BlobBuilder in that case. From: <https://github.com/bpampuch/pdfmake/issues/294#issuecomment-104029716> ``` try { blob = new Blob([result], { type: 'application/pdf' }); } catch (e) { // Old browser, need to use blob builder window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; if (window.BlobBuilder) { var bb = new BlobBuilder(); bb.append(result); blob = bb.getBlob("application/pdf"); } } ```
29,677,339
I'm getting an `InvalidStateError` at the blob creation line on IE 11. Needless to say, it works in Chrome and Firefox. I can see that the binary data is my client side. Are there any alternatives to download this as a file? ``` var request = new ActiveXObject("MicrosoftXMLHTTP"); request.open("post", strURL, true); request.setRequestHeader("Content-type", "text/html"); addSecureTokenHeader(request); request.responseType = 'blob'; request.onload = function(event) { if (request.status == 200) { var blob = new Blob([request.response], { type: 'application/pdf' }); var url = URL.createObjectURL(blob); var link = document.querySelector('#sim'); link.setAttribute('href', url); var filename = request.getResponseHeader('Content-Disposition'); $('#sim').attr("download", filename); $(link).trigger('click'); fireEvent(link, 'click'); } else { // handle error } } ```
2015/04/16
[ "https://Stackoverflow.com/questions/29677339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1709463/" ]
You need to use a BlobBuilder in that case. From: <https://github.com/bpampuch/pdfmake/issues/294#issuecomment-104029716> ``` try { blob = new Blob([result], { type: 'application/pdf' }); } catch (e) { // Old browser, need to use blob builder window.BlobBuilder = window.BlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder || window.MSBlobBuilder; if (window.BlobBuilder) { var bb = new BlobBuilder(); bb.append(result); blob = bb.getBlob("application/pdf"); } } ```
After much searching this worked for me on IE, Edge and Chrome ``` var xhr = new XMLHttpRequest(); xhr.onloadstart = function (ev) { xhr.responseType = "blob"; }; xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { if (!window.navigator.msSaveOrOpenBlob) { var url = (window.URL || window.webkitURL).createObjectURL(xhr.response); var aLink = document.createElement("a"); document.body.appendChild(aLink); aLink.href = url; aLink.download = filename; aLink.click(); } else { var fileData = [xhr.response]; blobObject = new Blob(fileData); window.navigator.msSaveOrOpenBlob(blobObject, filename); } } }; ```