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
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
Tcl, 50 ------- ``` puts \33\[9A[string map {( \33\[A ) \33\[B} $argv] ``` Kind of cheating, but well.. I use ascii escape sequences to get the line difference, `^[[A` means move the curser 1 line up, `^[[B` is move curser 1 line down.
Ruby 1.9 (129) -------------- Reads from stdin. ```ruby l=0 $><<gets.split('').map{|c|x=[?(]*99;x[l+=c==?(?-1:c==?)?1:0]=c;x}.transpose.map(&:join).*(?\n).tr('()',' ').gsub(/^\s+\n/,'') ```
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
C, 132 characters ----------------- ``` char*p,b[999];n; main(m){for(p=gets(memset(b,32,999));*p;++p)*p-41?*p-40?p[n*99]=*p:++n>m?m=n:0:--n; for(;m;puts(b+m--*99))p[m*99]=0;} ``` The description failed to specify how much input the submission had to accept in order to be accepted, so I settled on limits that were mo...
[Charcoal](https://github.com/somebody1234/Charcoal), 14 bytes ============================================================== ``` FS≡ι(«↘»)«↗»«ι ``` [Try it online!](https://tio.run/##VY49C8IwFEXn9lc8Mr03dPBraVcXB0EUJ3EIMW2CsQlp2g7S3x5jEaHjvffAuUJxLyw3MdbW46F1fbgEr9sGiaAbdRAKNcE7zzLBOwkMWTmn7GgHieXeju1ZNypQlcrpj9ESu...
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
Tcl, 50 ------- ``` puts \33\[9A[string map {( \33\[A ) \33\[B} $argv] ``` Kind of cheating, but well.. I use ascii escape sequences to get the line difference, `^[[A` means move the curser 1 line up, `^[[B` is move curser 1 line down.
C, 149 chars ============ ``` #define S for(i=0;c=v[1][i++];)h+=a=c-'('?c-')'?0:-1:1, c,i,h=0,m=0;main(int a,char**v){S m=h>m?h:m;for(;m;m--){S putchar(a||h-m?32:c);putchar(10);}} ``` run with quoted arg, e.g. a.out "((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo)))"
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
Python, 130 =========== ``` a=[""]*9 l=8 i=0 for c in raw_input():o=l;l+=c==')';l-=c=='(';a[l]=a[l].ljust(i)+c*(o==l);i+=1 print"\n".join(filter(str.strip,a)) ```
[Charcoal](https://github.com/somebody1234/Charcoal), 14 bytes ============================================================== ``` FS≡ι(«↘»)«↗»«ι ``` [Try it online!](https://tio.run/##VY49C8IwFEXn9lc8Mr03dPBraVcXB0EUJ3EIMW2CsQlp2g7S3x5jEaHjvffAuUJxLyw3MdbW46F1fbgEr9sGiaAbdRAKNcE7zzLBOwkMWTmn7GgHieXeju1ZNypQlcrpj9ESu...
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
C, 149 chars ============ ``` #define S for(i=0;c=v[1][i++];)h+=a=c-'('?c-')'?0:-1:1, c,i,h=0,m=0;main(int a,char**v){S m=h>m?h:m;for(;m;m--){S putchar(a||h-m?32:c);putchar(10);}} ``` run with quoted arg, e.g. a.out "((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo)))"
VB.net (For S&G) ---------------- Not the prettiest of code. ``` Module Q Sub Main(a As String()) Dim t = a(0) Dim h = 0 For Each m In (From G In (t.Select(Function(c) h += If(c = "(", 1, If(c = ")", -1, 0)) Return h ...
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
Python, 161 chars ----------------- ``` S=raw_input() R=range(len(S)) H=[S[:i].count('(')-S[:i].count(')')for i in R]+[0] for h in range(max(H),0,-1):print''.join((' '+S[i])[H[i]==H[i+1]==h]for i in R) ```
C, 149 chars ============ ``` #define S for(i=0;c=v[1][i++];)h+=a=c-'('?c-')'?0:-1:1, c,i,h=0,m=0;main(int a,char**v){S m=h>m?h:m;for(;m;m--){S putchar(a||h-m?32:c);putchar(10);}} ``` run with quoted arg, e.g. a.out "((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo)))"
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
APL (59) -------- ``` ⊖↑{⊃,/T\¨⍨⍵×P=0}¨R∘=¨(⍴T)∘⍴¨⍳⌈/R←1++\P←+/¨1 ¯1∘ר'()'∘=¨T←⍞ ``` I have assumed that the 'base' needs to be usable as well. (i.e. `(a(b))c(d)` is valid). If this is not necessary two characters can be saved. Explanation: * `T←⍞`: store a line of input in T * `'()'∘=¨T`: for each character in T...
Python, 130 =========== ``` a=[""]*9 l=8 i=0 for c in raw_input():o=l;l+=c==')';l-=c=='(';a[l]=a[l].ljust(i)+c*(o==l);i+=1 print"\n".join(filter(str.strip,a)) ```
6,600
Here is some example input, so I can explain what the problem is: ``` ((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo))) ``` Think of this line of text as a topographic map of some mountains. Each set of parentheses illustrates one unit of altitude. If we "view" this from the side, so that we see the mountains vert...
2012/07/12
[ "https://codegolf.stackexchange.com/questions/6600", "https://codegolf.stackexchange.com", "https://codegolf.stackexchange.com/users/4303/" ]
C, 149 chars ============ ``` #define S for(i=0;c=v[1][i++];)h+=a=c-'('?c-')'?0:-1:1, c,i,h=0,m=0;main(int a,char**v){S m=h>m?h:m;for(;m;m--){S putchar(a||h-m?32:c);putchar(10);}} ``` run with quoted arg, e.g. a.out "((1 2)(3 (4 5) moo)) (i (lik(cherries)e (woohoo)))"
C#, 229 bytes ------------- If there's no restriction on leading vertical space, you can use this (indented for clarity.) It'll initialise the cursor down one line for every `(` found before printing, then move the cursor up and down as brackets are read. ``` using C=System.Console; class P{ static void Main(stri...
400,064
I'm building a microcontroller circuit that feeds its output into a microphone input of an audio recorder. The output is a square wave. (Think old-style 3.5mm Square credit card readers). What can I use to covert a signal in the range of 0..3V to -1..+1V? I'm looking for something like MAX232, but with lower voltage l...
2018/10/08
[ "https://electronics.stackexchange.com/questions/400064", "https://electronics.stackexchange.com", "https://electronics.stackexchange.com/users/200650/" ]
> > I could just use a voltage divider and feed 0..+1V to the audio, but I understand that many audio input circuits use AC coupling and the recorded waveform can have unpredictable DC bias. This is undesirable, since the waveform encodes information in zero-cr ossings. > > > From the comments: > > If it helps, ...
I'd say that you don't need a level shifter if what you'll receive in the end is a digital audio file. Whatever biases present in that can easily be fixed with a simple equalizer (FFT filter). Microphone inputs don't usually care if the signal is not symmetrical around 0 (speakers and power amps are a different story)....
50,569
Wenn ich richtig verstanden habe, werden "Abstand" und "Distanz" für "a short specified distance" und "Entfernung" für "a large specified distance" verwendet. Wenn der Kontext ein Leichtathletikwettbewerb ist, verwendet man stattdessen "Strecke". Wie kann man zwischen "Abstand" und "Distanz" wählen? Ich habe gelesen, ...
2019/04/09
[ "https://german.stackexchange.com/questions/50569", "https://german.stackexchange.com", "https://german.stackexchange.com/users/34207/" ]
*Abstand* und *Distanz* sind größtenteils Synonyme, *Distanz* ist ein Fremdwort. Es gibt einige sehr kleine Unterschiede in der Verwendung von *Abstand* und *Distanz* (gleichzeitig eine Widerlegung der These, dass es bei Leichtathletik immer "Strecke hieße - Das stimmt nicht ganz): > > Müller ist unser bester 1000m-...
Mit der absoluten Entfernung hat das nichts zu tun: Planeten haben auch einen Abstand zur Sonne. Ich würde argumentieren, dass **Strecke** den kompletten Weg dazwischen meint; den werden Planeten oder der vorsichtige Wanderer der zum Abgrund Abstand hält, nie zurücklegen, im Gegensatz zum genannte Läufer. Feste Wendun...
50,569
Wenn ich richtig verstanden habe, werden "Abstand" und "Distanz" für "a short specified distance" und "Entfernung" für "a large specified distance" verwendet. Wenn der Kontext ein Leichtathletikwettbewerb ist, verwendet man stattdessen "Strecke". Wie kann man zwischen "Abstand" und "Distanz" wählen? Ich habe gelesen, ...
2019/04/09
[ "https://german.stackexchange.com/questions/50569", "https://german.stackexchange.com", "https://german.stackexchange.com/users/34207/" ]
*Abstand* und *Distanz* sind größtenteils Synonyme, *Distanz* ist ein Fremdwort. Es gibt einige sehr kleine Unterschiede in der Verwendung von *Abstand* und *Distanz* (gleichzeitig eine Widerlegung der These, dass es bei Leichtathletik immer "Strecke hieße - Das stimmt nicht ganz): > > Müller ist unser bester 1000m-...
As we see from the other answers here: there is no clear semantical differentiation of > > Distanz, Abstand, Entfernung, Strecke > > > The difference is a pragmatic one: these words tend to be used in different use-cases. They are actually interchangeable to large extent; but in practice the individual words seem...
50,569
Wenn ich richtig verstanden habe, werden "Abstand" und "Distanz" für "a short specified distance" und "Entfernung" für "a large specified distance" verwendet. Wenn der Kontext ein Leichtathletikwettbewerb ist, verwendet man stattdessen "Strecke". Wie kann man zwischen "Abstand" und "Distanz" wählen? Ich habe gelesen, ...
2019/04/09
[ "https://german.stackexchange.com/questions/50569", "https://german.stackexchange.com", "https://german.stackexchange.com/users/34207/" ]
As we see from the other answers here: there is no clear semantical differentiation of > > Distanz, Abstand, Entfernung, Strecke > > > The difference is a pragmatic one: these words tend to be used in different use-cases. They are actually interchangeable to large extent; but in practice the individual words seem...
Mit der absoluten Entfernung hat das nichts zu tun: Planeten haben auch einen Abstand zur Sonne. Ich würde argumentieren, dass **Strecke** den kompletten Weg dazwischen meint; den werden Planeten oder der vorsichtige Wanderer der zum Abgrund Abstand hält, nie zurücklegen, im Gegensatz zum genannte Läufer. Feste Wendun...
10,952,852
I'm looking to get the scale and precision from a number in the following example. `var x = 1234.567;` I'm not seeing any `.scale` or `.precision` functions built in and I'm not sure what the best way to right one is.
2012/06/08
[ "https://Stackoverflow.com/questions/10952852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/819662/" ]
``` var x = 1234.567; var parts = x.toString().split('.'); parts[0].length; // output: 4 for 1234 parts[1].length; // output: 3 for 567 ``` ### NOTE Javascript has **[toPrecision()](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number/toPrecision)** method that gives to a number with specif...
Another advanced solution (if I correctly understand what you mean by *scale* and *precision*): ``` function getScaleAndPrecision(x) { x = parseFloat(x) + ""; var scale = x.indexOf("."); if (scale == -1) return null; return { scale : scale, precision : x.length - scale - 1 }; } var...
10,952,852
I'm looking to get the scale and precision from a number in the following example. `var x = 1234.567;` I'm not seeing any `.scale` or `.precision` functions built in and I'm not sure what the best way to right one is.
2012/06/08
[ "https://Stackoverflow.com/questions/10952852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/819662/" ]
``` var x = 1234.567; var parts = x.toString().split('.'); parts[0].length; // output: 4 for 1234 parts[1].length; // output: 3 for 567 ``` ### NOTE Javascript has **[toPrecision()](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Number/toPrecision)** method that gives to a number with specif...
You can use [Number.prototype.toFixed()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) ```js var x = 1234.56780123; x.toFixed(2); // output: 1234.57 x.toFixed(3); // output: 1234.568 x.toFixed(4); // output: 1234.5680 ```
10,952,852
I'm looking to get the scale and precision from a number in the following example. `var x = 1234.567;` I'm not seeing any `.scale` or `.precision` functions built in and I'm not sure what the best way to right one is.
2012/06/08
[ "https://Stackoverflow.com/questions/10952852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/819662/" ]
You can use [Number.prototype.toFixed()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toFixed) ```js var x = 1234.56780123; x.toFixed(2); // output: 1234.57 x.toFixed(3); // output: 1234.568 x.toFixed(4); // output: 1234.5680 ```
Another advanced solution (if I correctly understand what you mean by *scale* and *precision*): ``` function getScaleAndPrecision(x) { x = parseFloat(x) + ""; var scale = x.indexOf("."); if (scale == -1) return null; return { scale : scale, precision : x.length - scale - 1 }; } var...
3,360,227
Suppose you draw two cards from a deck of 52 cards without replacement. 1) What is the probability that both cards are hearts? 2) What is the probability that exactly one of the cards is hearts? 3) What is the probability that none of the cards are hearts? I get that the first answer is 13/52 \* 12/51. For the...
2019/09/17
[ "https://math.stackexchange.com/questions/3360227", "https://math.stackexchange.com", "https://math.stackexchange.com/users/691317/" ]
You're missing something in part 2), namely that drawing a heart first and drawing a non-heart first are both allowed. You should multiply your answer by 2 since there are 2 ways of drawing exactly 1 heart: heart first, or non-heart first. Your other answers look fine.
You can see your question matches the following assumptions: 1. The result of each draw (the elements of the population being sampled) can be classified into one of two mutually exclusive categories (e.g. Hearts/No Hearts). 2. The probability of a success changes on each draw, as each draw decreases the population (sa...
20,713,076
In codeigniter, I have function to restrict controller, ``` private function controllerAccess(){ $sessionArray = $this->session->userdata('logged_in'); if($sessionArray['type'] == 'ADMIN' || $sessionArray['type'] == 'SUPERVISOR'){ return true; } else{ return false; } } ``` I am pr...
2013/12/20
[ "https://Stackoverflow.com/questions/20713076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3067928/" ]
A (non-anonymous) `mmap` is a link between a file and RAM that, roughly, guarantees that when RAM of the `mmap` is full, data will be paged to the given file instead of to the swap disk/file, and when you `msync` or `munmap` it, the whole region of RAM gets written out to the file. Operating systems typically follow a ...
As [the docs say](http://docs.scipy.org/doc/numpy/reference/generated/numpy.memmap.html): > > Memory-mapped files are used for accessing small segments of large files on disk, without reading the entire file into memory. > > > There's no true magic in computers ;-) If you access very little of a giant array, a me...
44,427
I'm developing an Android app and one screen (Favourites) is a `ListView` of items (bus stops); so, if the user select one stop he can do two things: * Send the arrival time for that stop * Eliminate the stop from favourites The first one is by far the most used. So, I think that my approach of showing always a dialo...
2013/09/01
[ "https://ux.stackexchange.com/questions/44427", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/25961/" ]
It's for feedback to the user. Without feedback of some sort, the user has no way of knowing the entry was accepted by the system except visually. In some cases, people still 'touch type' their entry and, without an audio feedback, they would be forced to look at the screen.
One possible answer is to understand the user's internal goal in a workspace. One of the goal is to show he is working. For instance, while writing this answer I'm sitting in my cube typing the words of the answer. It makes a lot of noise which makes me look like I'm working hard on something. If my keyboard didn't mak...
44,427
I'm developing an Android app and one screen (Favourites) is a `ListView` of items (bus stops); so, if the user select one stop he can do two things: * Send the arrival time for that stop * Eliminate the stop from favourites The first one is by far the most used. So, I think that my approach of showing always a dialo...
2013/09/01
[ "https://ux.stackexchange.com/questions/44427", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/25961/" ]
To begin with, not all keyboards and mice are designed to make a sound - some are designed for exactly the opposite, for obvious reasons. But to answer your question, there are 3 reasons, and the third one is by far the most important one. (I came across this topic while drifting off researching the mechanism of elec...
One possible answer is to understand the user's internal goal in a workspace. One of the goal is to show he is working. For instance, while writing this answer I'm sitting in my cube typing the words of the answer. It makes a lot of noise which makes me look like I'm working hard on something. If my keyboard didn't mak...
44,427
I'm developing an Android app and one screen (Favourites) is a `ListView` of items (bus stops); so, if the user select one stop he can do two things: * Send the arrival time for that stop * Eliminate the stop from favourites The first one is by far the most used. So, I think that my approach of showing always a dialo...
2013/09/01
[ "https://ux.stackexchange.com/questions/44427", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/25961/" ]
Because the people designing noisy keyboards are optimising for a different UX goal to you. Some keyboards are designed to be low noise. Using rubber domes under the keys to detect keypresses. Meanwhile other keyboards are designed to provide maximum feedback to the typist. These use a variety of mechanisms for feedb...
One possible answer is to understand the user's internal goal in a workspace. One of the goal is to show he is working. For instance, while writing this answer I'm sitting in my cube typing the words of the answer. It makes a lot of noise which makes me look like I'm working hard on something. If my keyboard didn't mak...
44,427
I'm developing an Android app and one screen (Favourites) is a `ListView` of items (bus stops); so, if the user select one stop he can do two things: * Send the arrival time for that stop * Eliminate the stop from favourites The first one is by far the most used. So, I think that my approach of showing always a dialo...
2013/09/01
[ "https://ux.stackexchange.com/questions/44427", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/25961/" ]
To begin with, not all keyboards and mice are designed to make a sound - some are designed for exactly the opposite, for obvious reasons. But to answer your question, there are 3 reasons, and the third one is by far the most important one. (I came across this topic while drifting off researching the mechanism of elec...
It's for feedback to the user. Without feedback of some sort, the user has no way of knowing the entry was accepted by the system except visually. In some cases, people still 'touch type' their entry and, without an audio feedback, they would be forced to look at the screen.
44,427
I'm developing an Android app and one screen (Favourites) is a `ListView` of items (bus stops); so, if the user select one stop he can do two things: * Send the arrival time for that stop * Eliminate the stop from favourites The first one is by far the most used. So, I think that my approach of showing always a dialo...
2013/09/01
[ "https://ux.stackexchange.com/questions/44427", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/25961/" ]
Because the people designing noisy keyboards are optimising for a different UX goal to you. Some keyboards are designed to be low noise. Using rubber domes under the keys to detect keypresses. Meanwhile other keyboards are designed to provide maximum feedback to the typist. These use a variety of mechanisms for feedb...
It's for feedback to the user. Without feedback of some sort, the user has no way of knowing the entry was accepted by the system except visually. In some cases, people still 'touch type' their entry and, without an audio feedback, they would be forced to look at the screen.
44,427
I'm developing an Android app and one screen (Favourites) is a `ListView` of items (bus stops); so, if the user select one stop he can do two things: * Send the arrival time for that stop * Eliminate the stop from favourites The first one is by far the most used. So, I think that my approach of showing always a dialo...
2013/09/01
[ "https://ux.stackexchange.com/questions/44427", "https://ux.stackexchange.com", "https://ux.stackexchange.com/users/25961/" ]
To begin with, not all keyboards and mice are designed to make a sound - some are designed for exactly the opposite, for obvious reasons. But to answer your question, there are 3 reasons, and the third one is by far the most important one. (I came across this topic while drifting off researching the mechanism of elec...
Because the people designing noisy keyboards are optimising for a different UX goal to you. Some keyboards are designed to be low noise. Using rubber domes under the keys to detect keypresses. Meanwhile other keyboards are designed to provide maximum feedback to the typist. These use a variety of mechanisms for feedb...
18,883,976
**Background** * Framework: Codeignighter/PyroCMS I have a DB that stores a list of products, I have a `duplicate function` in my application that first looks for the common product name so it can add a '`suffix`' value to the duplicated product. **Code in my Products model class** ```php $product = $this->get($id)...
2013/09/18
[ "https://Stackoverflow.com/questions/18883976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/692228/" ]
Let's do some testing about this. Here is what you are doing ``` $count = $this->db->like('name', $product->name)->get('products')->num_rows(); ``` And i suspect `$product->name` contains this. Harry's Book As we know this is coming from the database table as you are using. Where you are using the upper query men...
Try this, using `stripslashes()` around `$product->name`: ``` $count = $this->db->like('name', stripslashes($product->name))->get('products')->num_rows(); ``` CI automatically escapes characters with active records but I bet that it's already escaped if you entered it previously via active record in CI. So now it is...
18,883,976
**Background** * Framework: Codeignighter/PyroCMS I have a DB that stores a list of products, I have a `duplicate function` in my application that first looks for the common product name so it can add a '`suffix`' value to the duplicated product. **Code in my Products model class** ```php $product = $this->get($id)...
2013/09/18
[ "https://Stackoverflow.com/questions/18883976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/692228/" ]
Other answers didn't work for me, this does though: ``` $count = $this->db->query("SELECT * FROM `default_firesale_products` WHERE `title` LIKE '".addslashes($product['title'])."'")->num_rows(); ``` Whenever CI Active Record mangles your queries you can always just put a raw query in instead and have full control.
Try this, using `stripslashes()` around `$product->name`: ``` $count = $this->db->like('name', stripslashes($product->name))->get('products')->num_rows(); ``` CI automatically escapes characters with active records but I bet that it's already escaped if you entered it previously via active record in CI. So now it is...
18,883,976
**Background** * Framework: Codeignighter/PyroCMS I have a DB that stores a list of products, I have a `duplicate function` in my application that first looks for the common product name so it can add a '`suffix`' value to the duplicated product. **Code in my Products model class** ```php $product = $this->get($id)...
2013/09/18
[ "https://Stackoverflow.com/questions/18883976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/692228/" ]
Let's do some testing about this. Here is what you are doing ``` $count = $this->db->like('name', $product->name)->get('products')->num_rows(); ``` And i suspect `$product->name` contains this. Harry's Book As we know this is coming from the database table as you are using. Where you are using the upper query men...
Other answers didn't work for me, this does though: ``` $count = $this->db->query("SELECT * FROM `default_firesale_products` WHERE `title` LIKE '".addslashes($product['title'])."'")->num_rows(); ``` Whenever CI Active Record mangles your queries you can always just put a raw query in instead and have full control.
43,524,643
How to pad a `nvarchar` number with leading zeros and the first character is alpha. I have to concatenate an `id` to some leading characters to insert some records. The column type is `nvarchar 9`. sql server 2008r ``` A000000012 A000002212 A002322212 ```
2017/04/20
[ "https://Stackoverflow.com/questions/43524643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658837/" ]
If 2012+ you can use **Format()** ``` Select 'A'+format(12,'000000000') ``` Returns ``` A000000012 ```
What is the static part you need to pad? If it is `A00`, then: ``` Select 'A00' + CAST(Col_Number as varchar(50)) as 'New_string' From Table ```
43,524,643
How to pad a `nvarchar` number with leading zeros and the first character is alpha. I have to concatenate an `id` to some leading characters to insert some records. The column type is `nvarchar 9`. sql server 2008r ``` A000000012 A000002212 A002322212 ```
2017/04/20
[ "https://Stackoverflow.com/questions/43524643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658837/" ]
Using a bit of old school left padding for T-SQL: ``` select Id, 'A'+RIGHT(CONCAT(REPLICATE('0',8),Id),8) as PaddedId from YourTable; ```
What is the static part you need to pad? If it is `A00`, then: ``` Select 'A00' + CAST(Col_Number as varchar(50)) as 'New_string' From Table ```
43,524,643
How to pad a `nvarchar` number with leading zeros and the first character is alpha. I have to concatenate an `id` to some leading characters to insert some records. The column type is `nvarchar 9`. sql server 2008r ``` A000000012 A000002212 A002322212 ```
2017/04/20
[ "https://Stackoverflow.com/questions/43524643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658837/" ]
If 2012+ you can use **Format()** ``` Select 'A'+format(12,'000000000') ``` Returns ``` A000000012 ```
in Oracle: ``` select substr('A123',1,1) || substr('00000000',8-length('A123')) || substr('A123',2) from dual ```
43,524,643
How to pad a `nvarchar` number with leading zeros and the first character is alpha. I have to concatenate an `id` to some leading characters to insert some records. The column type is `nvarchar 9`. sql server 2008r ``` A000000012 A000002212 A002322212 ```
2017/04/20
[ "https://Stackoverflow.com/questions/43524643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658837/" ]
If 2012+ you can use **Format()** ``` Select 'A'+format(12,'000000000') ``` Returns ``` A000000012 ```
Using a bit of old school left padding for T-SQL: ``` select Id, 'A'+RIGHT(CONCAT(REPLICATE('0',8),Id),8) as PaddedId from YourTable; ```
43,524,643
How to pad a `nvarchar` number with leading zeros and the first character is alpha. I have to concatenate an `id` to some leading characters to insert some records. The column type is `nvarchar 9`. sql server 2008r ``` A000000012 A000002212 A002322212 ```
2017/04/20
[ "https://Stackoverflow.com/questions/43524643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658837/" ]
If 2012+ you can use **Format()** ``` Select 'A'+format(12,'000000000') ``` Returns ``` A000000012 ```
``` -- Sample data DECLARE @yourtable TABLE(somenumber int); INSERT @yourtable VALUES (12), (2212), (2322212); -- Solution 2012+ SELECT NewValue = CONCAT('A', REPLICATE('0', 9-LEN(somenumber)), somenumber) FROM @yourtable; -- Pre-SQL 2012 SELECT NewValue = 'A'+REPLICATE('0', 9-LEN(somenumber))+CAST(somenumber AS nvar...
43,524,643
How to pad a `nvarchar` number with leading zeros and the first character is alpha. I have to concatenate an `id` to some leading characters to insert some records. The column type is `nvarchar 9`. sql server 2008r ``` A000000012 A000002212 A002322212 ```
2017/04/20
[ "https://Stackoverflow.com/questions/43524643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658837/" ]
Using a bit of old school left padding for T-SQL: ``` select Id, 'A'+RIGHT(CONCAT(REPLICATE('0',8),Id),8) as PaddedId from YourTable; ```
in Oracle: ``` select substr('A123',1,1) || substr('00000000',8-length('A123')) || substr('A123',2) from dual ```
43,524,643
How to pad a `nvarchar` number with leading zeros and the first character is alpha. I have to concatenate an `id` to some leading characters to insert some records. The column type is `nvarchar 9`. sql server 2008r ``` A000000012 A000002212 A002322212 ```
2017/04/20
[ "https://Stackoverflow.com/questions/43524643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3658837/" ]
Using a bit of old school left padding for T-SQL: ``` select Id, 'A'+RIGHT(CONCAT(REPLICATE('0',8),Id),8) as PaddedId from YourTable; ```
``` -- Sample data DECLARE @yourtable TABLE(somenumber int); INSERT @yourtable VALUES (12), (2212), (2322212); -- Solution 2012+ SELECT NewValue = CONCAT('A', REPLICATE('0', 9-LEN(somenumber)), somenumber) FROM @yourtable; -- Pre-SQL 2012 SELECT NewValue = 'A'+REPLICATE('0', 9-LEN(somenumber))+CAST(somenumber AS nvar...
58,708,378
Here is my FirebaseDatabase Structure. [![Firebase Database](https://i.stack.imgur.com/arrjN.png)](https://i.stack.imgur.com/arrjN.png) > > How can I access this "1" value from firebase database (Image at Top) > > >
2019/11/05
[ "https://Stackoverflow.com/questions/58708378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12324650/" ]
The simplest way to get the value of your `alerts` property would be: ``` DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference(); DatabaseReference alertsRef = rootRef.child("Alert").child("1").child("alerts"); ValueEventListener valueEventListener = new ValueEventListener() { @Override publ...
mDatabase = FirebaseDatabase.getInstance().getReference(); mDatabase.child("elon\*\*").child("Alert").child("1").child("alert").child("1").setValue(xxxxx)
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
Obviously it's too late to answer, yet I'd like to add the following to the awesome answers above ```py dct = {"first": 1, "second": 2, "last": 3} first, *_, last = dct.items() print("*** Items ***") print("First Item:", first) print("Last Item:", last) first, *_, last = dct.keys() print("*** Keys ***") print("First...
There is no such thing as "first" or "last" key in dictionary, which does not guarantee any particular ordering. So there is **no possibility** to get "first" or "last" element. You can only create your own wrapper around python dict, which will store the information about "first" and "last" object Something like ```...
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
You can do it by using list(). ``` dir = dict() dir['Key-3'] = 'Value-3' # Added First Item dir['Key-2'] = 'Value-2' # Added Second Item dir['Key-4'] = 'Value-4' # Added Third Item dir['Key-1'] = 'Value-1' # Added Fourth Item lst = list(dir.items()) # For key & value # lst = list(dir.keys()) # Fo...
There is no such thing as "first" or "last" key in dictionary, which does not guarantee any particular ordering. So there is **no possibility** to get "first" or "last" element. You can only create your own wrapper around python dict, which will store the information about "first" and "last" object Something like ```...
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
Python dictionaries are unordered, so "first" and "last" isn't defined. Instead, you can sort your keys, and then access the element associated with the first and last key in your sorted set. EDIT: The OP clarified that by "first" and "last" he meant the order in which keys were added to the dictionary. `collections....
There is no such thing as "first" or "last" key in dictionary, which does not guarantee any particular ordering. So there is **no possibility** to get "first" or "last" element. You can only create your own wrapper around python dict, which will store the information about "first" and "last" object Something like ```...
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
Use an [`OrderedDict`](http://docs.python.org/2/library/collections.html#collections.OrderedDict), because a normal dictionary doesn't preserve the insertion order of its elements when traversing it. Here's how: ``` # import the right class from collections import OrderedDict # create and fill the dictionary d = Orde...
There is no such thing as "first" or "last" key in dictionary, which does not guarantee any particular ordering. So there is **no possibility** to get "first" or "last" element. You can only create your own wrapper around python dict, which will store the information about "first" and "last" object Something like ```...
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
Use an [`OrderedDict`](http://docs.python.org/2/library/collections.html#collections.OrderedDict), because a normal dictionary doesn't preserve the insertion order of its elements when traversing it. Here's how: ``` # import the right class from collections import OrderedDict # create and fill the dictionary d = Orde...
With OrderedDict you can use [iterators](https://docs.python.org/3.8/glossary.html#term-iterator) ``` d = OrderedDict(a=1, b=2, c=3) next(iter(d)) # returns 'a' next(reversed(d) # returns 'c' ```
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
Use an [`OrderedDict`](http://docs.python.org/2/library/collections.html#collections.OrderedDict), because a normal dictionary doesn't preserve the insertion order of its elements when traversing it. Here's how: ``` # import the right class from collections import OrderedDict # create and fill the dictionary d = Orde...
def dictionarySortingExample(yourDictionary): ``` #get all the keys and store them to a list allKeys = yourDictionary.keys() #sort the list of keys allKeysSorted = sorted(allKeys) #retrieve the first and last keys in the list firstKey = allKeysSorted[0] lastKey = allKeysSorted[-1] #retrive the values from the dicti...
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
Python dictionaries are unordered, so "first" and "last" isn't defined. Instead, you can sort your keys, and then access the element associated with the first and last key in your sorted set. EDIT: The OP clarified that by "first" and "last" he meant the order in which keys were added to the dictionary. `collections....
Obviously it's too late to answer, yet I'd like to add the following to the awesome answers above ```py dct = {"first": 1, "second": 2, "last": 3} first, *_, last = dct.items() print("*** Items ***") print("First Item:", first) print("Last Item:", last) first, *_, last = dct.keys() print("*** Keys ***") print("First...
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
Use an [`OrderedDict`](http://docs.python.org/2/library/collections.html#collections.OrderedDict), because a normal dictionary doesn't preserve the insertion order of its elements when traversing it. Here's how: ``` # import the right class from collections import OrderedDict # create and fill the dictionary d = Orde...
Python dictionaries are unordered, so "first" and "last" isn't defined. Instead, you can sort your keys, and then access the element associated with the first and last key in your sorted set. EDIT: The OP clarified that by "first" and "last" he meant the order in which keys were added to the dictionary. `collections....
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
If working with Python 3.6+ you can do a one liner: First: ``` list({'fist': 1, 'second': 2, 'last': 3}.items())[0] => ('first', 1) ``` Last: ``` list({'fist': 1, 'second': 2, 'third': 3}.items())[-1] => ('third', 1) ``` This is the case because Python 3.6+ default dictionary preserves insertion order. This is a...
Python dictionaries are unordered, so "first" and "last" isn't defined. Instead, you can sort your keys, and then access the element associated with the first and last key in your sorted set. EDIT: The OP clarified that by "first" and "last" he meant the order in which keys were added to the dictionary. `collections....
19,030,179
Before posting, I have already gone through [Access an arbitrary element in a dictionary in Python](https://stackoverflow.com/questions/3097866/python-access-to-first-element-in-dictionary), but I'm uncertain about this. I have a long dictionary and I've to get the values of its first and last keys. I can use `dict[di...
2013/09/26
[ "https://Stackoverflow.com/questions/19030179", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1162512/" ]
With OrderedDict you can use [iterators](https://docs.python.org/3.8/glossary.html#term-iterator) ``` d = OrderedDict(a=1, b=2, c=3) next(iter(d)) # returns 'a' next(reversed(d) # returns 'c' ```
You can do it by using list(). ``` dir = dict() dir['Key-3'] = 'Value-3' # Added First Item dir['Key-2'] = 'Value-2' # Added Second Item dir['Key-4'] = 'Value-4' # Added Third Item dir['Key-1'] = 'Value-1' # Added Fourth Item lst = list(dir.items()) # For key & value # lst = list(dir.keys()) # Fo...
6,052,092
My problem is that I want to return an xml file from server back to client and parsing it using ajax function of jquery. This is the code: Client: ``` $("#submit").click(function(){ $.ajax({ type: "POST", url: "search.php", data: "whatever", dataType: "xml", ...
2011/05/18
[ "https://Stackoverflow.com/questions/6052092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760111/" ]
Try this: `var data = $(xml).find('doctor').text()` In your example, 'xml' is not a jQuery object.
You need to parse this XML (I really don't understand why , but...), you can do it by do: ``` $(xml).find('doctor').text(); ``` Bye. :)
6,052,092
My problem is that I want to return an xml file from server back to client and parsing it using ajax function of jquery. This is the code: Client: ``` $("#submit").click(function(){ $.ajax({ type: "POST", url: "search.php", data: "whatever", dataType: "xml", ...
2011/05/18
[ "https://Stackoverflow.com/questions/6052092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760111/" ]
Try this: `var data = $(xml).find('doctor').text()` In your example, 'xml' is not a jQuery object.
You have to change your function to be: ``` $("#submit").click(function(){ $.ajax({ type: "POST", url: "search.php", data: "whatever", dataType: "xml", async: false, success: function(xml){ var xmlDoc; if (window.DOMParser) { ...
6,052,092
My problem is that I want to return an xml file from server back to client and parsing it using ajax function of jquery. This is the code: Client: ``` $("#submit").click(function(){ $.ajax({ type: "POST", url: "search.php", data: "whatever", dataType: "xml", ...
2011/05/18
[ "https://Stackoverflow.com/questions/6052092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760111/" ]
This is working fine **Post.php file** ``` if($_GET['id']!=""){ $array = array('satyam' => 'satyam', 'class' => 'B.TECH', 'company' => 'Ranosys'); } $new ='<?xml version="1.0" encoding="iso-8859-1"?><data>'; foreach($array as $key => $values){ $new .= "<$key>$...
Try this: `var data = $(xml).find('doctor').text()` In your example, 'xml' is not a jQuery object.
6,052,092
My problem is that I want to return an xml file from server back to client and parsing it using ajax function of jquery. This is the code: Client: ``` $("#submit").click(function(){ $.ajax({ type: "POST", url: "search.php", data: "whatever", dataType: "xml", ...
2011/05/18
[ "https://Stackoverflow.com/questions/6052092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760111/" ]
This is working fine **Post.php file** ``` if($_GET['id']!=""){ $array = array('satyam' => 'satyam', 'class' => 'B.TECH', 'company' => 'Ranosys'); } $new ='<?xml version="1.0" encoding="iso-8859-1"?><data>'; foreach($array as $key => $values){ $new .= "<$key>$...
You need to parse this XML (I really don't understand why , but...), you can do it by do: ``` $(xml).find('doctor').text(); ``` Bye. :)
6,052,092
My problem is that I want to return an xml file from server back to client and parsing it using ajax function of jquery. This is the code: Client: ``` $("#submit").click(function(){ $.ajax({ type: "POST", url: "search.php", data: "whatever", dataType: "xml", ...
2011/05/18
[ "https://Stackoverflow.com/questions/6052092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/760111/" ]
This is working fine **Post.php file** ``` if($_GET['id']!=""){ $array = array('satyam' => 'satyam', 'class' => 'B.TECH', 'company' => 'Ranosys'); } $new ='<?xml version="1.0" encoding="iso-8859-1"?><data>'; foreach($array as $key => $values){ $new .= "<$key>$...
You have to change your function to be: ``` $("#submit").click(function(){ $.ajax({ type: "POST", url: "search.php", data: "whatever", dataType: "xml", async: false, success: function(xml){ var xmlDoc; if (window.DOMParser) { ...
50,590,500
I have a Fragment which loads a DialogFragment. The DialogFragment that is loaded is a pop-over style that allows the user to choose a photo or take one from their camera. I have a onActivityResult method in my DialogFragment class, which I want to be called when they have taken the photo or selected it from the Galler...
2018/05/29
[ "https://Stackoverflow.com/questions/50590500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1268048/" ]
As the event is received in the **Activity** first, you need to then redirect it to your **Fragment**, so in your **Activity**: ``` @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Fragment yourChildFragment = get...
You don't need to use onActivityResult() in DialogFragment instead you can check for request code in main fragment onActivityResult() method like Start You intent like this: ``` startActivityForResult(intent, REQUEST_CODE); ``` and in onActivityResult() method check for request code: ``` protected void onActivityRe...
13,462,180
How can I display an image and string text from JSON in a listview? ``` // new HashMap HashMap<String, String> hashMap = new HashMap<String, String>(); String imageName = c.getString("avater"); URL url1 = new URL(imageName); HttpURLConnection connection = (HttpURLConnection) url1.openConnection(); InputStream is = c...
2012/11/19
[ "https://Stackoverflow.com/questions/13462180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1504340/" ]
I think knowing each class about others may not be good practice for you. In that way, your classes will become more and more dependent each other, which contradicts of the many design principles and breaks the modularity of your code. I would add another module for your log activity, giving the ability of knowing abo...
Some patterns where implemented in Log4Net (<http://logging.apache.org/log4net/release/features.html>) **Hierarchical logging architecture** Hierarchical logging is an ideal fit with component based development. Each component has its own of logger. When individually tested, the properties of these loggers may be set ...
13,462,180
How can I display an image and string text from JSON in a listview? ``` // new HashMap HashMap<String, String> hashMap = new HashMap<String, String>(); String imageName = c.getString("avater"); URL url1 = new URL(imageName); HttpURLConnection connection = (HttpURLConnection) url1.openConnection(); InputStream is = c...
2012/11/19
[ "https://Stackoverflow.com/questions/13462180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1504340/" ]
I think knowing each class about others may not be good practice for you. In that way, your classes will become more and more dependent each other, which contradicts of the many design principles and breaks the modularity of your code. I would add another module for your log activity, giving the ability of knowing abo...
How about wrapping each class with a logging decorator?
1,647,106
> > **Monotone Convergence Theorem** for general measure: > > > Let $(X,\Sigma,\mu)$ be a measure space. Let $f\_1, f\_2, ...$ be a pointwise non-decreasing sequence of $[0, \infty]$-valued $\Sigma-$measurable functions, i.e. for every $k\ge 1$ and every $x$ in $X$, $$0 \le f\_k(x) \le f\_{k+1}(x).$$ Next, set the p...
2016/02/09
[ "https://math.stackexchange.com/questions/1647106", "https://math.stackexchange.com", "https://math.stackexchange.com/users/108145/" ]
Well, if $f\_k$ could be negative, then its integral might not even be defined. For instance, if $X=\mathbb{R}$ with Lebesgue measure and $f\_k(x)=x$ for some $k$, there is no good way to define $\int f\_k$ (it should morally be "$\infty-\infty$"). On the other hand, the integral of a nonnegative measurable function ca...
If they could be negative, then the statement would also have to be true for any sequence $f\_n$ where $f\_n(x)\geq f\_{n+1}(x)$ by just reflecting across $0$. But then consider when $f\_n:[0,\infty]\rightarrow R, f\_n(x)=\frac{x}{n}$. In this case, for each $x$, $\lim\_n f\_n(x)=0$, and thus $f\_n \rightarrow f=0$ p...
26,712,236
Roughly speaking, I have an object `o` and a pointer to that object `po = &o`, which I serialize like this: ``` // Somewhere ar & o; // Somewhere else, but after somewhere ar & po; ``` When serializing `po`, Boost.Serialization should discover that it has already serialized `o` and not serialize `*po` again. I have...
2014/11/03
[ "https://Stackoverflow.com/questions/26712236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1734710/" ]
The code section in question is the `save_pointer()` function in [basic\_oarchive](http://www.boost.org/doc/libs/1_56_0/libs/serialization/src/basic_oarchive.cpp "basic_oarchive"). Boost.Serialization uses two characteristics to check whether an object has already been serialized: The object address and the object ty...
The assumption you make is that Boost Serialization tracks instances on references. This is a false assumption. AFAIR it tracks instances on pointers (and smart pointers). Similar things apply to runtime dynamic types of polymorphic classes.
807,889
![This is a screenshot of the problem I have and code I'm using.](https://s17.postimg.org/8v1ynmain/scheduling_problem.jpg) If anyone can give me any type of help on why I have negative numbers instead 40, which is what it should equal please help. I'd be so grateful. Thank You!
2014/09/05
[ "https://superuser.com/questions/807889", "https://superuser.com", "https://superuser.com/users/365465/" ]
You correctly have "Use 1904 data system" selected for the workbook, in File > Advanced > "When calculating this workbook" section (scroll down to the end). This is needed to allow times to calculate as negatives. (Try switching it off, and you will see the negs turn into all #s) But, in B16 and C16 for example the...
Your problem is when you go past midnight. Take for instance the first row on Friday, Saturday, and Sunday. Each day the ending time is 2:00 AM. For example on Friday, when you subtract the times, it takes 6:00 PM Friday minus 2:00 AM FRIDAY which is before the 6:00 PM. In order to avoid the negative, but still keep t...
807,889
![This is a screenshot of the problem I have and code I'm using.](https://s17.postimg.org/8v1ynmain/scheduling_problem.jpg) If anyone can give me any type of help on why I have negative numbers instead 40, which is what it should equal please help. I'd be so grateful. Thank You!
2014/09/05
[ "https://superuser.com/questions/807889", "https://superuser.com", "https://superuser.com/users/365465/" ]
The usual formula for going past 24 is: ``` =EndTime - StartTime +(EndTime < StartTime) ``` To combine all that into one formula, for summing all the days of the week, is awkward but doable. It requires an array-entered formula as you need to test each pair individually. The formula below makes use of your setup i...
Your problem is when you go past midnight. Take for instance the first row on Friday, Saturday, and Sunday. Each day the ending time is 2:00 AM. For example on Friday, when you subtract the times, it takes 6:00 PM Friday minus 2:00 AM FRIDAY which is before the 6:00 PM. In order to avoid the negative, but still keep t...
807,889
![This is a screenshot of the problem I have and code I'm using.](https://s17.postimg.org/8v1ynmain/scheduling_problem.jpg) If anyone can give me any type of help on why I have negative numbers instead 40, which is what it should equal please help. I'd be so grateful. Thank You!
2014/09/05
[ "https://superuser.com/questions/807889", "https://superuser.com", "https://superuser.com/users/365465/" ]
You correctly have "Use 1904 data system" selected for the workbook, in File > Advanced > "When calculating this workbook" section (scroll down to the end). This is needed to allow times to calculate as negatives. (Try switching it off, and you will see the negs turn into all #s) But, in B16 and C16 for example the...
The usual formula for going past 24 is: ``` =EndTime - StartTime +(EndTime < StartTime) ``` To combine all that into one formula, for summing all the days of the week, is awkward but doable. It requires an array-entered formula as you need to test each pair individually. The formula below makes use of your setup i...
807,889
![This is a screenshot of the problem I have and code I'm using.](https://s17.postimg.org/8v1ynmain/scheduling_problem.jpg) If anyone can give me any type of help on why I have negative numbers instead 40, which is what it should equal please help. I'd be so grateful. Thank You!
2014/09/05
[ "https://superuser.com/questions/807889", "https://superuser.com", "https://superuser.com/users/365465/" ]
You correctly have "Use 1904 data system" selected for the workbook, in File > Advanced > "When calculating this workbook" section (scroll down to the end). This is needed to allow times to calculate as negatives. (Try switching it off, and you will see the negs turn into all #s) But, in B16 and C16 for example the...
I had a similar issue calculating times that occasionally went past midnight with no day or date information. My start times were in the evening and would sometimes spill over into the next day, so I used a couple of formulas together to make it come out right for me: ``` =IF(D4< C4,TEXT(D4-C4+24,"h:mm"),TEXT(D4-C4,"h...
807,889
![This is a screenshot of the problem I have and code I'm using.](https://s17.postimg.org/8v1ynmain/scheduling_problem.jpg) If anyone can give me any type of help on why I have negative numbers instead 40, which is what it should equal please help. I'd be so grateful. Thank You!
2014/09/05
[ "https://superuser.com/questions/807889", "https://superuser.com", "https://superuser.com/users/365465/" ]
The usual formula for going past 24 is: ``` =EndTime - StartTime +(EndTime < StartTime) ``` To combine all that into one formula, for summing all the days of the week, is awkward but doable. It requires an array-entered formula as you need to test each pair individually. The formula below makes use of your setup i...
I had a similar issue calculating times that occasionally went past midnight with no day or date information. My start times were in the evening and would sometimes spill over into the next day, so I used a couple of formulas together to make it come out right for me: ``` =IF(D4< C4,TEXT(D4-C4+24,"h:mm"),TEXT(D4-C4,"h...
1,565,542
I want to show that $$1 + \frac{2n}{1!} + \frac{(2n)^2}{2!} + ... + \frac{(2n)^{n-1}}{(n-1)!} \le \frac{(2n)^n}{n!} $$ in order to apply Rouche's Theorem inside the disk $|z|<2n$. The solution gives a hint that says: use induction to show that $$1 + \frac{x}{1!} + \frac{(x)^2}{2!} + ... + \frac{(x)^{n-1}}{(n-1)!...
2015/12/08
[ "https://math.stackexchange.com/questions/1565542", "https://math.stackexchange.com", "https://math.stackexchange.com/users/296906/" ]
$\textbf{HINT:}$ Assume $$1 + \frac{x}{1!} + \frac{(x)^2}{2!} + ... + \frac{(x)^{n-1}}{(n-1)!} \le \frac{(x)^n}{n!} $$ is true for $n$ when $x\ge2n$. Now add $\frac{(x)^n}{n!}$ on both sides and prove that $$2\frac{(x)^n}{n!}\le\frac{(x)^{n+1}}{(n+1)!}.$$
$$ \frac{(2n+2)^{n+1}}{(n+1)!} = 2\frac{(2n+2)^n}{n!}\ge \frac{(2n+2)^n}{n!}+\frac{(2n+2)^{n-1}}{(n-1)!}+\dots+1 $$
28,525,078
I am running MongoDB on Webfaction as a database of a Django app . Problem is I have to keep my SSH terminal session open and use this syntax to keep running MongoDB . `mongod --dbpath ~/webapps/mongo_db/mongodb/ --port 31706` As soon as I close my terminal the connection to database dies . What is the solution to ke...
2015/02/15
[ "https://Stackoverflow.com/questions/28525078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4568529/" ]
WebFaction is a shared host, so you can't run `mongod` as a system service. Instead, use the `--fork` option when starting `mongod`, like so: ``` mongod --dbpath ~/webapps/mongo_db/mongodb/ --port 31706 --fork \ --logpath $HOME/logs/user/mongo_db.log ``` When you need to stop it, run: ``` mongod --dbpath ~/...
I could solve it with : mongod --dbpath ~/webapps/mongo\_db/mongodb/ --port 31706 --fork \ --logpath $HOME/logs/user/mongo\_db.log Also we can put a cron task to check it time to time .
60,851
If I were to win the lottery and the present winnings were less than twenty million paid out over a time period of twenty years, how would I theoretically find the present value amount?
2016/02/25
[ "https://money.stackexchange.com/questions/60851", "https://money.stackexchange.com", "https://money.stackexchange.com/users/39218/" ]
given your time frame I'm not sure if investing in a 529 is your best option. If you're investing in a 529 you may have to deal with market volatility and the amount you invest over the course of three years could be worth less than what you had initially invested when it comes to your child's college education. The m...
I'm not expert here, but a method used by quite a few people I went to school with was to save as much as possible before starting and continue to save as you go. Better explained, if you are able to save a years worth of tuition, or in a better case, save even more, you can pay as you, or in this case your child, att...
9,222,251
I hope the question is phrased well enough for someone to understand. I understand that main memory (RAM) and for Port I/O driven I/O, it has it's own Address Space that Instructions like IN, OUT use. If one were to write a real-mode assembler program, would it be up to the developer to have the necessary documentati...
2012/02/10
[ "https://Stackoverflow.com/questions/9222251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1201151/" ]
On an x86 pc the bios normally manages allocation of the flat/physical address space, and everything uses some place in that space. So the BIOS will "enumerate" the pcie devices by going out on each pcie slot to see if anyone is there. There are standard configuration registers that a pcie device must have some of whic...
*If one were to write a real-mode assembler program* ISRs are what you may be after (Interrupt Service Routines). ; This is a list of interrupt handler addresses stored in the first segment of memory. (segment 0000). Each interrupt number has a 4-byte handler address, segment and offset, to which a program wil...
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
You change position of elements in your list when you remove the first, so your code's behavior makes sense: e.g. ``` for (int i = -3; i < 3; i++) { set.add(i); list.add(i); } System.out.println("After adding elements:"); System.out.println(set + " " + list); for (int i = 0; i < 3; i++) { set.remove(i);...
No, the following line: ``` set.remove(i); ``` takes the int type you passed and boxes to Integer object ([see here](http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html)), then it uses Integer equals() method to determine which element has to be removed. It happens because there is no such method in Se...
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
You change position of elements in your list when you remove the first, so your code's behavior makes sense: e.g. ``` for (int i = -3; i < 3; i++) { set.add(i); list.add(i); } System.out.println("After adding elements:"); System.out.println(set + " " + list); for (int i = 0; i < 3; i++) { set.remove(i);...
``` [-3, -2, -1, 0, 1, 2] remove index 0 [-2, -1, 0, 1, 2] remove index 1 [-2, 0, 1, 2] remove index 2 [-2, 0, 2] ``` your positions in the list are changing with each remove. Just remove 3 times the position '0'.
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
You change position of elements in your list when you remove the first, so your code's behavior makes sense: e.g. ``` for (int i = -3; i < 3; i++) { set.add(i); list.add(i); } System.out.println("After adding elements:"); System.out.println(set + " " + list); for (int i = 0; i < 3; i++) { set.remove(i);...
In the case of `Set` you are specifying [the object to remove](http://docs.oracle.com/javase/6/docs/api/java/util/Set.html#remove%28java.lang.Object%29) and hence it actually **removes values** `0`, `1` and `2` from the set. Hence you get the remaining elements as result. In the case of `List` you are specifying [the ...
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
You change position of elements in your list when you remove the first, so your code's behavior makes sense: e.g. ``` for (int i = -3; i < 3; i++) { set.add(i); list.add(i); } System.out.println("After adding elements:"); System.out.println(set + " " + list); for (int i = 0; i < 3; i++) { set.remove(i);...
Ever imagined doing it functional programming way? //make sure you are adding static imports for both matcher and lambdaj to simulate below code ``` import static ch.lambdaj.Lambda.*; import static org.test.matcher.MatcherFactory.*; //this can be anything List<Integer> original = Arrays.asList(1,2,3,4,5,6); ...
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
No, the following line: ``` set.remove(i); ``` takes the int type you passed and boxes to Integer object ([see here](http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html)), then it uses Integer equals() method to determine which element has to be removed. It happens because there is no such method in Se...
``` [-3, -2, -1, 0, 1, 2] remove index 0 [-2, -1, 0, 1, 2] remove index 1 [-2, 0, 1, 2] remove index 2 [-2, 0, 2] ``` your positions in the list are changing with each remove. Just remove 3 times the position '0'.
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
No, the following line: ``` set.remove(i); ``` takes the int type you passed and boxes to Integer object ([see here](http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html)), then it uses Integer equals() method to determine which element has to be removed. It happens because there is no such method in Se...
In the case of `Set` you are specifying [the object to remove](http://docs.oracle.com/javase/6/docs/api/java/util/Set.html#remove%28java.lang.Object%29) and hence it actually **removes values** `0`, `1` and `2` from the set. Hence you get the remaining elements as result. In the case of `List` you are specifying [the ...
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
No, the following line: ``` set.remove(i); ``` takes the int type you passed and boxes to Integer object ([see here](http://docs.oracle.com/javase/tutorial/java/data/autoboxing.html)), then it uses Integer equals() method to determine which element has to be removed. It happens because there is no such method in Se...
Ever imagined doing it functional programming way? //make sure you are adding static imports for both matcher and lambdaj to simulate below code ``` import static ch.lambdaj.Lambda.*; import static org.test.matcher.MatcherFactory.*; //this can be anything List<Integer> original = Arrays.asList(1,2,3,4,5,6); ...
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
``` [-3, -2, -1, 0, 1, 2] remove index 0 [-2, -1, 0, 1, 2] remove index 1 [-2, 0, 1, 2] remove index 2 [-2, 0, 2] ``` your positions in the list are changing with each remove. Just remove 3 times the position '0'.
Ever imagined doing it functional programming way? //make sure you are adding static imports for both matcher and lambdaj to simulate below code ``` import static ch.lambdaj.Lambda.*; import static org.test.matcher.MatcherFactory.*; //this can be anything List<Integer> original = Arrays.asList(1,2,3,4,5,6); ...
16,635,063
It might be something obvious but not able to rationalise the output of this snippet. Reference: [this](https://github.com/marhan/effective-java-examples/blob/master/src/main/java/org/effectivejava/examples/chapter07/item41/SetList.java) ``` public class Sample { public static void main(String[] args) { S...
2013/05/19
[ "https://Stackoverflow.com/questions/16635063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1478852/" ]
In the case of `Set` you are specifying [the object to remove](http://docs.oracle.com/javase/6/docs/api/java/util/Set.html#remove%28java.lang.Object%29) and hence it actually **removes values** `0`, `1` and `2` from the set. Hence you get the remaining elements as result. In the case of `List` you are specifying [the ...
Ever imagined doing it functional programming way? //make sure you are adding static imports for both matcher and lambdaj to simulate below code ``` import static ch.lambdaj.Lambda.*; import static org.test.matcher.MatcherFactory.*; //this can be anything List<Integer> original = Arrays.asList(1,2,3,4,5,6); ...
30,613
Here's my situation : I currently am in a contractual job and my contract will end on September. From the time of this posting, I would only be available 2.5 months from now. I am already seeing good job postings that I want to apply to, but I'm worrying that it might be too early that when I do get to the offer sta...
2014/07/15
[ "https://workplace.stackexchange.com/questions/30613", "https://workplace.stackexchange.com", "https://workplace.stackexchange.com/users/22872/" ]
> > How early could you apply generally for jobs? > > > You can apply as early as you want. Keep in mind: * Some managers will want a replacement immediately * Some managers are looking to slowly build a team over a much longer period of time. They might prefer the right candidate and be willing to wait several ...
Well, the first thing you need to bear in mind is that there are numerous reasons why a company might have a job ad out there. Maybe someone has just resigned and they need to replace them. Maybe they need to bring in some new skills that they don't have in their current team. Maybe business is growing and they want to...
21,672,275
My requirement is to get the List of Diagnosis based on the most used Diagnosis. So, to achieve that I have added one Column named DiagnosisCounter in the tblDiagnosisMst Table of the database which increases by 1 for each Diagnosis the each time user selects it. So, my query is like below: ``` select DiagnosisID,Di...
2014/02/10
[ "https://Stackoverflow.com/questions/21672275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1680740/" ]
This should do the trick: ``` ;With Ordered as ( select DiagnosisID,DiagnosisCode,Name, ROW_NUMBER() OVER (ORDER BY DiagnosisCounter desc) as rn from tblDiagnosisMst where GroupName = 'Common' and RecStatus = 'A' ) select * from Ordered order by CASE WHEN rn <= 20 THEN rn ELSE 21 END, Name asc ``` We u...
Try this ``` SELECT TOP 20 * FROM tblDiagnosisMst ORDER BY DiagnosisCounter; ```
30,954,346
I am making a page that is extracting some information from the server and showing it on the interface. I am using angular js for this. So I have made a controller that has `$http.get()` method which gets data from the server and then the data binding is used to bind data to the html page. I am using this controller......
2015/06/20
[ "https://Stackoverflow.com/questions/30954346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4590956/" ]
I would suggest moving that code to a Service, then inject and use that service in each of the controllers where you need this functionality. Services are often the best place to add code that is shared between multiple controllers or if you need a mechanism to pass data betweeen controllers. Hope this helps!
Service/factory/value are meant for this , please refer the below example hope you get a better idea . ``` var app = angular.module('myApp',[]); //controller app.controller('myCtrl',myCtrl); //inject dependencies myCtrl.$inject = ["$scope","httpService"]; function myCtrl($scope,httpFactory){ $...
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
enclose the names within `back-ticks`
Hyphens in database names aren't good also. But you can use them with the backtick trick ` ``` `name-with-hyphen` ```
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
Do you have hyphens (-) or underscores (\_) in your column names? Hyphens are a big problem because if you end up mapping a column name to a variable, most languages do not like to have hyphens inside variable names. Perhaps you are using one of the Java libraries that automatically generates variables or objects who...
Hyphens in database names aren't good also. But you can use them with the backtick trick ` ``` `name-with-hyphen` ```
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
Hyphens in database names aren't good also. But you can use them with the backtick trick ` ``` `name-with-hyphen` ```
I had to create a db named pre-ca\_db. I solved the problem with ``` create database `pre-ca_db`; ``` Good luck!
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
enclose the names within `back-ticks`
It's better to not use hyphens in your column names. I suffered a big problem with JOIN statements where hyphens caused big trouble - there even escaping names in back ticks didn't work. Convert the column names to use underscores - this is the safest way to go. As an alternative - in case where even backticks should...
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
Do you have hyphens (-) or underscores (\_) in your column names? Hyphens are a big problem because if you end up mapping a column name to a variable, most languages do not like to have hyphens inside variable names. Perhaps you are using one of the Java libraries that automatically generates variables or objects who...
I had to create a db named pre-ca\_db. I solved the problem with ``` create database `pre-ca_db`; ``` Good luck!
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
Do you have hyphens (-) or underscores (\_) in your column names? Hyphens are a big problem because if you end up mapping a column name to a variable, most languages do not like to have hyphens inside variable names. Perhaps you are using one of the Java libraries that automatically generates variables or objects who...
[This entry](http://forums.mysql.com/read.php?103,129375,129375) at the MySQL forum suggests that you might have a problem. However, I think it's referring to data and not column names. [This](http://hockinson.com/index.php?s=36) says "don't do it." Don't know how authoritative it is.
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
Hyphens in database names aren't good also. But you can use them with the backtick trick ` ``` `name-with-hyphen` ```
[This entry](http://forums.mysql.com/read.php?103,129375,129375) at the MySQL forum suggests that you might have a problem. However, I think it's referring to data and not column names. [This](http://hockinson.com/index.php?s=36) says "don't do it." Don't know how authoritative it is.
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
Do you have hyphens (-) or underscores (\_) in your column names? Hyphens are a big problem because if you end up mapping a column name to a variable, most languages do not like to have hyphens inside variable names. Perhaps you are using one of the Java libraries that automatically generates variables or objects who...
It's better to not use hyphens in your column names. I suffered a big problem with JOIN statements where hyphens caused big trouble - there even escaping names in back ticks didn't work. Convert the column names to use underscores - this is the safest way to go. As an alternative - in case where even backticks should...
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
enclose the names within `back-ticks`
[This entry](http://forums.mysql.com/read.php?103,129375,129375) at the MySQL forum suggests that you might have a problem. However, I think it's referring to data and not column names. [This](http://hockinson.com/index.php?s=36) says "don't do it." Don't know how authoritative it is.
885,497
May be this question has been answered before but I couldn't find it. I am using a 2/3 yr old MySQL database which has hyphens in its column names. When I try to use these names from my Java code, the names are broken at the hyphen (e.g. air\_port becomes air) and thus are not found. I tried replacing hyphens to under...
2009/05/19
[ "https://Stackoverflow.com/questions/885497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78351/" ]
enclose the names within `back-ticks`
I had to create a db named pre-ca\_db. I solved the problem with ``` create database `pre-ca_db`; ``` Good luck!
164,132
While playing Hero Siege in the first area of the game, I suddenly got this achievement: > > **Odin's Spirit** > > > Activate a statue > > > I have no idea what I have done to deserve this, so I would like to know how you actually activate a statue and what exactly it does.
2014/04/13
[ "https://gaming.stackexchange.com/questions/164132", "https://gaming.stackexchange.com", "https://gaming.stackexchange.com/users/62277/" ]
You have to activate all the switches on the map, then a statue awakens and kills enemies. But not all levels have switches, so in some of them the statues are only decoration. The switches appear randomly on levels in Act V, which you need DLC for.
in the actual version statues spawn (randomly) after waves. the game tells you so - then you just have to find it. to activate it, you just have to be close to it for a second. it will give you a (permanent) buff. devil-statues may also give you a (permanent) de-buff. *but i am not really sure what "permanent" means ...
16,171,309
Let us say that I have two classes. Here is the relevant code for the first class called **Internet**: ``` public void doRequest() { string URL = "http://localhost:4000/HomePage.aspx"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL); request.Method = "POST"; request.ContentType ...
2013/04/23
[ "https://Stackoverflow.com/questions/16171309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1124249/" ]
You can use the keyword [return](http://msdn.microsoft.com/en-GB/library/1h3swy84.aspx) here (which will return void). I've actually used it twice, you have an empty if statement so I've rejigged it a little. ``` private void Button_LogIn_Click(object sender, RoutedEventArgs e) { Internet n...
You can catch exception, do something with it, and then rethrow it, so that no further code from this method will get executed. ``` try{ ... }catch(Exception ex){ // do something with ex throw; } ```
16,171,309
Let us say that I have two classes. Here is the relevant code for the first class called **Internet**: ``` public void doRequest() { string URL = "http://localhost:4000/HomePage.aspx"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL); request.Method = "POST"; request.ContentType ...
2013/04/23
[ "https://Stackoverflow.com/questions/16171309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1124249/" ]
You can use the keyword [return](http://msdn.microsoft.com/en-GB/library/1h3swy84.aspx) here (which will return void). I've actually used it twice, you have an empty if statement so I've rejigged it a little. ``` private void Button_LogIn_Click(object sender, RoutedEventArgs e) { Internet n...
``` try { net.doRequest(); } catch(Exception e) { if(e is WebException) { //handle appropriately return; //will exit the method } else throw; //good idea to throw unexpected exceptions anyway } ```
16,171,309
Let us say that I have two classes. Here is the relevant code for the first class called **Internet**: ``` public void doRequest() { string URL = "http://localhost:4000/HomePage.aspx"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL); request.Method = "POST"; request.ContentType ...
2013/04/23
[ "https://Stackoverflow.com/questions/16171309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1124249/" ]
You can use the keyword [return](http://msdn.microsoft.com/en-GB/library/1h3swy84.aspx) here (which will return void). I've actually used it twice, you have an empty if statement so I've rejigged it a little. ``` private void Button_LogIn_Click(object sender, RoutedEventArgs e) { Internet n...
The title is asking to stop execution and not returning from a function. So if you are not in the main function, and you don't want to throw an exception and then catch it again in main, you can use Environment.Exit() with an Exit code.. <https://msdn.microsoft.com/en-us/library/ms681382(v=vs.85)> ``` Environment.Exit...
16,171,309
Let us say that I have two classes. Here is the relevant code for the first class called **Internet**: ``` public void doRequest() { string URL = "http://localhost:4000/HomePage.aspx"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL); request.Method = "POST"; request.ContentType ...
2013/04/23
[ "https://Stackoverflow.com/questions/16171309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1124249/" ]
The title is asking to stop execution and not returning from a function. So if you are not in the main function, and you don't want to throw an exception and then catch it again in main, you can use Environment.Exit() with an Exit code.. <https://msdn.microsoft.com/en-us/library/ms681382(v=vs.85)> ``` Environment.Exit...
You can catch exception, do something with it, and then rethrow it, so that no further code from this method will get executed. ``` try{ ... }catch(Exception ex){ // do something with ex throw; } ```
16,171,309
Let us say that I have two classes. Here is the relevant code for the first class called **Internet**: ``` public void doRequest() { string URL = "http://localhost:4000/HomePage.aspx"; HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(URL); request.Method = "POST"; request.ContentType ...
2013/04/23
[ "https://Stackoverflow.com/questions/16171309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1124249/" ]
The title is asking to stop execution and not returning from a function. So if you are not in the main function, and you don't want to throw an exception and then catch it again in main, you can use Environment.Exit() with an Exit code.. <https://msdn.microsoft.com/en-us/library/ms681382(v=vs.85)> ``` Environment.Exit...
``` try { net.doRequest(); } catch(Exception e) { if(e is WebException) { //handle appropriately return; //will exit the method } else throw; //good idea to throw unexpected exceptions anyway } ```
3,390,770
Whats the best way to accomplish changing the timezone of an app? The way I see it the following must occur: 1. Server TZ is changed by sys admin 2. mysql must be restarted. 3. every time based column in the database must have all values updated, using convert\_tz or equivalent. So either a mysql script must be writte...
2010/08/02
[ "https://Stackoverflow.com/questions/3390770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305644/" ]
Java does not use time zones when using Dates; it stores everything as UTC and only uses time zones when displaying dates. see the following link for a discussion of java date/time. <http://www.odi.ch/prog/design/datetime.php> * If you're using the Date, Time, or DateTime column types in MySQL, time zone does not matt...
We had problems with time differences between using GORM and using groovy.sql.Sql (for quicker data import). GORM was using the grails config timezone (UTC) that we set in the Bootstrap, but groovy sql was using the default system timezone (GMT). The problem was solved by setting the timezone in the $JAVA\_OPTS, alth...
3,390,770
Whats the best way to accomplish changing the timezone of an app? The way I see it the following must occur: 1. Server TZ is changed by sys admin 2. mysql must be restarted. 3. every time based column in the database must have all values updated, using convert\_tz or equivalent. So either a mysql script must be writte...
2010/08/02
[ "https://Stackoverflow.com/questions/3390770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305644/" ]
Java does not use time zones when using Dates; it stores everything as UTC and only uses time zones when displaying dates. see the following link for a discussion of java date/time. <http://www.odi.ch/prog/design/datetime.php> * If you're using the Date, Time, or DateTime column types in MySQL, time zone does not matt...
I know this is an old question but I think it's also pretty timeless... at least, I have stumbled upon it a fair number of times recently... so I thought I would contribute my solution. First, I am using Grails 2.5.1 and PostgreSQL 9.4 as the backend. Second, Date fields in Groovy/Grails are stored as `timestamp with...
3,390,770
Whats the best way to accomplish changing the timezone of an app? The way I see it the following must occur: 1. Server TZ is changed by sys admin 2. mysql must be restarted. 3. every time based column in the database must have all values updated, using convert\_tz or equivalent. So either a mysql script must be writte...
2010/08/02
[ "https://Stackoverflow.com/questions/3390770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305644/" ]
I know this is an old question but I think it's also pretty timeless... at least, I have stumbled upon it a fair number of times recently... so I thought I would contribute my solution. First, I am using Grails 2.5.1 and PostgreSQL 9.4 as the backend. Second, Date fields in Groovy/Grails are stored as `timestamp with...
We had problems with time differences between using GORM and using groovy.sql.Sql (for quicker data import). GORM was using the grails config timezone (UTC) that we set in the Bootstrap, but groovy sql was using the default system timezone (GMT). The problem was solved by setting the timezone in the $JAVA\_OPTS, alth...
45,614,397
I plot the probability mass function of a binomial distribution with: ``` fig=plt.figure(figsize=(10,10)) binom=[scs.binom.pmf(k,100,0.2) for k in range(100)] print(np.max(binom)) #0.0993002148088 [plt.axvline(k,ymax=scs.binom.pmf(k,100,0.2)) for k in range(100)] plt.ylim(ymax=0.1) plt.show() ``` As you see the max...
2017/08/10
[ "https://Stackoverflow.com/questions/45614397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8144295/" ]
I think you may want to use a [`stem` plot](https://matplotlib.org/api/pyplot_api.html?highlight=matplotlib%20pyplot%20stem#matplotlib.pyplot.stem). ``` import matplotlib.pyplot as plt import numpy as np import scipy.stats as scs fig=plt.figure(figsize=(10,10)) binom=[scs.binom.pmf(k,100,0.2) for k in range(100)] #...
The problem is that [`axvline`](http://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.axvline.html#matplotlib.axes.Axes.axvline) accepts values in the range 0 to 1 for `ymax` (i.e. it is in axes coordinates, not data coordinates). From the docs: > > `ymax` : scalar, optional, default: 1 > > > Should be between 0 a...
7,072,389
Trying to learn Linq to EF in MVC3 project... Many to many relationship in Entity Framework: ``` Shirt ShirtType Type ----------- ------------- --------- **ShirtID** **ShirtID** **TypeID** ShirtName **TypeID** ...
2011/08/16
[ "https://Stackoverflow.com/questions/7072389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/776860/" ]
Assuming this is the query you want: > > return shirts that are referenced with type Type.Name==tName > > > And assuming your EF model and database is correct (hard to tell, since i can't see a screenshot of your EDMX or your FK's). You should have 2 entities on your EDMX - Shirt and Type. The join table will be...
When you load all the three entities to the edmx, the entity framework created two entities and not three: ``` A. Shirt - with scalar properties of ShirtID, ShirtName and ShirtPrice. with navigation property to many Types (IEnumerable<Type>). B. Type - with scalar properties of TypeID and TypeName. ...
26,351
I guess it is a pretty common feeling more or less everyone had at least once: Your boss is talking to you and you think "what would happen if I would just tell him to shut up". Very similar is the feeling of driving on a highway while thinking "what would happen if I would just drive my car into the oncoming traffic?"...
2017/06/28
[ "https://french.stackexchange.com/questions/26351", "https://french.stackexchange.com", "https://french.stackexchange.com/users/14154/" ]
Perhaps you're looking for *idée noire* > > (Figuré) Sentiment de déprime. [[wiktionary]](https://fr.wiktionary.org/wiki/id%C3%A9e_noire) > > > Exemple : > > La dépression s’accompagne souvent d’**idées noires**. Ces **idées noires** peuvent être liées à la personne elle-même ou à d’autres personnes. > > > Le...
The word you are looking for would be "autodestruction". If you do something that may have so negative effects on you, we would said that you do "autodestruction". The exact meaning is to destroy yourself, physically or psychologically.
26,351
I guess it is a pretty common feeling more or less everyone had at least once: Your boss is talking to you and you think "what would happen if I would just tell him to shut up". Very similar is the feeling of driving on a highway while thinking "what would happen if I would just drive my car into the oncoming traffic?"...
2017/06/28
[ "https://french.stackexchange.com/questions/26351", "https://french.stackexchange.com", "https://french.stackexchange.com/users/14154/" ]
The word (more a phrase) I was looking for is *L'appel du vide*. I found it on a webpage about "words that cannot be translated into another language". This [Wikipedia article](https://en.m.wikipedia.org/wiki/L%27appel_du_vide) defines it as > > the urge to engage in a self-destructive behavior during everyday life...
The word you are looking for would be "autodestruction". If you do something that may have so negative effects on you, we would said that you do "autodestruction". The exact meaning is to destroy yourself, physically or psychologically.
26,351
I guess it is a pretty common feeling more or less everyone had at least once: Your boss is talking to you and you think "what would happen if I would just tell him to shut up". Very similar is the feeling of driving on a highway while thinking "what would happen if I would just drive my car into the oncoming traffic?"...
2017/06/28
[ "https://french.stackexchange.com/questions/26351", "https://french.stackexchange.com", "https://french.stackexchange.com/users/14154/" ]
Perhaps you're looking for *idée noire* > > (Figuré) Sentiment de déprime. [[wiktionary]](https://fr.wiktionary.org/wiki/id%C3%A9e_noire) > > > Exemple : > > La dépression s’accompagne souvent d’**idées noires**. Ces **idées noires** peuvent être liées à la personne elle-même ou à d’autres personnes. > > > Le...
The word (more a phrase) I was looking for is *L'appel du vide*. I found it on a webpage about "words that cannot be translated into another language". This [Wikipedia article](https://en.m.wikipedia.org/wiki/L%27appel_du_vide) defines it as > > the urge to engage in a self-destructive behavior during everyday life...
26,351
I guess it is a pretty common feeling more or less everyone had at least once: Your boss is talking to you and you think "what would happen if I would just tell him to shut up". Very similar is the feeling of driving on a highway while thinking "what would happen if I would just drive my car into the oncoming traffic?"...
2017/06/28
[ "https://french.stackexchange.com/questions/26351", "https://french.stackexchange.com", "https://french.stackexchange.com/users/14154/" ]
Perhaps you're looking for *idée noire* > > (Figuré) Sentiment de déprime. [[wiktionary]](https://fr.wiktionary.org/wiki/id%C3%A9e_noire) > > > Exemple : > > La dépression s’accompagne souvent d’**idées noires**. Ces **idées noires** peuvent être liées à la personne elle-même ou à d’autres personnes. > > > Le...
Dans la question, le passage à l'acte n'est pas envisagé: les situations décrites sont juste des expériences de pensée. Sinon, j'aurais proposé *pensées suicidaires*.