input
stringlengths
51
42.3k
output
stringlengths
18
55k
Display 1st paragraph within Advanced Custom Fields <p>How do you display only the first paragraph of an advanced custom field.</p> <pre><code> &lt;?php the_field('lyrics'); ?&gt; </code></pre> <p>Above is what i use to display the full text. </p>
<pre><code>add_filter( 'wp_trim_excerpt', 'my_custom_excerpt', 10, 2 ); function my_custom_excerpt($text, $raw_excerpt) { if( ! $raw_excerpt ) { $content = apply_filters( 'the_content', get_the_content() ); $text = substr( $content, 0, strpos( $content, '&lt;/p&gt;' ) + 4 ); } return $text; ...
Dropdown Menu Not Working? <p>I've searched through this code for errors that would keep it from working, but can't seem to find any. All appears well, except the menu will not dropdown. Does anyone have any tips? </p> <p>Here is my code as snippet:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-co...
<p>Well, the dropdown-menu actually shows up :) </p> <p>But we cannot see it, because your menu is </p> <blockquote> <p>overflow: hidden;</p> </blockquote> <p>If you delete this css-row, your menu will work: </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <di...
Lisp finding all even numbers and adding them to new list <p>Given a list (3 b 6 7 8), I'm trying to find all the even numbers and add them to a new list and then print this list. I am using a do loop to cdr through my list. Then using (if (evenp (car mylist))) and now I want to save the first even number onto a new li...
<p>Create an empty list and use push to add the selected elements to the list. If you need to preserve order then use reverse with the list, at the end of the loop.</p>
Javascript How to get first three digits of a string <p>This may duplicate with previous topics but I can't find what I really need. I want to get a first three digits of a string. For example:</p> <pre><code>var str = '012123'; console.info(str.substring(0,3); //012 </code></pre> <p>I want the output of this string...
<pre><code>var str = '012123'; var strFirstThree = str.substring(0,3); console.log(str); //shows '012123' console.log(strFirstThree); // shows '012' </code></pre> <p>Now you have access to both.</p>
Javascript Thumbnails Array <p>I'm working on a website that displays pictures with the help of java-script. The way that I have this website set up at the moment, an image is displayed above thumbnail links. The problem is that the thumbnails are showing as broken, even though they send the correct image. Why is it do...
<p>You image <code>src</code> should have quotes</p> <pre><code>for (i = 0; i &lt; photos.length; i++) { document.write("&lt;a href=\"javascript: goto(" + i + ");\"&gt;" + "&lt;img src='" + photos[i] + "'/&gt;&lt;/a&gt; "); } </code></pre> <p>See: <a href="https://jsfiddle.net/evxoko9a/" rel="nofollow">https://jsfid...
How to make dynamic created div stack row by row <p>I have few child div that will be created inside parent div , because I want the child div to be dropped to the bottom. I use css to force the child div to drop to the bottom, however I also want if several child div are created, they will displayed in row by row, bu...
<p>You're using <code>display:flex;</code> on <code>.myProgress</code></p> <p>If you also add <code>flex-direction: column;</code> to <code>.myProgress</code> then it will add each div underneath the last one.</p> <p><a href="https://jsfiddle.net/9hd7ztx1/" rel="nofollow">JS Fiddle</a></p> <p><a href="https://css-tr...
How to add Pandas dataframe column from a element of a list in another column without lambda? <p>Suppose I have this dataframe</p> <pre><code>A B [ 'a' , 'b' , 'c' ] 3 [ 'e' , 'f' , 'g' , 'h'] 5 </code></pre> <p>How can I create a new column such as below without lambda?</p> <pre...
<p>You can define your lambda as a regular function and call it using apply like so:</p> <pre><code>def my_function(x): return x[-2] df['C'] = df['A'].apply(my_function) </code></pre>
How do I loop thorough an array of objects but print only the first 2 <p>Here is the code that I have that hits the API and appends all five to the li in the ul id="cards". How can I limit the results to the first two only?</p> <p>Thanks!</p> <pre><code>$.ajax({ url: url, success: function(data){ var cards = data.r...
<p>As stated in the <a href="http://api.jquery.com/jquery.each/" rel="nofollow">official documentation</a> the callback function accepts index and value: function( index, value ); so in your case i is the index.</p> <p>This should work: </p> <pre><code>$.ajax({ url: url, success: function(data){ var cards = data.re...
How do I override inherited methods when using JavaScript ES6/ES2015 subclassing <p>I have created a class that extends Array. I want to execute arbitrary code before calling the inherited push function.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="s...
<p>The solution I found was to create a new function in the subclass that has the same name as the inherited function. In this case push. Then inside the overriding function the inherited function is called via the super keyword.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-bab...
Golang - Why use done channel <p>It's one of example code of Golang. But cannot understand why 'done' channel need in this case.</p> <p><a href="https://gobyexample.com/closing-channels" rel="nofollow">https://gobyexample.com/closing-channels</a></p> <p>There is no reason to sent true to done channel. We can know job...
<p>No the result is not the same:<br> Your main goroutine exits before your <code>received job</code> goroutine in many situations (e.g. different CPU loads, and it is nondeterministic and system dependent behavior), so in that way you cannot guarantee that <code>all jobs received</code>, e.g. just Add </p> <pre><code...
Azure Service bus - queue connectivity error <p>I am trying to connect and send a message to azure service bus queue using the following code</p> <pre><code>var connectionString = "&lt;Your connection string&gt;"; var queueName = "&lt;Your queue name&gt;"; var client = QueueClient.CreateFromConnectionString(connecti...
<blockquote> <p>The client and server do not possess a common algorithm</p> </blockquote> <p>That's not a TCP layer problem. That's higher up in the TLS handshake and it means just that. The two parties (client and server) could not agree on a common cipher suite and the handshake failed.</p> <p>Run your client's h...
Does the Android OS have a default photo album? <p>I am creating a photo selector and I want to know if there is a default album in the Android OS that exists in all Android phones. For example: "Camera" or "DCIM"?</p> <p>Thanks</p>
<p>You can use any of these default libraries</p> <pre><code>Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM); </code></pre> <p>or </p> <pre><code>Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); </code></pre>
If Error+ If + VlookUp <p>So I have list of hundreads of datas based on baseball positions.</p> <p>There are three positions I am looking for, <code>1B</code>, <code>2B</code>, <code>3B</code>, <code>SS</code>. Let's say <code>A1-A10</code> I have positions. <code>C1-C4</code> a table showing only those positions. </...
<p>If you are just looking to make a column with '1' or '0' in it based on whether or not one of those positions then see if this works for you.</p> <p>=IF(OR(A1="1B",A1="2B",A1="3B",A1="SS"),1,0)</p>
url in browser auto add another `)`? <p>I have a function to return <code>imageUrl</code>,<br> and I check the console is right <code>url(../../../../assets/images/bottom/123.png)</code><br> But I don't know why in browser, it add a <code>)</code> so that it can't find the image</p> <pre><code>function getImage(imageN...
<p>In <code>img src</code> you are supposed to have <code>../../../../assets/images/bottom/123.png</code>, not <code>url(../../../../assets/images/bottom/123.png)</code>. The parenthesis at the end (but nothing at the start) is the result of the browser trying to make sense out of nonsense. <code>url(...)</code> is CSS...
Receiving responses in Android from a Spring REST service <p>I'm working with Android on the front end and I'm using Spring's REST Client libraries to send HTTP Requests to a REST web service. I've read examples online where people use <code>AsyncTask</code> to accomplish this with a <code>RestTemplate</code> in <code>...
<p>From <a href="https://developer.android.com/reference/android/os/AsyncTask.html" rel="nofollow">docs</a></p> <blockquote> <p>AsyncTask enables proper and easy use of the UI thread. This class allows you to perform background operations and publish results on the UI thread without having to manipulate threads and/...
Android: Add a drawable image to users phone remotley <p>I have a list of videos being shown. The user selects the video from a list of categories. From time to time I may have to add new categories (which would mean they would need a image downloaded and shown on there phone.</p> <p>I was going to load the image on s...
<p>It's not possible to add files into drawable after the apk is built. Instead you can download the files and store into <a href="http://developer.android.com/guide/topics/data/data-storage.html" rel="nofollow">device storage</a>. Like sdcard.</p>
ObjC class method is not called. GDB playing games? <p>I have a custom UITableViewController that I am trying to use to manage a UITableView. The flow of my code in the main UIViewController that contains the UITableView goes like below:</p> <pre><code> _messagesTableVC = [[AllMessagesTableViewController alloc] ini...
<p>I created a Messages Extension for the same project in the past and deleted the target while keeping the files in the project. When I re-added the Messages Extension to the project, Xcode kept running the older build of the app. I fixed the issue with Xcode running an older version of the app by:</p> <ol> <li>Clean...
SGE grid job dependency <p>I have a dilemma of streamlining a sequence of SGE grid jobs that have some dependency among them but haven't figured out a correct way of specifying <code>-hold_jid</code>. </p> <p>Suppose we have jobs like:</p> <pre><code>job1: qsub -N job1 ... job2: qsub -N job2 -hold_jid job1 job3: qsu...
<p>Have you tried giving <code>-hold_jid</code> a list of job Id:</p> <pre><code>qsub -N job2 qsub -N job2a qsub -N job3 -hold_jid job2,job2a.${timestamp_of_submission} </code></pre> <p>Alternatively, capturing the job Id should also work:</p> <pre><code>job2a=$(qsub -N job2a.${timestamp_of_submission} | perl -p -e ...
How to copy a file in one directory and move it to the other? <p>So, I am currently in my lab6 folder. In that folder, I have a makefile that is very similar to the one I need in lab7. So, I just want to copy that makefile in lab6 and move it to lab7. My current directory is </p> <p>username:~/fall2016/csc111/labs/lab...
<p>I think this is the basic copy "cp" command. Use this command on your "lab6" directory:</p> <blockquote> <p>cp makefile /path/to/lab7/directory/</p> </blockquote> <p>for example:</p> <blockquote> <p>cp makefile ~/fall2016/csc111/labs/lab7/</p> </blockquote> <p>If this folder and file need root permission, us...
How to upload a downloaded glance image? <p>I have downloaded a glance image from internet and I want to upload it in the set of glance images how do I do that? I am using devstack. My directory is <code>/home/mona/devstack/</code>.</p>
<p>You need to use either the glance client, or better, the openstack client. First, ensure you are authenticated, then issue (assuming last OpenStack version, Mitaka or Newton):</p> <pre><code>openstack image create "Your Image Name" \ --disk-format qcow2 \ --public \ --container-format bare \ --project $keystoneadmi...
Getting error while runing macro on different worksheet but on same workbook <p>I am getting the follwoing error runtime </p> <blockquote> <p>error'1004', select method of range class failed</p> </blockquote> <p>When trying to run the code below on different worksheet but on same workbook.</p> <pre><code>Sub Admin...
<p>Have you tried adding</p> <pre><code>report.Worksheets("administration").Select </code></pre> <p>before </p> <pre><code>report.Worksheets("administration").Range("a2:d100").Select </code></pre>
How to delete an image on key press of backspace or delete in mobile device using jquery or javascript <p>I am trying to display an output, when I type any password image should appear for each text or number or any character, but it should be removed one by one when I press delete or backspace to delete the characters...
<p>Try this, I'm not sure how to get it working on mobile yet, but it should bring you a whole lot closer to functioning code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><cod...
How to compare datetime.now with a certain date? <p>Let's say i have a variable of datetime type; varA = '2016-06-10 12:28:36.697'. What is the best way and how i can compare it with <code>datetime.now</code> to make sure the date is the same regardless of the year?</p>
<p>It's unclear if you want to include the time part of the DateTime as well, or simply the Day and Month. Uncomment/tweak for your use:</p> <pre><code>bool AreEqual(DateTime left, DateTime right) { return left.Day == right.Day &amp;&amp; left.Month == right.Month // &amp;&amp; left.TimeOfDay.Equals(rig...
Overflow-y doesn't work with ng-repeat <p>According to this <a href="http://stackoverflow.com/questions/34698151/ng-repeat-overflows-vertically">Link</a>, div needs to be set to a fixed height, but it doesn't work here with this following code. </p> <pre><code>&lt;div style="margin-top:0.5vh;"&gt; &lt;div style=...
<p>Please check this below code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div style="height:200px;overflow-y:auto;" ng-init="init()"&gt; &lt;div style="min...
Form for each user <p>I have an ordinary form to create a Package object at <code>/packages/new</code>: </p> <pre><code>&lt;%= form_for @package do |f| %&gt; &lt;%= f.text_field :name %&gt; &lt;%= f.text_field :address %&gt; ... &lt;% end %&gt; </code></pre> <p>The package model <code>belongs_to :partner<...
<p>You can send <code>partner_id</code> param with the link which your partner will send.</p> <p>Something like</p> <pre><code>http://website.com/packages/new?partner_id=3 </code></pre> <p>And use the param as <code>hidden_field</code> in the form</p> <pre><code>&lt;%= form_for @package do |f| %&gt; &lt;%= f.text...
Printing Simple Patterns in Java <p>Could someone explain the basics behind printing simple patterns in Java?</p> <p>I'll give one specific example.</p> <p>I'd just like for someone to clarify what each line is doing so I get a better understanding of how this works. Any other explained examples (line by line) would ...
<p>Printing anything or everything via a loop is just about understanding the flow of execution. In your code also, if you'll start watching the flow line by line you'll come to know that how it is working exactly.</p> <p>If you understand how it works, you would be able to print any pattern, but basics should be clea...
How do I call for my stored data, which are strings, in an array? <p>I am trying to get the title to print.</p> <pre><code>import java.text.SimpleDateFormat; public class TheMixtape { private String Title; private String Artist; private String Genre; private int Minutes; private int Seconds; private int Duratio...
<p>Change getTitle() to</p> <pre><code> public String getTitle(int index) { return Title[index]; // the user will have to pass zero-based index } </code></pre> <p><strong>Note</strong></p> <p>The arrays should be part of the class. You declared them in the constructor, at which point they pass out of sco...
How can we remove a ':' characters from a string? <p>I have strings like </p> <pre><code>@lle @mme: #crazy #upallnight: </code></pre> <p>I would like to remove the words which starts with either <code>@</code> or <code>#</code>. It works perfectly fine if those words doesn't contain the ':' character. However, that '...
<p>You can do this:</p> <pre><code>example = example.replaceAll(" +[@#][^ ]+", ""); </code></pre> <p>What this will do is replace any substrings in your string that match the regex pattern <code>[@#][^ ]+</code> with the empty string. Since that pattern matches the words you want to dump, it'll do what you want.</p> ...
How to reproduce the format of git log --oneline --decorate? <p>Where is the format of git log --oneline --decorate defined?</p> <p>Using git Iog --format=format:'my format', I cannot reproduce the colours of the branches, tags and HEAD as shown by git log --oneline --decorate.</p> <pre><code> git log --oneline --de...
<p>It does not appear to be possible with git version &lt; 1.8.3.</p> <p>Since git 1.8.3, one could use the colour %C(auto) token: </p> <pre><code> git log --graph --abbrev-commit --decorate --date=short --format=format:'%C(bold blue)%h%C(reset) %C(bold green)%ad%C(reset) %C(auto)%d %C(reset) %C(white)%s%C(res...
Collecting image from external site <p>I am making a startpage for my browser right now. I would like to put the day's XKCD and place it on my startpage. How can I get the image from xkcd.com and place it on my startpage? Thank you in advance.</p>
<p>Use XKCD's official API to do this..</p> <p>The following link will return a JSON will the url to today's comic</p> <p><a href="http://xkcd.com/info.0.json" rel="nofollow">http://xkcd.com/info.0.json</a></p> <p>Hope it helps!</p>
How to identify the row ranges that contribute into a colour formatted cell which is a subtotal, and applying to across multiple columns? <p>I'm really new in VBA codes and trying to improve to be better. Need help if anyone could assist me further in my codes. Thanks for your patience in advance.</p> <p>What I'm tryi...
<p>Do Until StrComp(ActiveCell.Value, ActiveCell.Offset(1, 0).Value) = True Or IsEmpty(ActiveCell.Value)</p> <pre><code> ActiveCell.Resize(1, 5).Copy ActiveCell.Offset(1, 0).Select Sheets("C").Activate ActiveCell.PasteSpecial ActiveCell.Off...
Can a python function know when it's being called by a list comprehension? <p>I want to make a python function that behaves differently when it's being called from a list comprehension:</p> <pre><code>def f(): # this function returns False when called normally, # and True when called from a list comprehension ...
<p>You can determine this by inspecting the stack frame in the following sort of way:</p> <pre><code>def f(): try: raise ValueError except Exception as e: if e.__traceback__.tb_frame.f_back.f_code.co_name == '&lt;listcomp&gt;': return True </code></pre> <p>Then: </p> <pre><code>&g...
One time Password in Node js <p>I want to use OTP for my node-express API. Right now I am able to personalize things using username and password, but would like to do it using mobile number and OTP. What references can I use for this?</p>
<p><em>See here you have to do it like this</em>:</p> <p><strong>Workflow</strong>:</p> <ol> <li>use Message sending Api like <code>twilio</code>, <code>OpenTok</code> something like that.</li> <li>use <code>Socket.io</code> for real time interaction while sending messages</li> <li><code>speakeasy</code> npm package ...
Transfer a table to Excel in CodeIgniter <p>I tried the code from the link <a href="http://kahayan-faisal.blogspot.com/2012/12/how-to-export-data-to-excel-file-using.html" rel="nofollow">http://kahayan-faisal.blogspot.com/2012/12/how-to-export-data-to-excel-file-using.html</a> to transfer table into Excel but the code...
<p>Your syntax should be:</p> <pre><code>$phpExcel-&gt;getActiveSheet()-&gt;getStyle('A'.$rowexcel.':C'.$rowexcel)-&gt;applyFromArray($styleArray); </code></pre>
YII2 - Mail always saved as files but not sent despite useFileTransport=false <p>I am trying to send mails from Yii2 production site but mails always arrive in runtime/mail folder</p> <pre><code> public function actionTestmail() { Yii::$app -&gt;mailer -&gt;compose(['html' =&gt; 'courriel-test-html...
<p>I solved it by changing the actionTestmail() function like this</p> <pre><code>$mailer = Yii::$app-&gt;mailer; $mailer-&gt;useFileTransport = false; $mailer-&gt;compose… </code></pre> <p>It seems that the line </p> <pre><code>'useFileTransport' =&gt; false, </code></pre> <p>in the config is useless</p>
ActiveMQ configuration <p><a href="http://i.stack.imgur.com/hhbw6.png" rel="nofollow"><img src="http://i.stack.imgur.com/hhbw6.png" alt="enter image description here"></a></p> <p>I'm new to <strong>ActiveMQ</strong> and I'd like to know how and where to add this line of code to enable <strong>MQTT</strong> on my broke...
<p>After you have create a new broker using tool <code>ARTEMIS_PATH/bin/artemis[.cmd in Windows]</code> named for example <code>TestBroker</code>, there will be broker's work path in <code>ARTEMIS_PATH/bin/TestBroker</code>. </p> <p>The file that configure connectors is <code>broker.xml</code> and it will be located i...
Search and replace in only certain tags and attributes in xml file by Regex <p>I have an xml file (call it module.xml) as below opened in editor like Notepad++/Geany:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;layout version="0.1.0"&gt; &lt;default&gt; &lt;reference name="head"&gt; &lt;acti...
<p>Note that this will work with properly formated xml files.</p> <hr> <p>You can use the regex <code>(?=.*\.phtml)module\/</code> and replace with <code>mycompany/module/</code>.</p> <p>This:</p> <pre><code>(?=.*\.phtml) </code></pre> <p>Is a positive lookahead: it will ensure that the regex will be matched in th...
How to send back MS word cursor focus on current document after click in Task Pane <p>I have developed a Word Add-in using word java script API. When i click in Task pane to do some action the cursor focus removes from current document, i am not able to edit the document until click back on the document. Please advice...
<p>This is not possible to do today. The user needs to click back in the document so it gets the focus.</p>
How do I return a snapshot.val() from Firebase to a variable? <pre><code>var getListings = function () { listingsRef.once("value").then(function(snapshot) { console.log(snapshot.val()); }, function (errorObject) { console.log("The read failed: " + errorObject.code); }); }; </code></pre> <p>...
<p>Return a <a href="https://firebase.google.com/docs/reference/js/firebase.Promise" rel="nofollow">Promise</a> from get listing. Consume the Promise using resolve and reject functions.</p> <pre><code>var getListings = function () { return listingsRef.once("value"); }; </code></pre> <hr> <pre><code>var currentSn...
Replacting XML node text using PowerShell <p>I am having my XML document as follows</p> <pre><code> &lt;Batch&gt; &lt;Alter&gt; &lt;ObjectDefinition&gt; &lt;DataSources&gt; &lt;DataSource&gt; &lt;ConnectionString&gt;Provider=SQLNCLI11.1;Data Source=ABC;Integrated Security=SSPI;Initial Ca...
<p>This is best way where I have taken the source from here</p> <p><a href="http://stackoverflow.com/questions/37992689/selecet-xml-nodes-by-similar-names-in-powershell">Selecet XML Nodes by similar names in Powershell</a></p> <pre><code>$XMLA = "D:\employee.xml" $SqlDataBase = [xml](Get-Content $XMLA) $data = $SqlDa...
Html.Raw() and a "TM" character <p>I'm getting xml data which contains some embedded html formatting. I need to display this in an mvc.net razor cshtml page, and I use the Html.Raw() method to do this. However, this same xml data also contains the "TM" characters inline, and for some reason this gets converted into som...
<p>The problem was actually in retrieving the xml- the webclient was defaulting to a latin charset instead of utf-8, so the tm was being garbled in this step. Forcing it to utf-8 fixed the xml and then the html in the page displayed correctly. </p>
String matching with foreach loop in php <p>I am trying to match two strings using <code>foreach</code> loop in php ( laravel framework).</p> <pre><code>$c_act = "ABC123"; foreach ($codes as $cd) { $ac = $cd-&gt;Code; //ac holds our Activity code if ($ac==$c_act) { $act_id = $cd-&gt;ID; ...
<p>Try using this code:</p> <pre><code>$act_id = null; $c_act = "ABC123"; foreach ($codes as $cd) { $ac = $cd-&gt;Code; //ac holds our Activity code if ($ac==$c_act) { $act_id = $cd-&gt;ID; break; } } if($act_id === null){ // there was no match }else{ // there was a match, an...
How to frame following complex structure using dictionaries? <p>I need to pass data with following structure to web service. </p> <p>required structure is :</p> <pre><code>{ "Name":"abc", "fatherName":"xyz", "class":{ "id":"1", "className":"MPC", "classDesc":"Maths,Physics,chemistry" ...
<p>You might need to <code>JsonSerialize</code> the data. Try this.</p> <pre><code>let clas = ["id":"1","className":"MPC","classDesc":"Maths,Physics,chemistry"] let classLeader = ["id":"123","firstName":"def","lastName":"ghi","emailId":"def.ghi@jkl.com"] let classTeacher = ["id":"567894","firstName":"xxx","lastName":"...
View apps by release date in app store <p>There used to be a way in appstore to sort apps by release date. But now in iOS 9 and 10, I am not able to find this. Has this been removed?</p> <p>Thanks</p>
<p>There doesn't seem to be a way to do this in the iOS app itself - Apple appears to have removed that kind of sorting capability some time ago (along with Sort by Rating)</p> <p>This site, however, might be of some use... <a href="http://www.148apps.com/newest-148-app-store-additions/1/any/" rel="nofollow">http://ww...
Spring Boot Microservice: dynamic role, permission based security <p>We have created application using Spring Boot Microservices, application contains jsp pages and rest uri.</p> <p>For this type of architecture expect suggestions to secure pages and uri. I want role and permission based access, where permission conta...
<p>You can use the concept of intercept-url in spring security for this. </p> <ol> <li>Java Based Configuration - h ttp://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle/#authorize-requests</li> <li>XML Based Configuration - h ttp://docs.spring.io/spring-security/site/docs/current/reference/htmls...
Cant sort array of struct <p>I have an array of struct,that I read from the text file.I wrote a sort function,that has to sort this array by the name field in alphabet order(A-Z),but it doesnt work,i dont know what to do,plz,can you tell me my mistake(code compiles,but it doesnt sort anything).</p> <pre><code>#include...
<p>Your for loops look incorrect:</p> <p>Instead of this:</p> <pre><code>for(int i=1;i&lt;8;i++) </code></pre> <p>You should be saying this:</p> <pre><code>for(int i=0;i&lt;8;i++) </code></pre> <p>Otherwise, <code>mass[0]</code> is going to contain garbage data and all sorts of undefined behavior will occur when y...
DB query from PHP gives no result but same query on phpMyAdmin works? <p>So I have a simple query that checks a mySQL database for articles and echos the HTML code to generate my blog dynamically. The query works when I run it directly with phpMyAdmin, but when it's called from the .php file, it show "No Results". Here...
<p>Please change your connect function like below </p> <pre><code>$connection = mysql_connect ("localhost", "root", "redhat") or die(mysql_error()); mysql_select_db('test'); </code></pre> <p>Also please use mysqli as mysql is deprecated in new versions of php</p>
I'm performing an insertion sort and getting an array out of bounds exception in my while loop <h2>Insertion Sort</h2> <pre><code>import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; class solution { public static void main(String[] args) { Scanner sca...
<pre><code>for(int i=0;i&lt;n;i++) </code></pre> <p>i starts from <code>0</code> so first time </p> <pre><code>i=0 j=i </code></pre> <p>and again first time <code>a[j-1]</code> will be a[<code>(0 - 1)</code>] = a[<code>-1</code>] here </p> <pre><code> while((temp&lt;a[j-1]) &amp;&amp; (j&gt;=0)) // array index sta...
XSLT 1.0 Given String break a given position if the position is space otherwise before that word <p>I am new to XSLT, I read some stuff on xslt. I could not able to achieve the solution.</p> <p>My input is like this.</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;root&gt; &lt;line1&gt;Hello world, XSLT is Functional...
<p>In XSLT 1.0 you could use a recursive template to split the string by checking if there is a space in the 20th or 21st position. (Or if the length is less than 20 in the first place)</p> <p>Try this XSLT</p> <pre><code>&lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"&gt; &lt;xs...
Where to get the vertx dashboard monitor? <p>I have seen a couple of times on vertx website a vertx dashboard monitor, that looks like: </p> <p><a href="http://i.stack.imgur.com/FrR9F.png" rel="nofollow"><img src="http://i.stack.imgur.com/FrR9F.png" alt="enter image description here"></a></p> <p>How to setup the d...
<p>The dashboard was built by Eric Zhao one of the Google Summer of Code students in 2016. The dashboard is not part of any official component however the student did a great job modularizing the code and you can see it at the blueprints project:</p> <p><a href="https://github.com/sczyh30/vertx-blueprint-microservice/...
Continue when a Future.failed(new Exception("")) is returned in Scala <p>How do I handle if a future returns a failed exception? </p> <p>The scenario is that my code calls <code>getValue()</code>, maps the result to <code>verifyValue()</code> and then I want to be able to handle the case where the result of getValue()...
<p>Use <code>recover</code> or <code>recoverWith</code></p> <p>recover or recoverWith are called when future fails with an exception. In the recover block you can give the alternative value.</p> <p><code>recoverWith</code> unlike <code>recover</code> takes future of something</p> <pre><code>getValue().recover { case...
redux-observable not exported createEpicMiddleware <p>I am using redux-observable in Ionic2 rc0 and getting below error, any idea?</p> <pre><code>Error: Module /Volumes/data/test/node_modules/redux-observable/lib/index.js does not export createEpicMiddleware (imported by /Volumes/data/test/.tmp/store/index.js) </code...
<p>I haven't used Ionic in years, but a quick look at the Ionic issue tracker suggests this is related to Rollup and affects numerous third party libraries.</p> <p><a href="https://github.com/driftyco/ionic/issues/8322" rel="nofollow">ionic#8322</a> contains numerous examples of this problem, and looks like it then mo...
How can I draw a point with Canvas in Tkinter? <p>I want to draw a point in Tkinter,Now I'm using <code>Canvas</code> to make it,but I didn't find such method to draw a point in <code>Canvas</code> class.<code>Canvas</code> provides a method called <code>crete_line(x1,y1,x2,y2)</code>,so i tried to set <code>x1=x2,y1=y...
<p>There is no method to directly put a point on <code>Canvas</code>. The method below shows points using <code>create_oval</code> method.</p> <p>Try this:</p> <pre><code>from Tkinter import * canvas_width = 500 canvas_height = 150 def paint(event): python_green = "#476042" x1, y1 = (event.x - 1), (event.y...
Cross-thread operation not valid on using Parallel.Invoke <p>I have read many explanations on Threading but it is still quite hard for me to grasp. I tried it in my code and I get an error like so: <em>"Additional information: Cross-thread operation not valid: Control 'dgvLocDatabase' accessed from a thread other than ...
<p>The problem is, that you're trying to modify the UI in a thread other than the thread, the UI was created from. Have a look at the SynchronizationContext class (<a href="https://msdn.microsoft.com/en-us/library/system.threading.synchronizationcontext(v=vs.110).aspx" rel="nofollow">https://msdn.microsoft.com/en-us/l...
Putting a caption and an image inside of a centered div that slides down from the top of the screen <p>I want to make a gallery in HTML/CSS/jQuery. I have a bunch of thumbnails that all represent different images of varying sizes and orientations. When the thumbnail is clicked, I want the image to slide down from the t...
<p>I've made some changes to your CSS if I understood your question it works like expected, look here: <a href="https://jsfiddle.net/cratgjks/" rel="nofollow">https://jsfiddle.net/cratgjks/</a></p> <pre><code>#imgHoverCont{ text-align:center; position:fixed; left:2%; right:2%; top:-96%; bottom:...
Keeping empty column names as such while reading the excel sheet data <p>I am reading an excel file and saving contents to database. I have two columns , first column name is blank and second column name is A. Both columns has rows under it .</p> <p>When I am executing <code>"select * from ["+excel[i]+"]")</code> usin...
<p>I don't think there is a way to avoid this. This is a normal behaviour of OleDB when connected to Excel, if it finds empty columns, it will either take the first row as column name or generate some default names as of F1,F2,F3...etc</p>
Extract specific string part from HTML content with Regex <p>I'm trying to extract with REGEX from the following string:</p> <p><code>&lt;tr class="data"&gt;&lt;td class="first"&gt;&lt;a href="en/clinics/al-khayal-medical-centre-6d15db1f.aspx"&gt;AL KHAYAL MEDICAL CENTRE&lt;/a&gt;&lt;/td&gt;&lt;td class="second not-re...
<p>The modern way of doing this is to use something like BeautifulSoup. One does not try to process mark up using regular expressions anymore because the resulting code is unreadble and even the slightest change to the markup can break your beautifully crafted regular expression.</p> <pre><code>from bs4 import Beautif...
C++ Error in password cracking <p><a href="http://www.cplusplus.com/forum/beginner/182115/" rel="nofollow">http://www.cplusplus.com/forum/beginner/182115/</a></p> <p>I tried to run the code in the link above. But, the output is a bit weird: 1. Why it can't match 2+ words/numbers? 2. Why if I input 2+ words, it always ...
<p>If you would have actually read, the code in that link is not functional.</p>
Add custom classname to jquery calendar cell <p>I am using Jquery calendar. I am trying to insert a new class name to each cell of calendar. It gets added but it is getting removed as and when the calendar is clicked. </p> <p>Basically it refreshes the calendar on every click so newly added class is getting removed on...
<p>Use callback functions of Datepicker Widget</p> <pre><code> $('#DatePicker').datepicker({ //The calendar is recreated OnSelect for inline calendar onSelect: function (date, dp) { updateDatePickerCells(); }, onChangeMonthYear: function(month, year, dp) { updat...
Gzip no such file or directory error, still zips files <p>I'm just learning shell scripting specifically in bash, I want to be able to use gzip to take files from a target directory and send them to a different directory. I enter directories in the command line. ext is for the extensions I want to zip and file will be ...
<p>There are two separate things causing problems here. In your outer loop</p> <pre><code>for ext in $*; do done </code></pre> <p>you are looping over all the command line parameters, using each as the extension to search for - including the directory names.</p> <p>Since the extension is the third parameter, you onl...
python writing list to text file result in different lengths <p>i have 2 lists of strings with the same length but when i write them to a file where each item appear on separate lines in the file, they length of the list and file do not match:</p> <pre><code>print len(x) print len(y) 317858 317858 </code></pre> <p>H...
<p>The only possible way for finding more lines in b.txt than the number of string written is that some of the strings in <code>y</code> actually contain new lines.</p> <p>Here is a small example</p> <pre><code>l = [ 'a', 'b\nc'] print len(l) with open('tst.txt', 'wb') as fd: for i in l: print &gt;&gt; fd...
How to draw view from center android layout <p>I need to design following screen but I am not sure how to draw a vertical line that will be center of the <code>imageview</code> present inside my <code>cardview</code></p> <p>my current xml code is</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearL...
<p>The simple aproach to solve your problem (it's not a perfect solution, but in your case, I think it will be enough):</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" ...
Cut lines using Notepad++ Regexp replace <p>I need to cut lines that have 6 or more characters, hyphen, then other characters or symbols. Hyphen and rest of line should be removed. Source text:</p> <pre><code>0402CS-2 0402CS-3 0402 7812-C 0603CS-1 0603CS-2 0603CS-3 </code></pre> <p>As a result, I need this:</p> <pre...
<pre><code>^([^\n\-]{6,})\-.+$ ^^ </code></pre> <p>Just use <code>\n</code> as due to <code>[^-]</code> the regex can traverse to line below as use that line to make a match.</p> <p>See demo.</p> <p><a href="https://regex101.com/r/BHO93c/1" rel="nofollow">https://regex101.com/r/BHO93c/1</a></p> <p>for the inpu...
Wildfly 10 Windows authentication <p>I got stuck on servlet's and security filter for a java web application. so I got my web.xml which looks like this:</p> <pre><code>&lt;!-- &lt;distributable/&gt; --&gt; &lt;filter&gt; &lt;filter-name&gt;com.company.xxx.xxx.xxx.SecurityFilter&lt;/filter-name&gt; &lt;filter-class&gt...
<p>Alright so I kept diging and after a night of sleep I thought about trying something new. </p> <p>Since I got the problem of already having a custom securityFilter that blocks waffle to perform correctly (even with filter jumping with dispatcher etc). My eyes caught something interesting.</p> <p>Waffle set a Heade...
How can I make a div having more than 4 corners <p>I have to make a <code>div</code> using HTML and CSS only but not using any background image with more than 4 corners.</p> <p><img src="http://i.stack.imgur.com/pUxp3.png" alt="i want t make exactly this thing using html and css"></p> <p>How can I do it?</p>
<p>You can use <code>pseudo-element</code> and some css shape tricks to achieve this. </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>.folder{ width: 190px; height:...
Getting radio button value and storing in php <p>this is radio button code now what if radio button does not have a constant name how would i store the data in database because to store the data in database we will need a name of form attribute</p> <pre><code>$sql1="select * from questions where email='". $_SESSION...
<p>Create an array at the end of while loop like this :</p> <pre><code>while ($result = mysqli_fetch_array($row)) { ?&gt; &lt;h2 id="question_&lt;?php echo $result['qid'];?&gt;"&gt;&lt;?php echo $result['qid'].".".$result['question'];?&gt;&lt;/h2&gt; &lt;input type="radio" value="&lt;?php echo $result['answer1'];...
Facebook Graph API: read messages in v2.8 <p>since <code>read_mailbox</code> is deprecated, I was wondering if there's still a possibility to get all of my messages via API or any other service?</p> <blockquote> <p>/v2.4/{user_id}/notifications operations as well as read_stream, read_mailbox, and manage_notification...
<p>No, there is no possibility to get access to the user messages anymore, you can only get messages of a Page with the conversations endpoint.</p>
A custom label "[Imap]/Trash" found to be just "Trash" while fetching folders via mail core 2, how can I fix this? <p>I am using mail core 2 to fetch folders in iOS app (objective C). I have a custom label named [Imap]/Trash in one of the email account ([Imap]/Trash can be created as a custom label), while fetching fol...
<p>1.The challenge is that Gmail uses "Labels" to attach to messages, and messages can have zero or more than one label, while IMAP puts messages in folders (Inbox, Trash, etc) and every message is in one, and only one folder. Thus, when Mail.app tells the Gmail server to delete a message from the Inbox the Gmail serve...
Disjoint set find & union operation's complexity <p>I'm studying algorithm about disjoint sets. </p> <p>And the chapter of <code>Fast FIND Implementation (Quick Find)</code></p> <p>The data structure is shown below:</p> <p>for example) </p> <pre><code>int array[5] [0] = 3, [1] = 5, [2] = 7, [3] = 1, [4] = 2, </cod...
<p>We want to make the total complexity for all operations as minimum as possible. </p> <p><strong>Total complexity = complexity(FIND) + complexity(UNION)</strong> </p> <p>As you stated if we are given that a sequence of n - 1 unions take O(n^2) time in the worst case. And find takes O(1) on average.</p> <p>So for n...
Wildfly war deployment get path to resource file <p>I have a web-application which uses an external tool to create reports. This tool needs an absolute path to the template i want to generate the report from.</p> <p>I deploy the templates as a resource included in my war file.</p> <p>When using an exploded war I can ...
<p>You'd have to use the <code>getResourceAsStream()</code> and write the contents to a known location. You could use something like the following to copy the template in your deployment to a temporary file.</p> <pre class="lang-java prettyprint-override"><code>final InputStream in = Thread.currentThread().getContextC...
How to do ADF data binding for Swing Components in JDeveloper 12 c? <p>as there is no drag and drop feature not available for Swing data Bindings from Data Control in JDeveloper 12c ,how to do it tell me clearly if possible i am new to Oracle ADF or provide any resources for learning that swing components binding.</p>...
<p>ADF Swing binding is deprecated in 12 - instead you should use "regular" swing development to bind to backend data.</p>
Update contact name in address book programatically? <p>I got a message contact is successfully updated but in contact application not display updated name.</p> <p><strong>I have call below method for updating my contact name.</strong></p> <pre><code>-(void)updateAddressBook { CFErrorRef *error = NULL; ABAdd...
<p>You have to do a ABAddressBookSave to commit the changes.</p> <p>Try the following - </p> <pre><code>ABAddressBookSave(addressBook, error) </code></pre>
Increase value of a text box while click on corresponding button in same row ionic <p>I am a newbie to ionic and angular. I have created a form with ng-repeat as shown. I have a text box and a button for each text box. I want to increase value of the text box while click on corresponding button near text box.</p> <pre...
<p>You should first link a separate value to each text box </p> <pre><code>ng-model="items[$index].nos" </code></pre> <p>and after that, in the controller increment that value like this:</p> <pre><code>$scope.increment_nos = function (index) { items[index].nos = items[index].nos + 1; } </code></pre> <p>but firs...
Java PL/SQL 'Execute Immediate' <p>I am programming Java application on Oracle database. The PL/SQL statement I am using is:</p> <pre><code>DECLARE USER_COUNT INTEGER; BEGIN SELECT COUNT(*) INTO USER_COUNT FROM dba_users WHERE username=?; IF (USER_COUNT = 0) THEN EXECUTE IMMEDIATE 'CREATE USER ? IDENTIFIED BY ...
<p>If <code>?</code> is a bind variable, you can't use those in a <code>create user</code> statement. It needs the complete literal text.</p> <p>btw did you really mean <code>CREATE ANY INDEX</code>? That will let the new user index any table in the entire database. Normally plain <code>CREATE INDEX</code> should be s...
Outdated thread <p>Outdated thread:) I have already received the help that I need. Thank you StackOverflow.</p>
<p>Your biggest mistake is to ignore what kind of language you are using. Your style is imperative, not object oriented.</p> <p>What you want to do is to create classes to handle those things, like cardHand or scoreTable. Then you give them methods like getBestHand. The part of the code in which you print out stuff sh...
By clicking an item in IFrame (Inline Frame) i need to route to specific URL <p>Hi am using i frame in one component of my angular 2 application. </p> <p><strong>Component.ts</strong></p> <pre><code>import { Component, OnInit } from '@angular/core'; import { SafeResourceUrl,DomSanitizer,} from '@angular/platform-brow...
<p>Add id to your frame and then use contentWindow.document.body.onclick on iframe element</p> <pre><code> &lt;iframe id="iframe_id" src="https://sampleurl" style="margin-top:-10px" frameborder="1" webkitallowfullscreen mozallowfullscreen allowfullscreen&gt; &lt;/iframe&gt; constructor(private _router:...
Reduce number of queries for JPQL POJO containing an entity <p>Entity relation: Transaction(@ManyToOne - eager by default) -> Account </p> <pre><code>String sql = "SELECT new com.test.Pojo(t.account, SUM(t.value)) FROM Transaction t GROUP BY t.account"; List list = entityManager.createQuery(sql).getResultList(); </cod...
<p>Try marking the <code>@ManyToOne</code> field as lazy: </p> <pre><code>@ManyToOne(fetch = FetchType.LAZY) private Account account; </code></pre> <p>And change your query using a <code>JOIN FETCH</code> of the <code>account</code> field to generate only one query with all you need, like this:</p> <pre><code>String...
Undo a merge after time, what happens? <p>How do i undo a merge that has been pushed and later been branched off? And what happens to the repo?</p> <p>This has been asked in different variations before but im not sure if any of the answers explains what happens after.</p> <p>Assume this is the state of the repo:</p> ...
<blockquote> <p>What i want is to undo the merge and continue working on the DEF branch</p> </blockquote> <p><a href="https://git-scm.com/blog/2010/03/02/undoing-merges.html" rel="nofollow">Undoing a merge through a revert</a> is one way which at least does not change the history of the main branch</p> <pre><code>g...
How to remove hash tag from the URL for a single page in Angular js <p>I want to remove hash tag (#) from the URL for a single page in angular js. Here is my code:</p> <pre><code>angular.config(['$routeSegmentProvider','$locationProvider' function ($routeSegmentProvider,locationProvider) { $routeSegmentProvider ...
<p>Try to add <code>&lt;base href="/"&gt;</code> right after your <code>&lt;meta&gt;</code> tags in your index.html file.</p>
VBA if with InStr <p>I'm trying to write a VBA code with if the i get an error.</p> <p>I want the code to check if one of the values ("S925,S936,S926,G") is not on cell 10.</p> <pre><code>Sub checklist() Dim x Dim LineType NumRows = Cells(Rows.Count, "j").End(xlUp).Row For x = 2 To NumRows If LineType = "G"...
<p>This won't cause an error but it will cause issues with your program so I'll explain it.</p> <p><code>InStr</code> doesn't return a Boolean but the index of the first occurrence of the search string. If the string isn't found it returns 0. For example <code>InStr("12345", "23")</code> will return 2.<br> Because ev...
Loop of function for taking multiple audio files from a directory <p>I am currently taking input from a directory, for a single audio file and I am saving my output in CSV file, with the file name and converted speech to text output but I have 100 files in that directory (i.e 001.wav,002.wav,003.wav..........100.wav)</...
<p>You can get all files of a directory and subdirectory with <code>os.walk</code>, which I have included in the <code>get_file_paths()</code> in the code below, here is an example:</p> <pre><code>import speech_recognition as sr import csv import os DIRNAME = r'c:\path\to\directory' OUTPUTFILE = r'c:\path\to\outputf...
SpliteViewController setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key _masterColumnWidth in iPad <p>I have upgraded application to <code>iOS 10</code> and <code>XCode 8</code>, after upgrading application is crashing in iPad with log as follows:</p> <blockquote> <p>*** Terminating...
<p>Since iOS 10 access to this internal property is not possible. Generally speaking, accessing these kind of properties is a risky practice. You should use either appropriate properties or methods to modify the master column's width:</p> <p><strong>1. Properties</strong></p> <pre><code>objSpliteViewController.maximu...
Answer prompt on remote machine via script <p>Following situation:</p> <p>From a Windows machine, I log into a remote Linux machine via</p> <pre><code>plink -v hostname -l username -pw password </code></pre> <p>Upon logging in, I am greeted with a 'Welcome to AIX Version 5.3!' and asked to choose a login case (at wh...
<p>I found a solution:</p> <pre><code>plink -v hostname -l username -pw password &lt;&lt; input.txt </code></pre> <p>where input.txt is:</p> <pre><code>2 1 exit </code></pre> <p>Additionally, all commands which I would like to give to the remote terminal can be included in this input.txt file.</p>
Exception is thrown when tried to run a jmeter test having websocket sampler in it , on remote host <p>I am trying to run a jmeter test script which has a single websocket sampler.It works fine when i run it from single machine through java GUI or command line.</p> <p>But , When i try to run it on remote host (by runn...
<p>According to the error message, it looks like the WebSocket plugin is missing on the remote slave. The main pre-requisite of <a href="https://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.pdf" rel="nofollow">distributed JMeter tests execution</a> is having <strong>the same</strong> JMeter vers...
Dynamics CRM lookup to quote products (aka quote details) <p>I'm using CRM 2016 quotes and quote products (quote details). Business requirement is to have a possibility to specify requested delivery dates to each quote product. There might be several delivery dates to one quote product. I want to create custom entity "...
<p>You can't create 1:N relation from entity 'quote details' the only option is N:N and N:1.</p>
Concurrent Usage Of Tweetinvi Auth Class <p>We are developing a social media monitoring appliction in ASP.NET (C# - Framework 4.0) and using Tweetinvi library for Twitter. We must send tweets and search for varius twitter users in same time. In order to publish tweets we must firstly set the access tokens in Auth cla...
<p>I am the main developer of Tweetinvi.</p> <p>PLEASE READ THIS POST ENTIRELY so that you have a good understanding of the subject.</p> <p>Tweetinvi <code>Auth</code> class is storing the credentials as a per thread static variable.</p> <p>What this mean is that for every Thread in which your application store its ...
Convert varchar time (for time > 24 hours) to float <p>I have a column with time records that represent the difference between two dates. Some of these records exceed 24 hours. </p> <p>As time syntax doesn't account for time records > 24 hours, I've had to convert these records to varchar hh:mm:ss as outlined in the s...
<p>Thanks for the helpful posts, I took the advice of the original comments in that it's a lot easier to calculate the difference between dates as a number and convert this later in the presentation layer (Excel). </p> <p>To do this, I used DATEPART logic to sum day,hour,minute,second together to derive a 'decimal da...
How to fetch json data from Mysql and convert it to an array in CodeIgniter <p>I have get the MySQL result as below format. I want to send this as JSON array format in an app.The keyword data are stored JSON array format in db. How to send this as JSON array ? </p> <p><strong>MySQL RESULT</strong></p> <pre><code>Arr...
<p>First create a php array in the way you want to encode in-side the function or use the below sample in model (which extends CI_Model)</p> <pre><code>$query_result = $result-&gt;result(); //for get result array return json_encode($query_result); </code></pre> <p>sample</p> <pre><code> $array = array("test"=&gt...
What does $uid and auth.uid stand for? <p>Was going through some articles for understanding <strong>Rules &amp; Permissions</strong> in Firebase and then came across conditions like this, for <code>write</code> operation :</p> <pre><code>{ "rules": { "users": { "$uid": { ".write": "$uid === auth.ui...
<p>Lets start with auth.uid, this stands for the uid of the authenticated user. Next up are $user and $article, these wildcard paths so they can be anything, not only push id's. Check out <a href="https://firebase.google.com/docs/database/security/securing-data#predefined_variables" rel="nofollow">the docs</a> for mor...
Python: ImportError: No module named 'tutorial.quickstart' <p>I am getting import error even when I am following the tutorial <a href="http://www.django-rest-framework.org/tutorial/quickstart/" rel="nofollow">http://www.django-rest-framework.org/tutorial/quickstart/</a> line by line.</p> <pre><code>from tutorial.quic...
<p>Make sure your tutorial.quickstart is in the same folder as your project. Also make sure it is unzipped ! Otherwise use a absolute path.</p> <p>Hope it helps !</p>
How to code in selenium-webdriver when entering a value and then entering that value in another screen without making it hard-coded? <p>How to code in selenium-webdriver when entering a value and then entering that value in another screen without making it hard-coded?</p> <p>first screen: ID is "workorder", entered va...
<pre><code> WebDriver driver; driver=new FirefoxDriver(); String a=driver.findElement(By.id("")).getText();//Fetch id of first screen driver.navigate().to("The second screen"); driver.findElement(By.id("")).sendKeys(a);//fetch id of second screen and put the value of the first screen </code></pre> <...
how to return from doInBackground only after the the thread inside it is finished <p>I started a Volley JsonObject Request from asynctak and i want to return from doinBackground after the volley request is completed. I know it return from the doInBackground after it successfully started the thread. But how do i return ...
<p>I think you've misunderstood something about the <em>async</em> part of <code>AsyncTask</code>. It means it runs <strong>asynchronously</strong></p> <p>Sure your code will run, but while Volley is running in a separate thread, you've gone ahead to <code>return mJsonWeather[0];</code>, which is null. </p> <p>No Asy...
jQuery, find next element with id <p>I have the following HTML:</p> <pre><code>&lt;input id="A1" type="radio" name="A"&gt; &lt;label for="A1"&gt;A1 &lt;div class="menu" id="menu1"&gt; &lt;img class="button" id="edit1" src="Aa.png"&gt; &lt;img class="button" id="remove1" src="Ab.png"&gt; &lt;/div&gt; &lt;/la...
<p>The <code>.menu</code> element is not the <em>next</em> element (sibling) after the <code>label</code>, it's a <em>child</em> element. So you want <code>children</code> (or <code>find</code> if it could be deeper), not <code>next</code>:</p> <pre><code>$("label").hover( function() { $(this).children(".menu")....
Is there any way to populate created data in sails js (mongodb) <p>i have a model named Business which have a feild address with type modal: Address, i want to send the address object with business data instead of only id when the business is created.. simple create method is just return id of created address object i...
<p>The <code>create</code> class method does not support <code>populate</code>, so the way you're doing this is correct. If you'd like to propose this as a feature, please check out the Sails.js project's <a href="https://github.com/balderdashy/sails/blob/master/CONTRIBUTING.md#v-proposing-features-and-enhancements" r...
tensorflow build fail at october 6 2016 <p>Ubuntu 16.04</p> <p>gcc 5.4.0</p> <p>java 1.8.0_91</p> <p>bazel 0.3.1 (download the releases , haven't build from source because it build fail)</p> <p>I change the config file follow the discussion <a href="https://github.com/tensorflow/tensorflow/issues/4371" rel="nofollo...
<p>This is a bug in protobuf, we signaled it already two weeks ago. See <a href="https://github.com/google/protobuf/issues/2133" rel="nofollow">https://github.com/google/protobuf/issues/2133</a></p>
toggle background color of selected list item react.js <p>what i want to do it when i click on one of the list items i want the class selected to be applied and when i click again i want it to be removed, so basically a toggle function, but it happens to all 3 list items, so if i click on one, all get selected, but i w...
<p>In your case <code>selectedCircle</code> has the same value for all list items. If you click on one of list items <code>selectedCircle</code> changes for the other ones too.</p> <p>Thus, you need for every list item the different piece of state. </p> <p>You can try something like this : </p> <p>First change your ...
Unhandled Promise rejection: Cannot call method 'push' of null <p>I have an issue I just cannot seem to understand. If anyone could offer some advise I would appreciate it.</p> <p>I am using Ionic2 with Meteor/Mongo to build a Chat App.</p> <p>I have the following code:</p> <pre><code> private findChats(): Promise&...
<p>The answer will probably not be relevant to many people, but as Anton pointed out, that it is an issue to do with the promise loading asynchronously.</p> <p>I had an event that was calling the same promise at the same time. As soon as I remove the trigger to that event, I don't get any errors. </p>
List all installed programs on windows using PHP <p>How can I list all installed programs in windows using php or how can I search for a installed program in windows using php?</p>
<p>Not sure you can, PHP is a server side language and as such is run on the server and presented to the end user. You would need something on the end users PC to interact with Windows and then pass that information to PHP using something like AJAX.</p>
Best place to hook path conversion in to Emacs under Windows <p>I use <a href="https://www.gnu.org/software/emacs/manual/efaq-w32.html" rel="nofollow">GNU Emacs on Windows</a> with <a href="https://git-for-windows.github.io/" rel="nofollow">git-bash</a> for unix tools like <code>locate</code>, <code>grep</code> and <co...
<p><a href="http://stackoverflow.com/users/2415684/jenesaisquoi">jenesaisquoi</a>'s comment brought me to <a href="https://www.emacswiki.org/emacs/cygwin-mount.el" rel="nofollow">cygwin-mount.el</a>. I tried it with <em>gitbash</em> - and it magically works!</p> <p>The reason is that <em>gitbash</em> provides a simila...
Angular's bindings don't work with elements added in directives <p>My directive is</p> <pre><code>myApp.directive('myRequired', function ($compile, gettextCatalog) { return { link: function (scope, element, attrs) { var noticeContainer = '&lt;div class="inputError" ng-show="showSomeNotices" tra...
<p>Mentioned in the comments above you must compile the string like this:</p> <pre><code>… var noticeContainer = '&lt;div class="inputError" ng-show="showSomeNotices" translate&gt;{{errorMessage}}&lt;/div&gt;', content = $compile(noticeContainer)(scope); element.after(content); … </code></pre> <p>I've create...