qid int64 1 74.7M | question stringlengths 0 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 2 48.3k | response_k stringlengths 2 40.5k |
|---|---|---|---|---|---|
16,430,373 | I'm trying to implement OpenCV into my application but every time I call a function there is a memory leak. I guess it has something to do with how I have used the library with Visual Studio but I tested it with a blank project and it seemed to work fine with the same settings.
The code I'm trying to implement into:
... | 2013/05/07 | [
"https://Stackoverflow.com/questions/16430373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1145456/"
] | Like I said in your last post, the details are important. The non-MFC dll loads before MFC dll and if there is any data not freed before MFC exits, MFC falsely reports this as a memory leak. This is a [known issue](http://comments.gmane.org/gmane.comp.lib.opencv/43423) which is a problem when using opencv with mfc. The... | I've noticed in the debug version that the combination of MFC and OpenCV can also result in strange behavior when you additionally use fopen and fread. fread might return error 9 (The storage control block address is invalid).
Again, delayed loading the OpenCV dlls might solve the problem. |
30,795,960 | I am trying to build a Movie Recommender System Using Apache Spark MLlib.
I have written a code for recommender in java and its working fine when run using `spark-submit` command.
My run command looks like this
`bin/spark-submit --jars /opt/poc/spark-1.3.1-bin-hadoop2.6/mllib/spark-mllib_2.10-1.0.0.jar --class "com.r... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30795960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2381737/"
] | To interact with data model (call its invoke method?), you could build a rest service inside the driver. This service listens for requests, and invokes model's predict method with input from the request, and returns result.
http4s (<https://github.com/http4s/http4s>) could be used for this purpose.
Spark SQL is not r... | For this kind of situation was developed a REST interface for lunching and sharing the context of spark jobs
Give a look at the documentation here :
<https://github.com/spark-jobserver/spark-jobserver> |
30,795,960 | I am trying to build a Movie Recommender System Using Apache Spark MLlib.
I have written a code for recommender in java and its working fine when run using `spark-submit` command.
My run command looks like this
`bin/spark-submit --jars /opt/poc/spark-1.3.1-bin-hadoop2.6/mllib/spark-mllib_2.10-1.0.0.jar --class "com.r... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30795960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2381737/"
] | To interact with data model (call its invoke method?), you could build a rest service inside the driver. This service listens for requests, and invokes model's predict method with input from the request, and returns result.
http4s (<https://github.com/http4s/http4s>) could be used for this purpose.
Spark SQL is not r... | For isolating the user sessions and showing the results in an isolated manner, you may need to use queues with a binded user identity. Incase the the results takes time, with this identity you can show the respective results to the user. |
30,795,960 | I am trying to build a Movie Recommender System Using Apache Spark MLlib.
I have written a code for recommender in java and its working fine when run using `spark-submit` command.
My run command looks like this
`bin/spark-submit --jars /opt/poc/spark-1.3.1-bin-hadoop2.6/mllib/spark-mllib_2.10-1.0.0.jar --class "com.r... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30795960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2381737/"
] | just pass the spark context and session as a bean in Spring
```
@Bean
public SparkConf sparkConf() {
SparkConf sparkConf = new SparkConf()
.setAppName(appName)
.setSparkHome(sparkHome)
.setMaster(masterUri);
return sparkConf;
}
@Bean
public JavaSparkContext javaSparkContex... | To interact with data model (call its invoke method?), you could build a rest service inside the driver. This service listens for requests, and invokes model's predict method with input from the request, and returns result.
http4s (<https://github.com/http4s/http4s>) could be used for this purpose.
Spark SQL is not r... |
30,795,960 | I am trying to build a Movie Recommender System Using Apache Spark MLlib.
I have written a code for recommender in java and its working fine when run using `spark-submit` command.
My run command looks like this
`bin/spark-submit --jars /opt/poc/spark-1.3.1-bin-hadoop2.6/mllib/spark-mllib_2.10-1.0.0.jar --class "com.r... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30795960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2381737/"
] | To interact with data model (call its invoke method?), you could build a rest service inside the driver. This service listens for requests, and invokes model's predict method with input from the request, and returns result.
http4s (<https://github.com/http4s/http4s>) could be used for this purpose.
Spark SQL is not r... | I am a bit late , but this can help other users.
If the requirement is to fetch data from Spark remotely, then you can consider using HiveThriftServer2.
This server exposes the Spark SQL (cached and temporary tables) as JDBC/ODBC Database.
So, you can connect to Spark by using a JDBC/ODBC driver, and access data from ... |
30,795,960 | I am trying to build a Movie Recommender System Using Apache Spark MLlib.
I have written a code for recommender in java and its working fine when run using `spark-submit` command.
My run command looks like this
`bin/spark-submit --jars /opt/poc/spark-1.3.1-bin-hadoop2.6/mllib/spark-mllib_2.10-1.0.0.jar --class "com.r... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30795960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2381737/"
] | just pass the spark context and session as a bean in Spring
```
@Bean
public SparkConf sparkConf() {
SparkConf sparkConf = new SparkConf()
.setAppName(appName)
.setSparkHome(sparkHome)
.setMaster(masterUri);
return sparkConf;
}
@Bean
public JavaSparkContext javaSparkContex... | For this kind of situation was developed a REST interface for lunching and sharing the context of spark jobs
Give a look at the documentation here :
<https://github.com/spark-jobserver/spark-jobserver> |
30,795,960 | I am trying to build a Movie Recommender System Using Apache Spark MLlib.
I have written a code for recommender in java and its working fine when run using `spark-submit` command.
My run command looks like this
`bin/spark-submit --jars /opt/poc/spark-1.3.1-bin-hadoop2.6/mllib/spark-mllib_2.10-1.0.0.jar --class "com.r... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30795960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2381737/"
] | just pass the spark context and session as a bean in Spring
```
@Bean
public SparkConf sparkConf() {
SparkConf sparkConf = new SparkConf()
.setAppName(appName)
.setSparkHome(sparkHome)
.setMaster(masterUri);
return sparkConf;
}
@Bean
public JavaSparkContext javaSparkContex... | For isolating the user sessions and showing the results in an isolated manner, you may need to use queues with a binded user identity. Incase the the results takes time, with this identity you can show the respective results to the user. |
30,795,960 | I am trying to build a Movie Recommender System Using Apache Spark MLlib.
I have written a code for recommender in java and its working fine when run using `spark-submit` command.
My run command looks like this
`bin/spark-submit --jars /opt/poc/spark-1.3.1-bin-hadoop2.6/mllib/spark-mllib_2.10-1.0.0.jar --class "com.r... | 2015/06/12 | [
"https://Stackoverflow.com/questions/30795960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2381737/"
] | just pass the spark context and session as a bean in Spring
```
@Bean
public SparkConf sparkConf() {
SparkConf sparkConf = new SparkConf()
.setAppName(appName)
.setSparkHome(sparkHome)
.setMaster(masterUri);
return sparkConf;
}
@Bean
public JavaSparkContext javaSparkContex... | I am a bit late , but this can help other users.
If the requirement is to fetch data from Spark remotely, then you can consider using HiveThriftServer2.
This server exposes the Spark SQL (cached and temporary tables) as JDBC/ODBC Database.
So, you can connect to Spark by using a JDBC/ODBC driver, and access data from ... |
7,344,674 | I'm a little confused as to why this isn't the default behaviour?
So, how do I detect the enter key being pressed on my button and fire the click event handler? (For example on a TextInput field there is an 'enter' event)
Thanks | 2011/09/08 | [
"https://Stackoverflow.com/questions/7344674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112549/"
] | 1. Create a service to download the content from the server.
2. Add your activity to it for custom event listening
3. Broadcast event [Completion, Part-Completion] to the registered listener when the service is able to do the job.
4. Till that time either show a splash screen or a download screen with progress bar indi... | You should make a `Splash` `Activity` for your application. So this will be an `Activity` that displays only a picture, let say your application logo or something similar. Then check if your app has all ready downloaded the videos and photos, you can do this by keeping a boolean field in `SharedPreferences` let say `DA... |
2,572,624 | I have a VB6 program which I've been maintaining for ten years. There is a subroutine in the program called "Prepare Copy", which looks like this (Edited to add changes):
```
Public Sub PrepareCopy()
On Local Error GoTo PrepareCopyError
MsgBox "in modeldescription preparecopy"
Set CopiedShapes = New Collection
Msg... | 2010/04/03 | [
"https://Stackoverflow.com/questions/2572624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/252710/"
] | Your recent comment says that the variable is `Public CopiedShapes as New Collection`.
1. Could you try removing the `new` in the declaration?
2. Are there any instances in the Collection with a `Sub Class_Terminate()` which are being called when the old Collection is garbage collected along with its contents? | Does the error occur only on machine/s different than where the code was compiled? It may be that some DLLs are missing in the runtime environment (like MSVBRT.dll or the like).
Easiest way to figure it out: run on the build machine.
If it doesn't happen there, you can create a deployable version (an installer) th... |
2,572,624 | I have a VB6 program which I've been maintaining for ten years. There is a subroutine in the program called "Prepare Copy", which looks like this (Edited to add changes):
```
Public Sub PrepareCopy()
On Local Error GoTo PrepareCopyError
MsgBox "in modeldescription preparecopy"
Set CopiedShapes = New Collection
Msg... | 2010/04/03 | [
"https://Stackoverflow.com/questions/2572624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/252710/"
] | Procmon was not helpful. Microsoft took a deep-dive image of the system at the point the problem was occurring.
They found a bad HRESULT failure code. Something deep in the VB6 runtime was attempting to access a late-bound but undeclared object through an IDispatch interface. They swiftly scheduled a call with me. I ... | Does the error occur only on machine/s different than where the code was compiled? It may be that some DLLs are missing in the runtime environment (like MSVBRT.dll or the like).
Easiest way to figure it out: run on the build machine.
If it doesn't happen there, you can create a deployable version (an installer) th... |
2,572,624 | I have a VB6 program which I've been maintaining for ten years. There is a subroutine in the program called "Prepare Copy", which looks like this (Edited to add changes):
```
Public Sub PrepareCopy()
On Local Error GoTo PrepareCopyError
MsgBox "in modeldescription preparecopy"
Set CopiedShapes = New Collection
Msg... | 2010/04/03 | [
"https://Stackoverflow.com/questions/2572624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/252710/"
] | Procmon was not helpful. Microsoft took a deep-dive image of the system at the point the problem was occurring.
They found a bad HRESULT failure code. Something deep in the VB6 runtime was attempting to access a late-bound but undeclared object through an IDispatch interface. They swiftly scheduled a call with me. I ... | Your recent comment says that the variable is `Public CopiedShapes as New Collection`.
1. Could you try removing the `new` in the declaration?
2. Are there any instances in the Collection with a `Sub Class_Terminate()` which are being called when the old Collection is garbage collected along with its contents? |
10,328,238 | I have to add an Upload file functionality using Kendo ui in my grails application. also i have to know how to change the upload location.
thnks | 2012/04/26 | [
"https://Stackoverflow.com/questions/10328238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727079/"
] | Here is the solution that we came up with to dynamically change the saveUrl on the Kendo UI Upload widget.
Controller code:
```
public class MediaController : ApiControllerBase
{
public Task<HttpResponseMessage> Post()
{
var queryVals = Request.RequestUri.ParseQueryString();
string idValue = q... | Check out the KendoUI Upload configuration documentation here: <http://www.kendoui.com/documentation/ui-widgets/upload/configuration.aspx>
The saveUrl option on the async object allows you to set the handler for the submitted file(s) with ease. |
10,328,238 | I have to add an Upload file functionality using Kendo ui in my grails application. also i have to know how to change the upload location.
thnks | 2012/04/26 | [
"https://Stackoverflow.com/questions/10328238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727079/"
] | Here is the solution that we came up with to dynamically change the saveUrl on the Kendo UI Upload widget.
Controller code:
```
public class MediaController : ApiControllerBase
{
public Task<HttpResponseMessage> Post()
{
var queryVals = Request.RequestUri.ParseQueryString();
string idValue = q... | You can just change the saveUrl property. The code should look like this:
```
this.documentUpload.options.async.saveUrl = '/newUrlStr';
``` |
1,257,636 | Need to do a proof by mathematical induction using 4 steps to show that the following statement is true for every positive integer n and to help use the weak principle of mathematical induction.
$2 + 6 + 18 + ... + 2\times{3^{n-1}} = 3^n-1$
1. show that the base step is true
2. What is the inductive hypothesis?
3. wh... | 2015/04/29 | [
"https://math.stackexchange.com/questions/1257636",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/224929/"
] | Base Step: $2 \cdot 3^{1-1} = 2 = 3^1 - 1$
The inductive hypothesis is: $\sum\_{n=1}^{k} 2 \cdot 3^{n-1} = 3^k - 1$
We must show that under the assumption of the inductive hypothesis that $$3^k - 1 + 2 \cdot 3^k = 3^{k + 1} - 1$$
We verify this as $$3^k - 1 + 2 \cdot 3^k = 3^k(1 + 2) - 1$$
$$= 3^{k+1} - 1$$ | **Hint** $\ $ By a very simple transformation we can reduce the induction to a very trivial induction, namely if $\,g(n)\,$ is constant $\,g(n\!+\!1)=g(n)\,$ then $\,g(n) = g(0)\,$
The $\rm\ RHS$ and $\rm LHS$ have equal first difference $\,f(n\!+\!1)-f(n) = 2\cdot 3^n,\,$ therefore defining $\,g(n) := \rm RHS - LHS$... |
183,105 | I have two accepted papers X and Y. I listed X as a reference for Y. I used "To appear" in front of X in the reference section of Y. But it has not published yet. How can I add volume details of X, while it seems that X will be published after publishing Y? | 2022/03/09 | [
"https://academia.stackexchange.com/questions/183105",
"https://academia.stackexchange.com",
"https://academia.stackexchange.com/users/49646/"
] | I think it is possible under one of the following options:
1. If possible and allowed by the publisher, you publish a preprint of X (e.g. arXiv or PubMed) and you cite the preprint (which is a very common practice nowadays). When X will be published by the publisher, most of the bibliographic indices/platforms will li... | I don’t know what your field is. I did my PhD in Molecular Biophysics ten years ago. It was customary to just list your paper X as “in press” and the corresponding journal name, if it’s cited in your paper Y reference. |
14,358,499 | I would like to know if there is some way in Swing to turn an ImageIcon to gray scale in a way like:
```
component.setIcon(greyed(imageIcon));
``` | 2013/01/16 | [
"https://Stackoverflow.com/questions/14358499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1308202/"
] | One limitation of `GrayFilter.createDisabledImage()` is that it is designed to create a *disabled* appearance for icons across diverse Look & Feel implementations. Using this `ColorConvertOp` [example](https://stackoverflow.com/a/12228640/230513), the following images contrast the effect:
`GrayFilter.createDisabledIma... | You can use the following:
```
ImageIcon icon = new ImageIcon("yourFile.gif");
Image normalImage = icon.getImage();
Image grayImage = GrayFilter.createDisabledImage(normalImage);
``` |
52,541,481 | 1. Is it possible to create & submit an PWA launcher icon to a website marketplace?
2. The launcher icon should work like a "Add to home screen" PWA function.
What I am trying to achieve is a PWA store making it easy for users to Add an icon to their homescreen for launching a PWA website. Please advice. | 2018/09/27 | [
"https://Stackoverflow.com/questions/52541481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10425302/"
] | If you mean that in your web marketplace, you want to get the icons of submitted PWA then, you can get the `PWA` launch icons from either the link tags:
```
<link rel="icon" sizes="192x192" href="nice-highres.png"> (recommended)
<link rel="icon" sizes="128x128" href="niceicon.png">
<link rel="apple-touch-icon" sizes="... | This is posible neither in iOS nor in Android:
### Regarding the icons
1. *Android* depends on the `manifest.json` file at the root of your domain to handle the information about the PWA.
2. *iOS:* You may be able to change the icon and launch screen at the top of the page holding the link to the PWA, but this will n... |
52,541,481 | 1. Is it possible to create & submit an PWA launcher icon to a website marketplace?
2. The launcher icon should work like a "Add to home screen" PWA function.
What I am trying to achieve is a PWA store making it easy for users to Add an icon to their homescreen for launching a PWA website. Please advice. | 2018/09/27 | [
"https://Stackoverflow.com/questions/52541481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10425302/"
] | You can set the icon to be displayed according to sizes on home screen in manifest.json file.
<https://developers.google.com/web/fundamentals/web-app-manifest/>
```
"icons": [
{
"src": "/images/icons-192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "/images/icons-512.png",
"type": "image/png",
... | This is posible neither in iOS nor in Android:
### Regarding the icons
1. *Android* depends on the `manifest.json` file at the root of your domain to handle the information about the PWA.
2. *iOS:* You may be able to change the icon and launch screen at the top of the page holding the link to the PWA, but this will n... |
77,191 | I have a [YubiKey NEO](https://www.yubico.com/products/yubikey-hardware/yubikey-neo/) which has a lot of amazing capabilities such as OTP, U2F, and PGP smart card for PGP/GPG and even SSH keys. One of the applications I've discovered recently for the device is [a PIV applet](https://developers.yubico.com/yubico-piv-too... | 2014/12/31 | [
"https://security.stackexchange.com/questions/77191",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/2374/"
] | >
> I've never seen configuration in Apache or nginx which would seem to
> indicate support for anything other than file-based SSL private keys.
>
>
>
You are using the Yubikey as a Hardware Security Module (HSM). They key is stored on and never leaves the HSM and all encryption and decryption is done on the HSM.... | Apache supports specifying the crypto device. The directive is called [SSLCryptoDevice](https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslcryptodevice). You can specify
Pkcs11 as the device. Update: according to [this answer](https://serverfault.com/a/711611/81387) it's not supported with mod\_ssl. That answer su... |
19,777,395 | i have a database like this

it have content of a site i grabbed with a php script and linux cron jobs
after i got all pages of the sites it goes to work slowly
and server load is:
 so 3GB of database to slog through would actually take quite a while. I would recommend removing the left hand wildcards and (potentially) taking a look at `MATCH AGAINST` using a `FULLTEXT` index.
F... | Every time that query runs you're searching through *3 billion* characters for a string match.
[You need to use an index](http://use-the-index-luke.com/sql/where-clause/searching-for-ranges/like-performance-tuning).
I also think you're using the wrong query predicate and should use a [full-text-search](http://dev.mys... |
3,637,553 | The code below returns `none`. How can I fix it? I'm using Python 2.6.
```
import urllib
URL = "http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1t1v&e=.csv"
symbols = ('GGP', 'JPM', 'AIG', 'AMZN','GGP', 'JPM', 'AIG', 'AMZN')
#symbols = ('GGP')
def fetch_quote(symbols):
url = URL % '+'.join(symbols)
f... | 2010/09/03 | [
"https://Stackoverflow.com/questions/3637553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428862/"
] | You have to explicitly `return` the `data` from `fetch_quote` function. Something like this:
```
def fetch_quote(symbols):
url = URL % '+'.join(symbols)
fp = urllib.urlopen(url)
try:
data = fp.read()
finally:
fp.close()
return data # <======== Return
```
In the absence of an expli... | Your method doesn't explicitly `return` anything, so it `returns` `None` |
16,938,113 | I have a form like this:
```
<form method="post" enctype="multipart/form-data">
<input type="text" id="title" placeholder="Project Title"/><br />
<input type="text" id="vurl" placeholder="If You have any video about project write your video url path here" style="width:435px;"/><br />
<textarea id="prjdesc" name="prj... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16938113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2330772/"
] | This code would work fine without the use of javascript. But make sure to change the directory and the table name and fields on line "2" and "66" resp.
We will create a hidden textarea which will create the datastring and we will get all the params using $\_GET
```
<script>
$("#update").click(function(e) {
alert("... | ```
<?php
/*dont use path like this C:/wamp/www/WebsiteTemplate4/upload/ becuase you are working at localhost server*/
if (file_exists("upload/" . $_FILES["file"]["name"])){
echo $_FILES["file"]["name"] . " already exists. ";
}else{
$file = $_FILES["file"]["name"]
$filePath = "upload/" . $file;
if(m... |
16,938,113 | I have a form like this:
```
<form method="post" enctype="multipart/form-data">
<input type="text" id="title" placeholder="Project Title"/><br />
<input type="text" id="vurl" placeholder="If You have any video about project write your video url path here" style="width:435px;"/><br />
<textarea id="prjdesc" name="prj... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16938113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2330772/"
] | If you mean how to call insert.php after submit button was clicked, in this line
```php
<form method="post" enctype="multipart/form-data">
```
you have to add this
```php
<form method="post" enctype="multipart/form-data" action="insert.php">
``` | ```
<?php
/*dont use path like this C:/wamp/www/WebsiteTemplate4/upload/ becuase you are working at localhost server*/
if (file_exists("upload/" . $_FILES["file"]["name"])){
echo $_FILES["file"]["name"] . " already exists. ";
}else{
$file = $_FILES["file"]["name"]
$filePath = "upload/" . $file;
if(m... |
16,938,113 | I have a form like this:
```
<form method="post" enctype="multipart/form-data">
<input type="text" id="title" placeholder="Project Title"/><br />
<input type="text" id="vurl" placeholder="If You have any video about project write your video url path here" style="width:435px;"/><br />
<textarea id="prjdesc" name="prj... | 2013/06/05 | [
"https://Stackoverflow.com/questions/16938113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2330772/"
] | This code would work fine without the use of javascript. But make sure to change the directory and the table name and fields on line "2" and "66" resp.
We will create a hidden textarea which will create the datastring and we will get all the params using $\_GET
```
<script>
$("#update").click(function(e) {
alert("... | If you mean how to call insert.php after submit button was clicked, in this line
```php
<form method="post" enctype="multipart/form-data">
```
you have to add this
```php
<form method="post" enctype="multipart/form-data" action="insert.php">
``` |
10,621,471 | I isolated the most I can my code into this : <http://jsfiddle.net/uXVWu/>
HTML :
```
<a id="stopHere" >Hi !</a>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><... | 2012/05/16 | [
"https://Stackoverflow.com/questions/10621471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1365010/"
] | Do you mean something like this: <http://jsfiddle.net/GTSaz/1/>
So that if, when you are scrolling, your mouse is over the element the scrolling will jump down to have the element at the top of the viewport (0,300 in this case).
Also, if you don't want to hardcode the position (0,300) then you can detect in in the sc... | I am not really sure what do you want . Do you want a `fixed` div or `window.scroll(0,0)`
But, I have combined your's and Adam's code, to workaround the situation.
<http://jsfiddle.net/c3CJF/1/>
**Markup:**
```
<a id="stopHere" >Hi !</a>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />... |
10,621,471 | I isolated the most I can my code into this : <http://jsfiddle.net/uXVWu/>
HTML :
```
<a id="stopHere" >Hi !</a>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><... | 2012/05/16 | [
"https://Stackoverflow.com/questions/10621471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1365010/"
] | If I'm understanding correctly, you could set it up at top of the page simpler using something like:
```
document.getElementById('stopHere').style.position="fixed"
document.getElementById('stopHere').style.top="0"
``` | I am not really sure what do you want . Do you want a `fixed` div or `window.scroll(0,0)`
But, I have combined your's and Adam's code, to workaround the situation.
<http://jsfiddle.net/c3CJF/1/>
**Markup:**
```
<a id="stopHere" >Hi !</a>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />... |
562,511 | How do I calculate the size of a filter capacitor to reduce the ripple when I have a microcontroller on the same regulated power supply as a high current load like a motor?
[](https://i.stack.imgur.com/xHeuw.jpg)
**My parameters:**
Motor: DC 5V; 0... | 2021/04/28 | [
"https://electronics.stackexchange.com/questions/562511",
"https://electronics.stackexchange.com",
"https://electronics.stackexchange.com/users/56749/"
] | Since this is homework, I'll rather "hint" you in the right direction to help you employ the right methods than solve it completely, I think you'll enjoy that more!
This gets doable if you start with your first schematic, and apply the Y-Delta transformation on the "inner" three R (those who connect to C). Afterwards,... | Looking at your redrawn circuit, I can see that
* I5 and I9 are the same current, labelled twice.
* By symmetry, I3 = I4 = I5 = I8
* By symmetry, I6 = I7 = 0 |
17,599,276 | At work we have a web application that is pretty old. So we have a hodge-podge of form-validation solutions. There is a lot of duplicated validation logic, a lot of custom validation logic, some stuff that has been implemented with jQuery validation, some stuff from the bassistance.de validator, and some of the new cod... | 2013/07/11 | [
"https://Stackoverflow.com/questions/17599276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2573549/"
] | Some points that you should consider:
1-not all browsers support html5.
2-you can't customize default error messages for required fields.
3-you could use the pattern attribute and validate with a regular expression. [External Resource](http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_pattern)
My sugg... | HTML5 data-\* attributes are useful for this kind of problems.
<http://www.slideshare.net/lensco/html5-data-attributes>
They don't work well with XHTML doctypes, but they do on more lax ones, like HTML 4.01.
jQuery 1.9 (and I think prior versions too) allow you to do things like this:
```
$(someInput).data()
```
w... |
17,599,276 | At work we have a web application that is pretty old. So we have a hodge-podge of form-validation solutions. There is a lot of duplicated validation logic, a lot of custom validation logic, some stuff that has been implemented with jQuery validation, some stuff from the bassistance.de validator, and some of the new cod... | 2013/07/11 | [
"https://Stackoverflow.com/questions/17599276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2573549/"
] | **Disclaimer:** I have a horse in this race; I'm the author of the following library.
I've answered a similar question [previously](https://stackoverflow.com/questions/4751780/best-javascript-solution-for-client-side-form-validation-and-interaction?rq=1) that you might want to check out. I'd like to suggest a framewor... | HTML5 data-\* attributes are useful for this kind of problems.
<http://www.slideshare.net/lensco/html5-data-attributes>
They don't work well with XHTML doctypes, but they do on more lax ones, like HTML 4.01.
jQuery 1.9 (and I think prior versions too) allow you to do things like this:
```
$(someInput).data()
```
w... |
17,599,276 | At work we have a web application that is pretty old. So we have a hodge-podge of form-validation solutions. There is a lot of duplicated validation logic, a lot of custom validation logic, some stuff that has been implemented with jQuery validation, some stuff from the bassistance.de validator, and some of the new cod... | 2013/07/11 | [
"https://Stackoverflow.com/questions/17599276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2573549/"
] | **Disclaimer:** I have a horse in this race; I'm the author of the following library.
I've answered a similar question [previously](https://stackoverflow.com/questions/4751780/best-javascript-solution-for-client-side-form-validation-and-interaction?rq=1) that you might want to check out. I'd like to suggest a framewor... | Some points that you should consider:
1-not all browsers support html5.
2-you can't customize default error messages for required fields.
3-you could use the pattern attribute and validate with a regular expression. [External Resource](http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_pattern)
My sugg... |
46,133,699 | I am a cave man in terms of web ui - I like it all without npm/nodejs and other nice infrastructure. I want it all in text files like in old days: include/link stuff from/to a HTML page and it's done. Is such cave approach possible for semantic-ui+ReactJS combination, meaning to have no npm/nodes/other server code for ... | 2017/09/09 | [
"https://Stackoverflow.com/questions/46133699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1973207/"
] | A way to do this is to use dataframes with pandas.
```
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
df = pd.read_csv("D:\Programmes Python\Data\Data_csv.txt",sep=";") #Reads the csv
df.index = pd.to_datetime(df["DateTime"]) #Set the index of the dataframe to the DateTime colu... | The first thing you need to do is to parse the datetime fields as dates/times. Try using [`dateutil.parser`](http://dateutil.readthedocs.io/en/stable/parser.html) for that.
Next, you will need to count the number of issues of each type in each month. The naive way to do that would be to maintain lists of lists for eac... |
46,133,699 | I am a cave man in terms of web ui - I like it all without npm/nodejs and other nice infrastructure. I want it all in text files like in old days: include/link stuff from/to a HTML page and it's done. Is such cave approach possible for semantic-ui+ReactJS combination, meaning to have no npm/nodes/other server code for ... | 2017/09/09 | [
"https://Stackoverflow.com/questions/46133699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1973207/"
] | A way to do this is to use dataframes with pandas.
```
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
df = pd.read_csv("D:\Programmes Python\Data\Data_csv.txt",sep=";") #Reads the csv
df.index = pd.to_datetime(df["DateTime"]) #Set the index of the dataframe to the DateTime colu... | honestly, I would just use R. [check this link out](http://www.ics.uci.edu/~jutts/110/InstallingRandRStudio.pdf) on downloading / setting up R & RStudio.
```
data <- read.csv(file="c:/yourdatafile.csv", header=TRUE, sep=",")
attach(data)
data$Month <- format(as.Date(data$DateTime), "%m")
plot(DateTime, Issue_Type... |
231,507 | I am trying to build a fast cryptography algorithm. The algorithm works fine, but I am worried if there are any potential flaws that might make the algorithm vulnerable to any kind of attack. Here is my code.
`Encryptor.cpp`
---------------
```cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <... | 2019/10/30 | [
"https://codereview.stackexchange.com/questions/231507",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/-1/"
] | Here are a number of things you could do to improve the code.
Separate interface from implementation
--------------------------------------
The interface goes into a header file and the implementation (that is, everything that actually emits bytes including all functions and data) should be in a separate `.cpp` file.... | File naming
===========
It's a long-standing convention in C++, as in C, that files meant to be included as part of another translation unit (headers) are given names with a `.h` suffix. It's a good idea to follow such conventions, as it makes the code easier for everyone to understand.
Includes
========
Don't use t... |
231,507 | I am trying to build a fast cryptography algorithm. The algorithm works fine, but I am worried if there are any potential flaws that might make the algorithm vulnerable to any kind of attack. Here is my code.
`Encryptor.cpp`
---------------
```cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <... | 2019/10/30 | [
"https://codereview.stackexchange.com/questions/231507",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/-1/"
] | Here are a number of things you could do to improve the code.
Separate interface from implementation
--------------------------------------
The interface goes into a header file and the implementation (that is, everything that actually emits bytes including all functions and data) should be in a separate `.cpp` file.... | Please do not roll your own encryption outside of an academic context.
If you would like a fast algorithm that can be easily implemented in C/C++ take a look at [ChaCha or Salsa](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant). Runs great on most general purpose CPUs and has been verified by the cryptographic co... |
231,507 | I am trying to build a fast cryptography algorithm. The algorithm works fine, but I am worried if there are any potential flaws that might make the algorithm vulnerable to any kind of attack. Here is my code.
`Encryptor.cpp`
---------------
```cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <... | 2019/10/30 | [
"https://codereview.stackexchange.com/questions/231507",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/-1/"
] | Here are a number of things you could do to improve the code.
Separate interface from implementation
--------------------------------------
The interface goes into a header file and the implementation (that is, everything that actually emits bytes including all functions and data) should be in a separate `.cpp` file.... | Regarding the cryptographic algorithm only:
Important observations
======================
This is equivalent to an XOR cipher with a repeating 256-byte key. The key16 stuff adds no security. The randKey stuff adds no security. The following is working decryption code for one round (I'll use your terminology), if you ... |
231,507 | I am trying to build a fast cryptography algorithm. The algorithm works fine, but I am worried if there are any potential flaws that might make the algorithm vulnerable to any kind of attack. Here is my code.
`Encryptor.cpp`
---------------
```cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <... | 2019/10/30 | [
"https://codereview.stackexchange.com/questions/231507",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/-1/"
] | Please do not roll your own encryption outside of an academic context.
If you would like a fast algorithm that can be easily implemented in C/C++ take a look at [ChaCha or Salsa](https://en.wikipedia.org/wiki/Salsa20#ChaCha_variant). Runs great on most general purpose CPUs and has been verified by the cryptographic co... | File naming
===========
It's a long-standing convention in C++, as in C, that files meant to be included as part of another translation unit (headers) are given names with a `.h` suffix. It's a good idea to follow such conventions, as it makes the code easier for everyone to understand.
Includes
========
Don't use t... |
231,507 | I am trying to build a fast cryptography algorithm. The algorithm works fine, but I am worried if there are any potential flaws that might make the algorithm vulnerable to any kind of attack. Here is my code.
`Encryptor.cpp`
---------------
```cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <... | 2019/10/30 | [
"https://codereview.stackexchange.com/questions/231507",
"https://codereview.stackexchange.com",
"https://codereview.stackexchange.com/users/-1/"
] | Regarding the cryptographic algorithm only:
Important observations
======================
This is equivalent to an XOR cipher with a repeating 256-byte key. The key16 stuff adds no security. The randKey stuff adds no security. The following is working decryption code for one round (I'll use your terminology), if you ... | File naming
===========
It's a long-standing convention in C++, as in C, that files meant to be included as part of another translation unit (headers) are given names with a `.h` suffix. It's a good idea to follow such conventions, as it makes the code easier for everyone to understand.
Includes
========
Don't use t... |
992,919 | I am using Ubuntu 14.04 LTS with Linux Kernel version 3.13.0-34.
How can I find out what is the default or what is the current TCP congestion control algorithm being used ?
Thanks. | 2015/10/28 | [
"https://superuser.com/questions/992919",
"https://superuser.com",
"https://superuser.com/users/401696/"
] | There aren't TCP variants; there are TCP *congestion control algorithms*:
```
sysctl net.ipv4.tcp_congestion_control
cat /proc/sys/net/ipv4/tcp_congestion_control
```
The default is usually `cubic` or `reno`, although plenty others are available, and programs can set the preferred algorithm for *individual connecti... | Adding to ***@grawity*** answer, it is possible to check all TCP congestion control algorithms available with the following command:
```
sysctl net.ipv4.tcp_available_congestion_control
```
A list of some of the possible output (i.e.- availble flavours) is:
*reno*: Traditional TCP used by almost all other OSes. (de... |
992,919 | I am using Ubuntu 14.04 LTS with Linux Kernel version 3.13.0-34.
How can I find out what is the default or what is the current TCP congestion control algorithm being used ?
Thanks. | 2015/10/28 | [
"https://superuser.com/questions/992919",
"https://superuser.com",
"https://superuser.com/users/401696/"
] | There aren't TCP variants; there are TCP *congestion control algorithms*:
```
sysctl net.ipv4.tcp_congestion_control
cat /proc/sys/net/ipv4/tcp_congestion_control
```
The default is usually `cubic` or `reno`, although plenty others are available, and programs can set the preferred algorithm for *individual connecti... | If you want to find out the current congestion control algorithm used on each connection you can use the `ss` command (part of the [iproute2](https://wiki.linuxfoundation.org/networking/iproute2) package/tools):
```
ss -ti
```
Here's some example output: Below the connection details, the first item in the parameter ... |
992,919 | I am using Ubuntu 14.04 LTS with Linux Kernel version 3.13.0-34.
How can I find out what is the default or what is the current TCP congestion control algorithm being used ?
Thanks. | 2015/10/28 | [
"https://superuser.com/questions/992919",
"https://superuser.com",
"https://superuser.com/users/401696/"
] | Adding to ***@grawity*** answer, it is possible to check all TCP congestion control algorithms available with the following command:
```
sysctl net.ipv4.tcp_available_congestion_control
```
A list of some of the possible output (i.e.- availble flavours) is:
*reno*: Traditional TCP used by almost all other OSes. (de... | If you want to find out the current congestion control algorithm used on each connection you can use the `ss` command (part of the [iproute2](https://wiki.linuxfoundation.org/networking/iproute2) package/tools):
```
ss -ti
```
Here's some example output: Below the connection details, the first item in the parameter ... |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | 1. create **/resources** folder inside **src/main**
2. create **application.properties** file inside **/resources**
3. write `server.port=9090` //(use any port number of your choice) | you can set `server.port= #some-available-port number` in application.properties file
or run command prompt in administrator mode and run `netstat -a -o -n`.
Find the process id which is using port 8080.
Run `taskkill /F /PID #Processid` command |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | open command prompt as administrator
step1: netstat -ano | findstr :<enter your 4 digit port number>
```
netstat -ano | findstr :8080
```
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 6436
TCP [::]:8080 [::]:0 LISTENING 6436
step2: taskkill /PID <enter above pid number(sometimes it shown 3/4/5/6 digits)> /F
```
taskkill ... | If you getting this error again and again , then make sure server.port=(your port no) is the first line in application.properties file. |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | 1. create **/resources** folder inside **src/main**
2. create **application.properties** file inside **/resources**
3. write `server.port=9090` //(use any port number of your choice) | Reset port 8080.
[reset image description here](https://i.stack.imgur.com/6YVJt.png) |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | 1. create **/resources** folder inside **src/main**
2. create **application.properties** file inside **/resources**
3. write `server.port=9090` //(use any port number of your choice) | The error basically means that your port 8080 is occupied. If you are getting this error then go to your project and open application.properties and add the below line and it should work fine:
```
server.port = 8090
``` |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | If you had previously started the spring boot app and forgot to stop before hitting play again then Go to windows **task manager** and locate the java application(Something like *"OpenJDK Platform binary"* and click on End Task. (Java app not eclipse). Then try running again. It worked for me. | It is a simple answer.If you are getting this error then go to your project then
src/main/resources and open application.properties file and mention there
server.port=8045 you can give your own number here instead of 8045
thanks[](https://i.stack.im... |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | Another way to do this is by first checking what processes are using that specific port, then killing it using its process ID:
1. Run `lsof -i :8080`
This will identify which process is listening on port 8080.
2. Take note of the process ID (PID) e.g. 63262
3. Run `kill -9 <PID>` e.g. `kill -9 63262` | Your client application also spring boot application, whats why you have two spring boot application run in 8080 port.
Change port one of them or create a standalone java application with main class, put your web client in it and run.
As http client you can use Apache Http Client. |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | If you don't want the embedded server to start, just set the following property in you `application.properties` (or `.yml`):
```
spring.main.web-application-type=none
```
>
> If your classpath contains the necessary bits to start a web server, Spring Boot will automatically start it. To disable this behaviour confi... | if port:8080 already in use error occurs:
* goto command prompt
.type command> .netstat -ano
.Enter->this will show all running port check port 8080
.type command> taskkill /F /PID 8080
.process will terminate. |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | 1. create **/resources** folder inside **src/main**
2. create **application.properties** file inside **/resources**
3. write `server.port=9090` //(use any port number of your choice) | You try to use an already used port.
Ports are used on the transport layer - `tcp`, `http` is application layer and uses a transport layer to send and receive requests.
Default port exposed by spring boot app is `8080`. In your case you have two solutions:
* change port for your application
* stop the service that... |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | If on windows and your getting this every time you run the application you need to keep doing:
```
> netstat -ano | findstr *<port used>*
TCP 0.0.0.0:*<port used>* 0.0.0.0:0 LISTENING *<pid>*
TCP [::]:*<port used>* [::]:0 LISTENING *<pid>*
> taskkill /F /PID *<... | If you had previously started the spring boot app and forgot to stop before hitting play again then Go to windows **task manager** and locate the java application(Something like *"OpenJDK Platform binary"* and click on End Task. (Java app not eclipse). Then try running again. It worked for me. |
56,499,932 | I am trying to optimize my code and I found out about comprehensions. But I am struggling with my code and how to apply dictionary comprehension.
The original code is below.
How do I optimize this code in a proper pythonic way?
```py
all_users = []
for x in range(len(result)):
user = {}
user["fieldy"] = str(... | 2019/06/07 | [
"https://Stackoverflow.com/questions/56499932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6701554/"
] | You can change the default port of your application in application.properties by adding the following line:
server.port = 8090 | The best answer to this is to always use the "Relaunch Application" button. That will stop the web server and restart the entire app on the same port as before.
It's the button with the red square and green play icon combined.
<https://i.stack.imgur.com/ICGtX.png> |
41,019,725 | To make it simple let's say I have a dataset consiting of four names: Anna, Bobby , Casper, Christine. The column name is just 'Names'.
I want to sort it in this order: Bobby, Anna, Casper, Christine. I cant use 'proc sort' with 'asc/desc' here. Because it's ordered randomly I need to type in the order manually.
Can ... | 2016/12/07 | [
"https://Stackoverflow.com/questions/41019725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6278424/"
] | The answer from @Joe is the best way due to being scalable and the ability to read in formats from a dataset using CNTLIN. I just thought I'd post an alternative solution, using `proc sql`. The version SAS uses enables you to create a custom order on the fly by adding an `order by` statement along with a `case` stateme... | The way you should store categorical variables in SAS is as numerics, with formats to show the characters. This is how other programming languages, e.g. R, handle them (`factor` in R).
So for example:
```
data have;
length names $15;
input names $;
datalines;
Bobby
Anna
Casper
Christine
;;;;
run;
proc format;
... |
37,161,349 | Am trying to connect DB2 database in java but it throwing error, I can't find what issue was that. I added **db2jcc.jar** and here I show my complete database connectivity code.
```
public class ConnectionExample {
public static void main(String[] args) {
String jdbcClassName="com.ibm.db2.jcc.DB2Driver";
... | 2016/05/11 | [
"https://Stackoverflow.com/questions/37161349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4348410/"
] | Actually the port 50000 is not opened that is the reason I got the error after change that port to 51020 it works fine also it connects with database.
```
String url="jdbc:db2://localhost:51020/TestDb";
```
Thanks | **Cause**
A possible cause for this problem is that TCP/IP is not properly enabled on your DB2 database server.
**Resolving the problem**
Use the `db2set DB2COMM` command from the DB2 command window to start the TCP/IP connection:
```
db2set DB2COMM=protocol_names
```
For example, to set the database manager to s... |
43,371,178 | I want to make my character transparent in some circumstances, I know I could do that via
```
GetComponent<SpriteRenderer>().color = new Color(1f,1f,1f,0.2f);
```
if it's a single sprite without animation.
But the thing is that it's during an animation, so is there any way to change the sprite sheet's alpha which ... | 2017/04/12 | [
"https://Stackoverflow.com/questions/43371178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2288944/"
] | **Abort object creation**
As documented by Qt, three methods exists to unload/abort an object instantiation:
1. Set [`Loader.active`](http://doc.qt.io/qt-5/qml-qtquick-loader.html#active-prop) to `false`
2. Set [`Loader.source`](http://doc.qt.io/qt-5/qml-qtquick-loader.html#source-prop) to an empty string
3. Set [`Lo... | I don't know what your issu is, with those *objects that are destroyed before the loader finishs*, but maybe the issue is there? If not, this should work:
If it does not help, please add some code to your question, that reproduces your problem.
**main.qml**
```
import QtQuick 2.7
import QtQuick.Controls 2.0
Applicat... |
50,596,214 | I am coding in react js.
We have an input form, which has text input. The text input fires an onChange function that results in a change in state (and thus rendering).
```
var resultJSXcount = 1;
for (let i = 0; i < myArray.length; i++){
resultJSXTable.push(
<tr key= {resultJSXcount++}>
<td style = {{"... | 2018/05/30 | [
"https://Stackoverflow.com/questions/50596214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9864875/"
] | I have a guess. It's just a guess, because you do not show everything that is going on.
Your problems come from not understanding how React works. Try this:
* myArray probably comes from state or props. Use setState() to update the contents of myArray instead doing `myArray[i].name = event.target.value;` within onCha... | Sorry! I found out the problem was in a completely different area of the code. The above code worked fine.
My error was that when I was applying my styles I had a random focus(). I am not sure why it still worked in Chrome, but crisis averted.
Thanks for the input! |
68,447,733 | I believe I'm misunderstanding how state works in React. I have a TextField as part of a Material UI Autocomplete component. The page is supposed to fetch new results each time the text changes to search the API with the new value. The simple output list at the bottom is updated as expected, but no results are ever pop... | 2021/07/19 | [
"https://Stackoverflow.com/questions/68447733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2275171/"
] | Try this
```
<TextField {...params} label="Search for a book" variant="outlined"
//ISBN - 10 or 13 digit
value={inputText} // *** I WOULD EXPECT THIS TO BE SET TO "BASKETBALL" ON FIRST RENDER
/>
``` | Thank you to @Ignacio Elias for getting me halfway there, so thank you.
I'm sad to say (for the 1,000th time in my career) that the it was something really, *really* stupid. On the second line of the code below I needed to capitalize InputProps in the spread operator because while inputProps *is* [a valid property of ... |
44,672,262 | I have two options in my payment get way i.e. `Credit Card` and `E-Check`. When I select the `Credit Card`, the layout should show something like this
[](https://i.stack.imgur.com/x7xay.png)
The problem is when I select the `E-Check` th... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44672262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5746625/"
] | Use View.GONE instead of View.INVISIBLE
View.INVISIBLE:
>
> This view is invisible, but it still takes up space for layout
> purposes.
>
>
>
View.GONE:
>
> This view is invisible, and it doesn't take any space for layout
> purposes.
>
>
> | You should play with view attribute `View.GONE` and `View.VISIBLE` to make layouts appear/disappear correctly. |
44,672,262 | I have two options in my payment get way i.e. `Credit Card` and `E-Check`. When I select the `Credit Card`, the layout should show something like this
[](https://i.stack.imgur.com/x7xay.png)
The problem is when I select the `E-Check` th... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44672262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5746625/"
] | Don't know why people are giving you such stupid answers.
Try this simple thing:
In your layout code change this:
Just below your Radio button layout make two layout like this:
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orien... | You should play with view attribute `View.GONE` and `View.VISIBLE` to make layouts appear/disappear correctly. |
44,672,262 | I have two options in my payment get way i.e. `Credit Card` and `E-Check`. When I select the `Credit Card`, the layout should show something like this
[](https://i.stack.imgur.com/x7xay.png)
The problem is when I select the `E-Check` th... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44672262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5746625/"
] | Use View.GONE instead of View.INVISIBLE
View.INVISIBLE:
>
> This view is invisible, but it still takes up space for layout
> purposes.
>
>
>
View.GONE:
>
> This view is invisible, and it doesn't take any space for layout
> purposes.
>
>
> | You can use two `FrameLayout` inside of `RelativeLayout`. Insert all views related to credit card in first & other into second `FrameLayout`. Then manage click event with `View.GONE` and `View.VISIBLE` |
44,672,262 | I have two options in my payment get way i.e. `Credit Card` and `E-Check`. When I select the `Credit Card`, the layout should show something like this
[](https://i.stack.imgur.com/x7xay.png)
The problem is when I select the `E-Check` th... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44672262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5746625/"
] | Don't know why people are giving you such stupid answers.
Try this simple thing:
In your layout code change this:
Just below your Radio button layout make two layout like this:
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orien... | You can use two `FrameLayout` inside of `RelativeLayout`. Insert all views related to credit card in first & other into second `FrameLayout`. Then manage click event with `View.GONE` and `View.VISIBLE` |
44,672,262 | I have two options in my payment get way i.e. `Credit Card` and `E-Check`. When I select the `Credit Card`, the layout should show something like this
[](https://i.stack.imgur.com/x7xay.png)
The problem is when I select the `E-Check` th... | 2017/06/21 | [
"https://Stackoverflow.com/questions/44672262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5746625/"
] | Don't know why people are giving you such stupid answers.
Try this simple thing:
In your layout code change this:
Just below your Radio button layout make two layout like this:
```
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orien... | Use View.GONE instead of View.INVISIBLE
View.INVISIBLE:
>
> This view is invisible, but it still takes up space for layout
> purposes.
>
>
>
View.GONE:
>
> This view is invisible, and it doesn't take any space for layout
> purposes.
>
>
> |
43,751,597 | ```
SELECT
player.FirstName,
player.LastName,
team.teamName,
TotalPoints,
TotalRebounds,
TotalAssists,
TotalSteals,
TotalBlocks
FROM playerstats
INNER JOIN player
ON playerstats.PlayerID = player.PlayerID
```
I have a table called player (Player ID, firstname, lastname, team ID)
ta... | 2017/05/03 | [
"https://Stackoverflow.com/questions/43751597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7795206/"
] | There's no built-in function for this, but you can easily create one yourself:
```
def chop(expr, *, max=0.3):
return [i if i > max else 0 for i in expr]
```
Calling this would convert all numbers less than or equal to `0.3` to a `0`:
```
>>> chop([1.0, 0.2, 0.4, 0.3, 0.31])
[1.0, 0, 0.4, 0, 0.31]
```
You sho... | One way to do that with numpy would be to use a masked array:
```
>>> import numpy
>>> def chop(expr, delta=10**-10):
... return numpy.ma.masked_inside(expr, -delta, delta).filled(0)
>>> x = numpy.fft.irfft(numpy.fft.rfft([2, 1, 1, 0, 0, 0]))
>>> x
array([ 2.00000000e+00, 1.00000000e+00, 1.00000000e+00,
... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | I'd suggest that you save the normalized versions to your table in addition with the real username. Changing the encoding on the fly can be expensive, and you have to do the conversion again for every row on every search.
If you're using PHP, you can use [iconv()](http://fi.php.net/manual/en/function.iconv.php) to han... | ```
$normalized = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
```
is a perfect php solution, but in mysql? CONVERT?
in mysql
```
SELECT 'Álvaro José' as accented, (CONVERT ('Álvaro José' USING ascii)) as notaccented
```
Produce:
```
Álvaro José ?lvaro Jos?
```
The accented words is not converted to no acce... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | The reason for the error is not the table but the characterset of your input, i.e. the 'rené' in your query. The behaviour depends on the [character\_set\_connection](http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_character_set_connection) variable:
>
> The character set used for literals ... | I'd suggest that you save the normalized versions to your table in addition with the real username. Changing the encoding on the fly can be expensive, and you have to do the conversion again for every row on every search.
If you're using PHP, you can use [iconv()](http://fi.php.net/manual/en/function.iconv.php) to han... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | I'd suggest that you save the normalized versions to your table in addition with the real username. Changing the encoding on the fly can be expensive, and you have to do the conversion again for every row on every search.
If you're using PHP, you can use [iconv()](http://fi.php.net/manual/en/function.iconv.php) to han... | Does a search using *English* characters return results with foreign characters?
I wrote the following script to compare collations in MySQL 5.7 (Should also work for MariaDB 10.2+):
```
$db->query('CREATE TABLE IF NOT EXISTS test (name varchar(20))
Engine=InnoDB character set utf8mb4 collate utf8mb4_... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | I have implemented a strtr php function/tr unix command in MySQL you can get the source [here](https://github.com/falcacibar/mysql-routines-collection/blob/master/tr.func.sql)
You can use as:
```
SELECT tr(name, 'áäèëî', 'aaeei') FROM persons
```
or to strip some characters
```
SELECT tr(name, 'áäèëî', null) FROM ... | ```
$normalized = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
```
is a perfect php solution, but in mysql? CONVERT?
in mysql
```
SELECT 'Álvaro José' as accented, (CONVERT ('Álvaro José' USING ascii)) as notaccented
```
Produce:
```
Álvaro José ?lvaro Jos?
```
The accented words is not converted to no acce... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | The reason for the error is not the table but the characterset of your input, i.e. the 'rené' in your query. The behaviour depends on the [character\_set\_connection](http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_character_set_connection) variable:
>
> The character set used for literals ... | ```
$normalized = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
```
is a perfect php solution, but in mysql? CONVERT?
in mysql
```
SELECT 'Álvaro José' as accented, (CONVERT ('Álvaro José' USING ascii)) as notaccented
```
Produce:
```
Álvaro José ?lvaro Jos?
```
The accented words is not converted to no acce... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | ```
$normalized = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
```
is a perfect php solution, but in mysql? CONVERT?
in mysql
```
SELECT 'Álvaro José' as accented, (CONVERT ('Álvaro José' USING ascii)) as notaccented
```
Produce:
```
Álvaro José ?lvaro Jos?
```
The accented words is not converted to no acce... | Does a search using *English* characters return results with foreign characters?
I wrote the following script to compare collations in MySQL 5.7 (Should also work for MariaDB 10.2+):
```
$db->query('CREATE TABLE IF NOT EXISTS test (name varchar(20))
Engine=InnoDB character set utf8mb4 collate utf8mb4_... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | The reason for the error is not the table but the characterset of your input, i.e. the 'rené' in your query. The behaviour depends on the [character\_set\_connection](http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_character_set_connection) variable:
>
> The character set used for literals ... | I have implemented a strtr php function/tr unix command in MySQL you can get the source [here](https://github.com/falcacibar/mysql-routines-collection/blob/master/tr.func.sql)
You can use as:
```
SELECT tr(name, 'áäèëî', 'aaeei') FROM persons
```
or to strip some characters
```
SELECT tr(name, 'áäèëî', null) FROM ... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | I have implemented a strtr php function/tr unix command in MySQL you can get the source [here](https://github.com/falcacibar/mysql-routines-collection/blob/master/tr.func.sql)
You can use as:
```
SELECT tr(name, 'áäèëî', 'aaeei') FROM persons
```
or to strip some characters
```
SELECT tr(name, 'áäèëî', null) FROM ... | Does a search using *English* characters return results with foreign characters?
I wrote the following script to compare collations in MySQL 5.7 (Should also work for MariaDB 10.2+):
```
$db->query('CREATE TABLE IF NOT EXISTS test (name varchar(20))
Engine=InnoDB character set utf8mb4 collate utf8mb4_... |
2,302,813 | I'd like to be able to do queries that normalize accented characters, so that for example:
```
é, è, and ê
```
are all treated as 'e', in queries using '=' and 'like'. I have a row with username field set to '**rené**', and I'd like to be able to match on it with both '**rene**' and '**rené**'.
I'm attempting to do... | 2010/02/20 | [
"https://Stackoverflow.com/questions/2302813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93995/"
] | The reason for the error is not the table but the characterset of your input, i.e. the 'rené' in your query. The behaviour depends on the [character\_set\_connection](http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_character_set_connection) variable:
>
> The character set used for literals ... | Does a search using *English* characters return results with foreign characters?
I wrote the following script to compare collations in MySQL 5.7 (Should also work for MariaDB 10.2+):
```
$db->query('CREATE TABLE IF NOT EXISTS test (name varchar(20))
Engine=InnoDB character set utf8mb4 collate utf8mb4_... |
50,354,041 | I am trying to write a dictionary to a csv file in python.
I've tried nearly every tutorial that I could find but did not get a good result yet.
I want to later edit that file in excel but it looks like this right now:
[](https://i.stack.imgur.com/aEl... | 2018/05/15 | [
"https://Stackoverflow.com/questions/50354041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4944986/"
] | ```
s = file_name
dict = App.get_running_app().get_widget_contents()
with open(s, 'w') as f:
writer = csv.writer(f)
writer.writerow(dict.keys()) #Header
for row, value in dict.items():
writer.writerow(value) #Write Values
``` | you can go with
```
s = file_name
dict = App.get_running_app().get_widget_contents()
with open(s, 'w') as f:
writer = csv.writer(f)
for key in dict:
writer.writerow([key, dict[key]])
``` |
21,174,310 | So I seem to have run into a bit of a dead end. I'm making a page which has an image slider. The slider has three images, one centered on the screen, the other two overflow on the left and right. When you click on the button to advance the slides it runs this code....
```
$('#slideRight').click(function() {
if ($... | 2014/01/16 | [
"https://Stackoverflow.com/questions/21174310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3159369/"
] | I'm going to start with the second part of your question, regarding completing the animation before continuing with the loop.
I have done something similar in the past, and what I did was set two global variables to control the animation. One variable is for how long you want the period to be, the other is a counter f... | Here is a full solution for one possible way of doing it at [this fiddle](http://jsfiddle.net/3Pe73/4/).
**HTML:**
The top container holds the images. In this particular example I've included three, using divs instead of images. Whether you use images or divs doesn't change anything.
```
<div class="holder_container... |
51,817 | Hope someone can help, can't find exactly my situation.
I have a Mackie proFx16 v3 which has 3 × 6.3 mm (pre fader switchable) Aux sends. (Well 4, but one of them is dedicated to Fx.)
My band is currently using 2 × active floor monitors – i.e. 2 monitor mixes, one fed from Aux send 1 and 1 fed from Aux send 2. All wo... | 2022/10/13 | [
"https://sound.stackexchange.com/questions/51817",
"https://sound.stackexchange.com",
"https://sound.stackexchange.com/users/35984/"
] | If you don't need stereo, connect one aux output to the left input and set the transmitter to mono. This is the most common configuration for a band sharing a limited number of monitor mixes.
Regarding TS (tip-sleeve) or TRS (tip-ring-sleeve) cables: in the live sound world, TRS cables with 1/4" connectors will usuall... | Concerning the technical part of your question: having a look at the Mackie's product description, the Aux sends seem to be mono, but balanced (please verify).
The PSM300's product description mentions "Connector Type: 6.35 mm (1/4") TRS".
So that's fine: you can connect one of the PSM300s with 2 TRS cables, and the o... |
31,150,565 | So i'm learning to create a java game on eclipse. I learned adding shapes and such. I also learned how to paint the shapes (change the colours) I was wondering how to add an image to the shape. This is the code for painting the rectangle.
```
public void paintColumn(Graphics g, Rectangle column)
{
g.setCol... | 2015/07/01 | [
"https://Stackoverflow.com/questions/31150565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4761936/"
] | Start by having a look at [Reading/Loading an Image](http://docs.oracle.com/javase/tutorial/2d/images/loadimage.html) for details about how to load a image, also, have a look at [2D Graphics](http://docs.oracle.com/javase/tutorial/2d/) for more details about 2D Graphics API.
Basically, you load the image, you draw it ... | Simply create a BufferedImage object:
```
BufferedImage image = ImageIO.read(filename);
```
Then instead of doing g.drawShape do:
```
g.drawImage(image, [starting x], [starting y], [image width], [image height], [image observer]);
```
In your case, you probably won't need an image observer, so you can just put `n... |
69,087,873 | I'm trying to build a simple web app using the MERN stack while following a course.
My backend runs on port 5000 while react runs on port 3000. When I want to make a request with the backend API, it sends it to port 3000 instead of 5000. I keep on getting this error message:
>
> xhr.js:178 POST http://localhost:3000... | 2021/09/07 | [
"https://Stackoverflow.com/questions/69087873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14116644/"
] | I suggest considering usage of [`pickle`](https://docs.python.org/3/library/pickle.html) built-in module. You can use it following way for writing
```
import pickle
data = [1,(2,3)]
with open('save.p','wb') as f:
pickle.dump(data, f)
```
and following way for reading
```
import pickle
with open('save.p','rb') a... | If you are wanting to write a python list to a txt file and then read it back in as a list you need to do something like this.
Write it with some delimiter.
```
with open("myfile.txt", "w") as f:
string1 = ",".join(map(str, LIST))
f.write(string1)
```
And then read it in and split it on that same delimiter.... |
69,087,873 | I'm trying to build a simple web app using the MERN stack while following a course.
My backend runs on port 5000 while react runs on port 3000. When I want to make a request with the backend API, it sends it to port 3000 instead of 5000. I keep on getting this error message:
>
> xhr.js:178 POST http://localhost:3000... | 2021/09/07 | [
"https://Stackoverflow.com/questions/69087873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14116644/"
] | As pickle is not secure you can use `json` format
```
dump/dumps: Serialize
load/loads: Deserialize
```
<https://docs.python.org/3/library/json.html>
Code:
```
>>> import json
>>> l = [1,2,3,4]
>>> with open("test.txt", "w") as fp:
... json.dump(l, fp)
...
>>> with open("test.txt", "r") as fp:
... b = json... | If you are wanting to write a python list to a txt file and then read it back in as a list you need to do something like this.
Write it with some delimiter.
```
with open("myfile.txt", "w") as f:
string1 = ",".join(map(str, LIST))
f.write(string1)
```
And then read it in and split it on that same delimiter.... |
4,124,906 | >
> Bob tells his sister that if she thinks of a number with all its digits different and ordered in increasing order from left to right, and then multiplies the number she thought of by 9, he always knows how much the sum of the digits of the result of multiplication, although he does not know what number his sister ... | 2021/05/02 | [
"https://math.stackexchange.com/questions/4124906",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/757330/"
] | Writing $9n=10n-n$ is a good start. The idea then is to note that, since the digits are strictly increasing, it is easy to see how that subtraction must turn out. Indeed, in most places you are subtracting a number from one which is strictly greater. More precisely, other than in the units and the tens place we are sub... | >
> $9N=\overline{a\_1(a\_2-a\_1)(a\_3-a\_2)\cdots (a\_{n-1}-a\_{n-2})(a\_n-a\_{n-1}-1)(10-a\_n)}$
>
>
>
And that's it!
$a\_1 + (a\_2-a\_1) + (a\_3 -a\_2) \cdots (a\_{n-1}-a\_{n-2}) + (a\_n-a\_{n-1}-1) + (10-a\_n)=$
$ (a\_1 + a\_2 + a\_3 + ..... + a\_n) - (a\_1 + a\_2 + ...a\_{n-2}+a\_{n-1}+a\_n) + (-1+10) =$ ... |
35,011 | Ok, long story short, I'm currious how long it would take an agency to crack a 10-15 character winrar password. The file names in the archive are also scrambled including a word at the start and numbers and characters. Roughly, should I have reason to believe this could be cracked within a reasonable time frame? | 2013/04/29 | [
"https://security.stackexchange.com/questions/35011",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/25336/"
] | There is some data [here](http://www.tomshardware.com/reviews/password-recovery-gpu,2945-8.html). WinRAR uses a custom [key derivation function](http://en.wikipedia.org/wiki/Key_derivation_function) which involves thousands of SHA-1 invocations. Apparently, with two good GPU, about 15000 passwords per second can be tri... | The answer is 42 of course.
In all seriousness, this question is unanswerable. There are many factors, including but not limited to the amount of hardware the attacker is willing to throw at you.
Your password is **weak** though, it's very predictable which is the bane of strong passwords. |
35,011 | Ok, long story short, I'm currious how long it would take an agency to crack a 10-15 character winrar password. The file names in the archive are also scrambled including a word at the start and numbers and characters. Roughly, should I have reason to believe this could be cracked within a reasonable time frame? | 2013/04/29 | [
"https://security.stackexchange.com/questions/35011",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/25336/"
] | The answer is 42 of course.
In all seriousness, this question is unanswerable. There are many factors, including but not limited to the amount of hardware the attacker is willing to throw at you.
Your password is **weak** though, it's very predictable which is the bane of strong passwords. | As mentioned rar uses SHA-1 which is pretty strong. You can have a good comparison of different algorithms [here](http://www.gat3way.eu/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=192&cntnt01returnid=15).
As you can see cracking rar is slower than WPA-PSK. |
35,011 | Ok, long story short, I'm currious how long it would take an agency to crack a 10-15 character winrar password. The file names in the archive are also scrambled including a word at the start and numbers and characters. Roughly, should I have reason to believe this could be cracked within a reasonable time frame? | 2013/04/29 | [
"https://security.stackexchange.com/questions/35011",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/25336/"
] | There is some data [here](http://www.tomshardware.com/reviews/password-recovery-gpu,2945-8.html). WinRAR uses a custom [key derivation function](http://en.wikipedia.org/wiki/Key_derivation_function) which involves thousands of SHA-1 invocations. Apparently, with two good GPU, about 15000 passwords per second can be tri... | As mentioned rar uses SHA-1 which is pretty strong. You can have a good comparison of different algorithms [here](http://www.gat3way.eu/index.php?mact=News,cntnt01,detail,0&cntnt01articleid=192&cntnt01returnid=15).
As you can see cracking rar is slower than WPA-PSK. |
20,455,295 | I have an object within an object and want to create a restriction using one of the fields within the inner most object. Now i figured it could be achieved by doing something like:
... .add(Restrictions.eq("myObjectTwp.myObjectThree.myObjectsID", mySearchId)).list();
However this does not seem to work. However, I get... | 2013/12/08 | [
"https://Stackoverflow.com/questions/20455295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1383163/"
] | You are probably looking for [CONCAT() function](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat), and your custom parts of the sentence have to be enclosed in single quotes and have the desired spaces at the beginning and at the end:
```
SELECT CONCAT (
A.CUSTNAME,
' WHO IS HOLDIN... | You need to use proper `join` syntax. In addition to the `on` clause, you need a `join` statement. In addition, what look like string constants should be in single quotes. And, the proper way to concatenate strings in MySQL is to use the `concat()` function, not vertical bars:
```
SELECT concat(A.CUSTNAME, ' WHO IS HO... |
54,672,187 | I have many `varchar` YYYY-mm values in my table :
[](https://i.stack.imgur.com/OhtND.png)
But now I need days in Month from this.
>
> I need the result: 2018-04 -> 30 Days
>
>
>
So how I can achieve this?
I thank you in advance! | 2019/02/13 | [
"https://Stackoverflow.com/questions/54672187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10921131/"
] | You can use `eomonth()`:
```
select day(eomonth(convert(date, yyyymm + '-01')))
```
[Here](https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=4be2dbb3aa77fd7d0ef478bb414c6657) is a db<>fiddle for doubters. | In addition to Gordon's spot-on answer, here is another way to compute the number of days in the month:
```
SELECT
DATEDIFF(day,
TRY_CONVERT(datetime, date+'01'),
DATEADD(month, 1, TRY_CONVERT(datetime, date+'01')))
FROM yourTable;
```
[Demo
----](https://dbfiddle.uk/?rdbms=sqlserver_20... |
54,672,187 | I have many `varchar` YYYY-mm values in my table :
[](https://i.stack.imgur.com/OhtND.png)
But now I need days in Month from this.
>
> I need the result: 2018-04 -> 30 Days
>
>
>
So how I can achieve this?
I thank you in advance! | 2019/02/13 | [
"https://Stackoverflow.com/questions/54672187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10921131/"
] | You can use `eomonth()`:
```
select day(eomonth(convert(date, yyyymm + '-01')))
```
[Here](https://dbfiddle.uk/?rdbms=sqlserver_2017&fiddle=4be2dbb3aa77fd7d0ef478bb414c6657) is a db<>fiddle for doubters. | The eomonth() function does the job :) |
54,672,187 | I have many `varchar` YYYY-mm values in my table :
[](https://i.stack.imgur.com/OhtND.png)
But now I need days in Month from this.
>
> I need the result: 2018-04 -> 30 Days
>
>
>
So how I can achieve this?
I thank you in advance! | 2019/02/13 | [
"https://Stackoverflow.com/questions/54672187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10921131/"
] | In addition to Gordon's spot-on answer, here is another way to compute the number of days in the month:
```
SELECT
DATEDIFF(day,
TRY_CONVERT(datetime, date+'01'),
DATEADD(month, 1, TRY_CONVERT(datetime, date+'01')))
FROM yourTable;
```
[Demo
----](https://dbfiddle.uk/?rdbms=sqlserver_20... | The eomonth() function does the job :) |
3,911,013 | Hey,
I'm saving a copy of all contacts in a database.
Upon launching, I want to check if there is a new contact in the address book in order to add it to my data base.
How to perform this check? I can't find the suitable logic to implement it. | 2010/10/12 | [
"https://Stackoverflow.com/questions/3911013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394868/"
] | There's not an easy way to get "new contacts" in the address book. Instead you'll have to do something like this:
1. [Get an array of all the contacts in the address book](http://developer.apple.com/library/ios/documentation/AddressBook/Reference/ABPersonRef_iPhoneOS/Reference/reference.html#//apple_ref/c/func/ABAddre... | A little easier way(don't need too much memory space):
1. Save your App's database lastest TimeStamp when you load data from AddressBook & total person count.
2. write a check function, and call it whenever you need it
3. check function : Get the latest modification date in all contacts, and get the total count right ... |
15,510,466 | For example
```
class A
{
void f() {}
void g()
{
[this]() // Lambda capture this
{
f();
A* p = this;
[p]() // Workaround to let inner lambda capture this
{
p->f();
};
};
}
};
```
Any better way to capt... | 2013/03/19 | [
"https://Stackoverflow.com/questions/15510466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1899020/"
] | Just use `[=]`, this is implicitly captured. If you have other variables which you don't wanna capture by copy, then just capture `[this]`. | You could just re-capture `this`:
```
class A
{
void f() {}
void g()
{
[this]()
{
f();
[this]()
// ^^^^
{
f();
};
};
}
};
``` |
67,897,255 | I need to append the same list before every element in list
```py
list1 = ['foo', 'fob', 'faz', 'funk']
string = 'bar'
```
*magic*
```py
list2 = ['barfoo', 'barfob', 'barfaz', 'barfunk']
``` | 2021/06/09 | [
"https://Stackoverflow.com/questions/67897255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16037285/"
] | Simple, concatenation and list comprehension should do the job.
```
newList = [string+word for word in list1]
```
output
```
['barfoo', 'barfob', 'barfaz', 'barfunk']
``` | It would be a good idea to use comprehension for this
```
list2 = [string+i for i in list1]
``` |
1,401,248 | I have tried several ways to login to a website through java. I have used watij, HTMLunit etc. but due to not so familiar with any of these, I am not able to login successfully.
Can anyone tell me in detail how to login through java
To be more specific, I want to login to the ORKUT and want the pagesource of the page... | 2009/09/09 | [
"https://Stackoverflow.com/questions/1401248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157027/"
] | The answer depends on how the website attempts to authenticate you:
* Do you have to set a username and password in the HTTP headers (basic auth)?
* Or do you have to fill out and submit a form containing the username and password?
For either I would recommend commons-httpclient, although the latter screen-scraping a... | Why are you trying to login via Java, why not just use cURL? Is there something specific you're trying to accomplish? |
1,401,248 | I have tried several ways to login to a website through java. I have used watij, HTMLunit etc. but due to not so familiar with any of these, I am not able to login successfully.
Can anyone tell me in detail how to login through java
To be more specific, I want to login to the ORKUT and want the pagesource of the page... | 2009/09/09 | [
"https://Stackoverflow.com/questions/1401248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157027/"
] | Your best chances to do such things & survive in the real world web are with Selenium-RC.
Basically, what you will do is to remote-control your browser to do anything that you can do manually (except file uploads).
Many times, I have used this pattern:
1. Login with selenium
2. Take the cookies
3. Continue with my f... | Why are you trying to login via Java, why not just use cURL? Is there something specific you're trying to accomplish? |
1,401,248 | I have tried several ways to login to a website through java. I have used watij, HTMLunit etc. but due to not so familiar with any of these, I am not able to login successfully.
Can anyone tell me in detail how to login through java
To be more specific, I want to login to the ORKUT and want the pagesource of the page... | 2009/09/09 | [
"https://Stackoverflow.com/questions/1401248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157027/"
] | The answer depends on how the website attempts to authenticate you:
* Do you have to set a username and password in the HTTP headers (basic auth)?
* Or do you have to fill out and submit a form containing the username and password?
For either I would recommend commons-httpclient, although the latter screen-scraping a... | Orkut uses Google auth to login. My suggestion is to use an HTTP debugger like Fiddler to watch the traffic during login. Probably, there are cookies and redirects that you need to replicate.
Generally,
1. Look at the login form, get the names of the name and password field and the action that the form posts to
2. Cr... |
1,401,248 | I have tried several ways to login to a website through java. I have used watij, HTMLunit etc. but due to not so familiar with any of these, I am not able to login successfully.
Can anyone tell me in detail how to login through java
To be more specific, I want to login to the ORKUT and want the pagesource of the page... | 2009/09/09 | [
"https://Stackoverflow.com/questions/1401248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/157027/"
] | Your best chances to do such things & survive in the real world web are with Selenium-RC.
Basically, what you will do is to remote-control your browser to do anything that you can do manually (except file uploads).
Many times, I have used this pattern:
1. Login with selenium
2. Take the cookies
3. Continue with my f... | Orkut uses Google auth to login. My suggestion is to use an HTTP debugger like Fiddler to watch the traffic during login. Probably, there are cookies and redirects that you need to replicate.
Generally,
1. Look at the login form, get the names of the name and password field and the action that the form posts to
2. Cr... |
5,008,744 | ```
<ul id="list">
</ul>
<input type="checkbox" id="item1" name="item one" />
<input type="checkbox" id="item2" name="item two" />
<input type="checkbox" id="item3" name="item three" />
<input type="checkbox" id="item4" name="item four" />
```
I need to add checked items to the `#list` as li's in this format:
```
<... | 2011/02/15 | [
"https://Stackoverflow.com/questions/5008744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/149128/"
] | What you should do is make a function, e.g. `toggleListCheckbox` and call that when the page loads and also on the event.
```
function toggleListCheckbox() {
if($(this).is(':checked')) {
var checkboxId = $(this).attr('id');
var checkboxName = $(this).attr('name');
$('#list').append('<li cla... | I'd have them on the page from the beginning, and then just show/hide them using the [`filter()`*(docs)*](http://api.jquery.com/filter/) method with `this.id` and the [`toggle()`*(docs)*](http://api.jquery.com/toggle/) method with `this.checked`, while placing the most recently clicked one at the bottom of the list usi... |
26,796,171 | I'm letting users add a `UITextField` on top of their images like a caption.
I've designed it so that their images are all perfect squares according to their iPhone screen size. So on my iPhone 5S, it would be a 320x320 `UIImageView`. An iPhone 6 would be 375x375 `UIImageView`. Images posted by larger screen phones wo... | 2014/11/07 | [
"https://Stackoverflow.com/questions/26796171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/339946/"
] | No you can't stream it using the O365 REST API, you'll have to download the file first. | You could try HTTP progressive download mechanism that doesn't require full file to be downloaded prior to playback. The media player has to be capable of playing with buffered data. On most modern players that is supported. |
36,807,223 | We have implemented RTSP server on our MCU. For testing purpose we are using VLC media player as a client. We coded our MCU such a way that only after receiving PLAY command from client, MCU reads data from camera. And we are seeing MCU receives data from camera and streams thorugh RTSP. We could see data streaming fro... | 2016/04/23 | [
"https://Stackoverflow.com/questions/36807223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6243514/"
] | The error message tells you what is going wrong:
>
> live555 error: no data received in 10s, aborting
>
>
>
The usual reasons for this are firewalls or NAT?
You can select the RTP over RTSP (TCP) option in the VLC preferences to verify this. If the stream works over TCP, UDP packets are being blocked somewhere. | I suggest using ffmpeg and ffplay to test your streaming from a RTSP source.
It is command line, but the information and logs are very helpful |
30,508,243 | I have a value to check in the list range
Example:
```
recipies = int(input("enter:"))
print(recipies)
interval =[]
for i in range(recipies):
x = (input().split())
interval.append(x)
print(interval)
agroup =int(input("enter:"))
print(agroup)
qali = []
for i in range(agroup):
x = (input().split())
... | 2015/05/28 | [
"https://Stackoverflow.com/questions/30508243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2992226/"
] | You can use following list comprehensions :
```
>>> f_list=[map(int,i.split(',')) for i in li]
>>> ['yes' if toa in range(i,j) else 'No' for i,j in f_list]
['yes', 'yes']
```
Fist you need to extract your ranges that it can be done with splitting your strings with `,` and convert to `int` with `map` function.
Then... | You'll have to parse each string into a start and stop value (integers):
```
ranges = ['1,9', '2,10']
for start_stop in ranges:
start, stop = map(int, start_stop.split(','))
if toa in range(start, stop):
print('yes')
```
Instead of creating a new `range()` object you can just use comparison operator... |
57,427,048 | I am new to using react hooks api.
Earlier I used to distinguish container components and presentational components.
The project directory structure was according to this distinction.
Container components used to inject store state and action creators to the component through `props`.
With hooks I have been left clue... | 2019/08/09 | [
"https://Stackoverflow.com/questions/57427048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5093536/"
] | About the separation between container components and presentational components, Dan Abramov (working on ReactJs, co-author of Redux and Create React App) wrote this in [Presentational and Container Components](https://link.medium.com/50US3ylBB2) :
>
> Update from 2019: I wrote this article a long time ago and my vie... | As user adel commented, there is now hook equivalents of `react-redux` stuff. To read redux state, instead of `connect`, you can use `useSelector`.
```
import { useSelector } from 'react-redux'
..
const somePieceOfData = useSelector( state => state.path.to.data )
```
About container components, you can still sepera... |
57,427,048 | I am new to using react hooks api.
Earlier I used to distinguish container components and presentational components.
The project directory structure was according to this distinction.
Container components used to inject store state and action creators to the component through `props`.
With hooks I have been left clue... | 2019/08/09 | [
"https://Stackoverflow.com/questions/57427048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5093536/"
] | About the separation between container components and presentational components, Dan Abramov (working on ReactJs, co-author of Redux and Create React App) wrote this in [Presentational and Container Components](https://link.medium.com/50US3ylBB2) :
>
> Update from 2019: I wrote this article a long time ago and my vie... | I am also running into the same problem now and was looking for some nice resources in that , but here what I've reached:
There is no big need for the distinction now between UI and container components, you can use custom hooks for the same purpose and you will have fewer lines of code and more readable one. From what... |
245,958 | 1. A particular mass of helium is required to lift a particular weight. If the weight stays the same and the mass of helium is decreased can the same lift force be achieved by increasing the acceleration of the helium gas? Not to be an Einstein, but if I recall correctly, force = mass \* acceleration.
2. Also, can heli... | 2016/03/28 | [
"https://physics.stackexchange.com/questions/245958",
"https://physics.stackexchange.com",
"https://physics.stackexchange.com/users/112603/"
] | Normally when you speak of lifting by helium you are using the buoyancy of a balloon in the atmosphere. If you decrease the mass of helium you decrease the volume of the balloon. The lift capacity of a balloon is the difference between the weight of a balloon and the weight of the air it displaces. If you can lighten t... | Well, you could get more lift force out the helium by accelerating it. If the helium, let's say in a balloon, was initial moving upwards quickly and the object you're trying to lift was stationary, at some point the rope connecting them would go tight and at that point the rope will apply a downwards force on the heliu... |
30,739,144 | All:
Suppose I have two directives( dir1 and dir2) , which are both isolated scope. From some posts, I learnt that I need to use "require" to get scope of the other directive, but there is one question confused me so much:
Suppose I use ng-repeat generated a lot of dir1 and dir2, how do I know in certain dir1, which ... | 2015/06/09 | [
"https://Stackoverflow.com/questions/30739144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1647559/"
] | There's no hard rule, but sometimes you do have to do it. You will also need to do if you inherit from something or need the protocol declaration.
In general I would restate the rule as "use forward declarations of @class and @protocol whenever possible." | If you've read such a rule, that rule is wrong. You can include (and import, which is just a safer way of include) things into your header, if that's something required for the interface declaration. Otherwise save it for the implementation files. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.