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,995,089
Which .net builtin functions use the params keyword?
<p>I am explaining the purpose and usage of the C# <code>params</code> (C++CLI <code>...array</code>) keyword to my colleague and wanted to show him some functions of .net that make use of it. But right know I don't remember any.</p> <p>For those who want to answer: Feel free to list as many as you know. But I would be happy with one already.</p>
<c#><arrays><c++-cli><params>
2016-10-12 09:27:00
LQ_CLOSE
39,995,145
'CGAffineTransformIdentity' is unavailable in Swift
<p>Came across this error when trying to do adapt some animations into Swift3 syntax. </p> <pre><code> UIView.animate(withDuration: duration, delay: 0.0, usingSpringWithDamping: 0.5, initialSpringVelocity: 0.8, options: [] , animations: { fromView.transform = offScreenLeft toView.transform = CGAffineTransformIdentity }, completion: { finished in transitionContext.completeTransition(true) }) </code></pre> <p>and got this: </p> <blockquote> <p>'CGAffineTransformIdentity' is unavailable in Swift </p> </blockquote>
<swift3><xcode8>
2016-10-12 09:29:03
HQ
39,995,573
When can I use explicit operator bool without a cast?
<p>My class has an explicit conversion to bool:</p> <pre><code>struct T { explicit operator bool() const { return true; } }; </code></pre> <p>and I have an instance of it:</p> <pre><code>T t; </code></pre> <p>To assign it to a variable of type <code>bool</code>, I need to write a cast:</p> <pre><code>bool b = static_cast&lt;bool&gt;(t); bool b = bool(t); bool b(t); // converting initialiser bool b{static_cast&lt;bool&gt;(t)}; </code></pre> <p>I know that I can use my type directly in a conditional without a cast, despite the <code>explicit</code> qualifier:</p> <pre><code>if (t) /* statement */; </code></pre> <p>Where else can I use <code>t</code> as a <code>bool</code> without a cast?</p>
<c++><implicit-conversion>
2016-10-12 09:49:02
HQ
39,996,000
Getting all positions of bit 1 in javascript?
<p>I have provided binary for example, <code>01001</code>, and would like to get positions of bit 1, so I expect it will return me <code>[0, 3]</code>.</p> <p>Is there any function provided by javascript to get all positions of bit 1?</p>
<javascript>
2016-10-12 10:11:26
LQ_CLOSE
39,996,081
Create JSON data in specific format in android
<p>i know there are many useful threads which teaches us how to make JSON data in a specific format. I have been looking into some useful threads but i am unable to achieve a specific format that i want. Can someone help me to achieve this format?</p> <pre><code>{"properties" : [ {"marker": {"point":new GLatLng(40.266044,-74.718479) }, {lastvisit: "Timestamp":"2016-10-31 13:55"} ]} </code></pre> <p>I need to make data in this format and after then i will send it to the server as a POST request.</p>
<java><android><arrays><json><jsonobject>
2016-10-12 10:15:08
LQ_CLOSE
39,996,239
Runtime error happens when deleting a node of the linklist
<p>Here's my C++ code of a simple structured linklist.</p> <pre><code>#include &lt;iostream&gt; using namespace std; class Node{ public: int data; Node* next; Node* prev; Node(){ data=-1; next=NULL; prev=NULL; } Node(int d,Node *nnext){ data=d; next=nnext; } void add(Node* nnext){ next=nnext; nnext-&gt;prev=this; } }; void print(Node* head){ Node* cNode; cNode=head; while (cNode!=NULL){ cout &lt;&lt;"["&lt;&lt;cNode-&gt;data&lt;&lt;"]" &lt;&lt; endl; cNode=cNode-&gt;next; } } void insertAfter(Node* pNode, Node* nNode){ nNode-&gt;next = pNode-&gt;next; pNode-&gt;next = nNode; pNode-&gt;next-&gt;prev = nNode; } void deleteNode(Node* b){ Node* c=b-&gt;next; Node* a=b-&gt;prev; a-&gt;next=c; c-&gt;prev=a; delete b; } void main(){ Node* head; head=new Node(); head-&gt;data=1; Node * currentNode=head; for (int i=2;i&lt;=5;i++){ Node* nNode=new Node(i,NULL); currentNode-&gt;add(nNode); currentNode=nNode; } cout &lt;&lt; currentNode-&gt;data &lt;&lt; endl; print(head); insertAfter(head, new Node(99,NULL)); //deleteNode(currentNode); print(head); } </code></pre> <p>The case checking is unnecessary because I just need the concept of the linklist. If you have another version of these kind of simple linklist code, please let me know! Thank you!</p>
<c++>
2016-10-12 10:23:34
LQ_CLOSE
39,996,333
Hello, I'm trying to write a program which outputs "n" (input) fibonacci numbers
**Hello!** I am struggling with my program. It should output n Fibonacci numbers, each on a new line. If the Fibonacci number exceeds the range of an unsigned int you should just exit the program. Moreover, you should print on a new line how many Fibonaccis of "n" are displayed. Here is the code so far: #include<iostream> #include<limits> using namespace std; int main() { unsigned int n; cout << "Please enter the amount of fibonaccis you would like to compute: " << endl; cin >> n; unsigned int next=1; unsigned int current=0; unsigned int c = current; unsigned int temp; unsigned int counter=1; //This bool returns true as soon as an overflow occurs bool overflow; /*This bool checks, whether the newly computed number is bigger than the previous number (which may not be the case if an overflow occurs)*/ bool nextBigger; /*Somehow, I could only handle the first inputs by using "bruteforce". If I tried to combine it with the "main loop", it got all messy. */ if(n==0) { std::cout << "0" << " of " << n << endl; } else if(n==1) { std::cout << "0" << endl << "1 of " << n << endl; } else if(n==2) { std::cout << "0" << endl << "1" << endl << "2 of " << n << endl; } else { /* This for-loop increases (at least it should) a counter by one for each computation of a valid fibonacci number*/ for(counter=1;counter<n;++counter) { overflow = (c > (std::numeric_limits<unsigned int>::max()-temp)); if(!overflow && nextBigger) { cout << next << endl; } else { break; //If overflow or next number < previous number, exit program } temp = next; //temp is storage variable for next c = current; //storage variable for current next += current; //next is being altered: it becomes the new fibonacci number current = temp; //current gets value of temp( value of next before being altered) } nextBigger = (next > current); cout << counter << " of " << n << endl; //Output of how many fibonaccis were computed } return 0; } So here is the thing. I programmed it in "Codeblocks", where it worked perfectly. But then I tried to upload it in "Codeboard" (as an assignment). In Codeboard it suddenly didn't work at all. Maybe it has to do with the different Compilers, but I really have no clue how I could fix this issue. So I am quite puzzled and I'd be very thankful for any hints, ideas, corrections or inspirations. (I am a beginner, so I hope the code is understandable and readable. I am open for suggested improvements.)
<c++><codeblocks><fibonacci>
2016-10-12 10:28:54
LQ_EDIT
39,996,491
Open downloaded file on Android N using FileProvider
<p>I've got to fix our App for Android N due to the FileProvider changes. I've basically read all about this topic for the last ours, but no solution found did work out for me.</p> <p>Here's our prior code which starts downloads from our app, stores them in the <code>Download</code> folder and calls an <code>ACTION_VIEW</code> intent as soons as the <code>DownloadManager</code> tells he's finished downloading:</p> <pre><code>BroadcastReceiver onComplete = new BroadcastReceiver() { public void onReceive(Context ctxt, Intent intent) { Log.d(TAG, "Download commplete"); // Check for our download long referenceId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); if (mDownloadReference == referenceId) { DownloadManager.Query query = new DownloadManager.Query(); query.setFilterById(mDownloadReference); Cursor c = mDownloadManager.query(query); if (c.moveToFirst()) { int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS); if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) { String localUri = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)); String fileExtension = MimeTypeMap.getFileExtensionFromUrl(localUri); String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileExtension); if (mimeType != null) { Intent openFileIntent = new Intent(Intent.ACTION_VIEW); openFileIntent.setDataAndTypeAndNormalize(Uri.parse(localUri), mimeType); openFileIntent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); try { mAcme.startActivity(openFileIntent); } catch (ActivityNotFoundException e) { // Ignore if no activity was found. } } } } } } }; </code></pre> <p>This works on Android M, but breaks on N due to the popular <code>FileUriExposedException</code>. I've now tried to fix this by using the <code>FileProvider</code>, but I cannot get it to work. It's breaking when I try to get the content URI:</p> <p><code>Failed to find configured root that contains /file:/storage/emulated/0/Download/test.pdf</code></p> <p>The <code>localUri</code> returned from the <code>DownloadManager</code> for the file is:</p> <p><code>file:///storage/emulated/0/Download/test.pdf</code></p> <p>The <code>Environment.getExternalStorageDirectory()</code> returns <code>/storage/emulated/0</code> and this is the code for the conversion:</p> <pre><code>File file = new File(localUri); Log.d(TAG, localUri + " - " + Environment.getExternalStorageDirectory()); Uri contentUri = FileProvider.getUriForFile(ctxt, "my.file.provider", file); </code></pre> <p>From <code>AndroidManifest.xml</code></p> <pre><code> &lt;provider android:name="android.support.v4.content.FileProvider" android:authorities="my.file.provider" android:exported="false" android:grantUriPermissions="true"&gt; &lt;meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"/&gt; &lt;/provider&gt; </code></pre> <p>The <code>file_paths.xml</code>:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;external-path name="external_path" path="." /&gt; &lt;/paths&gt; </code></pre> <p>And I've tried all values I could find in that xml file. :(</p>
<android><android-fileprovider><android-7.0-nougat>
2016-10-12 10:37:02
HQ
39,997,022
Show all warnings and errors in visual studio code
<p>I'am using Visual Studio Code Version 1.6.0. Is there any possibility to show errors and warnings of all files in the current root folder?</p> <p>At the moment it shows only errors and warnings for open files. </p>
<visual-studio-code>
2016-10-12 11:04:36
HQ
39,999,093
Swift: Programmatically make UILabel bold without changing its size?
<p>I have a UILabel created programmatically. I would like to make the text of the label bold without specifying font size. So far I have only found:</p> <pre><code>UIFont.boldSystemFont(ofSize: CGFloat) </code></pre> <p>This is what I have exactly:</p> <pre><code>let titleLabel = UILabel() let fontSize: CGFloat = 26 titleLabel.font = UIFont.boldSystemFont(ofSize: titleLabelFontSize) </code></pre> <p>But this way I am also setting the size. I would like to avoid that. Is there a way?</p> <p>If there is no way, what would be a good workaround in Swift?</p> <p>Thank you!</p>
<swift><uilabel><bold>
2016-10-12 12:52:46
HQ
39,999,153
What is hamburger menu ? and what is it used for ?
What is `3 line Menu` or `hamburgerMenu`? What is use of it ? Which Purpose we can add it in our application or website ?
<user-interface><user-controls><hamburger-menu>
2016-10-12 12:55:07
LQ_EDIT
40,000,864
Recursive method for 2,4,8,..in java
<p>I need to write an recursive method for my classes. The method should print the first n elements of the sequence 1,2,4,8,16,... so if the method is called for example like:</p> <pre><code>recSeq(6); </code></pre> <p>the method should print: 1,2,4,8,16,32 The method is declared like this:</p> <pre><code>static void recSeq(int n){ //enter code here } </code></pre> <p>I really don't know how to to it without a return value or something? Any ideas?</p>
<java><recursion>
2016-10-12 14:11:45
LQ_CLOSE
40,001,507
past a object from php to javascript
i have a little bit probleme , i need to give a object at JS when a click on a button , but i don t know how to do here is my code php echo '<script>'; echo 'var monObjet = "'.json_encode($product).'";'; echo '<script>'; <button type="button" onclick="ShowModal(monObjet)" class="btn btn-info btn-lg" data-toggle="modal" >Open Modal</button>'; and this is my code JS function ShowModal(monObjet){ var monObjet = monObjet; alert(monObjet); $('#myModal').appendTo("body").modal("show"); // $('#NomProduit').text(monObjet); }; </script> thanks in advance
<javascript><php>
2016-10-12 14:40:57
LQ_EDIT
40,002,297
How to generate url path in new Router Angular 2
<p>What analog <code>deprecated-router</code> method <code>generate</code> in new Router 3.0.0? Early it can take something like this:</p> <p><code>this._router.generate(['Profile']).urlPath; </code></p> <p>How do it on new router? </p>
<angular><angular-routing>
2016-10-12 15:17:38
HQ
40,002,798
JavaScript onChange not working using DOM element
<p>I got a problem when trying to make onchange listener for input in JavaScript:</p> <pre><code>var apple = document.getElementById("apple"); apple.addEventListener("change", validate("apple")); function validate(fruitName){ var qty = parseInt(document.getElementById(fruitName).value); console.log(qty); } </code></pre> <p>I am trying to check everytime when the user input something for 'apple' input, I will print the quantity at console. But by doing this, It only ran the first time when I refreshed the browser by printing out a NaN and does not work even when I changed the input for 'apple'.</p> <p>Any ideas?</p> <p>Thanks in advance.</p>
<javascript>
2016-10-12 15:41:16
LQ_CLOSE
40,003,213
How to extract json elements to variables in javascript
<p>I have json string like this:</p> <pre><code>[ {"COMPLIANCE_ID":"1/FIRST/US/191CC2/20160906/pW1WSpD/1","TOLERANCE":null,"WEIGHTED_ARR_LAST_SLP":"0.03801186624130076","SLIPPAGE_INTERVAL_VWAP_BPS":"10.2711","ROOT_ORDER_ID":"735422197553491","ENTERING_TRADER":"duffy_dma2","SECURITY_ID":"EOG.N","ARRIVAL_MID_PX":"93.6100","WEIGHTED_ARR_SLP":"0.12323190317127024","AVG_PX":"93.6586","ORDER_CCY":"USD","LEAVES_QTY":"0","WEIGHT":"0.02372627566400397","INITIATING_TRADER":null,"PARTICIPATION_RATE":"0E-12","LOCAL_REF_END_TIME":"2016-09-06 06:00:27.775","WEIGHTED_IVWAP_SLP":"0.2436949499725512","NOTIONAL_USD":"477940","LIST_ID":null,"SYM":"EOG","LIQ_CONSUMPTION":"15.21","URGENCY":null,"SIDE":"Sell Short","ALGO":"Hydra","EXECUTING_TRADER":"duffy_dma2","EXEC_QTY":"5103","CL_ORD_ID":"7245294057012908344","LOCAL_REF_START_TIME":"2016-09-06 05:59:57.844","SLIPPAGE_END_LAST_ARR_LAST_BPS":"1.6021","ORD_STATUS":"Filled","IVWAP_PX":"93.5625","LIMIT_PX":"93.6100","ORDER_ID":"735422197553491","VOLUME_LIMIT":"0E-12","SLIPPAGE_ARR_MID_BPS":"5.1939","ORDER_QTY":"5103","CLIENT_ACRONYM":"PEAKM","EXECUTION_STYLE":"2"},{"COMPLIANCE_ID":"1/FIRST/US/191CC2/20160906/pW1PUxP/1","TOLERANCE":null,"WEIGHTED_ARR_LAST_SLP":"-0.046488357264395964","SLIPPAGE_INTERVAL_VWAP_BPS":"0.1625","ROOT_ORDER_ID":"73855219760798","ENTERING_TRADER":"duffy_dma2","SECURITY_ID":"MCD.N","ARRIVAL_MID_PX":"118.0950","WEIGHTED_ARR_SLP":"-0.0041198933937856425","AVG_PX":"118.0923","ORDER_CCY":"USD","LEAVES_QTY":"0","WEIGHT":"0.01830250285999841","INITIATING_TRADER":null,"PARTICIPATION_RATE":"0E-12","LOCAL_REF_END_TIME":"2016-09-06 05:32:24.895","WEIGHTED_IVWAP_SLP":"0.002974156714749742","NOTIONAL_USD":"368684","LIST_ID":null,"SYM":"MCD","LIQ_CONSUMPTION":"62.82","URGENCY":null,"SIDE":"Sell","ALGO":"Hydra","EXECUTING_TRADER":"duffy_dma2","EXEC_QTY":"3122","CL_ORD_ID":"7244573979975932119","LOCAL_REF_START_TIME":"2016-09-06 05:32:19.697","SLIPPAGE_END_LAST_ARR_LAST_BPS":"-2.5400","ORD_STATUS":"Filled","IVWAP_PX":"118.0904","LIMIT_PX":"117.9900","ORDER_ID":"73855219760798","VOLUME_LIMIT":"0E-12","SLIPPAGE_ARR_MID_BPS":"-0.2251","ORDER_QTY":"3122","CLIENT_ACRONYM":"PEAKM","EXECUTION_STYLE":"4"}] </code></pre> <p>which I'm getting from another file in a js file:</p> <pre><code>var jsondata = document.getElementById("jsonArray").value; </code></pre> <p>How do I extract json elements from jsondata to variables like this:</p> <pre><code>RefData.COMPLIANCE_ID = [ "1/FIRST/US/191CC2/20160906/pW1WSpD/1", "1/FIRST/US/191CC2/20160906/pW1PUxP/1" ]; </code></pre> <p>etc..</p>
<javascript><json>
2016-10-12 16:03:00
LQ_CLOSE
40,004,159
Why is variable being modified from a method?
<h2>Background</h2> <p>I am making an array tools class for adding Python functionality to a Java array, and I came across this problem. This is obviously a simplified, more universal version.</p> <h2>Question</h2> <p>In this example:</p> <pre><code>public class ArrayTest { public static void main(String[] args) { // initial setup int[] given = {1, 2, 3, 4, 5}; // change array int[] changed = adjust(given); // these end up being the same... System.out.println(Arrays.toString(changed)); System.out.println(Arrays.toString(given)); } private static int[] adjust(int[] a) { for (int i = 0; i &lt; a.length; i++) { a[i]++; } return a; } } </code></pre> <p>...why is <code>changed</code> and <code>given</code> the same thing?</p> <h2>Disclaimer</h2> <p>I am guessing that this has been asked before, but I couldn't find an answer, so I apologize for that.</p>
<java><arrays><methods><scope>
2016-10-12 16:52:44
LQ_CLOSE
40,004,415
Having trouble with strings
<p>I AM ON WINDOWS</p> <p>I am working on a project. I have downloaded android-7.jar and renamed it to android7.zip and extracted the files. That worked fine. Now I have the classes for android. My main focus is just the android.app.AlertDialog, but that had a lot of imports, so I am just using the entire android source. I have my own java file, com.tylerr147.dialog.showDialog</p> <p>Here is that file:</p> <pre><code>//javac com/tylerr147/dialog/showDialog.java package com.tylerr147.dialog; import android.app.*; import android.os.*; public class showDialog extends Activity { AlertDialog.Builder adb = new AlertDialog.Builder(this); adb.setTitle("hi"); public static void main(String[] args) { } } </code></pre> <p>The reason I have the AlertDialog stuff outside of the main() is because I cannot use the AlertDialog in a static method.</p> <p>Everything has is fine except I am getting:</p> <pre><code>com\tylerr147\dialog\showDialog.java:10: error: &lt;identifier&gt; expected adb.setTitle("hi"); ^ com\tylerr147\dialog\showDialog.java:10: error: illegal start of type adb.setTitle("hi"); ^ 2 errors </code></pre> <p>I have no idea what is causing this problem. Any help is greatly appreciated.</p>
<java><android><string><compiler-errors>
2016-10-12 17:06:03
LQ_CLOSE
40,004,915
How do I check which merge tool I use?
<p>I want to check which merge tool my git is set to - I just don't remember the name. I know I can wait till the next merge opportunity to run it via <code>git merge tool</code> and see what was it, but I'd like to type something like <code>git mergetool status</code> to see what is the tool (and what is the version, for instance).</p>
<git><mergetool>
2016-10-12 17:34:52
HQ
40,005,795
How does sp_randint work?
<p>I am doing hyperparameter optimisation of Random Forest classifier. I am planning to use RandomSearchCV. </p> <p>So by checking the available code in Scikit learn: What does sp_randint do? Does it randomly take a value from 1 to 11? Can it be replaced by other function?</p> <pre><code> from scipy.stats import randint as sp_randint param_dist = {"n_estimators": sp_randint (1, 11), "max_depth": [3, None], "max_features": sp_randint(1, 11), "min_samples_split": sp_randint(1, 11), "min_samples_leaf": sp_randint(1, 11), } </code></pre> <p>Thank you.</p>
<machine-learning><python><optimization><scikit-learn><scipy>
2016-10-12 16:10:17
HQ
40,006,078
Objective C close keyboard when return key is pressed
<p>I have a button that when pressed brings up a keyboard for a textfield:</p> <pre><code>- (IBAction)textButtonPress:(id)sender { [self.textField becomeFirstResponder]; } </code></pre> <p>The problem I have is that when I press the return button on the keyboard nothing happens. How can I make the keyboard automatically close when the return key is pressed?</p>
<ios><objective-c>
2016-10-12 18:41:11
LQ_CLOSE
40,006,631
Sending POST request in Golang with header
<p>I create my form like this:</p> <pre><code>form := url.Values{} form.Add("region", "San Francisco") if len(params) &gt; 0 { for i := 0; i &lt; len(params); i += 2 { form.Add(params[i], params[i+1]) } testLog.Infof("form %v", form) </code></pre> <p>Now if I use</p> <pre><code>resp, err = http.PostForm(address+r.Path, form) </code></pre> <p>then everything works fine, I get back a response with an expected cookie. </p> <p>However, I would like to to add a header in which case I can't use <code>PostForm</code> hence I created my <code>POST request</code> manually like:</p> <pre><code>req, err := http.NewRequest("POST", address+r.Path, strings.NewReader(form.Encode())) </code></pre> <p>Then I add stuff to the header and send the request</p> <pre><code>req.Header.Add("region", "San Francisco") resp, err = http.DefaultClient.Do(req) </code></pre> <p>But the form is not received and my response does not contain any cookie.</p> <p>When I print the <code>req</code>, it looks like the form is <code>nil</code>:</p> <pre><code>&amp;{POST http://localhost:8081/login HTTP/1.1 1 1 map[Region:[San Francisco]] {0xc420553600} 78 [] false localhost:8081 map[] map[] &lt;nil&gt; map[] &lt;nil&gt; &lt;nil&gt; &lt;nil&gt; &lt;nil&gt;} </code></pre>
<http><post><go>
2016-10-12 19:15:06
HQ
40,006,690
gitlab runner The requested URL returned error: 403
<p>I'm currently using gitlab.com (not local installation) with their multi-runner for CI integration. This works great on one of my projects but fails for another.</p> <p>I'm using 2012R2 for my host with MSBuild version 14.0.23107.0. I know the error below shows 403 which is an access denied message. My problem is finding the permission setting to change.</p> <p>Error message:</p> <blockquote> <p>Running with gitlab-ci-multi-runner 1.5.3 (fb49c47) Using Shell executor... Running on WIN-E0ORPCQUFHS...</p> <p>Fetching changes...</p> <p>HEAD is now at 6a70d96 update runner file remote: Access denied fatal: unable to access '<a href="https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.com/##REDACTED##/ADInactiveObjectCleanup.git/" rel="noreferrer">https://gitlab-ci-token:xxxxxxxxxxxxxxxxxxxx@gitlab.com/##REDACTED##/ADInactiveObjectCleanup.git/</a>': The requested URL returned error: 403 Checking out 60ea1410 as Production...</p> <p>fatal: reference is not a tree: 60ea1410dd7586f6ed9535d058f07c5bea2ba9c7 ERROR: Build failed: exit status 128</p> </blockquote> <p>gitlab-ci.yml file:</p> <pre><code>variables: Solution: ADInactiveObjectCleanup.sln before_script: #- "echo off" #- 'call "%VS120COMNTOOLS%\vsvars32.bat"' ## output environment variables (usefull for debugging, propably not what you want to do if your ci server is public) #- echo. #- set #- echo. stages: - build #- test #- deploy build: stage: build script: - echo building... - '"%ProgramFiles(x86)%\MSBuild\14.0\Bin\msbuild.exe" "%Solution%" /p:Configuration=Release' except: #- tags </code></pre>
<git><msbuild><gitlab><gitlab-ci><gitlab-ci-runner>
2016-10-12 19:18:52
HQ
40,006,925
Clang and GCC disagree on legality of direct initialization with conversion operator
<p>The latest version of clang (3.9) rejects this code on the second line of <code>f</code>; the latest version of gcc (6.2) accepts it:</p> <pre><code>struct Y { Y(); Y(const Y&amp;); Y(Y&amp;&amp;); }; struct X { operator const Y(); }; void f() { X x; Y y(x); } </code></pre> <p>If any of these changes are made, clang will then accept the code:</p> <ul> <li>Remove <code>Y</code>'s move constructor</li> <li>Remove <code>const</code> from the conversion operator</li> <li>Replace <code>Y y(x)</code> with <code>Y y = x</code></li> </ul> <p>Is the original example legal? Which compiler is wrong? After checking the sections about conversion functions and overload resolution in the standard I have not been able to find a clear answer.</p>
<c++><initialization><type-conversion><language-lawyer><conversion-operator>
2016-10-12 19:34:48
HQ
40,007,365
RequiresApi vs TargetApi android annotations
<p>Whats the difference between <code>RequiresApi</code> and <code>TargetApi</code>?</p> <p>Sample in kotlin:</p> <pre><code>@RequiresApi(api = Build.VERSION_CODES.M) @TargetApi(Build.VERSION_CODES.M) class FingerprintHandlerM() : FingerprintManager.AuthenticationCallback() </code></pre> <p><em>NOTE: <code>FingerprintManager.AuthenticationCallback</code> requires api <code>M</code></em></p> <p><em>NOTE 2: if I dont use TargetApi lint fail with error <code>class requires api level 23...</code></em></p>
<android><android-support-library><kotlin><android-annotations>
2016-10-12 20:02:50
HQ
40,007,497
Using Cordova and XCode 8, how can I run iOS build with Push Notification capabilities?
<p>I'm using Ionic/Cordova to build an Android and iOS app. Before deployments, I use Jenkins to run 'ionic build ios --device' to create a final IPA file for QA to test against. Unfortunately, using xCode 8 you now have to manually enable the Push Notification capability in the XCode project capabilities settings.</p> <p>Is there a way to pass capabilities to <code>ionic build</code> or <code>cordova build</code> so that push notifications will be enabled when building via CLI?</p>
<cordova><ionic-framework><xcode8>
2016-10-12 20:11:05
HQ
40,007,812
Sublime text 3 how to hide Definition on mouse over function?
<p>I've tried to find a solution in other posts but no solution found.</p> <p>I'm using Sublime text 3 and since I installed last update 3126, when I put my mouse over a function, in PHP ou Javascript, I get a list of all files using this function and it's useless for me and takes all place on my screen.</p> <p>How can I hide this ?</p> <p><a href="https://i.stack.imgur.com/MkWbK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/MkWbK.png" alt="Sublime Text 3 Definition mouse over function"></a></p> <p>I'm using those Packages :</p> <ul> <li>alignment</li> <li>compare side by side</li> <li>Emmet</li> <li>minifier</li> <li>Sidebar</li> <li>livereload</li> <li>SFTP</li> <li>Sublimelinter</li> <li>colorpicker</li> </ul> <p>I love this tool but I need a bit more help to configure my own options.</p> <p>Thanks for help !</p>
<sublimetext3>
2016-10-12 20:30:55
HQ
40,007,935
How to handle errors in fetch() responses with Redux-Saga?
<p>I try to handle <code>Unauthorized</code> error from server using redux-saga. This is my saga:</p> <pre><code>function* logIn(action) { try { const user = yield call(Api.logIn, action); yield put({type: types.LOG_IN_SUCCEEDED, user}); } catch (error) { yield put({type: types.LOG_IN_FAILED, error}); } } </code></pre> <p>I fetch data like this:</p> <pre><code>fetchUser(action) { const {username, password} = action.user; const body = {username, password}; return fetch(LOGIN_URL, { method, headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify(body) }) .then(res =&gt; { res.json().then(json =&gt; { if (res.status &gt;= 200 &amp;&amp; res.status &lt; 300) { return json } else { throw res } }) }) .catch(error =&gt; {throw error}); } </code></pre> <p>But anyway result is <code>{type: 'LOG_IN_SUCCEEDED', user: undefined}</code> when I expect <code>{type: 'LOG_IN_FAILED', error: 'Unauthorized'}</code>. Where is my mistake? How to handle errors right using Redux-Saga?</p>
<javascript><redux><fetch><redux-saga>
2016-10-12 20:38:07
HQ
40,008,526
Python printing from array's
I've got 3 different array's, all the data inside is coming from a external csv file which works although how do i print each name with each number next to them name = [] number1 = [] number2 = [] for example expected output is, although I'm unsure how i would do this LOOP (12) as there is 12 names and numbers in each array Test, 5, 20
<python><list>
2016-10-12 21:18:42
LQ_EDIT
40,009,820
Git rebase one branch on top of another branch
<p>In my git repo, I have a <code>Master</code> branch. One of the remote devs created a branch <code>Branch1</code> and had a bunch of commits on it. I branched from <code>Branch1</code>, creating a new branch called <code>Branch2</code> (<code>git checkout -b Branch2 Branch1</code>) such that <code>Branch2</code> head was on the last commit added to <code>Branch1</code>:(Looks like this)</p> <pre><code>Master--- \ Branch1--commit1--commit2 \ Branch2 (my local branch) </code></pre> <p><code>Branch1</code> has had a number of changes. The other dev squashed his commits and then added a few more commits. Meanwhile, ive had a bunch of changes in my branch but havent committed anything yet. Current structure looks like this:</p> <pre><code> Master--- \ Branch1--squashed commit1,2--commit3--commit4 \ Branch2 (my local branch) </code></pre> <p>Now I want have to rebase my changes on top of <code>Branch1</code>. I am supremely confused on how to go about this. I know the 1st step will be to commit my changes using <code>git add .</code> and <code>git commit -m "message"</code>. But do i then push? using <code>git push origin Branch2</code> ? or <code>git push origin Branch2 Branch1</code> ? Help is much needed and GREATLY appreciated, also if I can some how create a backup of my branch, it will be great in case I screw something up</p>
<git><rebase>
2016-10-12 23:12:07
HQ
40,010,727
Checking if the value for the key is the same as before Python
I have been working on this code and I cannot find a answer. 1. I have 2 lists point_values = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10] letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] 2. I want to set `a:1` and `b:3` and so on... >I want them set in a dictionary called `point_values`. **How should I do this?**
<python><dictionary>
2016-10-13 01:08:44
LQ_EDIT
40,011,717
How to move line up and down in VS2015
<p>I don't know if something has changed recently in Visual Studio 2015 but before I was able to press <code>ALT + UP ARROW KEY</code> or <code>ALT + DOWN ARROW KEY</code> to move lines in code up or down and now it does not do anything.</p> <p>I went into <code>Tools &gt; Options &gt; Environment &gt; Keyboard</code> and I cannot find anything like in the past called <code>ProjectandSolutionContextMenus.Item.MoveUp</code> or <code>ProjectandSolutionContextMenus.Item.MoveDown</code></p> <p>Also here in the list of VS2015 I don't see that option: <a href="http://visualstudioshortcuts.com/2015/" rel="noreferrer">http://visualstudioshortcuts.com/2015/</a></p> <p>How to achieve this?</p>
<visual-studio-2015><keyboard-shortcuts>
2016-10-13 03:17:34
HQ
40,012,016
importing d3.event into a custom build using rollup
<p>I've got a file <code>d3.custom.build.js</code> like this (simplified):</p> <pre><code>import { range } from 'd3-array'; import { select, selectAll, event } from 'd3-selection'; import { transition } from 'd3-transition'; export default { range, select, selectAll, event, transition }; </code></pre> <p>And a <code>rollup.config.js</code> like this:</p> <pre><code>import nodeResolve from 'rollup-plugin-node-resolve'; export default { entry: './js/vendor/d3-custom-build.js', dest: './js/vendor/d3-custom-built.js', format: 'iife', globals: { d3: 'd3' }, moduleId: 'd3', moduleName: 'd3', plugins: [nodeResolve({ jsnext: true })] }; </code></pre> <p>I want to export to a plain old browser global named 'd3'. I'm calling rollup from a simple npm script. The good news is that almost everything works in the output file, except for one thing: <code>d3.event</code> in browser is always null. No, it's not an issue with events being hijacked on the page. When I swap in the standard full d3 4.0 library into the script tag everything works fine. It's definitely a build issue.</p> <p>The <a href="https://github.com/d3/d3-selection/blob/master/README.md#customEvent" rel="noreferrer">d3 docs</a> warn that bundling <code>event</code> is tricky:</p> <blockquote> <p>If you use Babel, Webpack, or another ES6-to-ES5 bundler, be aware that the value of d3.event changes during an event! An import of d3.event must be a live binding, so you may need to configure the bundler to import from D3’s ES6 modules rather than from the generated UMD bundle; not all bundlers observe jsnext:main. Also beware of conflicts with the window.event global.</p> </blockquote> <p>It appears that setting <code>nodeResolve({ jsnext: true })</code> isn't sufficing. How do I get a live binding in the bundle? Any guidance very appreciated.</p>
<javascript><d3.js><rollupjs>
2016-10-13 03:51:44
HQ
40,012,602
devise confirmable radio button
I am using devise gem, I used :confirmable to let the user confirm his account so the email will come to him after he signed up and if he open the link it will confirm immediately.. What I want is to send the user email after he signed up to show him his account then to give him option if to confirm it or not something like radio button Here is my codes in the user model devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable, :confirmable before_create :confirm_email def confirm_email UserMailer.registration_confirmation(self).deliver end in the mailier default :from => 'info@eccsbc.com' def registration_confirmation(user) @user = user mail :to => 'nour@khatib.ca' ,:subject =>"New member please confirm" end in the user_mailier tempalate <%= link_to 'Confirm my account', confirmation_url(@user, :confirmation_token => @user.confirmation_token) %>
<ruby-on-rails><devise><radio-button><devise-confirmable>
2016-10-13 04:57:48
LQ_EDIT
40,012,715
Just upgrade my site to 1.9.3.0 and got error SQLSTATE[42S22]: Column not found: 1054 Unknown column 'catalog_product_entity_group_price.is_percent'
<p>Before I was using Magento 1.9.2.4 and today I got message that need to upgrade my magento with latest update some critical updates too.</p> <p>After upgrading my website from downloader section everything went well no error etc, two things happen that I notices after update my index.php permission was change to 666 website is opening correctly I mean front page display, but when I click on any product It show error page with following information.</p> <p>There has been an error processing your request</p> <pre><code>SQLSTATE[42S22]: Column not found: 1054 Unknown column 'catalog_product_entity_group_price.is_percent' in 'field list', query was: SELECT `catalog_product_entity_group_price`.`value_id` AS `price_id`, `catalog_product_entity_group_price`.`website_id`, `catalog_product_entity_group_price`.`all_groups`, `catalog_product_entity_group_price`.`customer_group_id` AS `cust_group`, `catalog_product_entity_group_price`.`value` AS `price`, `catalog_product_entity_group_price`.`is_percent` FROM `catalog_product_entity_group_price` WHERE (entity_id='84') AND (website_id = 0) Trace: #0 /home/MyWebsite/public_html/app/Mage.php(463): Mage_Core_Model_Config-&gt;getModelInstance('eav/entity_attr...', 'SQLSTATE[42S22]...') #1 /home/MyWebsite/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(661): Mage::getModel('eav/entity_attr...', 'SQLSTATE[42S22]...') #2 /home/MyWebsite/public_html/app/code/core/Mage/Eav/Model/Entity/Abstract.php(1641): Mage_Eav_Model_Entity_Abstract-&gt;walkAttributes('backend/afterLo...', Arr </code></pre> <p>Not know how to roll back because I did not get backup as they says it is stable, or not able to resolve this error.</p> <p>Thanks in advance</p>
<php><magento><magento-1.9>
2016-10-13 05:08:10
HQ
40,012,866
Could not find method android() for arguments in Android Studio project
<p>I am trying to do a grade sync on my android studio project and I keep getting this error in the title. My build.gradle file is </p> <pre><code>// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } android { compileSdkVersion 24 buildToolsVersion '24.0.0' } dependencies { } </code></pre> <p>My error message is</p> <pre><code>Gradle sync failed: Could not find method android() for arguments [build_aiwlctiq29euo9devcma4v4r7$_run_closure3@22efc0bc] on root project 'MyRadio </code></pre> <p>I have looked online and tried multiple solutions but nothing seems to work. What does this even mean? Any help would be appreciated.</p>
<android><android-studio><gradle><build><android-gradle-plugin>
2016-10-13 05:21:33
HQ
40,013,764
Correct way to retrieve token for FCM - iOS 10 Swift 3
<p>i had implement Firebase with FirebaseAuth/FCM etc and did sent notification successfully through Firebase Console. </p> <p>However i would need to push the notification from my own app server.</p> <p>i am wondering below which way is correct way to retrieve the registration id for the device:-</p> <p><strong>1) retrieve registration id token from didRegisterForRemoteNotificationWithDeviceToken</strong></p> <pre><code>func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { var token = "" for i in 0..&lt;deviceToken.count { token += String(format: "%02.2hhx", arguments: [deviceToken[i]]) } print("Registration succeeded!") print("Token: ", token) Callquery(token) } </code></pre> <p><strong>2) Retrieve Registration token from firebase</strong> (Based on Firebase document which retrieve the current registration token)</p> <pre><code>let token = FIRInstanceID.instanceID().token()! </code></pre> <p>i was using the first way, the push notification is not being received even the registration id is stored on my app server database accordingly and i get this CURL session result :-</p> <pre><code>{"multicast_id":6074293608087656831,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]} </code></pre> <p>i had also tried the second way and get fatal error while running the app as below:- <a href="https://i.stack.imgur.com/ZeQ9U.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZeQ9U.png" alt="enter image description here"></a></p> <p>appreciated if anyone could point me the right way, thanks!</p>
<ios><swift><firebase><firebase-cloud-messaging>
2016-10-13 06:28:03
HQ
40,014,712
Angular 2.0.0 - Testing " imported by the module 'DynamicTestModule' "
<p>I am having a problem in testing app.component.ts in Angular 2. I am using angular-cli. Whenever I run ng test, my app.component.spec.ts makes the console prompt with the error: </p> <pre><code> Failed: Unexpected directive 'HomeModuleComponent' imported by the module 'DynamicTestModule' Error: Unexpected directive 'HomeModuleComponent' imported by the module 'DynamicTestModule' </code></pre> <p>I imported the HomeModuleComponent in TestBed</p> <pre><code>TestBed.configureTestingModule({ declarations: [AppComponent], imports : [ HomeModuleComponent ] }); </code></pre> <p>Can anyone help me with this problem?</p>
<unit-testing><angular><karma-jasmine>
2016-10-13 07:22:54
HQ
40,015,385
Angular 2 Router Wildcard handling with child-routes
<p>When using child routes with angular2's router "3.0", there is no need to declare them in the parent router config (before, you had to do something like <code>/child...</code> in the parent component).</p> <p>I want to configure a global "page not found" handler, which I can do like this:</p> <pre><code>{ path: '**', component: PageNotFoundComponent } </code></pre> <p>in my app routing module.</p> <p>The caveat: If I do this, the router navigates to routes declared in the app routing module before the <code>PageNotFoundComponent</code> just fine. But it always navigates to the wildcard route when I try to access a child route (declared using <code>RouterModule.forChild</code> in some child routing module.</p> <p>Intuitively, the wildcard route should be placed behind all other route configs, because the router resolves in declaration order. But there does not seem to be a way to declare it after the child routes. It also does not seem very elegant to declare a wildcard route in all child router modules.</p> <p>Am I missing something or is there just no way to define a global 404-page in Angular-2-Router-3 when using child routes?</p>
<angular>
2016-10-13 07:59:30
HQ
40,016,002
C# WPF - RegisterHotKey prevents from Textbox to receive input
Hello there and thank you for your time, I've been recently fiddling around with WPF, trying to learn as I go and decided to do a small project to help me learn faster. I have run into this problem, which is not quite exactly a problem, more of a logical contradiction, I would say. What I've been doing is registering global key presses. While my window is either the top window or another one is highlighted, register every key press there is on Windows. I have been using the RegisterHotKey function which tells the computer to interpret keyboard input differently, if I understand properly. Which prevents me from using the keyboard as I would normally while this application is open in the background. Every search I make comes up empty, they all lead me to RegisterHotKey which might not be the right solution in my case. I want to read global key presses while still keeping the same old keyboard input. Even a slight suggestion on how this might be done will be greatly appreciated! Thank you in advance.
<c#><.net><wpf><registerhotkey>
2016-10-13 08:31:53
LQ_EDIT
40,016,085
Android studio sync settings between different computers
<p>I use 3 different computers for programming in the android studio.</p> <p>What is the best way to sync android studio settings between computers?</p>
<android><android-studio>
2016-10-13 08:36:18
HQ
40,016,204
How can i make <a href='$game_link' target='_blank'>$game_link</a> a button
<p>Hello I'm to trying to make this variable $game_link which is the url from the database a button, but seem not to get it right? I need help on it please. This is the code $game_link.</p>
<php><html><variables><hyperlink>
2016-10-13 08:43:11
LQ_CLOSE
40,016,748
sql fragmentation
I need **SQL FRAGMENTATION** with *examples*
<sql-server-2008>
2016-10-13 09:10:11
LQ_EDIT
40,017,746
How to separate one file or folder with all history from one git repo to another?
<p>Let me explain. For some time I developed some code. Now I want to separate a part and make it open-source. My main problem is to <strong>save all commit history, which concerns that files</strong>.</p>
<git>
2016-10-13 09:52:22
LQ_CLOSE
40,018,125
Binning of data along one axis in numpy
<p>I have a large two dimensional array <code>arr</code> which I would like to bin over the second axis using numpy. Because <code>np.histogram</code> flattens the array I'm currently using a for loop:</p> <pre><code>import numpy as np arr = np.random.randn(100, 100) nbins = 10 binned = np.empty((arr.shape[0], nbins)) for i in range(arr.shape[0]): binned[i,:] = np.histogram(arr[i,:], bins=nbins)[0] </code></pre> <p>I feel like there should be a more direct and more efficient way to do that within numpy but I failed to find one.</p>
<python><numpy><histogram><binning>
2016-10-13 10:10:57
HQ
40,018,341
r update df1 values based ond df2 in different format
I am trying to find a scalable solution to update a data.frame based on another data.frame. Here a minimal example: df1 <- data.frame(cbind(c("a","b","b","b","c"),c(1,1,1,2,2),as.numeric(c(0.2,0.6,0.6,0.8,0.4)))) colnames(df1) <- c("ID1", "ID2","Value") > df1 ID1 ID2 Value 1 a 1 0.2 2 b 1 0.6 3 b 1 0.6 4 b 2 0.8 5 c 2 0.4 df2 <- data.frame(cbind(2),0,0.45,0.5) colnames(df2) <- c("ID2", "a","b","c") > df2 ID2 a b c 1 2 0 0.45 0.5 Now I would like to update the values of df1 by using df2 values to get to the following result: ID1 ID2 Value 1 a 1 0.2 2 b 1 0.6 3 b 1 0.6 4 b 2 0.45 5 c 2 0.5 Can someone help on this? thanks a lot
<r><dataframe><merge>
2016-10-13 10:22:35
LQ_EDIT
40,018,653
In a type trait, why do people use enum rather than static const for the value?
<p>For example, this is how I would write it, and it compiles and works just fine:</p> <pre><code>template&lt;typename T&gt; struct is_pointer&lt;T*&gt; { static const bool value = true; } </code></pre> <p>Then why do some people write the less obvious</p> <pre><code>template&lt;typename T&gt; struct is_pointer&lt;T*&gt; { enum { value = true }; } </code></pre> <p>instead? Is it only because the <code>static const</code> variable uses a byte of memory, whereas the <code>enum</code> doesn't?</p>
<c++><templates><enums><static><constants>
2016-10-13 10:37:33
HQ
40,019,283
Why does ToString() on generic types have square brackets?
<p>Why does <code>new List&lt;string&gt;().ToString();</code> return the following:?</p> <pre><code>System.Collections.Generic.List`1[System.String] </code></pre> <p>Why wouldn't it just bring back <code>System.Collections.Generic.List&lt;System.String&gt;</code>. What's with the strange non C# syntax?</p>
<c#><generics>
2016-10-13 11:05:42
HQ
40,019,429
Convert date string to year/month/day
<p>Ajax getResponseHeader("Last-Modified") returns a date string in the following format:</p> <pre><code>Thu Oct 13 2016 13:05:17 GMT+0200 (Paris, Madrid, sommartid) </code></pre> <p>Is it possible with javascript to get the year, month and day so I can store them in separate variables?</p>
<javascript><ajax>
2016-10-13 11:12:48
LQ_CLOSE
40,019,584
Could not find method android() for arguments org.gradle.api.Project
<p>Getting a bug, when I try to compile my project in studio , i have search quite a bit with no real solution to it </p> <p>Error:(17, 0) Could not find method android() for arguments [build_a7zf1o8ge4ow4uolz6kqzw5ov$_run_closure2@19201053] on root project 'booksStudioDir' of type org.gradle.api.Project.</p> <p>This is a sample of my build/gradle file </p> <pre><code>buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'io.fabric.tools:gradle:1.+' } } apply plugin: 'com.android.application' apply plugin: 'io.fabric' android { compileSdkVersion 21 buildToolsVersion "23.0.1" defaultConfig { applicationId "com.peade.time" minSdkVersion 10 targetSdkVersion 13 } signingConfigs { release { storeFile file("/home/bestman/Desktop/mkey/key") storePassword "androidkeys" keyAlias "peade" keyPassword "yes1234" } } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.release } } } repositories { maven { url 'https://maven.fabric.io/public' } mavenCentral() } dependencies { compile 'com.edmodo:cropper:1.0.1' compile 'com.android.support:support-v4:21.0.3' compile 'com.itextpdf:itextpdf:5.5.6' // compile files('libs/commons-lang3-3.3.2.jar') compile files('libs/dropbox-android-sdk-1.6.1.jar') // compile files('libs/httpmime-4.0.3.jar') compile files('libs/json_simple-1.1.jar') compile files('libs/picasso-2.5.2.jar') compile('com.crashlytics.sdk.android:crashlytics:2.5.2@aar') { transitive = true; } compile project(':owncloud') } </code></pre>
<java><android><gradle><android-gradle-plugin>
2016-10-13 11:21:10
HQ
40,019,683
Laravel Eloquent Lazy Eager Load Count
<p>I'm ideally looking for a function like</p> <pre><code>load('relationship') </code></pre> <p>but which loads a count in the same way</p> <pre><code>withCount('relationship') </code></pre> <p>works for eager loading.</p> <p>I'm thinking it is going to be called <code>loadCount('relationship')</code> </p>
<laravel><eloquent>
2016-10-13 11:25:53
HQ
40,019,695
getElementById(...) is null ? why?
<p>Check this code please, and help me solve why i'm getting type error <em>document.getElementById(...) is null</em></p> <pre><code>function Dropdown(){ this.core = ['NIS', 'EUR', 'USD']; this.check = function(){ var cho = '&lt;select&gt;'; for(x in this.core){ cho += '&lt;option value="'+ this.core[x] +'"&gt;'+ this.core[x] +'&lt;/option&gt;'; } cho += '&lt;/select&gt;'; return cho }; } var obj = new Dropdown(); document.getElementById("demo").innerHTML = obj.check(); </code></pre> <p>on HTML file i have : </p> <pre><code> &lt;div id="demo"&gt;Check Console log&lt;/div&gt; </code></pre> <p>Thank you for any help.</p>
<javascript><function><methods>
2016-10-13 11:26:26
LQ_CLOSE
40,019,861
Why do I get an conversion error in android using R.string?
<p>My file <code>strings.xml</code> looks like the following:</p> <pre><code>&lt;resources&gt; &lt;string name="app_name"&gt;BootIntervals&lt;/string&gt; &lt;string name="action_settings"&gt;Settings&lt;/string&gt; &lt;string name="logname"&gt;"bi2.log"&lt;/string&gt; &lt;/resources&gt; </code></pre> <p>and later I call a method </p> <pre><code> logger.init(R.string.logname); </code></pre> <p>which takes a <code>String</code> as argument. However, I get the following error:</p> <pre><code>Error:(21, 15) error: method init in class MyLogger cannot be applied to given types; required: String found: int reason: actual argument int cannot be converted to String by method invocation conversion </code></pre> <p>It does not matter if I use <code>bi2.log</code> or <code>"bi2.log"</code> in <code>strings.xml</code>. What do I make wrong this time? I do not understand why <code>R.string.logname</code> is an integer...</p>
<android>
2016-10-13 11:35:14
LQ_CLOSE
40,022,487
My version of quicksort Algorithm as Wikipedia says do not sort nice
Yesterday I post the same question, a nice member called Prune helped my. But now, I do not know why it does not work. def partition(A,lo,hi): pivot = A[hi] i=lo #Swap for j in range(lo,hi-1): if (A[j] <= pivot): val=A[i] A[i]=A[j] A[j]=val i=i+1 val=A[i] A[i]=A[hi] A[hi]=val return(i) def quicksort(A,lo,hi): if (lo<hi): p=partition(A,lo,hi) quicksort(A,lo,p-1) quicksort(A,p+1,hi) return(A) If my input is [5,3,2,6,8,9,1] the output is [1, 2, 5, 3, 8, 9, 6], why is that?
<python><quicksort>
2016-10-13 13:33:15
LQ_EDIT
40,022,679
Android Studio - No Target Device Found
<p>I'm having trouble getting an Android app that I developed working on my phone. (<code>Android Studio</code> on <code>Windows 7</code> trying to run the app on <code>Samsung Note 3</code> running <code>Android 5.0</code>)</p> <p>Here's what I've done so far:</p> <ul> <li>Turned on <code>USB debugging</code> and allowed <code>unknown sources</code></li> <li>Installed <code>Google USB Driver</code></li> <li>Restarted computer</li> <li>Tried <code>updating the driver</code> for the phone but no updates were available</li> <li>Turned on <code>debugging</code> in the <code>build.gradle</code> file</li> </ul> <p>and yet it is still returning <code>Error running app: No target device found</code></p> <p>I have also tried the dialog option for when I run the app but that says <code>No USB devices or running emulators detected</code></p> <p>Is there anything I have missed?</p> <p>Thanks in advance!</p>
<android><android-studio-2.1>
2016-10-13 13:40:35
HQ
40,024,147
Run Angular2 as static app in browser without a server
<p>As I understand the Angular2 concept - it is transpiling TypeScript files to .js files. In principle, it should be possible to compile, package, and then run that Angular2 application as a static application from AWS S3 bucket, GitHub or whatever static source.</p> <p>If I run Angular2 application on node server (with angular-cli "ng serve" command), it takes 500 MB of RAM on server - it's "Heey, common!" - is it really supposed to be that way! What's the benefit of this framework then against React, for example, which needs only a browser.</p> <p>I can't seem to find anything useful on serving Angular2 application as a static compiled HTML+JS.</p> <p>Maybe you can help me understand this, and solve?</p> <p>Thanks a lot!</p> <p>Maris</p>
<angular><angular-cli>
2016-10-13 14:42:32
HQ
40,024,280
mysqldump via SSH to local computer
<p>I have an SSH access to production server of the Rails app.</p> <p>I want to make a mysqldump of production database to my Mac. Please help me to achieve this.</p>
<mysql><ruby-on-rails><ssh>
2016-10-13 14:47:36
HQ
40,024,370
Ruby: What is the fastest way to xor 2 integers in Ruby?
Given an array a of n elements, I should replace a[i] with a[i] XOR a[i+1] for m number of times. The value of m may reach up to 10^18. What is the fastest and best approach?
<ruby><algorithm><performance><xor>
2016-10-13 14:51:33
LQ_EDIT
40,024,892
Windows 10 Docker Host - Display GUI application from Linux Container
<p>I'm trying to use Windows 10 as my host and run Docker containers that contain gui based applications and display them using X11 forwarding or something similar. Pretty much all of the information I've found online deal with Linux Host to Linux Container (example - <a href="http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker" rel="noreferrer">http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker</a>) where the socket / x11 authority are exposed. Other information I've found is from previous implementations of Boot2Docker / Windows where virtualbox was required as part of the setup procedure and required VNC.</p> <p>Basic setup currently, does anyone know what has to be adjusted to get Firefox to display within a window on the host system? -- </p> <p>Start an XMing server on Windows 10 host</p> <h2>Dockerfile</h2> <pre><code>FROM ubuntu:14.04 RUN apt-get update &amp;&amp; apt-get install -y firefox CMD /usr/bin/firefox </code></pre> <h2>Commands</h2> <pre><code>PS&gt; docker build -t firefox . PS&gt; set-variable -name DISPLAY -value localhost:0.0 PS&gt; docker run -ti --rm -e DISPLAY=$DISPLAY firefox </code></pre> <p>Thanks</p>
<windows><user-interface><docker><containers>
2016-10-13 15:16:45
HQ
40,025,328
Does git gc execute at deterministic intervals?
<p>I've been reading up on git, and I have a very particular question I am struggling to answer.</p> <p><strong>When</strong> does <code>git gc</code> execute autonomously?</p> <p>I've been hearing through the grape-vine of various forums that it occurs by default on a push or a fetch/pull - but I cannot find any source that verifies this. Even <a href="https://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer">the documentation itself</a> only gets this specific (emphasis mine):</p> <blockquote> <p><strong>Some</strong> git commands <strong>may</strong> automatically run git gc; see the --auto flag below for details</p> </blockquote> <p>and the <code>--auto</code> flag specifies</p> <blockquote> <p><strong>Some</strong> git commands run git gc --auto after performing operations that could create many loose objects.</p> </blockquote> <p>I want to be able to deterministically say:</p> <p>"Loose tree and blob files will not have been cleaned up by git until one of the following commands is run: <strong>{mystery list here}</strong>. When running one of these commands, if the number of loose objects exceeds the value of <code>gc.auto</code>, git will automatically compress the objects into a packfile".</p>
<git><garbage-collection>
2016-10-13 15:36:37
HQ
40,025,359
How to display 00*** number in console?
<pre><code>var a = 000077; </code></pre> <p>I would like to see in console.log(a) 000077. How is it possible to perform this?</p>
<javascript>
2016-10-13 15:37:49
LQ_CLOSE
40,025,540
Html/css Table border lines/separate editing
i am working on a html/css project for my school but have run into a problem on one of my pages i have 3 table's witch i want to edit with css separately if tried to put class in all of the table's but it still only takes the commands of the second table am i suppose to put class in all of the TR's and TD's too? here is my css code: body{ background-color: lightgrey; .tabel1{ border-color: purple; width: 400px; text-align: center; height: 100px; } .tabel2, tr, td{ width: 350px; border-color: grey; border-style: solid; border-collapse: collapse; } .tabel3{ border-radius: 25px; background: purple; padding-left: 2%; padding-right: 2%; padding-bottom: 4%; padding-top: 4%; width: 400px; border-color: purple; box-shadow: 15px 6px 10px purple; }
<html><css>
2016-10-13 15:46:56
LQ_EDIT
40,025,744
How to invoke a NSwag client method that needs bearer token on request header?
<p>I didn't get exactly how NSwag interact with IdentityServerX bearer tokens and adds it request header conventionally? My host api application implements IdentityServer3 with LDAP auth, so as far as i understand; if any host needs to a token for authentication then any client must send it on request header. So how can i deal with it while working NSwag clients ?</p> <p>Any idea appreciated. Thanks.</p>
<.net><asp.net-web-api><identityserver3><nswag>
2016-10-13 15:57:08
HQ
40,025,762
angular2-cli gives @multi styles error
<p>I started using angular2-cli recently and created a new project. I wanted to use bootstrap in my project hence I installed bootstrap and then wanted to import the bootstrap css file like it is shown in the the angular2-cli guide here. <a href="https://github.com/angular/angular-cli#global-library-installation" rel="noreferrer">https://github.com/angular/angular-cli#global-library-installation</a> After running ng serve I get the following error.</p> <blockquote> <p>ERROR in multi styles Module not found: Error: Can't resolve '/home/krishna/angular2_migrate/webui/node_modules/bootstrap/dist/css/bootstrap.min.css' in '/home/krishna/angular2_migrate/webui/node_modules/angular-cli/models' @ multi styles</p> </blockquote> <p>What am I doing wrong ?</p> <p>Information about angular2-cli version</p> <pre><code>krishna@Krishna:~/angular2_migrate/webui$ ng version Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ember-cli.com/user-guide/#watchman for more info. angular-cli: 1.0.0-beta.17 node: 4.4.3 os: linux x64 </code></pre>
<css><angular><styles><angular2-cli>
2016-10-13 15:58:13
HQ
40,025,981
OpenNLP vs Stanford CoreNLP
<p>I've been doing a little comparison of these two packages and am not sure which direction to go in. What I am looking for briefly is:</p> <ol> <li>Named Entity Recognition (people, places, organizations and such).</li> <li>Gender identification.</li> <li>A decent training API.</li> </ol> <p>From what I can tell, OpenNLP and Stanford CoreNLP expose pretty similar capabilities. However, Stanford CoreNLP looks like it has a lot more activity whereas OpenNLP has only had a few commits in the last six months.</p> <p>Based on what I saw, OpenNLP appears to be easier to train new models and might be more attractive for that reason alone. However, my question is what would others start with as the basis for adding NLP features to a Java app? I'm mostly worried as to whether OpenNLP is "just mature" versus semi-abandoned.</p>
<java><stanford-nlp><opennlp>
2016-10-13 16:08:58
HQ
40,026,124
Software to block internet for applications
<p>I am using mobile internet on my desktop computer. All the sudden I have found out there was like one giga mb lost for nothing and I assume it must be because of some other background applications. Is there any software where I could limit internet only for specific applications? Including blocking windows 10 for updates etc. Would appreciate your reply</p>
<windows-10><software-distribution><internet-connection>
2016-10-13 16:16:15
LQ_CLOSE
40,027,068
can a unique constraint column have 2 or more null values? (oracle)
<p>Is it possible to have 2 or more null values in unique constraint column?</p>
<sql><oracle11g>
2016-10-13 17:09:07
HQ
40,027,932
Using (:send) in Ruby with keyword arguments?
<p>I have a private method that I am trying to use #send to in Ruby to do some testing. The method is complicated and I don't want exposed outside of the class and so I want to test the method but I also don't need to list it as a public method. It has keyword arguments. How can I use <code>send</code> to call the method but also pass it keyword arguments/named parameters? Is there a way?</p> <p>The method looks like this:</p> <p><code>def some_method(keyword_arg1:, keyword_arg2:, keyword_arg3: nil)</code></p>
<ruby>
2016-10-13 18:01:47
HQ
40,028,715
Split the sub String from a String Starting with "http" and ending with ".JPG" in Excel
For Example Here is the String in Cell A1: Product Image File: 2eeb_1_edse.JPG Product Image URL: http://www.example.com/product_images/p/759/2eeb_1_edse.JPG|Product Image File: r__006677.jpg, Product Image URL: http://www.example.com/product_images/e/130/r__006677.jpg It Contains two Image URLs I want to Populate These two URLs in Cell B1 and C1. Please Any Body Can Help ?
<excel><macros><excel-formula><excel-2007><vba>
2016-10-13 18:48:04
LQ_EDIT
40,028,841
How Do I Run A Script On A Specific Wepbage Using A Chrome Extension?
<p>I have a script that I would like to run on a specific page. How would I go about doing this using a Google Chrome extension?</p>
<javascript><google-chrome-extension>
2016-10-13 18:55:17
LQ_CLOSE
40,029,106
vue.js, simple v-for / v-bind to add index to class name
<p>I can't seem to find the syntax to loop through my items and give each 'li' a class corresponding to the index. How is this done? </p> <pre><code>&lt;li v-for="(item, idx) in items class="idx""&gt; &lt;/li&gt; </code></pre>
<vue.js>
2016-10-13 19:12:47
HQ
40,029,315
How to do this effect? :S
<p>I'll be more then grateful if someone can give me some hints in achieving this effect from here: <a href="http://branditylab.com/#branditylab/home" rel="nofollow">http://branditylab.com/#branditylab/home</a></p>
<javascript><jquery><animation>
2016-10-13 19:24:24
LQ_CLOSE
40,029,587
Function for matrix in R
<p>I'm new (very new) in R. I'm struggling with making a function that's supposed to take a matrix (old_matrix) and return a new matrix (new_matrix), but in new_matrix all values in old_matrix that is a prime should be multiplied by 2 when it appears in new_matrix. So the new matrix should look the same as the old matrix, but where a prime occurs in old, this element should be multiplied by 2. </p> <p>I'm thinking that I should start out with a for loop, but I'm already struggling with how to make the loop go through all elements of the matrix. I appreciate all the help I can get to get closer to making this function!</p>
<r><function><for-loop><matrix>
2016-10-13 19:41:15
LQ_CLOSE
40,029,629
What do the different build actions do in a csproj. I.e. AdditionalFiles or Fakes
<p>What do the different build actions do in a Web API project (may apply to other types as well)? </p> <p>I see: None, Compile, Content, Embedded Resource, AdditionalFiles, CodeAnalysisDictionary, ApplicationDefinition, Page, Resource, SplashScreen, DesignData, DesignDataWithDesignTimeCreatableTypes, EntityDeploy, XamlAppDef, Fakes</p> <p>I found similar questions on StackOverflow, but they don't link to any Microsoft documentation or contain all items. I.e., what does AdditionalFiles or Fakes do?</p> <p><a href="http://What%20are%20the%20various%20%E2%80%9CBuild%20action%E2%80%9D%20settings%20in%20Visual%20Studio%20project%20properties%20and%20what%20do%20they%20do?" rel="noreferrer">"What are the various “Build action” settings in Visual Studio project properties and what do they do?"</a> has an incomplete list.</p> <p>Yes, I did look and can't find it in the documentation.</p>
<c#><asp.net-web-api><visual-studio-2015><msbuild>
2016-10-13 19:44:01
HQ
40,030,709
React Native: Can't see console.logs when I run application from XCode
<p>I'm struggling to get my code working with <code>react-native run-ios</code>. The native code is pulling some old cached version of the javascript bundle, and I can't seem to clear that to save my life.</p> <p>When I run the application from XCode however, the application runs just fine. Awesome!</p> <p>The only problem is that when I run my application through XCode, I can't seem to access the javascript logs. I've tried <code>react-native log-ios</code> but that doesn't seem to show my logs. I've tried "Enabling debugging in Chrome" from the simulator menu, but this option isn't available to me when I run the app from XCode.</p> <p>Does anybody have any thoughts on what might be going on here?</p>
<ios><xcode><react-native>
2016-10-13 20:49:08
HQ
40,031,688
Javascript ArrayBuffer to Hex
<p>I've got a Javascript ArrayBuffer that I would like to be converted into a hex string.</p> <p>Anyone knows of a function that I can call or a pre written function already out there?</p> <p>I have only been able to find arraybuffer to string functions, but I want the hexdump of the array buffer instead.</p>
<javascript>
2016-10-13 21:57:58
HQ
40,032,125
How do I center the ActionBar title in Android Studio without creating a custom layout?
I want to center the `ActionBar` title text in my app... What's the easiest way to center this with the default layout for action bars (not a custom layout)? Thanks. Base API for my app is 16. Please don't rate this post down... It's really a simple question.
<android><android-actionbar><center><title>
2016-10-13 22:34:09
LQ_EDIT
40,032,835
This formula is killing me, help please
The first formula below is the one that operates correctly – its function is to tally up all “x’s” in a particular column when another column in that row says “Spain” and another column in that row says “Issued”.   =COUNTIFS(L$3:L$89,"=x",$A$3:$A$89,"=Spain",$H$3:$H$89,"=Issued")   The problem is with this next formula where I want it to do the same as above, plus add to it the tally for other rows that have “France”, for example.  I know this formula isn’t structured correctly because the output is “zero”, when it should be “2”.  There are more countries that I want to add to this command eventually, but if I could get it to operate correctly with just two countries, adding the others should be easy. I’m not sure if the formula is the problem, or if I’m using the wrong function command, or what.    =COUNTIFS(K$3:K$89,"=x",$A$3:$A$89,"=Spain",$H$3:$H$89,"=Issued",K$3:K$89,"=x",$A$3:$A$89,"=France",$H$3:$H$89,"=Issued")  
<excel>
2016-10-13 23:52:36
LQ_EDIT
40,033,583
How is Complex number assignment from a double enabled?
<p>The Complex structure in System.Numerics allows assignment like this</p> <pre><code>Complex c = 3.72; </code></pre> <p>If I wanted to make my own Complex struct, how would I program this capability? I like it better than using constructors as in</p> <pre><code>Complex c = new Complex(3.72); </code></pre>
<c#>
2016-10-14 01:34:57
LQ_CLOSE
40,033,608
Enable Windows 10 Developer Mode programmatically
<p>I know you can <a href="http://www.hanselman.com/blog/Windows10DeveloperMode.aspx" rel="noreferrer">enable Windows 10 Developer mode interactively</a> by going to Settings | For developers, selecting 'Developer mode' and then rebooting.</p> <p>Is there a way to enable this programmatically? (eg. via PowerShell or similar so that I can include it as a step in a <a href="http://boxstarter.org/" rel="noreferrer">Boxstarter</a> script when refreshing my developer workstation)</p>
<powershell><windows-10><windows-administration>
2016-10-14 01:37:55
HQ
40,033,827
What is the difference between ACL and SCO Link in Bluetooth?
<p>ACL= Asynchronous Connection-Less. SCO = Synchronous Connection Oriented.</p> <p>SCO is Point to Point Connection between only one master and only one slave.</p> <p>ACL is multipoint connection between one master and many slaves. </p> <p>What are the other differences? </p>
<bluetooth><core-bluetooth>
2016-10-14 02:11:49
HQ
40,034,690
NODE_ENV is not recognised as an internal or external command
<p>I am developing in node.js and wanted to take into account both production and development environment. I found out that setting NODE_ENV while running the node.js server does the job. However when I try to set it in package.json script it gives me the error:</p> <blockquote> <p>NODE_ENV is not recognised as an internal or external command</p> </blockquote> <p>Below is my package.json</p> <pre><code>{ "name": "NODEAPT", "version": "0.0.0", "private": true, "scripts": { "start": "NODE_ENV=development node ./bin/server", "qa2": "NODE_ENV=qa2 node ./bin/server", "prod": "NODE_ENV=production node ./bin/server" }, "dependencies": { "body-parser": "~1.15.1", "cookie-parser": "~1.4.3", "debug": "~2.2.0", "express": "~4.13.4", "fs": "0.0.1-security", "jade": "~1.11.0", "morgan": "~1.7.0", "oracledb": "^1.11.0", "path": "^0.12.7", "serve-favicon": "~2.3.0" } } </code></pre> <p>I run my node server as: <code>npm run qa2</code> for example.</p> <p>I don't know what I am doing wrong. Any help is appreciated</p>
<node.js><express><package.json>
2016-10-14 03:55:58
HQ
40,034,880
Sort A String Array By Second Word Based On Specific Format?
I have the following **data** 1. John Smith 2. Tom Cruise 3. Chuck Norris 4. Bill Gates 5. Steve Jobs ** **Explanation** **</br> </br> Now as you can see, the data is in specific format, `[ID]. [Firstname] [Lastname]`, Is there a way to sort this array by firstname? **Output** Should look something like this 4. Bill Gates 3. Chuck Norris 1. John Smith 5. Steve Jobs 2. Tom Cruise
<java><arrays><sorting>
2016-10-14 04:22:02
LQ_EDIT
40,035,102
How to convert a list with properties to a another list the java 8 way?
<p>There is a List A with property Developer. Developer schema likes that:</p> <pre><code>@Getter @Setter public class Developer { private String name; private int age; public Developer(String name, int age) { this.name = name; this.age = age; } public Developer name(String name) { this.name = name; return this; } public Developer name(int age) { this.age = age; return this; } } </code></pre> <p>List A with properties:</p> <pre><code>List&lt;Developer&gt; A = ImmutableList.of(new Developer("Ivan", 25), new Developer("Curry", 28)); </code></pre> <p>It is demanded to convert List A to List B which with property ProductManager and the properties is same as the ones of List A.</p> <pre><code>@Getter @Setter public class ProductManager { private String name; private int age; public ProductManager(String name, int age) { this.name = name; this.age = age; } public ProductManager name(String name) { this.name = name; return this; } public ProductManager name(int age) { this.age = age; return this; } } </code></pre> <p>In the old days, we would write codes like:</p> <pre><code>public List&lt;ProductManager&gt; convert() { List&lt;ProductManager&gt; pros = new ArrayList&lt;&gt;(); for (Developer dev: A) { ProductManager manager = new ProductManager(); manager.setName(dev.getName()); manager.setAge(dev.getAge()); pros.add(manager); } return pros; } </code></pre> <p>How could we write the above in a more elegant and brief manner with Java 8?</p>
<java><list><collections><java-8><refactoring>
2016-10-14 04:47:50
HQ
40,035,363
2 wordpress websites on one account?
<p>Currently I have one wordpress website installed into the root directory.</p> <p>How to move it into any inner directory and install another website into the root?</p> <p>Or maybe will it easier to export data and unistall the old website and install 2 ones? but again How?</p>
<php><wordpress>
2016-10-14 05:13:03
LQ_CLOSE
40,036,374
How to use / include fabricjs in Angular2
<p>I want use fabricjs in my project. I installed fabricjs using bower and linked in index.html. but it is not working. Please see the below code.</p> <p>index.html</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt;document.write('&lt;base href="' + document.location + '" /&gt;'); &lt;/script&gt; &lt;title&gt;Image Editor&lt;/title&gt; &lt;meta charset="UTF-8"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;link rel="stylesheet" href="css/bootstrap/dist/css/bootstrap.min.css"&gt; &lt;!-- 1. Load libraries --&gt; &lt;!-- Polyfill(s) for older browsers --&gt; &lt;script src="libs/core-js/client/shim.min.js"&gt;&lt;/script&gt; &lt;script src="libs/zone.js/dist/zone.js"&gt;&lt;/script&gt; &lt;script src="libs/reflect-metadata/Reflect.js"&gt;&lt;/script&gt; &lt;script src="libs/systemjs/dist/system.src.js"&gt;&lt;/script&gt; &lt;script src="css/jquery/dist/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="css/bootstrap/dist/js/bootstrap.min.js"&gt;&lt;/script&gt; // incuding fabricjs here &lt;script src="../../bower_components/fabric.js/dist/fabric.min.js"&gt;&lt;/script&gt; &lt;!-- 2. Configure SystemJS --&gt; &lt;script src="systemjs.config.js"&gt;&lt;/script&gt; &lt;script&gt; System.import('app').catch(function(err){ console.error(err); }); &lt;/script&gt; &lt;/head&gt; &lt;!-- 3. Display the application --&gt; &lt;body&gt; &lt;my-app&gt;Loading...&lt;/my-app&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This is component file "stage.component.ts"</p> <pre><code>import {Component, OnInit} from '@angular/core'; import { ActivatedRoute, Router} from '@angular/router'; import { fabric } from 'fabric'; import { ImageService } from '../services/image.service'; declare var fabric:any; @Component({ selector:'my-stage', styleUrls: ['./app/stage/stage.component.css'], templateUrl: './app/stage/stage.component.html', }) export class StageComponent implements OnInit { title:string = 'Image Editor'; imgpath: string = ''; canvas:any = null; // fabric:any = null; constructor( private route: ActivatedRoute, ) { // this.fabric = new fabric(); } ngOnInit() { this.canvas = new fabric.Canvas('fstage', { isDrawingMode: true, selection: true }); } } </code></pre> <p>I have search many reference but couldn't find out what is wrong with my. Please advice, thank you.</p>
<javascript><angular><typescript><fabricjs>
2016-10-14 06:29:47
HQ
40,037,487
"The filename or extension is too long error" using gradle
<p>I have recently updated my code and when I tried to run our application using <strong>g bootRun</strong> in the command line, I encountered this error. </p> <p><strong>Stack Trace:</strong></p> <pre><code>org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46) at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66) at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110) at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23) at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43) at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37) at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30) at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154) at org.gradle.internal.Factories$1.create(Factories.java:22) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52) at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151) at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99) at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62) at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93) at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82) at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94) at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28) at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43) at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:75) at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:45) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:51) at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:28) at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:43) at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:170) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237) at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35) at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206) at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33) at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22) at org.gradle.launcher.Main.doAction(Main.java:33) at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45) at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54) at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35) at org.gradle.launcher.GradleMain.main(GradleMain.java:23) at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30) at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:129) at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61) Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'C:\Java\jdk1.8.0_77\bin\java.exe'' at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:197) at org.gradle.process.internal.DefaultExecHandle.failed(DefaultExecHandle.java:327) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:86) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54) at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40) Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'C:\Java\jdk1.8.0_77\bin\java.exe' at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27) at net.rubygrapefruit.platform.internal.WindowsProcessLauncher.start(WindowsProcessLauncher.java:22) at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36) at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68) ... 2 more Caused by: java.io.IOException: Cannot run program "C:\Java\jdk1.8.0_77\bin\java.exe" (in directory "D:\Work\FBXX"): CreateProcess error=206, The filename or extension is too long at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25) ... 5 more Caused by: java.io.IOException: CreateProcess error=206, The filename or extension is too long ... 6 more </code></pre> <p>Here's the task in gradle: </p> <pre><code> bootRun { if (project.hasProperty('args')) { args project.args.split('\\s+') } } </code></pre> <p>We have tried reducing the directory path of our project but we're looking for another solution. </p> <p>This is the current directory path of our project:</p> <blockquote> <p>D:\Work\FBXX</p> </blockquote>
<java><windows><intellij-idea><gradle><cmd>
2016-10-14 07:33:38
HQ
40,037,812
JSF: How to sort the dropdown list before displaying in dropdown box
[This is drop down list][1] The below image will show the code for that drop down box. It will return a list of object, after that I'm creating new SelectItem object. Is there any way to sort the list of object before I'm creating new SelectItem object. [Java Code for Drop Down box[2] Sorry, I'm not able to send the entire code, due to confidential [1]: https://i.stack.imgur.com/xo6Du.png [2]: https://i.stack.imgur.com/Y9L0W.png
<java>
2016-10-14 07:51:48
LQ_EDIT
40,038,169
Pandas: timestamp to datetime
<p>I have dataframe and column with dates looks like</p> <pre><code> date 1476329529 1476329530 1476329803 1476329805 1476329805 1476329805 </code></pre> <p>I use <code>df['date'] = pd.to_datetime(df.date, format='%Y-%m-%d %H:%M:%S')</code> to convert that, but I'm get strange result</p> <pre><code> date 1970-01-01 00:00:01.476329529 1970-01-01 00:00:01.476329530 1970-01-01 00:00:01.476329803 1970-01-01 00:00:01.476329805 1970-01-01 00:00:01.476329805 1970-01-01 00:00:01.476329805 </code></pre> <p>Maybe I did anything wrong</p>
<python><datetime><pandas>
2016-10-14 08:12:02
HQ
40,038,521
change the date format in laravel view page
<p>I want to change the date format which is fetched from database. now I got 2016-10-01<code>{{$user-&gt;from_date}}</code> .I want to change the format 'd-m-y' in laravel 5.3</p> <pre><code>{{ $user-&gt;from_date-&gt;format('d/m/Y')}} </code></pre>
<php><laravel><date>
2016-10-14 08:29:28
HQ
40,038,572
eval "$(docker-machine env default)"
<p>I have issues with launching docker with docker-compose.</p> <p>When I run <code>docker-compose -f dev.yml build</code> I following error > </p> <pre><code>Building postgres ERROR: Couldn't connect to Docker daemon - you might need to run `docker-machine start default`. </code></pre> <p>However if I run <code>docker-machine ls</code> machine is clearly up > </p> <pre><code>NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default - virtualbox Running tcp://192.168.99.100:2376 v1.12.1 </code></pre> <p>I fixed the error by running <code>eval "$(docker-machine env default)"</code> after which <code>docker-compose -f dev.yml build</code> completes successfully.</p> <p>My question why did this work, what actually happens and how do I undo it?</p> <p>Also is this a safe way to fix this? Right now this just my laptop, but these containers are supposed to hit company servers in near future. </p> <p>I am not super fluent with bash but I been always told not to run <code>eval</code> and especially not to run eval with " </p>
<bash><docker><docker-compose><docker-machine>
2016-10-14 08:32:30
HQ
40,039,770
TransformException duplicate entry for org/intellij/lang/annotations/Identifier.class
<p>I am getting this error</p> <pre><code>Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'. &gt; com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/intellij/lang/annotations/Identifier.class </code></pre> <p>It started after I added <code>compile "com.wefika:flowlayout:0.4.0"</code> to my gradle</p> <p>This is my gradle file</p> <pre><code> packagingOptions { exclude 'META-INF/NOTICE' // will not include NOTICE file exclude 'META-INF/LICENSE' // will not include LICENSE file // as noted by @Vishnuvathsan you may also need to include // variations on the file name. It depends on your dependencies. // Some other common variations on notice and license file names exclude 'META-INF/notice' exclude 'META-INF/notice.txt' exclude 'META-INF/license' exclude 'META-INF/license.txt' } dexOptions { javaMaxHeapSize "4g" } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:24.2.1' compile 'com.android.support:design:24.2.1' compile 'com.android.support:cardview-v7:24.2.1' compile 'com.google.android.gms:play-services-location:9.6.1' compile "com.google.firebase:firebase-messaging:9.0.0" compile 'com.google.android.gms:play-services-auth:9.6.1' compile 'com.google.android.gms:play-services-plus:9.6.1' compile 'com.android.support:multidex:1.0.1' compile 'com.jakewharton:butterknife:7.0.1' compile 'com.loopj.android:android-async-http:1.4.9' compile 'de.hdodenhof:circleimageview:2.0.0' compile 'com.firebase:firebase-client-android:2.5.2' compile 'com.facebook.android:facebook-android-sdk:[4,5)' compile 'com.google.android.gms:play-services:9.6.1' compile 'org.jetbrains:annotations-java5:15.0' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.google.firebase:firebase-core:9.4.0' compile "com.wefika:flowlayout:0.4.0" configurations.all { resolutionStrategy { force 'com.android.support:design:23.4.0' force 'com.android.support:support-v4:23.4.0' force 'com.android.support:appcompat-v7:23.4.0' } } </code></pre>
<android><intellij-idea>
2016-10-14 09:32:45
HQ
40,040,514
Python 3.4 - Text.get() on Tkinter returns Attribute Error
<p>Im using Python3.4 </p> <p>I was trying to run a simple program that reads the Input from the Text Box Widget of Tkinter. </p> <p>Im New to Tkinter, from the TkDocs i saw its a simple get command that would read the content of Text Box and store in a Variable.</p> <p>In My case neither Insert nor Get is working; both of them gives as Unknown Attribute Get &amp; Insert.</p> <p>I was facing difficulty to add the code, please check the image<a href="https://i.stack.imgur.com/UtX7z.jpg" rel="nofollow">Containd the sample Code</a></p>
<tkinter><textbox>
2016-10-14 10:08:30
LQ_CLOSE
40,040,583
How to use Notification service extension with UNNotification in iOS10
<p>Apple introduce new extension names <a href="https://developer.apple.com/reference/usernotifications/unnotificationserviceextension" rel="noreferrer">"UNNotificationServiceExtension"</a>, but how to launch it from push notification ?</p> <p>I read that service extension provide end to end encryption for payload.</p> <p>Which key is required to set payload of push notification ?</p> <p>How to identify payload and how to launch service extension from push notification ?</p>
<ios><push-notification><ios10><ios-extensions>
2016-10-14 10:11:27
HQ
40,041,401
How to manage service workers in chrome?
<p>In Mozila, we can view service workers by <code>about:serviceworkers</code>. Is there any option in chrome to manage/delete service workers?</p> <p>I have a worker in google chrome background displaying unwanted browser push notifications?</p>
<google-chrome><service-worker>
2016-10-14 10:52:24
HQ
40,042,749
Simple script not working on my html code for my site
<p>I am learning HTML and Javascript, but it seems I did something wrong and I can't figure it out, why won't my script work? It is supposed to change the size of the image when you hover over with the mouse. I'm just investigating to learn how to do stuff.</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; Kikito's Sprites &lt;/title&gt; &lt;/head&gt; &lt;body style="background-color:#ffc299"&gt; &lt;div&gt; &lt;h1 style="color:white"&gt; Kikito Loco Sprite Showcaserino &lt;/h1&gt; &lt;img onmouseover="descriptiveTextImg(this)" onmouseout="normalImg(this)" src="monigoteTransparencia.png" alt="Amicable Anthony" style="position:absolute;top:100px;left:-50px;width:300px;height:300px;"&gt; &lt;img src="ballinBob.png" alt="Ballin Bob" style="position:absolute;top:90px;left:130px;width:300px;height:300px;"&gt; &lt;img src="severedArm.png" alt="just some pixel gore" style= "position:absolute;top:350px;left:-40px;width:300px;height:300px;"&gt; &lt;img src="shinySkin.png" alt="Shiny Skin" style="position:absolute;top:350px;left:200px;width:300px;height:300px;"&gt; &lt;img src="bigBall.png" alt="a cannonball" style= "position:absolute;top:640px;left:-40px;width:300px;height:300px;"&gt; &lt;/div&gt; &lt;script&gt; function descriptiveTextImg(x) { x.style.width = 400px; x.style.height = 400px; } function normalImg(x) { x.style.width = 300px; x.style.height = 300px; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
<javascript><html>
2016-10-14 12:03:52
LQ_CLOSE
40,043,128
sql queury for below condition
Employee_id Status 111 Approved 111 Approved 111 Pending 222 Approved 222 Approved in my table which is like above only 222 should get as approved give solution
<mysql><sql><select>
2016-10-14 12:26:16
LQ_EDIT
40,045,017
Detecting irregularities or the so called outliners
<p>Hello dear boys and girls, I apologize if the question is not in the right place (talking about the right forum - stackoverflow, etc.)</p> <p>I can use python and R on a semi-intermediate level... I have been wondering for a while about the topic of this question:</p> <ol> <li>If i have a data set that i can build a statistical model on then all is well. I build the model, test it, test it again, make a score card and poof.</li> <li>I want to know... Is there a way of (theoretically or even practically) to detect irregularities/outliners in data without a previous data set that (for example) you can build a statistical model on. I mean a way that excludes checking 400 million records and flagging the irregs as such and then doing something productive.</li> </ol> <p>Is this possible? Identifying such things without a preset solid definition for the given data set? Lets take accounting records for example. I have "x" amount of records and i want to detect any records that are not "natural" for the data set. is there a way to code a system that does that - given that you don't have prior data with such records flagged as not normal?</p>
<python><r><statistics>
2016-10-14 13:57:30
LQ_CLOSE
40,045,442
merge data frame based on column names in r
I have 4 data frames all with the same number of columns and identical column names. The order of the columns is different. I want to combine all 4 data frames together and match them with the column name.
<r>
2016-10-14 14:18:02
LQ_EDIT
40,045,534
Calculating 1/2 on Python
<p>That's just basic math, 1/2 = 0.5, but it seems on Python the result is 0?</p> <p>I thought that the result is in int format, but I've also tried float(1/2) and the result is still the same. Does anyone know why is this happening? </p> <p>(Sorry for the bad English, not my native language. Also, I just got learning Python:D)</p>
<python><python-2.7><math>
2016-10-14 14:23:01
LQ_CLOSE