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
36,645,664
I'm working in jquery i have done a counter but still has some problems when is on click it works but if i make double click in one item the counter still increase, so how can a menage my condition to be like to count the item in click but uncount in unclik here is my code so far:<http://codepen.io/xhepigerta/pen/GZx...
2016/04/15
[ "https://Stackoverflow.com/questions/36645664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4483286/" ]
Please try this ``` <script> $(document).ready(function() { var count=5; $( ".category-item-image" ).on("click", function(event){ $(this).find('a').toggleClass( "checked" ); $(this).find('.overaly,.checked-box').toggleClass( "checked" ); $('.topic-picker').css( "opacity", "1" ); ...
Use `click` event for increase counter ``` $( ".category-item-image" ).on("click", function(event){ count++ // will increase counter}); ``` use `dblclick` event for decrease counter ``` $( ".category-item-image" ).on("dblclick", function(event){ count-- // will decrease counter}); ```
36,645,664
I'm working in jquery i have done a counter but still has some problems when is on click it works but if i make double click in one item the counter still increase, so how can a menage my condition to be like to count the item in click but uncount in unclik here is my code so far:<http://codepen.io/xhepigerta/pen/GZx...
2016/04/15
[ "https://Stackoverflow.com/questions/36645664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4483286/" ]
Please try this ``` <script> $(document).ready(function() { var count=5; $( ".category-item-image" ).on("click", function(event){ $(this).find('a').toggleClass( "checked" ); $(this).find('.overaly,.checked-box').toggleClass( "checked" ); $('.topic-picker').css( "opacity", "1" ); ...
In simple terms you can call two functions in two different events. ``` function doubleCount() in ondblclick="doubleCount();" ``` and ``` function singleCount() in onClick="singleCount();" ``` Inside functions you can update your count.
36,645,664
I'm working in jquery i have done a counter but still has some problems when is on click it works but if i make double click in one item the counter still increase, so how can a menage my condition to be like to count the item in click but uncount in unclik here is my code so far:<http://codepen.io/xhepigerta/pen/GZx...
2016/04/15
[ "https://Stackoverflow.com/questions/36645664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4483286/" ]
Please try this ``` <script> $(document).ready(function() { var count=5; $( ".category-item-image" ).on("click", function(event){ $(this).find('a').toggleClass( "checked" ); $(this).find('.overaly,.checked-box').toggleClass( "checked" ); $('.topic-picker').css( "opacity", "1" ); ...
Update your function to this: ``` $(document).ready(function() { var count=4; $( ".category-item-image" ).one("click", function(event){ $(this).find('a').toggleClass( "checked" ); $(this).find('.overaly,.checked-box').toggleClass( "checked" ); $('.topic-picker').css( "opacity", "1" ); if(count>0){ ...
24,189
I am a beginner in piano, and I am currently learning names of keys and some movements. While moving, my little fingers and almost all the other fingers are not very smooth at pressing keys, and after sometime the whole fore arm starts to pain. Is there any specific or established exercise to get better at it, or wil...
2014/10/09
[ "https://music.stackexchange.com/questions/24189", "https://music.stackexchange.com", "https://music.stackexchange.com/users/13569/" ]
What it sounds like is you are suffering from tension and poor hand and arm position. Hopefully you have a piano teacher as they can help you. You are bit too early on the piano technique exercises. After you've advanced a bit more, there are some books you can purchase that have a multitude of exercises in them. Recom...
Learn the scales, backwards & forward, & practice all of them daily. Move at the speed you're comfortable with; as time progresses, you'll notice you're picking up speed. Take care to be precise & do not allow yourself to get sloppy with this.
24,189
I am a beginner in piano, and I am currently learning names of keys and some movements. While moving, my little fingers and almost all the other fingers are not very smooth at pressing keys, and after sometime the whole fore arm starts to pain. Is there any specific or established exercise to get better at it, or wil...
2014/10/09
[ "https://music.stackexchange.com/questions/24189", "https://music.stackexchange.com", "https://music.stackexchange.com/users/13569/" ]
What it sounds like is you are suffering from tension and poor hand and arm position. Hopefully you have a piano teacher as they can help you. You are bit too early on the piano technique exercises. After you've advanced a bit more, there are some books you can purchase that have a multitude of exercises in them. Recom...
You might consider hand exercising equipment because it's cheap, useful and can help you in a way playing cannot. Accuracy is developed by playing very slowly. "Ease" is the word you used. There's this really cool device which is technically known as either a "reverse crushing toner" or a hand abduction tensioner. The ...
24,189
I am a beginner in piano, and I am currently learning names of keys and some movements. While moving, my little fingers and almost all the other fingers are not very smooth at pressing keys, and after sometime the whole fore arm starts to pain. Is there any specific or established exercise to get better at it, or wil...
2014/10/09
[ "https://music.stackexchange.com/questions/24189", "https://music.stackexchange.com", "https://music.stackexchange.com/users/13569/" ]
Learn the scales, backwards & forward, & practice all of them daily. Move at the speed you're comfortable with; as time progresses, you'll notice you're picking up speed. Take care to be precise & do not allow yourself to get sloppy with this.
You might consider hand exercising equipment because it's cheap, useful and can help you in a way playing cannot. Accuracy is developed by playing very slowly. "Ease" is the word you used. There's this really cool device which is technically known as either a "reverse crushing toner" or a hand abduction tensioner. The ...
11,796,126
I currently run my own server "in the cloud" with PHP using mod\_fastcgi and mod\_vhost\_alias. My mod\_vhost\_alias config uses a VirtualDocumentRoot of /var/www/%0/htdocs so that I can serve any domain that routes to my server's IP address out of a directory with that name. I'd like to begin writing and serving some...
2012/08/03
[ "https://Stackoverflow.com/questions/11796126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40413/" ]
Here is some info that might help getting python working (Despite the title it's not Ubuntu specific): <http://infobees.wordpress.com/2011/05/15/python-cgi/> I think you might be confused here, as you seem to have the impression that a particular domain can only be either PHP or Python and you have to specify which...
Even I faced the same situation, and initially I was wondering in google but later realised and fixed it, I'm using EC2 service in aws with ubuntu and I created alias to php and python individually and now I can access both.
34,034,157
I'm using NatNet SDK to receiving data from the cameras through tcp connection. In their example code below, it can print the stream data using DataHandler function while waiting for a while(c=\_getchar()) loop. I have no idea why the code can both waiting for keyboard input and at the same time printing the camera's d...
2015/12/02
[ "https://Stackoverflow.com/questions/34034157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5473110/" ]
As far as I know save your data to a persistent storage is good answer for your question. Let's use SharedPreferences and BOOT\_COMPLETED as you said.
You can use database to save your data, any inconvenience?
34,034,157
I'm using NatNet SDK to receiving data from the cameras through tcp connection. In their example code below, it can print the stream data using DataHandler function while waiting for a while(c=\_getchar()) loop. I have no idea why the code can both waiting for keyboard input and at the same time printing the camera's d...
2015/12/02
[ "https://Stackoverflow.com/questions/34034157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5473110/" ]
As far as I know save your data to a persistent storage is good answer for your question. Let's use SharedPreferences and BOOT\_COMPLETED as you said.
You can use **static** variable. but it will destroy once your application destroy completely otherwise it will work fine, throughout the application
34,034,157
I'm using NatNet SDK to receiving data from the cameras through tcp connection. In their example code below, it can print the stream data using DataHandler function while waiting for a while(c=\_getchar()) loop. I have no idea why the code can both waiting for keyboard input and at the same time printing the camera's d...
2015/12/02
[ "https://Stackoverflow.com/questions/34034157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5473110/" ]
As far as I know save your data to a persistent storage is good answer for your question. Let's use SharedPreferences and BOOT\_COMPLETED as you said.
Android's [`Application`](https://developer.android.com/reference/android/app/Application.html) Object could replace your `DataHolder` Object. Class description > > Base class for those who need to maintain global application state. You can provide your own implementation by specifying its name in your AndroidManife...
34,034,157
I'm using NatNet SDK to receiving data from the cameras through tcp connection. In their example code below, it can print the stream data using DataHandler function while waiting for a while(c=\_getchar()) loop. I have no idea why the code can both waiting for keyboard input and at the same time printing the camera's d...
2015/12/02
[ "https://Stackoverflow.com/questions/34034157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5473110/" ]
As far as I know save your data to a persistent storage is good answer for your question. Let's use SharedPreferences and BOOT\_COMPLETED as you said.
There is 3 ways to store data in persistent storage in android 1.SharedPreference 2.database 3.File
529,911
I have tried every method I could find in the forums, and cannot display any 8-bit character in an xterm window, under kubuntu 18.04 (nor in earlier versions). All characters in range 0x20-0x7e display as expected, but none in range 0x80-0xfe. When I try, depending on the settings, I get either a blank or the default g...
2019/07/12
[ "https://unix.stackexchange.com/questions/529911", "https://unix.stackexchange.com", "https://unix.stackexchange.com/users/362141/" ]
You can use the bitwise operators present in the arithmetic expression: ``` result=$((a|b|c)) ``` (and similarly `&` for AND and `^` for XOR). The logical operators work in arithmetic expressions, too: ``` result=$((a||b||c)) ``` (and similarly `&&`). The assignment can be part of the expression itself (spaces ...
My variant how to define complex expression first and resolve later: ``` TIME=10#$(date +%H%M) DAY=$(date +%a) case $DAY in Mon|Tue|Wed|Thu|Fri) a=$(( 10#0110 < $TIME && $TIME < 10#0530 || 1630 < $TIME && $TIME < 1910 )) ;; Sat|Sun) a=$(( 10#0150 < $TIME && $TIME < 10#0650 || 1610 < $TIME && $TIME < 1...
52,857,350
I draw a boxplot and I want to draw a value at the same axies of boxplot with different color ``` boxplot(ov, las=1) par(new=TURE) plot(ma) ``` ov like this ``` [,1] [,2] [,3] [,4] [,5] [,6] A 46.6 33.7 39.4 34.4 37.7 32.0 B 49.6 40.9 42.4 34.4 37.7 49.8 C 55.3 33.8 54.8 34.4 52.2 37.9 D 40.6 35.8 36.3 34.3 4...
2018/10/17
[ "https://Stackoverflow.com/questions/52857350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8911320/" ]
The Java docs are correct that IANA, IATA, and Microsoft are sources of time zone information. However, though it may be possible for a `ZoneRulesProvider` to be created for each, to the best of my knowledge I don't believe there are any standard `ZoneRulesProvider` implementations for anything other than IANA data. On...
I found these threads relevant to your question although the questions themselves don't seem to be relevant. The accepted answers to these questions may shed a light to your question: [Extremely slow parsing of time zone with the new java.time API](https://stackoverflow.com/questions/34374464/extremely-slow-parsing-of...
492,902
I'm planning to build a low-power, value HTPC. I'm really undecided if I should go for an 80PLUS Bronze Seasonic PSU OR a laptop adapter from Cooler Master (Energy Star certified). SETUP 1. I go for the laptop adapter. I'd have to choose a special Intel mini-itx mobo (DH61AG) which is pretty expensive. Mini-itx mobo +...
2012/10/25
[ "https://superuser.com/questions/492902", "https://superuser.com", "https://superuser.com/users/167734/" ]
There is a misconception! Mini ITX does NOT necessarily consume less power than micro, or full-size ATX! This is just a form factor, nothing else. Theoretically, in some cases, it is still possible to use ~140W CPUs in miniITX motherboards, but in most cases this is not the situation. My personal opinion would be to g...
Nope, absolutely not. The biggest thing is going to be power draw, not power availability. If you were going to use the same cpu, gpu, memory, hdd ect for the system, and literally the only diff is the power supply(and subsequently, the mobo), id say go for the one that will provide you the best value. In this case, th...
1,478,433
Good morning, I wonder if : $$\sum\_{n} \frac{(-1)^n}{\varphi (n)}$$ converges or not. where $\varphi (n)$ is the Euler function. Do you have any idea ?
2015/10/13
[ "https://math.stackexchange.com/questions/1478433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
Here is another way of proof (but still the same idea): Since $\frac{-1()^n}{\varphi (n)}$ is bounded it is sufficient to prove that : $$S\_{4n}:= \sum\_{k=1}^n \left( -\frac{1}{\varphi (4k-3)}+\frac{1}{\varphi (4k-2)}-\frac{1}{\varphi (4k-1)}+\frac{1}{\varphi (4k)}\right)$$ does not converge. To do this, just rem...
The sum diverges. Here is my reasoning. $s =\sum\_{n} \frac{(-1)^n}{\varphi (n)} =\sum\_{n} \frac{1}{\varphi (2n)} -\sum\_{n} \frac{1}{\varphi (2n+1)} =s\_e-s\_o $. If $n$ is odd, $\phi(2n) =\phi(n) $. If $n$ is even, $n = 2^ab$, $\phi(2n) =\phi(2^{a+1})\phi(b) =(2^{a}-1)\phi(b) $. Therefore $\begin{array}\\ s\_e ...
1,478,433
Good morning, I wonder if : $$\sum\_{n} \frac{(-1)^n}{\varphi (n)}$$ converges or not. where $\varphi (n)$ is the Euler function. Do you have any idea ?
2015/10/13
[ "https://math.stackexchange.com/questions/1478433", "https://math.stackexchange.com", "https://math.stackexchange.com/users/-1/" ]
> > It diverges, and in this answer we'll calculate exact asymptotics. We have that $$\sum\_{n\leq x}\frac{(-1)^{n}}{\phi(n)}=\frac{\zeta(2)\zeta(3)}{3\zeta(6)}\log x+O(1)=\frac{105}{2\pi^{4}}\log x+O(1).$$ > > > Write the sum as $$\sum\_{n\leq x}\frac{(-1)^{n}}{\phi(n)}=\sum\_{n\leq x}\frac{1}{\phi(n)}-2\sum\_{\b...
The sum diverges. Here is my reasoning. $s =\sum\_{n} \frac{(-1)^n}{\varphi (n)} =\sum\_{n} \frac{1}{\varphi (2n)} -\sum\_{n} \frac{1}{\varphi (2n+1)} =s\_e-s\_o $. If $n$ is odd, $\phi(2n) =\phi(n) $. If $n$ is even, $n = 2^ab$, $\phi(2n) =\phi(2^{a+1})\phi(b) =(2^{a}-1)\phi(b) $. Therefore $\begin{array}\\ s\_e ...
35,236,116
I would like to override accessor of a javascript object so that instead of override it should return a fixed value. eg. ``` var obj = {}; console.log(obj.someProperty) //will print undefined expected value false ```
2016/02/06
[ "https://Stackoverflow.com/questions/35236116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1900923/" ]
You need to `break` the loop after you have found the matching planet name, otherwise the loop keeps searching, and the next name won't match so `code` is set to -1. Also: for efficiency and clarity: set `code = -1` before the loop and only set to `x` on a match: ``` code = -1; for (int x = 0; x < 8; x++) { if (p...
this if is fine. for example if you type mars, code will get value 3. But then in next step of loop you will set it again to -1 ;) Break the loop when result is found. Advice: Split this part of code to new function.
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
You may also try like this to execute shell script in PHP: ``` <?php echo shell_exec('sh ./convertpngtif.sh'); ?> ``` or ``` <?php $exec = file_get_contents("./convertpngtif.sh"); echo shell_exec($exec); ?> ```
How about using a **temporary target file**: ``` $source = dirname( __FILE__ ) . '/' . $pos.".png"; $target = tempnam( '/tmp/', 'tif-' ); rename( $target, $target . '.tif' ); $target .= '.tif'; $command = '/opt/local/bin/convert'; assert( file_exists( $command )); assert( file_exists( $source )); assert( is_readable...
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
I would use PHP imagemagick's interface for this. Something like this: ``` <?php $image = new Imagick( "image.png" ); $height=$image->getImageHeight()*1.5; // 150% size $width=$image->getImageWidth()*1.5; // 150% size $image->resizeImage( $width, $height, imagick::FILTER_LANCZOS, 1 ); $image->setImageFormat( "tif" )...
You may also try like this to execute shell script in PHP: ``` <?php echo shell_exec('sh ./convertpngtif.sh'); ?> ``` or ``` <?php $exec = file_get_contents("./convertpngtif.sh"); echo shell_exec($exec); ?> ```
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
See if you have correct permissions for write. In linux common username for Apache server is www-data In the console: ``` cd /var/www (or where you are saving your php files) ls -la (You will see permissions) sudo chown www-data:youruser thisfolder (change primary user to www-data and group to youruser) sudo chmod 7...
How about using a **temporary target file**: ``` $source = dirname( __FILE__ ) . '/' . $pos.".png"; $target = tempnam( '/tmp/', 'tif-' ); rename( $target, $target . '.tif' ); $target .= '.tif'; $command = '/opt/local/bin/convert'; assert( file_exists( $command )); assert( file_exists( $source )); assert( is_readable...
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
I would use PHP imagemagick's interface for this. Something like this: ``` <?php $image = new Imagick( "image.png" ); $height=$image->getImageHeight()*1.5; // 150% size $width=$image->getImageWidth()*1.5; // 150% size $image->resizeImage( $width, $height, imagick::FILTER_LANCZOS, 1 ); $image->setImageFormat( "tif" )...
See if you have correct permissions for write. In linux common username for Apache server is www-data In the console: ``` cd /var/www (or where you are saving your php files) ls -la (You will see permissions) sudo chown www-data:youruser thisfolder (change primary user to www-data and group to youruser) sudo chmod 7...
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
The clue is in Hieu Nguyen answer above: when you run from command line with `PHP -r`, it works. When you run in the browser, it doesn't. This leads to one of three possible issues. The critical thing to remember is that when you run exec, the script, user, path and working directory will be run with the same user/per...
See if you have correct permissions for write. In linux common username for Apache server is www-data In the console: ``` cd /var/www (or where you are saving your php files) ls -la (You will see permissions) sudo chown www-data:youruser thisfolder (change primary user to www-data and group to youruser) sudo chmod 7...
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
I would use PHP imagemagick's interface for this. Something like this: ``` <?php $image = new Imagick( "image.png" ); $height=$image->getImageHeight()*1.5; // 150% size $width=$image->getImageWidth()*1.5; // 150% size $image->resizeImage( $width, $height, imagick::FILTER_LANCZOS, 1 ); $image->setImageFormat( "tif" )...
How about using a **temporary target file**: ``` $source = dirname( __FILE__ ) . '/' . $pos.".png"; $target = tempnam( '/tmp/', 'tif-' ); rename( $target, $target . '.tif' ); $target .= '.tif'; $command = '/opt/local/bin/convert'; assert( file_exists( $command )); assert( file_exists( $source )); assert( is_readable...
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
This looks like a permission issue to me. First you need to debug your php call by using `system()` instead of `exec()` (to get the full output) on terminal: ``` php -r 'system("/opt/local/bin/convert -adaptive-resize 150% 1.png 1.tif");' ``` I bet then you will see the exact error. There are 2 cases in my opinion: ...
As far as i see, you're trying to use ImageMagick to do convert an image. PHP has an `Imagick` library which needs to be installed. If you have root access, you can easily do it, and use the imagick library wrapper functions to convert the image (no need to run command line). [Here is the documentation to php Imagick...
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
The clue is in Hieu Nguyen answer above: when you run from command line with `PHP -r`, it works. When you run in the browser, it doesn't. This leads to one of three possible issues. The critical thing to remember is that when you run exec, the script, user, path and working directory will be run with the same user/per...
I would use PHP imagemagick's interface for this. Something like this: ``` <?php $image = new Imagick( "image.png" ); $height=$image->getImageHeight()*1.5; // 150% size $width=$image->getImageWidth()*1.5; // 150% size $image->resizeImage( $width, $height, imagick::FILTER_LANCZOS, 1 ); $image->setImageFormat( "tif" )...
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
The clue is in Hieu Nguyen answer above: when you run from command line with `PHP -r`, it works. When you run in the browser, it doesn't. This leads to one of three possible issues. The critical thing to remember is that when you run exec, the script, user, path and working directory will be run with the same user/per...
You may also try like this to execute shell script in PHP: ``` <?php echo shell_exec('sh ./convertpngtif.sh'); ?> ``` or ``` <?php $exec = file_get_contents("./convertpngtif.sh"); echo shell_exec($exec); ?> ```
17,654,642
I'm trying to use the imagemagick command "convert" to create a .tif image from a .png one. What I've come with is: ``` $exec = "/opt/local/bin/convert -adaptive-resize 150% ".$pos.".png ".$pos.".tif"; exec($exec); ``` If I run into CLI "which convert" I get that path: `/opt/local/bin/convert` . I've also tried wit...
2013/07/15
[ "https://Stackoverflow.com/questions/17654642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1077321/" ]
The clue is in Hieu Nguyen answer above: when you run from command line with `PHP -r`, it works. When you run in the browser, it doesn't. This leads to one of three possible issues. The critical thing to remember is that when you run exec, the script, user, path and working directory will be run with the same user/per...
Consider using [php imagick](http://php.net/manual/en/book.imagick.php) instead of **exec** function.
20,329
In 2011 my partner and I abandoned a patent application after publishing because of spiraling costs, since then he has made another application with his new business partners in 2015 which is basically the same thing. Would I be correct saying that the first patent application is within the public domain and is free to...
2019/03/04
[ "https://patents.stackexchange.com/questions/20329", "https://patents.stackexchange.com", "https://patents.stackexchange.com/users/21895/" ]
Since it was published 4 years before the time the new application was filed and then abandoned with no patent related to the application issued or continuation filed, the information in the published application is usable a prior art against the 2015 application. With the same topic and a common inventor the examiner ...
If the second patent is claiming priority from your first application, and if the patent gets grant then it would be an issue. If the second application filed in 2015 doesn't claim priority from 2011 application then the part disclosed would be in public domain. But before going on with the use consider consulting ...
47,546,835
How can I secure my site from `http://my_site` to `https://my_site` I am running Apache Tomcat and I have the AWS Certificate and Elastic Load Balancer having my EC2 instance.
2017/11/29
[ "https://Stackoverflow.com/questions/47546835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5951039/" ]
Essentially you cannot add Amazon issued certificates to Tomcat: you cannot retrieve the private key of the certificate. However, you can deploy the certificate on ELB (elastic load balancer). You have to ensure that ELB is listening on port 443. You will find step by step instructions on AWS documentation (<http://d...
Apparently you can download your private certificate's keys now - <https://docs.aws.amazon.com/acm/latest/userguide/export-private.html>
36,020,450
I was trying to use [hammerspoon](http://www.hammerspoon.org/) to control my windows (on MAC OSX) but was having some issue. Straight from the [getting started](http://www.hammerspoon.org/go/#winresize) page I copied the code for moving the focused window left: ``` hs.hotkey.bind({"cmd", "alt", "ctrl"}, "Left", functi...
2016/03/15
[ "https://Stackoverflow.com/questions/36020450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1601580/" ]
You need to `lookahead` negative for presence of `p` i.e absence of `p` **Regex:** `\d{4}(?!p)` [Regex101 Demo](https://regex101.com/r/lA5aO3/1)
`/(\d{4})(?!p)/` will capture all groups of four digits that aren’t followed by the character `p`. The `{}` is a [quantifier](http://www.regular-expressions.info/repeat.html) that allows you to specify a minimum, maximum, or exact number of repetitions and the `(?!)` is a special non-capturing group called a [“negative...
72,148,599
No matter what I do the pictures are not showing up. Even if I set the items to match parent, I still have the same problem, I've been dealing with it since the morning, if I find it, I will relax very well :D This is my adapter for viewpager 2 : ``` class ViewPagerAdapter ( private val context : Context , priva...
2022/05/07
[ "https://Stackoverflow.com/questions/72148599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16317259/" ]
If I understand your [real problem](https://xyproblem.info/) correctly, you want to do simply: **XSLT 2.0** ``` <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method='text' encoding='utf-8' /> <xsl:template match="root"> { "entityList": [ <xsl:...
Thank you @michael.hor257k for you help. This is how I went about it ```js <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" omit-xml-declaration="yes"/> <xsl:template match="root"> { "entityList": ...
45,739,781
I have a pretty typical RDD scenario where I gather some data, persist it, and then use the persisted RDD multiple times for various transforms. Persisting speeds things up by an order of magnitude, so persisting is definitely warranted. But I'm surprised at the relative speed of the different methods of persisting. ...
2017/08/17
[ "https://Stackoverflow.com/questions/45739781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/139794/" ]
After doing some research into the Internet Explorer docs, I found that there is a parentNode accessor which will work in Firefox/Chrome/Opera and Explorer. ``` var newCategory = articles[i].parentNode.nodeName; ```
I had a similar problem. Try using `.nodeValue` instead of `.nodeName`. ``` var newCategory = articles[i].parentElement.nodeValue; ```
3,380,489
G'day, I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: ``` gl.glBufferSubData(GL11.GL_ARRAY_BU...
2010/08/01
[ "https://Stackoverflow.com/questions/3380489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158121/" ]
To answer your question directly, put `r` in front of the string. ``` final= path + r'\xulrunner.exe ' + path + r'\application.ini' ``` But a better solution would be `os.path.join`: ``` final = os.path.join(path, 'xulrunner.exe') + ' ' + \ os.path.join(path, 'application.ini') ``` (the backslash there i...
You can escape the slash. Use `\\` and you get just one slash.
3,380,489
G'day, I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: ``` gl.glBufferSubData(GL11.GL_ARRAY_BU...
2010/08/01
[ "https://Stackoverflow.com/questions/3380489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158121/" ]
To answer your question directly, put `r` in front of the string. ``` final= path + r'\xulrunner.exe ' + path + r'\application.ini' ``` But a better solution would be `os.path.join`: ``` final = os.path.join(path, 'xulrunner.exe') + ' ' + \ os.path.join(path, 'application.ini') ``` (the backslash there i...
You can escape the backslash with another backslash (`\\`), but it won’t look nicer. To solve that, put an `r` in front of the string to signal a [*raw string*](https://stackoverflow.com/questions/2081640). A raw string will ignore **all** escape sequences, treating backslashes as literal text. It [cannot contain the c...
3,380,489
G'day, I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: ``` gl.glBufferSubData(GL11.GL_ARRAY_BU...
2010/08/01
[ "https://Stackoverflow.com/questions/3380489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158121/" ]
To answer your question directly, put `r` in front of the string. ``` final= path + r'\xulrunner.exe ' + path + r'\application.ini' ``` But a better solution would be `os.path.join`: ``` final = os.path.join(path, 'xulrunner.exe') + ' ' + \ os.path.join(path, 'application.ini') ``` (the backslash there i...
Another simple (and arguably more readable) approach is using string raw format and replacements like so: ``` import os path = os.getcwd() final = r"{0}\xulrunner.exe {0}\application.ini".format(path) print(final) ``` or using the os path method (and a microfunction for readability): ``` import os def add_cwd(path...
3,380,489
G'day, I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: ``` gl.glBufferSubData(GL11.GL_ARRAY_BU...
2010/08/01
[ "https://Stackoverflow.com/questions/3380489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158121/" ]
You can escape the slash. Use `\\` and you get just one slash.
You can escape the backslash with another backslash (`\\`), but it won’t look nicer. To solve that, put an `r` in front of the string to signal a [*raw string*](https://stackoverflow.com/questions/2081640). A raw string will ignore **all** escape sequences, treating backslashes as literal text. It [cannot contain the c...
3,380,489
G'day, I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: ``` gl.glBufferSubData(GL11.GL_ARRAY_BU...
2010/08/01
[ "https://Stackoverflow.com/questions/3380489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158121/" ]
You can escape the slash. Use `\\` and you get just one slash.
Another simple (and arguably more readable) approach is using string raw format and replacements like so: ``` import os path = os.getcwd() final = r"{0}\xulrunner.exe {0}\application.ini".format(path) print(final) ``` or using the os path method (and a microfunction for readability): ``` import os def add_cwd(path...
3,380,489
G'day, I'm trying to update part of a VBO with a call to glBufferSubData(). When I update from the start (0) of my existing shadow buffer, there is no problem, as the buffer starts reading from 0. The following will read 0 to y from the buffer and place it at 0 to y in the VBO: ``` gl.glBufferSubData(GL11.GL_ARRAY_BU...
2010/08/01
[ "https://Stackoverflow.com/questions/3380489", "https://Stackoverflow.com", "https://Stackoverflow.com/users/158121/" ]
You can escape the backslash with another backslash (`\\`), but it won’t look nicer. To solve that, put an `r` in front of the string to signal a [*raw string*](https://stackoverflow.com/questions/2081640). A raw string will ignore **all** escape sequences, treating backslashes as literal text. It [cannot contain the c...
Another simple (and arguably more readable) approach is using string raw format and replacements like so: ``` import os path = os.getcwd() final = r"{0}\xulrunner.exe {0}\application.ini".format(path) print(final) ``` or using the os path method (and a microfunction for readability): ``` import os def add_cwd(path...
3,684,035
Just starting learning about ajax requests using jQuery. I've tried looking at other posts on this but not sure how to implement it. Here's the code I have. Right now it's just getting the first 3 items. I want it to get 3 random items from the rss feed it's pulling. Here's what I have: ``` jQuery(document).ready(fun...
2010/09/10
[ "https://Stackoverflow.com/questions/3684035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430048/" ]
you could use the [shuffle-plugin](http://plugins.jquery.com/project/shuffle) to shuffle your array. the code would be something like: ``` var myresults = $('item', d).shuffle(); myresults.slice(0, 3).each(function() { // ... } ```
**If you only want 3 items, your server should only return 3 items.** Non-the-less, if you want to achieve this with JavaScript: ``` jQuery.fn.random = function (amount) { var els = this.get(); var ret = []; while (els.length && ret.length < amount) { ret.push(els.splice(Math.floor(Math.random() * els.leng...
3,684,035
Just starting learning about ajax requests using jQuery. I've tried looking at other posts on this but not sure how to implement it. Here's the code I have. Right now it's just getting the first 3 items. I want it to get 3 random items from the rss feed it's pulling. Here's what I have: ``` jQuery(document).ready(fun...
2010/09/10
[ "https://Stackoverflow.com/questions/3684035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430048/" ]
I'd use something like [*filter()*](http://api.jquery.com/filter/), rather than *slice()*, after generating 3 unique numbers in your range: ``` var rnd1, rnd2, rnd3, undef, items = $('item', d); // Generate our random numbers: rnd1 = Math.floor(Math.random()*items.length); while (rnd2 == undef || rnd2 == rnd1) ...
**If you only want 3 items, your server should only return 3 items.** Non-the-less, if you want to achieve this with JavaScript: ``` jQuery.fn.random = function (amount) { var els = this.get(); var ret = []; while (els.length && ret.length < amount) { ret.push(els.splice(Math.floor(Math.random() * els.leng...
5,303,726
I am developing a website to show information about a website like ip, location, coordinates, flag of country, dns entries and more. I managed to collect everything, but the only thing left is to find who is hosting the website. I saw in whoishostingthis.com that you could find the name of datacenter or host of any do...
2011/03/14
[ "https://Stackoverflow.com/questions/5303726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/650785/" ]
The best way to get this is by going to the source: [ARIN](https://www.arin.net/knowledge/database.html) Of course, you can only make educated guesses. Often times, the holder of the IP block will be some bigger ISP that your hosting provider connects to.
I own WhoIsHostingThis.com. We have an API... <http://www.whoishostingthis.com/our-api/> ...so PM me/meail me and we'll get you setup ASAP. Richard
5,303,726
I am developing a website to show information about a website like ip, location, coordinates, flag of country, dns entries and more. I managed to collect everything, but the only thing left is to find who is hosting the website. I saw in whoishostingthis.com that you could find the name of datacenter or host of any do...
2011/03/14
[ "https://Stackoverflow.com/questions/5303726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/650785/" ]
The best way to get this is by going to the source: [ARIN](https://www.arin.net/knowledge/database.html) Of course, you can only make educated guesses. Often times, the holder of the IP block will be some bigger ISP that your hosting provider connects to.
``` <?php function ipwhois(){ $ip_info = 'https://ipwhois.app/json/'.$_SERVER['REMOTE_ADDR']; $ch = curl_init();curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch); curl_close($ch); } $org = strtolower(json_decode(ipwhois())->org); echo $org;...
5,303,726
I am developing a website to show information about a website like ip, location, coordinates, flag of country, dns entries and more. I managed to collect everything, but the only thing left is to find who is hosting the website. I saw in whoishostingthis.com that you could find the name of datacenter or host of any do...
2011/03/14
[ "https://Stackoverflow.com/questions/5303726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/650785/" ]
I own WhoIsHostingThis.com. We have an API... <http://www.whoishostingthis.com/our-api/> ...so PM me/meail me and we'll get you setup ASAP. Richard
``` <?php function ipwhois(){ $ip_info = 'https://ipwhois.app/json/'.$_SERVER['REMOTE_ADDR']; $ch = curl_init();curl_setopt($ch, CURLOPT_URL, $host); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); return curl_exec($ch); curl_close($ch); } $org = strtolower(json_decode(ipwhois())->org); echo $org;...
15,079,442
I am new to both Python and Git. I am in the process of writing a Python script which needs to do the same action as done by running the below git command from my workspace on a Linux server. (i.e. /local/mnt/workspace/) ``` git clone git://git.xyz.com/platform/manifest.git -b jb_2.5 ``` I tried using Fab library ho...
2013/02/26
[ "https://Stackoverflow.com/questions/15079442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1429246/" ]
You can define a git function that allows you to make calls to git. Limiting the user to git commands is important for security purposes; otherwise asking for a git url and using other techniques could result in loss of data or other malicious attacks. ``` import subprocess def git(*args): return subprocess.check...
You can either shell out (via `os.system` or `subprocess`) or use the [GitPython](https://gitpython.readthedocs.io/en/stable/) package.
15,079,442
I am new to both Python and Git. I am in the process of writing a Python script which needs to do the same action as done by running the below git command from my workspace on a Linux server. (i.e. /local/mnt/workspace/) ``` git clone git://git.xyz.com/platform/manifest.git -b jb_2.5 ``` I tried using Fab library ho...
2013/02/26
[ "https://Stackoverflow.com/questions/15079442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1429246/" ]
You can either shell out (via `os.system` or `subprocess`) or use the [GitPython](https://gitpython.readthedocs.io/en/stable/) package.
Since you didn't show what the error was beyond "didn't work", it's hard to guess what exactly your problem was. But I'm guessing the problem is that `import git` raised an `ImportError`, because you never installed the `git` module that you're trying to use. If so, the exact same readme document that told you how to...
15,079,442
I am new to both Python and Git. I am in the process of writing a Python script which needs to do the same action as done by running the below git command from my workspace on a Linux server. (i.e. /local/mnt/workspace/) ``` git clone git://git.xyz.com/platform/manifest.git -b jb_2.5 ``` I tried using Fab library ho...
2013/02/26
[ "https://Stackoverflow.com/questions/15079442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1429246/" ]
You can define a git function that allows you to make calls to git. Limiting the user to git commands is important for security purposes; otherwise asking for a git url and using other techniques could result in loss of data or other malicious attacks. ``` import subprocess def git(*args): return subprocess.check...
Since you didn't show what the error was beyond "didn't work", it's hard to guess what exactly your problem was. But I'm guessing the problem is that `import git` raised an `ImportError`, because you never installed the `git` module that you're trying to use. If so, the exact same readme document that told you how to...
59,856,947
I'm using react-admin(3.1.2) and I'm implementing a "Save and Add" button to allow bulk creation, as documented [here](https://marmelab.com/react-admin/CreateEdit.html#toolbar). I'm trying to prefill **certain** fields on the next create form based on the inputs of the previous form. How could I achieve that? **Sand...
2020/01/22
[ "https://Stackoverflow.com/questions/59856947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2115451/" ]
To pre-fill some fields in the Create form, pass a stringified `source` parameter in the url. You can set this URL in the `SaveButton` redirect *function*: ``` redirect={(redirectTo, basePath, is, data) => `/posts/create?source={"title":"${data.title}"}`} ```
My two cents: I found out that if I change the **record** object of **props** (props.record) I can manipulate the content of the field I want to set. The problem is that **record** is read only and it is **null** so I couldn't manipulate its properties. My solution was to add the following line before `<Create {...pr...
18,269,434
I've got a map with a center that I've set – and when I ask the map to return the center, it returns the same values. However the map is zooming in on the only pin I have at the moment. I want the map to zoom out to the same place, no matter where the pins are. Context: the map lists locations in a country. At the mo...
2013/08/16
[ "https://Stackoverflow.com/questions/18269434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/790884/" ]
You cannot specify the country in setCenter of google maps because it will always focus on the specific coordinates. If you want the zoom to center a country, you will have a database of country boundaries (as coordinates) used together with fitBounds and [LatLngBounds](https://developers.google.com/maps/documentation...
As you haven't shared any code I'm guessing you are doing something like this. ``` var bounds = new google.maps.LatLngBounds (); bounds.extend (LATLNG); map.fitBounds(bounds); ``` This will add all points to the bounds and ensure that the zoom level is such to accommodate all the points. In your case it would zoom o...
43,714,883
Below mentioned are my textField delegate methods, I am using IQKeyBoardSwift for inteligent keyboard. I tried removing my keyboard but still I am not receiving call on any of my method accept 'begins touch' ``` func textFieldShouldReturn(textField: UITextField) -> Bool { if textField == textField { textF...
2017/05/01
[ "https://Stackoverflow.com/questions/43714883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5598732/" ]
**Adding :** Add protocol `UITextFieldDelegate` and try to replace `textField1?.delegate = self as UITextFieldDelegate` **Replace** This **doesn't** work: ``` func textFieldDidBeginEditing(textField: UITextField) { } ``` **This works**: ``` func textFieldDidBeginEditing(_textField: UITextField) { } ``` **Fo...
Adding textFiled delegate : ``` class ViewController: UIViewController , UITextFieldDelegate{ ``` Yes, Its Not Call because of your delegate is OLD swift version. Replace it Swift 3 code. ``` func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool{ if textField == textField { textFIeld2.become...
55,916,255
I'm new to erlang, I can't figure out how to solve this exercise. I need to reverse a long string by partitioning it in N substrings, reverse the single substrings and then join them to obtain the reverse of the original string. Each substring need to be reversed by a different process. My problems are: 1) How t...
2019/04/30
[ "https://Stackoverflow.com/questions/55916255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2296532/" ]
Try something like this. ``` -module(stackoverflow). -export([reverse/2, join/0, sub_reverse/2]). reverse(Str, N) -> % A process joining the reversed substrings. JoinPID = spawn(stackoverflow, join, []), % The step size is the length of Str divided by N. % TODO Handle remainder. Step = string:len...
Here's my version after the answer: ``` -module(reverse). -export([reverse/1, join/3, sub_reverse/3]). reverse("") -> ""; reverse(Str) -> Step = ceil(string:length(Str) / 10), SplitPoints = lists:seq(0, string:length(Str) - 1, Step), JoinPid = spawn(reverse, join, [self(), [], length(SplitPoints)]), ...
231,368
First time posting, so please advise if and where I'm braking protocols. Here is the question I was given: A particle travels with acceleration given by $a(t)=(2e^{-t})i+(5\cos{t})j-(3\sin{t})k$. When the particle is located at $(1,-3,2)$ at time $t=0$ and is moving with a velocity given by $v(t)=4i-3j+2k$, find the ...
2016/01/24
[ "https://physics.stackexchange.com/questions/231368", "https://physics.stackexchange.com", "https://physics.stackexchange.com/users/104873/" ]
Yes, you are right that velocity is the integral of acceleration, and displacement is in turn the integral of velocity. The reason that you were given those points is that when you integrate, you get a +C constant. You can find the value of that constant by plugging in those points for velocity and position at time t=0...
Please do the integrations component wise . Then you will get the components of velocity and displacement by integrating the components of acceleration consecutively. And I think you know how to find those integration constants from the boundary conditions
66,918,209
I have a command that sends a DM to user and the user is defined like this: ```js let user; if (message.mentions.users.first()) { user = message.mentions.users.first(); } else if (args[0]) { user = message.guild.members.cache.get(args[0]).user; } ``` But if I ping a user that is not in th...
2021/04/02
[ "https://Stackoverflow.com/questions/66918209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15037320/" ]
Instead of looking for the members with `message.guild.members` and then get the user from there, you could get the [`client.users`](https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=users) and check if a user with the `args[0]` ID exists. If it doesn't exist, you can simply check `if (!user)` you don't h...
For each variable in javascript you can take its type and obviously if its type is `=== 'undefined'` then it is undefined. ``` if(typeof comment === 'undefined') { alert('Variable "comment" is undefined.'); } ```
66,918,209
I have a command that sends a DM to user and the user is defined like this: ```js let user; if (message.mentions.users.first()) { user = message.mentions.users.first(); } else if (args[0]) { user = message.guild.members.cache.get(args[0]).user; } ``` But if I ping a user that is not in th...
2021/04/02
[ "https://Stackoverflow.com/questions/66918209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15037320/" ]
Instead of looking for the members with `message.guild.members` and then get the user from there, you could get the [`client.users`](https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=users) and check if a user with the `args[0]` ID exists. If it doesn't exist, you can simply check `if (!user)` you don't h...
You are currently checking if you have written user as `"undefined"` when actually you want to see if the user is `undefined`. Another issue with your code is that `args[0]` will return the command name when you want the next argument over from that, `args[1]`. Full example: ```js let user; if (message.mentions.use...
89,611
Suppose that a new Congress gets elected, and they unanimously really, *really* ***really*** hate the government of country X, so much so that they want the US military to basically destroy it. So the government passes a law that not only declares, but also bestows upon the President a legal obligation to see that coun...
2023/02/23
[ "https://law.stackexchange.com/questions/89611", "https://law.stackexchange.com", "https://law.stackexchange.com/users/2413/" ]
The Constitution says "The President shall be Commander in Chief of the Army and Navy of the United States, and of the Militia of the several States, when called into the actual Service of the United States". As supreme military commander, the president alone gets to say whether or not to commit troops for such an expe...
If the President does not properly conduct his duties as President, he is subject to impeachment. In such an exceptional circumstance, the two houses may consider that the Presidents failure to act constitutes treason, and that he/she should be impeached. There is certainly international precedent for that: King Char...
15,212,158
say i have the string `testString = "x=4+y and y = 8"` I want to run `findIndices(testString)` and get back a list of indices containing formula items i.e. this should return `[0,1,2,3,4,10,11,12,13,14]` I'm thinking this would work ``` find equalSigns foreach equalSign look to the left until you see a space not...
2013/03/04
[ "https://Stackoverflow.com/questions/15212158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/648927/" ]
You cannot have a combined web and worker role instance. It can be one or the other. However, it is possible to have the web role do background processing, so it can host the background workload. See this SO question for a couple of options [Azure WebRole Scheduled Task Every Morning](https://stackoverflow.com/questi...
Technically you can't have a role of both types. Yet a web role is just the same as a worker role, it just has IIS configured. So you can merge them into one web role - IIS will run in a separate process and role entry point `Run()` will run some endless loop for "backend" processing. See [this similar question](https:...
10,144,860
If I have such a clause inside my feature definition: ``` Then I can see the "/relative-url-path" page ``` Cucumber will impose this method: ``` @When("^I can see the \"([^\"]*)\" page$") public void I_open_the_page(String arg1) { // Express the Regexp above with the code you wish you had throw new PendingE...
2012/04/13
[ "https://Stackoverflow.com/questions/10144860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/801466/" ]
First, I don't think there should be an @ sign in front of your 'When' if you are using Ruby for your step definitions. This may be causing you problems (I don't know.) If you're not using Ruby, it would be helpful to know what language you are using for your step definitions. I can tell you what I did with a file pat...
Based on the discussion, it sounds like you want a [non-capturing group](http://www.regular-expressions.info/refadv.html). This will allow you to specify any URL but completely ignore it in the actual step (ie its not passed as a parameter). Putting `?:` at the beginning of a group will make it a non-capturing group. ...
5,081,599
In what cases does does the function fwrite put an error indicator onto the stream, such that ferror will return true? Specifically, I am wondering if it puts an error when all the bytes were not successfully written. Please provide a link as to where you get your information from. Thank you
2011/02/22
[ "https://Stackoverflow.com/questions/5081599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/137081/" ]
If any error occurs, the error indicator for the stream will be set, and will not be cleared until `clearerr` is called. However, due to buffering, it's difficult for stdio functions to report errors. Often the error will not be seen until a later call, since buffering data never fails, but the subsequent write after t...
From the fwrite man page on my Linux system: ``` RETURN VALUE fread() and fwrite() return the number of items successfully read or written (i.e., not the number of characters). If an error occurs, or the end-of-file is reached, the return value is a short item count (or zero). fread() does not distin...
5,081,599
In what cases does does the function fwrite put an error indicator onto the stream, such that ferror will return true? Specifically, I am wondering if it puts an error when all the bytes were not successfully written. Please provide a link as to where you get your information from. Thank you
2011/02/22
[ "https://Stackoverflow.com/questions/5081599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/137081/" ]
If any error occurs, the error indicator for the stream will be set, and will not be cleared until `clearerr` is called. However, due to buffering, it's difficult for stdio functions to report errors. Often the error will not be seen until a later call, since buffering data never fails, but the subsequent write after t...
On Windows `fwrite` may put error when try to write to read-opened stream. For example if there was a call to `seekg` which sets read flag to the stream and `seekp` was not called before writing.
58,573,139
I am new to Simpy and I am having troubles figuring out how to model a process scheduler that has complex dependencies. **High-level summary of my problem**: * I have a warehouse that receives boxes containing items through an entrance. The boxes are put in a queue where they wait to be processed. * Each box has a de...
2019/10/26
[ "https://Stackoverflow.com/questions/58573139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2066248/" ]
Here's another StackOverflow question on simpy that might get you closer to a solution: [How can I have a process wait for multiple resources?](https://stackoverflow.com/questions/29976113/how-can-i-have-a-process-wait-for-multiple-resources) If I understand that answer correctly, you can treat events like messages in...
You might want to take a look at <https://simpy.readthedocs.io/en/latest/topical_guides/resources.html#res-type-store> ``` from collections import namedtuple Machine = namedtuple('Machine', 'size, duration') m1 = Machine(1, 2) # Small and slow m2 = Machine(2, 1) # Big and fast env = simpy.Environment() mac...
297,268
Is there a unix command I can use to pull a file from a URL and put it into a directory of my choice? So I have a URL which if you go to it, a file will be downloaded. I want to be able to type a unix command to download the linked file from the URL I specify and place it into a directory of my choice. So if the URL `...
2011/06/14
[ "https://superuser.com/questions/297268", "https://superuser.com", "https://superuser.com/users/-1/" ]
``` wget -P examples/ www.example.com/image.png ``` and ``` curl -o examples/image.png www.example.com/image.png ``` both work.
Meet your new friend, wget: ``` wget -O examples/image.png www.example.com/image.png ``` Also ``` man wget ``` for more usage details.
297,268
Is there a unix command I can use to pull a file from a URL and put it into a directory of my choice? So I have a URL which if you go to it, a file will be downloaded. I want to be able to type a unix command to download the linked file from the URL I specify and place it into a directory of my choice. So if the URL `...
2011/06/14
[ "https://superuser.com/questions/297268", "https://superuser.com", "https://superuser.com/users/-1/" ]
``` wget -P examples/ www.example.com/image.png ``` and ``` curl -o examples/image.png www.example.com/image.png ``` both work.
as mentioned before, wget is your tool of choice. If The site is protected with a password (HTTP Basic Auth), wget will give you an HTTP 401 Unauthorized, if you don't provide a user and password. Use this to provide a username and password. ``` wget --http-user=<username> --http-password=<Secretpassword> <yourURL> ...
297,268
Is there a unix command I can use to pull a file from a URL and put it into a directory of my choice? So I have a URL which if you go to it, a file will be downloaded. I want to be able to type a unix command to download the linked file from the URL I specify and place it into a directory of my choice. So if the URL `...
2011/06/14
[ "https://superuser.com/questions/297268", "https://superuser.com", "https://superuser.com/users/-1/" ]
Meet your new friend, wget: ``` wget -O examples/image.png www.example.com/image.png ``` Also ``` man wget ``` for more usage details.
as mentioned before, wget is your tool of choice. If The site is protected with a password (HTTP Basic Auth), wget will give you an HTTP 401 Unauthorized, if you don't provide a user and password. Use this to provide a username and password. ``` wget --http-user=<username> --http-password=<Secretpassword> <yourURL> ...
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I hope here is what you have in mind.. <https://jsfiddle.net/0fgnu99o/6/> ``` code ```
If you only remove property **max-height** from panel element, parent is going to spread all the way down. ``` #collapseOne, #collapseTwo { overflow-y:auto; } ``` Fiddle: [CLICK](https://jsfiddle.net/0fgnu99o/13/)
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I think I understood what you want. When you set height on a collapsing element, Bootstrap JS overrides it with it's style animation. The solution I found is setting the `max-height` ``` .panel-collapse{ max-height: 200px; overflow-y: auto; } ``` [Check My Example](https://jsfiddle.net/1df596z7/15/)
If you only remove property **max-height** from panel element, parent is going to spread all the way down. ``` #collapseOne, #collapseTwo { overflow-y:auto; } ``` Fiddle: [CLICK](https://jsfiddle.net/0fgnu99o/13/)
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I would recommend to use % in css for width and height from root element to all child elements while working on fluid layout, anyways here is a small jQuery tweak to achieve what you have asked, i hope this helps..:) ```js $(document).ready(function() { var $offHeight = 0 function updateHeight() { var $te...
I think I understood what you want. When you set height on a collapsing element, Bootstrap JS overrides it with it's style animation. The solution I found is setting the `max-height` ``` .panel-collapse{ max-height: 200px; overflow-y: auto; } ``` [Check My Example](https://jsfiddle.net/1df596z7/15/)
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I would recommend to use % in css for width and height from root element to all child elements while working on fluid layout, anyways here is a small jQuery tweak to achieve what you have asked, i hope this helps..:) ```js $(document).ready(function() { var $offHeight = 0 function updateHeight() { var $te...
Have a look at Flexbox (<https://css-tricks.com/snippets/css/a-guide-to-flexbox/>) This has lots of possibilities to make sure 2 containers are the same heights
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I would recommend to use % in css for width and height from root element to all child elements while working on fluid layout, anyways here is a small jQuery tweak to achieve what you have asked, i hope this helps..:) ```js $(document).ready(function() { var $offHeight = 0 function updateHeight() { var $te...
I don't know whether you are looking for full height. Anyway this will remove scrollbar for contents. Please let me know. ``` #collapseOne, #collapseTwo { height: auto; max-height: none; overflow-y: auto; } ```
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
Unless you need to support Opera Mini you should be able to use `vh` and possibly `calc`. You'll want to play with it yourself and tweak the numbers, but I think something like this should work (change from the current targets to these): ``` #panel1, #panel2 { max-height: calc(100vh - 150px); overflow-y:auto; } `...
If you only remove property **max-height** from panel element, parent is going to spread all the way down. ``` #collapseOne, #collapseTwo { overflow-y:auto; } ``` Fiddle: [CLICK](https://jsfiddle.net/0fgnu99o/13/)
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I would recommend to use % in css for width and height from root element to all child elements while working on fluid layout, anyways here is a small jQuery tweak to achieve what you have asked, i hope this helps..:) ```js $(document).ready(function() { var $offHeight = 0 function updateHeight() { var $te...
Unless you need to support Opera Mini you should be able to use `vh` and possibly `calc`. You'll want to play with it yourself and tweak the numbers, but I think something like this should work (change from the current targets to these): ``` #panel1, #panel2 { max-height: calc(100vh - 150px); overflow-y:auto; } `...
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I would recommend to use % in css for width and height from root element to all child elements while working on fluid layout, anyways here is a small jQuery tweak to achieve what you have asked, i hope this helps..:) ```js $(document).ready(function() { var $offHeight = 0 function updateHeight() { var $te...
I hope here is what you have in mind.. <https://jsfiddle.net/0fgnu99o/6/> ``` code ```
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
I would recommend to use % in css for width and height from root element to all child elements while working on fluid layout, anyways here is a small jQuery tweak to achieve what you have asked, i hope this helps..:) ```js $(document).ready(function() { var $offHeight = 0 function updateHeight() { var $te...
If you only remove property **max-height** from panel element, parent is going to spread all the way down. ``` #collapseOne, #collapseTwo { overflow-y:auto; } ``` Fiddle: [CLICK](https://jsfiddle.net/0fgnu99o/13/)
35,359,197
I am trying to make these panels take full length of container they are in, without providing fixed height, initially I want them to take all of the height of the page, Fiddle - <https://jsfiddle.net/0fgnu99o/10/> HTML ``` <div class="container"> <div class="row"> <div class="column"> <h3 style="display:...
2016/02/12
[ "https://Stackoverflow.com/questions/35359197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1668069/" ]
this seems to look ok ... ``` .panel { height: 300px; } #collapseOne, #collapseTwo { height:90%; max-height:90%; overflow-y:auto; } ``` ... to use % heights properly you need to specify a height for the parent. EDIT: It is however also valid to say that the parent .panel has height: 100%; but at some poin...
If you only remove property **max-height** from panel element, parent is going to spread all the way down. ``` #collapseOne, #collapseTwo { overflow-y:auto; } ``` Fiddle: [CLICK](https://jsfiddle.net/0fgnu99o/13/)
11,500,879
Given this code : ``` #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/shm.h> #include <semaphore.h> #include <pthread.h> #define BUF_SIZE 256 int main() { key_t key; char *virtua...
2012/07/16
[ "https://Stackoverflow.com/questions/11500879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779111/" ]
You need to include `-lpthread` when compiling. This is used by the linker, to link your binary against the library. *The other answers already cover how to do this on the command line.* **To do this in Eclipse, you need to follow the directions [here](https://stackoverflow.com/q/4201129/274261):** > > In the proje...
When linking, you have to add the flag `-pthread` or `-lrt` to the command line. It's right there in the [manual page](http://linux.die.net/man/3/sem_open).
11,500,879
Given this code : ``` #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/wait.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <sys/shm.h> #include <semaphore.h> #include <pthread.h> #define BUF_SIZE 256 int main() { key_t key; char *virtua...
2012/07/16
[ "https://Stackoverflow.com/questions/11500879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/779111/" ]
You need to include `-lpthread` when compiling. This is used by the linker, to link your binary against the library. *The other answers already cover how to do this on the command line.* **To do this in Eclipse, you need to follow the directions [here](https://stackoverflow.com/q/4201129/274261):** > > In the proje...
As it is written in the first answer in the question you linked, you nedd to compile it in this way: `gcc source.c -lpthread` `-lrt` or `-pthread` will do the same.
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
You can certainly use the service without the UDDI registry. I have created several Web Services and have immediately used them without registering them. Registration gives others confidence that your Web Service is legitimate and [descriptions of how to interact](http://www.ibm.com/developerworks/webservices/library/...
No, not at all. You are probably talking about API directories you may register your WS at. Like UDDI or what it’s named. Entirely optional.
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
You can certainly use the service without the UDDI registry. I have created several Web Services and have immediately used them without registering them. Registration gives others confidence that your Web Service is legitimate and [descriptions of how to interact](http://www.ibm.com/developerworks/webservices/library/...
Nobody uses UDDI anymore. It's an idea whose time has come and gone. It was thought that there would be public registries of web services that everyone would use to find a web service to meet their needs. That never happened.
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
You can certainly use the service without the UDDI registry. I have created several Web Services and have immediately used them without registering them. Registration gives others confidence that your Web Service is legitimate and [descriptions of how to interact](http://www.ibm.com/developerworks/webservices/library/...
How could either the service or the app know whether or not the service was registered? Furthermore, why would they care?
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
You can certainly use the service without the UDDI registry. I have created several Web Services and have immediately used them without registering them. Registration gives others confidence that your Web Service is legitimate and [descriptions of how to interact](http://www.ibm.com/developerworks/webservices/library/...
If you're trying to use service orientation the right way, your web services should be registered within a service registry. The registry should contain the published contract of the services and any meta-data that helps the discovery process. A different questions is: does a service consumer program need to look up ...
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
No, not at all. You are probably talking about API directories you may register your WS at. Like UDDI or what it’s named. Entirely optional.
How could either the service or the app know whether or not the service was registered? Furthermore, why would they care?
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
No, not at all. You are probably talking about API directories you may register your WS at. Like UDDI or what it’s named. Entirely optional.
If you're trying to use service orientation the right way, your web services should be registered within a service registry. The registry should contain the published contract of the services and any meta-data that helps the discovery process. A different questions is: does a service consumer program need to look up ...
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
Nobody uses UDDI anymore. It's an idea whose time has come and gone. It was thought that there would be public registries of web services that everyone would use to find a web service to meet their needs. That never happened.
How could either the service or the app know whether or not the service was registered? Furthermore, why would they care?
3,738,893
I'm learning about web services and most of the resources I've been reading talk about registering your web service once it's ready for use by others. Is registering a web service required to use the service? For example, let's say I have a web application on a company intranet and I create another web service app tha...
2010/09/17
[ "https://Stackoverflow.com/questions/3738893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/451038/" ]
Nobody uses UDDI anymore. It's an idea whose time has come and gone. It was thought that there would be public registries of web services that everyone would use to find a web service to meet their needs. That never happened.
If you're trying to use service orientation the right way, your web services should be registered within a service registry. The registry should contain the published contract of the services and any meta-data that helps the discovery process. A different questions is: does a service consumer program need to look up ...
8,178
Which preposition goes with *Aufsatz*? Is it *über* or *zu*? > > Ein Aufsatz über die Kolonialisierung von Namibia? > > Ein Aufsatz zu der Kolonialisierung von Namibia? > > > They seem to be similar but are there any subtle differences between the two.?
2013/10/08
[ "https://german.stackexchange.com/questions/8178", "https://german.stackexchange.com", "https://german.stackexchange.com/users/3480/" ]
Both are grammatically correct, but there is a subtle difference: * By using *über* you imply that the essay is covering the whole subject in general. This would be suitable for a descriptive summary aiming at people who are new to the subject. * With *zu*, the essay becomes more like a contribution to the subject. It...
Ein Aufsatz über can be translated as "an essay **over**..." That is covering the topic in a "general" mannner. Ein Aufsatz zu can be translated as "an essay **regarding**..." That is making a point (or two) about the topic. Either can be used, but the correct usage depends on the context.
28,688,566
The code is as follows: ``` module abc(a,b,c...); inout [15:0] a; endmodule module top; wire [15:0] data_a; endmodule ``` How to make connection between wire signal data\_a of top module and inout signal a of other module so that any change in data\_a is reflected in inout port?
2015/02/24
[ "https://Stackoverflow.com/questions/28688566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4588730/" ]
If you want the Primary and Secondary weapons to change in each click, you have call Random method inside the CreateWeapons method. Also it is not good way to use href to call js function, you can use onclick instead of that. Here is the updated working code for you. ``` function Random(arr) { return arr[Mat...
It's better if you create an element and then use it's `onclick` event to call the function rather using the inline `onclick` event. Try this, ``` function Random(arr) { return arr[Math.floor(Math.random() * arr.length)]; } var aElement = document.createElement("a"); aElement.href="#"; function CreateWeapons() {...
254,549
I use Emacs and I run `bash` with `M-x term` command. There is a problem: colors in the `*terminal*` buffer aren't the same as in Gnome Terminal, and they are worse (do you need a screen shot?). How can I fix this? This is pretty annoying :-) Thank you! --- Linux Mint 9 Emacs 23.1.1 x86\_64 --- ``` _____________...
2011/03/07
[ "https://superuser.com/questions/254549", "https://superuser.com", "https://superuser.com/users/12691/" ]
The "terminal emulator" implemented by `emacs` doesn't support as many colors as `gnome-terminal` does. In fact, it advertises not supporting any colors at all, and here I get ANSI escape sequences not understood by it. What distribution and version are you running that it supports color at all? --- See comments belo...
How about trying a different emacs terminal mode? [ansi-term](http://www.emacswiki.org/emacs/AnsiTerm) renders colors.
32,311,789
I'm using the Zendesk Zopim Android Chat SDK. When I try to open the chat screen as a fragment (like here: <http://bit.ly/1hOkyce>) I get the following error: ``` Wrong 2nd argument type. Found: 'com.zopim.android.sdk.prechat.ZopimChatFragment', required: 'android.app.Fragment' ``` When I open the ZopimChatFragment...
2015/08/31
[ "https://Stackoverflow.com/questions/32311789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3533322/" ]
As in `build.gradle` of provided sample code. library is using `com.android.support:appcompat-v7:22.1.+'` dependencies. means they are using Fragment from support library instead of default. so use `getSupportFragmentManager()` instead of `getFragmentManager()` for getting `FragmentManager`: ``` android.support.v4.ap...
I never used this library but replace the following: ``` android.app.FragmentManager manager = getFragmentManager(); ``` with ``` FragmentManager manager = getSupportFragmentManager(); ``` I suggest you to follow the documentation: ``` import com.zopim.android.sdk.chatlog.ZopimChatLogFragment; ... ZopimChatFrag...
62,433,288
I'd like to insert multiple ids on multiple dates on a temporary table without adding an INSERT for each line. Here is what I expect to find in my table : ``` 100 | 2020-06-01 17:00:00 100 | 2020-06-02 17:00:00 100 | 2020-06-03 17:00:00 202 | 2020-06-01 17:00:00 202 | 2020-06-02 17:00:00 202 | 2020-06-03 17:00:00 555 ...
2020/06/17
[ "https://Stackoverflow.com/questions/62433288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/333589/" ]
You can generate DATE values by using CONNECT BY, and use the generated values in a CROSS JOIN. (Although there is an answer already, maybe the following example is a bit easier to understand.) **Table containing unique IDs** ``` create table file_r ( id number unique ) ; insert into file_r( id ) select 100 from d...
Here's one option: * lines #1 - 5 represent sample data you already have in the `file_r` table (so you don't have to type that) * query you do need begins at line #6 + according to what you posted, you want to start from the 1st of current month at 17:00 (line #7) + for each `ID` found in the `file_r` table, you wan...
21,617,278
How to send JPG over TCP from one Windows Phone to another? I found that in the other SO topic(below) showing how to send text over TCP, **but how to turn JPG to bytes and send it?** Most of jpges are bigger than 4kb how to deal with that?: ``` private void sendMessage() { connectArgs = new SocketAsyncEventArgs ...
2014/02/07
[ "https://Stackoverflow.com/questions/21617278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3211486/" ]
I would suggest using [nullable](http://msdn.microsoft.com/en-us/library/1t3y8s4s.aspx) enum in this situation, like this: ``` public void SomeMethod(string myFirstParam = "", string mySecondParam = "", MyEnum? myThirdParam = null) { if (myThirdParam.HasValue) { ...
What about : ``` enum MyEnum { MISSING = -1, FirstValue, SecondValue, ... } public void SomeMethod(string myFirstParam = "", string mySecondParam = "", MyEnum myThirdParam = MISSING) { if (myThirdParam != MISSING) { //do something with it } } ```
21,617,278
How to send JPG over TCP from one Windows Phone to another? I found that in the other SO topic(below) showing how to send text over TCP, **but how to turn JPG to bytes and send it?** Most of jpges are bigger than 4kb how to deal with that?: ``` private void sendMessage() { connectArgs = new SocketAsyncEventArgs ...
2014/02/07
[ "https://Stackoverflow.com/questions/21617278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3211486/" ]
Make sure your `enum` has a default value (equal to zero), that means "none" or "invalid". This would be an appropriate value for your optional parameter's default value. This is recommended by Microsoft Code Analysis as well, [CA1008: Enums should have zero value](http://msdn.microsoft.com/en-us/library/ms182149.aspx...
What about : ``` enum MyEnum { MISSING = -1, FirstValue, SecondValue, ... } public void SomeMethod(string myFirstParam = "", string mySecondParam = "", MyEnum myThirdParam = MISSING) { if (myThirdParam != MISSING) { //do something with it } } ```
71,785,852
I have a problem with the spatie/laravel-permissions library. Previously I had it implemented in my system but after doing composer update it stopped working... The problem is when I add the HasRole in my User model. Everything crashes and I get the error: "Call to a member function first() on array " Making mention ...
2022/04/07
[ "https://Stackoverflow.com/questions/71785852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12383903/" ]
You probably have a cache issue specifically related to Spatie. If you face any kind of issues when you are seeding your DB, you can add this line at the top of your seed within the `run()` method ``` app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions(); ``` On the other hand, if you chang...
So you just ran a full update of all packages? That is kind of a scary situation, I don't think I've ever done a full update to all packages. I'm not sure what version of spatie you are coming or going with, that might help. When I did a full update from Laravel 5.7 all the way to Laravel 8, spatie was a pain. Not jus...
379,507
[![QGIS prompt window](https://i.stack.imgur.com/ZLBb1.jpg)](https://i.stack.imgur.com/ZLBb1.jpg) ``` file_writer = QgsRasterFileWriter(self.mypath + f'/{self.Name}_2x2DEM.tif') pipe = QgsRasterPipe() provider = DEMlayer.dataProvider() pipe.set(provider.c...
2020/11/18
[ "https://gis.stackexchange.com/questions/379507", "https://gis.stackexchange.com", "https://gis.stackexchange.com/users/172744/" ]
Raster writer <https://qgis.org/pyqgis/master/core/QgsRasterFileWriterTask.html> requires the number of columns and rows as input. For achieving the desired resolution you must calculate the values first. * Take the layer extent * Take MinX, MaxX, MinY, MaxX from the extent * Divide the net width and height by resolut...
The following code can answer your question. ``` from qgis.core import ( QgsRasterFileWriter, QgsRasterPipe ) rlayer=iface.activeLayer() file_writer = QgsRasterFileWriter('myRaster.tif') pipe = QgsRasterPipe() provider = rlayer.dataProvider() pipe.set(rlayer.dataProvider().clone()) file_writer.writeRaster(pipe, rl...
25,016,744
In the PHP documentation for [`session_unset()`](http://php.net/manual/en/function.session-unset.php) there is no hint that this function is deprecated so I think it's fine to use it. But then I read through the documentation about [`session_destroy()`](http://php.net/manual/en/function.session-destroy.php) where I fou...
2014/07/29
[ "https://Stackoverflow.com/questions/25016744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1652031/" ]
I don't know the exact reason, too, but it can be found here I guess: <https://github.com/php/php-src/blob/master/ext/session/session.c> PHP handles variables in `ZVAL` pointers and I think they just wanted the `_SESSION` superglobal to be handled the same way as any other variable, and not with a "special" command `s...
If you want to close the session you must use [session\_destroy()](http://php.net/session_destroy). ``` session_destroy(); ``` If you want to clear the variables of the session you must use: ``` $_SESSION = array(); ``` And if you want to clear only one variable of the session you must use: ``` unset($_SESSION['...
4,373,123
I'm trying get all the button child widgets of a currently active window. The buttons were created through **QDialogButtonBox**. I'm trying to get the roles of each button so I can identify which button is the OK, CANCEL, or SAVE button. However I'm getting an error with the following code: ``` QWidget *pWin = QAppli...
2010/12/07
[ "https://Stackoverflow.com/questions/4373123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/94815/" ]
You are creating a new empty `QDialogButtonBox` which has no idea about `buttons` in `allPButtons` list. Calling `buttonRole()` on them returns -1 (InvalidRole) because `buttons` are not in that `button-box`. You must do as jkerian wrote and `myButtonBoxPtr` must point to the `QDialogButtonBox` which is already in you...
You can't call a non-static method like that. You need to have the `QDialogButtonBox` variable and call that particular instance for `buttonRole()` to work. ``` QDialogButtonBox::ButtonRole role = myButtonBoxPtr->buttonRole(i.next()); ```
116,610
I need to create some tests for a bunch of variables that are initialized via the editor, So in the script they are always null and can't be set publicly. Usually using the tag is a good way to encapsulate the code but with tests how do I check such a variable? Example: ``` public class thing { [SerializeField] ...
2016/02/13
[ "https://gamedev.stackexchange.com/questions/116610", "https://gamedev.stackexchange.com", "https://gamedev.stackexchange.com/users/54560/" ]
I ended up creating a constructor for each class that i wanted to test. So for the example above it would be: ``` thing(string line) { //this will be the value of a [SerializeField] variable this.line = line; //ensure that start is called just like it would in the game Start(); } ``` Then in a test ...
Your initial code is *initialized* through the inspector, unless you call your function in `void Update()` the value will always be null or its initial value no matter what you put in the inspector.
45,045,981
Is there a "pythonic" way to use an instance of a class for a module. For example: ``` class MyClass: def __init__(self): self.my_var = "cool value" _instance = MyClass() def getInstance(): return _instance() ``` The goal is to share large lookup classes through the application instead of initializin...
2017/07/11
[ "https://Stackoverflow.com/questions/45045981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3989609/" ]
You can import anything from a module. Class instance is not an exception: **file1.py** ``` class MyClass: def __init__(self): self.my_var = "cool value" instance = MyClass() ``` **file2.py** ``` from file1 import instance ```
If your instances are dynamically created somehow, and you **really** need to keep track of them, you can override `__new__`, like this: ``` class MyClass: instances = [] def __new__(cls, *args, **kwargs): my_instance = super(MyClass, cls).__new__(cls, *args, **kwargs) MyClass.instances.append...
14,087
I am trying to download multiple fastq files from the SRA NCBI database which, conveniently enough, have their IDs in a range. Building a simple loop doesn't seem to do the trick, as bash appears to interpret my variable as an additional command? Help would be appreciated. This is what I have for now: ``` for i in {25...
2020/08/05
[ "https://bioinformatics.stackexchange.com/questions/14087", "https://bioinformatics.stackexchange.com", "https://bioinformatics.stackexchange.com/users/4401/" ]
You have an obvious error in your shell script that should have given you an error message: ``` sra_code = "DRR163""$i" ``` Should be: ``` sra_code="DRR163""$i" ``` You cannot have spaces around the `=` sign in a variable assignment. The line `sra_code = "DRR163""$i"` means "run the command `sra_code` with the ar...
> > which, conveniently enough, have their IDs in a range > > > I think it's a bit risky to rely on that - for this particular case they are not going to change but you may need to download more samples in the future. I would suggest avoiding `sra` and `fastq(er)-dump` altogether and use [ena](https://www.ebi.ac....
58,701,955
I have this array (it is an example) and I'd like to get the duplicate items and push it into another array. ``` let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] ``` I tried to loop with `foreach` and got this: My code: ``` var counts = []; arr....
2019/11/04
[ "https://Stackoverflow.com/questions/58701955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11512309/" ]
`counts` should be an object, not an array, since the keys are strings, not integers. ```js let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] var counts = {}; arr.forEach(function(x) { counts[x] = (counts[x] || 0)+1 }); for (key in counts) {...
do something like this, first sort the array, then loop over it a take what you want ``` let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] var sorted_arr = arr.slice().sort(); // You can define the comparing function here. ...
58,701,955
I have this array (it is an example) and I'd like to get the duplicate items and push it into another array. ``` let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] ``` I tried to loop with `foreach` and got this: My code: ``` var counts = []; arr....
2019/11/04
[ "https://Stackoverflow.com/questions/58701955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11512309/" ]
The `counts` object has strings as it's indexes. Use `Object.keys` to get a list of keys. [![screenshot of JavaScript console](https://i.stack.imgur.com/3IuR3.png)](https://i.stack.imgur.com/3IuR3.png)
do something like this, first sort the array, then loop over it a take what you want ``` let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] var sorted_arr = arr.slice().sort(); // You can define the comparing function here. ...
58,701,955
I have this array (it is an example) and I'd like to get the duplicate items and push it into another array. ``` let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] ``` I tried to loop with `foreach` and got this: My code: ``` var counts = []; arr....
2019/11/04
[ "https://Stackoverflow.com/questions/58701955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11512309/" ]
The `counts` object has strings as it's indexes. Use `Object.keys` to get a list of keys. [![screenshot of JavaScript console](https://i.stack.imgur.com/3IuR3.png)](https://i.stack.imgur.com/3IuR3.png)
`counts` should be an object, not an array, since the keys are strings, not integers. ```js let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] var counts = {}; arr.forEach(function(x) { counts[x] = (counts[x] || 0)+1 }); for (key in counts) {...
58,701,955
I have this array (it is an example) and I'd like to get the duplicate items and push it into another array. ``` let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] ``` I tried to loop with `foreach` and got this: My code: ``` var counts = []; arr....
2019/11/04
[ "https://Stackoverflow.com/questions/58701955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11512309/" ]
`counts` should be an object, not an array, since the keys are strings, not integers. ```js let arr = ["17: Mega Sena", "16: Mega Sena", "15: Mega Sena", "11: Dia de Sorte", "11: Dia de Sorte", "16: Mega Sena"] var counts = {}; arr.forEach(function(x) { counts[x] = (counts[x] || 0)+1 }); for (key in counts) {...
Your first code is just fine, you just add another array for distinct values add push into that also if must. ``` var counts = [], dist=[]; arr.forEach(function(x) { counts[x] = (counts[x] || 0)+1 var didAdd = counts[x]==1 ? (dist.push(x)):false }); ```