Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
39,799,896
What does the term pass mean in python?
<p>What does pass mean in python? I have seen it used and I do not see why you need to use it or what it does? I guess I could say it passes over whatever function it is in, but why include it?</p>
<python>
2016-09-30 20:51:07
LQ_CLOSE
39,800,791
Post an sql transaction
I would like to trigger an sql transaction/a database query after a specific time(say 5 days) from an event(say a user clicked a button) in my website running on php server
<php><mariadb>
2016-09-30 22:12:14
LQ_EDIT
39,801,113
Please help!! forever grateful to the universe with traffic light code
**I LOVE YOU** Below is my code... it works perfectly fine but... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <body> <img id="trafficlights" src="Redlight.jpeg" style="width:128px;height:128px;"> <button type="button" onclick="changetrafficlights()">Change Traffic Lights</button> <script> var position = 0; var list = ["Redlight.jpeg","RedAmberlight.jpeg","Greenlight.jpeg", "Amberlight.jpeg"]; function changetrafficlights() {position = position + 1; if(position == list.length){ position = 0; } var image = document.getElementById('trafficlights'); image.src=list[position];} </script> </body> </html> **hey, im trying to make a javascript code in which will use a while loop or for loop in which will go through the variable "list" automatically... please help!!!!!**
<javascript><html><arrays>
2016-09-30 22:45:31
LQ_EDIT
39,802,076
pandas drop row based on index vs ix
<p>I'm trying to drop pandas dataframe row based on its index (not location).</p> <p>The data frame looks like </p> <pre><code> DO 129518 a developer and 20066 responsible for 571 responsible for 85629 responsible for 5956 by helping them </code></pre> <p>(FYI: "DO" is a column name)</p> <p>I want to delete the row where its index is 571 so I did:</p> <pre><code>df=df.drop(df.index[571]) </code></pre> <p>then I check df.ix[571]</p> <p>then what the hell it's still there!</p> <p>So I thought "ok, maybe index and ix are different!"</p> <pre><code>In [539]: df.index[571] 17002 </code></pre> <p>My question is</p> <p>1) What is index? (compared to ix)</p> <p>2) How do I delete the index row 571 using ix?</p>
<python><pandas><dataframe>
2016-10-01 01:17:02
HQ
39,802,157
Obfuscating Swift code before submission to Apple App Store
<p>I'm having a hard time finding any info on this. Android themselves mention code obfuscation as something to do before submitting to their store. But I see nothing about this from Apple or from any "third party" before-submission checklists. The only similar question I could find was one 5 years ago about Objective-C, and I only can find 1 github library about iOS obfuscation. Is it a common practice to obfuscate Swift code when submitting to the Apple App Store? Especially to hide any private API URLs or API keys? Is there a Pro-Guard equivalent for Apple?</p>
<ios><swift><app-store><obfuscation>
2016-10-01 01:30:59
HQ
39,802,631
Is Google Cloud Storage an automagical global CDN?
<p>I’m attempting to setup a Google Cloud Storage bucket to store and serve all the static objects for my site. I’m also attempting to push all the objects in that bucket out to all the global edge locations offered by Google Cloud CDN.</p> <p>I’ve created a bucket on Google Cloud Storage: <code>cdn.mysite.com</code>. I chose “US” multi-region for the bucket <code>location</code> setting.</p> <p>My assumption is that any object stored in this bucket will be replicated to all the <code>us-*</code> regions for high-durability purposes, but <strong>not</strong> pushed out to all the Google Cloud CDN global edge locations for CDN purposes.</p> <p>Or are all my objects in my “US” multi-region bucket already automagically pushed out to all of Google Cloud CDN edge locations?</p> <p>I’m gobsmacked that I can’t figure out whether or not my bucket is <em>already</em> a CDN or not. Even after two days of searching (Google, ironically).</p> <p>Thanks in advance for any help.</p>
<google-cloud-storage><google-cloud-platform><google-cloud-cdn>
2016-10-01 03:09:02
HQ
39,802,825
In mysql ,I cann't create the table,it say that erros code:1005. there are some Chiese annotation
CREATE DATABASE bookstore; /*用户表*/ CREATE TABLE tb_user( uid CHAR(32) PRIMARY KEY,/*主键*/ username VARCHAR(50) NOT NULL,/*用户名*/ `password` VARCHAR(50) NOT NULL,/*密码*/ email VARCHAR(50) NOT NULL,/*邮箱*/ `code` CHAR(64) NOT NULL,/*激活码*/ state BOOLEAN/*用户状态,有两种是否激活*/ ); /*分类*/ CREATE TABLE category ( cid CHAR(32) PRIMARY KEY,/*主键*/ cname VARCHAR(100) NOT NULL/*分类名称*/ ); INSERT INTO category(cid,cname) VALUES ('1','JavaSE'); INSERT INTO category(cid,cname) VALUES ('2','JavaEE'); INSERT INTO category(cid,cname) VALUES ('3','Javascript'); /*图书表*/ CREATE TABLE book ( bid CHAR(32) PRIMARY KEY,/*主键*/ bname VARCHAR(100),/*图书名*/ price DECIMAL(5,1),/*单价*/ author VARCHAR(20),/*作者*/ image VARCHAR(200),/*图片*/ cid CHAR(32),/*所属分类*/ FOREIGN KEY (cid) REFERENCES category(cid)/*建立主外键关系*/ ); INSERT INTO book VALUES ('1','Java编程思想(第4版)','75.6','qdmmy6','book_img/9317290-1_l.jpg','1'); INSERT INTO book VALUES ('2','Java核心技术卷1','68.5','qdmmy6','book_img/20285763-1_l.jpg','1'); INSERT INTO book VALUES ('3','Java就业培训教程','39.9','张孝祥','book_img/8758723-1_l.jpg','1'); INSERT INTO book VALUES ('4','Head First java','47.5','(美)塞若','book_img/9265169-1_l.jpg','1'); INSERT INTO book VALUES ('5','JavaWeb开发详解','83.3','孙鑫','book_img/22788412-1_l.jpg','2'); INSERT INTO book VALUES ('6','Struts2深入详解','63.2','孙鑫','book_img/20385925-1_l.jpg','2'); INSERT INTO book VALUES ('7','精通Hibernate','30.0','孙卫琴','book_img/8991366-1_l.jpg','2'); INSERT INTO book VALUES ('8','精通Spring2.x','63.2','陈华雄','book_img/20029394-1_l.jpg','2'); INSERT INTO book VALUES ('9','Javascript权威指南','93.6','(美)弗兰纳根','book_img/22722790-1_l.jpg','3'); SELECT * FROM book; /*订单表*/ CREATE TABLE orders ( oid CHAR(32) PRIMARY KEY,/*主键*/ ordertime DATETIME,/*订单生成时间*/ total DECIMAL(10,0),/*订单合计*/ state SMALLINT(1),/*订单状态:未付款、已付款但未发货、已发货但未确认收货、收货已结束*/ uid CHAR(32),/*订单的主人*/ address VARCHAR(200),/*订单的收货地址*/ FOREIGN KEY (uid) REFERENCES USER (uid)/*建立主外键关系*/ ); SELECT * FROM orders; /*订单项表*/ CREATE TABLE orderitem ( iid CHAR(32) PRIMARY KEY,/*主键*/ COUNT INT,/*数量*/ subtotal DECIMAL(10,0),/*小计*/ oid CHAR(32),/*所属订单*/ bid CHAR(32),/*订单项所指的商品*/ FOREIGN KEY (oid) REFERENCES orders (oid),/*建立主外键关系*/ FOREIGN KEY (bid) REFERENCES book (bid)/*建立主外键关系*/ ); the erros messages: 共 1 行受到影响 执行耗时 : 0.003 sec 传送时间 : 2.045 sec 总耗时 : 2.048 sec -------------------------------------------------- 共 0 行受到影响 执行耗时 : 0.049 sec 传送时间 : 0.010 sec 总耗时 : 0.060 sec -------------------------------------------------- 共 0 行受到影响 执行耗时 : 0.025 sec 传送时间 : 1.022 sec 总耗时 : 1.048 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.094 sec 传送时间 : 0 sec 总耗时 : 0.095 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.059 sec 传送时间 : 0 sec 总耗时 : 0.060 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.044 sec 传送时间 : 0 sec 总耗时 : 0.045 sec -------------------------------------------------- 共 0 行受到影响 执行耗时 : 0.007 sec 传送时间 : 0.051 sec 总耗时 : 0.059 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.060 sec 传送时间 : 0 sec 总耗时 : 0.061 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.092 sec 传送时间 : 0 sec 总耗时 : 0.093 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.075 sec 传送时间 : 0 sec 总耗时 : 0.076 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.045 sec 传送时间 : 0 sec 总耗时 : 0.046 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.010 sec 传送时间 : 0 sec 总耗时 : 0.011 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.075 sec 传送时间 : 0 sec 总耗时 : 0.075 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.011 sec 传送时间 : 0 sec 总耗时 : 0.012 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.074 sec 传送时间 : 0 sec 总耗时 : 0.075 sec -------------------------------------------------- 共 1 行受到影响 执行耗时 : 0.097 sec 传送时间 : 0 sec 总耗时 : 0.097 sec -------------------------------------------------- 返回了 9 行 执行耗时 : 0.001 sec 传送时间 : 0 sec 总耗时 : 0.001 sec -------------------------------------------------- 查询:/*订单表*/ CREATE TABLE orders ( oid CHAR(32) PRIMARY KEY,/*主键*/ ordertime DATETIME,/*订单生成时间*/ total DECIMAL(... 错误代码: 1005 Can't create table 'bookstore.orders' (errno: 150) 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.025 sec -------------------------------------------------- 查询:SELECT * FROM orders LIMIT 0, 1000 错误代码: 1146 Table 'bookstore.orders' doesn't exist 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.001 sec -------------------------------------------------- 查询:/*订单项表*/ CREATE TABLE orderitem ( iid CHAR(32) PRIMARY KEY,/*主键*/ COUNT INT,/*数量*/ subtotal DECIMAL(10,0),/*小议. 错误代码: 1005 Can't create table 'bookstore.orderitem' (errno: 150) 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0.056 sec -------------------------------------------------- 查询:SELECT * FROM orderitem LIMIT 0, 1000 错误代码: 1146 Table 'bookstore.orderitem' doesn't exist 执行耗时 : 0 sec 传送时间 : 0 sec 总耗时 : 0 sec What should I solve it?
<mysql><sql>
2016-10-01 03:48:08
LQ_EDIT
39,802,871
Angular2: How do you mark FormGroup control dirty via `patchValue()`
<p>I am updating a Reactive <code>FormGroup</code> control value from my component via <a href="https://angular.io/docs/ts/latest/api/forms/index/FormGroup-class.html#!#patchValue" rel="noreferrer">patchValue</a>.</p> <p>Ex:</p> <pre><code>this.myForm.patchValue({incidentDate:'2016-09-12'); </code></pre> <p>This works great and triggers a <code>valueChanges</code> event, however this control's <code>dirty</code> property is still <code>false</code>.</p> <p>I need the <code>incidentDate</code> control to be <code>dirty</code> so my validation logic knows to run against this control.</p> <p>How do I update the value of a control from my component AND indicate that it is dirty?</p> <p>Here is my validation logic:</p> <pre><code>onValueChanged(data?: any) { if (!this.myForm) { return; } const form = this.myForm; for (const field in this.formErrors) { // clear previous error message (if any) this.formErrors[field] = ''; const control = form.get(field); if (control &amp;&amp; control.dirty &amp;&amp; !control.valid) { const messages: any = this.validationMessages[field]; for (const key in control.errors) { this.formErrors[field] += messages[key] + ' '; } } } } </code></pre>
<angular>
2016-10-01 03:56:41
HQ
39,803,143
Object.constructor() vs Array.prototype.join() in terms of performance
I've been reading this thread to check if object is an array or not. > http://stackoverflow.com/questions/4775722/check-if-object-is-array?rq=1 The solution mentioned is: function isArray(obj){ return !!obj && Array === obj.constructor; } But I've written the following function function isArray(obj) { return obj.split; } I've done some sample test. I'm finding array.join() returns faster result than object.constructor(). Am I missing something? **I thought Object.constructor() is the parent class hence faster, but I'm able to return faster results using obj.split. Does it mean the answer in the other SO post was incorrect?** **Jsfiddle:** > https://jsfiddle.net/vdpseotp/6/ Please explain.
<javascript><arrays><performance>
2016-10-01 04:49:07
LQ_EDIT
39,803,299
Using %i and %I symbol array literal
<p>Reading through a list of Rails questions, I'm having trouble finding what the %i does in relation to a symbol array. Does this mean anything to anyone?</p>
<ruby-on-rails><ruby>
2016-10-01 05:20:50
HQ
39,803,954
IPFS: How to add a file to an existing folder?
<p>Given a rather large folder, that has already been pushed to the network, and deleted locally. How would a file be added to that folder, without re-downloading the entire folder it?</p>
<ipfs>
2016-10-01 07:11:26
HQ
39,804,070
Unattended install of krb5-user on Ubuntu 16.04
<p>So, when running:</p> <pre><code>sudo apt-get install krb5-user </code></pre> <p>You are asked to enter the AD/LDAP domain. The problem is that I want this to be able to be run as a startup script for my machines. Is there any way to either pass the domain in as a parameter or disable the interaction and set up krb5-user after?</p> <p>Thanks</p>
<linux><ubuntu><active-directory><ldap><kerberos>
2016-10-01 07:26:38
HQ
39,804,141
Clickable functional diagram in html
How can i achieve this kind of diagram Link of the [image][1] Can i achieve this with something like charts? bit it must be responsive i've tried SVG but no success. [1]: http://(https://drive.google.com/a/mim-soft.com/file/d/0B3VIf9ZImYwyTjRueDhZZ05yTDA/view?usp=drivesdk
<javascript><html><css><charts><diagram>
2016-10-01 07:35:21
LQ_EDIT
39,804,164
Need help aligning modals side by side
Hey StackOverflow Members! This is my first post. I usually find all my solutions to problems on here, but this question I cant seem to find the answer to. I am horrible at coding, but a am learning by making lots of mistakes. Im most comfortable with CSS and HTML, however java and other codes scare me to death! Speaking of JAVA, I am using modals for a website page I am working on. Everything has been working good, but I cant seem to get them to align how I would like them. If you do answer with a solution, if you could explain it so I can make this a learning process that would be great :) So here it goes. I am trying to make a web page which has 3 buttons which trigger a modal. A Monthly Subscription, Yearly Subscription, and Purchase Add-Ons. Both membership buttons open a modal with a PayPal subscription page. Now as soon as I add the PayPal code, i loose the ability to keep the 2 buttons side by side. Instead they are stacked. I have tried <Center>, Text-Align, Putting the modal in a DIV, and still no success. **Here Is The Code** (Yes I know...tisk tisk I have CSS with my HTML) http://pastebin.com/YfGghAW2 I dont know how to add code in this message correctly. Hope this is ok. Any help would be great :)
<html><css>
2016-10-01 07:37:58
LQ_EDIT
39,804,308
How to create a hand shake effect in the png
I have a png in which i want the hands to shake.I am providing the link to the png.Kindly help me out and please prefer using css js html and jquery to do so Kind regards
<javascript><jquery><html><css>
2016-10-01 07:59:35
LQ_EDIT
39,804,756
How to use classes in C++?
<p>I can't see to find the problem in my code. Nor the solution on the internet. I can see that i can create the code in a different way but i need to know how to work with it written like this:</p> <pre><code>class Triunghi{ int l1=0;//latura1 int l2=0;//latura2 int ba=0;//baza int p=0;//perimetru public: Triunghi(){} Triunghi(int a):l1(a){} Triunghi(int a,int b):l1(a),l2(b){} Triunghi(int a,int b,int c):l1(a),l2(b),ba(c){} Triunghi(int a,int b,int c,char *msg):l1(a),l2(b),ba(c){ cout&lt;&lt;msg&lt;&lt;""&lt;&lt;l1&lt;&lt;l2&lt;&lt;ba&lt;&lt;endl; } Triunghi(Triunghi &amp;A){ l1=A.l1; l2=A.l2; ba=A.ba; } ~Triunghi(){ } int Perimetru() { p=l1+l2+ba; return (p); } }; </code></pre> <p>It works fine there are no errors but i cant seem to give value to l1, l2 and ba, to use them in function 'Perimetru'. This is how my main looks.</p> <pre><code>int main() { Triunghi tri; Triunghi(1,2,3); tri.Perimetru(); return 0; } </code></pre> <p>How to make it work?</p>
<c++><class>
2016-10-01 08:57:23
LQ_CLOSE
39,804,861
What is a concise way to create a 2D slice in Go?
<p>I am learning Go by going through <a href="https://tour.golang.org/list" rel="noreferrer">A Tour of Go</a>. One of the exercises there asks me to create a 2D slice of <code>dy</code> rows and <code>dx</code> columns containing <code>uint8</code>. My current approach, which works, is this: </p> <pre><code>a:= make([][]uint8, dy) // initialize a slice of dy slices for i:=0;i&lt;dy;i++ { a[i] = make([]uint8, dx) // initialize a slice of dx unit8 in each of dy slices } </code></pre> <p>I think that iterating through each slice to initialize it is too verbose. And if the slice had more dimensions, the code would become unwieldy. Is there a concise way to initialize 2D (or n-dimensional) slices in Go? </p>
<go><slice>
2016-10-01 09:11:00
HQ
39,805,210
Get console user input as typed, char by char
<p>I have a console application in Elixir. I need to interpret user’s input on by keypress basis. For instance, I need to treat “q” as a command to end the session, without user to explicitly press <kbd>⏎</kbd> a.k.a. “carriage return.”</p> <p><a href="http://elixir-lang.org/docs/stable/elixir/IO.html#getn/2"><code>IO.getn/2</code></a> surprisingly waits for the <kbd>⏎</kbd> to be pressed, buffering an input (I am nearly sure, that this buffering is done by console itself, but <code>man stty</code> does not provide any help/flag to turn buffering off.)</p> <p><code>Mix.Utils</code> <a href="https://github.com/hexpm/hex/blob/1523f44e8966d77a2c71738629912ad59627b870/lib/mix/hex/utils.ex#L32-L58">use the infinite loop</a> to hide user input (basically sending backspace control sequence to console every 1ms,) <code>IEx</code> code wraps calls to standard erlang’s <code>io</code>, that provides the only ability to set a callback on <kbd>Tab</kbd> (for autocompletion.)</p> <p>My guess would be I have to use <a href="http://elixir-lang.org/docs/stable/elixir/Port.html#summary"><code>Port</code></a>, attach it to <code>:stdin</code> and spawn a process to listen to the input. Unfortunately, I am stuck with trying to implement the latter, since I need to attach to the currently running console, not create a new port to some other process (as it is <a href="http://www.theerlangelist.com/article/outside_elixir">perfectly described here</a>.)</p> <p>Am I missing something obvious on how am I to attach a <code>Port</code> to the current process’ <code>:stdin</code> (which is btw listed in <code>Port.list/0</code>,) or should I’ve built the whole 3-piped architecture to redirect what’s typed to <code>:stdin</code> and whatever my program wants to <code>puts</code> to <code>:stdout</code>?</p>
<console><port><command-line-interface><elixir>
2016-10-01 09:54:24
HQ
39,805,360
Recycleview not scroll in nested scroolview android
I have using recycle view inside nested Scroll view but Recycle view not scroll down in nested scroll view.recycle view scroll down when keyboard open and new item add in recycle view
<android><android-scrollview>
2016-10-01 10:10:02
LQ_EDIT
39,805,537
How to apply global styles with CSS modules in a react app?
<p>I'm currently using CSS Modules with React for my styling. So each of my components is importing in it's component specific css file, like so:</p> <pre><code>import React from 'react'; import styles from './App.css'; const example = () =&gt; ( &lt;div className={styles.content}&gt; Hello World! &lt;/div&gt; ); export default example; </code></pre> <p>This works fine when styling individual components, but how do I apply global styling (html, body, header tags, divs, etc.) that isn't component specific? </p>
<css><reactjs><css-modules><react-css-modules>
2016-10-01 10:31:48
HQ
39,805,590
how to extract data in between parathasis and append at the end of the line using python programing.
File.txt first_name NVARCHAR2(15) NOT NULL, middle_name NVARCHAR2(20) NOT NULL, last_name NVARCHAR2(11) NOT NULL, output i need:->output.txt first_name NVARCHAR2(15) NOT NULL,15 middle_name NVARCHAR2(20) NOT NULL,20 last_name NVARCHAR2(11) NOT NULL,11 how to extract data in File between parathasis and append at the end of the line using python programing.
<python><python-3.x>
2016-10-01 10:36:46
LQ_EDIT
39,806,025
Kotlin - how to get annotation attribute value
<p>say, i have one Kotlin class with annotations:</p> <pre><code>@Entity @Table(name="user") data class User (val id:Long, val name:String) </code></pre> <p>How can i get the value of name attribute from @Table annotation?</p> <pre><code>fun &lt;T&gt; tableName(c: KClass&lt;T&gt;):String { // i can get the @Table annotation like this: val t = c.annotations.find { it.annotationClass == Table::class } // but how can i get the value of "name" attribute from t? } </code></pre>
<annotations><kotlin>
2016-10-01 11:26:05
HQ
39,806,505
What does this C program do?
<pre><code>#include &lt;stdio.h&gt; int main(){ char c; while((c = getchar()) != EOF){ if(c &gt;= 'A' &amp;&amp; c &lt;= 'Z') c = c - 'A' + 'a'; putchar(c); } return 0; } </code></pre> <p>Came across this C code in MIT's Practical Programming in C. Can anyone explain how this program works?</p>
<c><character><arithmetic-expressions>
2016-10-01 12:17:06
LQ_CLOSE
39,806,744
I want to pass ajax request from themes folder/loyalty.tpl to /public_html/test/modules/loyalty/LoyaltyModule.php in prestashop 1.6.1.5
<input id="Gcash_id" name="Gcash_id" type="text" class="form-control grey" placeholder="Enter your G cash code you will get Gcash amount" /><br> <div id="errorBoxgcash" style="color:#FF0000; font-size:16px;"> </div><br> <button type="submit" name="Submit" value="OK" onclick="return gcashValue();" class="btn btn-default button button-small"><span>{l s='Ok'}</span></button> <script type="text/javascript"> {literal} function gcashValue() { if ($.trim($("#Gcash_id").val()) == ''){ $("#Gcash_id").focus(); $("#errorBoxgcash").removeClass('hide'); $("#errorBoxgcash").html("Please enter GCash ID"); return false; } var gcashidVal=$('#Gcash_id').val(); //alert(gcashidVal); $.ajax({ url:'{$base_dir}modules/loyalty/LoyaltyModule/gcashId', type: 'POST', data: 'ajax=true&gcashidVal='+gcashidVal, success: function(response) { alert(response); console.log('success'); document.getElementById("Gcash_id").innerHTML=response; } }); return false; } {/literal} </script> I am not able to pass the ajax request using the url format of the ajax call of the prestashop loyalty module mentioned above So please give me the correct url format as the concerned to the error mentioned in the screenshot of post request error in the console of firebug I am getting error in the console when making ajax call from /public_html/test/themes/pf_newfashionstore/modules/loyalty/views/templates/front/loyalty.tpl to /public_html/test/modules/loyalty/LoyaltyModule.php http://imgur.com/a/kspSi
<javascript><php><jquery><ajax><prestashop-1.6>
2016-10-01 12:44:15
LQ_EDIT
39,807,004
What does a for (;;) loop do
<p>In a c/c++ file I discovered a strange for loop</p> <pre><code>for (;;) {...} </code></pre> <p>I don't know if this runs once, infinetly or works in some other way Source: <a href="https://git.kernel.org/cgit/linux/kernel/git/jejb/efitools.git/tree/PreLoader.c" rel="nofollow">https://git.kernel.org/cgit/linux/kernel/git/jejb/efitools.git/tree/PreLoader.c</a> Line 87</p>
<c++><c><for-loop>
2016-10-01 13:09:58
LQ_CLOSE
39,807,629
Ensure template parameter is an enum class
<p>Is there a way to ensure a template parameter is an enum-class type?</p> <p>I know <code>type_traits</code> has <code>std::is_enum</code>, but I don't want it to match regular enums, just enum_classes.</p> <p>Example of the wanted effect:</p> <pre><code>enum class EnumClass {}; enum Enum {}; class Class {}; template &lt;typename T&gt; void Example() { static_assert(/* T is EnumClass */, "`T` must be an enum class"); } Example&lt;EnumClass&gt;(); // Ok Example&lt;Enum&gt;(); // Error Example&lt;Class&gt;(); // Error </code></pre> <p>I am using C++11, and unfortunately cannot go any higher (though I'd be curious to know the solution anyway, even if it involves newer standards).</p> <p>Is it possible?</p>
<c++><c++11><template-meta-programming>
2016-10-01 14:12:29
HQ
39,807,666
Different ports for frontend and backend. How to make a request?
<p>Using Angular-CLI as a frontend. 4200 port</p> <p>Using Express as a backend. 8080 port</p> <p>Directories look like:</p> <pre><code>Application - backend - ...Express architecture - frontend -...Angular2 architecture </code></pre> <p>So I'm running two projects, two commanders, one for frontent, second one for backend. <code>node app.js</code> for backend (8080), <code>ng serve</code> for frontent (4200).</p> <p>Let's assume that I have a layer in backend which returns some string.</p> <pre><code>app.get('/hello', function(req, res) { res.send("Hello!"); } </code></pre> <p>How can I make a request from frontend to backend and get that string? I don't want to know how exactly should I use Angular2 because that's not the point. I'm asking, what technology should I use to be able connect these two (frontent and backend) sides on different ports. If I just run them and make a request from frontend, I'll get an error because it can't find <code>/hello</code> url.</p>
<express><angular><port>
2016-10-01 14:15:46
HQ
39,807,938
How to transpose mysql table data using mysql query
<p>I would like to transpose attendance sql table as below </p> <p><a href="https://i.stack.imgur.com/2FqbI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2FqbI.png" alt="Below Mysql table data"></a></p> <p>To the following </p> <p><a href="https://i.stack.imgur.com/AhrHG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AhrHG.png" alt="enter image description here"></a></p> <p>Please help me here</p> <p>Thanks Sara</p>
<mysql><transpose>
2016-10-01 14:46:21
LQ_CLOSE
39,808,154
Preserve or save default values explicitely in RAD Studio IDE
I'm following the example to load a custom font (Segoe UI) in an Android app: http://community.embarcadero.com/index.php/blogs/entry/true-type-font-iconography-for-android-and-ios-apps My problem is, that the IDE (RAD Studio 10.1 Berlin) does not save default values to FMX files (the form files). At design time the default font seems to be already "Segoe UI", so the IDE shows only `(Default)` in the Object inspector and so does not store that value to the FMX form file. **BUT**, the default font in Android is "Roboto", not "Segoe UI", and the application indeed uses "Roboto" as the default font at runtime. So default values in the object inspector are not preserved for different target platforms. This is very annoying! Is this a (logical) bug in the IDE or how can I disable this IDE feature or explicitely set a value at **design time** (which is accidentally also the default value at design time in the IDE under Windows) and preserve it for the target platform (in this case Android)? I tried to go to text mode of the FMX form file and set it manually there, but when switching back to design mode, the IDE changes the value in the object inspector back to `(Default)` and when going back again to text-mode of the FMX form file, that line is removed. I want/need to set it at design time, not runtime, but I can't make it. I also need such default values for other properties, not only the font.
<delphi><firemonkey>
2016-10-01 15:08:52
LQ_EDIT
39,808,196
Aggregate a data frame in R using multiple FUN (mean, min, SD)
<p>I am trying to aggregate a data frame to find the mean, min, and SD of a specific column compared to another. I would like to aggregate Semester, and only apply mean, SD, and min to Grade. Then display all in one output as columns (aggregated-Semester, mean, min, SD). Is this possible? Below is the example data frame.</p> <p>(Sorry for output of data frame, not sure how to create a table in the questions)</p> <pre><code>#------------------------------------------ #|Student |Semester |Grade |Name | #------------------------------------------ #|1 |9a |90 |Jim | #|2 |9b |91 |Beth | #|3 |9a |76 |George | #|4 |9b |87 |Phill | #------------------------------------------ </code></pre>
<r>
2016-10-01 15:13:08
LQ_CLOSE
39,808,599
Is there a universally accepted value for a (float) NAN
<p>Is a (float) #NAN ("Not A Number") universally assigned the value of 0x7F A0 00 00 or is it different with different compilers?</p>
<java><c++><c>
2016-10-01 15:52:29
LQ_CLOSE
39,809,594
A console full of <FIRInstanceID/WARNING> - Xcode 8 / iOS10
<p>I am having issues with Firebase within Xcode 8 / iOS 10 / Swift 3. Trying to just get Firebase Analytics all set up. However in iOS10, the console gets logged with a plethora of WARNING logs from Firebase. These do not happen when I run iOS 9.3 in the simulator. I took the exact steps as noted here: <a href="https://firebase.google.com/docs/analytics/ios/start" rel="noreferrer">https://firebase.google.com/docs/analytics/ios/start</a> </p> <p>Here is what the log looks like:</p> <pre><code>&lt;FIRAnalytics/INFO&gt; Firebase Analytics v.3402000 started &lt;FIRAnalytics/INFO&gt; To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled &lt;FIRAnalytics/INFO&gt; Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist &lt;FIRInstanceID/WARNING&gt; Failed to remove checkin auth credentials from Keychain Error Domain=com.google.iid Code=-34018 "(null)" &lt;FIRInstanceID/WARNING&gt; Error failed to remove all tokens from keychain Error Domain=com.google.iid Code=-34018 "(null)" &lt;FIRInstanceID/WARNING&gt; FIRInstanceID AppDelegate proxy enabled, will swizzle app delegate remote notification handlers. To disable add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO &lt;FIRInstanceID/WARNING&gt; STOP!! Will reset deviceID from memory. &lt;FIRInstanceID/WARNING&gt; Failed to fetch default token Error Domain=com.firebase.iid Code=6 "(null)" &lt;FIRInstanceID/WARNING&gt; STOP!! Will reset deviceID from memory. &lt;FIRInstanceID/WARNING&gt; Error removing keypair status: -34018 &lt;FIRInstanceID/WARNING&gt; Unable to remove RSA keypair &lt;FIRInstanceID/WARNING&gt; Unable to generate keypair. &lt;FIRAnalytics/WARNING&gt; Failed to get InstanceID: Error Domain=com.firebase.iid Code=-34018 "(null)" &lt;FIRInstanceID/WARNING&gt; Failed to fetch default token Error Domain=com.firebase.iid Code=501 "(null)" UserInfo={msg=Missing device credentials. Retry later.} &lt;FIRInstanceID/WARNING&gt; Failed to retrieve the default GCM token after 5 retries </code></pre> <p>I also get the following error that pops up about every ~30 seconds (while the errors above all don't repeat):</p> <pre><code>&lt;FIRInstanceID/WARNING&gt; STOP!! Will reset deviceID from memory. </code></pre> <p>Before posting this, I did research and found that the WARNING logs can go away if you enable Keychain Sharing within Capabilities. I am weary of this, however, because no other documentation or explanation was given. And I don't know if that's just masking the errors, or if it's a safe solution here.</p> <p>Please advise on the safest way to remedy all these WARNING logs. Thanks</p>
<ios><firebase><analytics><swift3><ios10>
2016-10-01 17:36:07
HQ
39,809,599
Database Sql select statement
[provided the database below how do i solve this question?][1] [my sql statement is: select ename from employee e inner join certified c on e.eid = c.eid inner join aircraft a on c.aid = a.aid where cruisingrange> 1000 && a.aname not like'%b'][2] My answer is Jacob and Emily which is wrong. Jacob should not be retrieved. How should i modify or add to the sql statement? [1]: http://i.stack.imgur.com/Ohghh.jpg [2]: http://i.stack.imgur.com/Go4f6.jpg
<mysql><sql><sql-server><tsql>
2016-10-01 17:36:52
LQ_EDIT
39,809,943
React - Preventing Form Submission
<p>I've been experimenting with React. In my experiement, I'm using the <a href="https://reactstrap.github.io/">Reactstrap framework</a>.When I click a button, I've noticed that the HTML form submits. Is there a way to prevent form submission when a button is clicked? </p> <p>I've recreated my issue <a href="http://jsbin.com/tiwuhovebu/1/edit?html,js,output">here</a>. My form is pretty basic and looks like this:</p> <pre><code>&lt;Form&gt; &lt;h3&gt;Buttons&lt;/h3&gt; &lt;p&gt; &lt;Button color="primary" onClick={this.onTestClick}&gt;primary&lt;/Button&gt;&amp;nbsp; &lt;/p&gt; &lt;/Form&gt; </code></pre> <p>What am I missing?</p>
<javascript><reactjs>
2016-10-01 18:11:52
HQ
39,809,955
Quadratic equation program in C#
Could you tell me what's wrong with my code for calculating quadratic equation? Don't be cringed out on the way of my work, because i'm in still very new to the program. class Program { static void Main(string[] args) { double a, b, c, x1, x2, x, D; String A; String B; String C; Console.Write("a="); A = Console.ReadLine(); Console.Write("b="); B = Console.ReadLine(); Console.Write("c="); C = Console.ReadLine(); a = Convert.ToDouble(A); b = Convert.ToDouble(B); c = Convert.ToDouble(C); D =(b * b - 4 * a * c); if (D > 0) { x1 = (-b + Math.Sqrt(D)) / (2 * a); x2 = (-b - Math.Sqrt(D)) / (2 * a); Console.WriteLine("x1=" + x1); Console.WriteLine("x2=" + x2); } else if (D < 0) { D = -D; x1 = (-b + Math.Sqrt(D)) / (2 * a); x2 = (-b - Math.Sqrt(D)) / (2 * a); } else { x = (-b / (2 * a)); Console.WriteLine("x=" + x); } Console.ReadKey(); } }
<c#><console><quadratic>
2016-10-01 18:13:15
LQ_EDIT
39,810,045
lua odd table behaviour
In my code, I set a variable to the contents of a table, like so: colorTable = {{255, 255, 255}} color = colorTable[1] My problem is when I edit the value of `color` it changes the original value in `colorTable` so in the beginning, `colorTable[1][1]` equals `255`, but after I run this: color[1] = color[1] - 10 `colorTable[1][1]` equals `245`. Any help is appreciated.
<list><indexing><lua>
2016-10-01 18:21:50
LQ_EDIT
39,810,323
How to Stop an Endless String in R
<p>I'm new to R Programming and have somehow gotten stuck in an argument that will not stop. I wrote view(file) and hit enter and now there is an endless string of "+" and the argument will not close. Any help would be appreciated on how to close my argument. I know I can just force quit the program, but I would rather just figure out of to end the argument. Thank You!</p>
<r><arguments>
2016-10-01 18:51:50
LQ_CLOSE
39,810,783
My first java project! need help :)
I wanted to know why there is an error and how to fix it for my java project. I have to make exactly same out as these. What is your annual interest rate as a decimal? (ex: 0.045): .033 How many years will your mortgage be held? 15 What amount of the mortgage did you borrow? 300000 The number 0.033 can be represented as 3.3% The mortgage amount is $300,000.00 The monthly payment in dollars is $2,115.30 The total payment in over the years in dollars is $380,754.76 The overpayment is $80,754.76 The overpayment as a percentage of the mortgage is 26.9 And this is what I did on Eclipse. `enter code here`double annIntRat; int nOY; int borrowMor; int M; double monthPay; double mIR; Scanner scnr = new Scanner(System.in); // Your code should go below this line System.out.print("What is your annual interest rate as a decimal? (ex 0.045): "); annIntRat = scnr.nextDouble(); System.out.print("How many years will your mortgage be held? "); nOY = scnr.nextInt(); System.out.print("What amount of the mortgage did you borrow? "); borrowMor = scnr.nextInt(); DecimalFormat df = new DecimalFormat("0.0"); System.out.println("\nThe number "+annIntRat+" can be represented as "+df.format((annIntRat)*100)+"%"); NumberFormat defaultFormat = NumberFormat.getCurrencyInstance(); M=defaultFormat.format(borrowMor); //< Here is the error and tells me to change to String.But if I do so, there will be an error down there for monthPay=..... System.out.println("The mortgage amount is "+M); mIR=(annIntRat)/12; monthPay=(mIR * M)/(1-(1/Math.pow(1+mIR,12*nOY)));
<java>
2016-10-01 19:43:08
LQ_EDIT
39,811,230
Why doesn't my newly-created docker have a digest?
<p>I have been following the <a href="https://docs.docker.com/engine/tutorials/dockerimages/#/image-digests" rel="noreferrer">Docker tutorial here</a>, and built a test image on my local OSX machine by committing changes to an existing image and tagging it with three different labels:</p> <pre><code># docker images REPOSITORY TAG IMAGE ID CREATED SIZE adamatan/sinatra devel fccb6b4d21b4 8 minutes ago 469.5 MB adamatan/sinatra junk fccb6b4d21b4 8 minutes ago 469.5 MB adamatan/sinatra latest fccb6b4d21b4 8 minutes ago 469.5 MB </code></pre> <p>However, none of these images has a digest:</p> <pre><code># docker images --digests adamatan/sinatra REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE adamatan/sinatra devel &lt;none&gt; fccb6b4d21b4 9 minutes ago 469.5 MB adamatan/sinatra junk &lt;none&gt; fccb6b4d21b4 9 minutes ago 469.5 MB adamatan/sinatra latest &lt;none&gt; fccb6b4d21b4 9 minutes ago 469.5 MB </code></pre> <p>Other test images I have created with a Dockerfile do have a digest.</p> <p><strong>Why do some images have a digest and some don't? Is it related to the way the images were created (Dockerfile or not)?</strong></p>
<docker><digest>
2016-10-01 20:37:52
HQ
39,811,929
Package installed by Conda, Python cannot find it
<p>I try to install Theano by Anaconda. It works, but when I enter the python -i, <code>import theano</code> shows <code>No module named 'theano'</code>. Do I need to switch another interpreter of Python, how? Also, for the packages installed by conda, if I don't double install them, can I find in Python? How is Python related to Python by Anaconda? Thanks!!!</p>
<python><anaconda><theano><conda>
2016-10-01 22:10:59
HQ
39,812,037
Error on scalatest compilation in IDEA
<p>I am trying to compile Scala project which contains scalatest. It compiles normal on sbt </p> <pre><code>sbt &gt; compile &gt; test:compile </code></pre> <p>, but when I am trying to build it with IDEA, it shows the following error:</p> <pre><code>Error:(37, 11) exception during macro expansion: java.lang.NoSuchMethodError: org.scalactic.BooleanMacro.genMacro(Lscala/reflect/api/Exprs$Expr;Ljava/lang/String;Lscala/reflect/api/Exprs$Expr;)Lscala/reflect/api/Exprs$Expr; at org.scalatest.AssertionsMacro$.assert(AssertionsMacro.scala:34) assert((ElementMeasures.baseElementDistance(mEl1, mEl2) - 0.33333).abs &lt; 0.001) ^ </code></pre> <p>for each <code>assert</code> function in test.</p> <p><code>build.sbt</code> file contains following:</p> <pre><code>name := "ner-scala" organization := "ml.generall" version := "1.0-SNAPSHOT" scalaVersion := "2.11.8" libraryDependencies += "org.scalactic" %% "scalactic" % "3.0.0" libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0" % "test" ... </code></pre>
<scala><intellij-idea><sbt>
2016-10-01 22:27:26
HQ
39,812,558
Didn't find class "com.google.firebase.provider.FirebaseInitProvider"
<p>Before, my program run well. But When I just updated my Android studio to the latest version (2.2 built on 15-sept-16), I am having the following error. When I built it, it says: Built sucessfully, but this error appears when I run my program:</p> <blockquote> <p>E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.androidtutorial, PID: 28293 java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.androidtutorial-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.androidtutorial-2/lib/x86, /system/lib, /vendor/lib]] at android.app.ActivityThread.installProvider(ActivityThread.java:5814) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342) at android.app.ActivityThread.-wrap2(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.example.androidtutorial-2/base.apk"],nativeLibraryDirectories=[/data/app/com.example.androidtutorial-2/lib/x86, /system/lib, /vendor/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:380) at java.lang.ClassLoader.loadClass(ClassLoader.java:312) at android.app.ActivityThread.installProvider(ActivityThread.java:5799) at android.app.ActivityThread.installContentProviders(ActivityThread.java:5403)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5342)  at android.app.ActivityThread.-wrap2(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1528)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6077)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)</p> </blockquote> <p>I already looked at other questions but the problem is not the same. What am I doing wrong? Please help</p>
<java><android><android-studio><error-handling><compiler-errors>
2016-10-01 23:46:51
HQ
39,812,677
Want to Add Auto Links Variables
<pre><code>var links1 = link2 = link3 = link4 = link5 = ["a.html","b.html","c.html","d.html","e.html","f.html","g.html"] function myLinkJS(){ document.write( '&lt;a href=\"'+link1+'\" &gt;&lt;/a&gt;\n' ); document.write( '&lt;a href=\"'+link2+'\" &gt;&lt;/a&gt;\n' ); document.write( '&lt;a href=\"'+link3+'\" &gt;&lt;/a&gt;\n' ); document.write( '&lt;a href=\"'+link4+'\" &gt;&lt;/a&gt;\n' ); } </code></pre> <p>The series of Link variables are more than 150 means <strong>var Links1 to Links150</strong> and the same I have to add in href as URL. if there is any solution to add these 150 links easily with any code.</p>
<javascript><html>
2016-10-02 00:11:03
LQ_CLOSE
39,813,309
How is a GUI made from scratch?
<p>I just got into java GUIs, but the graphics are built upon layers of abstractions. At the fundamental level, what goes into these layers? For example, do primitive types build images. Are they simply a multidimensional array of integers? </p> <p>What should I study to understand how a GUI is built from scratch?</p>
<java><user-interface><graphics>
2016-10-02 02:30:59
LQ_CLOSE
39,813,373
Can i change the title bar of Sublime text is black like brackets?
<p>How can i change the title bar of sublime text like this image? All black finish!</p> <p><a href="https://i.stack.imgur.com/uGx7P.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/uGx7P.jpg" alt="enter image description here"></a></p>
<macos><themes><sublimetext3>
2016-10-02 02:43:49
HQ
39,813,710
Calling Firebase Analytic's getInstance() every time vs. storing instance as a static variable in Application class
<p>I'm trying decide which of the following is the proper way to do this:</p> <ol> <li>Calling <code>FirebaseAnalytics.getInstance(Context)</code> from every activity, fragment, and service that I'm logging an event from.</li> </ol> <p>or</p> <ol start="2"> <li>Calling <code>FirebaseAnalytics.getInstance(Context)</code> once from <code>Application</code> class and keeping it around as a public static variable. Then, from everywhere I need this I can call `MyAppClass.mFirebaseAnalytics.logEvent()'.</li> </ol> <p>Will any of the above methods have a undesired impact on the events that are automatically collected and/or do either of those have an efficiency gain over the other?</p> <p>Many thanks!</p>
<android><firebase><firebase-analytics>
2016-10-02 03:57:29
HQ
39,813,984
How to fetch data through api in redux?
<p>I am a beginner with reactjs/redux, could not find a simple to use example of how to use an api call to retrieve data in a redux app. I guess you could use a jquery ajax call but there are probable better options out there?</p>
<reactjs><react-redux>
2016-10-02 04:52:57
HQ
39,814,916
How can i see output of .rmd in github?
<p>I am practicing data analysis using R programming. I want my files to be on github. I am unable to figure out why github is not showing the output of .rmd files. </p> <p>Here is the link to the file in my github repository <a href="https://github.com/shankarpandala/Data-Analysis-Practice/blob/master/Exploring_one_variable.Rmd" rel="noreferrer">Data Analysis Practice</a></p> <p>I want the output including plots to be shown on github.</p>
<r><github><rstudio><r-markdown>
2016-10-02 07:42:45
HQ
39,815,316
Parse error: syntax error, unexpected ';' ... on line 87
<p>My problem is this,the problem I checked more time but not found the problem,why give me this error.</p> <pre><code>$i=0; while(count($profile-&gt;vehicles)&gt;=$i) { echo ' &lt;div class="name col-md-4 col-lg-4"&gt; &lt;h3&gt;'.$profile-&gt;vehicles['cars'][$i]['name'].'&lt;/h3&gt; &lt;/div&gt; &lt;div class="post_date col-md-3 col-lg-3"&gt; &lt;h3&gt;'.date("d/m/Y", strtotime($profile-&gt;vehicles['cars'][$i]['post_date']).'&lt;/h3&gt; &lt;/div&gt; &lt;div class="views col-md-3 col-lg-3"&gt; &lt;h3&gt;Views:&lt;span&gt;'.$profile-&gt;vehicles['cars'][$i]['views'].'&lt;/span&gt;&lt;/h3&gt; &lt;/div&gt; &lt;div class="edit col-md-2 col-lg-2"&gt; &lt;h3&gt;&lt;a href="?page=profile&amp;parent=edit&amp;id='.$profile-&gt;vehicles['cars'][$i]['id'].'" &gt;Edit&lt;/a&gt;&lt;/h3&gt; &lt;/div&gt; ';&lt;--Here is the error $i++; } </code></pre>
<php><error-handling>
2016-10-02 08:45:00
LQ_CLOSE
39,816,793
Simpe drop down menu with html and css
What am i doing wrong in this code? I want to see a drop down menu as soon as i hover on the "About" button, but instead of hovering, I only see half of the drop down menu. Plzzzzzzzz help me. here is the code. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html> <head> <style> .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f9f9f9; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); } .goCenter { text-align: center; color: white; } body { background-color: #1A1617 } ul { text-align: center; list-style-type: 0px; margin: 0px; padding: 20px; background-color: black; overflow: hidden; } li a { color: white; padding: 8px 16px; text-decoration: none; } li { display: inline; } li a:hover { background-color: red; text-size: 10px; } .dropdown:hover .dropdown-content { display: block; } </style> </head> <body> <ul> <li><a href="home.html">Home</a></li> <li><a href="news.html">News</a></li> <div class="dropdown"> <li><a href="about.html">About</a></li> <div class="dropdown-content"> <p>Check</p> <div> </div> </ul> <p class="goCenter"><strong></strong></p> </body> </html> <!-- end snippet -->
<html><css>
2016-10-02 12:03:10
LQ_EDIT
39,816,829
How do I do a patch request using HttpClient in dotnet core?
<p>I am trying to create a <code>Patch</code> request with the<code>HttpClient</code> in dotnet core. I have found the other methods,</p> <pre><code>using (var client = new HttpClient()) { client.GetAsync("/posts"); client.PostAsync("/posts", ...); client.PutAsync("/posts", ...); client.DeleteAsync("/posts"); } </code></pre> <p>but can't seem to find the <code>Patch</code> option. Is it possible to do a <code>Patch</code> request with the <code>HttpClient</code>? If so, can someone show me an example how to do it?</p>
<dotnet-httpclient><http-patch>
2016-10-02 12:07:05
HQ
39,818,429
How do you import type definitions from `@types` typescript 2.0
<p>I'm using typescript 2.0 with the lastest <code>ionic@RC.0</code> build process.</p> <p>I installed the google-maps types like this: </p> <p><code>npm install @types/google-maps --save-dev --save-exact</code></p> <p>and I'm trying to import some of the type definitions into my code like this</p> <pre><code>/// &lt;reference types="google-maps" /&gt; import { LatLng, LatLngBounds } from 'google-maps'; </code></pre> <p>but I get this typescript error:</p> <p><code>./node_modules/@types/google-maps/index.d.ts has no exported member 'LatLng'</code></p> <p>and if I look in the source, I actually find the definition in</p> <p><code>./node_modules/@types/google-maps/node_modules/@types/googlemaps/index.d.ts</code></p>
<typescript>
2016-10-02 15:15:22
HQ
39,819,238
Is there a generic way to avoid HTML content in ADF input fields
<p>My application is developed using Oracle ADF. I'm using <code>&lt;af:inputText&gt;</code> input fields in my forms.</p> <p>Here I have to avoid HTML content in input fields. Is there a way in ADF to avoid HTML content in form input fields.</p>
<jsf><oracle-adf><jspx>
2016-10-02 16:40:47
LQ_CLOSE
39,819,742
How to count dynamic submitting by button
<p>I have html structure like this</p> <p><a href="https://i.stack.imgur.com/5wzqJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5wzqJ.png" alt="enter image description here"></a></p> <pre><code>&lt;div class="count-box cocuk-count"&gt; &lt;span class="count-text"&gt;Çocuk:&lt;/span&gt; &lt;span class="kisi-down"&gt;&lt;/span&gt; &lt;span class="kisi-sayi-text"&gt;1&lt;/span&gt; &lt;span class="kisi-up"&gt;&lt;/span&gt; &lt;/div&gt; </code></pre> <p>and if I click first button (minus) it must counting forwards or if I click second button (plus) it must counting how can be possible by jquery ?</p>
<javascript><jquery>
2016-10-02 17:35:46
LQ_CLOSE
39,820,009
What happens if we don't software testing
<p>It is really simple question.</p> <p>However, really wondering.</p> <p>I think even we don't software testing,</p> <p>Program will work.</p> <p>So, What happens if we don't software testing?</p>
<testing><computer-science>
2016-10-02 18:03:41
LQ_CLOSE
39,820,797
Vue JS focus next input on enter
<p>I have 2 inputs and want switch focus from first to second when user press Enter. I tried mix jQuery with Vue becouse I can't find any function to focus on something in Vue documentation:</p> <pre><code>&lt;input v-on:keyup.enter="$(':focus').next('input').focus()" ...&gt; &lt;input ...&gt; </code></pre> <p>But on enter I see error in console:</p> <pre><code>build.js:11079 [Vue warn]: Property or method "$" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in anonymous component - use the "name" option for better debugging messages.)warn @ build.js:11079has @ build.js:9011keyup @ build.js:15333(anonymous function) @ build.js:10111 build.js:15333 Uncaught TypeError: $ is not a function </code></pre>
<javascript><focus><vue.js>
2016-10-02 19:27:49
HQ
39,820,989
How can I improve ths logic
I will have to implement following logic in java - 1. execute query Q1 on data D1 based on condition C1 2. if result of Q1 is more than zero then make another query Q2 on data D2 based on condition C2 3. If Q2 size is more than zero then make another query Q3 on data D2 based on condition C3 4. If Q3 size is more than zero then make another query Q4 on data D2 based on condition C4 5. Now if Q1 result size is zero then execute query Q5 on data D1 based on condition C5 6. If result of Q5 is more than zero then execute query Q6 on data D3 based on condition C2 7. If result of Q6 is more than zero then execute query Q7 on data D3 based on condition C3 8. If result of Q7 is more than zero then execute query Q8 on data D3 based on condition C4 So I'm thinking about to write below logic - R1 = getResult (dataset D1, condition C1); //Query on data D1 based on condition C1; If (R1 is not null) { R2 = getResult (dataset R1, condition C2); // Query on data R1 based on condition C2; if(R2 is null){ R3 = getResult (dataset R1, condition C3); // Query on data R1 based on condition C3 if(R3 is null){ R4 = getResult (dataset R1, condition C4); // Query on data R1 based on condition C4 display(R4); }else{ display(R3); } }else{ display(R2); } }else{ R5 = getResult (dataset D1, condition C5); if(R5 is not null){ R6 = getResult (dataset R5, condition C2); //Query on data R5 based on condition C2; if(R6 is null){ R7 = getResult (dataset R5, condition C3); //Query on data R5 based on condition C3 if(R7 is null){ R8 = getResult(dataset R5, condition C4); //Query on data R5 based on condition C3 }else{ display(R8); } }else{ display(R6); } } } Is there a better way to improve this logic?
<java><algorithm><logic>
2016-10-02 19:46:07
LQ_EDIT
39,821,132
Using if statement to turn to a line in code? Java
<p>I have program that asks for user to "wanna try again" .. So I can write the code again for them to use over an over or is there a things for code to start over from a chosen line.??</p>
<java><arrays><if-statement>
2016-10-02 20:03:28
LQ_CLOSE
39,822,170
window.postMessage not working from iframe to parent document
<p>I'm trying to send a simple message from a child document (an iframe) back to its direct parent using the window.postMessage API.</p> <p>Within the parent document I have the following:</p> <pre><code>window.addEventListener("message", receiveMessage, true); var receiveMessage = function(event) { console.log("Recieved event " + JSON.stringify(event)); } </code></pre> <p>Then, in the iframe I have the following:</p> <pre><code>window.parent.postMessage('message', '*'); </code></pre> <p>Based on everything I've read, this should work and my log message should be written to the console. Except it's not working.</p> <p>I'm aware that using the * as the targetOrigin is not always secure, but at this point I just want to sort out the linkage.</p> <p>Any ideas or anything obvious that I'm missing?</p>
<javascript><iframe><postmessage>
2016-10-02 22:02:55
HQ
39,822,702
Location of MySQL configuration file (ie: my.cnf) not specified
<p>Location of MySQL configuration file (ie: my.cnf) not specified<a href="https://i.stack.imgur.com/cwmtI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cwmtI.png" alt="enter image description here"></a></p> <p>How can I fixed this thing? I been trying to reinstall mysqlserver 5.5 / 5.7 and workbench countless of time. But I still not able to fix this issue.</p>
<mysql>
2016-10-02 23:16:16
HQ
39,822,874
Azure Management REST API - "Authentication failed. The 'Authorization' header is provided in an invalid format."
<p>I am desperately trying to move 2 classic storage accounts from my old MSDN subscription to my MPN subscription and I keep hitting a brick wall as move is only supported for these through REST APIs.</p> <p>I have enabled the APIs following the instructions here....</p> <p><a href="https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/" rel="noreferrer">https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/</a></p> <p>and here...</p> <p><a href="https://msdn.microsoft.com/en-us/library/azure/dn776326.aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/library/azure/dn776326.aspx</a></p> <p>but am completely flummoxed. I have created a POST request as suggested to check status as the first call in the 'move resources' instructions...</p> <p>POST <a href="https://management.azure.com/subscriptions/" rel="noreferrer">https://management.azure.com/subscriptions/</a>{subscriptionId}/providers/Microsoft.ClassicCompute/validateSubscriptionMoveAvailability</p> <p>(with the subscriptionId replaced with the ID for each) and passing the appropriate source / target body in.</p> <p>I have also provided the Authorization header as follows...</p> <p>Authorization: {key as generated by the Azure portal}</p> <p>Completely lost now. I have tried using both Fiddler &amp; Postman. PowerShell isn't an option for me because I don't know it at all. I just want to move 2 items over and so far just having these management APIs running has cost me over £15 and my website is on the verge of going down as my credit will soon expire.</p> <p>Any help would be most appreciated.</p>
<rest><api><azure><azure-api-management>
2016-10-02 23:47:08
HQ
39,823,011
Return to readline version 6.x in Homebrew to fix Postgresql?
<p>I'm no Homebrew expert but I think it has "upgraded" me from readline version 6.x to 7.0 sometime after <a href="http://ftp.gnu.org/gnu/readline/">9/15/16</a>:</p> <pre><code>eat@eric-macbook:Homebrew$ brew info readline readline: stable 7.0 (bottled) [keg-only] Library for command-line editing https://tiswww.case.edu/php/chet/readline/rltop.html /usr/local/Cellar/readline/7.0 (45 files, 2M) </code></pre> <p>This has caused headaches for my 9.4.5 Homebrew version of Postgresql (I need the older 9.4 for comparability reasons):</p> <pre><code>eat@eric-macbook:~$ psql --version dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib Referenced from: /usr/local/Cellar/postgresql/9.4.5/bin/psql Reason: image not found Trace/BPT trap: 5 </code></pre> <p>Unfortunately I can't find a 6.x version of readline on Homebrew to revert to - only 7.0 seems to be available(?).</p> <p>My question is twofold:</p> <ul> <li>Is the the readline version mismatch the cause of my postgres/psql problem?</li> <li>If so, how do I return to 6.x with Homebrew to correct the problem?</li> </ul> <p>Thank you in advance!</p>
<postgresql><homebrew><readline>
2016-10-03 00:07:49
HQ
39,823,666
Scheduling in a webpage release
<p>I have just started to learn html and css and curious to know if there's a way of scheduling changes to html code.</p> <p>To give you guys an idea of what I am looking to do...</p> <p>I am building a one page website that displays a quote or comment. I want this to change every day and wondered if there's a way of scheduling in that change so I don't have to change it at the start of every day.</p> <p>Helps to make life a little easier for me!</p> <p>Thanks so much</p> <p>Tom </p>
<html><css>
2016-10-03 02:04:02
LQ_CLOSE
39,823,676
How to install a specific version of MongoDB?
<p>I have yet to find a solution to the problem of installing a specific release of MongoDB. I've found several SO posts and other resources, to no avail. The official docs say:</p> <pre><code>sudo apt-get install -y mongodb-org=3.0.12 mongodb-org-server=3.0.12 mongodb-org-shell=3.0.12 mongodb-org-mongos=3.0.12 mongodb-org-tools=3.0.12 </code></pre> <p>But I get error messages saying those versions are not found. I've tried previous versions as well, but I get the same error output.</p>
<mongodb>
2016-10-03 02:05:00
HQ
39,823,924
"if" multiple conditions in javascript
<p>I'm new to javascript and I'd just like a simple explanation of how to use "if" with multiple conditions in javascript.</p> <p>I've seen stuff like this: if (condition1 &amp;&amp; condition2) and if (condition1) || (condition2)</p> <p>To my understanding, &amp;&amp; is basically "and", and || is basically "or". Please correct me if I'm wrong.</p> <p>But would you use these if you wanted to test more than 2 conditions? And are there any other marks besides &amp;&amp; and || ? Also, if you were to have a much larger list of conditions. Let's say 10 or 20, then is there a better/proper way to test them other than sticking them all in if() seperated by &amp;&amp; and || ?</p>
<javascript>
2016-10-03 02:43:37
LQ_CLOSE
39,824,060
hive> set x='test variable'; hive> ${hiveconf:x}; FAILED: Parse Error: line 1:0 cannot recognize input near ''test variable'' '<EOF>' '<EOF>'
passing parameter in hive is not working for me please see below. Example 1) hive> set x='test variable'; hive> ${hiveconf:x}; FAILED: Parse Error: line 1:0 cannot recognize input near ''test variable'' '<EOF>' '<EOF>'
<hadoop><hive><hiveql><hadoop-streaming>
2016-10-03 03:06:01
LQ_EDIT
39,824,314
How to make this in Javascript, jQuery or Angular
<p>I've been trying to google this for hours, and I'm just totally clueless. I want to make something similar to the "Recent Vehicles" section at the bottom of this site, where you can click the arrow and the cars slide on and off the screen. </p> <p>I have no idea what's the correct thing to google. I know it's not a slider or a carousel, because that's what I've been searching all night.</p> <p>If someone can show me the basic idea of how to do this in Javascript, jQuery or Angular that would be awesome. Thanks in advance! =)</p> <p><a href="http://demo.themesuite.com/index.php?theme=Automotive-WP" rel="nofollow">http://demo.themesuite.com/index.php?theme=Automotive-WP</a></p>
<javascript><jquery><angularjs>
2016-10-03 03:43:14
LQ_CLOSE
39,824,770
Write to file in javascript?
<p>I have made a simple site that generates random number. I want to record how many times a specific number comes up.</p> <p>Is there anyway I can use javascript to write to a Local .txt File on the server?</p> <p>or do I have to learn PHP?</p>
<javascript>
2016-10-03 04:49:51
LQ_CLOSE
39,824,814
Sequencing of function parameter destruction
<p>According to C++14 [expr.call]/4:</p> <blockquote> <p>The lifetime of a parameter ends when the function in which it is defined returns.</p> </blockquote> <p>This seems to imply that a parameter's destructor must run before the code which called the function goes on to use the function's return value. </p> <p>However, this code shows differently:</p> <pre><code>#include &lt;iostream&gt; struct G { G(int): moved(0) { std::cout &lt;&lt; "G(int)\n"; } G(G&amp;&amp;): moved(1) { std::cout &lt;&lt; "G(G&amp;&amp;)\n"; } ~G() { std::cout &lt;&lt; (moved ? "~G(G&amp;&amp;)\n" : "~G()\n"); } int moved; }; struct F { F(int) { std::cout &lt;&lt; "F(int)\n"; } ~F() { std::cout &lt;&lt; "~F()\n"; } }; int func(G gparm) { std::cout &lt;&lt; "---- In func.\n"; return 0; } int main() { F v { func(0) }; std::cout &lt;&lt; "---- End of main.\n"; return 0; } </code></pre> <p>The output for gcc and clang , with <code>-fno-elide-constructors</code>, is (with my annotations):</p> <pre><code>G(int) // Temporary used to copy-initialize gparm G(G&amp;&amp;) // gparm ---- In func. F(int) // v ~G(G&amp;&amp;) // gparm ~G() // Temporary used to copy-initialize gparm ---- End of main. ~F() // v </code></pre> <p>So, clearly <code>v</code>'s constructor runs before <code>gparm</code>'s destructor. But in MSVC, <code>gparm</code> is destroyed before <code>v</code>'s constructor runs.</p> <p>The same issue can be seen with copy-elision enabled, and/or with <code>func({0})</code> so that the parameter is direct-initialized. <code>v</code> is always constructed before <code>gparm</code> is destructed. I also observed the issue in a longer chain, e.g. <code>F v = f(g(h(i(j())));</code> did not destroy any of the parameters of <code>f,g,h,i</code> until after <code>v</code> was initialized.</p> <p>This could be a problem in practice, for example if <code>~G</code> unlocks a resource and <code>F()</code> acquires the resource, it would be a deadlock. Or, if <code>~G</code> throws, then execution should jump to a catch handler without <code>v</code> having been initialized.</p> <p>My question is: does the standard permit both of these orderings? . Is there any more specific definition of the sequencing relationship involving parameter destruction, than just that quote from expr.call/4 which does not use the standard sequencing terms?</p>
<c++><c++14><language-lawyer><function-calls><sequencing>
2016-10-03 04:57:15
HQ
39,825,360
How can I display single list value in 2 different columns of jsp according to ID's?
<div id="mappedORg"> <table width="100%" id="myTable" class="sortable"> <tr> <h1>Mapped Organization</h1> <thead> <tr><th><strong><s:property value="getText('global.univeristy')" /></strong></th> <th ><strong><s:property value="getText('global.college')" /></strong></th> </tr> </thead> <tbody> <s:iterator value="userOrgMappedList" var="quesvar" status="questat"> <tr> <td valign="top" class="style11" style="width: 20%;"><s:property value="userOrgMappedList[#questat.index].OrgName"/></td> </s:iterator> </tr> here is my query for fetching university and college SELECT UOM.Organization_ID, OM.Organization_Name, OM.Organization_Type_ID, UOM.Is_Active,OM.Organization_Parent_Id FROM T_User_Organization_Map UOM INNER JOIN M_Organization_Master OM ON UOM.Organization_ID = OM.Organization_ID INNER JOIN M_Organization_Type_Master OTM ON OM.Organization_Type_ID=OTM.Organization_Type_ID LEFT OUTER JOIN M_Organization_Master LOM ON OM.Organization_Parent_Id = LOM.Organization_ID WHERE UOM.User_ID IN (' 1 ') AND OM.Is_Active = 1 ORDER BY OM.Organization_Name Query is returing organization_parent_id as whose organization_id is university for that particular organization. I want to display university and college in different column as different university has different college and all are fetching from same list usrOrgMapping . How can I display all College with respect to university. How can I perform this operation in jsp page?
<java><jsp>
2016-10-03 06:01:30
LQ_EDIT
39,825,606
Constructing a transition matrix from two vectors in R
<p>I am trying to visualize the transition frequency of a process. I have the following data></p> <pre><code>from to 1 4 4 5 1 3 1 3 4 5 ... </code></pre> <p>What I am trying to do is create a heatmap of frequency matrix of those transitions, so for upper example, </p> <pre><code> 1 3 4 5 1 0 2 1 0 3 0 0 0 0 4 0 0 0 2 5 0 0 0 0 </code></pre> <p>Before I reinvent the wheel, are there any predefined functions in R, which could give me such result?</p> <p>Thanks!</p>
<r>
2016-10-03 06:25:16
LQ_CLOSE
39,825,801
I created a weather robot on Facebook, but it showed below error message
404 Not Found: Requested route ('circle-weather-bot.mybluemix.net') does not exist.
<ibm-cloud><weather><weather-api>
2016-10-03 06:40:30
LQ_EDIT
39,826,401
How to add custom item in android Theme declaration?
<p>I'm having few custom themes in my styles.xml <br> Now whenever the activity takes the theme, it uses the <strong>colorPrimary</strong>, <strong>colorPrimaryDark</strong> and <strong>colorAccent</strong> values. <br> For my layout's background I'm using <strong>?attr/colorAccent</strong>, so it can pick the background color based on the selected theme. <br> If I use any of the above values it works fine. But I want to define a custom item value for my background color.<br> I tried like this below but it didn't worked. any ideas to make it work ? <br> My custom theme with custom value: <br></p> <pre><code>&lt;style name = "customTheme" parent="Theme.AppCompat.Light.NoActionBar"&gt; &lt;item name="colorPrimary"&gt;#4285f4&lt;/item&gt; &lt;item name="colorPrimaryDark"&gt;#2C75F2&lt;/item&gt; &lt;item name="colorAccent"&gt;#E1FFC7&lt;/item&gt; &lt;item name="customBgColor"&gt;#d3d3d3&lt;/item&gt; &lt;/style&gt; </code></pre> <p><br> And I want to use it in layout's style as <br></p> <pre><code>&lt;style name="layoutStyle" &gt; &lt;item name="android:background"&gt;?attr/customBgColor&lt;/item&gt; &lt;/style&gt; </code></pre>
<android><android-theme><android-styles>
2016-10-03 07:25:44
HQ
39,826,427
Parse error: syntax error, unexpected 'company_name' (T_STRING)
<p>what am i gonna put inside the for loop to connect it to the database </p> <pre><code>&lt;?php try { require ("db.php"); $sql = ("select company_name, company_logo from company"); mysql_query($sql); for () { print '&lt;a href="systemlogin2.php"&gt;$row['company_name']&lt;/h2&gt;'; print '&lt;p&gt;&lt;img border="0" src="$row['company_logo']" width="230" height="198"&gt;&lt;/p&gt;'; } } ?&gt; </code></pre>
<php>
2016-10-03 07:27:32
LQ_CLOSE
39,826,525
When I try to run a java class in IntelliJ,nothing comes out even though it has been successfully compiled and run.
[enter image description here][1] Did I mess up with the JV machine? [1]: http://i.stack.imgur.com/GEXNF.png
<java><intellij-idea><compiler-errors>
2016-10-03 07:34:12
LQ_EDIT
39,826,637
how can I detect an cell content color?
<p>I have an excel cell. In the cell, I have few paragraphs, each paragraph using different font color. How can I get the font color value for each paragraph using VBA?</p>
<excel><vba>
2016-10-03 07:41:56
LQ_CLOSE
39,826,650
Simple PHP error T_print error
<pre><code>include 'connect.php'; msql_select_db("u972015033_jobss"); or die("Could not find DB"); if(isset($_POST['search'])){ $searchq = $_POST['search']; $query = msql_query("SELECT * FROM job_search WHERE job_name LIKE '%$searchq%'"); or die("Could not find"); $count = mysql_num_rows($query); if($count == 0){ $output = 'There was no results found'; else{ while($row = mysql_fetch_array($query)){ $jobname = $row['job_name']; $jobdesc = $row['job_desc']; $jobcomp = $row['job_company']; $output .= '&lt;div&gt; '.$jobname.' '.$jobdesc.' '.$jobcomp.'&lt;/div&gt;'; echo = "$output"; } } } } </code></pre> <p>I dont know what is the problem please help Its a basic script to query a database and display the output</p>
<php>
2016-10-03 07:42:26
LQ_CLOSE
39,826,799
beginner regular expressions( java)
s = s.replaceAll("\\\s+$" , ""); I am still a beginner in java but as far as I know to use regular expressions I have to write it in [ ] so why this works and how the Jvm knows it is regular expressions and not just some string
<java><regex>
2016-10-03 07:51:57
LQ_EDIT
39,826,905
iOS 10 UNUserNotificationCenterDelegate not called. push notifications not working
<p>Tearing my hair out tying to get push notifications to work in iOS10. Current setup:</p> <p>in <code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool</code>:</p> <pre><code>if #available(iOS 10.0, *) { let center = UNUserNotificationCenter.current() center.delegate = self center.requestAuthorization(options: [.alert, .badge, .sound]) { (granted, error) in if error == nil { print("DID REQUEST THE NOTIFICATION") UIApplication.shared.registerForRemoteNotifications() } } print("DID SET DELEGATE") } </code></pre> <p>In <code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data)</code>:</p> <pre><code>print("DID REGISTER FOR A REMOTE NOTIFICATION AND THE TOKEN IS \(deviceToken.base64EncodedString())" let request = UpdatePushNotificationSubscription_Request(deviceToken: deviceToken) updatePushNotificationSubscriptionWorker.updateSubscription(request) </code></pre> <p>I have checked the token is uploaded to the backend correctly and it does indeed match.</p> <p>I have also implemented:</p> <pre><code> @available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Void) { print("GOT A NOTIFICATION") } @available(iOS 10.0, *) func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void) { //This is for the user tapping on the notification print("GOT A NOTIFICATION") } </code></pre> <p>I have set the entitlements for all targets and enabled push:</p> <p><a href="https://i.stack.imgur.com/slJXQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/slJXQ.png" alt="enter image description here"></a></p> <p>Now when I try to send a message from the backend the device just receives nothing. Delegates are not being called. Have no idea what I'm doing wrong here. Push is working for iOS9 and android devices. Any pointers to what I might be doing wrong?</p>
<ios><swift><apple-push-notifications>
2016-10-03 07:58:16
HQ
39,827,463
Random like order with mysql and PHP
<p>I use PHP and Mysql. I have a table that looks kind of like this:</p> <pre><code>id title ---------- 1 my title 2 another title 3 The last title </code></pre> <p>Now I want to select them with a random like order.</p> <ul> <li>I will need to use LIMIT because of the query size.</li> <li>The random like order should always be the same random order every time.</li> </ul> <h2>Example result, every time</h2> <pre><code>3 The last title 1 my title 2 another title </code></pre> <p>Do another query run:</p> <pre><code>3 The last title 1 my title 2 another title </code></pre> <p>The same random like result appear.</p> <h2>Possible solutions</h2> <ul> <li>Add a real random number stored as a new column generated by insert.</li> <li>Some fancy SELECT query that does some magic.</li> <li>Something else?</li> </ul> <p>Why I want this is that I insert products, first from one site, then from another. In the result I want to present them as a mix.</p>
<php><mysql><random>
2016-10-03 08:35:46
LQ_CLOSE
39,828,071
what is @ sign as a css selector?
<p>I saw this in a css file:</p> <pre><code>@-webkit-keyframes loading-spinner-anim { 0% { opacity: 1} 100% {opacity: 0} } @keyframes loading-spinner-anim { 0% { opacity: 1} 100% {opacity: 0} } </code></pre> <p>what do these selectors mean?</p> <p><code>@keyframes</code> it's not a class or id selector.</p> <p><code>loading-spinner-anim</code> - the space means it's a child element of the first selector. But it's not a class or id selector.</p>
<javascript><html><css>
2016-10-03 09:11:56
LQ_CLOSE
39,828,073
Can't connect to database inside file triggered using AJAX
I'm using AJAX to trigger my validation.php file. I want to connect to my database in that file, so I included connect.php file but it's causing some problem. <script type="text/javascript"> $(document).ready(function(){ $("#offer-form").submit(function(e){ e.preventDefault(); $.ajax({ type : 'POST', data: { 'name': $('#name-input').val() }, url : 'validation.php', success : function(data) { $("#name-error").text(data["name-error"]); } }); return false; }); }) </script> validation.php <?php header('Content-Type: application/json'); $error = array("name-error" => ""); require_once "connect.php"; $error['name-error'] = "error"; echo json_encode($error); ?> connect.php <?php $serverName = "localhost"; $dbName = "test"; $username = "root"; $password = ""; try { $conn = new PDO("mysql:host=$serverName; dbname=$dbName", $username, $password, array(PDO::ATTR_EMULATE_PREPARES => false, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) ); echo "Connected successfully"; } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } ?> I simplified my code. The thing is that using *require_once* inside my validation.php file causes *name-error* no to be displayed. Another strange thing to me is that this file works when I type .../validation.php in my browser. I'm already using connect.php in my main file (one including script shown above) and it works fine.
<php><ajax>
2016-10-03 09:11:58
LQ_EDIT
39,828,638
What is columnstore index and how is different from clustered and non-clustered
<p>Hi I am confused about columnstore index, what is column store index and how it is different from clustered and non-clustered index..</p>
<sql-server>
2016-10-03 09:40:38
HQ
39,828,744
Visual studio code interactive python console
<p>I'm using visual studio code with DonJayamanne python extension. It's working fine but I want to have an interactive session just like the one in Matlab, where after code execution every definition and computational result remains and accessible in the console. </p> <p>For example after running this code: </p> <pre><code>a = 1 </code></pre> <p>the python session is terminated and I cannot type in the console something like:</p> <pre><code>b = a + 1 print(b) </code></pre> <p>I'm aware that the python session can stay alive with a "-i" flag. But this simply doesn't work. </p> <p>Also every time I run a code file, a new python process is spawned. Is there a way to run consecutive runs in just one console? Again like Matlab?</p> <p>This sounds really essential and trivial to me. Am I missing something big here that I can't find a solution for this?</p>
<python><ipython><visual-studio-code>
2016-10-03 09:45:53
HQ
39,829,230
Git does not ask me for gpg passphrase and fails my commit
<p>When I do <code>git commit -a -S -m "Commit Message"</code>, I get this error:</p> <pre><code>You need a passphrase to unlock the secret key for user: "Username (Gpg Key) &lt;email-id&gt;" 2048-bit RSA key, ID 2487BE7C, created 2016-10-03 error: gpg failed to sign the data fatal: failed to write commit object </code></pre> <p>But, it doesn't even ask/prompts for my passphrase when I commit. So, how and where do I enter my passphrase while using gpg's <code>-S</code> flag?</p>
<git><gnupg>
2016-10-03 10:13:53
HQ
39,829,289
How do I call activity method from Adaptor class
I have three Class mainActivity.java public class mainactivity extends AppCompatActivity{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.abc); } public void firstDialog() { //Do something //call next method secondDialog() } public void secondDialog() { //Do something } } Next is another class which is calling the adaptor class secondclass.java public class secondclass extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.xyz); //calling and set adaptor adapter=new Myadaptopr(this,result); recyclerlist.setAdapter(adapter); } //Now the Adaptor class public class Myadaptopr extends RecyclerView.Adapter<Myadaptopr.ViewHolder> { @Override public void onBindViewHolder(final MedicineAdaptor.ViewHolder holder, int position) { //In this function I need to call firstDialog() Method How Do I proceed. } } **My Question is:** How do I call the methods of mainactivity.java class file. I have tried solution: but didn't work because mainactivity class don't call and set the adaptor. ((mainactivity)context).firstDialog();
<java><android><android-arrayadapter>
2016-10-03 10:16:40
LQ_EDIT
39,830,196
how to inject javascript in HTML label?
I've registration form with same regular details with 'submit' button to fill up in order to get registered in the system. I tried to inject scripts into text boxes but those are protected. now I want to inject script on labels so whenever a person opens that page my injected script on label get executed.
<xss><inject>
2016-10-03 11:09:49
LQ_EDIT
39,830,407
How to get firebase generated unique id
<p>I am creating chatting application. When user login I want to store his unique ID which is generated by push. How to get that ID.</p>
<android><firebase-realtime-database>
2016-10-03 11:21:09
LQ_CLOSE
39,830,580
Jest test fails : TypeError: window.matchMedia is not a function
<p>This is my first front-end testing experience. In this project, I'm using jest snapshot testing and got an error <code>TypeError: window.matchMedia is not a function</code> inside my component. </p> <p>I go through jest documentation, I found "Manual mocks" section, but I have not any idea about how to do that yet. </p>
<reactjs><jestjs>
2016-10-03 11:31:28
HQ
39,830,816
c# how to update checkbox in database through SQL Query
i am trying to update the checked state of a collom in my database. below is the code i have but i am unsure of how to implement the checkbox. Thank you for any help. con.Open(); OleDbCommand cmd = new OleDbCommand(String.Concat("Select * From ", comboBox1.Text), con); cmd.CommandType = CommandType.Text; string tableName = comboBox1.Text.ToString(); cmd.CommandText = "UPDATE [" + tableName + "] SET People_Call_Status = '" + Status_textBox1.Text + "', Research_Date = '" + Date_textBox.Text + "', Company_Name = '" + company_NameTextBox.Text + "', tblCompanies_Area_Dialling_Code = '" + tblCompanies_Area_Dialling_CodeTextBox.Text + "', Work_Number = '" + work_NumberTextBox.Text + "', building_Address = '" + building_AddressTextBox.Text + "', [Street Address] = '" + street_AddressTextBox.Text + "', suburb = '" + suburbTextBox.Text + "', city = '" + cityTextBox.Text + "', res_Code = '" + res_CodeTextBox.Text + "', industry_Vertical_ID = '" + industry_Vertical_IDTextBox.Text + "', pO_Box = '" + pO_BoxTextBox.Text + "', post_Office = '" + post_OfficeTextBox.Text + "', postal_Code = '" + postal_CodeTextBox.Text + "', country_ID = '" + country_IDTextBox.Text + "', province_ID = '" + province_IDTextBox.Text + "', prospect = '" + prospectCheckBox.Checked //not working + "' WHERE Company_ID = " + company_IDTextBox.Text + ";"; cmd.ExecuteNonQuery(); { MessageBox.Show("Update Success!"); con.Close(); }
<c#><sql><checkbox>
2016-10-03 11:44:23
LQ_EDIT
39,830,842
How to use Postgres JSONB datatype with JPA?
<p>Im not finding a way to map the JSON and JSONB datatypes from PostgreSQL using JPA (EclipseLink). Is some one using this datatypes with JPA and can give me some working examples?</p>
<java><json><postgresql><jpa><eclipselink>
2016-10-03 11:46:01
HQ
39,830,955
Pop to root view controller from modal
<p>I am trying to pop to the root view controller using the following code:</p> <pre><code>self.navigationController!.popToRootViewController(animated: true) </code></pre> <p>This usually works, but I get an error when trying to use this code when the current view is a modal. How do I go about popping back to the root view controller in this situation?</p> <p>Thanks in advance.</p>
<ios><swift><swift3>
2016-10-03 11:53:18
HQ
39,831,448
case insensitive matching search in string array swift 3
<p>In Swift 3, I want to create an array of matching string (case insensitive) from string array:-</p> <p>I am using this code, but it is case sensitive, </p> <pre><code>let filteredArray = self.arrCountry.filter { $0.contains("india") } </code></pre> <p>how can I do this.. suppose I have a master string array called arrCountry, I want to create other array of all the string who has "india"(case insensitive) in it. </p> <p>Can anyone help me out.</p>
<ios><swift><swift3>
2016-10-03 12:16:56
HQ
39,831,747
Get the length of a number by only using modulus
<p>Can someone help me figure out an exersice the IT teacher gave me? I have to make a program, that calculates how many digits are in a number. For example:</p> <p>I input a number 100, and the program gives me an output of 3. If I input 99, the program gives me 2.</p> <p>How can I achieve this by ONLY using the modulus (%) operator and nothing else, but mathematical calculations.</p>
<c++><functional-programming>
2016-10-03 12:31:51
LQ_CLOSE
39,832,721
Meaning of self.__dict__ = self in a class definition
<p>I'm trying to understand the following snippet of code:</p> <pre><code>class Config(dict): def __init__(self): self.__dict__ = self </code></pre> <p>What is the purpose of the line <code>self.__dict__ = self</code>? I suppose it overrides the default <code>__dict__</code> function with something that simply returns the object itself, but since <code>Config</code> inherits from <code>dict</code> I haven't been able to find any difference with the default behavior.</p>
<python>
2016-10-03 13:22:41
HQ
39,832,862
Jenkins: Cannot define variable in pipeline stage
<p>I'm trying to create a declarative Jenkins pipeline script but having issues with simple variable declaration.</p> <p>Here is my script:</p> <pre><code>pipeline { agent none stages { stage("first") { def foo = "foo" // fails with "WorkflowScript: 5: Expected a step @ line 5, column 13." sh "echo ${foo}" } } } </code></pre> <p>However, I get this error:</p> <pre><code>org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: WorkflowScript: 5: Expected a step @ line 5, column 13. def foo = "foo" ^ </code></pre> <p>I'm on Jenkins 2.7.4 and Pipeline 2.4.</p>
<jenkins><groovy><jenkins-pipeline>
2016-10-03 13:29:20
HQ
39,832,980
How to change application name in NativeScript
<p>I'm working with <strong>NativeScript</strong> from <strong>Telerik</strong> and I made an app with a debug name ("notiApp") but now I can't change the app's name in launcher and action bar.</p> <p>I already tried configuring my <code>AndroidManifest.xml</code> in <code>/app/App_Resources/Android/</code> modifying the <code>android:label</code> attribute of my <code>&lt;application&gt;</code> tag.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest&gt; &lt;application android:label="DESIRED NAME"&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>Also, I tried changing my project's root directory name for the new app desired name.</p> <p>There's anything else I can do or any additional information I could provide?</p> <p>Thanks in advance guys!</p>
<android><xml><telerik><nativescript><angular2-nativescript>
2016-10-03 13:35:20
HQ
39,833,324
How to create a Dynamic Associative array in PHP, from $_POST values?
I am trying to create php array (associative) declaration for non-empty key-value pairs only, which I am getting from $_POST. Any guesses, how to do this ? $my_array = [ "k1"=>"$val1", "k2"=>"$val2", "k3"=>"$val3", "k4"=>"$val4" ]; But, if $val4 & $val3 are empty / NULL / does'nt exist, then : $my_array = [ "k1"=>"$val1", "k2"=>"$val2" ]; Thanks
<php><arrays>
2016-10-03 13:52:15
LQ_EDIT
39,834,286
components communication through <router-outlet>
<p>I have a root component that has a changing boolean and I want to subscribe to that changing boolean, with a component within my <code>&lt;router-outlet&gt;</code>. I understand I need to use a shared bidirectional service of some sort. However, the docs for shared services just arent making a whole lot of sense to me. (I guess I cant wrap my head around the astronaut example) <a href="https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service" rel="noreferrer">here</a>, any help would be greatly appreciated, here is a little bit of code to show what I am trying to do.</p> <p><strong>root component</strong></p> <pre><code>@Component({ selector: 'my-app', template: `&lt;nav [state]="boolshow" (show)="changeValue($event)" &gt;&lt;/nav&gt; &lt;article&gt;&lt;router-outlet&gt;&lt;/router-outlet&gt;&lt;/article&gt; &lt;-----component in router here &lt;footer&gt;&lt;/footer&gt; &lt;h3&gt;toggle state: {{boolshow}}&lt;/h3&gt;`, styleUrls: ['./Css/app.css'], }) export class AppComponent { boolshow: boolean; &lt;-----boolean that needs to be read } </code></pre>
<angular>
2016-10-03 14:41:47
HQ
39,834,397
Perfomance Effect of Laravel Framework
<p>I'm wondering about the performance implications of using the laravel framework. Mainly the disk seeks, if it's scalable and if I can somehow cache the files in RAM.</p> <p>Thanks!</p>
<php><laravel><symfony>
2016-10-03 14:47:55
LQ_CLOSE