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
34,785,653
PyODBC : can't open the driver even if it exists
<p>I'm new to the linux world and I want to query a Microsoft SQL Server from Python. I used it on Windows and it was perfectly fine but in Linux it's quite painful.</p> <p>After some hours, I finally succeed to install the Microsoft ODBC driver on Linux Mint with unixODBC.</p> <p>Then, I set up an anaconda with python 3 environment. </p> <p>I then do this :</p> <pre><code>import pyodbc as odbc sql_PIM = odbc.connect("Driver={ODBC Driver 13 for SQL Server};Server=XXX;Database=YYY;Trusted_Connection=Yes") </code></pre> <p>It returns :</p> <pre><code>('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0' : file not found (0) (SQLDriverConnect)") </code></pre> <p>The thing I do not undertsand is that PyODBC seems to read the right filepath from odbcinst.ini and still does not work.</p> <p>I went to "/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.0.so.0.0" and the file actually exists !</p> <p>So why does it tell me that it does not exist ? Here are some possible clues :</p> <ul> <li>I'm on a virtual environment</li> <li>I need to have "read" rights because it's a root filepath</li> </ul> <p>I do not know how to solve either of these problems.</p> <p>Thanks !</p>
<python><sql-server><linux><pyodbc><unixodbc>
2016-01-14 09:18:36
HQ
34,785,684
unable to start activity, android.content.res.Resources$NotFoundException: String resource ID #0x0
<p>I'm developing an android game, and I'm stuck with this problem.<br /> This is the secondary activity, when I click the button that takes me to the second activity, it shows some errors, I'm trying to figure this out on my on by searching and experimenting by my self, but it didn't work<br /> This is my activity :</p> <pre><code>package game.esolindo.com.gametest; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MoneyActivity extends ActionBarActivity { private TextView txtMoney; private Button btnWork; private Button btnBuyClothes; int workMoney = 15; int buyClothesMoney = 20; int currentMoney; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_money); txtMoney = (TextView)findViewById(R.id.txtMoney); btnWork = (Button)findViewById(R.id.btnWork); btnWork.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentMoney = currentMoney + workMoney; txtMoney.setText(String.valueOf(currentMoney)); } }); btnBuyClothes = (Button)findViewById(R.id.btnBuyClothes); btnBuyClothes.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentMoney = currentMoney - buyClothesMoney; txtMoney.setText(String.valueOf(currentMoney)); } }); txtMoney.setText(currentMoney); } } </code></pre> <p>This is my xml file :</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context="game.esolindo.com.gametest.MoneyActivity"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="Money" android:id="@+id/txtMoneyText" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="10dp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceLarge" android:text="0" android:textSize="50sp" android:id="@+id/txtMoney" android:layout_below="@+id/txtMoneyText" android:layout_centerHorizontal="true" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Work" android:id="@+id/btnWork" android:layout_marginTop="20dp" android:layout_below="@+id/txtMoney" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Buy Clothes" android:id="@+id/btnBuyClothes" android:layout_below="@+id/btnWork" android:layout_alignParentRight="true" android:layout_alignParentEnd="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /&gt; </code></pre> <p></p> <p>And this is the error message I received :</p> <pre><code>01-14 04:00:15.927 22640-22640/game.esolindo.com.gametest E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: game.esolindo.com.gametest, PID: 22640 java.lang.RuntimeException: Unable to start activity ComponentInfo{game.esolindo.com.gametest/game.esolindo.com.gametest.MoneyActivity}: android.content.res.Resources$NotFoundException: String resource ID #0x0 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2184) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233) at android.app.ActivityThread.access$800(ActivityThread.java:135) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5001) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: android.content.res.Resources$NotFoundException: String resource ID #0x0 at android.content.res.Resources.getText(Resources.java:244) at android.widget.TextView.setText(TextView.java:3888) at game.esolindo.com.gametest.MoneyActivity.onCreate(MoneyActivity.java:46) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)             at android.app.ActivityThread.access$800(ActivityThread.java:135)             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)             at android.os.Handler.dispatchMessage(Handler.java:102)             at android.os.Looper.loop(Looper.java:136)             at android.app.ActivityThread.main(ActivityThread.java:5001)             at java.lang.reflect.Method.invokeNative(Native Method)             at java.lang.reflect.Method.invoke(Method.java:515)             at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)             at dalvik.system.NativeStart.main(Native Method) </code></pre> <p>Please help me fix this<br /> Thanks in advance</p>
<java><android><android-studio>
2016-01-14 09:20:09
LQ_CLOSE
34,785,690
execute hello world with flask "ImportError: No module named flask"
<p>I'm trying to use flask and python. I did a simple file named <code>hello.py</code>. tHis file contains this code:</p> <pre><code>from flask import Flask app = Flask(__name__) @app.route("/") def main(): return "Welcome!" if __name__ == "__main__": app.run() </code></pre> <p>This is a simple hello world with flask. I want to execute it but actually, I have a problem. In the terminal, I typed <code>python hello.py</code> and I get this error:</p> <pre><code>File "hello.py", line 1, in &lt;module&gt; from flask import Flask ImportError: No module named flask </code></pre> <p>Even that I installed flask globally. I understand that this is a basic question, but I'm stuck?</p>
<python><flask>
2016-01-14 09:20:28
HQ
34,785,789
how can i retreive a row(given as search) from postgresql and display the result in html page?
my problem is that i have to search a term(take as id).if i give some number to search it should search the id in the table(take as result) of pgadmin3(postgresql).and display the result table of particular row what i have searched in the html page.my conditions are i can use only html5 ,ccs3, angularjs and with out using jsp and servelets how can i actually retreive data from postgres and display that in html page??please send me some link or something like step by step code to do that.
<javascript><html><angularjs><postgresql>
2016-01-14 09:25:21
LQ_EDIT
34,786,440
Row to column for frequency in R
<p>I have a data frame which looks like this</p> <pre><code>&gt; initial Name Status 1 a Win 2 b Win 3 c Loss </code></pre> <p>From here I want a data frame which looks like this</p> <pre><code>&gt; final Name Win Loss 1 a 1 0 2 b 1 0 3 c 0 1 </code></pre> <p>How can I achieve this</p>
<r>
2016-01-14 09:55:59
LQ_CLOSE
34,786,855
count html table rows using PHP
I need to display the num of the row (tr) using php, but i don't know how to do because i using quotes ... Thanks for yours answers aaaaaaaaaaaaaaaaaaaaa $data['formation'] = ' <div class="table-responsive"> <table class="table table-bordered" style="width: auto !important;"> <thead style="font-weight: bold;"> <tr> <td>N</td> <td>Intitulé</td> <td>Organisme</td> <td>Date</td> <td>Durée (en heures)</td> <td>Eval. à chaud / à froid</td> <td>Dispositif utilisé</td> </tr> </thead> <tbody class="table-striped"> <tr> <td> **HERE NUM OF THE ROW** </td> <td> <input type="text" class="form-control" name="form_intitule" id="form_intitule" readonly> </td> <td> <input type="text" class="form-control" name="form_organisme" id="form_organisme" readonly> </td> <td> <input type="text" class="form-control" name="form_date" id="form_date" readonly> </td> <td> <input type="text" class="form-control" name="form_duree" id="form_duree" readonly> </td> <td></td> <td></td> </tr> </tbody> </table> </div>'; }
<php>
2016-01-14 10:13:25
LQ_EDIT
34,787,378
PHP error " Undefined variable: mysql_fetch_assoc"
<p>I'm recieving the above error when I try to run this code, I have tried multiple solutions, using fetch_array too: <pre><code>$conn = mysql_connect('localhost', '-----', '-----','-----') or die('Error connecting to mysql'); $sql = "SELECT * FROM Subject"; $result = mysql_query($sql); $row=null; echo "&lt;table&gt;"; while( $row = $mysql_fetch_assoc[$result]){ echo "&lt;tr&gt;&lt;td&gt;"; echo $data['SubjectNo']; echo "&lt;/td&gt;&lt;td&gt;"; echo $data['SubjectName']; echo"&lt;/td&gt;&lt;/tr&gt;"; } echo "&lt;/table"; echo"urnan"; ?&gt; </code></pre>
<php><html><mysql><database>
2016-01-14 10:37:33
LQ_CLOSE
34,787,457
This classic asp page is throwing "internal server 500 error". Please help me on this
**Connection file-** <% Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "abc","ID","Password" conn.commandtimeout=120`enter code here` Set RS = Server.CreateObject("ADODB.RecordSet") rs.activeConnection = Conn %> **Classic ASP file** <%response.buffer = true%> <%Response.Expires = 0%> <!-- #include file="functions.asp" --> <% Response.Write session("RequestID")%> <%if session("ValidLogon") <> "true" then if request("FromEmail") = "True" then SetSessVar() else%> <%response.redirect "Default.asp" end if end if%> <html> <body> <%rs.Source = "SELECT * from tblRequests WHERE RequestID = " & request("requestID") rs.Open session("RequestID") = rs("requestid") if rs("RequestType") = "O" then response.clear If request("Tag") = "Change" then response.redirect "abc.asp#change" else response.redirect "abc.asp?From=" & request("From") end if else response.clear If request("Tag") = "Change" then response.redirect "editinternal.asp#change" else response.redirect "editinternal.asp?From=" & request("From") end if end if rs.close%> </body> </html> ---------- I have checked the classic asp page and it looks like there is error in syntax inside "Body" tag. As I dont know anything about it. Please help me on this classic asp page. Quick help will be appreciated. I am stuck on this page as it is giving internal server error 500.
<vbscript><asp-classic>
2016-01-14 10:40:35
LQ_EDIT
34,788,914
How can i convert to json
I am using the below function, i need to use json object instead of javascript. How i can achieve it? function ChangeIDToString(strCondition,id) { if (strCondition.indexOf("AssignedTo") > -1) return GetUserName(id) else if (strCondition.indexOf("ClaimStatusId") > -1) return GetClaimStatus(id) else if (strCondition.indexOf("ClaimTypeId") > -1) return GetClaimType(id); else return id; }
<javascript>
2016-01-14 11:50:21
LQ_EDIT
34,789,337
python pandas\numpy encode unique by integers
<p>Say I have <code>x=["apple","orange","orange","apple","pear"]</code> I would like to have a categorical representation with integers e.g. <code>y=[1,2,2,1,3]</code>. What would be the best way to do so?</p>
<python><pandas><integer><unique><categorical-data>
2016-01-14 12:12:55
LQ_CLOSE
34,790,455
PHP WITH MS SQL SERVER DOWNLOADING AND CONNECTING
I have a project written in php.Also,another application is written in C(sharp) with Ms Sql as the database engine. I want to fetch some data from the Ms Sql database and use it in php. I have tried many solution provided on stackover and other site, but none seems to work.Below are what I have done, maybe there is a place where i am missing something: 1. I Downloaded drivers(Ms Drivers for php) and loads it into the C:\wamp\bin\php\php5.5.12\ext directories.files are php_pdo_sqlsrv_55_nts.dll php_pdo_sqlsrv_55_ts.dll php_sqlsrv_55_nts.dll php_sqlsrv_55_ts.dll 2. Modify the php.ini by including the following in the extension area: extension=php_pdo_sqlsrv_55_nts.dll extension=php_pdo_sqlsrv_55_ts.dll extension=php_sqlsrv_55_nts.dll extension=php_sqlsrv_55_ts.dll Infact, one of the site says I should rename by removing the "_55_xx", so that it looks like php_sqlsrv.dll.yet it is still not working. 3. Restart the Apache server and discovered that the included files not activated or seen when you click on the wamp monitor,navigate to the php and view the extension directory. I have search and search,seems to be given up, but thought it better to communicate with others who can be of assistance. I currently use wamp and php version is php5.5.12. Please, I need a solution on how to get working drivers to connect my php with Ms Sql server and get data from the server seamlessly.
<php><sql-server>
2016-01-14 13:07:05
LQ_EDIT
34,790,802
Can you use AND in an IF - to check two conditions - python
<p>I am trying to search by two criteria matches or word starts in an input:</p> <pre><code>sentence=input("What is wrong with your device?\n") # variable arrays screenissues=["scre","displ","moni","blan"] wifiissues=["wif","connect","signal","3g","4g"] waterdamage=["wet","damp","rain","water","soak"] phone=["phon","samsun","calls","mobi","mob"] for word in sentence.split(): #splits if (word.startswith(tuple(screenissues)) and word.startswith(tuple(phone))): #trys to serach for two criteria at once - or works... print( word) print("you have an issue with your PHONE screen, please call us") </code></pre>
<python>
2016-01-14 13:26:14
LQ_CLOSE
34,790,925
How do I use Cognito with the generated Javascript SDK?
<p>I couldn't find any documentation that showed how to do this so I tried my best to figure it out (is this not a common use case)? I've set up my resource to use IAM authentication, set up CORS, etc. Then I deployed it, and downloaded the generated the SDK.</p> <p>On the client-side I'm using the credentials from AWS.CognitoIdentityCredentials with apigClientFactory.newClient. When I try to post to my resource, I get a 403 error response with no body. </p> <p>The response headers contain: <code>x-amz-ErrorType: UnrecognizedClientException</code></p> <p>Could this error possibly be coming from some other AWS service (do they bubble up like that)? If so, how can I tell which one? What else might be causing the error?</p> <p>The code I'm using test test client-side looks like this:</p> <pre><code>function onFacebookLogin(fbtoken) { // get cognito credentials AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'us-east-1:abcd6789-1234-567a-b123-12ab34cd56ef', Logins: {'graph.facebook.com': fbtoken} }); AWS.config.credentials.get(function(err) { if (err) {return console.error('Credentials error: ', err);} /* I'm assuming that this is what I use for accessKey and secretKey */ var credentials = AWS.config.credentials; apigClient = apigClientFactory.newClient({ accessKey: credentials.accessKeyId, secretKey: credentials.secretAccessKey }); }); } </code></pre>
<javascript><amazon-web-services><amazon-cognito><aws-api-gateway><aws-lambda>
2016-01-14 13:31:00
HQ
34,791,076
PHP PDO bindValue does not update the DB
<p>Could someone tell me what I am doing wrong.</p> <p>If I use the code below, I am able to update the DB.</p> <pre><code> $sUpdateSql = "UPDATE googleAnalytics SET $period = '$value' WHERE statisticName = '$item' "; $preparedStatement = $db-&gt;query($sUpdateSql); </code></pre> <p>However, with the statement below the DB does not update.</p> <pre><code> $sUpdateSql = "UPDATE googleAnalytics SET $period = '?' WHERE statisticName = '?' "; $preparedStatement = $db-&gt;prepare($sUpdateSql); /* bind parameters for markers */ $preparedStatement-&gt;bindValue(1, $value); $preparedStatement-&gt;bindValue(2, $item); $preparedStatement-&gt;execute(); </code></pre>
<php><pdo>
2016-01-14 13:37:54
LQ_CLOSE
34,791,138
Find pattern in files with java 8
<p>consider I have a file like (just an excerpt)</p> <pre><code>name: 'foobar' </code></pre> <p>I like to retrieve <code>foobar</code> when I discover the line with <code>name</code>.</p> <p>My current approach is</p> <pre><code>Pattern m = Pattern.compile("name: '(.+)'"); try (Stream&lt;String&gt; lines = Files.lines(ruleFile)) { Optional&lt;String&gt; message = lines.filter(m.asPredicate()).findFirst(); if (message.isPresent()) { Matcher matcher = m.matcher(message.get()); matcher.find(); String group = matcher.group(1); System.out.println(group); } } </code></pre> <p>which looks not nice. The excessive use of the pattern and matcher seems wrong.</p> <p>Is there a easier/better way ? Especially if I have multiple keys I like to search like this ?</p>
<java><regex><java-8>
2016-01-14 13:40:37
HQ
34,791,383
Control if inside an array there is a value
I started few times ago coding JavaScript and now I want to check if an Array contains a value. I tried to use var accountList = [3,4]; function isInArray(value, array){ return array.indexOf(value); } if(isInArray(4, accountList) > -1){ document.getElementById("pp").innerHTML = "found"; }` but it doesn't work. I'll want to use this for check if an input is inside and Array, I use the "3,4" value just for try this method. Someone can help me? :) P.s: I'm sorry for any error but I'm not english!
<javascript>
2016-01-14 13:54:20
LQ_EDIT
34,791,578
How to stop js from running ?
I have seen a video tutorial on Youtbe about [Dynamic Content][1] that when user reaches the bottom of a page ,it automatically loads new div. (Something like facebook homepage). But it just keeps loading & never stop that! I don't know how to stop that. Here's the full code: <!DOCTYPE html> <html> <head> <script> function yHandler(){ // Watch video for line by line explanation of the code // http://www.youtube.com/watch?v=eziREnZPml4 var wrap = document.getElementById('wrap'); var contentHeight = wrap.offsetHeight; var yOffset = window.pageYOffset; var y = yOffset + window.innerHeight; if(y >= contentHeight){ // Ajax call to get more dynamic data goes here wrap.innerHTML += '<div class="newData"></div>'; } var status = document.getElementById('status'); status.innerHTML = contentHeight+" | "+y; } window.onscroll = yHandler; </script> <style> div#status{position:fixed; font-size:24px;} div#wrap{width:800px; margin:0px auto;} div.newData{height:1000px; background:#09F; margin:10px 0px;} </style> </head> <body> <div id="status">0 | 0</div> <div id="wrap"><img src="temp9.jpg"></div> </body> </html> **To test it on your desktop ,plz make sure you have the image with the name of *temp9.jpg*** [1]: https://www.youtube.com/watch?v=eziREnZPml4&index=37&list=PLGlcsQuIFMgJBt-4GDm8ZZpR_nnKPW9g4
<javascript><jquery><html><ajax>
2016-01-14 14:05:15
LQ_EDIT
34,792,146
Export to csv/excel from kibana
<p>I am building a proof of concept using Elasticsearch Logstash and Kibana for one of my projects. I have the dashboard with the graphs working without any issue. One of the requirements for my project is the ability to download the file(csv/excel). In kibana the only option i saw for downloading the file is by clicking on edit button on the visualization created. Is it possible to add a link on the dashboard that would allow users to download the file without going into the edit mode. And secondly I would like to disable/hide the edit mode for anyone other than me who views the dashboard. Thanks</p>
<elasticsearch><logstash><export-to-csv><kibana-4>
2016-01-14 14:33:38
HQ
34,792,563
Login is currently incompatible with git bash/cygwin
<p>I just download this version Git-2.6.1-64-bit.exe my OS is windows 10 64bit.. why I cannot still log in it? is Git-2.6.1-64-bit.exe the latest one?</p> <p>before it was MINWG32 now updated become MINWG64 but still I cannot login..help me solve this issues</p> <p>I don't have any solution for this instead to use the cmd.exe.... but I need the flow of it...coz some of the commands cannot run in this environment...it's a big difference between a Linux-like environment... please post procedure/steps in deploying apps in heroku.</p> <p>IT SAYS : Login is currently incompatible with git bash/cygwin In the meantime, login via cmd.exe <a href="https://github.com/heroku/heroku-cli/issues/84" rel="noreferrer">https://github.com/heroku/heroku-cli/issues/84</a></p>
<git><bash><deployment>
2016-01-14 14:54:15
HQ
34,792,795
C# - What does passing by ref do?
I know what passing by ref is and what it means but what exactly does it do with the objects passed by ref? Does it guarantee the objects to stay at their current position in memory while the reference is being used? Does the behavior change between local objects and global objects? I'm mostly interested with what happens in memory. **A bit of background information:** I have written a simple test program that stores the memory address of objects passed by ref and noticed how C# likes to move objects around in memory. But what I think is odd was that the objects being used were locals of a function. This automatically makes me think that the object's reference can't move in memory because it is on the stack. But clearly I'm missing something. What kind of memory was I receiving when using the ref?
<c#>
2016-01-14 15:05:03
LQ_EDIT
34,793,452
What are these seemingly-useless callq instructions in my x86 object files for?
<p>I have some template-heavy C++ code that I want to ensure the compiler optimizes as much as possible due to the large amount of information it has at compile time. To evaluate its performance, I decided to take a look at the disassembly of the object file that it generates. Below is a snippet of what I got from <code>objdump -dC</code>:</p> <pre><code>0000000000000000 &lt;bar&lt;foo, 0u&gt;::get(bool)&gt;: 0: 41 57 push %r15 2: 49 89 f7 mov %rsi,%r15 5: 41 56 push %r14 7: 41 55 push %r13 9: 41 54 push %r12 b: 55 push %rbp c: 53 push %rbx d: 48 81 ec 68 02 00 00 sub $0x268,%rsp 14: 48 89 7c 24 10 mov %rdi,0x10(%rsp) 19: 48 89 f7 mov %rsi,%rdi 1c: 89 54 24 1c mov %edx,0x1c(%rsp) 20: e8 00 00 00 00 callq 25 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x25&gt; 25: 84 c0 test %al,%al 27: 0f 85 eb 00 00 00 jne 118 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x118&gt; 2d: 48 c7 44 24 08 00 00 movq $0x0,0x8(%rsp) 34: 00 00 36: 4c 89 ff mov %r15,%rdi 39: 4d 8d b7 30 01 00 00 lea 0x130(%r15),%r14 40: e8 00 00 00 00 callq 45 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x45&gt; 45: 84 c0 test %al,%al 47: 88 44 24 1b mov %al,0x1b(%rsp) 4b: 0f 85 ef 00 00 00 jne 140 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x140&gt; 51: 80 7c 24 1c 00 cmpb $0x0,0x1c(%rsp) 56: 0f 85 24 03 00 00 jne 380 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x380&gt; 5c: 48 8b 44 24 10 mov 0x10(%rsp),%rax 61: c6 00 00 movb $0x0,(%rax) 64: 80 7c 24 1b 00 cmpb $0x0,0x1b(%rsp) 69: 75 25 jne 90 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x90&gt; 6b: 48 8b 74 24 10 mov 0x10(%rsp),%rsi 70: 4c 89 ff mov %r15,%rdi 73: e8 00 00 00 00 callq 78 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x78&gt; 78: 48 8b 44 24 10 mov 0x10(%rsp),%rax 7d: 48 81 c4 68 02 00 00 add $0x268,%rsp 84: 5b pop %rbx 85: 5d pop %rbp 86: 41 5c pop %r12 88: 41 5d pop %r13 8a: 41 5e pop %r14 8c: 41 5f pop %r15 8e: c3 retq 8f: 90 nop 90: 4c 89 f7 mov %r14,%rdi 93: e8 00 00 00 00 callq 98 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x98&gt; 98: 83 f8 04 cmp $0x4,%eax 9b: 74 f3 je 90 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x90&gt; 9d: 85 c0 test %eax,%eax 9f: 0f 85 e4 08 00 00 jne 989 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x989&gt; a5: 49 83 87 b0 01 00 00 addq $0x1,0x1b0(%r15) ac: 01 ad: 49 8d 9f 58 01 00 00 lea 0x158(%r15),%rbx b4: 48 89 df mov %rbx,%rdi b7: e8 00 00 00 00 callq bc &lt;bar&lt;foo, 0u&gt;::get(bool)+0xbc&gt; bc: 49 8d bf 80 01 00 00 lea 0x180(%r15),%rdi c3: e8 00 00 00 00 callq c8 &lt;bar&lt;foo, 0u&gt;::get(bool)+0xc8&gt; c8: 48 89 df mov %rbx,%rdi cb: e8 00 00 00 00 callq d0 &lt;bar&lt;foo, 0u&gt;::get(bool)+0xd0&gt; d0: 4c 89 f7 mov %r14,%rdi d3: e8 00 00 00 00 callq d8 &lt;bar&lt;foo, 0u&gt;::get(bool)+0xd8&gt; d8: 83 f8 04 cmp $0x4,%eax </code></pre> <p>The disassembly of this particular function continues on, but one thing I noticed is the relatively large number of <code>call</code> instructions like this one:</p> <pre><code>20: e8 00 00 00 00 callq 25 &lt;bar&lt;foo, 0u&gt;::get(bool)+0x25&gt; </code></pre> <p>These instructions, always with the opcode <code>e8 00 00 00 00</code>, occur frequently throughout the generated code, and from what I can tell, are nothing more than no-ops; they all seem to just fall through to the next instruction. This begs the question, then, is there a good reason why all these instructions are generated? </p> <p>I'm concerned about the instruction cache footprint of the generated code, so wasting 5 bytes many times throughout a function seems counterproductive. It seems a bit heavyweight for a <code>nop</code>, unless the compiler is trying to preserve some kind of memory alignment or something. I wouldn't be surprised if this were the case.</p> <p>I compiled my code using g++ 4.8.5 using <code>-O3 -fomit-frame-pointer</code>. For what it's worth, I saw similar code generation using clang 3.7.</p>
<c++><assembly><x86><compiler-optimization>
2016-01-14 15:33:41
HQ
34,794,067
How to set a cell to NaN in a pandas dataframe
<p>I'd like to replace bad values in a column of a dataframe by NaN's.</p> <pre><code>mydata = {'x' : [10, 50, 18, 32, 47, 20], 'y' : ['12', '11', 'N/A', '13', '15', 'N/A']} df = pd.DataFrame(mydata) df[df.y == 'N/A']['y'] = np.nan </code></pre> <p>Though, the last line fails and throws a warning because it's working on a copy of df. So, what's the correct way to handle this? I've seen many solutions with iloc or ix but here, I need to use a boolean condition.</p>
<python><pandas><nan>
2016-01-14 16:00:09
HQ
34,794,992
def amount_of_Chests () :
def amount_of_Chests () : chestCount = 0 amount_of_Chests_Display () while chestCount <4 : chestCount_string = input("Please Make Sure You Enter Enough Chests\nPlease Enter How Many Chests You Would Like (Min.4)") chestCount = int(chestCount_string) if chestCount < 4 : print ("\nThere Are Not Enough Chests, Please Try Again.") amount_of_Chests_Display () if chestCount > 3 : return chestCount amount_of_Bandits () else : print ("Sorry that input is not valid. Please try Again.\n") whenever I try this it does not work(input = 6), it sends me to the previous menu and says the input is invalid. [Coding on python that does not work][1] [1]: http://i.stack.imgur.com/aHVOi.png
<python><integer>
2016-01-14 16:42:15
LQ_EDIT
34,795,100
Multiply int in array list OCAML
Hi I'm trying to solve this problem in OCAML: I have two arrays of variable size like [1;4;5] [3;2;3] that rappresent TWO integer: 145 and 323. I would to multiply this two number (145*323). The result (46835) I want to rappresent how [4;6;8;3;5]. Can you help me please?
<arrays><ocaml>
2016-01-14 16:46:58
LQ_EDIT
34,795,577
What logic determines the insert order of Entity Framework 6
<p>So, I have a DBContext, and I am doing the following operations:</p> <pre><code>dbContext.SomeTables1.Add(object1) dbContext.SomeTables2.AddRange(objectArray2) dbContext.SomeTables3.AddRange(objectArray3) dbContext.SaveChanges(); </code></pre> <p>The EF doesn't insert the db records in this order, it inserts them in a random order. To insert them in the same order, I have to do a <code>dbContext.SaveChanges()</code> after each addition. This is not an efficient solution and in my case, it is taking 10 seconds to do all my inserts, while the random order with one save takes around 3 seconds.</p> <p>N.B. I need the right order to solve a deadlock issue.</p> <p>My questions are:</p> <blockquote> <ul> <li>Is this issue resolved in EF7?</li> <li>I can profile EF and determine the random order, however, is there a guarantee that it will be consistently with the same random order or does it change between requests? (I can adopt my other code if the answer to this question is positive).</li> <li>Is there a better way of maintaining the order than <code>dbContext.SaveChanges()</code> on every addition?</li> </ul> </blockquote>
<c#><entity-framework><entity-framework-6><entity-framework-core>
2016-01-14 17:09:50
HQ
34,795,818
Getting a HttpStatusCode of 0
<p>Why am I getting a HttpStatusCode of 0 if I point the service my client is connecting to to a bad URL.</p> <p>My statusCodeAsInt is showing up as a 0. Why is it not showing up as a 404 and being handled?</p> <pre><code>IRestResponse response = client.Execute(restReq); HttpStatusCode statusCode = response.StatusCode; var statusCodeAsInt = (int) statusCode; if (statusCodeAsInt &gt;= 500) { throw new InvalidOperationException("A server error occurred: " + response.ErrorMessage, response.ErrorException); } if (statusCodeAsInt &gt;= 400) { throw new InvalidOperationException("Request could not be understood by the server: " + response.ErrorMessage, response.ErrorException); } </code></pre> <p>What is the proper way to handle this RestResponse?</p>
<c#><rest><http><http-status-code-404><http-status-codes>
2016-01-14 17:22:36
HQ
34,796,577
make validate useranme without Regex, must be alphanumeric
function isUser(username) { var numaric = username; for(var j=0; j<numaric.length; j++) { var alphaa = numaric.charAt(j); var hh = alphaa.charCodeAt(0); if((hh > 96 && hh<123) || (hh > 64 && hh<91) ==false){ //A-Z - a-z }else if((hh > 47 && hh<58) ==false){ //0-9 }else if( true == (hh > 96 && hh<123) || (hh > 64 && hh<91) || (hh > 47 && hh<58)){ //A~Z - a~z - 1~9 }else{ alert("Your Alpha Numeric Test Falid"); return false; } alert("Your Alpha Numeric Test passed"); return true; } }
<javascript><html><validation><ascii>
2016-01-14 18:00:54
LQ_EDIT
34,798,015
How would I write the package.json version to my WebPack bundle?
<p>My package.json file includes a version for my module, which ultimately get's compiled into an app.bundle.js file that I include in my web project. I would REALLY like to have the version number from the package.json file written to the app.bundle.js file as a comment right at the beginning of the file.</p> <p>Is there a WebPack plugin to do this or a setting with WebPack itself?</p>
<node.js><webpack>
2016-01-14 19:27:11
HQ
34,798,148
The newline characters '/n' is getting printed instead of splitting to a newline
<p>To clarify, I understand I could use:</p> <pre><code>Console.WriteLine("sample text") </code></pre> <p>to get the desired effect, nevertheless, the code I'm using should work, and I want to know why it isn't.</p> <p>The code sample:</p> <pre><code>Console.Write("You have chosen {0}, the game will now begin.{1} Newline.", x_or_o, "/n"); </code></pre> <p>And the output I am receiving in the console is:</p> <pre><code>You have chosen x, the game will now begin./n Newline. </code></pre> <p>Whereas my desired output is:</p> <pre><code>You have chosen x, the game will now begin. Newline. </code></pre> <p>Sorry if I'm missing something fundamental or obvious, but my SO and google searches have resulted in no solutions.</p> <p>All answers are appreciated in advance, thank you for your time.</p>
<c#><console-application>
2016-01-14 19:34:27
LQ_CLOSE
34,798,553
Converting randomly generated list of numbers into integers
<pre><code>elif a == "other": numbers = [randrange(33, 126) for _ in range(8)] for n in numbers: print(n) print(chr(n)) sum(numbers) numbercomp = numbers /8 -32 </code></pre> <p>I am trying to convert the list of numbers that are randomly generated into a integer so I can divide them by 8 and minus 32.</p>
<python><list><integer>
2016-01-14 19:56:56
LQ_CLOSE
34,798,690
working with data in java
I've been using a formula for some time to try to find value in spreads for sports betting and done this by basically creating my own spread and comparing to what bookies offer and would like to automate the process. I've written some code in java which will do the maths on the data i give it and i'm looking for a way to populate the input data either from a database or from an xml file i create but i'm quite new to programming. Say for example if i pick two teams to compare. for each team i need a list of the teams they played, how many points each team scored in total, how many points each team conceded in total and how many games each team played so i can run the maths on those figures and i have no idea where to start. could anyone help me or point me in the right direction? Thanks in advance
<java><analysis>
2016-01-14 20:04:39
LQ_EDIT
34,799,052
Mount Qnap NFS Share on Linux OS
<p>I am trying to mount a NFS share from my Qnap to my laptop which runs Manjaro (Arch Linux) but I keep getting access denied by the server and i can't figure out what the problem is!</p> <pre><code>$ sudo mount 10.0.2.6:/backup /mnt/nas/backup mount.nfs: access denied by server while mounting 10.0.2.6:/backup </code></pre> <p>Mount points :</p> <pre><code>$ showmount -e 10.0.2.6 Export list for 10.0.2.6: /backup /Web /Recordings /Public /Multimedia /Download /Containers </code></pre> <p><a href="https://i.stack.imgur.com/58p6t.png" rel="noreferrer"><img src="https://i.stack.imgur.com/58p6t.png" alt="Qnap folder permissions"></a></p>
<linux><nfs><qnap>
2016-01-14 20:25:20
HQ
34,799,326
New to VBS. Expecting end of statement on 60'th character.
When I put the END at the 60'th character. It says it needs an 'expected statement' Here's the code. Set colComputers2 = objWMIService.Get("Win32_ScheduledJob") end T = "C:\AntiVirusNet.vbs"D = "********" & Hou & "" & Min & "00.000000+000" Help???
<vbscript>
2016-01-14 20:41:53
LQ_EDIT
34,800,168
Xamarin Forms Android App Crashes Running Debug with VS Android Emulator
<p>I have a basic Xamarin Forms app I created. It works fine against the iOS simulator.</p> <p>However when I try and run with a VS Android Emulator (5.1in Marshmallow) it crashes every time upon opening. Even when I try and run without debugging. Below is the error I keep seeing:</p> <pre><code>01-14 16:22:10.290 D/Mono ( 1366): AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/App3.Droid-2/libaot-mscorlib.dll.so" not found 01-14 16:22:10.290 D/Mono ( 1366): AOT module '/Users/builder/data/lanes/2512/d3008455/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/App3.Droid-2/libaot-mscorlib.dll.so" not found 01-14 16:22:10.294 D/Mono ( 1366): Unloading image data-0x9659b010 [0xb93d5940]. </code></pre> <p>I am running VS2015 + Xamarin Forms 2.0 latest and greatest.</p> <p>What's going on here?</p>
<android><xamarin><xamarin-forms><visual-studio-emulator>
2016-01-14 21:33:55
HQ
34,800,765
How to assign a variable in a Swift case statement
<p>This works but seems inefficient:</p> <pre><code>switch var1 { case 1: string1 = "hello" case 2: string1 = "there" default: string1 = "world" } </code></pre> <p>but</p> <pre><code>string1 = switch var1 { ... </code></pre> <p>throws an error. Is there a more efficient way to write the switch/case so that the assigned variable isn't listed redundantly in each line?</p> <p>Thanks in advance!</p>
<swift>
2016-01-14 22:11:38
HQ
34,801,083
Program to repeatedly get the contents of a webpage
<p>I wish to get the contents of a web page that requires me to be logged in (and one that I do not have control over: e.g. Twitter or Facebook), for example I can have Chrome running and I can see Ajax updating the page updating, but I want to periodically get the contents of this page and somehow save it. I don't mind leaving a computer running to achieve this...</p>
<javascript><ajax>
2016-01-14 22:34:58
LQ_CLOSE
34,801,342
tensorflow: how to rotate an image for data augmentation?
<p>In tensorflow, I would like to rotate an image from a random angle, for data augmentation. But I don't find this transformation in the tf.image module. </p>
<python><tensorflow>
2016-01-14 22:56:24
HQ
34,801,691
Clion memory view
<p>I can't find a memory view in Jetbrain's clion IDE. Does anybody know to show it (has clion this feature)?</p> <p>Meant is this: <a href="http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Freference%2Fcdt_u_memoryview.htm" rel="noreferrer">memory view</a> in eclipse </p>
<c++><memory><clion>
2016-01-14 23:24:17
HQ
34,802,465
Sklearn: Is there any way to debug Pipelines?
<p>I have created some pipelines for classification task and I want to check out what information is being present/stored at each stage (e.g. text_stats, ngram_tfidf). How could I do this.</p> <pre><code>pipeline = Pipeline([ ('features',FeatureUnion([ ('text_stats', Pipeline([ ('length',TextStats()), ('vect', DictVectorizer()) ])), ('ngram_tfidf',Pipeline([ ('count_vect', CountVectorizer(tokenizer=tokenize_bigram_stem,stop_words=stopwords)), ('tfidf', TfidfTransformer()) ])) ])), ('classifier',MultinomialNB(alpha=0.1)) ]) </code></pre>
<python><python-2.7><scikit-learn>
2016-01-15 00:40:50
HQ
34,802,882
Passing array to component property in React
<p>How can I pass an array to a component as a property. Neither of the following achieve what I am looking for. I want to pass the array of items through, manipulate them in the component and output in the render method. </p> <pre><code>&lt;List columns=['one', 'two', 'three', 'four'] /&gt; // unexpected token &lt;List columns="['one', 'two', 'three', 'four']" /&gt; // passed through as string not array </code></pre> <p>Is there a standard syntax or best practice for this kind of thing?</p>
<javascript><reactjs>
2016-01-15 01:25:39
HQ
34,803,311
template and derived class definition : error: 'myClass' is not a class, namespace, or enumeration
<p>I'm trying to learn templates in C++ and I have the following code :</p> <pre><code>#include &lt;stack&gt; template&lt;typename T&gt; class myClass : public std::stack&lt;T&gt;{ public: myClass(void); myClass(myClass const &amp; src); virtual ~myClass(void); myClass &amp; operator=(myClass const &amp; rhs); }; template&lt;typename T&gt; myClass::myClass(void) : std::stack&lt;T&gt;(){ } </code></pre> <p>But I can't figure out why I get the following when I try to compile :</p> <pre><code>test.cpp:17:1: error: 'myClass' is not a class, namespace, or enumeration myClass::myClass(void) : std::stack&lt;T&gt;(){ ^ test.cpp:8:9: note: 'myClass' declared here class myClass : public std::stack&lt;T&gt;{ ^ 1 error generated. </code></pre> <p>It looks like the definition of the function causes the error, but I don't know why I get this error, it looks OK to me (even if I guess it's not really OK), just a syntax error perhaps?..</p> <p>I compile with <strong>clang++ -Wall -Werror -Wextra -c</strong>.</p> <p>What could cause this error?</p>
<c++><templates><derived-class>
2016-01-15 02:14:17
HQ
34,803,466
How to list the content of a named volume in docker 1.9+?
<p>Docker 1.9 added named volumes, so I..</p> <pre><code>docker volume create --name postgres-data docker volume ls </code></pre> <p>and I get</p> <pre><code>local postgres-data </code></pre> <p>all good so far.. </p> <p>so how do I see what is in the named volume? Is there a way to cd to it on the host system. Like I can for a mounted host directory?</p>
<docker>
2016-01-15 02:33:39
HQ
34,803,567
What pylint options can be specified in inline comments?
<p>I note that I can disable particular messages using a comment. For example, pylint by default complains about variable names of less than three letters. I can suppress that like this:</p> <pre><code># pylint: disable=invalid-name def some_string_operation(s): # (the same thing here would also work) return something(s) </code></pre> <p>But I cannot, for example, add <code>s</code> to the good-names list. This doesn't work:</p> <pre><code># pylint: good-names=s def some_string_operation(s): return something(s) </code></pre> <p>So clearly not all options can be modified that way. Which ones can?</p>
<python><pylint>
2016-01-15 02:44:50
HQ
34,803,648
ConfigurationManager and AppSettings in universal (UWP) app
<p>I would like to store an API key in a configuration file without checking it into source control, and read the data in my UWP app.</p> <p>A common solution is to store the key in .config file (such as <code>app.config</code> or <code>web.config</code>) and access it like so:</p> <pre><code>var apiKey = ConfigurationManager.AppSettings.Get("apiKey"); </code></pre> <p>I'm working on a Universal Windows (UWP) app and can't access the System.Configuration namespace that holds <code>ConfigurationManager</code>.</p> <p>How can I access AppSettings in UWP app? Alternatively, what's the best way to access configuration data in an UWP app?</p>
<c#><uwp><portable-class-library>
2016-01-15 02:54:10
HQ
34,804,000
What is the best way to execute form submission?
<p>Please excuse any ignorant or ametuer perspective that I may seem to have. I am indeed an aspiring web developer :)</p> <p>The only thing that I need to achieve right now is having the user fill out a form with only two fields and have that information end up in my inbox.</p> <p>After much searching and different solutions/opinions from a WIDE variety of sources and dev types, I still cannot seem to find a step by step process of how to best implement this seemingly simple issue I'm having. </p> <p>Now, I'm willing to learn what I may need to, but I have no idea where to start. I've been told PHP, Django(Python), JavaScript and a whole slew of others.</p> <p>I can build the form with out an issue. It's getting that information to my email that I'm stuck on!</p> <p>Any and all feedback is much appreciated. Thank you!</p>
<javascript><php><forms><validation><submit>
2016-01-15 03:38:09
LQ_CLOSE
34,804,494
can any one clarify "S_NO" NUMBER(12,0) NOT NULL ENABLE PRIMARY KEY" what it means S_NO" NUMBER(12,0)
can any one clarify "S_NO" NUMBER(12,0) NOT NULL ENABLE PRIMARY KEY" what it means the datatype S_NO" NUMBER(12,0) Please clarify the each parameter
<sql><oracle><oracle11g>
2016-01-15 04:38:06
LQ_EDIT
34,804,803
Complete a string base on index of last character
<p>Example Word : String , the returned last index is 5 which is "g". I need to complete the word string base on the space before the word.</p> <p>For example</p> <p>obj string the last index is 5, which is g, "string" word should be completed.</p>
<c#><string>
2016-01-15 05:16:00
LQ_CLOSE
34,806,347
What is the comment syntax in Yesod (hamlet) templates?
<p>I just can not find how to comment line in hamlet template. Is there some syntax for comments? Like</p> <pre><code>-- &lt;p&gt;Some code should be ignored by template </code></pre> <p>or something?</p>
<templates><haskell><yesod><hamlet><shakespeare-text>
2016-01-15 07:42:01
HQ
34,807,187
java: Reading in multiple integers from the scanner and assigning each integer to a different variable?
I have to read in integers and the scanner has to continue to scan them in until 0 is entered. Then all of those numbers have to be saved to different variables. Then the variables have to be compared and the following has to occur: -Find the smallest integer -Find how many integers are even -Find the sum of the negative integers I have this so far: public static void main (String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter integers"); do { } while (in.nextInt() !=0); } I am lost on what to do next.
<java>
2016-01-15 08:43:42
LQ_EDIT
34,807,286
WebSocket SyntaxError: An invalid or illegal string was specified
<p>I'm getting a <code>SyntaxError: An invalid or illegal string was specified</code>, while trying to connect to a WebSocket on Firefox.</p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt;&lt;meta charset="utf-8"&gt;&lt;/head&gt; &lt;body&gt; &lt;script&gt; var socket = new WebSocket('127.0.0.1:1234'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Why do I get this error?</p>
<javascript><firefox><websocket>
2016-01-15 08:49:11
HQ
34,807,293
How to set teh selected option on a dropdown list on a jquery dialog?
i have a table od data, when i sent the a row of data to fields on a jquery dialog it fails to set the selected value of the `dropdown list` i have use this $('#ddlProducts').val(data.prodID); `data.prodID` has a value but it does not set it to the `value` of the `dropdown`. How do i fix this?
<jquery><asp.net-mvc-4>
2016-01-15 08:49:59
LQ_EDIT
34,807,532
iOS what is paperRect in core graphics topic
I was studying core graphics recently and always see some of the code assign paperRect in CGRect variable, so I search around in internet and I dunno what is paperRect doing? Counld any one explain to me. Thanks you.
<ios><core-graphics>
2016-01-15 09:03:16
LQ_EDIT
34,807,819
Using a argument as a property key
<p>Lets say I got this function:</p> <pre><code> vm.setSelectedItem = function(itemName, searchedItems){ vm.selectedItem = _.findWhere(searchedItems, {name: itemName}); }; </code></pre> <p>I need to make the "name" dynamic</p> <pre><code> vm.setSelectedItem = function(itemName, searchedItems, propertyKey){ vm.selectedItem = _.findWhere(searchedItems, {}); //How do I use the arg propertyKey here? }; </code></pre> <p>How do I do this?</p>
<javascript>
2016-01-15 09:20:08
LQ_CLOSE
34,807,971
Why does git diff-index HEAD result change for touched files after git diff or git status?
<p>If I <code>touch</code> a file tracked in a git repo, and run <code>git diff-index HEAD</code>, it will print output with <code>M</code> indicating the file has been modified. For example,</p> <pre><code>$ touch foo $ git diff-index HEAD :100644 100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0000000000000000000000000000000000000000 M foo </code></pre> <p>I am unsure if this makes sense or not, but that is not the question. The question is, why does the output change (to no diff) if I run <code>git diff HEAD</code> or <code>git status</code>?</p> <pre><code>$ touch foo $ git diff-index HEAD :100644 100644 257cc5642cb1a054f08cc83f2d943e56fd3ebe99 0000000000000000000000000000000000000000 M foo $ git diff # no output $ git diff-index HEAD # no output </code></pre> <p>I would expect the result, whatever it is, to stay the same across commands that are not supposed to change anything.</p>
<git>
2016-01-15 09:28:27
HQ
34,808,036
Hi, I wanted to know why the output of this code is nothing?
I wanted to know why the output of this code is nothing? is it something related to the use of SIZE in for expression? #include<stdio.h> int array[6] = {4, 5, 6, 10, -1, 0}; #define SIZE (sizeof(array)/sizeof(array[0])) int main() { int i; for (i= -1; i< SIZE; ++i) printf("%d", array[i+1]); return 0; }
<c><type-conversion>
2016-01-15 09:31:49
LQ_EDIT
34,808,133
Simple countdown hh:mm:ss in android studio
<p>How can I create a simple countdown in Android studio with a fixed start time? It should start the count down as soon as the application is opened. The preferable format is hh:mm:ss</p> <p>thanks</p>
<android><android-studio><countdown>
2016-01-15 09:37:25
LQ_CLOSE
34,808,493
Java- formatted input
<p>How can I accept input from STDIN in the format <strong>HH:MM:SSAM</strong> <strong>here in place of AM , PM can also be there</strong> and display output in the form <strong>HH:MM:SS</strong></p>
<java>
2016-01-15 09:58:54
LQ_CLOSE
34,808,801
How to play flv video on mobile web browsers?
<p>Is it possible to view .flv format video movies with standard android web browsers fromm my web page? I tried to watch using videojs, but get an error "no compatible source was found for this video". </p>
<javascript><html><video><video-streaming><html5-video>
2016-01-15 10:16:23
LQ_CLOSE
34,808,925
Express and WebSocket listening on the same port
<p>I have an app.js which is used to trigger two events when some POST data are received: </p> <ol> <li>Insert POST data into a database</li> <li>Send a message to a client using a WebSocket</li> </ol> <p>Here is the <strong>app.js</strong> (only the important lines)</p> <pre><code>var express = require('express'); var bodyParser = require('body-parser'); var server = require('./server'); var app = express(); var port = process.env.PORT || 3000; app.post('/server', server); app.listen(port, function(){ console.log('Slack bot listening'); }); </code></pre> <p>And here is the <strong>server.js</strong> (only the important lines)</p> <pre><code>var db = require('./DB'); var WebSocketServer = require('ws').Server; var insertData = function(req, res){ var wss = new WebSocketServer({server: server}); console.log('WebSocketServer created'); wss.on('connection', function(wss){ wss.send(JSON.stringify('Socket open')); }); wss.on('close', function(){ console.log('WebServerSocket has been closed'); }); }; module.exports = insertData; </code></pre> <p>What I would like to achieve is to set the WebSocketServer in a way that it listen to the same port of the app. I thought about passing the <em>server</em> var from <strong>app.js</strong> to <strong>server.js</strong> but </p> <ol> <li>I think this a not an elegant way to do it</li> <li>I don't know how to do it</li> </ol> <p>What do you guys think? </p>
<javascript><node.js><websocket>
2016-01-15 10:23:33
HQ
34,809,287
passing data from web form PHP application to Java web application
There is two WEB applications based on two different servers. How I can pass data from the web form, which consist 5-10 fields (php web application) to Java application(Struts2, Spring2) in the most elegant and safe way. please give me suggestions
<java><php><web-services>
2016-01-15 10:42:41
LQ_EDIT
34,809,845
Check Ansible version from inside of a playbook
<p>I have a playbook that is running in different way in Ansible 1.9.x and 2.0. I would like to check currently running ansible version in my playbook to avoid someone running it with old one. </p> <p>I don't think that this is the best solution: </p> <pre><code>- local_action: command ansible --version register: version </code></pre> <p>What would you suggest?</p>
<ansible><ansible-playbook>
2016-01-15 11:16:14
HQ
34,809,935
Change column names of data.frame based on column number and text
<p>In the data.frame <code>run</code></p> <pre><code>run &lt;- data.frame(1:4,2:5,3:6) X1.4 X2.5 X3.6 1 1 2 3 2 2 3 4 3 3 4 5 4 4 5 6 </code></pre> <p>I want to change the column names to</p> <pre><code>&gt; colnames(run) &lt;- c("runner1", "runner2", "runner3") </code></pre> <p>Is there a way to do this in R code (imagine I have hundreds of columns) by combining a similar text <code>runner</code> with a serial number <code>1, 2, 3...</code></p> <p>I started with <code>c(rbind(rep(c("runner"), each=3), c(1:3)))</code> which does not work and is probably way too complicated.</p> <p>I suppose there is a easy solution?</p>
<r><dataframe>
2016-01-15 11:21:58
LQ_CLOSE
34,809,965
display hidden form when specific number of integers/characters are entered into a text field
<p>I am trying to create a function where when a specific number of integers (eg. a phone number) are entered into a text field, a hidden form is displayed and both initial text field and form re-positioned. </p> <p>Any examples available on how this can be accomplished?</p> <p>Thanks</p>
<javascript><jquery><html>
2016-01-15 11:23:49
LQ_CLOSE
34,810,451
WHy If condition block is getting executed ?
I have this conditions if (txtBoxFatherHusbandName.Text != "" || txtBoxName.Text != "" || txtBoxNICNo.Text != "") { ShowMsgBox("Please first <b>Save/Update</b> the data being entered in mandatory fields"); txtBoxFatherHusbandName.Focus(); return; } all three textboxes are empty with no text in it but still the conditions is getting executed. why ?
<c#><asp.net><webforms>
2016-01-15 11:50:21
LQ_EDIT
34,810,560
Version ranges in gradle
<p>What are the possible ways of specifying version ranges in gradle dependencies? I saw some 1.+ notation but I have not found a document which really says what is possible and what is not. Furthermore, I do not know whether the Maven ranges can be used as well.</p> <p>Can somebody give me a short overview so that I can understand the rules?</p>
<gradle><dependencies><repository>
2016-01-15 11:56:13
HQ
34,810,604
singly linked list counting algorithm
I need to write a metod that goes over a sorted singly linked list and returns the numer that appears the most times but goes over the list only one time can someone point me in the right direction? can't find an elegent solution yet, should i use recursion? I want the code to be as efficient as possible thanks in advance
<java><algorithm><singly-linked-list>
2016-01-15 11:58:57
LQ_EDIT
34,810,835
How to create an array constructor for my class?
<p>I would like to create a constructor, which is similar to the <code>int</code> array constructor: <code>int foo[3] = { 4, 5, 6 };</code></p> <p>But I would like to use it like this:</p> <pre><code>MyClass&lt;3&gt; foo = { 4, 5, 6 }; </code></pre> <p>There is a private <code>n</code> size array in my class:</p> <pre><code>template&lt;const int n=2&gt; class MyClass { public: // code... private: int numbers[n]; // code... }; </code></pre>
<c++><arrays><c++11>
2016-01-15 12:12:26
HQ
34,811,268
No img-responsive in Bootstrap 4
<p>I just downloaded the source code for Bootstrap 4 alpha 2 and can't find the class <code>img-responsive</code> in it. It exists in Bootstrap 3 source code and I can find it with Notepad++ but in Bootstrap 4s <code>bootstrap.css</code> in <code>dist</code> folder it doesn't exist.</p> <p>What happend to it??</p>
<image><twitter-bootstrap>
2016-01-15 12:37:53
HQ
34,811,540
How to build a Fluent Nested Guard API
<p>I am building a simple Guard API to protect against illegal parameters being passed to functions and so on.</p> <p>I have the following code:</p> <pre><code>public static class Guard { public static GuardArgument&lt;T&gt; Ensure&lt;T&gt;(T value, string argumentName) { return new GuardArgument&lt;T&gt;(value, argumentName); } } public class GuardArgument&lt;T&gt; { public GuardArgument(T value, string argumentName) { Value = value; Name = Name; } public T Value { get; private set; } public string Name { get; private set; } } // Example extension for validity checks public static GuardArgument&lt;T&gt; IsNotNull&lt;T&gt;(this GuardArgument&lt;T&gt; guardArgument, string errorMessage) { if (guardArgument.Value == null) { throw new ArgumentNullException(guardArgument.Name, errorMessage); } return guardArgument; } </code></pre> <p>At the moment the code can be used in a similar way to (note this is just a dumb example):</p> <pre><code>void DummyMethod(int? someObject) { Guard.Ensure(someObject, "someObject") .IsNotNull() .IsGreaterThan(0) .IsLessThan(10); } </code></pre> <p>This all works fine. What I want to be able to do now is extend the API to include child properties in the checks in the following way:</p> <pre><code>Guard.Ensure(someObject, "someObject") .IsNotNull() .Property( (x =&gt; x.ChildProp1, "childProp1") .IsNotNull() .IsGreaterThan(10) ) .Property( (x =&gt; x.ChildProp2, "childProp2") .IsNotNull() .IsLessThan(10) ); </code></pre> <p>Obviously the new <code>.Property</code> method needs to return the parent <code>GuardArgument</code> in order to chain. Furthermore the child property needs to be able to use the existing check methods (<code>IsNotNull()</code> etc) to avoid code duplication.</p> <p>I cannot work out how to construct the lambda/Property function parameters or where the <code>.Property</code> method should be located - i.e. should it be a property on the <code>GuardArgument</code> or somewhere else, or even if there is a better structure to the API.</p>
<c#><lambda><fluent>
2016-01-15 12:53:26
HQ
34,812,486
Calling functions inside Vue.js template
<p>My template:</p> <pre><code>&lt;template id="players-template" inline-template&gt; &lt;div v-for="player in players"&gt; &lt;div v-bind:class="{ 'row': ($index + 1) % 3 == 0 }"&gt; &lt;div class="player col-md-4"&gt; &lt;div class="panel panel-default"&gt; &lt;div class="panel-heading"&gt; &lt;h3 class="panel-title"&gt; &lt;a href="#"&gt;{{ player.username }}&lt;/a&gt; &lt;span class="small pull-right"&gt;{{ player.createdAt }}&lt;/span&gt; &lt;/h3&gt; &lt;/div&gt; &lt;div class="panel-body"&gt; &lt;img v-bind:src="player.avatar" alt="{{ player.username }}" class="img-circle center-block"&gt; &lt;/div&gt; &lt;div class="panel-footer"&gt; &lt;div class="btn-group btn-group-justified" role="group" aria-label="..."&gt; &lt;a href="#" class="btn btn-primary btn-success send-message" data-toggle="tooltip" data-placement="bottom" title="Wyślij wiadomość" v-bind:id="player.id" @click="createConversation(player.id)"&gt;&lt;span class="glyphicon glyphicon-envelope"&gt;&lt;/span&gt;&amp;nbsp;&lt;/a&gt; &lt;a href="#" class="btn btn-primary btn-info" data-toggle="tooltip" data-placement="bottom" title="Pokaż profil"&gt;&lt;span class="glyphicon glyphicon-user"&gt;&lt;/span&gt;&amp;nbsp;&lt;/a&gt; &lt;a href="#" class="btn btn-primary btn-primary" data-toggle="tooltip" data-placement="bottom" title="Zobacz szczegółowe informacje o poście"&gt;&lt;span class="glyphicon glyphicon-option-horizontal"&gt;&lt;/span&gt;&amp;nbsp;&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/template&gt; </code></pre> <p>My script:</p> <pre><code>new Vue({ el: 'body', methods: { createConversation: function(id) { console.log("createConversation()"); console.log(id); } } }); </code></pre> <p>When the template is rendering i gets an error <code>[Vue warn]: v-on:click="createConversation" expects a function value, got undefined</code>. I don't know how to use methods inside a component template. If someone could help me I would appreciate is.</p>
<javascript><vue.js>
2016-01-15 13:46:06
HQ
34,812,664
PHP Header = Location in a different folder in directory
<p>If I had a page inside of an includes folder but wanted a <code>header("location: dashboard.php");</code> to redirect out of the folder into the main directory, how would I do this?</p> <p>I want to come out of two folders to the main directory.</p>
<php>
2016-01-15 13:55:55
LQ_CLOSE
34,812,731
Html multiple select element accessibility
<p>In our web application we have a search form which contains a field for which a user can select one or more answers from a list of possible options. We currently use the "select" html element with the "multiple" attribute set as in the example below:</p> <p><div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>select { width: 150px; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;select multiple&gt; &lt;option value="A"&gt;Alice&lt;/option&gt; &lt;option value="B"&gt;Bob&lt;/option&gt; &lt;option value="F"&gt;Fred&lt;/option&gt; &lt;option value="K"&gt;Kevin&lt;/option&gt; &lt;option value="M"&gt;Mary&lt;/option&gt; &lt;option value="S"&gt;Susan&lt;/option&gt; &lt;/select&gt;</code></pre> </div> </div> </p> <p>Feedback from user testing has shown that this solution is confusing for users. Multiple selection/deselection is performed by holding down the Ctrl key (on windows), however many users were unaware of this.</p> <p>The element also does not seem to allow for easy use when using just a keyboard - this is obviously an accessibility issue.</p> <p>Is there a "best practice", accessible way of displaying an input with multiple options to a user?</p>
<html><accessibility>
2016-01-15 14:00:34
HQ
34,812,890
IabHelper class not working?
<p>I have implemented the IabHelper class in my android project and it says that the 'getBuyIntentToReplaceSkus' cannot be resolved. The full method:</p> <pre><code>buyIntentBundle = mService.getBuyIntentToReplaceSkus(5, mContext.getPackageName(),oldSkus, sku, itemType, extraData); </code></pre> <p>I implemented in app billing in my project but I have not yet created any items to be purchased, though the rest of the methods don't have any problems.</p>
<android><android-intent><in-app-purchase>
2016-01-15 14:10:06
HQ
34,812,967
Bad performance of UIStackView within UICollectionViewCells
<p>I am using <code>UIStackView</code> to layout <code>UILabels</code> in my <code>UICollectionViewCell</code> subclass. I'm using the iOS SDK 9.2</p> <p>The scrolling of the collection view is smooth if I don't update the labels' <code>text</code> when I dequeue them. However, if I update their <code>text</code> as I dequeue them, the scrolling is very slow. </p> <p>I made a very small demo to show the problem, to be ran on a device (not the simulator). You can create a new empty project and replace the contents of <code>ViewController.swift</code> with this:</p> <pre><code>import UIKit class ViewController: UIViewController { override func loadView() { view = UIView() let layout = UICollectionViewFlowLayout() layout.itemSize = CGSize(width: 100, height: 200) let collectionView = UICollectionView(frame: CGRectZero, collectionViewLayout: layout) collectionView.registerClass(Cell.self, forCellWithReuseIdentifier: "Cell") collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.dataSource = self view.addSubview(collectionView) let constraints = ["H:|-[collectionView]-|", "V:|[collectionView]|" ].flatMap { NSLayoutConstraint.constraintsWithVisualFormat($0, options: [], metrics: nil, views: ["collectionView": collectionView]) } NSLayoutConstraint.activateConstraints(constraints) } } extension ViewController: UICollectionViewDataSource { func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -&gt; UICollectionViewCell { let cell = collectionView.dequeueReusableCellWithReuseIdentifier("Cell", forIndexPath: indexPath) as! Cell //comment out the line below to make the scrolling smoother: cell.fillLabels() return cell } func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -&gt; Int { return 100 } } class Cell: UICollectionViewCell { var labelArray = [UILabel]() func fillLabels() { for label in labelArray { label.text = "\(label.text!) yo" } } override init(frame: CGRect) { super.init(frame: frame) contentView.backgroundColor = UIColor.whiteColor() let stackView = UIStackView() stackView.axis = .Horizontal stackView.alignment = .Leading stackView.distribution = .EqualSpacing stackView.translatesAutoresizingMaskIntoConstraints = false contentView.addSubview(stackView) let leftStack = UIStackView() leftStack.axis = .Vertical let rightStack = UIStackView() rightStack.axis = .Vertical stackView.addArrangedSubview(leftStack) stackView.addArrangedSubview(rightStack) for index in 0...10 { let leftLabel = UILabel() leftLabel.text = "\(index)" leftStack.addArrangedSubview(leftLabel) labelArray.append(leftLabel) let rightLabel = UILabel() rightLabel.text = "\(index)" rightStack.addArrangedSubview(rightLabel) labelArray.append(rightLabel) } let constraints = [ "H:|[stackView]|", "V:|[stackView]|" ].flatMap { NSLayoutConstraint.constraintsWithVisualFormat($0, options: [], metrics: nil, views: ["stackView": stackView]) } NSLayoutConstraint.activateConstraints(constraints) } required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } } </code></pre> <p>You'll notice the scrolling is smooth when you comment out the call to <code>fillLabels</code>. </p> <p>If you try to reproduce the same layout without <code>UIStackViews</code> and include the call <code>fillLabels</code>, you'll notice the scrolling is smooth too.</p> <p>This suggests <code>UIStackView</code> suffers performance bottlenecks if it has recalculate its layout. </p> <p>Is this hypothesis correct? Are there some solutions?</p>
<ios><uicollectionviewcell><uistackview>
2016-01-15 14:14:00
HQ
34,813,156
Need to change program filtering of files getting from FTP
<p>I've a C# program that received FTP records. The files we receive are all .csv so I check for that below:</p> <pre><code>private static bool IsAllowedExtension(string fileExtension) { return fileExtension.ToLower() == ".csv"; } </code></pre> <p>then we process only this sort of file:</p> <pre><code> foreach (RemoteFileInfo fileInfo in directory.Files) { var fileExtension = Path.GetExtension(fileInfo.Name); if (string.IsNullOrEmpty(fileExtension) || !IsAllowedExtension(fileExtension)) continue; if (!Directory.Exists(LocalPath)) Directory.CreateDirectory(LocalPath); var localFile = string.Format("{0}\\{1}",LocalPath.TrimEnd('\\') , fileInfo.Name); if (fileInfo.Name != ".." &amp;&amp; !File.Exists(localFile)) </code></pre> <p>However, now there has been some .csv in the group receiving we dont want. So i want to add or change this to that the file we want all start as this:</p> <p>"CheckoutReportID=" this would give us only the ones needed.</p>
<c#><.net>
2016-01-15 14:24:03
LQ_CLOSE
34,813,412
How to detect if building with address sanitizer when building with gcc 4.8?
<p>I'm working on a program written in C that I occasionally build with address sanitizer, basically to catch bugs. The program prints a banner in the logs when it starts up with info such as: who built it, the branch it was built on, compiler etc. I was thinking it would be nice to also spell out if the binary was built using address sanitizer. I know there's __has_feature(address_sanitizer), but that only works for clang. I tried the following simple program: </p> <pre><code>#include &lt;stdio.h&gt; int main() { #if defined(__has_feature) # if __has_feature(address_sanitizer) printf ("We has ASAN!\n"); # else printf ("We have has_feature, no ASAN!\n"); # endif #else printf ("We got nothing!\n"); #endif return 0; } </code></pre> <p>When building with <code>gcc -Wall -g -fsanitize=address -o asan asan.c</code>, this yields: </p> <pre><code>We got nothing! </code></pre> <p>With <code>clang -Wall -g -fsanitize=address -o asan asan.c</code> I get: </p> <pre><code>We has ASAN! </code></pre> <p>Is there a gcc equivalent to __has_feature? </p> <p>I know there are ways to check, like the huge VSZ value for programs built with address sanitizer, just wondering if there's a compile-time define or something. </p>
<c><gcc><clang><address-sanitizer>
2016-01-15 14:36:22
HQ
34,813,726
google play services 8.4.0 - classes.jar not found - android studio
<p>I am getting this error when I Run or Debug the app but when I build or clean my project there are no errors. It sounds strange but I've wasted my 4-5 hours searching for this but nothing was helpful. Error:</p> <pre><code>Error:Execution failed for task ':app:compileDebugJavaWithJavac'.&gt; java.io.FileNotFoundException: C:\Users\Saeed Jassani\Downloads\AppName\app\build\intermediates\exploded-aar\com.google.android.gms\play-services\8.4.0\jars\classes.jar (The system cannot find the path specified) </code></pre> <p>build.gradle file:</p> <pre><code>apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.example.app" minSdkVersion 9 targetSdkVersion 23 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:recyclerview-v7:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.google.android.gms:play-services:8.4.0' compile 'com.android.support:support-v4:23.1.1' } </code></pre>
<android><android-gradle-plugin><google-play-services>
2016-01-15 14:50:48
HQ
34,814,280
List<comma-separated strings> => List<string>?
<p>Trying to come up with a LINQy way to do this, but nothing's coming to me.</p> <p>I have a List&lt;> of objects which include a property which is a comma-separated list of alpha codes:</p> <pre><code>lst[0].codes = "AA,BB,DD" lst[1].codes = "AA,DD,EE" lst[2].codes = "GG,JJ" </code></pre> <p>I'd like a list of those codes, hopefully in the form of a List of strings:</p> <pre><code>result = AA,BB,DD,EE,GG,JJ </code></pre> <p>Thanks for any direction.</p>
<c#><linq>
2016-01-15 15:19:43
HQ
34,814,306
Customize Radio and Checkbox with CSS
<p>Is it possible to customize the look of radio and checkboxes only using CSS? I see there is a lot out there regarding this, but most solutions require the use of images and javascript. </p>
<css><checkbox><radio-button>
2016-01-15 15:21:12
LQ_CLOSE
34,814,368
"Gradle Version 2.10 is required." Error
<p>As I've been using </p> <pre><code>classpath 'com.android.tools.build:gradle:+' </code></pre> <p>In the <strong>build.gradle</strong> file, I got the following error since <strong>gradle version 2.10</strong> has been released. The error is :</p> <blockquote> <p>Warning:Gradle version 2.10 is required. Current version is 2.8. If using the gradle wrapper, try editing the distributionUrl in C:\Users\blahblah\myproject\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip</p> </blockquote> <p>at first it looks easy to solve by the guide, but when I'd done the change, I got the error again. </p> <p>I'm using <strong>Android Studio 2.0</strong> with the latest <strong>Android SDK Tools 24.4.1</strong> and <strong>Android SDK Build Tools 23.0.2</strong></p> <p>I've even tried to download <strong>Gradle 2.10</strong> and put it manually on android-studio\gradle\ folder, but no luck.</p> <p>Any help would be appreciated.</p>
<android><android-studio><plugins><gradle><android-gradle-plugin>
2016-01-15 15:24:36
HQ
34,814,952
Javascript: find english word in string
<p>i want to find any english word (min 4 letters) in one string.</p> <pre><code>Eg: hello123fdwelcome =&gt; ["hello", "welcome"]; </code></pre> <p>Could you suggest for me any solution or javascript lib to match english word.</p> <p>Thanks</p>
<javascript><node.js><dictionary>
2016-01-15 15:54:19
LQ_CLOSE
34,815,482
Accessing credentials in Jenkins with the Credentials Parameter plugin
<p>My Jenkins box needs to access Stash and Jira through their REST apis. For that I need to store their credentials.</p> <p>The way I am doing is via the Credentials Parameter, which asks me for a Name, Credential type, Required, Default Value, and a Description.</p> <p>I define a Name as CREDENTIAL_PARAMETER, in the type I set it as "Username with password", and then I pick one credential from the list in the Default Value.</p> <p>Next in the Build section I define that a shell should be executed, which is something like</p> <pre><code>echo $CREDENTIAL_PARAMETER </code></pre> <p>I was expecting to get something like "username:password" as the CREDENTIAL_PARAMETER. However, I get a hash that I think is how the username and password can be retrieved.</p> <p>How can I get the credentials based on the hash using bash?</p>
<jenkins><jenkins-plugins>
2016-01-15 16:22:47
HQ
34,816,577
When can I use a SFSafariViewController, WKWebView, or UIWebView with universal links?
<p>In the <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html#//apple_ref/doc/uid/TP40016308-CH12-SW1" rel="noreferrer">Universal Links</a> section of the <a href="https://developer.apple.com/library/ios/documentation/General/Conceptual/AppSearch/index.html" rel="noreferrer">iOS App Search Programming Guide</a>, Apple says:</p> <blockquote> <p>If you instantiate a SFSafariViewController, WKWebView, or UIWebView object to handle a universal link, iOS opens your website in Safari instead of opening your app. However, if the user taps a universal link from within an embedded SFSafariViewController, WKWebView, or UIWebView object, iOS opens your app.</p> </blockquote> <p>What does "handle a universal link" mean? Can I not ever open the given URL with an <code>SFSafariViewController</code>, <code>WKWebView</code>, or <code>UIWebView</code>? Does it only apply during <code>-[UIApplicationDelegate application:continueUserActivity:restorationHandler:]</code>, or is there a timeout in place? Does this mean we can't ever open the URL in a <code>SFSafariViewController</code>, <code>WKWebView</code>, or <code>UIWebView</code>?</p>
<ios><uiwebview><wkwebview><applinks><sfsafariviewcontroller>
2016-01-15 17:27:29
HQ
34,816,578
How to detect API modifications when mocking e2e tests?
<p>I'd like to setup a solid e2e testing foundation on our team's project but I can't find a simple solution to that question :</p> <p><strong>When you are mocking all of your calls, what is the best way to detect if the actual model of the objects returned by your server has been modified ?</strong></p> <p>Your tests would still pass because they're testing an outdated version of the model but the app is potentially broken.</p> <p>For example, if a mock assumes that <code>/api/users/1</code> returns <code>null</code> if the user doesn't exist, when it actually returns an empty object, then although the tests may pass, the behaviour being tested relies on incorrect assumptions and may therefore fail in unexpected ways.</p> <p>Or maybe the backend is somehow providing static json files with the latest up-to-date model and the frontend relies on this ?</p> <p>This of course supposes that the people working on the backend and the people working on the frontend are separate teams.</p> <p>I am using Angular 1.x and Protractor here but this doesn't really depend on the technology.</p>
<angularjs><unit-testing><mocking><protractor><e2e-testing>
2016-01-15 17:27:31
HQ
34,816,593
C scanf ignored when invalid input
<p>I wrote this code, and all it meant to do is input ints until a negative is entered:</p> <pre><code>int result = 0, input_number = 0; while(input_number &gt;= 0){ printf("Please enter students IDs(negetive to stop)= "); result = scanf("%d", &amp;input_number); if(result != 1){ printf("Invalid input! try again...\n"); continue; } } </code></pre> <p>When the input is an int- everything works fine,</p> <p>But when entering a char (any char the is not int),</p> <p>The loop becomes endlessly and scanf doesn't request any input anymore.</p> <p>DO NOT suggest I use a replacement for scanf cause it's a work for school, and scanf must be used.</p> <p>After entering char output:</p> <pre><code>Please enter students IDs(negetive to stop)= 4 Please enter students IDs(negetive to stop)= 5 Please enter students IDs(negetive to stop)= r Please enter students IDs(negetive to stop)= Invalid input! try again... Please enter students IDs(negetive to stop)= Invalid input! try again... Please enter students IDs(negetive to stop)= Invalid input! try again... Please enter students IDs(negetive to stop)= Invalid input! try again... Please enter students IDs(negetive to stop)= Invalid input! try again... Please enter students IDs(negetive to stop)= Invalid input! try again... ... </code></pre>
<c><scanf>
2016-01-15 17:29:38
LQ_CLOSE
34,816,628
await await vs Unwrap()
<p>Given a method such as</p> <pre><code>public async Task&lt;Task&gt; ActionAsync() { ... } </code></pre> <p>What is the difference between</p> <pre><code>await await ActionAsync(); </code></pre> <p>and</p> <pre><code>await ActionAsync().Unwrap(); </code></pre> <p>if any.</p>
<c#><async-await>
2016-01-15 17:32:23
HQ
34,817,231
is there any way to restict the data into table if it is already present
I have an sp which when triggered, data will be inserted into the data. if the data being inserted is already present oin the table, I don't want the data to be inserted into the table. is there anyway i could use a logic to restrict the data into table. my query is declare @ident int = IDENT_CURRENT( 'SADEV.RO_Transcript.ETQueueCtrl' ) insert into SADEV.RO_Transcript.ETQueueCtrl ([STU_ID],[STU_ORD_SEQ_NUM],[CreatedDate],[LastUpdatedDate],[ETQueueCtrlStatusCd],[ErrorFl]) select STU_ID ,STU_ORD_SEQ_NUM ,getdate() ,getdate() ,[ETQueueCtrlStatusCd] = 'N' ,'N' from srdb_sr2_qa.dbo.SR0ROT rt where STU_ORD_TYP_CD = 'A' and ORD_DLVY_MTHD_CD = 'ET' and STU_ORD_STAT_CD = 'C' --and convert(varchar(1),STU_ORD_XPDT_FL) = @stu_ord_xpdt_fl and case when @stu_ord_xpdt_fl = 'y' then GETDATE() else case when ORD_PEND_INST_CD = '' then STU_ORD_SBM_DT+ DATEADD (mi,480,STU_ORD_SBM_TM) else LAST_UPD_DT+ DATEADD (mi,480,LAST_UPD_TM) end end <= GETDATE() select et.ETQueueCtrlID, ro.STU_ID, ro.STU_ORD_SEQ_NUM, ty.CAREER_CD, ty.CAREER_SUFX_CD from SADEV.RO_Transcript.ETQueueCtrl et join srdb_sr2_qa.dbo.SR0ROT ro on et.STU_ID = ro.STU_ID and et.STU_ORD_SEQ_NUM = ro.STU_ORD_SEQ_NUM left join srdb_sr2_qa.dbo.SR0TYT ty on ro.STU_ID = ty.STU_ID where et.ETQueueCtrlID > @ident
<sql><sql-server><tsql><tsql-sequence>
2016-01-15 18:13:01
LQ_EDIT
34,817,380
How do we set constant variables while building R packages?
<p>We are building a package in R for our service (a robo-advisor here in Brazil) and we send requests all the time to our external API inside our functions. </p> <p>As it is the first time we build a package we have some questions. :(</p> <p>When we will use our package to run some scripts we will need some information as <code>api_path, login, password</code>.</p> <p>How do we place this information inside our package? </p> <p>Here is a real example:</p> <pre><code>get_asset_daily &lt;- function(asset_id) { api_path &lt;- "https://api.verios.com.br" url &lt;- paste0(api_path, "/assets/", asset_id, "/dailies?asc=d") data &lt;- fromJSON(url) data } </code></pre> <p>Sometimes we use a <code>staging</code> version of the API and we have to constantly switch paths. How we should call it inside our function? </p> <p>Should we set a global environment variable, a package environment variable, just define <code>api_path</code> in our scripts or a package config file?</p> <p>How do we do that? </p> <p>Thanks for your help in advance.</p> <p>Ana</p>
<r><global-variables><environment-variables><packages><environment>
2016-01-15 18:22:23
HQ
34,817,549
How to convert Spark RDD to pandas dataframe in ipython?
<p>I have a <code>RDD</code> and I want to convert it to <code>pandas</code> <code>dataframe</code>. I know that to convert and <code>RDD</code> to a normal <code>dataframe</code> we can do</p> <pre><code>df = rdd1.toDF() </code></pre> <p>But I want to convert the <code>RDD</code> to <code>pandas</code> <code>dataframe</code> and not a normal <code>dataframe</code>. How can I do it?</p>
<python><pandas><ipython><pyspark><rdd>
2016-01-15 18:34:18
HQ
34,818,057
Unity C#: Help editing script to use Right Mouse Button instead of OnMouseDrag
I am having trouble figuring out how to adjust this script to use the Middle Mouse Button instead of Left. The script currently uses OnMouseDown, OnMouseUp, and OnMouseDrag. I need those to be middle mouse instead. (mouse button 3) I appreciate any help, as I am new to coding. Everything I have tried so far has broken the script in one way or another. Thank you very much for your time. using UnityEngine; using System.Collections; public class FPH_DoorObject_Drag : MonoBehaviour { /* * This script is for doors which can be opened dragging on the screen */ public float factor = 2.0f; // How fast will be the movement public float minRot = 0.0f; public float maxRot = 90.0f; public string[] observeKind = new string[] {"Normal", "Closeup"}; public int observeInt = 0; // this variable is used inside of the Editor script public float secToOserve = 1.3f; // After this amount of seconds the text will reset public GameObject inGameCamera; public GameObject closeupCamera; public bool removeItemWhenUsed; public string hasBeenUnlockedKey; public bool canBeObserved; public AudioClip lockedSound; public string observMessage_English; public string observMessage_Italian; public string observMessage_Spanish; public string observMessage_German; public string observMessage_French; public string observMessage_Japanese; public string observMessage_Chinese; public string observMessage_Russian; public string lockedMessage_English; public string lockedMessage_Italian; public string lockedMessage_Spanish; public string lockedMessage_German; public string lockedMessage_French; public string lockedMessage_Japanese; public string lockedMessage_Chinese; public string lockedMessage_Russian; public string wrongItemMessage_English; public string wrongItemMessage_Italian; public string wrongItemMessage_Spanish; public string wrongItemMessage_German; public string wrongItemMessage_French; public string wrongItemMessage_Japanese; public string wrongItemMessage_Chinese; public string wrongItemMessage_Russian; public int doorType = 0; /* * A dor can be: * " Normally Open " - The door is always open * " Locked " - The door is always locked and CAN'T be opened * " Need Equipped Object " - The door is locked but can be opened if the player equip an object * " Need Activated Key " - The door is locked but can be opened if a PlayerPres key is " 1 " which means true */ public string[] doorTypeArray = new string[] {"Normally Open", "Locked", "Need Equipped Object", "Need Activated Key"}; public string neededObject_Name; public string neededKey; private Vector3 startRot; private float startPlayerRot; private float currRot; private float playerRot; private float delta = 0; private Transform playerTransform; private bool canbeOpen; public float openDirection; private bool hasBeenUnlocked; void Start(){ openDirection = -1.0f; playerTransform = GameObject.FindWithTag("Player").transform; startRot = this.gameObject.GetComponent<Transform>().eulerAngles; delta = 0; hasBeenUnlocked = FPH_ControlManager.LoadBool(hasBeenUnlockedKey); if(hasBeenUnlocked){ doorType = 0; } } void Update(){ if(doorType == 0){ canbeOpen = true; } if(doorType == 1){ canbeOpen = false; } if(doorType == 2){ if(FPH_InventoryManager.equippedItem != neededObject_Name && FPH_InventoryManager.equippedItem != "" && FPH_InventoryManager.equippedItem != " "){ canbeOpen = false; } if(FPH_InventoryManager.equippedItem == "" || FPH_InventoryManager.equippedItem == " "){ canbeOpen = false; } if(FPH_InventoryManager.equippedItem == neededObject_Name){ canbeOpen = true; } } if(doorType == 3){ bool boolValue = FPH_ControlManager.LoadBool(neededKey); if(boolValue){ canbeOpen = true; } else{ canbeOpen = false; } } } public void OnMouseDown(){ if(canbeOpen){ startPlayerRot = playerTransform.eulerAngles.y; } } public void OnMouseUp(){ if(doorType == 1){ StartCoroutine("PrivateLocked"); } if(doorType == 2){ if(FPH_InventoryManager.equippedItem != neededObject_Name && FPH_InventoryManager.equippedItem != "" && FPH_InventoryManager.equippedItem != " "){ StartCoroutine("PrivateWrongItem"); } if(FPH_InventoryManager.equippedItem == "" || FPH_InventoryManager.equippedItem == " "){ StartCoroutine("PrivateLocked"); } } if(doorType == 3 && !canbeOpen){ StartCoroutine("PrivateLocked"); } if(canbeOpen){ startRot.y = currRot; delta = 0; if(FPH_InventoryManager.equippedItem == neededObject_Name && !hasBeenUnlocked){ hasBeenUnlocked = true; FPH_ControlManager.SaveBool(hasBeenUnlockedKey, hasBeenUnlocked); doorType = 0; //Afte we used the item we unequip it FPH_InventoryManager.equippedItem = ""; FPH_InventoryManager.equippedItem_Index = -1; if(removeItemWhenUsed){ FPH_InventoryManager.RemoveInventoryItem(FPH_InventoryManager.equippedItem_Index); FPH_InventoryManager.SaveInventory(); } } } } void OnMouseDrag(){ if(canbeOpen){ playerRot = playerTransform.eulerAngles.y; delta = (playerRot - startPlayerRot) * openDirection; // openDirection si important or player rotation will be the inverse of door rot currRot = (startRot.y + (delta * factor)); currRot = Mathf.Clamp(currRot, minRot, maxRot); // door rotation can't be bigger or smaller than min and max rot transform.eulerAngles = new Vector3(startRot.x, currRot, startRot.z); if(FPH_InventoryManager.equippedItem == neededObject_Name && !hasBeenUnlocked){ hasBeenUnlocked = true; FPH_ControlManager.SaveBool(hasBeenUnlockedKey, hasBeenUnlocked); doorType = 0; //Afte we used the item we unequip it FPH_InventoryManager.equippedItem = ""; FPH_InventoryManager.equippedItem_Index = -1; if(removeItemWhenUsed){ FPH_InventoryManager.RemoveInventoryItem(FPH_InventoryManager.equippedItem_Index); FPH_InventoryManager.SaveInventory(); } } } } public void Observe(){ if(observeInt == 0){ StartCoroutine("PrivateObserve_Normal"); } if(observeInt == 1){ StartCoroutine("PrivateObserve_Closeup"); } } IEnumerator PrivateLocked(){ FPH_LanguageManager.static_observeTextMesh.text = ""; if(lockedSound){ GetComponent<AudioSource>().PlayOneShot(lockedSound); } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.English){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_English; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Italian){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_Italian; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Spanish){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_Spanish; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.German){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_German; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.French){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_French; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Japanese){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_Japanese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Chinese){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_Chinese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Russian){ FPH_LanguageManager.static_observeTextMesh.text = lockedMessage_Russian; } yield return new WaitForSeconds(secToOserve); FPH_LanguageManager.static_observeTextMesh.text = ""; } IEnumerator PrivateWrongItem(){ FPH_LanguageManager.static_observeTextMesh.text = ""; if(lockedSound){ GetComponent<AudioSource>().PlayOneShot(lockedSound); } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.English){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_English; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Italian){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_Italian; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Spanish){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_Spanish; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.German){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_German; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.French){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_French; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Japanese){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_Japanese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Chinese){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_Chinese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Russian){ FPH_LanguageManager.static_observeTextMesh.text = wrongItemMessage_Russian; } yield return new WaitForSeconds(secToOserve); FPH_LanguageManager.static_observeTextMesh.text = ""; } IEnumerator PrivateObserve_Normal(){ if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.English){ // If language is .... FPH_LanguageManager.static_observeTextMesh.text = observMessage_English; // Set this thext } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Italian){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Italian; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Spanish){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Spanish; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.German){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_German; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.French){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_French; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Japanese){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Japanese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Chinese){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Chinese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Russian){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Russian; } yield return new WaitForSeconds(secToOserve); // After " secToOserve " ... FPH_LanguageManager.static_observeTextMesh.text = ""; // Reset the text } /* * We toggle the cameras and show a text, everything will be reset * after " secToOserve " */ IEnumerator PrivateObserve_Closeup(){ inGameCamera.SetActive(false); closeupCamera.SetActive(true); FPH_ControlManager.canBeControlled = false; yield return new WaitForSeconds(0.1f); if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.English){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_English; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Italian){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Italian; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Spanish){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Spanish; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.German){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_German; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.French){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_French; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Japanese){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Japanese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Chinese){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Chinese; } if(FPH_LanguageManager.gameLanguage == FPH_LanguageManager.LanguagesEnum.Russian){ FPH_LanguageManager.static_observeTextMesh.text = observMessage_Russian; } yield return new WaitForSeconds(secToOserve); FPH_LanguageManager.static_observeTextMesh.text = ""; yield return new WaitForSeconds(0.3f); inGameCamera.SetActive(true); closeupCamera.SetActive(false); FPH_ControlManager.canBeControlled = true; } }
<c#><unity3d><unityscript>
2016-01-15 19:07:41
LQ_EDIT
34,818,088
jax-rs vs HttpServlet in jee
<p>I'm so confused. I worked servlet.</p> <p>which one is newest?</p> <p>which one is better for implementing <strong>restful</strong> architecture?</p> <p>jax-rs example :</p> <pre><code>// This method is called if XML is request @GET @Produces(MediaType.TEXT_XML) public String sayXMLHello() { return "&lt;?xml version=\"1.0\"?&gt;" + "&lt;hello&gt; Hello Jersey" + "&lt;/hello&gt;"; } </code></pre> <p>servlet example :</p> <pre><code>/** Servlet implementation class FetchTest */ @WebServlet( urlPatterns = {"/users", "/Users/"}) public class Users extends HttpServlet { /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { m_showUsers( response); } /** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { m_updateUser(request , response); } @Override protected void doDelete( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { m_deleteUser(req , resp); } @Override protected void doPut( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { m_insertUser(req , resp); } </code></pre>
<java><servlets><jakarta-ee><jax-rs><jax-ws>
2016-01-15 19:09:32
LQ_CLOSE
34,818,533
How to compare two Streams in Java 8
<p>What would be a good way to compare two <code>Stream</code> instances in Java 8 and find out whether they have the same elements, specifically for purposes of unit testing?</p> <p>What I've got now is:</p> <pre><code>@Test void testSomething() { Stream&lt;Integer&gt; expected; Stream&lt;Integer&gt; thingUnderTest; // (...) Assert.assertArrayEquals(expected.toArray(), thingUnderTest.toArray()); } </code></pre> <p>or alternatively:</p> <pre><code>Assert.assertEquals( expected.collect(Collectors.toList()), thingUnderTest.collect(Collectors.toList())); </code></pre> <p>But that means I'm constructing two collections and discarding them. It's not a performance issue, given the size of my test streams, but I'm wondering whether there's a canonical way to compare two streams.</p>
<java><junit><java-8>
2016-01-15 19:36:24
HQ
34,819,252
How to pass 'this' into a Promise without caching outside?
<p>I have a variable called <code>LangDataService.isDataReady</code> that is a Promise wawiting to be resolved. Upon resolve some logic will happen. How can I pass this into that Promise?</p> <pre><code>LangDataService.isDataReady.then(function () { this.modalOn() }); </code></pre> <p>I know i can cache <code>var self_ = this;</code> but I'm curious of other alternatives? </p>
<javascript><caching><asynchronous><promise><this>
2016-01-15 20:21:49
HQ
34,819,557
How to find and replace with regex in excel
<p>I have an excel file with 1 column and multiple rows.</p> <p>The rows contain various text, here's an example:</p> <pre><code>texts are home texts are whatever dafds dgretwer werweerqwr texts are 21412 texts are 346345 texts are rwefdg terfesfasd rwerw </code></pre> <p>I want to replace "texts are *" where * is anything after "texts are" with a specific word, for example "texts are replaced". How can I do that in Excel?</p>
<regex><excel><replace>
2016-01-15 20:45:01
HQ
34,819,642
Appending a to-do list
<p>I am trying to make a "to do list" app. I am trying to append what I put in the input into a list under "To Do" with a "Done" button. Here is what I have so far:</p> <p>HTML:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;link rel="stylesheet" text="text/css" href="doneit.css"&gt; &lt;head&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"&gt; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="container"&gt; &lt;input type="text" id="task" placeholder="New Task"/&gt; &lt;button id="enter"&gt;Enter&lt;/button&gt; &lt;div class="todo"&gt; &lt;ul id="chores"&gt;&lt;h2&gt;To Do:&lt;/h2&gt;&lt;/ul&gt; &lt;/div&gt; &lt;button id="reset"&gt;New List&lt;/button&gt; &lt;/div&gt; &lt;script type="text/javascript" src="doneit.js"&gt;&lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and the Javascript:</p> <pre><code>$(document).ready( function() { var chores=[]; $("#enter").click(function () { var task = $("#task").val(); var $btn = $('&lt;button /&gt;', { id: "check", type: "button", text: "Done", value: task, click: function(){ var did = this.value; $("#todo").append('&lt;p&gt;'+ check+'&lt;/p&gt;'); chores.push(check); } }); $(".reset").click(function() { location.reload(); }); </code></pre>
<javascript><jquery>
2016-01-15 20:50:47
LQ_CLOSE
34,820,239
Seaborn Heatmap Colorbar Label as Percentage
<p>Given this heat map:</p> <pre><code>import numpy as np; np.random.seed(0) import seaborn as sns; sns.set() uniform_data = np.random.rand(10, 12) ax = sns.heatmap(uniform_data) </code></pre> <p>How would I go about making the color bar values display in percent format? Also, what if I just wanted to show the first and last values on the color bar?</p> <p>Thanks in advance!</p>
<python-3.x><heatmap><seaborn>
2016-01-15 21:35:20
HQ
34,820,653
My comand prompt exits right after I test my code
<p>Right after I start my PYTHON code my comand prompt exits.I can't even test it out or see the result becaues it exits too fast.Any help?</p>
<python>
2016-01-15 22:04:37
LQ_CLOSE
34,820,755
Gitlab docker executor - cache image after before_script
<p>In <code>gitlab-ci</code> there's an option in the <a href="http://doc.gitlab.com/ce/ci/yaml/README.html" rel="noreferrer"><code>.gitlab-ci.yml</code></a> file to execute commands before any of the actual script runs, called <code>before_script</code>. <code>.gitlab-ci.yml</code> examples illustrate installing ancillary programs here. However, what I've noticed is that these changes are not cached in Docker when using a docker executor. I had naively assumed that after running these commands, docker would cache the image, so for the next run or test, docker would just load the cached image produced after <code>before_script</code>. This would drastically speed up builds.</p> <p>As an example, my <code>.gitlab-ci.yml</code> looks a little like:</p> <pre><code>image: ubuntu before_script: - apt-get update -qq &amp;&amp; apt-get install -yqq make ... build: script: - cd project &amp;&amp; make </code></pre> <p>A possible solution is to go to the runner machine and create a docker image that can build my software without any other installation and then reference it in the <code>image</code> section of the yaml file. The downside of this is that whenever I want to add a dependency, I need to log in to the runner machine and update the image before builds will succeed. It would be much nicer if I just had to add the dependency to to the end of <code>apt-get install</code> and have docker / gitlab-ci handle the appropriate caching.</p> <p>There is also a <code>cache</code> command in <code>.gitlab-ci.yml</code>, which I tried setting to <code>untracked: true</code>, which I thought would cache everything that wasn't a byproduct of my project, but it didn't seem to have any effect.</p> <p>Is there any way to get the behavior I desire?</p>
<docker><gitlab><gitlab-ci><gitlab-ci-runner>
2016-01-15 22:12:16
HQ
34,820,817
ESLint's "no-undef" rule is calling my use of Underscore an undefined variable
<p>I am using Grunt as my Build Tool and ESLint as my linting tool for an app I am working on. I am also using the Underscore Node package, and have made use of it in my app. Unfortunately, when I run ESLint on my code, it thinks that _ is an undefined variable in the following line:</p> <p><code>return _.pluck(objects, nameColumn);</code></p> <p>This is the error it is giving me:</p> <p><code>78:21 error "_" is not defined no-undef</code></p> <p>I would prefer not to disable the no-undef rule for ESLint, and I have tried installing the Underscore plugin, but I am still receiving this error. If anyone else has any ideas for what to try with this, I would be very appreciative!</p> <p>If there is any further information I can give that would help anyone with helping me get this figured out, just let me know!</p>
<javascript><angularjs><gruntjs><underscore.js><eslint>
2016-01-15 22:17:46
HQ
34,820,975
Git clone: Redirect stderr to stdout but keep errors being written to stderr
<p><code>git clone</code> writes its output to <code>stderr</code> as documented <a href="https://www.kernel.org/pub/software/scm/git/docs/git-clone.html">here</a>. I can redirect this with the following command:</p> <pre><code>git clone https://myrepo c:\repo 2&gt;&amp;1 </code></pre> <p>But this will redirect all output, including errors, from <code>stderr</code>to <code>stdout</code>. Is there a way to redirect progress messages to <code>stdout</code> but have error messages still written to <code>stderr</code>. </p>
<git><powershell><git-clone>
2016-01-15 22:31:30
HQ