qid
int64
1
74.7M
question
stringlengths
15
58.3k
date
stringlengths
10
10
metadata
list
response_j
stringlengths
4
30.2k
response_k
stringlengths
11
36.5k
80,667
For example usage, on asking a question. The lack of response was expected/annoying... Google gave me 'Indifferent' but I believe there must be something else.
2012/09/05
[ "https://english.stackexchange.com/questions/80667", "https://english.stackexchange.com", "https://english.stackexchange.com/users/589/" ]
"Unresponsiveness" works if you really need it to be a single word.
Consider *[stodginess](http://en.wiktionary.org/wiki/stodginess)* (“state or quality of being stodgy”, *ie* of being dull, old-fashioned); as in “The stodginess of their response shocked me.” Also consider *[complacency](http://en.wiktionary.org/wiki/complacency#Noun)*, as in “The complacency of their response amazed me.” Some other words to think about are *[insipidity](http://en.wiktionary.org/wiki/insipidity)*, *[turgidity](http://en.wiktionary.org/wiki/turgidity)*, *[inertia](http://en.wiktionary.org/wiki/inertia)*, and *[Luddism](http://en.wiktionary.org/wiki/Luddism)*. Also consider verb *[cold-shoulder](http://en.wiktionary.org/wiki/cold-shoulder)* (“To disrespect someone, especially by ignoring them”), or noun *[cold shoulder](http://en.wiktionary.org/wiki/cold_shoulder)* (“A deliberate act of disrespect; a slight or snub”), as in “They cold-shouldered the proposal most obstropulously” or “The cold shoulder was expected but annoying.” *Slight*, as a [verb](http://en.wiktionary.org/wiki/slight#Verb) (“To treat as slight or not worthy of attention, to make light of” or “To treat with disdain or neglect”) or [noun](http://en.wiktionary.org/wiki/slight#Noun) (“The act of slighting; a deliberate act of neglect or discourtesy”), may be used similarly.
80,667
For example usage, on asking a question. The lack of response was expected/annoying... Google gave me 'Indifferent' but I believe there must be something else.
2012/09/05
[ "https://english.stackexchange.com/questions/80667", "https://english.stackexchange.com", "https://english.stackexchange.com/users/589/" ]
If OP doesn't like **indifference**, how about > > [apathy](http://www.thefreedictionary.com/apathy) *- lack of interest or concern, especially regarding matters of general importance or appeal* > > >
*The **stonewalling** was expected/annoying...* Wikipedia says : > > Stonewalling is a refusal to communicate or cooperate. Such behaviour occurs in situations such as marriage guidance counseling, diplomatic negotiations, politics and legal cases > > > and *Dictionary.com Unabridged. Based on the Random House Dictionary* says: > > **stonewalling** > > noun > 1. > the act of stalling, evading, or filibustering, especially to avoid revealing politically embarrassing information. > > > —
80,667
For example usage, on asking a question. The lack of response was expected/annoying... Google gave me 'Indifferent' but I believe there must be something else.
2012/09/05
[ "https://english.stackexchange.com/questions/80667", "https://english.stackexchange.com", "https://english.stackexchange.com/users/589/" ]
Perhaps > > The silence was deafening. > > >
"Inaction", "Inattention", or "Disregard" might be fitting. The first most fitting I think but maybe a little broad. > > The inaction was expected. > > >
254,480
We have 2 household ranges sidebyside on 2 50amp breakers. We want to replace both stoves with 1 60in commercial stove with burners/griddle and 2 ovens below. Without doing to much rewiring..is this possible.
2022/08/10
[ "https://diy.stackexchange.com/questions/254480", "https://diy.stackexchange.com", "https://diy.stackexchange.com/users/155218/" ]
It depends on a lot of things but for a 60 inch *commercial all-electric range*, 30kW is typical. Plus or minus a lot, but attempting to answer a very general question. For that on a residential single-phase 240V circuit you're going to need an entire 150A service panel just for the range. Most of these are able to accept single or three phase service. I don't think you'll find one with dual independent single phase power inputs. Maybe you could rig it up in a warranty-voiding sort of way. Or maybe not warranty-voiding. It requires some careful planning and the manufacturer would have to agree but it ought to work as long as the loads can be split into two groups each requiring no more than 9600W. (So the entire unit can be at most 19kW). If the unit has both single-phase and 3-phase wiring buses, you would use each bus for one circuit and half the loads. Question: Were your two 50A circuits designed so that they could both be maxed out (80A total actual continuous consumption) and you still have enough service capacity for the rest of your home to function normally? My suggestion: gas.
You might want to run your plan by your home insurance agent. Your policy may not insure commercial equipment. I would want something in writing. If you’re buying new, check whether the warranty is valid for being in a home. Do you have the required clearance around the stove?
25,826,396
it is awkward, but until now i always copy the \*.h and the \*.c files to my projekts location. this is a mess and i want to change it! i want to build my own c library and have a few questions about it. where should i locate the \*.h files? should i copy them in the global /usr/include/ folder or should i create my own folder in $HOME (or anywhere else)? where should i locate the \*.a files and the \*.o files and where the \*.c files. i am using debian and gcc. my c projects are in $HOME/dev/c/. i would keep my lib-sources in $HOME/dev/c/lib (if this is the way you could recommend) and copy the \*.o, \*.a and \*.h files to the location i am asking for. how would you introduce the lib-location to the compiler? should i add it to the $PATH or should i introduce it in the makefiles of my projekt (like -L PATH/TO/LIBRARY -l LIBRARY). do you have anny further tips and tricks for building a own library?
2014/09/13
[ "https://Stackoverflow.com/questions/25826396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3403216/" ]
I would recommend putting the files somewhere in your `$HOME` directory. Let's say you've created a library called `linluk` and you want to keep that library under `$HOME/dev/c/linluk`. That would be your project root. You'll want a sensible directory structure. My suggestion is to have a `lib` directory containing your library and an `include` directory with the header files. ``` $PROJECT_ROOT/ lib/ liblinluk.so include/ linluk.h src/ linluk.c Makefile ``` **Compiling:** When you want to use this library in another project, you'd then add `-I$PROJECT_ROOT/include` to the compile line so that you could write `#include <linluk.h>` in the source files. **Linking:** You would add `-L$PROJECT_ROOT/lib -llinluk` to the linker command line to pull in the compiled library at link time. Make sure your `.so` file has that `lib` prefix: it should be `liblinluk.so`, not `linluk.so`. A `src` directory and `Makefile` are optional. The source code wouldn't be needed by users of the library, though it might be helpful to have it there in case someone wants to remake the `.so` file.
As I commented, you should try first to build and install from its source code several free software libraries, e.g. like [libonion](http://www.coralbits.com/libonion/) or [gdbm](http://www.gnu.org.ua/software/gdbm/) or [GNU readline](http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html) etc (don't use any distribution package, but compile and install these from source code). This will teach you some good practice. You probably want to install these libraries *system-wide*, not for your particular user. Then, assuming that your library is called `foo` (you need to give it some name!), * the header files `*.h` go into `/usr/local/include/foo/` * the shared objects (dynamic libraries) go into `/usr/local/lib/libfoo.so` (with perhaps some version numbering) * if relevant, static library go into `/usr/local/lib/libfoo.a` You need to add once `/usr/local/lib/` into `/etc/ld.so.conf` and run [ldconfig(8)](http://man7.org/linux/man-pages/man8/ldconfig.8.html) and you *usually* don't want to copy any source file `*.c` or object file `*.o` (except for [homoiconic programs](https://en.wikipedia.org/wiki/Homoiconicity), [bootstrapped compilers](https://en.wikipedia.org/wiki/Bootstrapping_(compilers)), [Quine programs](https://en.wikipedia.org/wiki/Quine_(computing)), [generated C code](https://softwareengineering.stackexchange.com/a/257873/40065), etc... See [RefPerSys](http://refpersys.org/) or [Jacques Pitrat](https://en.wikipedia.org/wiki/Jacques_Pitrat) systems as an incomplete example of self generated C or C++). In *some weird* cases, you may want to copy such "source" or "generated C" code under `/usr/src/`. Read [Program Library HowTo](http://tldp.org/HOWTO/Program-Library-HOWTO/) (and later, Drepper's paper: [How To Write Shared Libraries](http://people.redhat.com/drepper/dsohowto.pdf)) You could consider making your library known by [pkg-config](http://www.freedesktop.org/wiki/Software/pkg-config/). Then install some `foo.pc` under `/usr/local/lib/pkgconfig/` BTW, I strongly suggest you to publish your library as [free software](https://en.wikipedia.org/wiki/Free_software), perhaps on [github](http://github.com/) or elsewhere. You'll get useful feedback and could get some help and some bug reports or enhancements. You probably should use some builder like `make` and have an `install` target in your `Makefile` (hint: make it use the `DESTDIR` convention).
34,548,493
I'm using MailChimp and I want to display the sign up form on a button click. They provide a modal pop up but it only loads when the page loads or after x amount of secs. I want to display the screen only when a user clicks a button. Can anyone lead me the right way? This is the code I get from MailChimp. ``` <script type="text/javascript" src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us12.list-manage.com","uuid":"5fa6528f19f668f9c0c842dab","lid":"5319bf6b62"}) })</script> ``` Thanks!
2015/12/31
[ "https://Stackoverflow.com/questions/34548493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1281890/" ]
In `server.xml` comment or remove the following line: ``` <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> ``` Also, check if the variable `JAVA_HOME` is set and pointing to your correct Java installation.
It seems you dont have a server.xml on your project or maybe there a mistake on it. Can you check ? Or post the server.xml file ? Sincerely
13,096,650
I'm writing a GUI application using Python and Qt as a GUI library. I would like to perform certain scheduled actions after e.g. 3 days or so (but some more often, some even more rare etc). I have discovered the QTimer() app but my understanding is that it only tracks time while the software is running. So, for example, suppose a user has checked the option to check the automatic updates every 5 days. If he runs it on day one, everything is fine. The countdown clock starts ticking. But if he runs it for the second time on day 6, how to make sure the application does indeed download an update (other than writing the date every time to some file and comparing the two)? I hope I'm clear enough, if I'm not, please let me know and I'll try to elaborate even better.
2012/10/27
[ "https://Stackoverflow.com/questions/13096650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/647897/" ]
Either your app has to run all the time, eq. as a little systray icon on windows, or you need the operating system to run a version of your app regularly to check for updates. What operating system are you using? edit: on windows see this answer to get your program run at scheduled intervals [Programmitically how to create task scheduler in windows server 2008](https://stackoverflow.com/questions/5218482/programmitically-how-to-create-task-scheduler-in-windows-server-2008)
Creating a scheduler outside of the running PyQt app is a bit outside the scope of PyQt itself, and is platform-dependant. Unless you create a second app that runs strictly as a `Qt.WindowSystemMenuHint` in the system tray and actually performs the update separate of your main app. So here is an example of something that records the updates in a `QSettings`. Every time the app loads, it checks when the last update occurred, and whether we are overdue, or have time left. If there is time left, the timer will be adjusted appropriately for the difference: ``` from PyQt4 import QtGui, QtCore class Window(QtGui.QMainWindow): def __init__(self): super(Window, self).__init__() self.resize(150,150) self._update_secs = 30 self.button = QtGui.QPushButton("Update") self.button.setFixedSize(100,100) self.setCentralWidget(self.button) self.button.clicked.connect(self.doUpdate) self._loadSettings() def _loadSettings(self): self._settings = QtCore.QSettings("mycompany", "myapp") # checkpoint = self._settings.value('checkpoint') lastUpdate = self._settings.value('lastUpdate') now = QtCore.QDateTime.currentDateTimeUtc() # update_time = 60*60*24*5 secs = self._update_secs if not lastUpdate.isNull(): secs = abs(lastUpdate.toDateTime().secsTo(now)) if secs >= self._update_secs: print "Update is past due at load time" self.doUpdate() return else: print "Still %d seconds left from last load, until next update" % secs self._startUpdateTimer(secs) def doUpdate(self): print "performing update!" now = QtCore.QDateTime.currentDateTimeUtc() self._settings.setValue("lastUpdate",now) self._startUpdateTimer(self._update_secs) def _startUpdateTimer(self, secs): print "Starting update timer for %d seconds" % secs try: self._updateTimer.stop() except: pass self._updateTimer = QtCore.QTimer() self._updateTimer.timeout.connect(self.doUpdate) self._updateTimer.start(secs*1000) if __name__ == "__main__": app = QtGui.QApplication([]) win = Window() win.show() app.exec_() ``` You can try loading this up, closing it soon after, and reloading it. It should report that there is still time left. Once an update occurs, you can close it and wait past the 30 second deadline, then open. It should say the update is overdue.
63,611,737
This is my CSS ```css .marquee { color: red; margin: 0; display: inline-block; white-space: nowrap; animation-name: marquee; animation-timing-function: linear; animation-duration: 10s; animation-iteration-count: infinite; } @keyframes marquee{ 0%{ transform: translate(10%, 0); } 100%{ transform: translate(-100%, 0); } ``` This is my Javascript function to update CSS animation duration ```js calcSpeed: function (speed) { var spnSelect = document.querySelectorAll('.marquee'); var i=0; for(i=0; i< spnSelect.length; i++) { var spnLen = spnSelect[i].offsetWidth; var timeTaken = spnLen / speed; spnSelect[i].style.animationDuration = timeTaken +'s'; } } ``` I don't know why I can't update the css animation duration. I deleted animation-duration and run the code. The text became stopped. I don't know what to do. Help me please.
2020/08/27
[ "https://Stackoverflow.com/questions/63611737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14174877/" ]
As you already use `awk` to create the arrays `log_array` and `lag_array` I'd recommend to do everything in a single `awk` command. This is not only shorter to write and faster to execute, but also more precise as `awk` supports floating point numbers whereas `bash` does not. ``` awk 'NR>1 && ($3-$4)/$3 > 0.3' inputFile ``` This reads the table from `inputFile` and prints those lines where the difference *Log-Lag* is greater than 30 % of *Log*. If you also want to print the percentage use ``` awk 'NR>1 && (p=($3-$4)/$3)>0.3 {print $0, p}' inputFile ``` **Note:** I think the formula is wrong as all percentages in your example are greater than 90 %. You didn't exactly specify how the *"percentage difference"* should be computed. However, I suspect the following: *Log-Lag* is *H* percent of *Log*: `Log * H/100 = Log-Lag`, therefore `H = (Log-Lag)/Log * 100` Now compute the difference *D* between 100% (the "percentage" of *Log*) and *H*: `D = 100-H` In this case the script would be ``` awk 'NR>1 && (p=1-($3-$4)/$3)>0.3 {print $0, p}' inputFile ```
If you don't mind the loss in precision coming from the fact that bash does not support floating point or fractional arithmetic, you can do a ``` if (( ${log_array[$i]} - ${lag_array[$j] * 100 / ${log_array[i]} > 20 )) then ... fi ```
46,118,351
I am trying to get a a max value per stretch of an indicator, or repeating value. Here is an example: ``` A = c(28, 20, 23, 30, 26, 23, 25, 26, 27, 25, 30, 26, 25, 22, 24, 25, 24, 27, 29) B = c(0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1) df <- as.data.frame(cbind(A, B)) df A B 28 0 20 1 23 1 30 0 26 0 23 1 25 1 26 1 27 0 25 0 30 1 26 1 25 1 22 0 24 1 25 0 24 0 27 0 29 1 ``` For each group or stretch of 1's in column B I want to find the max in column A. The max column could be an indicator that A it is a max or the actual value in A, and be NA or 0 for other values of B. The output I am hoping for looks something like this: ``` A B max 28 0 0 20 1 0 23 1 1 30 0 0 26 0 0 23 1 0 25 1 0 26 1 1 27 0 0 25 0 0 30 1 1 26 1 0 25 1 0 22 0 0 24 1 1 25 0 0 24 0 0 27 0 0 29 1 1 ``` I've tried to generate groups per section of column B that = 1 but I did not get very far because most grouping functions require unique values between groups. Also, please let me know if there are any improvements to the title for this problem.
2017/09/08
[ "https://Stackoverflow.com/questions/46118351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7014711/" ]
One option would be `data.table` ``` library(data.table) setDT(df)[, Max := +((A== max(A)) & B), rleid(B) ] df # A B Max # 1: 28 0 0 # 2: 20 1 0 # 3: 23 1 1 # 4: 30 0 0 # 5: 26 0 0 # 6: 23 1 0 # 7: 25 1 0 # 8: 26 1 1 # 9: 27 0 0 #10: 25 0 0 #11: 30 1 1 #12: 26 1 0 #13: 25 1 0 #14: 22 0 0 #15: 24 1 1 #16: 25 0 0 #17: 24 0 0 #18: 27 0 0 #19: 29 1 1 ``` --- Or as @Frank mentioned, for better efficiency, we can make use `gmax` by first assigning column and then replace ``` DT[, MA := max(A), by=rleid(B)][A == MA & B, Max := 1L][] ```
Solution using `dplyr` ``` library(dplyr) df %>% group_by(with(rle(B), rep(seq_along(lengths), lengths))) %>% mutate(MAX = ifelse(B == 0, 0, as.numeric(A == max(A)))) %>% .[, c(1, 2, 4)] A B MAX <dbl> <dbl> <dbl> 1 28 0 0 2 20 1 0 3 23 1 1 4 30 0 0 5 26 0 0 6 23 1 0 7 25 1 0 8 26 1 1 9 27 0 0 10 25 0 0 11 30 1 1 12 26 1 0 13 25 1 0 14 22 0 0 15 24 1 1 16 25 0 0 17 24 0 0 18 27 0 0 19 29 1 1 ```
4,259,650
So, $i$ and complex expressions are used as a sort of stepping stone to bypass domain issues when solving expressions and equations algebraically; it is very convenient to be able to factor out or solve the square root of a negative number. But is it just $i$? Are there any constants with no direct connection to the real world, that are *not* involved with the square root of $-1$? For example, $\frac{1}{0}$ would be useful for sidestepping restricted domain in expressions like $\frac{3x+2}{x}$ or something... *except* that $\frac{1}{0}$ doesn't play well with the regular rules of math. So, my question is, **is there any comparable style of imaginary numbers**, that I don't know about? Or is $i$ just special?
2021/09/25
[ "https://math.stackexchange.com/questions/4259650", "https://math.stackexchange.com", "https://math.stackexchange.com/users/810037/" ]
**Hint:** Observe, $$\frac{\sin(x^2-1)}{x-1}=\frac{\sin(x^2-1)}{x^2-1}\cdot (x+1)=\frac{\sin y}{y}\cdot (x+1)$$ where $y=x^2-1$. Note, if $x$ tends to $1$ then, $y$ tends to $0$.
$$\lim\_{x\to1} \frac{\sin(x^2-1)}{(x-1)}=\lim\_{x\to1}\frac{\sin(x^2-1)}{(x^2-1)}\cdot (x+1)=\lim\_{x^2\to1}\frac{\sin (x^2-1)}{(x^2-1)}\lim\_{x\to1} (x+1)=1\times2$$
4,259,650
So, $i$ and complex expressions are used as a sort of stepping stone to bypass domain issues when solving expressions and equations algebraically; it is very convenient to be able to factor out or solve the square root of a negative number. But is it just $i$? Are there any constants with no direct connection to the real world, that are *not* involved with the square root of $-1$? For example, $\frac{1}{0}$ would be useful for sidestepping restricted domain in expressions like $\frac{3x+2}{x}$ or something... *except* that $\frac{1}{0}$ doesn't play well with the regular rules of math. So, my question is, **is there any comparable style of imaginary numbers**, that I don't know about? Or is $i$ just special?
2021/09/25
[ "https://math.stackexchange.com/questions/4259650", "https://math.stackexchange.com", "https://math.stackexchange.com/users/810037/" ]
**Hint:** Observe, $$\frac{\sin(x^2-1)}{x-1}=\frac{\sin(x^2-1)}{x^2-1}\cdot (x+1)=\frac{\sin y}{y}\cdot (x+1)$$ where $y=x^2-1$. Note, if $x$ tends to $1$ then, $y$ tends to $0$.
Alternatively, you can observe that $\sin(x^{2} - 1) \sim x^{2} - 1$ when $x\to 1$. Based on such relation, we conclude that \begin{align\*} \lim\_{x\to 1}\frac{\sin(x^{2} - 1)}{x - 1} & = \lim\_{x\to 1}\frac{x^{2} - 1}{x-1}\\\\ & = \lim\_{x\to 1}(x+1)\\\\ & = 2 \end{align\*}
4,259,650
So, $i$ and complex expressions are used as a sort of stepping stone to bypass domain issues when solving expressions and equations algebraically; it is very convenient to be able to factor out or solve the square root of a negative number. But is it just $i$? Are there any constants with no direct connection to the real world, that are *not* involved with the square root of $-1$? For example, $\frac{1}{0}$ would be useful for sidestepping restricted domain in expressions like $\frac{3x+2}{x}$ or something... *except* that $\frac{1}{0}$ doesn't play well with the regular rules of math. So, my question is, **is there any comparable style of imaginary numbers**, that I don't know about? Or is $i$ just special?
2021/09/25
[ "https://math.stackexchange.com/questions/4259650", "https://math.stackexchange.com", "https://math.stackexchange.com/users/810037/" ]
**Hint:** Observe, $$\frac{\sin(x^2-1)}{x-1}=\frac{\sin(x^2-1)}{x^2-1}\cdot (x+1)=\frac{\sin y}{y}\cdot (x+1)$$ where $y=x^2-1$. Note, if $x$ tends to $1$ then, $y$ tends to $0$.
The above solutions are very simple to understand but this is also what you can do: Expansion $\sin(t) = $ $t- \frac{t^3}{3!} +\frac{t^5}{5!}..... $ Now, $\frac{x^2-1}{x-1}-\frac{(x^2-1){3}}{3!(x-1)} +.......$ As ${x\to1} $ all higher powers ${\to0}$ Left with $\frac{(x+1)(x-1)}{x-1}$ As ${x\to1}$ implied $x-1{\to0}$ but is not equal to zero $$\lim\_{x\to1}(x+1){\to2}$$ That is $2$
4,259,650
So, $i$ and complex expressions are used as a sort of stepping stone to bypass domain issues when solving expressions and equations algebraically; it is very convenient to be able to factor out or solve the square root of a negative number. But is it just $i$? Are there any constants with no direct connection to the real world, that are *not* involved with the square root of $-1$? For example, $\frac{1}{0}$ would be useful for sidestepping restricted domain in expressions like $\frac{3x+2}{x}$ or something... *except* that $\frac{1}{0}$ doesn't play well with the regular rules of math. So, my question is, **is there any comparable style of imaginary numbers**, that I don't know about? Or is $i$ just special?
2021/09/25
[ "https://math.stackexchange.com/questions/4259650", "https://math.stackexchange.com", "https://math.stackexchange.com/users/810037/" ]
$$\lim\_{x\to1} \frac{\sin(x^2-1)}{(x-1)}=\lim\_{x\to1}\frac{\sin(x^2-1)}{(x^2-1)}\cdot (x+1)=\lim\_{x^2\to1}\frac{\sin (x^2-1)}{(x^2-1)}\lim\_{x\to1} (x+1)=1\times2$$
The above solutions are very simple to understand but this is also what you can do: Expansion $\sin(t) = $ $t- \frac{t^3}{3!} +\frac{t^5}{5!}..... $ Now, $\frac{x^2-1}{x-1}-\frac{(x^2-1){3}}{3!(x-1)} +.......$ As ${x\to1} $ all higher powers ${\to0}$ Left with $\frac{(x+1)(x-1)}{x-1}$ As ${x\to1}$ implied $x-1{\to0}$ but is not equal to zero $$\lim\_{x\to1}(x+1){\to2}$$ That is $2$
4,259,650
So, $i$ and complex expressions are used as a sort of stepping stone to bypass domain issues when solving expressions and equations algebraically; it is very convenient to be able to factor out or solve the square root of a negative number. But is it just $i$? Are there any constants with no direct connection to the real world, that are *not* involved with the square root of $-1$? For example, $\frac{1}{0}$ would be useful for sidestepping restricted domain in expressions like $\frac{3x+2}{x}$ or something... *except* that $\frac{1}{0}$ doesn't play well with the regular rules of math. So, my question is, **is there any comparable style of imaginary numbers**, that I don't know about? Or is $i$ just special?
2021/09/25
[ "https://math.stackexchange.com/questions/4259650", "https://math.stackexchange.com", "https://math.stackexchange.com/users/810037/" ]
Alternatively, you can observe that $\sin(x^{2} - 1) \sim x^{2} - 1$ when $x\to 1$. Based on such relation, we conclude that \begin{align\*} \lim\_{x\to 1}\frac{\sin(x^{2} - 1)}{x - 1} & = \lim\_{x\to 1}\frac{x^{2} - 1}{x-1}\\\\ & = \lim\_{x\to 1}(x+1)\\\\ & = 2 \end{align\*}
The above solutions are very simple to understand but this is also what you can do: Expansion $\sin(t) = $ $t- \frac{t^3}{3!} +\frac{t^5}{5!}..... $ Now, $\frac{x^2-1}{x-1}-\frac{(x^2-1){3}}{3!(x-1)} +.......$ As ${x\to1} $ all higher powers ${\to0}$ Left with $\frac{(x+1)(x-1)}{x-1}$ As ${x\to1}$ implied $x-1{\to0}$ but is not equal to zero $$\lim\_{x\to1}(x+1){\to2}$$ That is $2$
73,566,373
I am developing a webapp with spring boot with Windows 10 Pro German Edition. As IDE i am using Spring Tool Suite. When i start the application from the console with maven: ``` mvn clean package -Pproduction && mvn spring-boot:run -Dfile.encoding=UTF8 ``` and i call on the String "Jürgen" string.toCharArray() and show all the characters it will print this: length: 6 pos: 0, val: J pos: 1, val: ³ pos: 2, val: r pos: 3, val: g pos: 4, val: e pos: 5, val: n But when i start the application within the Spring Tool Suite IDE by the Boot Dashboard (right click restart) It will print this: length: 6 pos: 0, val: J pos: 1, val: ü pos: 2, val: r pos: 3, val: g pos: 4, val: e pos: 5, val: n I want the behaviour from the STS in the console as well? But how? And why do i have the problem at all? The value is correctly displayed in the GUI. Only the output differs.
2022/09/01
[ "https://Stackoverflow.com/questions/73566373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2605902/" ]
The `Material-UI` library you are using makes this very easy. Their components behave differently based on the types of props you provide them with. In the case of `<Chip>`, if you pass an `onDelete` method, it should automatically show the "X" at the end. However, since you already did that, it should work. My guess here is that maybe it doesn't register properly due to the way you pass the function. In React, when passing function to components, etc.. we should pass them as callbacks, instead of calling them directly. **Example:** ``` <Chip // Other props... onDelete={() => this.handleDelete(item)} /> ``` Let me know if this works. **Refs:** * <https://reactjs.org/docs/faq-functions.html> * <https://mui.com/material-ui/react-chip/>
There are two ways to add icon Way 1 u can use material ui icons to add icon Way 2 u can use bootstrap 5 to add icon By way 2 the steps are Step 1 Keep the cdn in the head part in index.html ``` <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous"> ``` Step 2 is to add your icon where we want ``` <i class="bi bi-trash"></i> ```
36,070
I have a car with all four new tires installed at the same time 6 months ago. Three of them are identical and one is different (front right if this matters). Today, I noticed that the front tires have significant tread wear compared to the rear ones. I have checked several articles on diagnosing tread wear, but his type was not one of them. What could be causing this?
2016/09/07
[ "https://mechanics.stackexchange.com/questions/36070", "https://mechanics.stackexchange.com", "https://mechanics.stackexchange.com/users/19474/" ]
Assuming the vehicle is front wheel drive, more wear in the front tyres than the rear is normal as the the driving wheels have plenty more torque and stresses placed on them than the rears. Avoiding harsh braking and accelerating will extend the life of the tyres.
If the tire tread is worn evenly and you have a front wheel drive car, that's just wear on your drive wheel from acceleration. On some vehicles, one wheel is favored more than the other. If it's that significant, congrats on driving it like you stole it- nothing wrong with that.
274,260
Below the first sentence is from one LSAT. My confusion is how **1.** differs from **2.**, which I made for comparison. > > 1. Works of art in the Renaissance were mostly commissioned by patrons. > > > > > 2. Most works of art in the Renaissance were commissioned by patrons. > > > I am wondering whether "1." means the same as "2." Could someone explain the difference, if any? --- P.S. Please see another sentence below, also from an LSAT, with similar construction as **1.** above. 3. *New species primarily threatens disturbed areas.* Considering the action verb and the difference between "primarily" and "mostly", so this sentence only means: *All* New species primarily *but not entirely* threatens disturbed areas. Is my interpretation correct? Any comments or help would be really appreciated. Leon
2021/02/04
[ "https://ell.stackexchange.com/questions/274260", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/116956/" ]
1. Works of art in the Renaissance were mostly commissioned by patrons. 2. Most works of art in the Renaissance were commissioned by patrons. In this example, it is very difficult to perceive any difference in meaning between the two sentences. However, the constructions don't always mean the same. For example: 1. Paintings in this period were mostly in colour. 2. Most paintings in this period were in colour. One interpretation of (1) is the same as (2), but (1) has an alternative reading: that each painting was mostly in colour but not entirely.
As rjpond says, it is difficult to draw a distinction in meaning between the two sentences. But consider this. The second sentence has the unambiguous meaning that most works of art were entirely commissioned by patrons. Some were, some weren't. However, the meaning of the first sentence could be taken to mean this, but it could also be taken to mean that *all* works of art were *mostly* commissioned by patrons, and, therefore, that *no* works of art were *entirely* commissioned by patrons. So, it's ambiguous. This is analogous to rjpond's example, which is a good simplification of the idea. This is also just the sort of thing that lawyers run into all the time in disagreements over the meaning of contracts, so it doesn't surprise me that it is from an LSAT.
601,628
Good day. I am designing a power control circuit for dimming a 100W bulb using BTA16. In the circuit shown below, when I apply power to the circuit I only receive the positive pulse at the output (of both MOC3020 and the Triac, triggered perfectly at the desired angle) but it completely blocks the negative cycle. (Circuit and output diagrams are attached below) I have tried few solutions given below but still I am facing the same issue. I have tried several resistance values, but no gain. Of course, if I increase the value too much, then the TRIAC doesn't even trigger in the positive half. But for the negative half, even low resistance values don't work. Can anyone please guide me on what I am doing wrong here? Many thanks. [![enter image description here](https://i.stack.imgur.com/dtUtb.jpg)](https://i.stack.imgur.com/dtUtb.jpg)
2021/12/24
[ "https://electronics.stackexchange.com/questions/601628", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/262268/" ]
I’m 99% sure you can use it. 16.8 V to 17 V is a 1.2% increase in supply voltage, and almost every product can operate perfectly within that range.
Every electronic component, and every electronic circuit has a tolerance for its parameters. It is highly likely that a 17 V power supply delivers a voltage which is within the tolerance range of the required 16.8 V input of your circuit. If this were a life-critical situation, say for aircraft or medical usage, I would reject using "the wrong" adapter out of hand. But for everyday circuits, I would without any misgivings use the 17 V supply.
601,628
Good day. I am designing a power control circuit for dimming a 100W bulb using BTA16. In the circuit shown below, when I apply power to the circuit I only receive the positive pulse at the output (of both MOC3020 and the Triac, triggered perfectly at the desired angle) but it completely blocks the negative cycle. (Circuit and output diagrams are attached below) I have tried few solutions given below but still I am facing the same issue. I have tried several resistance values, but no gain. Of course, if I increase the value too much, then the TRIAC doesn't even trigger in the positive half. But for the negative half, even low resistance values don't work. Can anyone please guide me on what I am doing wrong here? Many thanks. [![enter image description here](https://i.stack.imgur.com/dtUtb.jpg)](https://i.stack.imgur.com/dtUtb.jpg)
2021/12/24
[ "https://electronics.stackexchange.com/questions/601628", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/262268/" ]
Every electronic component, and every electronic circuit has a tolerance for its parameters. It is highly likely that a 17 V power supply delivers a voltage which is within the tolerance range of the required 16.8 V input of your circuit. If this were a life-critical situation, say for aircraft or medical usage, I would reject using "the wrong" adapter out of hand. But for everyday circuits, I would without any misgivings use the 17 V supply.
Plug the power supply into AC (without connecting to your mixer) and measure the output voltage. If it is 17 V (with and without a load), you'll be fine. This means it is a regulated power supply with actual regulation. Some older power supplies or low cost power supplies from things like low-voltage desk lamps, or other constant-load devices will have a voltage that changes significantly with the load that is connected to the supply (ie. an unregulated power supply). Unregulated power supplies are designed for a specific load. Regulated supplies deliver the same voltage to all loads. If you plug your mixer into an unregulated power supply, the supply may have a significantly higher voltage than 17 V without a load. An unregulated supply is designed to deliver a specific voltage at a specific load. Google "unregulated power supply" for details. Just measure the output to make sure, before you plug it into the mixer.
601,628
Good day. I am designing a power control circuit for dimming a 100W bulb using BTA16. In the circuit shown below, when I apply power to the circuit I only receive the positive pulse at the output (of both MOC3020 and the Triac, triggered perfectly at the desired angle) but it completely blocks the negative cycle. (Circuit and output diagrams are attached below) I have tried few solutions given below but still I am facing the same issue. I have tried several resistance values, but no gain. Of course, if I increase the value too much, then the TRIAC doesn't even trigger in the positive half. But for the negative half, even low resistance values don't work. Can anyone please guide me on what I am doing wrong here? Many thanks. [![enter image description here](https://i.stack.imgur.com/dtUtb.jpg)](https://i.stack.imgur.com/dtUtb.jpg)
2021/12/24
[ "https://electronics.stackexchange.com/questions/601628", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/262268/" ]
I’m 99% sure you can use it. 16.8 V to 17 V is a 1.2% increase in supply voltage, and almost every product can operate perfectly within that range.
Plug the power supply into AC (without connecting to your mixer) and measure the output voltage. If it is 17 V (with and without a load), you'll be fine. This means it is a regulated power supply with actual regulation. Some older power supplies or low cost power supplies from things like low-voltage desk lamps, or other constant-load devices will have a voltage that changes significantly with the load that is connected to the supply (ie. an unregulated power supply). Unregulated power supplies are designed for a specific load. Regulated supplies deliver the same voltage to all loads. If you plug your mixer into an unregulated power supply, the supply may have a significantly higher voltage than 17 V without a load. An unregulated supply is designed to deliver a specific voltage at a specific load. Google "unregulated power supply" for details. Just measure the output to make sure, before you plug it into the mixer.
50,299,147
I have a service in my Angular 5 project that holds some configuration state: ``` @Injectable export class FooService { isIncognito: boolean = null; constructor() { // I want Angular to wait for this to resolve (i.e. until `isIncognito != null`): FooService.isIncognitoWindow() .then( isIncognito => { this.isIncognito= isIncognito; } ); } private static isIncognitoWindow(): Promise<boolean> { // https://stackoverflow.com/questions/2909367/can-you-determine-if-chrome-is-in-incognito-mode-via-a-script // https://developer.mozilla.org/en-US/docs/Web/API/LocalFileSystem return new Promise<boolean>( ( resolve, reject ) => { let rfs = window['requestFileSystem'] || window['webkitRequestFileSystem']; if( !rfs ) { console.warn( "window.RequestFileSystem not found." ); resolve( false ); } const typeTemporary = 0; const typePersistent = 1; // requestFileSystem's callbacks are made asynchronously, so we need to use a promise. rfs( /*type: */ typeTemporary, /* bytesRequested: */ 100, /* successCallback: */ function( fso: WebKitFileSystem ) { resolve( false ); }, /* errorCallback: */ function( err: any /* FileError */ ) { resolve( true ); } ); } ); } } ``` This service is used by many Components in my project and is passed as a constructor argument. For example: ``` @Component( { moduleId: module.id, templateUrl: 'auth.component.html' } ) export class AuthComponent implements OnInit { constructor( private fooService: FooService ) { } ngOnInit(): void { // do stuff that depends on `this.fooService.isIncognito != null` } } ``` Ideally I'd like Angular to wait for the `FooService::isIncognitoWindow()` promise to resolve (the resolution happens instantly, but not synchronously) first before injectinting the `FooService` into the other components. An alternative solution is changing `FooComponent.isIncognito`'s property to a `Promise<boolean>` and resolving it again and calling the rest of `ngOnInit` via a callback, but that means every component will cause the promise's main function to be invoked again - so that means possibly changing it to a buffered Observable or Subject instead, and that's getting needlessly complicated - all for a single `boolean` value. It also means refactoring lots of code I'd rather not have to do.
2018/05/11
[ "https://Stackoverflow.com/questions/50299147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/159145/" ]
What you can do is use `APP_INITIALIZER` token to make sure that your `FooService` is initialised before the application starts. With the code below, angular will only start the application when the promise returned by the `load` method has resolved. **FooService.ts** ``` @Injectable() export class FooService { isIncognito: boolean = null; public load()// <=== the method to be called and waited on during initialiation { return FooService.isIncognitoWindow().then(isIncognito => { this.isIncognito = isIncognito; }); } private static isIncognitoWindow(): Promise<boolean> { { //your method here ``` **app.module.ts** ``` export function loadFooService(fooService: FooService): Function { return () => { return fooService.load() }; } @NgModule({ imports: [ BrowserModule, FormsModule ], declarations: [ AppComponent, HelloComponent ], bootstrap: [ AppComponent ], providers: [ FooService, { provide: APP_INITIALIZER, useFactory:loadFooService , deps: [FooService], multi: true },] }) ``` See [stackblitz example](https://stackblitz.com/edit/angular-dyhnu3?file=src%2Fapp%2Fapp.component.html)
If `isIncognitoWindow` returns `Promise` try this: ``` await awaitFooService.isIncognitoWindow() .then( isIncognito => { this.isIncognito= isIncognito; } ); ```
34,390,284
I'm trying to implement a KeyListener for a JFrame form in java. So far, I used the [code suggested here](https://stackoverflow.com/a/1379517/906428) and got a fairly good result, but when the event fires (when any of the desired keys is pressed), it seems that not only do I get the last key pressed, but as the occurrences continue, I get 2, 3, etc, values of keys (which can be seen by the ammount of JOptionPane.showMessageDialog() displayed). How can I limit the evaluation of the event to JUST the last key pressed? or, how can I "clear" the key pressed array each time the event fires? Here is the full code for my form: ``` import java.awt.event.*; import javax.swing.KeyStroke; import javax.swing.Action; import javax.swing.JOptionPane; import java.awt.KeyEventDispatcher; import java.awt.KeyEventPostProcessor; import java.awt.KeyboardFocusManager; public class frmMain extends javax.swing.JFrame { char optionselected; String other; private class MyDispatcher implements KeyEventDispatcher { @Override public boolean dispatchKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_RELEASED) { optionselected = e.getKeyChar(); } other = String.valueOf(optionselected).toUpperCase(); switch (other) { case "C": JOptionPane.showMessageDialog(null, "Option 1"); break; case "T": JOptionPane.showMessageDialog(null, "Option 2"); break; case "D": JOptionPane.showMessageDialog(null, "Option 3"); break; case "N": JOptionPane.showMessageDialog(null, "Option 4"); break; case "O": JOptionPane.showMessageDialog(null, "Option 5"); break; case "S": JOptionPane.showMessageDialog(null, "Option 6"); break; default: break; } return false; } } /** * Creates new form frmMain */ public frmMain() { initComponents(); KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); manager.addKeyEventDispatcher(new MyDispatcher()); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() { jInternalFrame1 = new javax.swing.JInternalFrame(); jDesktopPane1 = new javax.swing.JDesktopPane(); mbarMenu = new javax.swing.JMenuBar(); mnuConta = new javax.swing.JMenu(); mnuTeso = new javax.swing.JMenu(); mnuDiezmo = new javax.swing.JMenu(); mnuNomi = new javax.swing.JMenu(); mnuCole = new javax.swing.JMenu(); mnuExit = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setMaximumSize(new java.awt.Dimension(800, 600)); setMinimumSize(new java.awt.Dimension(800, 600)); setPreferredSize(new java.awt.Dimension(800, 600)); setResizable(false); jInternalFrame1.setMaximumSize(new java.awt.Dimension(1000, 607)); jInternalFrame1.setMinimumSize(new java.awt.Dimension(1000, 607)); jInternalFrame1.setPreferredSize(new java.awt.Dimension(1000, 607)); jInternalFrame1.setVisible(true); mnuConta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/books_noun_9566_cc.png"))); // NOI18N mnuConta.setText("[C] = Option 1"); mnuConta.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N mbarMenu.add(mnuConta); mnuTeso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/money_noun_197480_cc.png"))); // NOI18N mnuTeso.setText("[T] = Option 2"); mnuTeso.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N mbarMenu.add(mnuTeso); mnuDiezmo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/diezmador_noun_247665_cc.png"))); // NOI18N mnuDiezmo.setText("[D] = Option 3"); mnuDiezmo.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N mbarMenu.add(mnuDiezmo); mnuNomi.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/payroll_noun_233106_cc.png"))); // NOI18N mnuNomi.setText("[N] = Option 4"); mnuNomi.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N mbarMenu.add(mnuNomi); mnuCole.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/school_noun_147545_cc.png"))); // NOI18N mnuCole.setText("[O] = Option 5"); mnuCole.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N mbarMenu.add(mnuCole); mnuExit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icons/logout_noun_14841_cc.png"))); // NOI18N mnuExit.setText("[S] = Option 6"); mnuExit.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N mnuExit.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { mnuExitMouseClicked(evt); } }); mbarMenu.add(mnuExit); jInternalFrame1.setJMenuBar(mbarMenu); javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane()); jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout); jInternalFrame1Layout.setHorizontalGroup( jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 989, Short.MAX_VALUE) ); jInternalFrame1Layout.setVerticalGroup( jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jInternalFrame1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jInternalFrame1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }// </editor-fold> private void mnuExitMouseClicked(java.awt.event.MouseEvent evt) { this.dispose(); System.exit(0); } /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(frmMain.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new frmMain().setVisible(true); } }); } public static void salida(){ System.exit(0); } // Variables declaration - do not modify private javax.swing.JDesktopPane jDesktopPane1; private javax.swing.JInternalFrame jInternalFrame1; private javax.swing.JMenuBar mbarMenu; private javax.swing.JMenu mnuCole; private javax.swing.JMenu mnuConta; private javax.swing.JMenu mnuDiezmo; private javax.swing.JMenu mnuExit; private javax.swing.JMenu mnuNomi; private javax.swing.JMenu mnuTeso; // End of variables declaration } ``` The `MyDispatcher` class implements the KeyListener, and is supposed to raise a JOptionPane.showMessageDialog() only once for each time a desired key is pressed. Thank you in advance for any guidance on the subject.
2015/12/21
[ "https://Stackoverflow.com/questions/34390284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/906428/" ]
The basic problem is, you are getting both a key pressed and key released event, but you are only changing `optionselected` on key release. So: * Pressing `C`, on `keyPressed`, `optionSelected` is `null`, `other` will be `null`, on `keyReleased`, `optionSelected` becomes `C`, show dialog * Pressing `T`, on `keyPressed` `optionselected` is (still) `C`, show dialog, on `keyReleased` `optionselected` becomes `T`, show dialog Instead, you should be processing only the `keyReleased` event ``` private class MyDispatcher implements KeyEventDispatcher { @Override public boolean dispatchKeyEvent(KeyEvent e) { if (e.getID() == KeyEvent.KEY_RELEASED) { optionselected = e.getKeyChar(); other = String.valueOf(optionselected).toUpperCase(); switch (other) { case "C": JOptionPane.showMessageDialog(null, "Option 1"); break; case "T": JOptionPane.showMessageDialog(null, "Option 2"); break; case "D": JOptionPane.showMessageDialog(null, "Option 3"); break; case "N": JOptionPane.showMessageDialog(null, "Option 4"); break; case "O": JOptionPane.showMessageDialog(null, "Option 5"); break; case "S": JOptionPane.showMessageDialog(null, "Option 6"); break; default: break; } } return false; } } ``` Having said all that, `KeyEventDispatcher` is very, very low level, a better solution might be to use the key bindings API, see [How to Use Key Bindings](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) for more details
From [the documentation for `dispatchKeyEvent`](https://docs.oracle.com/javase/8/docs/api/java/awt/KeyEventDispatcher.html): > > Return `true` if the KeyboardFocusManager should take no further > action with regard to the KeyEvent; `false` otherwise > > > Also you can directly consume the event in your `dispatchKeyEvent` implementation when no further processing of the event is required. ``` e.consume(); ``` Suggestion of @MadProgrammer is also important. Using of global event processing possibilities is the last choice.
60,753,061
In the same function, I have tried to use integer, float, and rounding, but I could not get this result. What did I do wrong? The goal is: 10\*12.3 = 123 3\*12.3= 36.9 my code: ```py def multi(n1, n2): x = n1*n2 return x ``` I have tried `int(n1*n2)`, but I got 123 and 36. Then I tried `float(n1*n2)` and I got 123.0 and 36.9. What did I do wrong and how can I fix it?
2020/03/19
[ "https://Stackoverflow.com/questions/60753061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13064478/" ]
You are always multiplying an integer with a float which will always output a float. If you want the number that your function returns to be a float with 1 decimal point you can use `round(num, 1)`. ```py def multi(n1, n2): x = n1*n2 return round(x, 1) print(multi(10, 12.3)) # outputs '123.0' print(multi(3, 12.3)) # outputs '36.9' ``` To escape the `.0` you could probably use an if statement although I don't see the use of it, since doing calculations with floats have the same output as integers *(when they are `.0`)* ```py def multi(n1, n2): x = n1 * n2 return round(x, 1) output = [] output.append(multi(10, 12.3)) # outputs '123.0' output.append(multi(3, 12.3)) # outputs '36.9' for index, item in enumerate(output): if int(item) == float(item): output[index] = int(item) print(output) # prints [129, 36.9] ``` This should probably help you but it shouldn't matter all that match to you
The number is not the *representation* of the number. For example, all these representations are `123`: ``` 123 12.3E1 123.0 123.0000000000000000000 ``` My advice is to do them as floating point and either use output formatting to get them all in a consistent format: ``` >>> for i in (12.3 * 10, 42., 36.9 / 10): ... print(f"{i:8.2f}") ... 123.00 42.00 3.69 ``` or string manipulation to remove useless suffixes: ``` >>> import re >>> x = 12.3 * 10 >>> print(x) 123.0 >>> print(re.sub(r"\.0*$", "", str(x))) 123 ```
44,089,415
I am and getting an error when trying to modify code to handle documents in `Android Nougat`. > > incompatible types: cannot be converted to Context > > > This is my code ``` documentViewHolder.preview.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { File document = new File(Environment.getExternalStorageDirectory() + "/heyJudeDocuments/" + getItem(position).attachment_id); // -> filename = maven.pdf Uri path = FileProvider.getUriForFile(MessageAdapter.this,BuildConfig.APPLICATION_ID + ".provider",document); Intent docIntent = new Intent(Intent.ACTION_VIEW); docIntent.setDataAndType(path, getItem(position).mime); docIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); docIntent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); ``` It's the `MessageAdapter.this` part that seems to be wrong. Can someone point out where I am going wrong?
2017/05/20
[ "https://Stackoverflow.com/questions/44089415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8041623/" ]
``` public class MessageAdapter extends BaseAdapter { private Context context; public MessageAdapter(Context context) { this.context = context; } ``` use that context(instead of MessageAdapter.this) in Uri ``` Uri path = FileProvider.getUriForFile(context ,BuildConfig.APPLICATION_ID + ".provider",document); ```
`MessageAdapter` is not a subclass of `Context`. Usually, for what you are doing (starting an activity, presumably), you have access to the `Activity` that you are in, and that is the `Context` to use here.
212,408
How common is the expression 'to keep someone across' the news. Is this a new phrasal verb? I've noticed it mostly in the last four years on British news programmes, such as the BBC. It seems to mean that they will try to keep us informed of any developments in a news story. Has it appeared in any dictionary yet?
2014/12/07
[ "https://english.stackexchange.com/questions/212408", "https://english.stackexchange.com", "https://english.stackexchange.com/users/87328/" ]
You heard "keep someone across" the news correctly. It is not so common (evidenced in part by the response you've received here) and you are not the first to wonder about it (as you can see in this [wordsmith.org forum](http://wordsmith.org/board/ubbthreads.php?ubb=showflat&Number=161960) as well as this [wordreference.com forum](http://forum.wordreference.com/showthread.php?t=2207555)) However, yes, it is currently being used; here are a couple examples (with links): > > ["Guardian Australia will be back on deck tomorrow to keep you across all the G20 news you can handle."](http://www.theguardian.com/world/live/2014/nov/15/g20-brisbane-world-leaders-meet-at-2014-summit-live) - from *the Guardian* > > > ["We keep you across events unfolding after yesterday's plane crash in eastern Ukraine."](http://www.bbc.co.uk/programmes/p022m7b9) - from *BBC World Service* > > > There are several others you can find - all from UK, Australia, or NZ and all relatively recent - simply by Googling "keep you across" (with quotation marks) and hitting "news" (as oppposed to "web"). Interestingly, there are only three pages of results, which would suggest that the history of this expression (or, to be perfectly logical, the history of the use of the expression with "you"), is relatively brief. The meaning in the examples you can find is, in almost all cases, "keep you abreast of" something, as defined in FumbleFingers post. However, you will find it used in a slightly different sense here, in a review of LG's G Watch R, which is touted as a... > > ["...highly sophisticated heart-rate monitor that helps to keep you across your daily workouts."](http://www.itwire.com/your-it-news/mobility/66015-video-lg%E2%80%99s-g-watch-r-in-oz-now-for-$359) - ITWire > > > But no, you won't find it in dictionaries and it would seem, given the evidence, that we are witnessing the birth of a new expression. If anyone has evidence to show that this is, in fact a *revival* of an older expression, I'd love to see it!
I suspect OP has simply misheard something like [*The BBC keeps you **abreast of** current affairs...*](https://www.google.co.uk/search?q=%22keeps%20you%20abreast%20of%22&rlz=1C1CHFX_en-GBGB569GB569&oq=%22keeps%20you%20abreast%20of%22&aqs=chrome..69i57.12810372j0j0&sourceid=chrome&es_sm=122&ie=UTF-8) > > [**abreast**](http://www.merriam-webster.com/dictionary/abreast) 2: up to a particular standard or level especially of knowledge of recent developments > > *keeps abreast of the news* > > > ...or maybe *one or more other people* have made this mistake, which OP has noticed. It doesn't seem like a very justifiable "spatial metaphor" usage to me in this context. Noting OP's [example usages in a comment](https://english.stackexchange.com/questions/212408/is-keep-someone-across-a-new-phrasal-verb/212414#comment452255_212408), I would expect... > > *"We'll keep you **abreast of** that story"* > > *"We'll keep **on** that for you"* > > > --- As John Lawler points out, unless anyone is prepared to accept forms like *"We are keeping across Ken Anderson on this story"*, it wouldn't actualy be a "phrasal verb" anyway, because it doesn't do [Particle Shift](http://linguistics.lang.answers.ninja/post/3184).
212,408
How common is the expression 'to keep someone across' the news. Is this a new phrasal verb? I've noticed it mostly in the last four years on British news programmes, such as the BBC. It seems to mean that they will try to keep us informed of any developments in a news story. Has it appeared in any dictionary yet?
2014/12/07
[ "https://english.stackexchange.com/questions/212408", "https://english.stackexchange.com", "https://english.stackexchange.com/users/87328/" ]
I suspect OP has simply misheard something like [*The BBC keeps you **abreast of** current affairs...*](https://www.google.co.uk/search?q=%22keeps%20you%20abreast%20of%22&rlz=1C1CHFX_en-GBGB569GB569&oq=%22keeps%20you%20abreast%20of%22&aqs=chrome..69i57.12810372j0j0&sourceid=chrome&es_sm=122&ie=UTF-8) > > [**abreast**](http://www.merriam-webster.com/dictionary/abreast) 2: up to a particular standard or level especially of knowledge of recent developments > > *keeps abreast of the news* > > > ...or maybe *one or more other people* have made this mistake, which OP has noticed. It doesn't seem like a very justifiable "spatial metaphor" usage to me in this context. Noting OP's [example usages in a comment](https://english.stackexchange.com/questions/212408/is-keep-someone-across-a-new-phrasal-verb/212414#comment452255_212408), I would expect... > > *"We'll keep you **abreast of** that story"* > > *"We'll keep **on** that for you"* > > > --- As John Lawler points out, unless anyone is prepared to accept forms like *"We are keeping across Ken Anderson on this story"*, it wouldn't actualy be a "phrasal verb" anyway, because it doesn't do [Particle Shift](http://linguistics.lang.answers.ninja/post/3184).
It may have been invented by Adnan Nawaz. He uses it in every telecast. I always thought it was a mistake, but it seems he decided to go with it and make it a new normal.
212,408
How common is the expression 'to keep someone across' the news. Is this a new phrasal verb? I've noticed it mostly in the last four years on British news programmes, such as the BBC. It seems to mean that they will try to keep us informed of any developments in a news story. Has it appeared in any dictionary yet?
2014/12/07
[ "https://english.stackexchange.com/questions/212408", "https://english.stackexchange.com", "https://english.stackexchange.com/users/87328/" ]
You heard "keep someone across" the news correctly. It is not so common (evidenced in part by the response you've received here) and you are not the first to wonder about it (as you can see in this [wordsmith.org forum](http://wordsmith.org/board/ubbthreads.php?ubb=showflat&Number=161960) as well as this [wordreference.com forum](http://forum.wordreference.com/showthread.php?t=2207555)) However, yes, it is currently being used; here are a couple examples (with links): > > ["Guardian Australia will be back on deck tomorrow to keep you across all the G20 news you can handle."](http://www.theguardian.com/world/live/2014/nov/15/g20-brisbane-world-leaders-meet-at-2014-summit-live) - from *the Guardian* > > > ["We keep you across events unfolding after yesterday's plane crash in eastern Ukraine."](http://www.bbc.co.uk/programmes/p022m7b9) - from *BBC World Service* > > > There are several others you can find - all from UK, Australia, or NZ and all relatively recent - simply by Googling "keep you across" (with quotation marks) and hitting "news" (as oppposed to "web"). Interestingly, there are only three pages of results, which would suggest that the history of this expression (or, to be perfectly logical, the history of the use of the expression with "you"), is relatively brief. The meaning in the examples you can find is, in almost all cases, "keep you abreast of" something, as defined in FumbleFingers post. However, you will find it used in a slightly different sense here, in a review of LG's G Watch R, which is touted as a... > > ["...highly sophisticated heart-rate monitor that helps to keep you across your daily workouts."](http://www.itwire.com/your-it-news/mobility/66015-video-lg%E2%80%99s-g-watch-r-in-oz-now-for-$359) - ITWire > > > But no, you won't find it in dictionaries and it would seem, given the evidence, that we are witnessing the birth of a new expression. If anyone has evidence to show that this is, in fact a *revival* of an older expression, I'd love to see it!
It may have been invented by Adnan Nawaz. He uses it in every telecast. I always thought it was a mistake, but it seems he decided to go with it and make it a new normal.
9,799,783
I have an application in c#.net in which I have embeded the SWF file in SWFObject from COM Object. Now after installation, the original SWF file also available in the application root directory. So from that place(application root directory) anyone can access that file. But I want to restrict that file from being opened. ``` axShockwaveFlash1.Movie = Directory.GetCurrentDirectory() + "\\XYZ.swf"; ``` I did something like this. So how can I restrict that file in application root directory such that only from my application I can access it..??
2012/03/21
[ "https://Stackoverflow.com/questions/9799783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1042848/" ]
I'm doing it like this: ``` body.ui-mobile-viewport,div.ui-mobile-viewport { background-color: transparent; background-image: url("your_image_URL"); } ```
I am going to guess its a CSS property that has background image set.
13,017
I saw a few questions, which are asking for the latest version of package/lib/software named **XY**, so I do believe that a more general question, which could help other looking for some package/lib/software. > > Where I can find a list of the Software packages and their version numbers supported by the RPi? > > > ***NOTE*** I am referring only to the approved OSes, respectively Raspbian, Arch, Pidora, RaspBMC, OpenELEC and RISC OS.
2014/01/16
[ "https://raspberrypi.stackexchange.com/questions/13017", "https://raspberrypi.stackexchange.com", "https://raspberrypi.stackexchange.com/users/11251/" ]
> > a more general question > > > Good idea, except a generalization would be for the *operating system*, not the device, since it's the OS that determines what software packages are available. By analogy, let's say I have an Acme X1000 Laptop, and I want to know "What software packages are available in what versions?" -- this is dependent on the OS I use on it. Generally, if an OS can be used on a given device, and a particular piece of software runs on that OS, then that software will run on the device via the OS, so the device is irrelevant to the question. Of course, there are inevitably exceptions and caveats. Normative GNU/Linux distributions, such as Raspbian, Arch, and Pidora, are all really variants of *the same operating system* (GNU/Linux). So if software package foobar is available for GNU/Linux, it can probably be made to work -- by which I mean, configured and built without significant changes to the source -- on any normative GNU/Linux distribution. However, "configuring and building" is rarely as fast (esp. on the pi) and easy as simply installing a pre-built package, and those are what the distributions provide. So we want to determine what packages are available for a given distribution in what versions. This can be done via the distro's [package management system](http://en.wikipedia.org/wiki/Package_manager). Here's a brief overview of package management systems for the popular, normative pi distros: * **Raspbian:** Being Debian, the fundamental tools are `apt` and `dpkg`. For example, `apt-cache search foobar` will help to find packages involving foobar; version information can be found via `apt-cache search --full` or `apt-cache showpkg`. [Here's debian's own guide](http://www.debian.org/doc/manuals/debian-reference/ch02.en.html). * **Pidora:** Being Fedora, the main tool is `yum`; you can search with `yum search foobar` and all available versions will be shown. * **Arch:** The package manager is `pacman`. There is a bit of a complication here in that package managers work by searching online repositories, and there may be more repositories available than your package manager is currently configured to check. There are also GUI front-ends available for the above command-line tools, e.g, Synaptic for Debian and PackageKit for Fedora. Whether these really make things easier depends on the user. I've left out RaspBMC, OpenELEC, and RISC OS, since I don't know much about them. I believe the first two are reasonably close to being regular linuxes and should have package managers of some sort. RISC OS is a world of its own.
The official RISC OS package manager is here: <http://www.riscpkg.org/> Note though, that this is a recent project, and up 'til about a year ago, there was no formal packaging used. So this is currently classifiying existing software, and well as new stuff.
455,965
Like most laptops, it has both ethernet and wireless networking options. Likewise, I have a wireless router with 10/100/1000 Mbs. 90% of the time, wireless speeds suffice. But once in a while, I have several gigs of data that needs transfering. In those times, I would physically walk over the router and plug in directly. The problem is that until I disable the wirelless network adapter, Windows still uses the wireless connection as opposed the ethernet connection. **Is there a way to configure Windows to give preference to one network adapter once it becomes availabe instead of disabling the other altogether?**
2012/07/31
[ "https://superuser.com/questions/455965", "https://superuser.com", "https://superuser.com/users/85983/" ]
You have to change the priority of the network adapters. To do this, open the **Network and Sharing Center** and click on **Change adapter settings** in the left pane. you should see a list of network adapters. Press the `Alt` button (if the menu bar is not already visible) and click on the **Advanced** menu, and then choose **Advanced settings**. A new control panel will pop up, and you should see it open to the *Adapters and Bindings* tab. In the top list should be a list of your network adapters, with an up and down arrow button to the right. This is the priority order of what adapter it will use when connecting to the Internet. Choose your Ethernet adapter and click the up arrow button until it shows at the top. Then click *OK*. That should cause it to prioritize your wired connection over WiFi whenever it is connected.
Easier and faster, you can just delete the entire `0.0.0.0` route. ``` route delete 0.0.0.0 ``` And adding back only the preferable route to the internet. ``` route add 0.0.0.0 mask 0.0.0.0 192.168.43.1 METRIC 1 ``` Also ensure that legitimate traffic meant for the second route is added to the routing table so that all traffic meant for that route is not routed through the default route. ``` route add 10.1.0.0 mask 255.255.0.0 10.1.18.41 METRIC 1 ```
455,965
Like most laptops, it has both ethernet and wireless networking options. Likewise, I have a wireless router with 10/100/1000 Mbs. 90% of the time, wireless speeds suffice. But once in a while, I have several gigs of data that needs transfering. In those times, I would physically walk over the router and plug in directly. The problem is that until I disable the wirelless network adapter, Windows still uses the wireless connection as opposed the ethernet connection. **Is there a way to configure Windows to give preference to one network adapter once it becomes availabe instead of disabling the other altogether?**
2012/07/31
[ "https://superuser.com/questions/455965", "https://superuser.com", "https://superuser.com/users/85983/" ]
***(I know there is already accepted answer, but)...*** First, from XP onwards, Windows has a feature called automatic metric. This feature should automatically prioritize traffic on adapter with highest throughput. When you enable 'better' NIC (eg. by plugging in cable) Windows should automatically route traffic via that interface. Obviously yours incorrectly thinks WiFi is faster (which seems to be [reported for some of WiFi cards](http://answers.microsoft.com/en-us/windows/forum/windows_xp-networking/automatic-metric-is-wrong/0eac380f-9920-4dce-b826-2ee8399f42cf)) What is a metric anyway and how it's used by network software? Well,a metric is used in routing when there are multiple paths to a destination and a decision needs to be made which one is the best. The lower, the better. Imagine you're at exit gates in a stadium. There are several gates and each will eventually allow you to get out - you need to select which one is the best, eg. by looking at how many people queue at each. Windows does the same, but bases it's decision on link speed. Your gate to 'outside' is called default route. Let's look at output from `route print` command, which shows you ip routing table: ``` > (output ommited) Network Destination Netmask Gateway Interface Metric > 0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.12 25 > 0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.22 10 (output ommited) ``` Those entries with 0.0.0.0 are default routes (sometimes also called quad 0 routes). Obviously I have two (with both cable and WiFi active), which one will be selected? The one with lower metric. In my case - 0.22 which happens to be my cable connection. **Now important thing** - changing adapter priority via adapter setting **does not change** metric. This means it will not change routing decisions! To actually change metric you need to to to open each adapter properties, then TCP/IP properties, Advanced, uncheck `automatic metric` and enter your own value. Adapter with lowest metric wins. You can quickly check which interface is actually used - open Task Manager - Network, start download/upload and look at interface usage. If you need more detail - use Perfmon.
Easier and faster, you can just delete the entire `0.0.0.0` route. ``` route delete 0.0.0.0 ``` And adding back only the preferable route to the internet. ``` route add 0.0.0.0 mask 0.0.0.0 192.168.43.1 METRIC 1 ``` Also ensure that legitimate traffic meant for the second route is added to the routing table so that all traffic meant for that route is not routed through the default route. ``` route add 10.1.0.0 mask 255.255.0.0 10.1.18.41 METRIC 1 ```
1,695
what ways can I make one new line in a post? And what is the sense in the fact that pushing enter and starting a new line, doesn't create a new line when the question or I guess answer is submitted? Suppose I write a b c I just want a b and c to be on adjacent lines. But they come up as a b c And why is it that when I highlight something and press "Code" I get the backquote thing appear around it, but when I just click code, it lets me enter what it calls "code" which no doubt needn't be.. But it doesn't include hte backquote.. so how would it even know what i'm typing is to be formatted as code?
2010/11/21
[ "https://meta.superuser.com/questions/1695", "https://meta.superuser.com", "https://meta.superuser.com/users/42672/" ]
When you click on the `?` at the top right of the editing box, it leads you to the [markdown editing help page](https://meta.superuser.com/editing-help). This page is far from complete, but does mention > > End a line with two spaces to add a > linebreak: > > > You can also use the `<br>` HTML tag (or `<br/>`) directly. Two newlines make a paragraph break, a newline preceded by two spaces is a line break, and there are a few other cases where newlines have a special meaning, but by default, a newline is a whitespace character like any other, and a sequence of whitespace is rendered as a space. There are two ways to enter code (almost all characters are rendered literally, and in a teletype font): ``between backquotes`` (⇒ `between backquotes`) and in a paragraph indented four spaces. You can also get a teletype font without suppressing special characters as `<code>foo</code>` (⇒ `foo`).
use `<br />` A B C > > so how would it even know what i'm typing is to be formatted as code > > > It doesn't using backticks makes it apply syntax formatting. Else prefixing 4 spaces does the same. ``` like so ``` This is [how I](https://meta.superuser.com/revisions/5db5f237-9391-481d-a8e9-6c448325c766/view-source) entered this post
38,176,658
My data is structured as follows: ``` Name Drill Movement Repetition DV 1 RUTH 90_Turn Sprint 1 10 2 RUTH 90_Turn Sprint 1 12 2 RUTH 90_Turn Sprint 2 12 2 RUTH 90_Turn Sprint 2 9 3 RUTH 90_Turn Sprint 3 14 3 RUTH 90_Turn Sprint 3 12 4 RUTH 90_Turn Walk 1 13 4 RUTH 90_Turn Walk 1 17 5 RUTH 90_Turn Walk 2 11 5 RUTH 90_Turn Walk 2 15 ``` I would like to add in a column `Trial` that contains a code for each unique combination of `Movement` and `Repetition`, such as: ``` Name Drill Movement Repetition DV Trial 1 RUTH 90_Turn Sprint 1 10 D90_Sprint1 2 RUTH 90_Turn Sprint 1 12 D90_Sprint1 2 RUTH 90_Turn Sprint 2 12 D90_Sprint2 2 RUTH 90_Turn Sprint 2 9 D90_Sprint2 3 RUTH 90_Turn Sprint 3 14 D90_Sprint3 3 RUTH 90_Turn Sprint 3 12 D90_Sprint3 4 RUTH 90_Turn Walk 1 13 D90_Walk1 4 RUTH 90_Turn Walk 1 17 D90_Walk1 5 RUTH 90_Turn Walk 2 11 D90_Walk2 5 RUTH 90_Turn Walk 2 15 D90_Walk2 ``` This takes into account the `Drill` which remains constant, along with `Name` - the `data.frame` only consists of Ruth's data for this drill. The `DV` is measured at least twice per `Movement` and `Repetition`. Is it possible to do this? My data frame is 10140 obs. so a quick solution would be ideal. Thank you!
2016/07/04
[ "https://Stackoverflow.com/questions/38176658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2716568/" ]
**I fixed this by including the libxml2.dylib in my project manually.** I'll include steps for anyone that stumbles up on this. 1. Click the folder at the top of Xcode's project pane, and select the first item in your project (it usually has the xcode icon). [![enter image description here](https://i.stack.imgur.com/v4rbU.png)](https://i.stack.imgur.com/v4rbU.png) 2. Click the **General** tab and find "**Linked Frameworks and Libraries**" [![enter image description here](https://i.stack.imgur.com/2bpJa.png)](https://i.stack.imgur.com/2bpJa.png) 3. Scroll all the way to the Bottom of **Linked Frameworks and Libraries** and click the plus sign at the bottom to add a new Framework [![enter image description here](https://i.stack.imgur.com/I8Dgf.png)](https://i.stack.imgur.com/I8Dgf.png) 4. Click Add Other on the framework selection window [![enter image description here](https://i.stack.imgur.com/EwLTq.png)](https://i.stack.imgur.com/EwLTq.png) 5. A basic browse/choose file window will open, click Macintosh HD on the left (optional, but it will make sure you're in the correct place) [![enter image description here](https://i.stack.imgur.com/FOR7Y.png)](https://i.stack.imgur.com/FOR7Y.png) 6. Press CMD+SHIFT+G to bring up the **Go to Folder** window. [![enter image description here](https://i.stack.imgur.com/ctWGL.png)](https://i.stack.imgur.com/ctWGL.png) 7. From this folder, find the file libxml2.dylib and double click it. [![enter image description here](https://i.stack.imgur.com/qKVHG.png)](https://i.stack.imgur.com/qKVHG.png) 8. Save, Clean and Rebuild just to be safe, and you should be good to go.
You can also add "-lxml2" to your "Other Linker Flags" [Xcode Project Settings](https://i.stack.imgur.com/NLKrQ.png)
38,176,658
My data is structured as follows: ``` Name Drill Movement Repetition DV 1 RUTH 90_Turn Sprint 1 10 2 RUTH 90_Turn Sprint 1 12 2 RUTH 90_Turn Sprint 2 12 2 RUTH 90_Turn Sprint 2 9 3 RUTH 90_Turn Sprint 3 14 3 RUTH 90_Turn Sprint 3 12 4 RUTH 90_Turn Walk 1 13 4 RUTH 90_Turn Walk 1 17 5 RUTH 90_Turn Walk 2 11 5 RUTH 90_Turn Walk 2 15 ``` I would like to add in a column `Trial` that contains a code for each unique combination of `Movement` and `Repetition`, such as: ``` Name Drill Movement Repetition DV Trial 1 RUTH 90_Turn Sprint 1 10 D90_Sprint1 2 RUTH 90_Turn Sprint 1 12 D90_Sprint1 2 RUTH 90_Turn Sprint 2 12 D90_Sprint2 2 RUTH 90_Turn Sprint 2 9 D90_Sprint2 3 RUTH 90_Turn Sprint 3 14 D90_Sprint3 3 RUTH 90_Turn Sprint 3 12 D90_Sprint3 4 RUTH 90_Turn Walk 1 13 D90_Walk1 4 RUTH 90_Turn Walk 1 17 D90_Walk1 5 RUTH 90_Turn Walk 2 11 D90_Walk2 5 RUTH 90_Turn Walk 2 15 D90_Walk2 ``` This takes into account the `Drill` which remains constant, along with `Name` - the `data.frame` only consists of Ruth's data for this drill. The `DV` is measured at least twice per `Movement` and `Repetition`. Is it possible to do this? My data frame is 10140 obs. so a quick solution would be ideal. Thank you!
2016/07/04
[ "https://Stackoverflow.com/questions/38176658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2716568/" ]
**I fixed this by including the libxml2.dylib in my project manually.** I'll include steps for anyone that stumbles up on this. 1. Click the folder at the top of Xcode's project pane, and select the first item in your project (it usually has the xcode icon). [![enter image description here](https://i.stack.imgur.com/v4rbU.png)](https://i.stack.imgur.com/v4rbU.png) 2. Click the **General** tab and find "**Linked Frameworks and Libraries**" [![enter image description here](https://i.stack.imgur.com/2bpJa.png)](https://i.stack.imgur.com/2bpJa.png) 3. Scroll all the way to the Bottom of **Linked Frameworks and Libraries** and click the plus sign at the bottom to add a new Framework [![enter image description here](https://i.stack.imgur.com/I8Dgf.png)](https://i.stack.imgur.com/I8Dgf.png) 4. Click Add Other on the framework selection window [![enter image description here](https://i.stack.imgur.com/EwLTq.png)](https://i.stack.imgur.com/EwLTq.png) 5. A basic browse/choose file window will open, click Macintosh HD on the left (optional, but it will make sure you're in the correct place) [![enter image description here](https://i.stack.imgur.com/FOR7Y.png)](https://i.stack.imgur.com/FOR7Y.png) 6. Press CMD+SHIFT+G to bring up the **Go to Folder** window. [![enter image description here](https://i.stack.imgur.com/ctWGL.png)](https://i.stack.imgur.com/ctWGL.png) 7. From this folder, find the file libxml2.dylib and double click it. [![enter image description here](https://i.stack.imgur.com/qKVHG.png)](https://i.stack.imgur.com/qKVHG.png) 8. Save, Clean and Rebuild just to be safe, and you should be good to go.
"You can also add "-lxml2" to your "Other Linker Flags" Xcode Project Settings" This Work for me like a charm
38,176,658
My data is structured as follows: ``` Name Drill Movement Repetition DV 1 RUTH 90_Turn Sprint 1 10 2 RUTH 90_Turn Sprint 1 12 2 RUTH 90_Turn Sprint 2 12 2 RUTH 90_Turn Sprint 2 9 3 RUTH 90_Turn Sprint 3 14 3 RUTH 90_Turn Sprint 3 12 4 RUTH 90_Turn Walk 1 13 4 RUTH 90_Turn Walk 1 17 5 RUTH 90_Turn Walk 2 11 5 RUTH 90_Turn Walk 2 15 ``` I would like to add in a column `Trial` that contains a code for each unique combination of `Movement` and `Repetition`, such as: ``` Name Drill Movement Repetition DV Trial 1 RUTH 90_Turn Sprint 1 10 D90_Sprint1 2 RUTH 90_Turn Sprint 1 12 D90_Sprint1 2 RUTH 90_Turn Sprint 2 12 D90_Sprint2 2 RUTH 90_Turn Sprint 2 9 D90_Sprint2 3 RUTH 90_Turn Sprint 3 14 D90_Sprint3 3 RUTH 90_Turn Sprint 3 12 D90_Sprint3 4 RUTH 90_Turn Walk 1 13 D90_Walk1 4 RUTH 90_Turn Walk 1 17 D90_Walk1 5 RUTH 90_Turn Walk 2 11 D90_Walk2 5 RUTH 90_Turn Walk 2 15 D90_Walk2 ``` This takes into account the `Drill` which remains constant, along with `Name` - the `data.frame` only consists of Ruth's data for this drill. The `DV` is measured at least twice per `Movement` and `Repetition`. Is it possible to do this? My data frame is 10140 obs. so a quick solution would be ideal. Thank you!
2016/07/04
[ "https://Stackoverflow.com/questions/38176658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2716568/" ]
You can also add "-lxml2" to your "Other Linker Flags" [Xcode Project Settings](https://i.stack.imgur.com/NLKrQ.png)
"You can also add "-lxml2" to your "Other Linker Flags" Xcode Project Settings" This Work for me like a charm
18,901,776
It seems that our apps which use `getPropertyType(..)` are failing under ios7. For whatever reason, `getPropertyType(..)` on for example a NSString property returns `NSString$'\x19\x03\x86\x13` as the type, instead of just NSString, and also instead of NSNumber it returns `NSNumber\xf0\x90\xae\x04\xff\xff\xff\xff`. All of this is causing some tricky problems when i later on check against a specific type. I have changed this (legacy?) code to use `isKindOfClass` instead, but it bothers me that I don't understand whats going on here. The code in question: ``` #import <objc/runtime.h> static const char *getPropertyType(objc_property_t property) { const char *attributes = property_getAttributes(property); char buffer[1 + strlen(attributes)]; strcpy(buffer, attributes); char *state = buffer, *attribute; while ((attribute = strsep(&state, ",")) != NULL) { if (attribute[0] == 'T') { return (const char *)[[NSData dataWithBytes:(attribute + 3) length:strlen(attribute) - 4] bytes]; } } return "@"; } ``` What on earth is going on, why are the results different??
2013/09/19
[ "https://Stackoverflow.com/questions/18901776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/215400/" ]
The buffer returned by getPropertyType isn't NULL terminated. I think it's only dumb luck that it ever worked. Also, returning the data pointed to by a newly created NSData is not guaranteed to work once that function returns. I'd make this return an NSString. ``` NSString* getPropertyType(objc_property_t property) { const char *attributes = property_getAttributes(property); char buffer[1 + strlen(attributes)]; strcpy(buffer, attributes); char *state = buffer, *attribute; while ((attribute = strsep(&state, ",")) != NULL) { if (attribute[0] == 'T') { return [[NSString alloc] initWithBytes:attribute + 3 length:strlen(attribute) - 4 encoding:NSASCIIStringEncoding]; } } return @"@"; } ``` This assumes ARC.
The return value of your method need not be NULL-terminated, as it points to the internal memory of an `NSData` object. This would explain random bytes after your expected output. Note also that the return value might not point to valid memory at all if the `NSData` object is destroyed (which might be at any time after your function returns).
49,843,926
I have a table on my website which contains the columns: User, Title, Description, Join, Update, Delete. The "User" column's width is way too big as well as the "Title" column. I need help with CSS to set them to something smaller without affecting the width of the other columns as they are perfect as is. My Code: ``` <?php echo "<table> <tr> <th>User</th> <th>Title</th> <th>Description</th> <th></th> <th>Join</th> <th>Update</th> <th>Delete</th> </tr>"; while ($record = mysql_fetch_array($myData)) { echo "<form action=findGroup.php method=post>"; echo "<div class=joinLink>"; echo "<tr>"; echo "<td>" . "<input type=text name=name value='" . $record['form_user'] . "'/> </td>"; echo "<td>" . "<input type=text name=name value='" . $record['form_name'] . "'/> </td>"; echo "<td>" . "<input type=text name=description value='" . $record['form_description'] . "'/> </td>"; echo "<td>" . "<input type=hidden name=hidden value='" . $record['form_id'] . "'/></td>"; echo "<td><a class=joinLink type=text name=join href='http://localhost:3000'>Join</a></td>"; echo "<td>" . "<input type=submit name=update value='Update" . "'/> </td>"; echo "<td>" . "<input type=submit name=delete value='Delete" . "'/> </td>"; echo "</tr>"; echo "</div>"; echo "</form>"; } echo "</table>"; ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; } input { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; height: auto; overflow: hidden; } th { align: centre; text-align: centre; background-color: #4D5960; color: white; } tr { background-color: #f2f2f2 } input[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } a[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } ```
2018/04/15
[ "https://Stackoverflow.com/questions/49843926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5673120/" ]
You can use **width** property to fix the width of your columns. You can apply width in html directly or using css **HTML** ``` <td width="20%">content</td> <th width="20%">content</th> ``` **CSS** ``` .custom-class{ width: 20%; } <th class="custom-class"></th> <td class="custom-class"></td> ```
it seems that there is no problem, everything is the same ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; text-align: center; align: center; } input { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; align: center; height: auto; overflow: hidden; } th { align:center; text-align: center; background-color: #4D5960; color: white; } tr {background-color: #f2f2f2} input[type="text"]{width:100% !important; line-height:30px; box-sizing:border-box;} a[type="text"]{width:100% !important; line-height:30px; box-sizing:border-box;} ``` <https://jsfiddle.net/1qy5v05p/6/> you can also use Bootstrap 4, maybe it will be better <https://www.w3schools.com/bootstrap4/bootstrap_forms.asp>
49,843,926
I have a table on my website which contains the columns: User, Title, Description, Join, Update, Delete. The "User" column's width is way too big as well as the "Title" column. I need help with CSS to set them to something smaller without affecting the width of the other columns as they are perfect as is. My Code: ``` <?php echo "<table> <tr> <th>User</th> <th>Title</th> <th>Description</th> <th></th> <th>Join</th> <th>Update</th> <th>Delete</th> </tr>"; while ($record = mysql_fetch_array($myData)) { echo "<form action=findGroup.php method=post>"; echo "<div class=joinLink>"; echo "<tr>"; echo "<td>" . "<input type=text name=name value='" . $record['form_user'] . "'/> </td>"; echo "<td>" . "<input type=text name=name value='" . $record['form_name'] . "'/> </td>"; echo "<td>" . "<input type=text name=description value='" . $record['form_description'] . "'/> </td>"; echo "<td>" . "<input type=hidden name=hidden value='" . $record['form_id'] . "'/></td>"; echo "<td><a class=joinLink type=text name=join href='http://localhost:3000'>Join</a></td>"; echo "<td>" . "<input type=submit name=update value='Update" . "'/> </td>"; echo "<td>" . "<input type=submit name=delete value='Delete" . "'/> </td>"; echo "</tr>"; echo "</div>"; echo "</form>"; } echo "</table>"; ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; } input { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; height: auto; overflow: hidden; } th { align: centre; text-align: centre; background-color: #4D5960; color: white; } tr { background-color: #f2f2f2 } input[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } a[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } ```
2018/04/15
[ "https://Stackoverflow.com/questions/49843926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5673120/" ]
You can use **width** property to fix the width of your columns. You can apply width in html directly or using css **HTML** ``` <td width="20%">content</td> <th width="20%">content</th> ``` **CSS** ``` .custom-class{ width: 20%; } <th class="custom-class"></th> <td class="custom-class"></td> ```
There are bunch of jQuery table plugins. Check [this](https://www.sitepoint.com/12-amazing-jquery-tables/) out. My favourites are `DataTables`, `x-Editable` and `Bootgrid`. There are also open sources, you can see them with their Github repo.
49,843,926
I have a table on my website which contains the columns: User, Title, Description, Join, Update, Delete. The "User" column's width is way too big as well as the "Title" column. I need help with CSS to set them to something smaller without affecting the width of the other columns as they are perfect as is. My Code: ``` <?php echo "<table> <tr> <th>User</th> <th>Title</th> <th>Description</th> <th></th> <th>Join</th> <th>Update</th> <th>Delete</th> </tr>"; while ($record = mysql_fetch_array($myData)) { echo "<form action=findGroup.php method=post>"; echo "<div class=joinLink>"; echo "<tr>"; echo "<td>" . "<input type=text name=name value='" . $record['form_user'] . "'/> </td>"; echo "<td>" . "<input type=text name=name value='" . $record['form_name'] . "'/> </td>"; echo "<td>" . "<input type=text name=description value='" . $record['form_description'] . "'/> </td>"; echo "<td>" . "<input type=hidden name=hidden value='" . $record['form_id'] . "'/></td>"; echo "<td><a class=joinLink type=text name=join href='http://localhost:3000'>Join</a></td>"; echo "<td>" . "<input type=submit name=update value='Update" . "'/> </td>"; echo "<td>" . "<input type=submit name=delete value='Delete" . "'/> </td>"; echo "</tr>"; echo "</div>"; echo "</form>"; } echo "</table>"; ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; } input { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; height: auto; overflow: hidden; } th { align: centre; text-align: centre; background-color: #4D5960; color: white; } tr { background-color: #f2f2f2 } input[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } a[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } ```
2018/04/15
[ "https://Stackoverflow.com/questions/49843926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5673120/" ]
You can use **width** property to fix the width of your columns. You can apply width in html directly or using css **HTML** ``` <td width="20%">content</td> <th width="20%">content</th> ``` **CSS** ``` .custom-class{ width: 20%; } <th class="custom-class"></th> <td class="custom-class"></td> ```
If you don't mind I would suggest some changes, see below. Check if the form action is either join, update or delete to perform the action. About the data structure you receive when the form is submitted check out the `var_dump($_POST);` part PHP: ``` <?php var_dump($_POST); ?> ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; } input[type="text"] { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; box-sizing: border-box; padding: 6px 13px; } button { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; box-sizing: border-box; padding: 6px 13px; } thead th { align: center; text-align: center; background-color: #4D5960; color: #ffffff; } tbody td { align: center; text-align: center; background-color: #f2f2f2; } ``` HTML/PHP: ``` <form action="index.php" method="POST" enctype="application/x-www-form-urlencoded"> <table> <thead> <tr> <th class="col-name">User</th> <th class="col-title">Title</th> <th class="col-description">Description</th> <th class="col-join">Join</th> <th class="col-update">Update</th> <th class="col-delete">Delete</th> </tr> </thead> <tbody> <?php foreach ([0, 1, 2, 3] as $row) : ?> <tr> <td class="col-name"> <input type="hidden" name="user[id][]" value=""> <input type="text" name="user[name][]" value="" size="10"> </td> <td class="col-title"> <input type="text" name="user[title][]" value="" size="10"> </td> <td class="col-description"> <input type="text" name="user[description][]" value="" size="10"> </td> <td class="col-join"> <button type="submit" name="action" value="join">Join</button> </td> <td class="col-update"> <button type="submit" name="action" value="update">Update</button> </td> <td class="col-delete"> <button type="submit" name="action" value="delete">Delete</button> </td> </tr> <?php endforeach; ?> </tbody> </table> </form> ```
49,843,926
I have a table on my website which contains the columns: User, Title, Description, Join, Update, Delete. The "User" column's width is way too big as well as the "Title" column. I need help with CSS to set them to something smaller without affecting the width of the other columns as they are perfect as is. My Code: ``` <?php echo "<table> <tr> <th>User</th> <th>Title</th> <th>Description</th> <th></th> <th>Join</th> <th>Update</th> <th>Delete</th> </tr>"; while ($record = mysql_fetch_array($myData)) { echo "<form action=findGroup.php method=post>"; echo "<div class=joinLink>"; echo "<tr>"; echo "<td>" . "<input type=text name=name value='" . $record['form_user'] . "'/> </td>"; echo "<td>" . "<input type=text name=name value='" . $record['form_name'] . "'/> </td>"; echo "<td>" . "<input type=text name=description value='" . $record['form_description'] . "'/> </td>"; echo "<td>" . "<input type=hidden name=hidden value='" . $record['form_id'] . "'/></td>"; echo "<td><a class=joinLink type=text name=join href='http://localhost:3000'>Join</a></td>"; echo "<td>" . "<input type=submit name=update value='Update" . "'/> </td>"; echo "<td>" . "<input type=submit name=delete value='Delete" . "'/> </td>"; echo "</tr>"; echo "</div>"; echo "</form>"; } echo "</table>"; ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; } input { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; height: auto; overflow: hidden; } th { align: centre; text-align: centre; background-color: #4D5960; color: white; } tr { background-color: #f2f2f2 } input[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } a[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } ```
2018/04/15
[ "https://Stackoverflow.com/questions/49843926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5673120/" ]
If you don't mind I would suggest some changes, see below. Check if the form action is either join, update or delete to perform the action. About the data structure you receive when the form is submitted check out the `var_dump($_POST);` part PHP: ``` <?php var_dump($_POST); ?> ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; } input[type="text"] { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; box-sizing: border-box; padding: 6px 13px; } button { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; box-sizing: border-box; padding: 6px 13px; } thead th { align: center; text-align: center; background-color: #4D5960; color: #ffffff; } tbody td { align: center; text-align: center; background-color: #f2f2f2; } ``` HTML/PHP: ``` <form action="index.php" method="POST" enctype="application/x-www-form-urlencoded"> <table> <thead> <tr> <th class="col-name">User</th> <th class="col-title">Title</th> <th class="col-description">Description</th> <th class="col-join">Join</th> <th class="col-update">Update</th> <th class="col-delete">Delete</th> </tr> </thead> <tbody> <?php foreach ([0, 1, 2, 3] as $row) : ?> <tr> <td class="col-name"> <input type="hidden" name="user[id][]" value=""> <input type="text" name="user[name][]" value="" size="10"> </td> <td class="col-title"> <input type="text" name="user[title][]" value="" size="10"> </td> <td class="col-description"> <input type="text" name="user[description][]" value="" size="10"> </td> <td class="col-join"> <button type="submit" name="action" value="join">Join</button> </td> <td class="col-update"> <button type="submit" name="action" value="update">Update</button> </td> <td class="col-delete"> <button type="submit" name="action" value="delete">Delete</button> </td> </tr> <?php endforeach; ?> </tbody> </table> </form> ```
it seems that there is no problem, everything is the same ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; text-align: center; align: center; } input { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; align: center; height: auto; overflow: hidden; } th { align:center; text-align: center; background-color: #4D5960; color: white; } tr {background-color: #f2f2f2} input[type="text"]{width:100% !important; line-height:30px; box-sizing:border-box;} a[type="text"]{width:100% !important; line-height:30px; box-sizing:border-box;} ``` <https://jsfiddle.net/1qy5v05p/6/> you can also use Bootstrap 4, maybe it will be better <https://www.w3schools.com/bootstrap4/bootstrap_forms.asp>
49,843,926
I have a table on my website which contains the columns: User, Title, Description, Join, Update, Delete. The "User" column's width is way too big as well as the "Title" column. I need help with CSS to set them to something smaller without affecting the width of the other columns as they are perfect as is. My Code: ``` <?php echo "<table> <tr> <th>User</th> <th>Title</th> <th>Description</th> <th></th> <th>Join</th> <th>Update</th> <th>Delete</th> </tr>"; while ($record = mysql_fetch_array($myData)) { echo "<form action=findGroup.php method=post>"; echo "<div class=joinLink>"; echo "<tr>"; echo "<td>" . "<input type=text name=name value='" . $record['form_user'] . "'/> </td>"; echo "<td>" . "<input type=text name=name value='" . $record['form_name'] . "'/> </td>"; echo "<td>" . "<input type=text name=description value='" . $record['form_description'] . "'/> </td>"; echo "<td>" . "<input type=hidden name=hidden value='" . $record['form_id'] . "'/></td>"; echo "<td><a class=joinLink type=text name=join href='http://localhost:3000'>Join</a></td>"; echo "<td>" . "<input type=submit name=update value='Update" . "'/> </td>"; echo "<td>" . "<input type=submit name=delete value='Delete" . "'/> </td>"; echo "</tr>"; echo "</div>"; echo "</form>"; } echo "</table>"; ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; } input { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: centre; align: centre; height: auto; overflow: hidden; } th { align: centre; text-align: centre; background-color: #4D5960; color: white; } tr { background-color: #f2f2f2 } input[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } a[type="text"]{ width:100% !important; line-height:30px; box-sizing:border-box; } ```
2018/04/15
[ "https://Stackoverflow.com/questions/49843926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5673120/" ]
If you don't mind I would suggest some changes, see below. Check if the form action is either join, update or delete to perform the action. About the data structure you receive when the form is submitted check out the `var_dump($_POST);` part PHP: ``` <?php var_dump($_POST); ?> ``` CSS: ``` table { width: 100%; font: 17px/1.5 Arial, Helvetica,sans-serif; } input[type="text"] { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; box-sizing: border-box; padding: 6px 13px; } button { width: 100%; font: 13px/1.5 Arial, Helvetica,sans-serif; text-align: center; box-sizing: border-box; padding: 6px 13px; } thead th { align: center; text-align: center; background-color: #4D5960; color: #ffffff; } tbody td { align: center; text-align: center; background-color: #f2f2f2; } ``` HTML/PHP: ``` <form action="index.php" method="POST" enctype="application/x-www-form-urlencoded"> <table> <thead> <tr> <th class="col-name">User</th> <th class="col-title">Title</th> <th class="col-description">Description</th> <th class="col-join">Join</th> <th class="col-update">Update</th> <th class="col-delete">Delete</th> </tr> </thead> <tbody> <?php foreach ([0, 1, 2, 3] as $row) : ?> <tr> <td class="col-name"> <input type="hidden" name="user[id][]" value=""> <input type="text" name="user[name][]" value="" size="10"> </td> <td class="col-title"> <input type="text" name="user[title][]" value="" size="10"> </td> <td class="col-description"> <input type="text" name="user[description][]" value="" size="10"> </td> <td class="col-join"> <button type="submit" name="action" value="join">Join</button> </td> <td class="col-update"> <button type="submit" name="action" value="update">Update</button> </td> <td class="col-delete"> <button type="submit" name="action" value="delete">Delete</button> </td> </tr> <?php endforeach; ?> </tbody> </table> </form> ```
There are bunch of jQuery table plugins. Check [this](https://www.sitepoint.com/12-amazing-jquery-tables/) out. My favourites are `DataTables`, `x-Editable` and `Bootgrid`. There are also open sources, you can see them with their Github repo.
73,144,125
I have this project where I pull a json from gitlab, filter its contents, and then spit out a csv report. I've been going in circles putting in different solutions, and I *did* get it to work on my personal PC using two different methods, but neither work in the gitlab environment. First issue: The dataset I'm pulling is rather peculiar in that its 2d: {'id':0, 'entity\_type':'Project', 'details':{'author\_name':'Billy', 'author\_id':02}, 'created\_at':10242022} which translates to: | id | entity\_type | details | created\_at | | --- | --- | --- | --- | | 0 | Project | {'author\_name':'Billy', 'author\_id':02} | 10-24-2022 | What I've been trying to do is flatten it into this: | id | entity\_type | author\_name | author\_id | created\_at | | --- | --- | --- | --- | --- | | 0 | Project | 'Billy' | 02 | 10-24-2022 | What I have so far is the following, which works on my personal PC, but for some reason not the gitlab: ``` import pandas as pd #pull data from the gitlab df = pd.DataFrame(data) sub_df = df.details.apply(pd.Series) #pull out details column sub_df = pd.concat({'details':sub_df}, axis=1, names=['l1','l2']) # df = pd.concat({'':df}, axis=1, names =['l1','l2']) df = pd.concat((df, sub_df), axis=1) #code to delete unnecessary data from df. ``` Now, on my PC when I run this code, pd.Series helps turn the 'details' column into multiple columns of the headers within. However, when I run it on the GitLab, it instead separates into multiple columns of 'details' with each value stored underneath, ie: | details | details | details | details | ... | | --- | --- | --- | --- | --- | | author\_name | Billy | author\_id | 02 | ... | | author\_name | Sam | author\_id | 05 | ... |
2022/07/27
[ "https://Stackoverflow.com/questions/73144125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19635246/" ]
If you use vector constructor with the integer parameter, you get vector with `nums.size()` elements initialized by default value. You should use indexing to set the elements: ``` ... for(int i = 0; i < l; ++i){ sum2 = sum2 + nums[i]; prefix[i] = sum2; } ... ``` If you want to use `push_back` method, you should create a zero size vector. Use the constructor without parameters. You can use `reserve` method to allocate memory before adding new elements to the vector.
You create `prefix` to be the same size as `nums` and then you `push_back` the same number of elments. `prefix` will therefore be twice the size of `nums` after the first loop. You never access the elements you've `push_back`ed in the second loop so the algorithm is broken. I suggest that you simplify your algorithm. Keep a running sum for the left and the right side. Add to the left and remove from the right as you loop. Example: ``` #include <numeric> #include <vector> int pivotIndex(const std::vector<int>& nums) { int lsum = 0; int rsum = std::accumulate(nums.begin(), nums.end(), 0); for(int idx = 0; idx < nums.size(); ++idx) { rsum -= nums[idx]; // remove from the right if(lsum == rsum) return idx; lsum += nums[idx]; // add to the left } return -1; } ```
107,190
The Ledger company says that their chips are super safe so that even if some electronic engineers get your Ledger wallet, they cannot get your private key. But is that true? For example, if I stole someone's purse and found a Ledger, is it possible I get his/her bitcoins?
2021/06/22
[ "https://bitcoin.stackexchange.com/questions/107190", "https://bitcoin.stackexchange.com", "https://bitcoin.stackexchange.com/users/119689/" ]
There is currently no way I could find that someone could extract a private key out of a Ledger wallet. So if someone steals your Ledger today, they should not be able to spend your coins. However, since the private keys are physically stored in the device, someone successfully extracting them isn't a question of "if" but "when". In case of a firmware vulnerability it may be publicly disclosed only after it is patched with a firmware update, but whoever stole your Ledger simply won't install the update and will now have access to your funds. In other words, if you lose your Ledger wallet (or any other hardware wallet) or it gets stolen, it's best to sweep your funds into a wallet with a new seed, sooner rather than later.
If the information is encrypted, it is not possible at all، Because even after successful data extraction, it needs to be decrypted. Access to encrypted information is completely useless if decryption is not possible.
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
On [POSIX](http://en.wikipedia.org/wiki/POSIX)-compliant systems, your program receives the [SIGSEGV](http://en.wikipedia.org/wiki/SIGSEGV) signal and dies as soon as you call `strlen(p2)`, since `p2` is `NULL`. To my knowledge, there's no way to portably catch [segfaults](http://en.wikipedia.org/wiki/Segmentation_fault) using C++ exceptions.
`strlen()` doesn't throw exceptions, because it's a C function and C does not have exceptions. It just crashes your program when you give it bad input. (Although it is not required to.)
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
On [POSIX](http://en.wikipedia.org/wiki/POSIX)-compliant systems, your program receives the [SIGSEGV](http://en.wikipedia.org/wiki/SIGSEGV) signal and dies as soon as you call `strlen(p2)`, since `p2` is `NULL`. To my knowledge, there's no way to portably catch [segfaults](http://en.wikipedia.org/wiki/Segmentation_fault) using C++ exceptions.
Your code has undefined behavior. Therefore **any** output or **no** output are both valid results. My guess is that `strlen` is causing an access violation (at least on x86) and your program is being terminated. C++ does not throw exceptions upon trying to dereference a null pointer.
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
In C++, dereferencing a NULL pointer causes **undefined behavior**, which means anything could happen: the computer could blow up, the function could return an arbitrary value, the program could be killed by an operating system exception (which, unlike a C++ expression, cannot be caught with `try-catch`). In short, **don't do it**. If you really need to do this for an extremely good reason (like working around a bug in a library you have absolutely no control over), look into your operating system support for such things (such as [SEH](http://msdn.microsoft.com/en-us/library/ms680657%28VS.85%29.aspx) on Windows).
On [POSIX](http://en.wikipedia.org/wiki/POSIX)-compliant systems, your program receives the [SIGSEGV](http://en.wikipedia.org/wiki/SIGSEGV) signal and dies as soon as you call `strlen(p2)`, since `p2` is `NULL`. To my knowledge, there's no way to portably catch [segfaults](http://en.wikipedia.org/wiki/Segmentation_fault) using C++ exceptions.
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
On [POSIX](http://en.wikipedia.org/wiki/POSIX)-compliant systems, your program receives the [SIGSEGV](http://en.wikipedia.org/wiki/SIGSEGV) signal and dies as soon as you call `strlen(p2)`, since `p2` is `NULL`. To my knowledge, there's no way to portably catch [segfaults](http://en.wikipedia.org/wiki/Segmentation_fault) using C++ exceptions.
strlen(NULL) tries to dereference NULL pointer. This raises hardware exception which cannot be caught with try-catch mechanism. Program blows up. You would have the same scenario if you try to perform division by zero. For this reason it is always a good practice to check whether pointers are (not) NULL. If pointer is NULL somewhere where it should not be (and you treat this as an exceptional situation), you can throw software exception from that place. Body of your catch block would have been executed If you had written something like this (before strlen call): ``` if(p2 == NULL) throw 1; ``` You forgot to add endl manipulator in line that prints "mark". It should be: ``` cout << "mark" << endl; ```
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
In C++, dereferencing a NULL pointer causes **undefined behavior**, which means anything could happen: the computer could blow up, the function could return an arbitrary value, the program could be killed by an operating system exception (which, unlike a C++ expression, cannot be caught with `try-catch`). In short, **don't do it**. If you really need to do this for an extremely good reason (like working around a bug in a library you have absolutely no control over), look into your operating system support for such things (such as [SEH](http://msdn.microsoft.com/en-us/library/ms680657%28VS.85%29.aspx) on Windows).
`strlen()` doesn't throw exceptions, because it's a C function and C does not have exceptions. It just crashes your program when you give it bad input. (Although it is not required to.)
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
`strlen()` doesn't throw exceptions, because it's a C function and C does not have exceptions. It just crashes your program when you give it bad input. (Although it is not required to.)
strlen(NULL) tries to dereference NULL pointer. This raises hardware exception which cannot be caught with try-catch mechanism. Program blows up. You would have the same scenario if you try to perform division by zero. For this reason it is always a good practice to check whether pointers are (not) NULL. If pointer is NULL somewhere where it should not be (and you treat this as an exceptional situation), you can throw software exception from that place. Body of your catch block would have been executed If you had written something like this (before strlen call): ``` if(p2 == NULL) throw 1; ``` You forgot to add endl manipulator in line that prints "mark". It should be: ``` cout << "mark" << endl; ```
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
In C++, dereferencing a NULL pointer causes **undefined behavior**, which means anything could happen: the computer could blow up, the function could return an arbitrary value, the program could be killed by an operating system exception (which, unlike a C++ expression, cannot be caught with `try-catch`). In short, **don't do it**. If you really need to do this for an extremely good reason (like working around a bug in a library you have absolutely no control over), look into your operating system support for such things (such as [SEH](http://msdn.microsoft.com/en-us/library/ms680657%28VS.85%29.aspx) on Windows).
Your code has undefined behavior. Therefore **any** output or **no** output are both valid results. My guess is that `strlen` is causing an access violation (at least on x86) and your program is being terminated. C++ does not throw exceptions upon trying to dereference a null pointer.
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
Your code has undefined behavior. Therefore **any** output or **no** output are both valid results. My guess is that `strlen` is causing an access violation (at least on x86) and your program is being terminated. C++ does not throw exceptions upon trying to dereference a null pointer.
strlen(NULL) tries to dereference NULL pointer. This raises hardware exception which cannot be caught with try-catch mechanism. Program blows up. You would have the same scenario if you try to perform division by zero. For this reason it is always a good practice to check whether pointers are (not) NULL. If pointer is NULL somewhere where it should not be (and you treat this as an exceptional situation), you can throw software exception from that place. Body of your catch block would have been executed If you had written something like this (before strlen call): ``` if(p2 == NULL) throw 1; ``` You forgot to add endl manipulator in line that prints "mark". It should be: ``` cout << "mark" << endl; ```
4,155,831
``` int main(int argc, char** argv) { try { char *p2 = NULL; cout << "p2:" << strlen(p2) <<endl; cout << "mark"; } catch (...) { cout << "caught exception" <<endl; } return 0; } ``` The output is `p2:`,so neither `cout << "mark";` nor `cout << "caught exception" <<endl;` got run,why?
2010/11/11
[ "https://Stackoverflow.com/questions/4155831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454770/" ]
In C++, dereferencing a NULL pointer causes **undefined behavior**, which means anything could happen: the computer could blow up, the function could return an arbitrary value, the program could be killed by an operating system exception (which, unlike a C++ expression, cannot be caught with `try-catch`). In short, **don't do it**. If you really need to do this for an extremely good reason (like working around a bug in a library you have absolutely no control over), look into your operating system support for such things (such as [SEH](http://msdn.microsoft.com/en-us/library/ms680657%28VS.85%29.aspx) on Windows).
strlen(NULL) tries to dereference NULL pointer. This raises hardware exception which cannot be caught with try-catch mechanism. Program blows up. You would have the same scenario if you try to perform division by zero. For this reason it is always a good practice to check whether pointers are (not) NULL. If pointer is NULL somewhere where it should not be (and you treat this as an exceptional situation), you can throw software exception from that place. Body of your catch block would have been executed If you had written something like this (before strlen call): ``` if(p2 == NULL) throw 1; ``` You forgot to add endl manipulator in line that prints "mark". It should be: ``` cout << "mark" << endl; ```
2,235,655
I'm working on a blackberry application and would like to use the OpenStreetMap reverse geo-coding to get an address and/or a street corner. I found Nominatim but it doesn't seem to do zip codes in the US (it has UK postal codes though), is there a OpenStreetMap API to get zipcodes, or some other free/open licensed reverse geocoding or address to zipcode data/API **note:** this is for a final school project(but as this is a API/data source question I feel its fair to ask) **note2:** another person has already done a google maps version, I'm looking for something w/ a Creative Commons type license, please don't mention google maps -be careful, I found at least one API that claims to be open but seems to be based around both OSM , google, and other data (ie, it didn't have the rights to give away to its data).
2010/02/10
[ "https://Stackoverflow.com/questions/2235655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259130/" ]
You can reverse-geocode US ZIP codes with [geocoder.us](http://geocoder.us/). [Their geocoder](http://search.cpan.org/~sderle/Geo-Coder-US/) is open source (GPLv2 or Perl Artistic License) and they encourage writing code using their web services API for non-commercial purposes. This is in fact the service [OpenStreetMap.org is using](http://wiki.openstreetmap.org/wiki/Search#US_ZIP_Codes) for US ZIP codes. Also have a look at [this overview of geocoders](https://webgis.usc.edu/Services/Geocode/About/GeocoderList.aspx).
I found an opensource geocoder and have started to work on the autotooling. on extendthereach dot com slash products OpenSourceGeocoder Here is my github, but it is not ready yet: <http://github.com/h4ck3rm1k3/AutoToolsGeocoder> In theory we could use osm data with this, but I will have to look into it more.
2,235,655
I'm working on a blackberry application and would like to use the OpenStreetMap reverse geo-coding to get an address and/or a street corner. I found Nominatim but it doesn't seem to do zip codes in the US (it has UK postal codes though), is there a OpenStreetMap API to get zipcodes, or some other free/open licensed reverse geocoding or address to zipcode data/API **note:** this is for a final school project(but as this is a API/data source question I feel its fair to ask) **note2:** another person has already done a google maps version, I'm looking for something w/ a Creative Commons type license, please don't mention google maps -be careful, I found at least one API that claims to be open but seems to be based around both OSM , google, and other data (ie, it didn't have the rights to give away to its data).
2010/02/10
[ "https://Stackoverflow.com/questions/2235655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259130/" ]
I use [Geonames.org](http://www.geonames.org). It offers different webservices around geocoding. The [Postcode WS](http://www.geonames.org/postal-codes/postal-codes-us.html) will help you: Postcode for Washington, USA: * [Via HTML page](http://www.geonames.org/postalcode-search.html?q=Washington&country=US) * [Via Webservice (XML response)](http://ws.geonames.org/postalCodeSearch?placename=Washington&maxRows=10&country=US) There's a commercial offer but I don't know if the service is totally free. There's a limit of 3000 requests per day and ip.
I found an opensource geocoder and have started to work on the autotooling. on extendthereach dot com slash products OpenSourceGeocoder Here is my github, but it is not ready yet: <http://github.com/h4ck3rm1k3/AutoToolsGeocoder> In theory we could use osm data with this, but I will have to look into it more.
2,235,655
I'm working on a blackberry application and would like to use the OpenStreetMap reverse geo-coding to get an address and/or a street corner. I found Nominatim but it doesn't seem to do zip codes in the US (it has UK postal codes though), is there a OpenStreetMap API to get zipcodes, or some other free/open licensed reverse geocoding or address to zipcode data/API **note:** this is for a final school project(but as this is a API/data source question I feel its fair to ask) **note2:** another person has already done a google maps version, I'm looking for something w/ a Creative Commons type license, please don't mention google maps -be careful, I found at least one API that claims to be open but seems to be based around both OSM , google, and other data (ie, it didn't have the rights to give away to its data).
2010/02/10
[ "https://Stackoverflow.com/questions/2235655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259130/" ]
I use [Geonames.org](http://www.geonames.org). It offers different webservices around geocoding. The [Postcode WS](http://www.geonames.org/postal-codes/postal-codes-us.html) will help you: Postcode for Washington, USA: * [Via HTML page](http://www.geonames.org/postalcode-search.html?q=Washington&country=US) * [Via Webservice (XML response)](http://ws.geonames.org/postalCodeSearch?placename=Washington&maxRows=10&country=US) There's a commercial offer but I don't know if the service is totally free. There's a limit of 3000 requests per day and ip.
You can reverse-geocode US ZIP codes with [geocoder.us](http://geocoder.us/). [Their geocoder](http://search.cpan.org/~sderle/Geo-Coder-US/) is open source (GPLv2 or Perl Artistic License) and they encourage writing code using their web services API for non-commercial purposes. This is in fact the service [OpenStreetMap.org is using](http://wiki.openstreetmap.org/wiki/Search#US_ZIP_Codes) for US ZIP codes. Also have a look at [this overview of geocoders](https://webgis.usc.edu/Services/Geocode/About/GeocoderList.aspx).
15,761,890
Is there a way to only add new files and not add modified files with git? That is, files that are listed as untracked with git status. Other than ofcourse adding each file separately. It's not absolutely necessary to do this in my case, the real question for me is answered here: [How to make git-diff and git log ignore new and deleted files?](https://stackoverflow.com/questions/6894322/how-to-make-git-diff-and-git-log-ignore-new-and-deleted-files) That is, don't show diff on new files, so I'm asking this more because i couldn't find an answer to it anywhere.
2013/04/02
[ "https://Stackoverflow.com/questions/15761890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1053561/" ]
Maybe ``` git add $(git ls-files -o --exclude-standard) ``` `git ls-files` lets you list the files managed by git, filtered by some options. `-o` in this case filters it to only show "others (i.e. untracked files)" The `$(...)` statement passes the return value of that command as an argument to `git add`.
You can use short mode of git status (see [man git-status(1)](https://www.kernel.org/pub/software/scm/git/docs/git-status.html)), which gives the following output: Without short mode: ``` $ git status ... # Untracked files: # (use "git add <file>..." to include in what will be committed) # # README # application/libraries/Membres_exception.php no changes added to commit (use "git add" and/or "git commit -a") ``` With short mode: ``` $ git status -s M application/models/membre_model.php ?? README ?? application/libraries/Membres_exception.php ``` Then using grep, awk and xarg, you can add the files where the first column is `??`. ``` $ git status -s | grep '??' | awk '{ print $2 }' | xargs git add ``` and see that it worked: ``` $ git status # On branch new # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # new file: README # new file: application/libraries/Membres_exception.php ```
3,847
["Camel hair"](http://en.wikipedia.org/wiki/Camel_hair) is, among other things, the hair of a camel. Since we talk about "sheep's wool" or "lamb's wool", why don't we use the "*'s*" after camel in the case above? Perhaps some historical reason might exist, but, as a not native of English language I'm wondering if I have to learn all the cases in reference to any specific animal or if there exists some guidance, if not some rule, helping to understand this problem. For example, if the separation of an animal's part implies its death, can I be sure that the "*'s*" has to be dropped, as in the case of "calf skin"? If this is a real rule, could we extend it to human beings? For example, if one—a doctor, for example—talks about my heart, **after my death**, should s/he say "Carlo's heart" or "Carlo heart"?
2013/03/11
[ "https://ell.stackexchange.com/questions/3847", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
You are assuming a relationship where none exists. This has nothing to do with the animal's death. "Camel hair" is the name given to the textile fiber obtained from a camel. It's as simple as that. They could have come up with another name for that fiber — like *angora* from rabbits, *cashmere* from goats, etc — but they didn't. It's called "camel hair" as in "a camel hair jacket." That doesn't preclude you from using the possessive form for *a camel's hair* (as in "the camel's hair was long and matted). You simply have to know that the material that comes from a camel is commonly called "camel hair." Incidentally, a *sheep's wool* literally refers to the wool of a sheep. You can also get wool from goats (commonly called cashmere or mohair), rabbits (angora)… and, yes, even *camel hair* is a type of wool. Saying *sheep's wool* is simply used to disambiguate it — and there's nothing wrong with referring to the material as "sheep wool".
I'm not aware of a rule about “if the separation of an animal’s part implies its death [then] the “\_’s” is dropped, as in the case of *calf skin*”. If such a rule exists, it is not used consistently. For example, [ngrams](http://books.google.com/ngrams/graph?content=elephant+tusk%2Celephant%27s+tusk&year_start=1800&year_end=2008&corpus=0&smoothing=3&share=) for *elephant tusk,elephant's tusk* shows similar counts (in recent years) for both terms, and the linked book references show similar usage (similar meanings) for both. [Ngrams](http://books.google.com/ngrams/graph?content=cow+horn%2Ccow%27s+horn&year_start=1500&year_end=2008&corpus=15&smoothing=3&share=) for *cow horn,cow's horn* is weighted slightly more in favor of the proposition, but in recent years both terms have been used with similar frequency. Note, elephants are killed for their tusks in most cases, but cow horns are obtained without killing the cow, in most cases. In short, there are many exceptions to the “rule”, and the exceptions go both ways ― ie, *'s* being used for fatally-obtained items, or not being used for nonfatally-obtained items. Regarding “Carlo’s heart” or “Carlo heart”, the latter phrase would not be used to refer to your heart in any way I'm aware of.
3,847
["Camel hair"](http://en.wikipedia.org/wiki/Camel_hair) is, among other things, the hair of a camel. Since we talk about "sheep's wool" or "lamb's wool", why don't we use the "*'s*" after camel in the case above? Perhaps some historical reason might exist, but, as a not native of English language I'm wondering if I have to learn all the cases in reference to any specific animal or if there exists some guidance, if not some rule, helping to understand this problem. For example, if the separation of an animal's part implies its death, can I be sure that the "*'s*" has to be dropped, as in the case of "calf skin"? If this is a real rule, could we extend it to human beings? For example, if one—a doctor, for example—talks about my heart, **after my death**, should s/he say "Carlo's heart" or "Carlo heart"?
2013/03/11
[ "https://ell.stackexchange.com/questions/3847", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
I'm not aware of a rule about “if the separation of an animal’s part implies its death [then] the “\_’s” is dropped, as in the case of *calf skin*”. If such a rule exists, it is not used consistently. For example, [ngrams](http://books.google.com/ngrams/graph?content=elephant+tusk%2Celephant%27s+tusk&year_start=1800&year_end=2008&corpus=0&smoothing=3&share=) for *elephant tusk,elephant's tusk* shows similar counts (in recent years) for both terms, and the linked book references show similar usage (similar meanings) for both. [Ngrams](http://books.google.com/ngrams/graph?content=cow+horn%2Ccow%27s+horn&year_start=1500&year_end=2008&corpus=15&smoothing=3&share=) for *cow horn,cow's horn* is weighted slightly more in favor of the proposition, but in recent years both terms have been used with similar frequency. Note, elephants are killed for their tusks in most cases, but cow horns are obtained without killing the cow, in most cases. In short, there are many exceptions to the “rule”, and the exceptions go both ways ― ie, *'s* being used for fatally-obtained items, or not being used for nonfatally-obtained items. Regarding “Carlo’s heart” or “Carlo heart”, the latter phrase would not be used to refer to your heart in any way I'm aware of.
I think of it this way... > > elephant's tusk > > > is when the tusk is still attached to the elephant. We would assume it's still alive, but not necessarily so. Its a possessive form. > > elephant tusk > > > is the tusk after removal from the elephant. It's a modified noun. Since it has been removed, it's technically dead, regardless of the state of the elephant it came from.
3,847
["Camel hair"](http://en.wikipedia.org/wiki/Camel_hair) is, among other things, the hair of a camel. Since we talk about "sheep's wool" or "lamb's wool", why don't we use the "*'s*" after camel in the case above? Perhaps some historical reason might exist, but, as a not native of English language I'm wondering if I have to learn all the cases in reference to any specific animal or if there exists some guidance, if not some rule, helping to understand this problem. For example, if the separation of an animal's part implies its death, can I be sure that the "*'s*" has to be dropped, as in the case of "calf skin"? If this is a real rule, could we extend it to human beings? For example, if one—a doctor, for example—talks about my heart, **after my death**, should s/he say "Carlo's heart" or "Carlo heart"?
2013/03/11
[ "https://ell.stackexchange.com/questions/3847", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
You are assuming a relationship where none exists. This has nothing to do with the animal's death. "Camel hair" is the name given to the textile fiber obtained from a camel. It's as simple as that. They could have come up with another name for that fiber — like *angora* from rabbits, *cashmere* from goats, etc — but they didn't. It's called "camel hair" as in "a camel hair jacket." That doesn't preclude you from using the possessive form for *a camel's hair* (as in "the camel's hair was long and matted). You simply have to know that the material that comes from a camel is commonly called "camel hair." Incidentally, a *sheep's wool* literally refers to the wool of a sheep. You can also get wool from goats (commonly called cashmere or mohair), rabbits (angora)… and, yes, even *camel hair* is a type of wool. Saying *sheep's wool* is simply used to disambiguate it — and there's nothing wrong with referring to the material as "sheep wool".
I think of it this way... > > elephant's tusk > > > is when the tusk is still attached to the elephant. We would assume it's still alive, but not necessarily so. Its a possessive form. > > elephant tusk > > > is the tusk after removal from the elephant. It's a modified noun. Since it has been removed, it's technically dead, regardless of the state of the elephant it came from.
3,847
["Camel hair"](http://en.wikipedia.org/wiki/Camel_hair) is, among other things, the hair of a camel. Since we talk about "sheep's wool" or "lamb's wool", why don't we use the "*'s*" after camel in the case above? Perhaps some historical reason might exist, but, as a not native of English language I'm wondering if I have to learn all the cases in reference to any specific animal or if there exists some guidance, if not some rule, helping to understand this problem. For example, if the separation of an animal's part implies its death, can I be sure that the "*'s*" has to be dropped, as in the case of "calf skin"? If this is a real rule, could we extend it to human beings? For example, if one—a doctor, for example—talks about my heart, **after my death**, should s/he say "Carlo's heart" or "Carlo heart"?
2013/03/11
[ "https://ell.stackexchange.com/questions/3847", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
You are assuming a relationship where none exists. This has nothing to do with the animal's death. "Camel hair" is the name given to the textile fiber obtained from a camel. It's as simple as that. They could have come up with another name for that fiber — like *angora* from rabbits, *cashmere* from goats, etc — but they didn't. It's called "camel hair" as in "a camel hair jacket." That doesn't preclude you from using the possessive form for *a camel's hair* (as in "the camel's hair was long and matted). You simply have to know that the material that comes from a camel is commonly called "camel hair." Incidentally, a *sheep's wool* literally refers to the wool of a sheep. You can also get wool from goats (commonly called cashmere or mohair), rabbits (angora)… and, yes, even *camel hair* is a type of wool. Saying *sheep's wool* is simply used to disambiguate it — and there's nothing wrong with referring to the material as "sheep wool".
No. In the case where the 's is dropped, we are referring to the animal in it's mass noun form as an adjective of the object, for example: > > Before it was made illegal, piano keys were often made out of elephant tusks. > > > In this case, **elephant** is an adjective to **tusks** meaning that the tusk in order to distinguish it from any other particular type of tusk, such as a **walrus tusk**. When the 's is employed, we are referring to the tusk in the possessive sense, for example: > > We went to see Nelly the elephant at the zoo. We were very impressed at the size of the elephant's tusks. > > > In this case, **elephant's tusks** is merely the tusks *belonging to* the elephant - in this case Nelly the elephant at the zoo. Note that this is in no way related to the death or otherwise of the subject: > > When we went to the zoo we were impressed by **Nelly's tusks**. > > > In the classroom we learned that **elephant tusk** is a very durable material. > > > Later we learnt that one of Nelly's relatives called Joey the elephant had been killed for his **elephant tusks**. > > > The poacher had been captured and the **elephant's tusks** were on display. > > >
3,847
["Camel hair"](http://en.wikipedia.org/wiki/Camel_hair) is, among other things, the hair of a camel. Since we talk about "sheep's wool" or "lamb's wool", why don't we use the "*'s*" after camel in the case above? Perhaps some historical reason might exist, but, as a not native of English language I'm wondering if I have to learn all the cases in reference to any specific animal or if there exists some guidance, if not some rule, helping to understand this problem. For example, if the separation of an animal's part implies its death, can I be sure that the "*'s*" has to be dropped, as in the case of "calf skin"? If this is a real rule, could we extend it to human beings? For example, if one—a doctor, for example—talks about my heart, **after my death**, should s/he say "Carlo's heart" or "Carlo heart"?
2013/03/11
[ "https://ell.stackexchange.com/questions/3847", "https://ell.stackexchange.com", "https://ell.stackexchange.com/users/-1/" ]
No. In the case where the 's is dropped, we are referring to the animal in it's mass noun form as an adjective of the object, for example: > > Before it was made illegal, piano keys were often made out of elephant tusks. > > > In this case, **elephant** is an adjective to **tusks** meaning that the tusk in order to distinguish it from any other particular type of tusk, such as a **walrus tusk**. When the 's is employed, we are referring to the tusk in the possessive sense, for example: > > We went to see Nelly the elephant at the zoo. We were very impressed at the size of the elephant's tusks. > > > In this case, **elephant's tusks** is merely the tusks *belonging to* the elephant - in this case Nelly the elephant at the zoo. Note that this is in no way related to the death or otherwise of the subject: > > When we went to the zoo we were impressed by **Nelly's tusks**. > > > In the classroom we learned that **elephant tusk** is a very durable material. > > > Later we learnt that one of Nelly's relatives called Joey the elephant had been killed for his **elephant tusks**. > > > The poacher had been captured and the **elephant's tusks** were on display. > > >
I think of it this way... > > elephant's tusk > > > is when the tusk is still attached to the elephant. We would assume it's still alive, but not necessarily so. Its a possessive form. > > elephant tusk > > > is the tusk after removal from the elephant. It's a modified noun. Since it has been removed, it's technically dead, regardless of the state of the elephant it came from.
63,351
Is it possible to test a Hybrid Remote app in a web browser? The documentation makes it seems as though I simply need to replace 'cordova.js' with 'mockcordova.js' and add 'mocksmartstore.js'. However when I try that, cordova's "DeviceReady" function does not get triggered and none of app's functionality works. Anyone have details on how to get a Hybrid (Remote) app running in the browser? \*Mock files were pulled from the sample projects (<https://github.com/forcedotcom/SalesforceMobileSDK-Shared/tree/master/samples/simplesyncreact/js>)
2015/01/14
[ "https://salesforce.stackexchange.com/questions/63351", "https://salesforce.stackexchange.com", "https://salesforce.stackexchange.com/users/15112/" ]
This is very similar to the question I answered [here](https://salesforce.stackexchange.com/questions/34898/why-does-the-mobile-sdk-ask-for-login-in-emulator-but-not-on-desktop/34907#34907). If you are using Angular.js for your hybrid app, use forceng.js - it is very similar to forcetk.js (without jQuery) and is compatible with Mobile SDK.
I was able to get browser testing working for the hybrid remote app, which uses Visual Force Remoting, by also including a few other JS files (not just mocksmartstore and mockcordova). The JS files are loaded like this: $Resource.underscore $Resource.mockcordova $Resource.cordova\_force $Resource.mocksmartstore $Resource.MY\_APP\_JS\_FILE MockCordova and MockSmartStore are available here: github.com/forcedotcom/SalesforceMobileSDK-Shared/tree/master/test Underscore: <https://github.com/forcedotcom/SalesforceMobileSDK-Shared/blob/master/dependencies/underscore/underscore-min.js> Corova Force: <https://github.com/forcedotcom/SalesforceMobileSDK-Shared/blob/master/libs/cordova.force.js>
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
Boost filesystem is one of the Boost library that have some ABI problem relative to function signature change due to C++0x or C++11. cf Boost ticket : <https://svn.boost.org/trac/boost/ticket/6779> You have three solutions: 1. Inhibit C++11 scoped enums in concerned Boost header files included in your programs with #include (cf <http://www.ridgesolutions.ie/index.php/2013/05/30/boost-link-error-undefined-reference-to-boostfilesystemdetailcopy_file/>): ``` #define BOOST_NO_CXX11_SCOPED_ENUMS #include <boost/filesystem.hpp> #undef BOOST_NO_CXX11_SCOPED_ENUMS ``` But this solution is not a complete one and I read it does not work for everybody. 2. Build BOOST with the C++11 option (the same options you use for your application): <http://hnrkptrsn.github.io/2013/02/26/c11-and-boost-setup-guide> I read also it does not work for everybody. 3. Set up a cross compiler dedicated to your application where you rebuild all the libraries you need in a dedicated environment. That ensures coherence plus stability plus more maintainability, and is certainly the solution to recommend. I have not read if it has been tested - probably yes, and probably it works. Anyway, cross compiling is well mastered now in computer science. You will find many good tutorials and support for it. In Linux Gentoo, they have the marvelous sys-devel/crossdev package that makes it very easy. In my own case, solution 1 has solved the problem. As soon as I encounter another one, I will switch to solution 3. So, I have not yet tested it.
For some boost modules, you have to compile libraries **and** link them (using bootstrap.sh). In your case, you have to compile and link `Filesystem`, and probalbly `System` too Have a look [here](http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html) **For example:** * ./bootstrap.sh (bjam) * rm -rf bin.v2 stage (between 2 bjam commands) * ./bjam release toolset=gcc address-model=64 cxxflags=-fPIC * ./bjam debug toolset=gcc address-model=64 cxxflags=-fPIC If you are linking on Windows, you don't have to manually link your libraries, since they are automatically linked using pragma. On Linux, you have to do it. According to documentation, these modules need you to acquire or build a library : * Boost.Filesystem * Boost.GraphParallel * Boost.IOStreams * Boost.MPI * Boost.ProgramOptions * Boost.Python * Boost.Regex * Boost.Serialization * Boost.Signals * Boost.System * Boost.Thread * Boost.Wave
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
You need to add libboost\_filesystem library when linking. Or libboost\_filesystem-mt if your application is multi-threaded. Like this: ``` g++ -o file -lboost_filesystem-mt source_file.cpp ```
For some boost modules, you have to compile libraries **and** link them (using bootstrap.sh). In your case, you have to compile and link `Filesystem`, and probalbly `System` too Have a look [here](http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html) **For example:** * ./bootstrap.sh (bjam) * rm -rf bin.v2 stage (between 2 bjam commands) * ./bjam release toolset=gcc address-model=64 cxxflags=-fPIC * ./bjam debug toolset=gcc address-model=64 cxxflags=-fPIC If you are linking on Windows, you don't have to manually link your libraries, since they are automatically linked using pragma. On Linux, you have to do it. According to documentation, these modules need you to acquire or build a library : * Boost.Filesystem * Boost.GraphParallel * Boost.IOStreams * Boost.MPI * Boost.ProgramOptions * Boost.Python * Boost.Regex * Boost.Serialization * Boost.Signals * Boost.System * Boost.Thread * Boost.Wave
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
The solution that worked for me is to compile with "-c" and then create the executable like this: ``` g++ -c -o main.o main.cpp g++ -o my_prog main.o -lboost_system -lboost_filesystem ```
For some boost modules, you have to compile libraries **and** link them (using bootstrap.sh). In your case, you have to compile and link `Filesystem`, and probalbly `System` too Have a look [here](http://www.boost.org/doc/libs/1_53_0/more/getting_started/unix-variants.html) **For example:** * ./bootstrap.sh (bjam) * rm -rf bin.v2 stage (between 2 bjam commands) * ./bjam release toolset=gcc address-model=64 cxxflags=-fPIC * ./bjam debug toolset=gcc address-model=64 cxxflags=-fPIC If you are linking on Windows, you don't have to manually link your libraries, since they are automatically linked using pragma. On Linux, you have to do it. According to documentation, these modules need you to acquire or build a library : * Boost.Filesystem * Boost.GraphParallel * Boost.IOStreams * Boost.MPI * Boost.ProgramOptions * Boost.Python * Boost.Regex * Boost.Serialization * Boost.Signals * Boost.System * Boost.Thread * Boost.Wave
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
Boost filesystem is one of the Boost library that have some ABI problem relative to function signature change due to C++0x or C++11. cf Boost ticket : <https://svn.boost.org/trac/boost/ticket/6779> You have three solutions: 1. Inhibit C++11 scoped enums in concerned Boost header files included in your programs with #include (cf <http://www.ridgesolutions.ie/index.php/2013/05/30/boost-link-error-undefined-reference-to-boostfilesystemdetailcopy_file/>): ``` #define BOOST_NO_CXX11_SCOPED_ENUMS #include <boost/filesystem.hpp> #undef BOOST_NO_CXX11_SCOPED_ENUMS ``` But this solution is not a complete one and I read it does not work for everybody. 2. Build BOOST with the C++11 option (the same options you use for your application): <http://hnrkptrsn.github.io/2013/02/26/c11-and-boost-setup-guide> I read also it does not work for everybody. 3. Set up a cross compiler dedicated to your application where you rebuild all the libraries you need in a dedicated environment. That ensures coherence plus stability plus more maintainability, and is certainly the solution to recommend. I have not read if it has been tested - probably yes, and probably it works. Anyway, cross compiling is well mastered now in computer science. You will find many good tutorials and support for it. In Linux Gentoo, they have the marvelous sys-devel/crossdev package that makes it very easy. In my own case, solution 1 has solved the problem. As soon as I encounter another one, I will switch to solution 3. So, I have not yet tested it.
You need to add libboost\_filesystem library when linking. Or libboost\_filesystem-mt if your application is multi-threaded. Like this: ``` g++ -o file -lboost_filesystem-mt source_file.cpp ```
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
Boost filesystem is one of the Boost library that have some ABI problem relative to function signature change due to C++0x or C++11. cf Boost ticket : <https://svn.boost.org/trac/boost/ticket/6779> You have three solutions: 1. Inhibit C++11 scoped enums in concerned Boost header files included in your programs with #include (cf <http://www.ridgesolutions.ie/index.php/2013/05/30/boost-link-error-undefined-reference-to-boostfilesystemdetailcopy_file/>): ``` #define BOOST_NO_CXX11_SCOPED_ENUMS #include <boost/filesystem.hpp> #undef BOOST_NO_CXX11_SCOPED_ENUMS ``` But this solution is not a complete one and I read it does not work for everybody. 2. Build BOOST with the C++11 option (the same options you use for your application): <http://hnrkptrsn.github.io/2013/02/26/c11-and-boost-setup-guide> I read also it does not work for everybody. 3. Set up a cross compiler dedicated to your application where you rebuild all the libraries you need in a dedicated environment. That ensures coherence plus stability plus more maintainability, and is certainly the solution to recommend. I have not read if it has been tested - probably yes, and probably it works. Anyway, cross compiling is well mastered now in computer science. You will find many good tutorials and support for it. In Linux Gentoo, they have the marvelous sys-devel/crossdev package that makes it very easy. In my own case, solution 1 has solved the problem. As soon as I encounter another one, I will switch to solution 3. So, I have not yet tested it.
You need to add the following libraries: ``` g++ -o file -lboost_system -lboost_filesystem sourcefile.cpp ``` If you use a Makefile: ``` CC=gcc CXX=g++ PROG = program CXXFLAGS := -std=c++1y -g -Wall LDFLAGS = -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu LIBS= -lboost_system -lboost_filesystem SRCS= main.cpp OBJS=$(subst .cpp,.o,$(SRCS)) all: $(OBJS) $(CXX) $(CXXFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(LDFLAGS) ```
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
Boost filesystem is one of the Boost library that have some ABI problem relative to function signature change due to C++0x or C++11. cf Boost ticket : <https://svn.boost.org/trac/boost/ticket/6779> You have three solutions: 1. Inhibit C++11 scoped enums in concerned Boost header files included in your programs with #include (cf <http://www.ridgesolutions.ie/index.php/2013/05/30/boost-link-error-undefined-reference-to-boostfilesystemdetailcopy_file/>): ``` #define BOOST_NO_CXX11_SCOPED_ENUMS #include <boost/filesystem.hpp> #undef BOOST_NO_CXX11_SCOPED_ENUMS ``` But this solution is not a complete one and I read it does not work for everybody. 2. Build BOOST with the C++11 option (the same options you use for your application): <http://hnrkptrsn.github.io/2013/02/26/c11-and-boost-setup-guide> I read also it does not work for everybody. 3. Set up a cross compiler dedicated to your application where you rebuild all the libraries you need in a dedicated environment. That ensures coherence plus stability plus more maintainability, and is certainly the solution to recommend. I have not read if it has been tested - probably yes, and probably it works. Anyway, cross compiling is well mastered now in computer science. You will find many good tutorials and support for it. In Linux Gentoo, they have the marvelous sys-devel/crossdev package that makes it very easy. In my own case, solution 1 has solved the problem. As soon as I encounter another one, I will switch to solution 3. So, I have not yet tested it.
The solution that worked for me is to compile with "-c" and then create the executable like this: ``` g++ -c -o main.o main.cpp g++ -o my_prog main.o -lboost_system -lboost_filesystem ```
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
You need to add libboost\_filesystem library when linking. Or libboost\_filesystem-mt if your application is multi-threaded. Like this: ``` g++ -o file -lboost_filesystem-mt source_file.cpp ```
You need to add the following libraries: ``` g++ -o file -lboost_system -lboost_filesystem sourcefile.cpp ``` If you use a Makefile: ``` CC=gcc CXX=g++ PROG = program CXXFLAGS := -std=c++1y -g -Wall LDFLAGS = -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu LIBS= -lboost_system -lboost_filesystem SRCS= main.cpp OBJS=$(subst .cpp,.o,$(SRCS)) all: $(OBJS) $(CXX) $(CXXFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(LDFLAGS) ```
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
You need to add libboost\_filesystem library when linking. Or libboost\_filesystem-mt if your application is multi-threaded. Like this: ``` g++ -o file -lboost_filesystem-mt source_file.cpp ```
The solution that worked for me is to compile with "-c" and then create the executable like this: ``` g++ -c -o main.o main.cpp g++ -o my_prog main.o -lboost_system -lboost_filesystem ```
15,634,114
I'm trying to run program, using sample code of boost::filesystem on Ubuntu 12.10, but it doesn't want to build. ``` #include <iostream> #include <boost/filesystem.hpp> using namespace boost::filesystem; using namespace std; void fun(const string& dirPath); int main() { fun("/home"); return 0; } void fun(const string& dirPath) { path p (dirPath); if (exists(p)) { if (is_regular_file(p)) cout << p << " size is " << file_size(p) << '\n'; else if (is_directory(p)) cout << p << "is a directory\n"; else cout << p << "exists, but is neither a regular file nor a directory\n"; } else cout << p << "does not exist\n"; } ``` And CMake code: ``` project(tttest) cmake_minimum_required(VERSION 2.8) aux_source_directory(. SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) FIND_PACKAGE(Boost 1.53 COMPONENTS filesystem system REQUIRED) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES}) ``` Unfortunately it generates errors ``` CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::exists(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem6existsERKNS0_4pathE[_ZN5boost10filesystem6existsERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_directory(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem12is_directoryERKNS0_4pathE[_ZN5boost10filesystem12is_directoryERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::is_regular_file(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem15is_regular_fileERKNS0_4pathE[_ZN5boost10filesystem15is_regular_fileERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)' CMakeFiles/tttest.dir/main.cpp.o: In function `boost::filesystem::file_size(boost::filesystem::path const&)': main.cpp:(.text._ZN5boost10filesystem9file_sizeERKNS0_4pathE[_ZN5boost10filesystem9file_sizeERKNS0_4pathE]+0x19): undefined reference to `boost::filesystem::detail::file_size(boost::filesystem::path const&, boost::system::error_code*)' collect2: error: ld returned 1 exit status ``` What is the reason of this problem and how to solve it?
2013/03/26
[ "https://Stackoverflow.com/questions/15634114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/903649/" ]
The solution that worked for me is to compile with "-c" and then create the executable like this: ``` g++ -c -o main.o main.cpp g++ -o my_prog main.o -lboost_system -lboost_filesystem ```
You need to add the following libraries: ``` g++ -o file -lboost_system -lboost_filesystem sourcefile.cpp ``` If you use a Makefile: ``` CC=gcc CXX=g++ PROG = program CXXFLAGS := -std=c++1y -g -Wall LDFLAGS = -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu LIBS= -lboost_system -lboost_filesystem SRCS= main.cpp OBJS=$(subst .cpp,.o,$(SRCS)) all: $(OBJS) $(CXX) $(CXXFLAGS) -o $(PROG) $(OBJS) $(LIBS) $(LDFLAGS) ```
54,748,217
I have a table with more than 100 columns c1,c2,c3....c200 and I want to apply function (assume MAX) on all columns. I can compose my query for each column, but I cannot use \* for which BigQuery throws this error `Argument * can only be used in COUNT(*)` This Query format works but my query size will be much bigger and it is proportional to number of columns. ``` SELECT max(c1) as c1, max(c2) as c2 .... max(c200) as c200 FROM `MYTABLE` group by user ``` Can I write query in a shorter form ?
2019/02/18
[ "https://Stackoverflow.com/questions/54748217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3879625/" ]
Below example is for BigQuery Standard SQL and avoids to call out all columns by names but as a side-effect result is just one comma separated list of max values in order of respective columns ``` #standardSQL SELECT STRING_AGG(CAST(max_val AS STRING) ORDER BY pos) max_values FROM ( SELECT pos, MAX(CAST(val AS INT64)) max_val FROM `project.dataset.table` t, UNNEST(REGEXP_EXTRACT_ALL(TO_JSON_STRING(t), r'".+?":([^,}]+)')) val WITH OFFSET pos GROUP BY pos ) ``` In above example I assume columns are all of INT64 datatype You can test, play with above using dummy data as in below example ``` #standardSQL WITH `project.dataset.table` AS ( SELECT 1 c1, 2 c2, 3 c3 UNION ALL SELECT 11, 1, 22 ) SELECT STRING_AGG(CAST(max_val AS STRING) ORDER BY pos) max_values FROM ( SELECT pos, MAX(CAST(val AS INT64)) max_val FROM `project.dataset.table` t, UNNEST(REGEXP_EXTRACT_ALL(TO_JSON_STRING(t), r'".+?":([^,}]+)')) val WITH OFFSET pos GROUP BY pos ) ``` with result ``` Row max_values 1 11,2,22 ```
You are passing a data set as parameter for your function, does your function accept a data set as its input parameter? If not, you get the error of course. You can try like this: ``` select (select max(c1) from mytable) max_c1, (select max(c2) from mytable) max_c2 from dual ```
54,748,217
I have a table with more than 100 columns c1,c2,c3....c200 and I want to apply function (assume MAX) on all columns. I can compose my query for each column, but I cannot use \* for which BigQuery throws this error `Argument * can only be used in COUNT(*)` This Query format works but my query size will be much bigger and it is proportional to number of columns. ``` SELECT max(c1) as c1, max(c2) as c2 .... max(c200) as c200 FROM `MYTABLE` group by user ``` Can I write query in a shorter form ?
2019/02/18
[ "https://Stackoverflow.com/questions/54748217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3879625/" ]
You are passing a data set as parameter for your function, does your function accept a data set as its input parameter? If not, you get the error of course. You can try like this: ``` select (select max(c1) from mytable) max_c1, (select max(c2) from mytable) max_c2 from dual ```
Once you harness the power of dynamically query generation, you will love Bigquery even more: You can literally create the sql first by another wrapper sql like this: ``` select concat("select ", string_agg(selected_columns), " from `{YOUR_TABLE_NAME}`") from (select concat("max(", column_name, ") as ", column_name) as selected_columns from (select 'column_prefix'|| num as column_name from (select generate_array(1, 200) as num_column) as a, unnest (num_column) as num)) ``` Below is the sql that will get generated from above that you want to run as per your ask: ``` select max(column_prefix1) as column_prefix1,max(column_prefix2) as column_prefix2,max(column_prefix3) as column_prefix3,max(column_prefix4) as column_prefix4,max(column_prefix5) as column_prefix5,max(column_prefix6) as column_prefix6,...,max(column_prefix200) as column_prefix200 from `{YOUR_TABLE_NAME}` ``` Now you can copy paste above sql and get your results. (This assumes your column numbers are without any gaps)
54,748,217
I have a table with more than 100 columns c1,c2,c3....c200 and I want to apply function (assume MAX) on all columns. I can compose my query for each column, but I cannot use \* for which BigQuery throws this error `Argument * can only be used in COUNT(*)` This Query format works but my query size will be much bigger and it is proportional to number of columns. ``` SELECT max(c1) as c1, max(c2) as c2 .... max(c200) as c200 FROM `MYTABLE` group by user ``` Can I write query in a shorter form ?
2019/02/18
[ "https://Stackoverflow.com/questions/54748217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3879625/" ]
Below example is for BigQuery Standard SQL and avoids to call out all columns by names but as a side-effect result is just one comma separated list of max values in order of respective columns ``` #standardSQL SELECT STRING_AGG(CAST(max_val AS STRING) ORDER BY pos) max_values FROM ( SELECT pos, MAX(CAST(val AS INT64)) max_val FROM `project.dataset.table` t, UNNEST(REGEXP_EXTRACT_ALL(TO_JSON_STRING(t), r'".+?":([^,}]+)')) val WITH OFFSET pos GROUP BY pos ) ``` In above example I assume columns are all of INT64 datatype You can test, play with above using dummy data as in below example ``` #standardSQL WITH `project.dataset.table` AS ( SELECT 1 c1, 2 c2, 3 c3 UNION ALL SELECT 11, 1, 22 ) SELECT STRING_AGG(CAST(max_val AS STRING) ORDER BY pos) max_values FROM ( SELECT pos, MAX(CAST(val AS INT64)) max_val FROM `project.dataset.table` t, UNNEST(REGEXP_EXTRACT_ALL(TO_JSON_STRING(t), r'".+?":([^,}]+)')) val WITH OFFSET pos GROUP BY pos ) ``` with result ``` Row max_values 1 11,2,22 ```
Once you harness the power of dynamically query generation, you will love Bigquery even more: You can literally create the sql first by another wrapper sql like this: ``` select concat("select ", string_agg(selected_columns), " from `{YOUR_TABLE_NAME}`") from (select concat("max(", column_name, ") as ", column_name) as selected_columns from (select 'column_prefix'|| num as column_name from (select generate_array(1, 200) as num_column) as a, unnest (num_column) as num)) ``` Below is the sql that will get generated from above that you want to run as per your ask: ``` select max(column_prefix1) as column_prefix1,max(column_prefix2) as column_prefix2,max(column_prefix3) as column_prefix3,max(column_prefix4) as column_prefix4,max(column_prefix5) as column_prefix5,max(column_prefix6) as column_prefix6,...,max(column_prefix200) as column_prefix200 from `{YOUR_TABLE_NAME}` ``` Now you can copy paste above sql and get your results. (This assumes your column numbers are without any gaps)
6,102,144
We have an ExtJS Grid Panel that has grown to include too many columns (imo), so I am looking into enfolding some data into "sub-rows" of the main row. Like: Data1 | Data2 | Data3 | Data4 | Data5   Some additional data that spans Data1 | Data2 | Data3 | Data4 | Data5   Some additional data that spans I am aware of the `expander` plugin, but we wouldn't need the expand/collapse functionality and always need the sub-rows open. Any thoughts or ideas? Thanks in advance.
2011/05/23
[ "https://Stackoverflow.com/questions/6102144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/643779/" ]
If you're using ExtJS-4, ``` // ... var rowBodyFeature = Ext.create('Ext.grid.feature.RowBody', { getAdditionalData: function(data, rowIndex, record, orig) { var headerCt = this.view.headerCt, colspan = headerCt.getColumnCount(); return { rowBody: "HELLO WORLD!", // do something with record rowBodyCls: this.rowBodyCls, rowBodyColspan: colspan }; } }); Ext.create('Ext.grid.Panel', { // ... features: [rowBodyFeature] // ... }); ``` If using ExtJS-3, try: ``` new Ext.grid.GridPanel({ //... viewConfig: { enableRowBody: true, getRowClass: function(record, rowIndex, p, store) { p.body = 'HELLOW WORLD: ' + record.get('attribute'); return 'x-grid3-row-expanded'; } } ```
What you need to do is implement a nested grid using the expander plugin. On the click or expand event, you can use your row's ID as a key to load the sub-rows.
333
When showing a fellow Stack Exchange regular our site, I got the complaint that most questions were in the form of an anecdote, eventually followed by the real question. They said this had a bad connotation due to their experiences on Programmers where this is a common sign of a bad question. Is it the sign of a bad question here? To what extent should we discourage/edit away anecdotal details in questions? Generally I'd rather askers stray to the side of offering too *much* information rather than too little; it's easy to edit out excessive details and often impossible to assume missing ones. But how much is too much? How personal is too personal?
2012/07/13
[ "https://workplace.meta.stackexchange.com/questions/333", "https://workplace.meta.stackexchange.com", "https://workplace.meta.stackexchange.com/users/42/" ]
Yes, some questions are too anecdote-y, but I don't think that anecdotes directly correlate to bad questions. Given the nature of this site, and the desire to answer "practical, answerable questions based on actual problems that [users] face", the questions almost *must* include anecdotes to set the stage for the real question. However, plenty of work is still left to be done to ensure that users are structuring questions in such a way that the anecdote supports the question rather than buries it. By "plenty of work" I mean "show good models" -- either by suggesting edits, editing the question directly, or otherwise talking about the issue here. I try to do this when I see a good question buried in a too-localized anecdote -- I edit it to highlight the question and call out the supporting anecdote via formatting, or sometimes the edits are more significant. But I don't do it consistently (I'd never get any work done, if I did!), unfortunately, and that's not helpful because it doesn't show consistent models. It *is* easy to edit out extraneous details, but I don't think we can draw any sort of hard line about what is too much, because like a lot of things at The Workplace (for good or for bad), *it depends*. I don't think we're headed down the same road as early ProgSE, for no other reason than all three of us -- and many of our users -- know what that road was and want to avoid it.
Questions here pertain to a real-life situation, in which there is no real good 'blanket'/'cookie cutter' answer. Instead, answers here tend to be more of a situational thing. Thus, the added backstory and context helps to focus answers down to something that will be truly helpful. Example: asking 'what should i put on my resume?' would be frowned on here, while a question saying: > > "I'm currently working towards my [insert level of degree here] in [insert program here] and am looking for some advice. Here's a bunch of things i've done/accomplished, and a bunch of certifications/awards i've received, as well as some overviews regarding my previous work history. If i want to make the best impression to a [insert company type here] company, what would be the best format/ordering/content to include for my resume, and what items (if any) should i include in my cover letter instead?" > > > obviously, there'd be alot more text in the 'list' parts, but from that question, knowing what exactly there is to work with, we could give a much better answer (for [position] at a [company] company, you'd want to focus more on your achievements and work experience in related field...etc etc)
333
When showing a fellow Stack Exchange regular our site, I got the complaint that most questions were in the form of an anecdote, eventually followed by the real question. They said this had a bad connotation due to their experiences on Programmers where this is a common sign of a bad question. Is it the sign of a bad question here? To what extent should we discourage/edit away anecdotal details in questions? Generally I'd rather askers stray to the side of offering too *much* information rather than too little; it's easy to edit out excessive details and often impossible to assume missing ones. But how much is too much? How personal is too personal?
2012/07/13
[ "https://workplace.meta.stackexchange.com/questions/333", "https://workplace.meta.stackexchange.com", "https://workplace.meta.stackexchange.com/users/42/" ]
Yes, some questions are too anecdote-y, but I don't think that anecdotes directly correlate to bad questions. Given the nature of this site, and the desire to answer "practical, answerable questions based on actual problems that [users] face", the questions almost *must* include anecdotes to set the stage for the real question. However, plenty of work is still left to be done to ensure that users are structuring questions in such a way that the anecdote supports the question rather than buries it. By "plenty of work" I mean "show good models" -- either by suggesting edits, editing the question directly, or otherwise talking about the issue here. I try to do this when I see a good question buried in a too-localized anecdote -- I edit it to highlight the question and call out the supporting anecdote via formatting, or sometimes the edits are more significant. But I don't do it consistently (I'd never get any work done, if I did!), unfortunately, and that's not helpful because it doesn't show consistent models. It *is* easy to edit out extraneous details, but I don't think we can draw any sort of hard line about what is too much, because like a lot of things at The Workplace (for good or for bad), *it depends*. I don't think we're headed down the same road as early ProgSE, for no other reason than all three of us -- and many of our users -- know what that road was and want to avoid it.
This SE was originally created to answer a lot of the "Good" questions on programmer that were off topic there. Specifically the career and workplace problems. We want to deal with real world problems not hypothetical problems. I do not think an anecdote (that is good summary of the issue) is bad in a question. We are not dear Abby, but we are not a class room either. We are trying to deal with real world issues in a timely fashion. In this the context is important, and including an anecdote is not out of line.
55,686,826
I want to find contours on the image below (white bubbles). The problem is that when I convert the image to gray with the standard way: ``` gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) ``` I do not see them (second image). Is it possible to change the conversion some how? Thank you for any help [![enter image description here](https://i.stack.imgur.com/WNrrP.png)](https://i.stack.imgur.com/WNrrP.png) [![enter image description here](https://i.stack.imgur.com/f7Zvy.png)](https://i.stack.imgur.com/f7Zvy.png)
2019/04/15
[ "https://Stackoverflow.com/questions/55686826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7332041/" ]
``` import cv2 img = cv2.imread("WNrrP.png") img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.imshow("h",img) cv2.waitKey() ``` This works correctly for me
Works perfectly fine for me. Please insure that visualisation code is correct. Here is a screenshot of the my code which I ran to test your images. [Screenshot of code.](https://i.stack.imgur.com/mKCMj.png)
55,686,826
I want to find contours on the image below (white bubbles). The problem is that when I convert the image to gray with the standard way: ``` gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) ``` I do not see them (second image). Is it possible to change the conversion some how? Thank you for any help [![enter image description here](https://i.stack.imgur.com/WNrrP.png)](https://i.stack.imgur.com/WNrrP.png) [![enter image description here](https://i.stack.imgur.com/f7Zvy.png)](https://i.stack.imgur.com/f7Zvy.png)
2019/04/15
[ "https://Stackoverflow.com/questions/55686826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7332041/" ]
``` import cv2 img = cv2.imread("WNrrP.png") img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.imshow("h",img) cv2.waitKey() ``` This works correctly for me
the problem was in the different line before. The cvtColor works fine
54,374,825
I am trying to load a dataset of images into tensorflow but I am facing a problem to load it properly. Actually, I have a folder named PetImages in C drive which contains two folders with the name of cat and dog. Each folder holds more **12450** images so in total it is **24500** plus images. I am loading them with the following code: ``` import numpy as np import matplotlib.pyplot as plt import os import cv2 DATADIR = "C:\Datasets\PetImages" CATEGORIES = ["Dog","Cat"] for the category in CATEGORIES: path = os.path.join(DATADIR, category) for img in os.listdir(path): img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) plt.imshow(img_array, cmap="gray") plt.show() break break ``` The result of code looks absolutely fine and it shows the first image of the folder. Then I am converting the shape of the whole array into desired pixel rate with following code: ``` IMG_SIZE=50 new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) plt.imshow(new_array, cmap = "gray") plt.show() ``` This part is also fine but then I want to mix(shuffle) the images so that I can puzzle the system and check the accuracy in this way but problem is the it only shows **12450** images resut after this code: ``` training_data = [] def create_training_data(): for category in CATEGORIES: path = os.path.join(DATADIR, category) class_num = CATEGORIES.index(category) for img in os.listdir(path): try: img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) training_data.append([new_array, class_num]) except Exception as e: pass create_training_data() print(len(training_data) ``` Then using the random I am not getting the success to shuffle images from both folders, its only shows the values of one folder. ``` import random random.shuffle(training_data) for the sample in training_data[:10]: print(sample[1]) ``` But my result is 1 1 1 1 1 instead of randomly generated like 0 1 0 1 0 0 0 1 1 this style I mean unpredicted the next will be **1** or **0**. Your help will be valuable to me. Thanks in advance
2019/01/26
[ "https://Stackoverflow.com/questions/54374825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302957/" ]
Looks to me like an indentation error. Your second `for` loop lies outside of your first `for` loop, which causes the first loop to terminate completely and set class\_num to 1 before the second loop is ever entered. You probably want to nest them. Try: ``` def create_training_data(): for category in CATEGORIES: path = os.path.join(DATADIR, category) class_num = CATEGORIES.index(category) for img in os.listdir(path): try: img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) training_data.append([new_array, class_num]) except Exception as e: pass create_training_data() print(len(training_data) ```
You can try to shuffle a mask or index of the training data ``` import random index=[k for k in range(len(training_data))] shuffIndex=random.shuffle(index) shuffTrainigData=[training_data[val] for val in shuffIndex] ``` Hope it helps
54,374,825
I am trying to load a dataset of images into tensorflow but I am facing a problem to load it properly. Actually, I have a folder named PetImages in C drive which contains two folders with the name of cat and dog. Each folder holds more **12450** images so in total it is **24500** plus images. I am loading them with the following code: ``` import numpy as np import matplotlib.pyplot as plt import os import cv2 DATADIR = "C:\Datasets\PetImages" CATEGORIES = ["Dog","Cat"] for the category in CATEGORIES: path = os.path.join(DATADIR, category) for img in os.listdir(path): img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) plt.imshow(img_array, cmap="gray") plt.show() break break ``` The result of code looks absolutely fine and it shows the first image of the folder. Then I am converting the shape of the whole array into desired pixel rate with following code: ``` IMG_SIZE=50 new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) plt.imshow(new_array, cmap = "gray") plt.show() ``` This part is also fine but then I want to mix(shuffle) the images so that I can puzzle the system and check the accuracy in this way but problem is the it only shows **12450** images resut after this code: ``` training_data = [] def create_training_data(): for category in CATEGORIES: path = os.path.join(DATADIR, category) class_num = CATEGORIES.index(category) for img in os.listdir(path): try: img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) training_data.append([new_array, class_num]) except Exception as e: pass create_training_data() print(len(training_data) ``` Then using the random I am not getting the success to shuffle images from both folders, its only shows the values of one folder. ``` import random random.shuffle(training_data) for the sample in training_data[:10]: print(sample[1]) ``` But my result is 1 1 1 1 1 instead of randomly generated like 0 1 0 1 0 0 0 1 1 this style I mean unpredicted the next will be **1** or **0**. Your help will be valuable to me. Thanks in advance
2019/01/26
[ "https://Stackoverflow.com/questions/54374825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302957/" ]
Looks to me like an indentation error. Your second `for` loop lies outside of your first `for` loop, which causes the first loop to terminate completely and set class\_num to 1 before the second loop is ever entered. You probably want to nest them. Try: ``` def create_training_data(): for category in CATEGORIES: path = os.path.join(DATADIR, category) class_num = CATEGORIES.index(category) for img in os.listdir(path): try: img_array = cv2.imread(os.path.join(path,img), cv2.IMREAD_GRAYSCALE) new_array = cv2.resize(img_array, (IMG_SIZE, IMG_SIZE)) training_data.append([new_array, class_num]) except Exception as e: pass create_training_data() print(len(training_data) ```
your code only loaded the Dog data the training data, hence the 12450 for training lentgh. this means you are only shuffling dog images, which will give you 1s. your training length should be aprox 25000. fix yo indentations and you should be okay.
97,158
I've been reading Rabin's article on decidability in Barwise's text, and I came across Rabin's discussion of the decidability proof of his tree theory: the second-order theory with two successor functions. The text mentions that the proof is hard and very technical owing to many extensions of automata theory, and I was wondering if someone might be able to sketch it out. Thanks!
2012/05/16
[ "https://mathoverflow.net/questions/97158", "https://mathoverflow.net", "https://mathoverflow.net/users/23760/" ]
[**Edit, June 2, 2013:** At the Nordic Spring School in Logic this year there was a course by Wolfgang Thomas on *Logic, automata and games*. You may be interested in the slides, particularly for part III (Rabin’s tree theorem). Slides and notes for all courses can be downloaded [here](http://scandinavianlogic.org/school); the slides for part III can be downloaded [here](http://scandinavianlogic.org/material/norway3a.pdf).] This is a nice result, but you are right that the known proofs are rather elaborate. Below, I just give the briefest of sketches, but it gives a glimpse of the ideas involved. The game theoretic approach is elegant, even if it takes a bit of time to understand the relevant notions. An excellent reference is the book "The classical decision problem", by Börger, Grädel, and Gurevich (Springer, 1997). You can find the proof in II.7.1. I lectured on it in Caltech a few centuries ago (2007). If you do not have access to the book, you may want to take a look at homework sets 5 and 6 at this [link](http://caicedoteaching.wordpress.com/previous-courses/computability-theory-decidability-caltech-spring-2007/). There, you will find a sketch of the so called Forgetful Determinacy theorem of Gurevich and Harrington. This is the key technical result. Here, I'll just state it. (The theorem comes from Gurevich-Harrington, "Trees, automatas, and games". 14th annual ACM Symposium on Theory of Computation, 60-65, 1982. The presentation in the book follows Zeitman, "Unforgettable forgetful determinacy", Journal of Logic and Computation, vol 4, 273-283 (1994).) > > **Theorem (Forgetful determinacy for tree automata).** If $A$ is a $\Sigma$-tree automaton and $F$ is a $\Sigma$-tree, one of the players ($A$ or Pathfinder) has a winning strategy in > $\Gamma(A,F)$ that is *forgetful* in the sense that whenever $p$, $q$ are positions from which the winner moves, > $$ LAR(p)=LAR(q), $$ > and > $$ \mbox{$Node(p)$-residue of $F=Node(q)$-residue of $F$}, $$ > then $f(p)=f(q)$. > > > (Here, the node of a position is simply the node in the binary tree that is being played. Given a $\Sigma$-tree $F$, the $v$-residue of $F$ is the $\Sigma$-tree $F\_v$ coming from $F$ by only considering the tree from $v$ on, that is, $F\_v(w)=F(vw)$. I define the other relevant notions below.) Using this, it is relatively easy to check that the "Emptiness problem" is decidable for tree automata: There is an algorithm that, given a $\Sigma$-automaton $A$, decides whether there is a $\Sigma$-tree that $A$ accepts. Similarly, but this takes a bit of work and is really the whole point, Forgetful Determinacy implies that there is an algorithm that to each $\Sigma$-automaton $A$ assigns a $\Sigma$-automaton $C$ with the property that $C$ accepts a $\Sigma$-tree iff $A$ rejects it. (This is the "Complementation Theorem".) Using this, it is a simple matter of induction in formulas to prove decidability, since one can effectively associate to each monadic formula $\phi(X\_1,\dots,X\_n)$ (of second-order theory with two successors) a $\Sigma$-automaton $A$ for $\Sigma=\{0,1\}^n$, with the property that, for any collections $W\_1,\dots,W\_n$ of binary words, the automaton $A$ accepts the tree $T$ they define iff $T^2$ satisfies $\phi(W\_1,\dots,W\_n)$, where $T^2$ is the structure given by the full binary tree with the two successor functions. --- Let me briefly review the relevant definitions, following the book closely. I'm just quoting the notes of my younger self, so there may be a bit of irrelevancy, for which I apologize. Let $MOVE$ be a finite alphabet. An *arena* $A$ is a colored bipartite multi-digraph in the following sense: 1. The *vertices* of $A$ are divided into two disjoint sets, *east* vertices and *west* vertices. There are no *edges* between east vertices or between west vertices. There may be *several* edges between an east and a west vertices, or between a west and an east vertices (so edges have *directions*, which is why we call the object a digraph, and there may be several edges between the same vertices, which is why we call it a multi-digraph). 2. There is a distinguished vertex, the *start vertex*. Every vertex is *reachable* from the start vertex (i.e., for any $v$ there is a finite sequence $v\_0,\dots,v\_n$ where $v\_0$ is the start vertex, $v\_n=v$ and for each $i\lt n$ there is an edge going from $v\_i$ to $v\_{i+1}$). Any vertex has at least one outgoing edge. 3. The edges are labeled by elements of $MOVE$ in such a way that no two *outgoing* edges from the same vertex have the same label. 4. There is a finite set $S$ of *colors* that partition the set of vertices. We denote by $C^s$ the vertices with color $s$. A **game** on $A$ is played between two players 0 and 1 who alternate choosing an outgoing edge from the current vertex, starting from the start vertex. So a play of the game defines an infinite *path* through $A$ (we allow for the possibility of revisiting vertices). A *position* $p$ is a finite directed path through $A$ from the start vertex, so it is uniquely described by a word in $MOVE^\*$, with which we identify $p$. Given a position $p$, the labels of the edges leading out of the last vertex of $p$ are the *possible moves* at $p$. A *play* is an $\omega$-sequence $P\in MOVE^\omega$ such that each initial segment is a position. The set of plays over $A$ is $PLAY(A)$. A **graph game** is a triple $\Gamma=(A,\varepsilon,W\_\varepsilon)$ where $A$ is an arena, $\varepsilon\in\{0,1\}$ (denoting the player that goes first) and $W\_\varepsilon$, the *winning set* for player $\varepsilon$, is a Boolean combination of the sets ${}[C^s]$ where ${}[C^s]$ is the set of plays that infinitely often pass through a vertex of color $s$. Player $\varepsilon$ wins a play $P$ of $\Gamma$ iff $P\in W\_\varepsilon$. Otherwise, player $1-\varepsilon$ wins the play $P$. Notice that if the start vertex is an east (resp., a west) vertex then, playing $\Gamma$, player $\varepsilon$'s turns to move are always at east (resp., west) vertices. Call the set of these vertices $V\_{\varepsilon}$ and the set of remaining vertices $V\_{1-\varepsilon}$. A **forgetful strategy** $f$ for player $\delta\in\{0,1\}$ in $\Gamma$ is a function $f:V\_\delta\to{\mathcal P}(MOVE)$ that to each $v\in V\_\delta$ assigns a non-empty set of possible moves from $v$. (The strategy is forgetful since it depends only on $v$ and not on how $v$ was reached.) The *latest appearance record* $LAR(p)$ of a position $p$ is an ordering of the colors. We define $LAR$ inductively, with $LAR(start)$ being an ordering whose last color is that of the start vertex. If a position $q$ is obtained from a position $p$ by adjoining an edge to a vertex of color $s$, then $LAR(q)$ is obtained from $LAR(p)$ by moving $s$ to the last place. The coloring of an arena $A$ is *forgetful* if any two positions at the same vertex have the same $LAR$, in which case we can simply talk of the $LAR$ at a vertex $v$ (rather than at a position $p$ whose last vertex is $v$). What one actually shows is the following: > > **Theorem (Forgetful determinacy).** > Let $\Gamma=(A,\varepsilon,W\_\varepsilon)$ be a graph game with a > forgetful coloring of the arena $A$. Then one of the players has a > forgetful winning strategy in $\Gamma$. > > > One then uses this result to prove the version I stated earlier. For this, let $\Gamma(A,F)$ be a game on a $\Sigma$-tree $F$ between a $\Sigma$-tree automaton $A$ and Pathfinder. Define from this a graph game whose alphabet consists of the states of $A$ and names for the two directions left and right. (So $A$ starts the game and chooses a state according to its initial table, Pathfinder responds by choosing the name of a direction, then $A$ chooses a state, etc.) All positions $p$ where $A$ makes a move have the same default color. If $A$ chooses a state $s$ at $p$ then the color of position $ps$ is $s$. (One needs to check that this coloring is forgetful.) One then has that either $A$ or Pathfinder has a forgetful winning strategy in $\Gamma(A,F)$, by "transfering" the strategy that the forgetful determinacy theorem guarantees.
Here is a very sketchy answer, but it should give the first idea of the proof. Basically, even on words (structures with one successor), you can decide if an MSO (Monadic Second Order) sentence accepts a model by translating the sentence to an equivalent automaton, and then you just need to find an accepting path in this automaton, which is easy. What Rabin did is develop a model of automaton running on infinite tree, together with a way to translate MSO sentences to equivalent automata. Then, in the same way, deciding if the MSO sentence accepts a model is reduced to finding a "path" (which is generalized to a tree structure in some way) in the equivalent automaton.
519,175
I am studying for a class on System and Network Engineering and in one material we are told that Ubuntu uses the OS loader to load the bootloader GRUB. My question is what is the Ubuntu OS loader and where does it reside?
2014/09/02
[ "https://askubuntu.com/questions/519175", "https://askubuntu.com", "https://askubuntu.com/users/280766/" ]
I assume we are talking about a system using a BIOS system. Nowadays we also have UEFI where things are a bit more complicated. The [booting](https://wiki.ubuntu.com/Booting) (link has more detailed information) process has 4 stages: 1. BIOS * (U)EFI is another form of kind of firmware. BIOS is found mainly on IBM based systems. EFI is from INTEL and UEFI is supported by a wide range of companies (including Redhat, AMD, nVidia, Intel, Microsoft). If you want detailed difference between the two [this website](https://www.happyassassin.net/2014/01/25/uefi-boot-how-does-that-actually-work-then/) explains it very nicely.When a computer is started it starts by executing firmware. In IBM PC compatible systems this is the BIOS and is (mostly) stored on a read only memory module. This will initialise all hardware expect for the CPU and ends with starting the boot loader. 2. Boot loader **Answer to 1st part** The boot loader can be activated from several locations. 1. Master Boot record (The master boot record is the first sector on a disk and contains in general a partition table for the disk and a simple boot loader **Answer to 2nd part**). GRUB (currently default on Ubuntu) and LILO (used to be the Linux default) are examples of this. 2. A CD, DVD or USB. 3. A network location.At the end of the bootloader section it will start the kernel. The kernel picked for this can be a manual choice or an automated choice (last booted kernel, 1st one on the list etc). 3. Kernel * This is the same for all Linux systems though any Linux can use different modules.The kernel is the core of all of our Linux systems and provides access to hardware (by loading modules), load ram disks and several other low level tasks so the system startup can begin. 4. System startup * this will be different for Redhat, SUSE, Debian/Ubuntu (etc.) and also different for kde, gnome, unity (etc.)First the root partition and filesystem are located, checked and mounted. Next the init process is started, which runs the initialization scripts. These scripts involve different `/etc/rc` scripts and upstart events that eventually gives you a ready-to-use computer with a login screen.
The OS loader is Grub. Grub is more than just a bootloader. **By Default:** For BIOS computers it's stored in the drive's master boot record on MBR partition tables, and the drive's protected master boot record on GUID partition tables. For UEFI/EFI computers it's stored on the EFI System Partition. Sources: * [Proposal For A New Tag & Synonym Tags To Help Prevent Misuse Of The Bootloader Tag?](http://meta.askubuntu.com/questions/9237/proposal-for-a-new-tag-synonym-tags-to-help-prevent-misuse-of-the-bootloader-t) * <https://wiki.ubuntu.com/Booting>
41,909,766
I have two tables which look like this: ``` event_ap Event a_nr tnr date timestamp knr maschnr PAN 123 2203 2017-01-23 21600 11 x222 PAN 132 2203 2017-01-22 21600 22 x222 PAB 123 2203 2017-01-23 28523 11 x222 PAN 555 2203 2017-01-23 14023 33 x222 PAN 555 2201 2017-01-23 21235 44 x222 PAB 222 2202 2017-01-23 21245 44 x222 PAN 666 2202 2017-01-28 35000 44 x222 PAB 666 2202 2017-01-28 35000 44 x222 pers_stm name knr Test1 11 Test2 22 Test3 33 Test4 44 ``` So what I need is the last record for each ID (knr). My query for this looks like this ``` select * From ( select * from ( select * , row_number() over (partition by knr order by date desc, timestamp desc) as RN from event_ap ) X where RN = 1 ) Y join pers_stm p on p.knr = Y.knr ``` But there is an issue with this. As you can see above in the example of the Table "event\_ap" (**last two records**) there are records with the **exact same data** (including same timestamp) the only **difference** is the **Event-Tag**. ***So what i need based on the query i have so far:*** * (get the **last record** of table event\_ap (**date, timestamp**) already accomplished with query above) * if there are **two records with the same date, timestamp and ID (knr)** then p**ick the record with the event-Tag "PAN"** as query result Thank you!
2017/01/28
[ "https://Stackoverflow.com/questions/41909766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This will be fixed shortly and be part of 4.1.9.Final: <https://github.com/netty/netty/pull/5766>
It seems if found the solution in this thread <https://github.com/netty/netty-tcnative/issues/136> I've just copied netty-tcnative-boringssl-static.jar and relinked tomcat-jni.jar to it in tomcat library directory
47,680,435
my next/prev buttons are not working. Can someone help me. Thanks!I am new to coding I have researched a bunch and tried different things but nothing is working. ``` <section class="section-main"> <div class="container"> <div class="row"> <div class="col-md-8"> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="img/slide1.jpg" alt="First slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide2.jpg" alt="Second slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide3.jpg" alt="Third slide"> </div> </div> <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <div class="col-md-4"> </div> </div> </div> ```
2017/12/06
[ "https://Stackoverflow.com/questions/47680435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9063261/" ]
I can't think of a really elegant way to accomplish this. The following is somewhat brute force, but it gets the job done: ``` select t1.x, t1.y, (case when t1.y is null then unmatched.cnt else matched.cnt end) as cnt from table1 t1 outer apply (select count(*) as cnt from table2 t2 where t2.y = t1.y ) matched cross join (select count(*) as cnt from table2 t2 where not exists (select 1 from table1 t1 where t1.y = t2.y) ) unmatched; ```
There are multiple ways to solve this problem and the best one for you really depends on the data, the number of rows and resulting performance. One of the ways would be doing the operation for everything but `null` from the `Table1` and then `UNION`-ing with the `null` row. For your given example I assume that the combination of `x` and `y` values in both `Table1` and `Table2` is always unique. You'll need additional grouping if it's not. ``` SELECT t1.x, t1.y, COUNT(*) as [count] FROM Table1 t1 INNER JOIN Table2 t2 ON t1.y = t2.y WHERE t1.y IS NOT NULL GROUP BY t1.x, t1.y UNION ALL SELECT t1.x, NULL as y, t2missingFromt1.[count] FROM Table1 t1 CROSS APPLY ( SELECT COUNT(x) as [count] FROM Table2 t2 WHERE NOT EXISTS (SELECT 1 FROM Table1 tbl1 WHERE tbl1.y = t2.y) ) t2missingFromt1 WHERE t1.y IS NULL ```
47,680,435
my next/prev buttons are not working. Can someone help me. Thanks!I am new to coding I have researched a bunch and tried different things but nothing is working. ``` <section class="section-main"> <div class="container"> <div class="row"> <div class="col-md-8"> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="img/slide1.jpg" alt="First slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide2.jpg" alt="Second slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide3.jpg" alt="Third slide"> </div> </div> <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <div class="col-md-4"> </div> </div> </div> ```
2017/12/06
[ "https://Stackoverflow.com/questions/47680435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9063261/" ]
I can't think of a really elegant way to accomplish this. The following is somewhat brute force, but it gets the job done: ``` select t1.x, t1.y, (case when t1.y is null then unmatched.cnt else matched.cnt end) as cnt from table1 t1 outer apply (select count(*) as cnt from table2 t2 where t2.y = t1.y ) matched cross join (select count(*) as cnt from table2 t2 where not exists (select 1 from table1 t1 where t1.y = t2.y) ) unmatched; ```
This is the best I came up with: ``` SELECT t1.x , t1.y , [count] = ISNULL(t2.cnt,0) FROM #Table1 t1 LEFT JOIN (SELECT x , y , cnt = COUNT(*) FROM #Table2 GROUP BY x, y ) t2 ON (t1.x = t2.x AND t1.y = t2.y AND t1.y IS NOT NULL ) OR (t1.x = t2.x AND ISNULL(t1.y,t2.y) = t2.y AND NOT EXISTS (SELECT 1 FROM #Table1 WHERE y = t2.y) ) ```
47,680,435
my next/prev buttons are not working. Can someone help me. Thanks!I am new to coding I have researched a bunch and tried different things but nothing is working. ``` <section class="section-main"> <div class="container"> <div class="row"> <div class="col-md-8"> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="img/slide1.jpg" alt="First slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide2.jpg" alt="Second slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide3.jpg" alt="Third slide"> </div> </div> <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <div class="col-md-4"> </div> </div> </div> ```
2017/12/06
[ "https://Stackoverflow.com/questions/47680435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9063261/" ]
I can't think of a really elegant way to accomplish this. The following is somewhat brute force, but it gets the job done: ``` select t1.x, t1.y, (case when t1.y is null then unmatched.cnt else matched.cnt end) as cnt from table1 t1 outer apply (select count(*) as cnt from table2 t2 where t2.y = t1.y ) matched cross join (select count(*) as cnt from table2 t2 where not exists (select 1 from table1 t1 where t1.y = t2.y) ) unmatched; ```
Here is one solution. See if this helps! ``` WITH v_t2 AS (SELECT y, COUNT(*) AS cnt FROM table2 t2 GROUP BY t2.y ), v_t2_null AS (SELECT COUNT(*) AS cnt FROM table2 t2 WHERE NOT EXISTS (SELECT 1 FROM table1 t1 WHERE t1.y= t2.y) ) SELECT t1.x. t1.y, COALESCE(t2.cnt, v_t2_null.cnt) FROM table1 t1 LEFT JOIN v_t2 t2 ON (t1.y = t2.y) JOIN v_t2_null; ``` Output ``` x y cnt 1 A 2 1 B 0 1 V 0 1 NULL 1 2 M 2 2 N 1 ```
47,680,435
my next/prev buttons are not working. Can someone help me. Thanks!I am new to coding I have researched a bunch and tried different things but nothing is working. ``` <section class="section-main"> <div class="container"> <div class="row"> <div class="col-md-8"> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="img/slide1.jpg" alt="First slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide2.jpg" alt="Second slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide3.jpg" alt="Third slide"> </div> </div> <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <div class="col-md-4"> </div> </div> </div> ```
2017/12/06
[ "https://Stackoverflow.com/questions/47680435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9063261/" ]
I can't think of a really elegant way to accomplish this. The following is somewhat brute force, but it gets the job done: ``` select t1.x, t1.y, (case when t1.y is null then unmatched.cnt else matched.cnt end) as cnt from table1 t1 outer apply (select count(*) as cnt from table2 t2 where t2.y = t1.y ) matched cross join (select count(*) as cnt from table2 t2 where not exists (select 1 from table1 t1 where t1.y = t2.y) ) unmatched; ```
If my understanding is right, it is not just a left join question, it is something like this: ``` -- Creating example CREATE TABLE #T1 (x int, y char(1) null) CREATE TABLE #T2 (x int, y char(1) null) -- Loading tables INSERT INTO #T1 SELECT 1,'A' UNION ALL SELECT 1,'B' UNION ALL SELECT 1,'C' UNION ALL SELECT 1,null UNION ALL SELECT 2,'M' UNION ALL SELECT 2,'N' INSERT INTO #T2 SELECT 1 ,'A' UNION ALL SELECT 1 ,'D' UNION ALL SELECT 2 ,'M' UNION ALL SELECT 2 ,'N' UNION ALL SELECT 2 ,'M' UNION ALL SELECT 1 ,'A' SELECT t1.x, t1.y, count(t2.y) FROM #T1 t1 LEFT JOIN #T2 t2 on t1.y = t2.y LEFT JOIN #T2 t22 on t1.Y IS NULL AND t22.y IS NULL WHERE t1.y is not null GROUP BY t1.x, t1.y UNION ALL SELECT t.x, t.y, (SELECT count(1) 'count' FROM #T2 t2 LEFT JOIN #T1 t1 on t1.y = t2.y WHERE t1.y IS NULL ) FROM #T1 t WHERE t.y IS NULL ``` I had to separate the problem in two.
47,680,435
my next/prev buttons are not working. Can someone help me. Thanks!I am new to coding I have researched a bunch and tried different things but nothing is working. ``` <section class="section-main"> <div class="container"> <div class="row"> <div class="col-md-8"> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="img/slide1.jpg" alt="First slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide2.jpg" alt="Second slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide3.jpg" alt="Third slide"> </div> </div> <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <div class="col-md-4"> </div> </div> </div> ```
2017/12/06
[ "https://Stackoverflow.com/questions/47680435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9063261/" ]
I can't think of a really elegant way to accomplish this. The following is somewhat brute force, but it gets the job done: ``` select t1.x, t1.y, (case when t1.y is null then unmatched.cnt else matched.cnt end) as cnt from table1 t1 outer apply (select count(*) as cnt from table2 t2 where t2.y = t1.y ) matched cross join (select count(*) as cnt from table2 t2 where not exists (select 1 from table1 t1 where t1.y = t2.y) ) unmatched; ```
Another way we can do this via a self join and group by on join of two tables like below ``` select t1.*,t2.c from Table1 t1 join ( select a.y, sum(case when b.y is null then 0 else 1 end) as c from Table1 a full outer join Table2 b on a.y=b.y group by a.y )t2 on ISNULL(t1.y,-1)=ISNULL(t2.y,-1) ``` `[Working demo](http://rextester.com/ALVNM39830)`
47,680,435
my next/prev buttons are not working. Can someone help me. Thanks!I am new to coding I have researched a bunch and tried different things but nothing is working. ``` <section class="section-main"> <div class="container"> <div class="row"> <div class="col-md-8"> <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel"> <ol class="carousel-indicators"> <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li> <li data-target="#carouselExampleIndicators" data-slide-to="1"></li> <li data-target="#carouselExampleIndicators" data-slide-to="2"></li> </ol> <div class="carousel-inner" role="listbox"> <div class="carousel-item active"> <img class="d-block img-fluid" src="img/slide1.jpg" alt="First slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide2.jpg" alt="Second slide"> </div> <div class="carousel-item"> <img class="d-block img-fluid" src="img/slide3.jpg" alt="Third slide"> </div> </div> <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button" data-slide="prev"> <span class="carousel-control-prev-icon" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="carousel-control-next" href="#carouselExampleIndicators" role="button" data-slide="next"> <span class="carousel-control-next-icon" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </div> <div class="col-md-4"> </div> </div> </div> ```
2017/12/06
[ "https://Stackoverflow.com/questions/47680435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9063261/" ]
I can't think of a really elegant way to accomplish this. The following is somewhat brute force, but it gets the job done: ``` select t1.x, t1.y, (case when t1.y is null then unmatched.cnt else matched.cnt end) as cnt from table1 t1 outer apply (select count(*) as cnt from table2 t2 where t2.y = t1.y ) matched cross join (select count(*) as cnt from table2 t2 where not exists (select 1 from table1 t1 where t1.y = t2.y) ) unmatched; ```
Thank you for all answers. They were very helpful. Here is my solution, with counts in proper way all rows from Table2 and match it by x to row in table1 with y == null. I know that I can wright better subquery in left join. Of course the real problem is much complicated and the question is simplified version of it. I you find how I can improve the query then please, let me know :) ``` ;with T2Count as ( select x, y, count(*) cnt from @t2 group by x, y ) /* select t1.x, t1.y, isnull(t2.cnt, 0) from @T1 t1 left join T2Count t2 on t1.x = t2.x and t1.y = t2.y where t1.y is not null */ select t1.x, t1.y, isnull(AllCounts.cnt, 0) cnt from @t1 t1 left join ( select * from T2Count -- I know that here I'will take too much data 1-D, 2-Q, but those data will not natch in last join (AllCounts...) union all select t2.x, null, sum(cnt) cnt from T2Count t2 left join @t1 t1 on t1.x = t2.x and t1.y = t2.y where t1.x is null group by t2.x ) as AllCounts on t1.x = AllCounts.x and (t1.y = AllCounts.y or (t1.y is null and AllCounts.y is null)) ```
39,609,727
I am messed with both completion handler and blocks while I am using them in `Swift` and `Objective-C`. And when I am searching blocks in `Swift` on google it is showing result for completion handler! Can somebody tell me what is the difference between completion handler and blocks with respect to `Swift` and `Objective-C` ?
2016/09/21
[ "https://Stackoverflow.com/questions/39609727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6160393/" ]
Here you can easily differentiate between blocks and completion handlers in fact both are blocks see detail below. **Blocks:** Blocks are a language-level feature added to C, Objective-C and C++, which allow you to create distinct segments of code that can be passed around to methods or functions as if they were values. Blocks are Objective-C objects, which means they can be added to collections like NSArray or NSDictionary. * They can be executed in a later time, and not when the code of the scope they have been implemented is being executed. * Their usage leads eventually to a much cleaner and tidier code writing, as they can be used instead of delegate methods, written just in one place and not spread to many files. **Syntax:** ReturnType (^blockName)(Parameters) *see example*: ``` int anInteger = 42; void (^testBlock)(void) = ^{ NSLog(@"Integer is: %i", anInteger); // anInteger outside variables }; // calling blocks like testBlock(); ``` *Block with argument:* ``` double (^multiplyTwoValues)(double, double) = ^(double firstValue, double secondValue) { return firstValue * secondValue; }; // calling with parameter double result = multiplyTwoValues(2,4); NSLog(@"The result is %f", result); ``` **Completion handler:** Whereas completion handler is a way (technique) for implementing callback functionality using blocks. A completion handler is nothing more than a simple block declaration passed as a parameter to a method that needs to make a callback at a later time. Note: **completion handler should always be the last parameter in a method. A method can have as many arguments as you want, but always have the completion handler as the last argument in the parameters list.** Example: ``` - (void)beginTaskWithName:(NSString *)name completion:(void(^)(void))callback; // calling [self beginTaskWithName:@"MyTask" completion:^{ NSLog(@"Task completed .."); }]; ``` More example with `UIKit` classes methods. ``` [self presentViewController:viewController animated:YES completion:^{ NSLog(@"xyz View Controller presented .."); // Other code related to view controller presentation... }]; ``` --- ``` [UIView animateWithDuration:0.5 animations:^{ // Animation-related code here... [self.view setAlpha:0.5]; } completion:^(BOOL finished) { // Any completion handler related code here... NSLog(@"Animation over.."); }]; ```
In short : Completion handlers are a way of implementing callback functionality using blocks or closures. Blocks and Closures are chunks of code that can be passed around to methods or functions as if they were values (in other words "anonymous functions" which we can give names to and pass around).
39,609,727
I am messed with both completion handler and blocks while I am using them in `Swift` and `Objective-C`. And when I am searching blocks in `Swift` on google it is showing result for completion handler! Can somebody tell me what is the difference between completion handler and blocks with respect to `Swift` and `Objective-C` ?
2016/09/21
[ "https://Stackoverflow.com/questions/39609727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6160393/" ]
In short : Completion handlers are a way of implementing callback functionality using blocks or closures. Blocks and Closures are chunks of code that can be passed around to methods or functions as if they were values (in other words "anonymous functions" which we can give names to and pass around).
I am hope this will help. First Step: ``` #import <UIKit/UIKit.h> @interface ViewController : UIViewController -(void)InsertUser:(NSString*)userName InsertUserLastName:(NSString*)lastName widthCompletion:(void(^)(NSString* result))callback; @end ``` Second Step : ``` #import "ViewController.h" @interface ViewController () @end @implementation ViewController -(void)InsertUser:(NSString *)userName InsertUserLastName:(NSString*)lastName widthCompletion:(void (^)(NSString* result))callback{ callback(@"User inserted successfully"); } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self InsertUser:@"Ded" InsertUserLastName:@"Moroz" widthCompletion:^(NSString *result) { NSLog(@"Result:%@",result); }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end ```
39,609,727
I am messed with both completion handler and blocks while I am using them in `Swift` and `Objective-C`. And when I am searching blocks in `Swift` on google it is showing result for completion handler! Can somebody tell me what is the difference between completion handler and blocks with respect to `Swift` and `Objective-C` ?
2016/09/21
[ "https://Stackoverflow.com/questions/39609727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6160393/" ]
Here you can easily differentiate between blocks and completion handlers in fact both are blocks see detail below. **Blocks:** Blocks are a language-level feature added to C, Objective-C and C++, which allow you to create distinct segments of code that can be passed around to methods or functions as if they were values. Blocks are Objective-C objects, which means they can be added to collections like NSArray or NSDictionary. * They can be executed in a later time, and not when the code of the scope they have been implemented is being executed. * Their usage leads eventually to a much cleaner and tidier code writing, as they can be used instead of delegate methods, written just in one place and not spread to many files. **Syntax:** ReturnType (^blockName)(Parameters) *see example*: ``` int anInteger = 42; void (^testBlock)(void) = ^{ NSLog(@"Integer is: %i", anInteger); // anInteger outside variables }; // calling blocks like testBlock(); ``` *Block with argument:* ``` double (^multiplyTwoValues)(double, double) = ^(double firstValue, double secondValue) { return firstValue * secondValue; }; // calling with parameter double result = multiplyTwoValues(2,4); NSLog(@"The result is %f", result); ``` **Completion handler:** Whereas completion handler is a way (technique) for implementing callback functionality using blocks. A completion handler is nothing more than a simple block declaration passed as a parameter to a method that needs to make a callback at a later time. Note: **completion handler should always be the last parameter in a method. A method can have as many arguments as you want, but always have the completion handler as the last argument in the parameters list.** Example: ``` - (void)beginTaskWithName:(NSString *)name completion:(void(^)(void))callback; // calling [self beginTaskWithName:@"MyTask" completion:^{ NSLog(@"Task completed .."); }]; ``` More example with `UIKit` classes methods. ``` [self presentViewController:viewController animated:YES completion:^{ NSLog(@"xyz View Controller presented .."); // Other code related to view controller presentation... }]; ``` --- ``` [UIView animateWithDuration:0.5 animations:^{ // Animation-related code here... [self.view setAlpha:0.5]; } completion:^(BOOL finished) { // Any completion handler related code here... NSLog(@"Animation over.."); }]; ```
**Blocks**: ***Obj-c*** ``` - (void)hardProcessingWithString:(NSString *)input withCompletion:(void (^)(NSString *result))block; [object hardProcessingWithString:@"commands" withCompletion:^(NSString *result){ NSLog(result); }]; ``` **Closures**: ***Swift*** ``` func hardProcessingWithString(input: String, completion: (result: String) -> Void) { ... completion("we finished!") } ``` The **completion closure here** for example is only a function that takes argument string and returns void. > > Closures are self-contained blocks of functionality that can be passed > around and used in your code. Closures in Swift are similar to blocks > in C and Objective-C and to lambdas in other programming languages. > > > <https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html> > > Closures > are first-class objects, so that they can be nested and passed around > (as do blocks in Objective-C). In Swift, functions are just a special > case of closures. > > >
39,609,727
I am messed with both completion handler and blocks while I am using them in `Swift` and `Objective-C`. And when I am searching blocks in `Swift` on google it is showing result for completion handler! Can somebody tell me what is the difference between completion handler and blocks with respect to `Swift` and `Objective-C` ?
2016/09/21
[ "https://Stackoverflow.com/questions/39609727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6160393/" ]
**Blocks**: ***Obj-c*** ``` - (void)hardProcessingWithString:(NSString *)input withCompletion:(void (^)(NSString *result))block; [object hardProcessingWithString:@"commands" withCompletion:^(NSString *result){ NSLog(result); }]; ``` **Closures**: ***Swift*** ``` func hardProcessingWithString(input: String, completion: (result: String) -> Void) { ... completion("we finished!") } ``` The **completion closure here** for example is only a function that takes argument string and returns void. > > Closures are self-contained blocks of functionality that can be passed > around and used in your code. Closures in Swift are similar to blocks > in C and Objective-C and to lambdas in other programming languages. > > > <https://developer.apple.com/library/content/documentation/Swift/Conceptual/Swift_Programming_Language/Closures.html> > > Closures > are first-class objects, so that they can be nested and passed around > (as do blocks in Objective-C). In Swift, functions are just a special > case of closures. > > >
I am hope this will help. First Step: ``` #import <UIKit/UIKit.h> @interface ViewController : UIViewController -(void)InsertUser:(NSString*)userName InsertUserLastName:(NSString*)lastName widthCompletion:(void(^)(NSString* result))callback; @end ``` Second Step : ``` #import "ViewController.h" @interface ViewController () @end @implementation ViewController -(void)InsertUser:(NSString *)userName InsertUserLastName:(NSString*)lastName widthCompletion:(void (^)(NSString* result))callback{ callback(@"User inserted successfully"); } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self InsertUser:@"Ded" InsertUserLastName:@"Moroz" widthCompletion:^(NSString *result) { NSLog(@"Result:%@",result); }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end ```
39,609,727
I am messed with both completion handler and blocks while I am using them in `Swift` and `Objective-C`. And when I am searching blocks in `Swift` on google it is showing result for completion handler! Can somebody tell me what is the difference between completion handler and blocks with respect to `Swift` and `Objective-C` ?
2016/09/21
[ "https://Stackoverflow.com/questions/39609727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6160393/" ]
Here you can easily differentiate between blocks and completion handlers in fact both are blocks see detail below. **Blocks:** Blocks are a language-level feature added to C, Objective-C and C++, which allow you to create distinct segments of code that can be passed around to methods or functions as if they were values. Blocks are Objective-C objects, which means they can be added to collections like NSArray or NSDictionary. * They can be executed in a later time, and not when the code of the scope they have been implemented is being executed. * Their usage leads eventually to a much cleaner and tidier code writing, as they can be used instead of delegate methods, written just in one place and not spread to many files. **Syntax:** ReturnType (^blockName)(Parameters) *see example*: ``` int anInteger = 42; void (^testBlock)(void) = ^{ NSLog(@"Integer is: %i", anInteger); // anInteger outside variables }; // calling blocks like testBlock(); ``` *Block with argument:* ``` double (^multiplyTwoValues)(double, double) = ^(double firstValue, double secondValue) { return firstValue * secondValue; }; // calling with parameter double result = multiplyTwoValues(2,4); NSLog(@"The result is %f", result); ``` **Completion handler:** Whereas completion handler is a way (technique) for implementing callback functionality using blocks. A completion handler is nothing more than a simple block declaration passed as a parameter to a method that needs to make a callback at a later time. Note: **completion handler should always be the last parameter in a method. A method can have as many arguments as you want, but always have the completion handler as the last argument in the parameters list.** Example: ``` - (void)beginTaskWithName:(NSString *)name completion:(void(^)(void))callback; // calling [self beginTaskWithName:@"MyTask" completion:^{ NSLog(@"Task completed .."); }]; ``` More example with `UIKit` classes methods. ``` [self presentViewController:viewController animated:YES completion:^{ NSLog(@"xyz View Controller presented .."); // Other code related to view controller presentation... }]; ``` --- ``` [UIView animateWithDuration:0.5 animations:^{ // Animation-related code here... [self.view setAlpha:0.5]; } completion:^(BOOL finished) { // Any completion handler related code here... NSLog(@"Animation over.."); }]; ```
I am hope this will help. First Step: ``` #import <UIKit/UIKit.h> @interface ViewController : UIViewController -(void)InsertUser:(NSString*)userName InsertUserLastName:(NSString*)lastName widthCompletion:(void(^)(NSString* result))callback; @end ``` Second Step : ``` #import "ViewController.h" @interface ViewController () @end @implementation ViewController -(void)InsertUser:(NSString *)userName InsertUserLastName:(NSString*)lastName widthCompletion:(void (^)(NSString* result))callback{ callback(@"User inserted successfully"); } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [self InsertUser:@"Ded" InsertUserLastName:@"Moroz" widthCompletion:^(NSString *result) { NSLog(@"Result:%@",result); }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end ```
223,880
*Huge omega thanks to @wasif for emailing me this challenge idea in its basic form* Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them. Henceforth, today's task is to tell me every single tag that exists on the Code Golf and Coding Challenges Stack Exchange. The Challenge ------------- Write a program or function that prints/returns a list of all available tags on <https://codegolf.stackexchange.com> As tags can be created/deleted at any time, simply hard-coding a list of tags is not a valid solution - the list must be correct at run-time regardless of when the program/function is executed. The tags avaliable can be seen [here](https://codegolf.stackexchange.com/tags) Rules ----- * As this is an [internet](/questions/tagged/internet "show questions tagged 'internet'") challenge, internet connections are allowed. However, web requests can only be made to codegolf.stackexchange.com and api.stackexchange.com domains. * Output can be given in any convenient and reasonable format. * The tags can be in any order, so long as all current tags are returned. * The exact name of the tags must be used (e.g. `code-golf` is valid, `code GOLF` is not valid.) * And as usual, standard loopholes apply, shortest code wins Example Program --------------- ```python import urllib.request import regex pobj = regex.compile('rel="tag">(.*)</a>') page_number = 2 req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page=1&tab=name") data = req.read().decode('utf-8') tags = [] while data.count("tag") != 43: tags += pobj.findall(data) req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page={page_number}&tab=name") data = req.read().decode('utf-8') page_number += 1 print(tags) ```
2021/04/20
[ "https://codegolf.stackexchange.com/questions/223880", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/78850/" ]
Python 3 + `requests`, 143 bytes ================================ ``` from requests import* p=1 while[print(x["name"])for x in get(f"http://api.stackexchange.com/tags?page={p}&site=codegolf").json()["items"]]:p+=1 ``` -19 bytes thanks to Jonathan Allan -5 bytes thanks to dingledooper
JavaScript, 176 bytes ===================== ```js async _=>{t=[];i=1;do t.push(...(j=await (await fetch("http://api.stackexchange.com/2.2/tags?site=codegolf&page="+i++)).json()).items);while(j.has_more)return t.map(d=>d.name)} ``` Must be run on `api.stackexchange.com` subdomain; I use `/docs` for testing.
223,880
*Huge omega thanks to @wasif for emailing me this challenge idea in its basic form* Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them. Henceforth, today's task is to tell me every single tag that exists on the Code Golf and Coding Challenges Stack Exchange. The Challenge ------------- Write a program or function that prints/returns a list of all available tags on <https://codegolf.stackexchange.com> As tags can be created/deleted at any time, simply hard-coding a list of tags is not a valid solution - the list must be correct at run-time regardless of when the program/function is executed. The tags avaliable can be seen [here](https://codegolf.stackexchange.com/tags) Rules ----- * As this is an [internet](/questions/tagged/internet "show questions tagged 'internet'") challenge, internet connections are allowed. However, web requests can only be made to codegolf.stackexchange.com and api.stackexchange.com domains. * Output can be given in any convenient and reasonable format. * The tags can be in any order, so long as all current tags are returned. * The exact name of the tags must be used (e.g. `code-golf` is valid, `code GOLF` is not valid.) * And as usual, standard loopholes apply, shortest code wins Example Program --------------- ```python import urllib.request import regex pobj = regex.compile('rel="tag">(.*)</a>') page_number = 2 req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page=1&tab=name") data = req.read().decode('utf-8') tags = [] while data.count("tag") != 43: tags += pobj.findall(data) req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page={page_number}&tab=name") data = req.read().decode('utf-8') page_number += 1 print(tags) ```
2021/04/20
[ "https://codegolf.stackexchange.com/questions/223880", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/78850/" ]
Python 3 + `requests`, 143 bytes ================================ ``` from requests import* p=1 while[print(x["name"])for x in get(f"http://api.stackexchange.com/tags?page={p}&site=codegolf").json()["items"]]:p+=1 ``` -19 bytes thanks to Jonathan Allan -5 bytes thanks to dingledooper
[Bash](https://www.gnu.org/software/bash/) + wget + jq, 86 ========================================================== Assumes there are no more than 99 pages of results (currently 10 pages). ```bash wget -qO- api.stackexchange.com/tags?site=codegolf\&page={1..99}|zcat|jq .items[].name ``` Testing this blew through my daily API requests limit pretty quick.
223,880
*Huge omega thanks to @wasif for emailing me this challenge idea in its basic form* Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them. Henceforth, today's task is to tell me every single tag that exists on the Code Golf and Coding Challenges Stack Exchange. The Challenge ------------- Write a program or function that prints/returns a list of all available tags on <https://codegolf.stackexchange.com> As tags can be created/deleted at any time, simply hard-coding a list of tags is not a valid solution - the list must be correct at run-time regardless of when the program/function is executed. The tags avaliable can be seen [here](https://codegolf.stackexchange.com/tags) Rules ----- * As this is an [internet](/questions/tagged/internet "show questions tagged 'internet'") challenge, internet connections are allowed. However, web requests can only be made to codegolf.stackexchange.com and api.stackexchange.com domains. * Output can be given in any convenient and reasonable format. * The tags can be in any order, so long as all current tags are returned. * The exact name of the tags must be used (e.g. `code-golf` is valid, `code GOLF` is not valid.) * And as usual, standard loopholes apply, shortest code wins Example Program --------------- ```python import urllib.request import regex pobj = regex.compile('rel="tag">(.*)</a>') page_number = 2 req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page=1&tab=name") data = req.read().decode('utf-8') tags = [] while data.count("tag") != 43: tags += pobj.findall(data) req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page={page_number}&tab=name") data = req.read().decode('utf-8') page_number += 1 print(tags) ```
2021/04/20
[ "https://codegolf.stackexchange.com/questions/223880", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/78850/" ]
[05AB1E](https://github.com/Adriandmen/05AB1E), ~~60~~ ~~57~~ 56 bytes ====================================================================== ``` [N>’¸¸.‚‹º.ŒŒ/›´?€¼=ƒËŠˆ&€®=ÿ’.wD2è'eQ#“e":"“¡¦ε'"¡н]\) ``` Outputs as a list of pages, where each page is a list of tags. ``` [N>’...’.wD2è'eQ#“e":"“¡¦ε'"¡н]\) # trimmed program [ # # while... è # character in... .wD # data of response from URL... # (implicit) "http://" concatenated with... ’...’ # "api.stackexchange.com/tags?site=codegolf&page=ÿ"... # (implicit) with ÿ replaced by... N # current index in loop... > # plus 1... è # at index... 2 # literal... # # is not... Q # equal to... 'e # literal... .w # push data of response from URL... # (implicit) "http://" concatenated with... ’...’ # "api.stackexchange.com/tags?site=codegolf&page=ÿ"... # (implicit) with ÿ replaced by... N # current index in loop... > # plus 1... ¡ # split by... “e":"“ # literal... ¦ # excluding the first... ε # with each element replaced by... н # first element of... # (implicit) current element in map... ¡ # split by... '" # literal ] # exit map ] # exit infinite loop \ # delete top element of stack ) # push stack # implicit output ```
JavaScript, 176 bytes ===================== ```js async _=>{t=[];i=1;do t.push(...(j=await (await fetch("http://api.stackexchange.com/2.2/tags?site=codegolf&page="+i++)).json()).items);while(j.has_more)return t.map(d=>d.name)} ``` Must be run on `api.stackexchange.com` subdomain; I use `/docs` for testing.
223,880
*Huge omega thanks to @wasif for emailing me this challenge idea in its basic form* Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them. Henceforth, today's task is to tell me every single tag that exists on the Code Golf and Coding Challenges Stack Exchange. The Challenge ------------- Write a program or function that prints/returns a list of all available tags on <https://codegolf.stackexchange.com> As tags can be created/deleted at any time, simply hard-coding a list of tags is not a valid solution - the list must be correct at run-time regardless of when the program/function is executed. The tags avaliable can be seen [here](https://codegolf.stackexchange.com/tags) Rules ----- * As this is an [internet](/questions/tagged/internet "show questions tagged 'internet'") challenge, internet connections are allowed. However, web requests can only be made to codegolf.stackexchange.com and api.stackexchange.com domains. * Output can be given in any convenient and reasonable format. * The tags can be in any order, so long as all current tags are returned. * The exact name of the tags must be used (e.g. `code-golf` is valid, `code GOLF` is not valid.) * And as usual, standard loopholes apply, shortest code wins Example Program --------------- ```python import urllib.request import regex pobj = regex.compile('rel="tag">(.*)</a>') page_number = 2 req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page=1&tab=name") data = req.read().decode('utf-8') tags = [] while data.count("tag") != 43: tags += pobj.findall(data) req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page={page_number}&tab=name") data = req.read().decode('utf-8') page_number += 1 print(tags) ```
2021/04/20
[ "https://codegolf.stackexchange.com/questions/223880", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/78850/" ]
JavaScript (Firefox chrome), 135 bytes ====================================== ```javascript f=async(i=1)=>(await((await fetch('http://codegolf.stackexchange.com/tags?page='+i)).text())).match(/[\w-]+(?=&#3)/g).map(alert)|f(i+1) ``` 1. ~~Open [Browser Console of Firefox](https://developer.mozilla.org/en-US/docs/Tools/Browser_Console);~~ You may however open console on this page instead; 2. Paste codes there; 3. Invoke it by running `f()`; 4. Click to close many many `alert`'s --- Source codes for tags page contains line ```html <a href="/questions/tagged/code-golf" class="post-tag" title="show questions tagged &#39;code-golf&#39;" rel="tag">code-golf</a> ``` We match the text `code-golf` between `&#39;` by `/[\w-]+(?=&#3)/g`. The recursion terminate when ith page contains no tags. While the match result is null, and `.map` on `null` cause an error.
JavaScript, 176 bytes ===================== ```js async _=>{t=[];i=1;do t.push(...(j=await (await fetch("http://api.stackexchange.com/2.2/tags?site=codegolf&page="+i++)).json()).items);while(j.has_more)return t.map(d=>d.name)} ``` Must be run on `api.stackexchange.com` subdomain; I use `/docs` for testing.
223,880
*Huge omega thanks to @wasif for emailing me this challenge idea in its basic form* Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just *so many* of them. Henceforth, today's task is to tell me every single tag that exists on the Code Golf and Coding Challenges Stack Exchange. The Challenge ------------- Write a program or function that prints/returns a list of all available tags on <https://codegolf.stackexchange.com> As tags can be created/deleted at any time, simply hard-coding a list of tags is not a valid solution - the list must be correct at run-time regardless of when the program/function is executed. The tags avaliable can be seen [here](https://codegolf.stackexchange.com/tags) Rules ----- * As this is an [internet](/questions/tagged/internet "show questions tagged 'internet'") challenge, internet connections are allowed. However, web requests can only be made to codegolf.stackexchange.com and api.stackexchange.com domains. * Output can be given in any convenient and reasonable format. * The tags can be in any order, so long as all current tags are returned. * The exact name of the tags must be used (e.g. `code-golf` is valid, `code GOLF` is not valid.) * And as usual, standard loopholes apply, shortest code wins Example Program --------------- ```python import urllib.request import regex pobj = regex.compile('rel="tag">(.*)</a>') page_number = 2 req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page=1&tab=name") data = req.read().decode('utf-8') tags = [] while data.count("tag") != 43: tags += pobj.findall(data) req = urllib.request.urlopen(f"https://codegolf.stackexchange.com/tags?page={page_number}&tab=name") data = req.read().decode('utf-8') page_number += 1 print(tags) ```
2021/04/20
[ "https://codegolf.stackexchange.com/questions/223880", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/78850/" ]
[Jyxal 0.2.0](https://github.com/Vyxal/Jyxal/tree/0.2.0), 44 bytes ================================================================== ``` 0{›:`ȯø.⟩β•∵.•⅛/ɾƈ?λ→=%&λẋ=¬⋎»₅`%¨UøJht(ntt, ``` [Jyxal-is-not-hosted-anywhere-so-read-the-readme-to-see-how-to-try-this](https://github.com/Vyxal/Jyxal/blob/master/README.md) Fixed thanks to @emanresu A Absolutely crushes 05AB1E. On my machine, it goes through the first 25 pages before getting a 403 and printing `4` forever. Unfortunately, Vyxal cannot decompress zipped responses so I kinda had to use Jyxal in place. This is heavily dependent on the ordering of the values in the JSON response. ``` 0{›:`ȯø.⟩β•∵.•⅛/ɾƈ?λ→=%&λẋ=¬⋎»₅`%¨UøJht(ntt, # I don't need the 2 closing parens at the end. 0 # Push 0 (Jyxal does not have implicit input yet) { # Loop forever › # And increment the number % # Replace all "%" in the string... `ȯø.⟩β•∵.•⅛/ɾƈ?λ→=%&λẋ=¬⋎»₅` # "api.stackexchange.com/tags?page=%&site=codegolf" : # With the current loop index ¨U # Make a GET request to that URL... øJ # And decode the JSON response h # Get the first key-value pair... t # And the second item; that is, the "items" array (n # For each item in that array... t # Get the last key-value pair and then... t # Get the value , # Print that value ```
JavaScript, 176 bytes ===================== ```js async _=>{t=[];i=1;do t.push(...(j=await (await fetch("http://api.stackexchange.com/2.2/tags?site=codegolf&page="+i++)).json()).items);while(j.has_more)return t.map(d=>d.name)} ``` Must be run on `api.stackexchange.com` subdomain; I use `/docs` for testing.