input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Extract words from PDF with golang? <p>I don't understand type conversion. I know this isn't right, all I get is a bunch of hieroglyphs.</p>
<p><code>f, _ := os.Open("test.pdf")
defer f.Close()
io.Copy(os.Stdout, f)</code></p>
<p>I want to work with the strings....</p>
| <blockquote>
<p>all I get is a bunch of hieroglyphs.</p>
</blockquote>
<p>What you get is the content of a pdf file, which is not clear text.</p>
<p>If you want to read a pdf file in Go, use <a href="http://libs.club/golang/data-formats/pdf">one of the golang pdf libraries</a> like <a href="https://godoc.org/rsc.io... |
How to add custom dialog using angular2-mdl? <p>I am new to angular2 and im using angular2-mdl for my project. i tried to implement custom dialog given in the <a href="http://mseemann.io/angular2-mdl/dialogs" rel="nofollow">http://mseemann.io/angular2-mdl/dialogs</a> but i am not to get it work. I am getting errors</p>... | <p>You can find a simple working example here: <a href="http://plnkr.co/edit/HgAvCnzkWAmK1NVxfEUM?p=preview" rel="nofollow">http://plnkr.co/edit/HgAvCnzkWAmK1NVxfEUM?p=preview</a></p>
<p>It's probably the missing <code>dialogService</code> property in you 'AppComponent':</p>
<pre><code>constructor(private dialogServi... |
Java Swing Layout block <p>I'm trying to learn about layouts as I've read things about bad practice to use null layout with absolute positioning in GUI. If takes away the flexibility to expand the GUI dynamically. So I'm trying out some combinations of GUI blocks and now I've encounter a problem. Below is the GUI block... | <p>I think you should use a <code>BorderLayout</code>. Put the first three components in the <code>NORTH</code> constraint area. Put 4 in the center, and put 5 in the <code>EAST</code>.</p>
<p>The example below doesn't look exactly like your picture, because the various panels I used have different borders and layou... |
Get the Echo value from other page while a script in that file still running <p><strong>Page1.php :</strong></p>
<pre><code><html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css">
<script src="js/jquery-2.1.1.min.js"></s... | <p>Page2.php will always wait for Page3.php, since you're calling it in the script.</p>
<p>Page2.php should return the u_id, and then in the javascript code post a second time to Page3.php with the u_id recently obtained.</p>
<p>The messages is irrelevant in Page2.php, you could easily handle that part in javascript.... |
How to convert text to UIimage(use GPU) <p>I know have many questions like this on <code>stackoverflow</code>and also have the answer for it like on this link: <a href="http://stackoverflow.com/questions/23556269/how-to-convert-text-to-image">How to convert text to Image?</a>. But with me, I need to draw many(more than... | <p>UIKit is already using graphics acceleration. Your problem probably is running this method on the main thread.</p>
<p>I dont't know what your app should do without any other context, but you should move the execution of this method to a background thread.</p>
<p>If you need to process a big number of images this w... |
describe relationship between two categorical variables? <p>I have a table called "smoke", containing 300 rows (one row for each subject) and two variables ("group" and "race"). Group takes the values "smoker", "non-smoker" or "quit" and race takes the values "White", "Black", "Hispanic", "Asian". </p>
<p>I want to wr... | <p>The typical statistical test for independence of association of two categorical variables where neither of them has what I would consider a natural ordering would be a chi-squared test for independence.</p>
<pre><code>with(dataset, chisq.test( smoke, Group) )
</code></pre>
<p>To look at the actual values just:</p>... |
C: How do I make my program reject words longer than 'y' or 'n'? <p>So the code below is a small part of a larger program, and by itself works just fine:</p>
<pre><code>int main(){
char ansr;
scanf("%c", &ansr);
while (ansr != 'y' && ansr != 'n'){
printf("\n\tInvalid answer, Please try again.");
... | <p>For such use cases, don't use <code>scanf</code> to read input. Use <code>fgets</code> to read the text line by line and process each line with whatever logic makes sense.</p>
<pre><code>int main()
{
char answer[LINE_LENGTH]; // #define LINE_LENGTH to a sensible value.
while ( fgets(answer, LINE_LENGTH, stdi... |
About a Looping Program in Java <p>I need a Program in Java in which I can give any number to the program and in return it tells me that how many odd or even digits are present in that number.
for Example:- I give - 1234567,then it tells me that Even-3 digits and Odd - 5 digits Thank You</p>
| <pre><code>public class Count
{
public void display(int number)
{
int a,nOdd =0 ,nEven=0;
while(number > 0)
{
a = number % 10;
if(a%2==0)
nEven ++;
else
nOdd ++;
number = number / 10;
}
System.out.println("No. of Odd digits = "+nOdd);
System.out.println("No. of Eve... |
Show separate line not border <p>I am not sure how to make a separate line as shown in this image. </p>
<p><a href="http://i.stack.imgur.com/ln8ff.png" rel="nofollow"><img src="http://i.stack.imgur.com/ln8ff.png" alt="enter image description here"></a></p>
<p>This is what I am doing:</p>
<pre><code>.separate-line {
... | <p>If your looking to create a two coloured/seperate lined <code><hr></code>, this is a way that you can do it</p>
<p>If you zoom in close, you can see the difference in colours between the top half of the line and the bottom half</p>
<p>I've added a darker background so you can notice the difference in colour<... |
Xcode 8 (swift 3) What its an entity's type? <p>What is the correct type for an Entity?</p>
<p>For example, when saving a value to an attribute of an entity, what type declaration should replace the three question marks below?</p>
<pre><code>func setSample() {
let saveSample: <type???> = SampleEntity(contex... | <p>Use <code>??? = SampleEntity</code> or remove the <code>???</code> part completely:</p>
<pre><code>let saveSample = SampleEntity(context: context)
let saveSample: SampleEntity = SampleEntity(context: context)
let saveSample: SampleEntity
</code></pre>
|
C++ builder (no idea what to do with this code) <p>Sorry if this is wrong place to ask. I have 2 pieces of code given to me:</p>
<pre><code>IdHTTP1->Head("http://dsrt.dyndns.org/files/MAIN.zip");
Memo1->Lines->Add(DateTimeToStr(IdHTTP1->Response->Date));
Memo1->Lines->Add(DateTimeToStr(IdHTTP1->... | <p><code>TMemo</code> is an Embarcadero visual UI component. <code>TIdHTTP</code> is a component of the <a href="http://www.indyproject.org" rel="nofollow">Indy Project</a>, which ships preinstalled in Delphi and C++Builder.</p>
<p>The code you were given is UI-related code, so create UI for it. In the C++Builder IDE... |
Spring Boot class Size not found @Size(min=1,max=18) <p>I have a <code>User</code> class as below and I am trying to enforce validation and I am getting an: </p>
<blockquote>
<p>error cannot find symbol symbol: class Size</p>
</blockquote>
<p>My class looks something like this:</p>
<pre><code>import javax.persis... | <p>You are missing an import for the size annotation.</p>
<pre><code>import javax.validation.constraints.Size;
</code></pre>
|
Reading and writing BMP files in C memory error <p>I am attempting to write a program to invert the color of an image. My problem is when I try to read from the DIB header in my BMP file.</p>
<p>When I try to get the file header size and use fread(dib.fileheader, 4,1,fp); . I get an error that says "The memory could n... | <p><code>fread</code> expects a pointer to memory to write the file contents. So you need to give it the address of <code>dib.fileheader</code></p>
<pre><code>fread( &dib.fileheader, sizeof(dib.fileheader),1,fp );
printf("File header is %d bytes\n", dib.fileheader);
</code></pre>
<p>It's complaining because it's ... |
How to change date format in outlook when I am sending mail linked with Excel data? <p>Can someone help me out here with formatting date when I am sending email? In <strong>Cell 8</strong> I have date but when I'm sending email date will show as 10/03/2016 but I wanted to show date as 03-Oct-2016. I tried putting code ... | <p>Change</p>
<pre><code>"Departure/Arrival Date : " & Cells(i, 8) & vbNewLine & vbNewLine & _
</code></pre>
<p>to</p>
<pre><code>"Departure/Arrival Date : " & Format(Cells(i, 8), "dd-mmm-yyyy") & vbNewLine & vbNewLine & _
</code></pre>
|
Modifying static data member in class constructor <p>I am trying to count the number of instances of a class by modifying a static data member: </p>
<pre><code>
class C
{
public:
static unsigned int i;
C(){i++;}
};
</code></pre>
<p>this shows an error:<br>
Main.obj : error LNK2001: unresolved external symbol... | <p>A direct static data member that's assigned to needs a <em>definition</em>. Basically the definition allocates memory. Goes like this:</p>
<pre><code>class C
{
private:
static int i; // pure declaration
public:
static auto n_instances() -> int { return i; }
~C() { --i; }
C(){ ++i; }
C( C co... |
Hibernate not showing the performance log <p>I am trying to get performance statistics from Hibernate. I've already enabled hibernate statistics in the spring context.</p>
<pre><code><bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property... | <p>Turn out this is a logger issue</p>
<p>Did some debugging, I see both hql, time, rows contain correct information. But the logger still not printing out the correct format. We are using logback 1.0.12, I wonder if this will cause a problem?</p>
<pre><code>@SuppressWarnings({ "UnnecessaryBoxing" })
public void quer... |
Authorization request to Feedly API throws a bad request with Guzzle? <p>The objective is to exchange the authorization code for the access and refresh token.</p>
<p>Error:</p>
<pre><code>GuzzleHttp\Exception\ClientException #400
Client error response
[url] http://sandbox.feedly.com/v3/auth/token?code=[auth_code]&a... | <p>Starting from the bottom, as per the OAuth 2.0 specification:</p>
<blockquote>
<p>The client MUST use the HTTP "POST" method when making access token
requests.</p>
</blockquote>
<p>(source: section 3.2. <a href="https://tools.ietf.org/html/rfc6749" rel="nofollow">The OAuth 2.0 Authorization Framework</a>)</p>
... |
Extension background script doesn't load unless resaved <p>For Firefox, I have a page that loads in a new tab after clicking a browser icon button. The background script for the page runs fine the first time but not when reloading the page, clicking the button again with a tab already open, or after having closed the t... | <p>I figured out the issue and solution. I forgot once the background script is open it stays open for the lifetime of the extension. Thus, the variables aren't reset. whatever variables need to be reset have to be reset manually. As for reloading the page, only the webpage is reloaded and not the code which needs to b... |
How to use the result of a thenCompose multiple times in Java 8? <p>I have a series of <code>thenCompose</code> calls, similar to </p>
<pre><code>myObject.updateDB(payload)
.thenCompose(__ -> getUserID(payload.ID()))
.thenCompose(id -> getProfile(id))
.thenCompose(userProfile -> updateSometh... | <p>The issue with your current code is that by the time you reach <code>.thenCompose(__ -> notifyUser(id))</code>, the variable <code>id</code> is not in scope anymore.</p>
<p>A simple solution in this case would be to invoke multiple <code>thenCompose</code> directly on the <code>CompletionStage</code> returned by... |
Laravel eloquent relationship fetch records upto third level of relationship <p>I have users table which has a hasOne relationship with vendordetails table.</p>
<pre><code>class User extends Authenticatable
{
public function vendor_details() {
return $this->hasOne('App\Vendordetail');
}
}
</code></p... | <p>To access nested relationship</p>
<p><code>$user = User::with(['vendor_details.this_state','vendor_details.this_country','vendor_details.this_city'])->first();</code></p>
|
Supported Devices 0 on play console <p>Play Console shows "Supported Devices 0". </p>
<p>Questions</p>
<ol>
<li>Should I wait for the publishing to be complete ? </li>
<li>Should I expect that Supported Devices number will go up > 0 immediately after upload ?</li>
</ol>
<p>I need the camera functionality, without ca... | <p>You get 0 supported devices because you require a non-existing feature. There is no such feature called <code>android.hardware.camera2</code>. </p>
<p><a href="https://developer.android.com/reference/android/hardware/camera2/package-summary.html" rel="nofollow">android.hardware.camera2</a> is the package that provi... |
Can dafny show a counter example for a failed assertion? <p>I am trying to prove correctness / incorrectness of the following program using Dafny.</p>
<pre><code>datatype List<T> = Nil | Cons(T, List)
function tail(l:List):List
{
match l
case Nil => Nil
case Cons(x,xs) => xs
}
method check(l:Li... | <p>If you run Dafny in the visual studio extension a red dot will appear next to the failed assertion. If you click the red dot then the verification debugging view should appear. This should show a counter example (which is an execution trace with variable valuations).</p>
|
Do i need to know java or swift/objective-c to build apps with react native? <p>If yes, how much proficiency is needed in these languages? Or can I straightly go to learn <code>React/React-Native</code> after learning <code>JavaScript</code>.</p>
<p>This may attract some opinions, but not purely an opinion based quest... | <p>In order to pick up React, you should understand JavaScript and npm on a good level.</p>
<p>When it comes to React Native, understanding Xcode on a basic level will be beneficial. Android experience might come in handy too if you are interested on the Android target.</p>
<p>Read this <a href="https://www.quora.com... |
Android setting default value from Hashmap Key for Spinner in Simple Adapter <p>I have parsed some <code>JSON</code> data from <code>PHP</code> and displayed it into a <code>Spinner</code>.The data comes with Key-Value. So I used <code>Hashmap</code> together with <code>SimpleAdapter</code>. Spinner displays only the v... | <p>Create a model class for your <code>JSON</code> data,</p>
<pre><code>private class Item {
String key;
String value;
public Item(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String ke... |
Scopes required for executing "gcloud container clusters create" on GCE VM instance <p>I am trying to create a GKE cluster by executing the following command on a GCE VM instance:</p>
<pre><code>sudo gcloud container clusters create my-cluster \
--machine-type g1-small --num-nodes 1
</code></pre>
<p>Execution fails... | <p>Google Container Engine requires the <code>https://www.googleapis.com/auth/cloud-platform</code> scope, so you'll need to select "Allow full access to all Cloud APIs" when you create the VM instance.</p>
|
Switching between images with a button <p>I've got a webpage in which I need to create a button that will switch the image displayed,
the image is a schematic of a building so I will need a button to select between levels, level 1, 2 ect...</p>
<p>On top of that I need a button that will toggle another image relative... | <p>I think the easiest way for a beginner is to use it this method:</p>
<p>For example you have a folder with images. And you have a page with one image that you want to switch and a button that will toggle it.</p>
<p>This is not functional example but it might give you an idea:</p>
<p>HTML:</p>
<pre><code><img ... |
'bottom' doesn't work in Edge <p>I have the following HTML:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.arrow {
width: 50px;
position: fixed;
}
.arrow.arrow-r... | <p>Just change to the following:</p>
<pre><code>.arrow.arrow-bottom {
left: 0;
right: 0;
margin: 0 auto; /* instead of auto */
bottom: 15px;
transform: rotate(90deg);
}
</code></pre>
<p>The <code>margin: auto</code> was causing the issue. Please let me know if it solved the issue or not.</p>
|
(kernel simple programming) I want to know why pids are displayed like this <p>I am practicing making device driver programming.</p>
<p>my goal was to get current task's pid, and parent task's pid.</p>
<p>furthermore, I get grand(parent's parent) task's pid.</p>
<p>this is source code.</p>
<pre><code>struct task_st... | <p>you have not specified whether you are using IDE for writing and executing the code.
In the case if you are using it </p>
<p><code>grand parent task</code> is IDE (which is constant till you close and reopen it.</p>
<p><code>parent task id</code> - when you execute the program, the program is called by a process w... |
python: convert pandas categorical values to integer when reading csv in chunks <p>I have large csv file with 1000 columns, column 0 is an id, the other columns are categorical. I would like to convert them to integer values in order to use them for data analysis. First "dummy" way would work if I had enough memory:</p... | <p>In this case, it indeed seems that a two-pass scheme might be effective.</p>
<p>Starting with</p>
<pre><code>import pandas as pd
data=pd.read_csv(my_file_name, chunksize=my_chunk_size)
</code></pre>
<p>You could do:</p>
<pre><code>import collections
uniques = collections.defaultdict(list)
for chunk in data:
... |
Undefined offset: 0 in mail_queue.php | CentOS Web Panel <p>I am using Postfix. The mails are being sent and received properly but I am getting below PHP notice on CentOS Web Panel's mail queue page:</p>
<blockquote>
<p>Notice: Undefined offset: 0 in
/usr/local/cwpsrv/htdocs/resources/admin/modules/mail_queue.php ... | <p>So, <code>sendmail</code> was causing the issue in my case. Someone from CWP support fixed it by uninstalling it.</p>
|
ComboBox.SelectedItem is not ComboBoxItem <p>I have ComboBox which I bind with list of some objects. <strong>ComboBox.SelectedItem</strong> and <strong>ComboBox.SelectedValue</strong> return the same object instance but I was thinking <strong>SelectedItem</strong> should return <strong>ComboBoxItem</strong>.</p>
<p><s... | <p>ComboBox.SelectedItem returns an instance of the type of objects in the list, so you'll have to cast it to the appropriate type and then select the display property of that instance.</p>
<p>OR</p>
<p>It should be sufficient just to call Combox.Text, but it requires that SelectedItem != null and a defined DisplayMe... |
Need some help to schedule my automation script on my local machine Mac OS (Java+appium+selenium) <p>I had my code written in java for mobile app testing. Appium+java+IOS. JUst wanted to now how to schedule this on my local machine mac OS. Any guide or help how to do it will be appreciated. Or if there is any online se... | <p>Try this:</p>
<pre><code>0 2 * * * cd ~/your_project_folder/ && mvn clean test
</code></pre>
<p>you need to add your test suite file testng.xml to your maven build tag (pom.xml)</p>
<pre><code> <build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin&... |
LDAP - LDIF file? - Complete Confusion <p>Can someone please explain what the LDIF file on openldap is used for? Is this how you set the schema of the database? Or is this how you enter in users in your database? What do I actually have below? </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console=... | <p>LDIF stands for LDAP Data Interchange Format, and represents a textual way to enter data or export data from an LDAP directory server. In the case, above, this represents a directory structure for users and groups under a "dc=example,dc=com" domain.</p>
<p>This data must obey to an LDAP schema which may or may not ... |
Adding Sheet object to Collection causes RTE 438-Object doesnt support this method <p>I'm trying to add a Sheet object to a blank Collection. </p>
<blockquote>
<p>Line: SheetsCollection.Add (wbTested.Sheets(1))</p>
</blockquote>
<p>I want to use this collection of sheets to print their details later in another fun... | <p>remove brackets</p>
<pre><code>SheetsCollection.Add wbTested.Sheets(1)
</code></pre>
|
Transfer fund from stripe platform account to a recipient by email <p>One of my clients have a situation to pay their website user directly from platform account to user. I can do it by using their transfer payment API.</p>
<p>But, my client want to pay to user's email so that user can have option to perform rest of t... | <p>Stripe's API doesn't have anything like that, but it is something you may be able to build into your application.</p>
<p>I think you might want to contact <a href="https://support.stripe.com/email" rel="nofollow">Stripe Support</a> and fill them in on your use case and see if they can offer you some specific sugges... |
Output ArrayList has size of zero <pre><code>private static List<Integer> parseStringArrayList(List<String> input) {
System.out.println(input.size());
List<Integer> output = new ArrayList<Integer>(input.size());
for (int index = 0; index < output.size(); index++) {
output.... | <p>Initializing the Arraylist with size will not set the size of the arraylist, the size will only be modified for adding or removing elements. the capacity which represents the number of nodes the list can have before allocating the memory is what you actually defined.</p>
<pre><code>private static List<Integer>... |
prolog doesn't give me a solution when one exists <p>I am working through <em>Seven Languages in Seven Weeks</em>, but there is something I don't understand about prolog. I have the following program (based on their wallace and grommit program):</p>
<pre><code>/* teams.pl */
onTeam(a, aTeam).
onTeam(b, aTeam).
onTea... | <p>You have made a very good observation! In fact, the situation is even worse, because even the <em>most general</em> query <em>fails</em>:</p>
<pre>
?- teamMate(X, Y).
<b>false</b>.
</pre>
<p>Declaratively, this means "there are no solutions whatsoever", which is obviously <strong>wrong</strong> and not how we... |
Can't pass array from jsp to javascript <p>My jsp code and js code are within the same jsp file. I want to send two array to js part. Here is my jsp array:</p>
<pre><code>String[] node = call.getAll(results_list[i * 18 + 1]);
int[] edge = call.getAllTable2();
</code></pre>
<p>Some websites said that I have to receive... | <pre><code>Try Like this:
<script language="JavaScript">
var node1= new Array();
<%
for (int i=0; i < node .length; i++) {
%>
node1[<%= i %>] = '<%=node [i] %>';
<%}%>
</script>
</code></pre>
|
Slow SQL Server database response time issue <p>I am running a desktop based application built in C# connected to a Microsoft SQL Server Express database. About 20-30 users are accessing this application while 20-30 more systems are connected with database at the same time and it is working 24 hours daily. OS running i... | <p>There are imitations for the SQL Server Express Edition:</p>
<ul>
<li><p>Number of CPUs supported: Only one CPU at a time (max core =4 for sql express 2016). So, if your server has multiple CPUs, it will use only one CPU at a time.</p></li>
<li><p>Maximum memory used : A maximum of 1 GB memory for data buffer. So, ... |
Column with datatype TEXT or Varchchar returning null in json even its not <p>I have a php-file that returns a JSON-array</p>
<hr>
<pre><code>NAME TYPE COLLATION NULL
title varchar(50) latin1_swedish_ci No
description text latin1_swedish_ci No
</co... | <p>You can use this function json_last_error_msg() to check whether there is any error or not.
<a href="http://php.net/manual/en/function.json-last-error-msg.php" rel="nofollow">http://php.net/manual/en/function.json-last-error-msg.php</a></p>
|
AVCaptureDevice Low Light Boost swift <p>Does anyone know how to set up low light boost for your ios camera app? This is the code i have but can't make it to work. </p>
<pre><code>let backCamera = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo)
do {
try backCamera?.lockForConfigurati... | <p>You don`t need that. Put this in the didMoveToView:</p>
<pre><code>captureSession!.sessionPreset = AVCaptureSessionPresetPhoto
</code></pre>
|
Issue with variable initialization when non-static <p>I'm trying to double an array in a non-static context in the following way:</p>
<pre><code>public class Test {
int[] data=new int[1];
public void Double(){
if(data == null){
int[] data=new int[1];
}
int[] data=new int[da... | <p>You are declaring a local <code>data</code> variable in your <code>Double()</code> method (actually you are declaring two such variables), which hides the instance variable having the same name.</p>
<p>Therefore, in the statement :</p>
<pre><code>int[] data=new int[data.length*2];
</code></pre>
<p>You are accessi... |
GridView Adapter not populating? not populating on time? not being updated in onPostExecute()? <p>I'm building a UI that is comprised of a GridView with images extracted from an API, I'm using an ImageListAdapter and a MovieFragment, when I start the app I just get an empty screen.
I've tried using a list of predownloa... | <p>If you think it's a timing problem can you try calling your FetchMovieData before you set your Adapter inside the onCreateView() method</p>
<pre><code>FetchMovieData movieTask = new FetchMovieData();
movieTask.execute(urlPopular);
gridview.setAdapter(imageAdapter);
</code></pre>
|
how to add class to tag when i click on it <p>I need to add <code>class="active"</code> to tag <code><li></code> when i click on <code><a></code> to become <code><li class="active"></code> </p>
<p>Notice i have multiple <code><li></code> tags and i need to <code>class="active"</code> only for ... | <p>Use <code>.parent()</code> and <code>.addClass()</code></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(function(){
$('a').click(function(e){
e.preventDefault... |
Product advertising API PHP invalid xml response <p>Hi I am a beginner programmer trying to integrate the API into my mobile app so I can view items from amazon from my app. I have followed all the 6 simple steps <a href="https://www.jahajee.com/PHP-Amazon-Product-advertising-API-tutorial/13569/1.html" rel="nofollow">h... | <p>For my case, my error was <code>InvalidClientTokenId</code> , <code>The X.509 certificate or AWS access key ID provided does not exist in our records.</code> I simply (very carefuly) created a new access and secret keys with <a href="http://www.cloudberrylab.com/blog/how-to-find-your-aws-access-key-id-and-secret-acc... |
function that select ALL paths in folder containing specificic pieces of string <p>I would like to use the os.walk method in Python in order to select ALL the files that contain certain strings in their name. Here the code I wrote</p>
<pre><code>def func(root = root, element = ''):
c = []
for path, subdirs, fi... | <p>You may use <code>any</code> built-in function:</p>
<pre><code>import os
def func(root, elements):
c = []
for path, subdirs, files in os.walk(root):
c = c + [os.path.join(path, name) for name in files \
if any(element in os.path.join(path, name) for element in elements)]
retur... |
OpenProcessToken() gives "Access is denied" <p>As part of a project which runs as a service that spawns a process in the login screen (for desktop control) we call OpenProcessToken(), which is then duplicated and a process created. This works successfully as expected under LocalSystem, however this does not work under... | <p>Does your application run successfully when you run it with administrator privileges? If so, go to your project options, select Application and check "Enable Administrator Privileges" under Manifest File.</p>
|
Can the Sass default compiler autoprefixes? <p>If I have the example code:</p>
<pre><code>:fullscreen a {
display: flex;
}
</code></pre>
<p>Can the default <code>sass</code> compiler make it:</p>
<pre><code>:-webkit-full-screen a {
display: -webkit-box;
display: flex;
}
:-moz-full-screen a {
display: flex;
}... | <p>You can use <a href="http://compass-style.org/" rel="nofollow">Compass</a> with SASS, but it's not as elegant as autoprefixer.</p>
<p>From the <a href="http://compass-style.org/reference/compass/support/" rel="nofollow">docs</a>:</p>
<blockquote>
<p>You can configure the compass default browser support matrix by... |
Values list vs Iterating <p>I have to extract value of id field from each model instance in queryset. What is more efficient - iterating through queryset with use of list comprehension or values list method with flat argument setted to true and then converted to list?</p>
| <p><code>values_list</code> will be more performant as it will only fetch the requested fields from the database and it will not instantiate model instances.</p>
<p>Quoting the <a href="https://docs.djangoproject.com/en/1.10/ref/models/querysets/#values" rel="nofollow">Django documentation</a>:</p>
<blockquote>
<p>... |
List access scopes from inside GCE VM instance <p>How can I find out from the command line of a Google Cloud Engine (GCE) VM instance which access scopes the instance possesses?</p>
| <p>You can retrieve it from the <a href="https://cloud.google.com/compute/docs/storing-retrieving-metadata" rel="nofollow">metadata server</a>, run the command from within the VM instance:</p>
<pre><code>curl "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/?recursive=true" -H "Metadata-Fl... |
Repeated rotation - increasing image dimension at export to png <p>I want an user to draw something. I will rotate that image many times and I will save each file to a folder. A template is <code>img<degree>.png</code>, for example <code>img24.png</code> is the original image rotated by 24 degree. It's like using... | <p>If you rotate a rectangular image, you must either obtain a slightly larger image, or clip off some of that data. Often the area of interest is in fact roughly circular and the corners either background or transparent. However it's unlikely that a rotate algorithm will make that decision for you.</p>
<p>If you iter... |
Firebase cannnot be initialized on localhost <p>I can not initialize my Firebase database object in my localhost.
Can any body tell me what is wrong? As these are simple steps I am following from tutorial.</p>
<p>Below is my script. I debug to find:</p>
<pre><code>TypeError: database.set is not a function. help need... | <p>This is easier to see if you split the code into separate lines:</p>
<pre><code>var promise = database.set("Text"); // this works
promise.value("hello world"); // "promise.value is not a function"
</code></pre>
<p>The first line works without problems now. But the second line give:</p>
<blockquote>
<p>promise.v... |
Modify CSS of element in wordpress <p>I'm trying to modify a WordPress website, with WooCommerce. There is an element that is the "add to cart button" from WooCommerce where I can not find where to modify the CSS. When I inspect the item, here is what I get:</p>
<pre><code><p class="product woocommerce add_to_cart_... | <p>Just go to <strong>Appearance</strong> -> <strong>Editor</strong> and add the following line to the end of your main stylesheet (<strong>style.css</strong>):</p>
<pre><code>.add_to_cart_inline {
border: 0!important;
padding: 0!important;
}
</code></pre>
<p>Because the <strong>style</strong> attribute is us... |
C++ Optimize if/else statement <p>I wrote the following code to simulate and simplify what is happening in my application. </p>
<p>In this simplification, I have the <strong>if</strong> and <strong>else</strong> branch that are executing the same code, but writing in a different portion of memory. So I thought to use ... | <p>Your optimization of <code>if</code>/<code>else</code> with an array is the correct one. It always gives you an improvement, but the significance of the improvement depends on other factors as well.</p>
<p>Your experiment shows relative impacts of branch elimination and cache access optimization.</p>
<p>When the c... |
How can i create waypoints array of the terrain area? <p>I have a number of flying objects and i need to give them some waypoints.
What i want is to make them fly all around the terrain area in a free style.</p>
<p>Is it possinle to do it with waypoints ?</p>
<p>In the screenshot on the Main Camera inspector on the M... | <p>Rather than trying to get your flying object to behave this way with scripts it would be much easier to use the animator that comes with Unity.</p>
<p>You can choose the different locations(waypoints) with keyframes and use the built in tools to create smooth animation curves. Then if you need this behaviour to cha... |
How to change the position of letters in a word in an input string <p>i am trying to make a program wherein i want to swap/change the position of the input word:
for example:
input word: overflows
output: vorelfwos
I want to swap out the 1st and 2nd letters the 3rd and 4th and so on, and if it has a letter at t... | <p>C# strings have an <a href="https://msdn.microsoft.com/en-us/library/6x16t2tx.aspx" rel="nofollow">indexer</a>, called <a href="https://msdn.microsoft.com/en-us/library/system.string.chars(v=vs.110).aspx" rel="nofollow"><code>System.String.Chars</code></a>:</p>
<pre><code>char letter = "Hello World"[0];
</code></pr... |
How can I detect if an android device indoor with Google Fit? <p>We have an Android App which using Google Fit. We counting steps and distance for awarding users by this values. </p>
<p>But we want detect if device indoor. Is it possible with Google Fit Api?</p>
<p>Thanks in advance.</p>
| <p>This feature does not exist in the Fit API yet. Looking through the docs, it does not mention a way to detect whether you are indoor or outdoor.</p>
|
SQL Match individual word? <p>I am using <strong>like</strong> statement: <strong>%word%</strong> but the problem is it also matches words that are inside other words.</p>
<p>How can I match words that are separate from the rest in the string like this. I wanna match word1 in these strings:</p>
<p><strong>word1</stro... | <p>The main idea is: match the space too.</p>
<pre><code>col LIKE '% doc %' OR col LIKE '% doc' OR col LIKE 'doc %' OR col = 'doc'
</code></pre>
|
JS hide email function not working <p>I took the code below from a wider document, and tried to include it between 2 script tags, but for some reason it's not working (nothing happens).
Do I need to add some document ready syntax or something like this?
Thanks,</p>
<pre><code><script>
function sendAnnotatedMailT... | <p>You only defined a function but didn't call it.</p>
<p>You have to call your function like this:</p>
<pre><code><a href="javascript:sendAnnotatedMailTo('name', 'democompany', 'domain.tld', 'Subject of mail', 'Body of mail')">Send mail</a>
</code></pre>
<p>This will open your mail client and prepare an... |
Unable to override method of a jquery plugin <p>How to override a method of below jQuery sample plugin code from outside. </p>
<pre><code> //This is simplified skeleton of infinatescroll plugin.
(function ($)
{
var defaults = {
prop: 'name'
};
var methods = {
... | <p>can you afford something like this ? </p>
<pre><code><script type="text/javascript">
//This is simplified skeleton of infinatescroll plugin.
(function ($)
{
var defaults = {
prop: 'name'
};
var methods = {
init: function (params)
{
... |
how to convert SFML image to OpenCV mat in C++? <p>Below code is used to convert an OpenCV Mat image into SFML image. How to convert SFML image back to Mat image?</p>
<pre><code> cv::Mat frameBGR, frameBGRA;
sf::Image image;
cv::cvtColor(frameBGR, frameRGBA, cv::COLOR_BGR2RGBA);
image.create(frameRGBA.c... | <p>This code worked for me:</p>
<pre><code>cv::Mat sfml2opencv(const sf::Image& img){
//get size from image
cv::Size size(img.getSize().x, img.getSize().y);
//create a mat on image memory
cv::Mat mat(size,CV_8UC4, (void*)img.getPixelsPtr(), cv::Mat::AUTO_STEP);
//make SFML RGBA to OpenCV BGRA
... |
Javascript map string lookup. Can't find key even though key is in object <p>I must be missing something pretty standard here.</p>
<p>I have a map mapping string to object. What I write out:</p>
<pre><code>console.log(playerMap, this.id(), playerMap[this.id()]);
</code></pre>
<p>What it prints out:
<a href="http://i... | <p>Based on your Fiddle, apparently your <code>playerMap</code> is not yet initialised when you <code>new FeedViewModel()</code>, if you change your console.log to</p>
<pre><code> console.log(Object.keys(playerMap).length, this.id(), playerMap[this.id()]);
</code></pre>
<p>you will see the object is empty</p>
<pre><... |
Return document count with mongoose in NodeJS <p>How can I return the count of documents returned by a query?
I have a routing file, which have the following code:</p>
<pre><code>router.post('/facebookLogin', function(req, res, next){
var User=require('../models/user');
var a=User.facebookUserExist(req.body.id... | <p>We know that JavaScript is asynchronous and won't wait for result. So you may either use callback or Promise object, here is example of callback for your code </p>
<pre><code>router.post('/facebookLogin', function(req, res, next){
var User=require('../models/user');
User.facebookUserExist(req.body.id, req.b... |
StoreKit in Xcode 8 and iOS 10 not working <p>I am using XCode version 2345.1 and I have a device with iOS 10.0.1. The app was working with in-app purchases in iOS 9, now I cannot perform that functionality. </p>
<p>On debugging, I got 'SKErrorUnknown' in one device whilst in another I got 'SKErrorClientInvalid'. The ... | <p>May be your app is enabled only for other location, test user was localised for other - and with this setup does not work.</p>
<p>You should enabled the app for USA and created a test user localised in USA and it seems to work (no code change at all). And I think that proves that the code is ok, just the apple sand... |
onsubmit function fails to find function bundled by webpack <p>I must be be missing something really basic with Webpack or JS. I just want to call a bundled function in a form's submit function. I get a function not found message and I can't figure out why.</p>
<p>Error
index.html:13 Uncaught ReferenceError: doubl... | <p>The problem is trying to mix page and bundled JS. They're in different scope, hence the bundled method not being visible. </p>
<p>I moved the onsubmit function from the page to the entry file, running after window.load. The window object is of course global so the bundled code can add event handlers to any DOM elem... |
underscore.js Uncaught SyntaxError: missing ) after argument list <p>I am facing this weird issue where in I am getting error as</p>
<blockquote>
<p>underscore.js:(Line number-1442) Uncaught SyntaxError: missing ) after argument list.</p>
</blockquote>
<p>I am using jQuery, Underscore and Backbone.js in my project.... | <p>The scripts are placed after closing the body tag, which is not valid, put them just before . This might be the reason for your script not working.</p>
|
Rendering barcode using Barby generator and WickedPDF <p>I'm trying to render a Barcode on the show action using Barby on a PDF, but it's not showing the barcode in visual aspects. <code>new_barcode_pdf</code> is active and returns: 4000000000297</p>
<p>The code i'm using in my controller:</p>
<pre><code>@barcode = B... | <p>I figured out what the problem was, the PDF itself requires to have the CSS inside the same PDF file.</p>
|
How to set VBox size to scene <p>I have a VBox as root in a scene, this VBox contains a MenuBar and a BorderPane.
What i would know is how to make automatic the resizing of everything (i guess that only the vbox should be enough) when the window is resized widthout adding a changelistener to the scene.widthproperty pr... | <p>You can try with this hack:</p>
<pre><code>@Override
public void start(Stage primaryStage) throws Exception
{
//Get visible bounds of the screen
Rectangle2D screenbounds=Screen.getPrimary().getVisualBounds();
VBox root=new VBox();
//Set scene's size to maximum
Scene s... |
Push notification open a new activity <p>I am using OneSignal push notification service.
When user clicking on the push notification it is open automaticlly a new activity called "Main2Activity.java".
When the user clicking on the notification, the code is working and open a new acvtivity. But if I am sending another ... | <p>When you open activity from notification then you put some data which is identify user came from notification</p>
<p>And when user press back button from mainactivity2 then check, user came from notification or any other place, if came from notification then close app.</p>
<p>Add below code in your menifest.xml</p... |
How to write your program more efficiently <p>I have written a code for adding three numbers and printing their sum. Is there a way in which I can write this code more efficiently like initializing and introducing each variable together. </p>
<p>Code goes as follows:</p>
<pre><code>#include <stdio.h>
int main... | <blockquote>
<p>can write this code more efficiently like initializing and introducing each variable together. </p>
</blockquote>
<p>Use an array: </p>
<pre><code>int numbers[3] = {0};
</code></pre>
<p>The above line defines three <code>int</code>s and initialises all of them to <code>0</code>.</p>
<p>To access t... |
SimpleForm (DOB not displaying correctly) <p>For some reason SimpleForm is treating Date fields differently to other fields. This was the standard output after running the installs. You can see that the DOB (Date) is missing some elements I need to add: </p>
<ol>
<li>add the col-sm-3 class</li>
</ol>
<p>class="<st... | <h1>simple_form.rb</h1>
<pre><code>**OLD**
config.wrappers :multi_select_date, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
b.use :html5
b.optional :readonly
b.use :label, class: 'control-label'
b.wrapper tag: 'div', class: 'form-inline' do |ba|
ba.use :input, class: 'form-con... |
Python and time / datetime <p>I've recently began work on a Python program as seen in the fragment below.</p>
<pre><code># General Variables
running = False
new = True
timeStart = 0.0
timeElapsed = 0.0
def endProg():
curses.nocbreak()
stdscr.keypad(False)
curses.echo()
curses.endwin()
quit()
# Dr... | <p>Using Ëtime.time`:</p>
<pre><code>import time
star = time.time()
# run long processing...
elapsed = time.time() - start
</code></pre>
<p>Et voilà !</p>
|
call function from list(string) in another py file <p>i have 3 python scripts ('testPrint01.py','testPrint02.py','testPrint03.py')
and i would like to call function from 'testPrint02'</p>
<pre><code> import sys
sys.path.append(path)
a = ['testPrint01','testPrint02','testPrint03']
import sys.a[1]
a[... | <p>If you're in the same directory as your target script you can use</p>
<pre><code>from testPrint02 import x
</code></pre>
<p>Where x is the function you want to import.</p>
<p><strong>Edit</strong>:
To import a module from a string variable you can use <code>importlib</code> as described here: <a href="http://stac... |
JBOSS FUSE - Community Version <p>I am exploring the possibility of using the community version of FUSE ESB in a production system for a period of one year. Is it possible? Can you please provide some advice here? </p>
<p>Just like RHEL, can I continue to use RedHat Jboss FUSE in production environment free of cost... | <p>Have your legal team review the agreement. My understanding matches yours. There are no technical limiting factors (no registration keys, etc), and Fuse is free to use the software for development purposes, but production usage requires a subscription. </p>
|
Doctrine said I should split parameter in explicit fields but then my ID is empty <p>I'm using a third party software which neither using Symfony nor Doctrine nor something else. Only PHP & MySQL.</p>
<p>And now I tried to generate entities from this old MySQL structure and using them into my project.
But I don't ... | <p>If it's possible, merge the oneToOne tables into one single table.
You should also use better attribute names like :</p>
<pre><code>/**
* Passage
*
* @ORM\Table(name="passage", @ORM\Index(name="IDX_98AF07F7EC91F2AA", columns={"DcplID"})})
* @ORM\Entity
*/
class Passage
{
/**
* @var boolean
*
... |
VisualStudio:Could not create SSL/TLS secure channel <p>I have searched for this alot but couldn't find this specific problem related answer.</p>
<p>I am accessing a web service trough my c# web application. The web service require a certificate in the request to authenticate.</p>
<p>The web application is in develop... | <p>Just a guess: This maybe a certificate access error.</p>
<p>You can edit the ACL of the certificate: Select the certificate in the MMC; context menu; all tasks; manage private keys.</p>
<p>The administrators are in this list by default. This matches with the behavior you describe.</p>
|
Ball stops bouncing after 4-5 seconds <p>Here is the javascript:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var canvas = document.getElementById('canvas'),
ctx = can... | <p>Short answer is you are getting many hits because you are not moving the ball up away from the ground. The next frame it is still impacting the ground and as you reduce its speed it just bogs down..</p>
<p>Add this after line 29 of your fiddle.</p>
<pre><code>ay = canvas.height - radius;
</code></pre>
<p><a href=... |
how would I convert an inputted string into a list? <p>I am doing a python assessment in school which requires me to take an inputted sentence and a word the user inputs to analyse the text and output the positions of where the word is in the text, for part of this task i am trying to convert the inputted sentence into... | <p>Are you trying to make a list of the words in the sentence, or of each character?
If the former; then as you did with string.split() is fine.
If the later; try creating a list and then adding each character of the string to it.
This is how I'd do it:</p>
<pre><code>string="Hello World of Python"
char_list=[]
for ch... |
J2ME Controls LEFT and UP <p>I'm trying to make a 2d game using java microedition and i just want to make my control smoother but the problem is when i press the LEFT key while pressing the UP Key the condition is not working i dont know why</p>
<pre><code>public void moveJet2() throws IOException{
int gameAction... | <p><code>getKeyStates()</code> returns the state of keys in a single int. The various keys have individual values. UP_PRESSED = 0x0002 and LEFT_PRESSED = 0x0004. So if you press UP on your d-pad while calling <code>getKeyStates()</code>, you'll get 2 back, and <code>if (getKeyStates()==UP_PRESSED)</code> will thus be t... |
Error installing MySQL-python: Unable to find vcvarsall.bat <p>I was trying to install <code>mysql-python</code> using <strong>pip</strong><br>
I'm getting the following error: </p>
<pre><code>error: Unable to find vcvarsall.bat
----------------------------------------
Failed building wheel for mysql-python
...
... | <p>First check your Python installation & Windows 10 Installation [i.e. Is it 32Bit or 64Bit].</p>
<h1>Visual C++ Redistributable comes with x86 as well x64 make sure you have installed compatible package.</h1>
|
Relocating legend from GeoPandas plot <p>I'm plotting a map with legends using the GeoPandas plotting function. When I plot, my legends appear in the upper right corner of the figure. Here is how it looks like:
<a href="http://i.stack.imgur.com/s9euK.png" rel="nofollow"><img src="http://i.stack.imgur.com/s9euK.png" alt... | <p>You can access the legend defined on the <code>ax</code> instance with <code>ax.get_legend()</code>. You can then update the location of the legend using the method <code>set_bbox_to_anchor</code>. This doesn't provide the same ease of use as the <code>loc</code> keyword when creating a legend from scratch, but does... |
Unable to use Glimpse. Ambiguity in IApplicationBuilder package <p>I am creating and angular 2 app using asp.net core. I have selected the latest 4.6.1 DotNetFramwork version while creating the project.I have also added the Glimpse package version "2.0.0-beta1". I am having trouble in the startup.cs file as getting con... | <p>Glimpse 2 Beta 1 supports .NET Core RC1. </p>
<p>Try using Glimpse 2 Beta 2 from the NuGet feed at <a href="https://www.myget.org/gallery/glimpseprototype" rel="nofollow">https://www.myget.org/gallery/glimpseprototype</a> for .NET Core RTM Support</p>
|
How to read this line of code <p>I am using this </p>
<pre><code>while ((nextLine = br.readNext()) != null) {
</code></pre>
<p>quite frequent but I don't really understand it.<br>
It is part of the code where the csv file is uploaded.<br>
Basically I would like to know, hot to read it.<br>
Nextline is defined as: <co... | <p>The line</p>
<pre><code>while ((nextLine = br.readNext()) != null) {
</code></pre>
<p>takes advantage of the fact that an "assignment" is also an "expression" that has a value - the assigned value.</p>
<p>So the line, reading from inside the parentheses out, does the following:</p>
<ol>
<li>Calls <code>readNext(... |
ServiceConnection onServiceConnected is not calling <p>Getting null object error on <code>Service</code> object. This method is not initializing </p>
<p><code>private ServiceConnection musicConnection = new ServiceConnection()</code></p>
<p>Its containg tab host then this <code>Fragment</code>.</p>
<pre><code>public... | <p>i had not registed MusicService in "AndroidManifest.xml". so i include this line and it started working.
"< service android:name=".MusicService" />"
we need to register services in manifest..</p>
|
Why tr of table cannot be displayed orderly in primefaces <p>I have encountered a problem.It is that I want to place a multiSelectListbox at bottom of table(not dataTable). However, when I do it,
the multiSelectListbox is displayed on the top of table.</p>
<p>The below is my codes:</p>
<pre><code><table id="addBo... | <p>You need to place your multiselectlistbox in cell.In your case you will need to colspan:</p>
<pre><code><tr><td colspan="5">
<p:multiSelectListbox value="#{bookView.newBook.category}" effect="slide" header="Categories" showHeaders="true">
<f:selectItems value="#{bookView.categories}... |
How to get view count of telegram channel's post in php <p>How can I get a channel post view count in telegram via php. Or how get top viewed post in telegram channel by php?</p>
| <p>updateChannelMessageViews#98a12b4b .
maybe this action can be useful . but you should use it as telegram CLI not bot</p>
|
How to get python tcp server/client to allow multiple clients on ant the same time <p>I have started to make my own TCP server and client. I was able to get the server and the client to connect over my LAN network. But when I try to have another client connect to make a three way connection, it does not work. What will... | <p>This is your main problem: <code>Thread(target=clietConnect()).start()</code> executes the function <code>clientConnect</code> and uses it's return value as the Thread function (which is None, so the Thread does nothing)</p>
<p>Also have a look at:</p>
<p>1) You should wait for all connections to close instead of ... |
How to interpret the strange training curve for RNN? <p>I use the <code>tensorflow</code> to train a simple two-layer RNN on my data set. The training curve is shown as follows:</p>
<p><a href="http://i.stack.imgur.com/DkSvl.png" rel="nofollow"><img src="http://i.stack.imgur.com/DkSvl.png" alt="RNN curve"></a></p>
<p... | <p>It's absolutely OK since you are using SGD. General trend is that your accuracy increases as number of used minibatches increases, however, some minibatches could significantly 'differ' from most of the others, therefore accuracy could be poor on them.</p>
|
render array of object into a <li> in react.js <p>I read an article and the author critic below code, I wonder what's wrong with it. I was starting to learn React, too bad the author did not point out what's his problem with the code below. I tested the code below, it's running fine.</p>
<pre><code>import React from '... | <p><strong>In short, you code will not ensure component re-usability</strong>.</p>
<p>With React, you'll get the most of <strong>re-usability</strong>. In the above code, I can see that you are trying to render the items in the state in the function <code>renderItem()</code>. The need of using <code>functions</code> i... |
Does suspended state exist in Android? <p>In iOS if user press home button, app will move to <code>suspended state</code>. Double click of the home button, suspended apps appear, and selecting an app will bring back it to <code>active state</code>.</p>
<ul>
<li>How is it by Android? App can become to <code>suspended s... | <p>Have a look over <a href="https://developer.android.com/training/basics/activity-lifecycle/starting.html" rel="nofollow">Android Activity Lifecycle</a></p>
<p>In android, if the app is not "on the main screen" it counts as Paused state.</p>
<p>By starting an app, there will be a one and only call for onCreate, lat... |
How to call controller method from jsp using ajax <p>I am using spring boot, maven 3.2.5.
I am working on simple maven webapp using spring boot following mvc pattern.
i am trying to call controller method from jsp suing ajax.</p>
<p>this is my jsp javascript method look like , which call the ajax call to call the con... | <p>there's some changes to be made in the contoller method</p>
<pre><code>@RequestMapping(value = "/listExistingUser", method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<Object> getAuthentication(){
System.out.println("listExistingUser is called in controller");
return new ResponseEntity<Object&g... |
my jquery code doesnot work in bootstrap <p>My jquery code doesnot work in bootstrap. i have some columns and i want to put submission form within specific column but when i use form tag my jquery wont work.</p>
<pre><code> <body>
<form>
<div class="row" id="row1">
<div class="c... | <p>You need to use preventDefault() as shown below:</p>
<pre><code>$(document).ready(function(){
$("#btn").click(function(e){
e.preventDefault();
$("#row1").slideUp("slow");
});
});
</code></pre>
<p>When you are putting the <code>form</code> tag and there is a <code>button</code> tag inside it... |
SQL - Find the lowest unused number <p>I have a 'number' column in 2 different tables. This isn't the ID.</p>
<p>I have created a union like so:</p>
<pre><code>SELECT number FROM table1 UNION SELECT number FROM table ORDER BY number ASC
</code></pre>
<p>This results in the following:</p>
<pre><code>number
=====
1
... | <p>Here is one way:</p>
<pre><code>select min(number + 1)
from t
where not exists (select 1 from t t2 where t2.number = t.number + 1);
</code></pre>
<p>With two different tables, I would phrase this as:</p>
<pre><code>select min(x)
from ((select min(number + 1) as x
from t1 t
where not exists (select 1... |
url scheme: open windows application on request [Electron] <p>i have a php website and i have an electron based desktop application
i want to be able to open this application which i made it when the client hit the button on my website, how can i do that? </p>
<p>for example, let's say i have a chatting website and a ... | <p>What you are attempting is really hard. Most browsers operate inside a sandbox, meaning that the website code (javascript) cannot do anything outside the browser. You would have to build something like a browser extension to make it work.</p>
|
Form input required message doesn't disappear after input is made <p>Refer <a href="http://codepen.io/shirodkarsohan/pen/kkGEgR?editors=1000" rel="nofollow">this codepen link</a></p>
<p>I have a simple form built using angular material. have referred <a href="https://material.angularjs.org/latest/demo/input" rel="nof... | <p>You forgot to inject <code>ngMessages</code> to your app.</p>
<pre><code>angular.module('BlankApp', ['ngMaterial', 'ngMessages']);
</code></pre>
|
Android - IContentService cannot be resolved <p>In my project I need to use IContentService, and I've used the right import (import android.content.IContentService) and yet android studio tells me 'Cannot resolve symbol IContentService'.</p>
<p>I know IContentService is an actual class, because it is used in ContentRe... | <p>You cannot use this class directly.</p>
<p>You can see in the source code (e.g. <a href="https://android.googlesource.com/platform/frameworks/base/+/marshmallow-release/core/java/android/content/IContentService.aidl" rel="nofollow">here for Marshmallow</a>) that this class is tagged with the <code>@hide</code> anno... |
Redirect whole Subdirectory to Subdomain Subdirectory with .htaccess <p>Although I know a bit of RegEx I can't figure out, or find an answer here, on how to redirect subdirectory to <strong>subdomain's subdirectory</strong>. This is not a duplicate because every post here covers how to redirect subdirectory to subdomai... | <p>This should do the trick</p>
<pre><code><VirtualHost *:80>
ServerName example.com
ServerAlias *.example.com
RewriteEngine on
RewriteCond %{HTTP_HOST} !^sub.example.com$
RewriteRule ^sub/directory/here/(.*) http://sub.example.com/directory/$1 [R,L]
</VirtualHost>
</code></pre>
<p><strong>EDIT</strong> ... |
Given a few points and circles, how can I tell which point lies in which circles? <p><strong>Given a small number of points and circles (say under 100), how do I tell which point lies in which circles? The circles can intersect, so one point can lie in multiple circles.</strong></p>
<p>If it's of any relevance, both p... | <p>If the number of points and circles is that small, you probably will get away with brute-forcing it. Circle-point intersections are pretty cheap, and 100 * 100 checks a frame shouldn't harm performance at all.</p>
<p>If you are completely sure that this routine is the bottleneck and <em>needs</em> to be optimized, ... |
How can I validate my Other option in dropdown list? <p>How can I validate my Other <strong>input field</strong> in Laravel 4.2 which appears after choosing <strong>Other</strong> option in a <strong>dropdown</strong> list? The values from my dropdown list are already required, now I want to apply the same loggic of va... | <p>You need to use <a href="https://laravel.com/docs/4.2/validation#rule-required-if" rel="nofollow">required_if</a>.</p>
<pre><code>protected $rules = array(
'email' => 'required|email|unique:users',
'password' => 'required|min:8|confirmed',
'first_name' => ... |
how to stay sticky after form submit with jQuery toggle <p>I have two forms in the same HTML file .</p>
<pre><code><form id="#login" class="toggling">
</form>
<form id="#register" class="toggling">
</form>
</code></pre>
<p>I switch between my forms with </p>
<pre><code>$('.toggling').toggle(... | <p>You can use hidden input field to identify the form which is sending you the request. e.g.</p>
<pre><code><form id="#login" class="toggling">
<input type="hidden" name="form_type" value="login" />
</form>
<form id="#register" class="toggling">
<input type="hidden" name="form_typ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.