input
stringlengths
51
42.3k
output
stringlengths
18
55k
Moving a response into table <p>I have a response given below, I need to move program details into an array and show them in table. But I am getting undefined message since, programdetails is again an array.my programdetails is stored in <code>newprogramdetails[]</code> if I give ng-repeat it gives duplicate error.</p>...
<p>You dont need for loop for this.</p> <p>Correct approach to solve your issue is:</p> <pre><code>&lt;tr ng-repeat="item in json.response.data"&gt; &lt;td&gt;{{item.programdetails.title}}&lt;/td&gt; &lt;td&gt;{{item.programdetails.description}}&lt;/td&gt; &lt;td&gt;{{item.programdetails.createddate}}&lt;...
Style first word of paragraph <p>I am trying to style the first word of a paragraph, but it is not working. Can anyone help. I can style the first letter, but not the first word. I have reasons to not use <code>&lt;span&gt;</code> to do this. <strong><a href="https://jsfiddle.net/pjthqaz8/" rel="nofollow">JSFiDDLE HERE...
<p>there is no pseudo class for :first-word in css they only have :first-line and :first-letter if you need to style that you can do it by adding span tag and applying class to first word.</p> <p><a href="http://www.w3schools.com/css/css_pseudo_elements.asp" rel="nofollow">http://www.w3schools.com/css/css_pseudo_eleme...
Get data with db with lambda expression and coalesce <p>I have a question about coalesce and lambda expression. I'm reading from a SQLite database some records but not always there are some of them. For example</p> <pre><code>return db.GetItems&lt;Appointment&gt;().Where(l =&gt; l.AppointmentId == appointmentId).First...
<p>Use <a href="https://msdn.microsoft.com/en-us/library/bb340482(v=vs.110).aspx" rel="nofollow"><code>FirstOrDefault</code></a> instead of <code>First</code>. It returns default value if the sequence contains <strong>no</strong> elements. And also you don't need the null conditional operator.</p> <pre><code>return db...
Spring Scheduler synchronized method starvation <p>Assume I have a scheduler</p> <pre><code>@Component public class Scheduler{ private static int counter = 0; private synchronized void countIt(){ counter++; } @Scheduled(fixedDelay = 3000) public void job1(){ countIt(); } ...
<p>This should not deadlock.</p> <p>A Deadlock is caused by one thread locking resource <code>A</code> and then attempting to lock resource <code>B</code> while another thread locks resource <code>B</code> and then tries to lock resource <code>A</code>. There are more complex ways a deadlock can occurr but deadlocks c...
Shell Script : How to use Tee command with sed command <p>Before:</p> <pre><code>main 2&gt;&amp;1 | tee -a $log_file; </code></pre> <p>This is working fine but it is throwing stderr in $log_file as shown below. I want to replace:</p> <pre><code>"ERROR (version 5.3.0.0-213, build 1 from 2015-02-02_12-17-08 by buildgu...
<p>You should precise your need, it's pretty hard to read your code by now.</p> <p>There is two option here : </p> <ul> <li>You get the mainstream and alternate him before saving into your log file</li> <li>You format your log file at the end</li> </ul> <p><strong>First option</strong></p> <p>I can't test it, howev...
Angular2 Prevent queuing http requests when there is any pending request <p>Let's assume I want to pull data from backend each 15 seconds. My code now looks like this:</p> <p><strong>TestComponent:</strong></p> <pre><code>public ngOnInit(): void { Observable.timer(0, 15000).subscribe(() =&gt; { this.callS...
<p>According to second point, you have two possibilities:</p> <pre><code>Observable.first().subscribe(...) </code></pre> <p>or</p> <pre><code>Observable.take(1).subscribe(...) </code></pre> <p><code>first()</code> means that <strong>Observable</strong> will emit only 1 item from the source. <code>take()</code> allo...
convert signed to unsigned value in C <p>I have got a negative value somehow which I need the equivalent positive value. I though adding MAX + 1 to that value, where MAX is the maximum value that can be represented with that many number of bits, we can resolve this issue. But it did not help. For example please look at...
<p>I think what you are looking for is the 2's complement:</p> <pre><code>{ unsigned long long u; u = 0xffffffff38034080; u = ~u + 1; printf("0x%llx", u); } </code></pre>
Javascript to cut same second character on a text <p>For example I have text: </p> <pre><code>var x="default_1305, default_1695, default_1805"; </code></pre> <p>I want to cut before the second comma to get this text:"default_1305, default_1695". </p> <p>How can I do this?</p>
<p><code>var x="default_1305, default_1695, default_1805";</code></p> <p>string can be split by , like below:</p> <p><code>var res = x.split(",", 2);</code></p> <p>Note 2 here in the second param.</p> <p>And if needed as string, then</p> <p><code>var res_string = res.join(",");</code></p> <hr> <p><strong>Edit</s...
Filter with elasticsearch <p>I want to fetch a range of date with a specific id, but my result is including other id's in it. I need help checking the query.</p> <p>This is what am trying to do</p> <p>Fectch all documents where <strong>uniqueid</strong> == 1 and <strong>start</strong> range from 2016-10-11T12:00:30.0...
<p>You need to remove the empty line below the URL path</p> <pre><code>GET _search &lt;--- remove this line { "query": { </code></pre> <p>Like this:</p> <pre><code>GET _search { "query": { </code></pre>
concrete5 no name no description no styling of theme <p>I have installed my theme in C:\xampp\htdocs\projects\c5\surreymarketingpr_gmk\packages\dotawesome_warm\themes\dotawesome its working fine on localhost but not on live site. Also its an older version of concrete5 because this theme is not compatible with the lates...
<p>You aren't really giving enough information here. Not working is not very helpful. What do your error logs contain? What's the website URL?</p> <p>There are several things that can impact uploading to an online host, such as PHP version, MySQL version, .htaccess settings, file permissions, etc.</p> <p>Another ve...
Combine jquery on form submit with plugins for inputs <p>Im using jquery and a few input plugins like sliders checkboxes etc. However in that form I have on form change submit (GET filtering). Here the action will not be triggered if plugin changes the input value field.. only if the user did it.</p> <pre><code>$(docu...
<p>It seems that you would like to combine two events. you can combine multiple events with multiple selectors.</p> <ul> <li>Check event type <code>e.type</code></li> <li>Check element id <code>e.target.id</code></li> </ul> <p><strong>Example</strong></p> <pre><code>$(".select_all, #form-onchange-submit").on("click...
Configure mobilefist operational analytics with *websphre application server (network depoyment) cluster* on a separate machine(server) <p>Currently I have configured mobilefirst server 7.1 on websphere application server <strong>cluster</strong> with two nodes (two machine). </p> <p>My reference : <a href="https://ww...
<p>Analytics is not a relational database. Analytics uses Elasticsearch as it's method of storing information. </p> <p>Elasticsearch is a search engine based on Lucene. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.</p> <p>Elasticsearc...
Why do XMPP messages sometimes get lost on mobile devices <p><a href="http://stackoverflow.com/questions/9690020/lost-messages-over-xmpp-on-device-disconnected">This question</a> asks what to do about loosing XMPP messages on mobile devices when they don't have a stable connection, but I don't really see why the packag...
<blockquote> <blockquote> <p>Why isn't TCP enough to ensure a proper transmission (or proper error handling, so the server knows the message has to be sent again) in this scenario?</p> </blockquote> </blockquote> <p>Application gives the data that needs to be sent across to its TCP. TCP segments the data as ne...
Redirecting to page based on today's date isn't working <p>I'm not very familiar with scripts, etc... and I have a very precise question. On one of my pages I want to redirect to a page, based on today's date. Searching the web, I've come up with something like this at the moment :</p> <pre><code>&lt;html&gt; &lt;head...
<p>Remove the <code>date</code> argument passed to the <code>Date()</code> and wich is defined nowhere, and the script will work fine. This variable is not defined and cause an error, the script will not continue.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <di...
How to upgrade VSIX to make it compatible with VS 15 Preview 5? <p>When I try to install my VSIX to <a href="https://blogs.msdn.microsoft.com/visualstudio/2016/10/05/announcing-visual-studio-15-preview-5" rel="nofollow">VS 15 Preview 5</a> I get the warning </p> <blockquote> <p>"This extension is not compatible with...
<p>You can download upgrade documentation to VSIXv3 from <a href="https://aka.ms/vs15preview5extensionsdk" rel="nofollow">this link</a>.</p> <p>Mostly you should use VS "15" and add <code>&lt;GenerateVsixV3&gt;true&lt;/GenerateVsixV3&gt;</code> to your project file. That will add <code>manifest.json</code> to your new...
How to remove duplicate values from array in foreach loop? <p>I want to remove duplicate values from array. I know to use <code>array_unique(array)</code> function but faced problem in <code>foreach</code> loop. This is not a duplicate question because I have read several questions regarding this and most of them force...
<p>It is very complicated to remove duplicate values from array within foreach loop. Simply you can push all elements to one array and then remove the duplicates and then get values as you need. Try with following code.</p> <pre><code> $listImages=array(); $images = scandir($dir); foreach($images as $image){ ...
Java regex pattern group capture <p>I'm trying to split the string below into 3 groups, but with it doesn't seem to be working as expected with the pattern that I'm using. Namely, when I invoke <code>matcher.group(3)</code>, I'm getting a null value instead of <code>*;+g.3gpp.cs-voice;require</code>. What's wrong with ...
<p>The result you get does actually match your pattern in a non-greedy way. Group2 is expanded to the shortest possible result </p> <pre><code>*;+g.oma.sip-im </code></pre> <p>and then the last group is left out because of the question mark at the very end. It appears to me that you are building a far too complicated...
Cannot pass size_t *arg[] to function requiring array of void pointers <p>My function <code>f(void *data[])</code> is supposed to receive an array of generic pointers as an argument, as far as I understand. Nonetheless, I get a compilation error when I try to do</p> <pre><code>size_t *cnt[8]; ... // initialize pointer...
<blockquote> <p>g++ automatically converts the prototype of <code>f</code> into <code>f(void**)</code></p> </blockquote> <p>I find that using exact terminology helps understand programming languages better. It may be confusing to think that <code>f</code> is <em>converted</em> into <code>f(void**)</code>. That's not...
Issue in php with "header" <p>I am developing an android app that download songs(so type of data is blob) from db.</p> <p>I have the following download image code example:</p> <pre><code>&lt;?php if($_SERVER['REQUEST_METHOD']=='GET'){ $id = $_GET['id']; $sql = "select * from images where id = '$i...
<p>You'll want to send the following header for a .mp3 file:</p> <pre><code>Content-Type: audio/mpeg3 </code></pre> <p>Refer to <a href="https://www.sitepoint.com/web-foundations/mime-types-complete-list/" rel="nofollow">https://www.sitepoint.com/web-foundations/mime-types-complete-list/</a> for a good list of MIME t...
Twitter bootstrap typeahea - get value and id <p>i try to get a value and the id from this data-set. </p> <p>Gettin one think is easy, but i dont know how i can get the second information?</p> <p>Importang to know is, that in my site can be a dynamicly number of input fields wich all have to use this function.</p> <...
<p>To get more than one values from your dataset, you have to transform your result set and return a key-value pair. So in the example below, the <code>response</code> is a JSON string that I receive, and then I get all the values I need.</p> <blockquote> <p>A friendly reminder to everyone who are still using Twitte...
Linux IF & Else using awk or grep <p>I have an output in one column. I need to compare if any value is greater then 3 then print "value is greater than 3"</p> <pre><code>Column 2 4 5 6 7 </code></pre>
<p>try this;</p> <pre><code>awk '$1 &gt; 3' yourFile </code></pre> <p>Eg;</p> <pre><code>user@host $ awk '$1 &gt; 3' test Column 4 5 6 7 </code></pre>
How to configure nginx for django with gunicorn? <p>I have successfully run gunicorn and confirmed that my web runs on localhost:8000. But I can't get nginx right. My config file goes like this:</p> <pre><code> server { listen 80; server_name 104.224.149.42; location / { proxy_pass http://127.0....
<p>Do this</p> <ul> <li>Remove <code>default</code> from <code>/etc/nginx/sites-enabled/default</code></li> </ul> <p>Create <code>/etc/nginx/sites-available/my.conf</code> with following</p> <pre><code>server { listen 80; server_name 104.224.149.42; location / { proxy_pass http://127.0.0.1:8000; } } </code><...
asp.net query c# error <p>I was working with ASP.NET and I try to change a label text and get the value from data base. here is what i do.</p> <p>First I add database then I create a linq and then I use query to load it but it won't work.</p> <p>this is query code</p> <pre><code>protected void Page_Load(object sende...
<p>Linq queries return an <code>IEnumerable&lt;T&gt;</code> and you want to access a specific item in the collection, to a specific property. Use <code>FirstOrDefault()</code>. <em>(Read <a class='doc-link' href="http://stackoverflow.com/documentation/c%23/68/linq-queries/329/first-firstordefault-last-lastordefault-sin...
C# Winforms SQLAuthentication fails when running exe from share, works running locally <p>I have a Windows Form app that a connects to a SQL Server database using a connection string in the following format:</p> <pre><code>ConnectionString='Data Source=ServerName;Initial Catalog=DbName;User ID=UserName;Password </code...
<p>I think you are publishing the project you have to add file where your connection string is stored. According to your connection string you have to use provider name in it. When publishing or making exe select include file in your project.</p>
Finding a minimum length substring in string S which contains all charachters from string T using Hash Table in O(n) <p>I know that this question has already been asked more than once.My doubt is not finding the solution of this problem, but the correct complexity. I read an answer here:</p> <p><a href="http://stackov...
<p>The data structure described is a doubly-linked list, visualised as follows, using the example in the <a href="http://stackoverflow.com/a/3592224/149530">answer</a>:</p> <pre><code>HEAD &lt;=&gt; ('c', 0) &lt;=&gt; ('b', 3) &lt;=&gt; ('a', 5) &lt;=&gt; TAIL </code></pre> <p>coupled with an array, which is visualis...
d3 plot missing the first item in an array <p>I'm really struggling with this. I'm creating a dot-plot in javascript using the d3 library. I would like to filter the dots actually being plotted so that later I can add text fields to some of them specified in a column in the dataset called 'highlight. Just as a test I'm...
<p>When you do this:</p> <pre><code>parent.append('text') .attr("class", media+"Subtitle") .attr("x",margin.left) .attr("y",0) .text(function(d){return d.key}); </code></pre> <p>You are creating a <code>text</code> element in the SVG (in your case, the subtitle). So, when you do this l...
Dictionaries and Map <p>I've just started my adventure with programming. I really like the subject, but sometimes I come across something that I do not completly understand.<br> Like this, for instance:</p> <pre><code>//Complete this code or write your own from scratch import java.util.*; import java.io.*; class Solu...
<p><code>phonebook</code> is a Hashmap. It cannot equal a String of <code>"null"</code></p> <pre><code>if(phonebook.equals("null") == true) </code></pre> <p>I believe you are confused about how to appropriately check for <code>null</code> values.</p> <p>When a key in a Hashmap does not exist, it returns <code>null</...
Generating Report from User Inputs in Access Form <p>Goal: To create an access form that takes user inputs combines those with a bound value in an access query calculates a final number and then generates a report.</p> <p>The only issue I am having here in referencing the user inputs on the form to the actual report. ...
<p>In the report it would be:</p> <pre><code>=Forms!YourUserInputFormName!txtUserInputBox </code></pre> <p>The form must be left open.</p>
Plotting and sorting of multi-channel sequence objects <p>I would like to make a sequence index plots of a multi-channel sequence object for first descriptive purposes. However, I am still not sure how to do that properly. The usual way of sorting one sequence object does not work well as there is no nested sorting fun...
<p>I just stumbled upon the package <code>seqHMM</code> whose name suggests other purposes but which is able to sort multi-channel sequence objects. Thus, <code>seqHMM</code> is an answer to my first question. Here is an example code using <code>seqHMM</code>:</p> <pre><code>library(TraMineR) library(seqHMM) # Buildi...
How to get the selected options of a multiselect in Elm? <p>I've seen <a href="http://stackoverflow.com/questions/32426042">what is required for a getting the selected index of a single select</a> but I'm interested in getting all of the selected options from a multi select. I haven't been able to work out how to do th...
<p>The decoder fails because <code>event.target.selectedOptions</code> is not a javascript array. When you cannot use <code>Json.Decode.list</code>, you can use <code>Json.Decode.keyValuePairs</code>.</p> <p>Here is the example how you can use it. You may want to change <code>extractValues</code> below depending on h...
How do i pass the value from the first form to the second form messageBox ? It will show 0 <p>This is the first form( it contains an OK button and a textbox)</p> <pre><code>namespace Testt { public partial class Form1 : Form { public Form1() { InitializeComponent(); } ...
<p>You could make it so that your form takes dimx as a variable, so it would look like this</p> <pre><code>public partial class Form2 : Form { private int dimX; public Form2(int dimx) { InitializeComponent(); dimX = dimx; } private void button1_Click(object sender, EventArgs e) ...
How to Fill a group of Fabric.Path like any shape or a single path <p>While filling a single Fabric.Path object , it fills completely and works fine! </p> <p>Example,<br> <a href="https://i.stack.imgur.com/jxKzL.png" rel="nofollow"><strong>Single Path Fill Example Image</strong></a> </p> <p>But , when I fill a gro...
<p>Fabric does not support what you are trying to do.</p>
Get value of option of the dropdown menu and filter table <p>I would like to click in the dropdown menu and I get the value of the selected option. After that I would like to filter a field of the bootstrap-table and it show only the records with this field.</p> <p><a href="https://i.stack.imgur.com/l2LBt.png" rel="no...
<p>Add this code</p> <pre><code>&lt;select id="edicion"&gt; &lt;option value="1"&gt;Option 1&lt;/option&gt; &lt;option value="2"&gt;Option 2&lt;/option&gt; &lt;option value="3"&gt;Option 3&lt;/option&gt; &lt;/select&gt; $(document).on("change", '#edicion', function(){ console.log($(this).val()); }); </code>...
How to get camera instance from cwac- cam2 for face detection? <p>I would like to know how to get camera instance from CWAC- CAM2 library in android so that I can attach face detector to camera for face detection. Need know how to do this in android ?</p>
<p>That is not supported by the library. Use the camera APIs directly, skipping the library.</p>
How to restrict errors coming from iframe - htaccess <p>I have a php site .Im using iframe to load some contents from other site.A bulk list of errors showing in my console.Is it possible to restrict this errors in htaccess or using jquery?</p>
<p>You cannot suppress errors in frames from other sites. It is for security reasons.</p> <p>What you can do is catch the errors - and then do some action if an error occurs. Or I would recommend to contact the site which you are including as a frame. They are the ones who can fix the errors. </p>
How do I call an Excel VBA script using xlwings v0.10 <p>I used to use the info in this question to run a VBA script that does some basic formatting after I run my python code.</p> <p><a href="http://stackoverflow.com/questions/30308455/how-do-i-call-an-excel-macro-from-python-using-xlwings">How do I call an Excel mac...
<p>You need to use <code>Book.macro</code>. As your link to the docs says, <code>App.macro</code> is only for macros that are not part of a workbook (i.e. addins). So use:</p> <pre><code>wb.macro('your_macro') </code></pre>
How to display images in web page using angularjs? <p>I already know how to save images in mongodb using angularjs and java to save it in my mongodb, </p> <p>I need to get the saved image from mongodb and display it in an html page using AngularJS.</p> <p>This is my controller for getting image</p> <pre><code>@GET @...
<p>i think your base64 code is not converting images properly, so check my code it may help you.</p> <pre><code>import java.awt.image.BufferedImage; import java.io.BufferedWriter; import java.io.ByteArrayOutputStream; import javax.imageio.ImageIO; BufferedImage buffimage = ImageIO.read(new File(imagePath)); ByteAr...
Search each row, paste each match - Excel VBA <p>So I can search but I'm having problems with the loop, here is an example for some context:</p> <pre><code>Sub Find_First() Dim FindString As String Dim Rng As Range FindString = InputBox("Enter a Search value") If Trim(FindString) &lt;&gt; "" Then With Sheets("DCCUEQ")...
<p>I think using 2 For loops (one for the columns and one for the rows) would work perfectly in your context. </p> <p>You set a cell with your two variables for the address and compare it to your string. If it is the same, then you copy/paste and exit the loop of columns so it skips the rest of the row.</p> <pre><cod...
Runtime defined global const variable in C++ <p>I want to declare a global const variable that is defined at runtime. That is, I want to prompt the user for a value and assign it to a const global variable that I don't want to be modified during the execution of the program. </p> <p>If I wanted a const variable in the...
<p>Write an init function for it:</p> <pre><code>int init() { int tmp; cin &gt;&gt; tmp; return tmp; } const int var = init(); </code></pre>
how to read endpoint address value from app.config <p>I have <code>asp.net web application</code> and have the following in my <code>app.config</code> file. </p> <pre><code>&lt;system.serviceModel&gt; &lt;bindings&gt; &lt;basicHttpBinding&gt; &lt;binding name="Test" /&gt; &lt;binding name="Test1"&gt; &...
<pre><code> var serviceModel = ServiceModelSectionGroup.GetSectionGroup(ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None)); var endpoints = serviceModel.Client.Endpoints; foreach (ChannelEndpointElement e in endpoints) { if (e.Name == "HTTP_Port") ...
select specific column from panads MultiIndex dataframe <p>I have a MultiIndex dataframe with 200 columns, I would like to select an specific column from that. Suppose, df is some part of my dataframe:</p> <pre><code>df= a b l h l ...
<p>For multi-index slicing as you desire the columns needs to be sorted first using <code>sort_index(axis=1)</code>, you can then select the cols of interest without error:</p> <pre><code>In [12]: df = df.sort_index(axis=1) df['a','h','hot'] Out[12]: 0 2009-01-01 01:00:00 0.9 2009-01-01 02:00:00 0.8 2009-01-01 ...
Pass devise current_user to a method in a lib file <p>I am trying to pass the devise @current_user from my application_controller to a class method in a library file. This is to use the Twitter API. I can get it working by writing the various twitter methods in the application_controller file, but I was wondering how I...
<p>I woudl make an instance of the class rather than using class methods.</p> <pre><code>class UserTwitter def initialize(user) @user = user end def our_public_tweets client.user_timeline('BBCNews', count: 1, exclude_replies: true, include_rts: false) end def followers client.followers.take(5) ...
datatables adding/removing data to text area <p>I'm trying to add the clicked row of datatables to a textarea and if the same row is clicked again, the data is searched in the textarea and if found removed. (select/deselect)</p> <p>If I select one row and the deselect it, it works great. But when I select more than on...
<p>EDITED: Since you're using textarea:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#myTable tbody').on('click', 'tr', function() { var str = $("#selectedref").val...
ServiceM8 api email - how to relate to job diary <p>I can send an email from a ServiceM8 account through the ServiceM8 API 'message services' (<a href="http://developer.servicem8.com/docs/platform-services/message-services/" rel="nofollow">http://developer.servicem8.com/docs/platform-services/message-services/</a>), an...
<p>Using the messaging services API, can't be done. Using the web API, you can do just that.</p> <p>There's an authorisation code required, which is specific to your account and to this function, you only need to retrieve it once, and then you can integrate that specific URL into your code. It's contained within the...
Python How to sort list in a list <p>I'm trying to sort a list within a list. This is what I have. I would like to sort the inner namelist based on alphabetical order. Have tried using loops but to no avail. The smaller 'lists' inside happens to be strings so I can't sort() them as list. Error: 'str' object has no attr...
<pre><code>Names = [sorted(sublist) for sublist in Names] </code></pre> <p>This is a list comprehension that takes each sublist of <code>Names</code>, sorts it, and then builds a new list out of those sorted lists. It then makes <code>Names</code> that list</p>
Matlab function perfcurve falsely asserts ROC AUC = 1 <p>The perfcurve function in Matlab falsely, asserts AUC=1 when two records are clearly misclassified for reasonable cutoff values. If I run the same data through a confusion matrix with cutoff 0.5, the accuracy is rightfully below 1. The MWE contains data from one ...
<p>This simply means that there is <em>another cutoff</em> where the separation is perfect.</p> <p>Try:</p> <pre><code>threshold = 0.995 confus = confusionmat(classes,(confidence&lt;threshold)+1) accuracy = trace(confus)/sum(sum(confus)) </code></pre>
For Loop not giving correct results in R <p>I am trying to rename my Dataframe columns from 5th column to the total number of columns in my dataframe. Below, is the R loop which i have coded to rename.</p> <pre><code>for(i in 5:NCOL(raw_data_ui)){ colnames(raw_data_ui[i]) &lt;- paste(substr(colnames(raw_data_ui[i]),...
<p>You want to change the i'th colname, that is why the brackets need to stand after after the closing parenthesis as in </p> <pre><code>colnames(raw_data_ui)[i] </code></pre> <p>To give a clearer view, some sore simpler example:</p> <pre><code>d &lt;- data.frame(a=1, b=2, c=3) </code></pre> <p>Your version of </p...
horizontal scroll bar on resizing browser and right white space on smaller screens <p>i'm getting horizontal scroll bar when resizing the browser to 796px or less i'v tried to delete the sections one by one to find which one gives that issue but it didn't resolve it then i tried to delete some code starting from sectio...
<p>I can not replicate the side scroll however the white space is because you have a "Margin: 8px;" on your "body" if you add "body {margin:0;}" into your css that should fix your issue.</p> <p>Let me know if that helped!</p>
How to check for partial string match in getelementById while scraping <p>I need to get value of this id: "price-including-tax-9926"</p> <pre><code> &lt;span class="price-including-tax"&gt; &lt;span class="label"&gt;Incl. Tax:&lt;/span&gt; &lt;span class="price" id="price-including-tax-...
<p>Your question re: can you partially match an ID, have a look at this <a href="http://stackoverflow.com/questions/4275071/javascript-getelementbyid-wildcard">post</a>. Hopefully it helps</p>
Custom Magento 2 container/banner <p>I'm trying to create my own magento 2 theme. I want to add a header image to all pages on top. </p> <pre><code>--&gt; &lt;page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"&gt; ...
<pre><code> &lt;referenceContainer name="header.panel"&gt; &lt;block class="Magento\Framework\View\Element\Html\Links" name="header.links"&gt; &lt;arguments&gt; &lt;argument name="css_class" xsi:type="string"&gt;header links&lt;/argument&gt; &lt;/arguments&gt; &lt;/block&gt; &lt;/re...
Multiple language sitemap gives validation error "No matching global element declaration available" <p>I have been trying to follow <a href="https://support.google.com/webmasters/answer/2620865?hl=en" rel="nofollow">Google's recommendation for multi-lingual sitemaps</a>. However when I try this on my site I get the err...
<p>It seems the validator you use, <a href="http://tools.seochat.com/tools/site-validator/" rel="nofollow">http://tools.seochat.com/tools/site-validator/</a>, doesn’t support <a href="http://www.sitemaps.org/protocol.html#extending" rel="nofollow">additional namespaces</a> (like <code>xhtml</code> in your example).</...
Responsive CSS: viewport and 100% doesnt fit so much <p>I putted this tag in my code:</p> <pre><code>&lt;meta name="viewport" content="width=device-width; initial-scale=1.0;"&gt; </code></pre> <p>And then, after a media query i asked</p> <pre><code>header { width: 100% !important; } main { width: 100% !impor...
<p>You use <strong>semicolon</strong> to separate content attribute's values, where you should use <strong>comma</strong> instead, like:</p> <pre><code> &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; </code></pre>
Message is received two times in xmpp smack library <p>I am creating an android chat application using xmpp smack library.I have create a background service to listen to incoming chats and use an application class to initialize the xmpp connection object. The problem is the chatCreated function of chat listener is call...
<p>You have to fix createdLocally usage in chatCreated method. </p> <p>Just add the listener if is not createdLocally like this:</p> <pre><code>public void chatCreated(Chat chat, boolean createdLocally) { if (!createdLocally) { chat.addMessageListener(ne...
"require is not defined" error <p>I just started a <a href="http://ionicframework.com/docs/v2/getting-started/tutorial/" rel="nofollow">new project</a> with ionic v2 and added <a href="https://github.com/danmactough/node-feedparser" rel="nofollow">feedparser</a> to my project.</p> <p>By using</p> <pre><code>ionic ser...
<p>I guess you need to install these node dependencies in your machine. </p> <p>Use the below commands to have them installed in your project, </p> <p>For RequireJS,</p> <pre><code>npm install --save requirejs </code></pre> <p>For FeedParser,</p> <pre><code>npm install --save feedparser </code></pre> <p>If you wa...
Cassandra consistency Issue <p>We have our Cassandra cluster running on AWS EC2 with 4 nodes in the ring. We have face data inconsistency issue. We changed consistency level two while using "cqlsh" shell, the data inconsistency issue has been solved. </p> <p>But we dont know "How to set consistency level on Cassandra ...
<p>Consistency level can be set at per session or per statement basis. You will need to check the consistency level of writes and reads, to get a strong consistency your R + W ( read consistency + write consistency ) should be greater than your replication factor. </p>
React Jest to match snapshot, crash when testing component with child components <p>I have some components with child components from third parties addons/libraries. I use Jest for my unit test and <code>toMatchSnapshot()</code> method. I tried to exclude the child components with <code>jest.unmock('ChildComponet.js')<...
<p>The easiest way to mock out react components I found so far is to use:</p> <pre><code>jest.mock('component', ()=&gt; 'ComponentName') </code></pre> <p>before you the import statement of the module you want to test.</p> <p>The first parameter is either the name of global npm module or the path to your local compon...
Concatenate dictionary values in Swift <p>I created a dictionary in Swift like:</p> <pre><code>var dict:[String : Int] = ["A": 1, "B": 2, "C": 3, "D": 4] print(dict["A"]!) </code></pre> <p>The computer prints number 1, but how do I concatenate these values such that the output is 1234 instead of a single integer?</p...
<p>The key-value pairs in a <code>Dictionary</code> are unordered. If you want to access them in a certain order, you must sort the keys yourself:</p> <pre><code>let dict = ["A": 1, "B": 2,"C": 3,"D": 4] let str = dict.keys .sorted(by: &lt;) .map { dict[$0]! } .reduce ("") { $0 + S...
send checkbox values to php through ajax results in null <p>I am trying to send the values of 7 jquery checkboxes to php via ajax. I am attempting to put the values in an array and serialize the array in ajax. Ultimately, I would like to use the values of the checkboxes as conditions in a MySQL WHERE clause. My ajax co...
<p>You are using a class selector while your checkboxes does not have class attributes</p>
How to use git staging as temporary space? <p>I am trying to figure out the easiest way to switch back and forth between version of code to test while making changes. When I'm in the middle of something and want to test out something else I'll use git stash but that seems like overkill in this situation as it can't be ...
<p>You could simply use <code>git commit</code> if <code>git stash</code> is not good enough.</p> <p>First let's make a tag to track the tip of the current branch.</p> <pre><code> git tag start </code></pre> <p>After making the changes to some files,</p> <pre><code> git add . git commit -m 'version 1' ...
linux source command not working when building Dockerfile <p>I have a Dockerfile that defines a Ruby on Rails stack.</p> <p>Here is the Dockerfile:</p> <pre><code>FROM ubuntu:14.04 MAINTAINER Junayed Mizan &lt;m.j.mizan@gmail.com&gt; # Update RUN apt-get update # Install Ruby and Rails dependencies RUN apt-get inst...
<p>From the <a href="https://docs.docker.com/engine/reference/builder" rel="nofollow">docker builder reference</a>, each RUN command is run independently. So doing <code>RUN source /usr/local/rvm/scripts/rvm</code> does not have any effect on the next RUN command. </p> <p>Try changing the operations which require the ...
WebSocket timeout in Firefox (and Chrome) <p>I use <a href="https://github.com/ghedipunk/PHP-Websockets" rel="nofollow">PHP WebSockets</a>.</p> <p>I've set a long timeout on the server:</p> <pre><code>protected function connected ($user) { socket_set_option($user-&gt;socket, SOL_SOCKET, SO_RCVTIMEO, array('sec'=&...
<p>What you are setting with SO_RCVTIMEO &amp; SO_SNDTIMEO is the timeout for socket <code>send</code> and <code>recv</code>. If within the set time, the <code>send</code> and <code>recv</code> do not perform their actions, error is returned.Its not related to the disconnect you are seeing</p> <p>The disconnect that y...
Retrieve GroupName in Listview Grouping in WPF <p>I've setup a ListView with grouping and I would like to retrieve the GroupName when I right click on the group in MVVM. I've placed a <code>ContextMenu</code> on my group style, and I was trying to use the EventToCommand from System.Windows.Interactivity to get the unde...
<p>First of all, i think i've figured out why your Command isnt firing.</p> <p>Since you are in an Template, the DataContext has Changed. Therefore your CommandBinding should look like this:</p> <pre><code>&lt;i:InvokeCommandAction Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Li...
Sum arrays in php <p>I have the result from database.</p> <pre><code>Array ( [0] = stdClass Object ( [name] = First [sum] = 3,8,... ) [1] = stdClass Object ( [name] = Second [sum] = -1,0,... ) [2] = stdClass Object ( [name] = Third [sum]...
<p><a href="http://php.net/manual/en/function.array-reduce.php" rel="nofollow"><code>array_reduce</code></a> is good for reducing an array to a single value as you're doing here. It takes an array and a function that updates a "carry" value for each item in your array.</p> <pre><code>$result = array_reduce($your_array...
HttpWebRequest.GetResponse() times out after some time <p>I have application that sends requests to same REST server constantly and after some time HttpWebRequest.GetResponse() starts timing out i've noticed that whenever i increase System.Net.ServicePointManager.DefaultConnectionLimit it takes it longer to start timin...
<p>I agree it does <em>behave</em> like the connection is still in use by a resource that has not been closed. The <a href="https://msdn.microsoft.com/en-us/library/system.net.httpwebresponse(v=vs.110).aspx" rel="nofollow">documentation</a> for <code>HttpWebResponse</code> mentions:</p> <blockquote> <p>You must call...
Can someone show me how to handle java.lang.NullPointerException in my code below <p>I get the exception whenever I run the program without passing in the usDollarAmount or cancel the program... I'm using swing components to accept user input. The program works fine otherwise.</p> <p>Please show me how to handle this...
<p>First assign the input to a variable and then do a null check. If not null do the parsing</p> <pre><code>String input = JOptionPane.showInputDialog(null, "Enter your dollar amount:"); if(input != null &amp;&amp; !input.trim().isEmpty()) usDollarAmount = Double.parseDouble(); </code></pre>
SQL SELECT: concatenated column with line breaks and heading per group <p>I have the following <code>SQL</code> result from a <code>SELECT</code> query:</p> <pre><code>ID | category| value | desc 1 | A | 10 | text1 2 | A | 11 | text11 3 | B | 20 | text20 4 | B | 21 | text21 5 |...
<pre><code>Declare @YourTable table (ID int,category varchar(50),value int, [desc] varchar(50)) Insert Into @YourTable values (1,'A',10,'text1'), (2,'A',11,'text11'), (3,'B',20,'text20'), (4,'B',21,'text21'), (5,'C',30,'text30') Declare @String varchar(max) = '' Select @String = @String + Case when RowNr=1 Then Rep...
CodenameOne Background color <p>I've got a problem setting background color of a TextField:</p> <pre><code>private TextField mValueField; public void setFgColor(int color) { mValueField.getAllStyles().setBgTransparency(0xFF); if (color == Controller.WHITE_COLOR) { mValueField.getAllStyles().setBgColo...
<p>After changing the bg color, you should immediately call <code>mValueField.getComponentForm().repaint();</code> or <code>mValueField.getParent().repaint();</code></p>
R: read and parse Json <p>If R is not suitable for this job then fair enough but I believe it should be.</p> <p>I am calling an API, then dumping the results into Postman json reader. Then I get results like:</p> <pre><code> "results": [ { "personUuid": "***", "synopsis": { "fullName": "***", ...
<p>Additional test data might be helpful.</p> <p>Consider:</p> <pre><code>library(jsonlite) library(dplyr) json_data = "{\"results\": [\n {\n\"personUuid\": \"***\",\n\"synopsis\": {\n\"fullName\": \"***\",\n\"headline\": \"***\",\n\"location\": \"***\",\n\"image\": \"***\",\n\"skills\": [\n\"*\",\n\"*\",\n\"*\",...
How to create shorthands for CGPoint & CGVector? <p>I'm doing a lot of positioning and animation stuff in literals, and they're taking up a lot of space and becoming unreadable because of the verbosity.</p> <p><strong>What I'd like to do is turn this</strong></p> <pre><code> var xy = CGPoint(x: 100, y: 100) </code...
<pre><code>extension CGPoint { init(_ x: CGFloat, _ y: CGFloat) { self.init(x: x, y: y) } } extension CGVector { init(_ dx: CGFloat, _ dy: CGFloat) { self.init(dx: dx, dy: dy) } } typealias P = CGPoint typealias V = CGVector let p = P(10, 10) let v = V(10, 10) </code></pre> <p>But no...
TS2307: Cannot find module '~express/lib/express' <p>I'm converting a working JavaScript file to TypeScript.</p> <p>I use Express in this file, so I've added the following to the top of the file:</p> <pre><code>///&lt;reference path="./typings/globals/node/index.d.ts" /&gt; import {Request} from "~express/lib/expres...
<p>I think you should try this line</p> <p><code>import * as express from "express";</code> </p> <p>it was taken from <a href="http://brianflove.com/2016/03/29/typescript-express-node-js/" rel="nofollow">http://brianflove.com/2016/03/29/typescript-express-node-js/</a></p> <p>hope it helps you.</p>
Complex regular expression ... AND OR, negation <p>I would like to search files by their content in Total Commander so I want to create a regex, but I cannot find any manual where it would really be explained. My situation is that I need something like this:</p> <pre><code>fileContains("&lt;html&gt;") &amp;&amp; fileC...
<p>try this <a href="https://regex101.com/r/VWlZ4T/2" rel="nofollow">regex</a>:</p> <pre><code>(?=.*\{myVariable1\})(?=.*&lt;html&gt;)(?!.*&lt;script&gt;) </code></pre> <p>it's just 3 lookaheads in a row. one of those is a negative lookahead. Note the "single line" modifier to enable 'dot matches newline'. </p> <p>...
How to make shell script to automatically input value <p>I'm trying to copy ssh public key to all hosts on my network with the following little script</p> <pre><code>#!/bin/bash for ip in $(nmap -n -sn 192.0.2.0/24 -oG - | awk '/Up$/{print $2}'); do ssh-copy-id vagrant@$ip done </code></pre> <p>However, it asks for...
<p>Use the <code>sshpass</code>. Note that it is not a good idea to store passwords in the scripts, but it will do the job for the setup:</p> <pre><code>#!/bin/bash for ip in $(nmap -n -sn 192.0.2.0/24 -oG - | awk '/Up$/{print $2}'); do sshpass -p password ssh-copy-id vagrant@$ip done </code></pre>
Select the register with not null value in a column with GROUP BY <p>I have the next results with the following query:</p> <p><a href="https://i.stack.imgur.com/AtoC4.png" rel="nofollow"><img src="https://i.stack.imgur.com/AtoC4.png" alt="enter image description here"></a></p> <pre><code>SELECT `id_booking`, `id_task...
<p>A bit more complex ...</p> <p>but from the result of the select union you should select only the id whit duplicated rows and for this only these with not null type</p> <pre><code>SELECT `id_booking`, `id_task`, `type`, `date` FROM (SELECT `id` AS `id_booking`, null AS `id_task`, 1 AS `type`, `date_in` AS `date` ...
I am unable to run my program <pre><code>Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=student.mdb;DriverID=22;READONLY=true at java.sql.DriverManager.getConnection(DriverManager.java:689) at java.sql.DriverManager.getConnec...
<p>In order to successfully execute a connection with a database through java,for example if you are using mysql follow the steps below:</p> <p>Go to mysql website and download the appropriate driver for Java. Then go to Project -> Properties -> Java Build Path -> Libraries (in Eclipse) and click on "add external Jar...
Mod security Block GET request to URI path <p>I need to block the GET request for a certain URI path. I'm using anomaly mode, but im using a straight block rule, I cannot get the rule to work properly</p> <p>example <code>GET /secure/test/bla/bla/</code> example <code>https://bla.bla.com/secure/test/bla/bla?www.test.c...
<p>So this is a continuation of this question: <a href="http://stackoverflow.com/questions/39980992/modsecurity-create-rule-disable-get-request/39983843">modsecurity create rule disable GET request</a></p> <blockquote> <pre><code>example GET /secure/test/bla/bla/ example https://bla.bla.com/secure/test/bla/bla?www.tes...
Subtract two ranges and clear the contents from result <p>I'm trying to subtract RangeA - RangeA+offset to get a new range. After this i need to clear all the values within it. My problem is that the variable columnrange is empty and i'm unable to realize what i'm doing wrong.</p> <pre><code>Dim rng1 As String Dim ran...
<h2>This code moves a user-defined range by a user-defined amount.</h2> <pre><code>Sub RemoveRangeOverlap() Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Plan1") Dim rngOffset As Integer Dim rangeA As Range, rangeB As Range Dim cellRange() As String On Error GoTo ErrHandle rngOffset = CIn...
understanding the minesweeper programming p.roblem <p>I am trying to understand the minesweeper problem: <br> <strong>Problem statement:</strong><br> Have you ever played Minesweeper? This cute little game comes with a certain operating system whose name we can’t remember. The goal of the game is to find where all t...
<p>In theory minesweeper can be made as grid of objects. When player use any object then (in classical minesweeper) surrounding objects checks <strong>THEIR surrounding objects</strong> and count how many are marked as mine.</p>
Using web.xml to conf programmatically started jetty <p>I created an eclipse maven project and added jetty dependency. Next I made a simple servlet and a class that starts the jetty server. Here is what i got so far:</p> <pre><code>package com.example.jetty; import org.eclipse.jetty.server.Server; import org.eclipse....
<p>I'll start with an example that you may interested in. If you want to use <code>web.xml</code> with programmatic way <code>Jetty</code> server, then you can do it following way:</p> <pre><code>WebAppContext context = new WebAppContext(); context.setContextPath("/myWebApp"); context.setExtractWAR(false); context.set...
Button not clickable - Disable Click <p><br></p> <p>I want to make a button in ionic <strong>not clickable</strong>, so how can I do it?</p> <p>I have buttons inside a header bar and they are scores, so people can't click on them. </p>
<p>use <code>ng-disable</code></p> <pre><code>&lt;button ng-disable="true"&gt;&lt;/button&gt; </code></pre>
Can i fork this code from gist and using it for my own projects? <p>Hello I'm new to Github/Gist and I want to use this code, but I need to modify it a little bit. Can i just fork this code and modify it to use it for my own projects? Or do i have to link to the author etc.? Here is the link: <a href="https://gist.gith...
<p>When you are using a forked repository.It shows up as "forked from xyz". So attribution is automatic. But if you want to, you can always give an extra credit to the author by mentioning it specifically.</p>
Error Couldn't find GPIOController <p>Hope to find some guidance on this one soon, I've added reference for Windows IoT UWT in my project but still getting the following error ?</p> <pre><code>An exception of type 'System.TypeLoadException' occurred in test_led_alljoyn.exe but was not handled in user code Additional ...
<p>Solved. I had to set build platform target compile with .net native tool chain.</p>
Locking a fragment after switching <p>I have a query about locking of fragments.Actually I have three fragments in bottom tab navigation. All of the three fragments are basically entry forms in which I am picking the values from edittexts.However I want a feature to be added in the app such that when I submit one form ...
<p>if you are using a viewpager the only solution is create a Custom ViewPager like this:</p> <pre><code>public class NoScrollViewPager extends ViewPager { private boolean isPagingEnabled = false; public NoScrollViewPager(Context context) { super(context); } public NoScrollViewPager(Context context, AttributeSe...
Python Regex: Using a lookahead <p>I'm trying to detect text of the following type, in order to remove it from the text:</p> <pre><code>BOLD:Parshat NoachBOLD: BOLD:Parshat Lech LechaBOLD: BOLD:Parshat VayeraBOLD BOLD:Parshat Sh’miniBOLD: </code></pre> <p>But only to capture this part:</p> <pre><code>BOLD:Parshat ...
<p>In python you can just do:</p> <pre><code>str = re.sub(r'BOLD:?$', '', str, 0, re.MULTILINE) </code></pre> <p><a href="https://regex101.com/r/qiNd4L/3" rel="nofollow">RegEx Demo</a></p> <p>That will remove <code>BOLD</code> followed by optional <code>:</code> from the end of each line.</p> <hr> <p><strong>EDIT:...
Is it possible to give a url like this in laravel http://sitename/store/us/walmart.com <p>Is it possible to give a route in <em>laravel 5.3</em> similar to </p> <p>Please give me an answer before down voting the question</p> <p><a href="https://i.stack.imgur.com/oCJN4.png" rel="nofollow">Image of not found page </a><...
<p>Try Laravel Annotations and annotate the function to handle the request with the desired url. check out <a href="http://dunebook.com/docblock-annotations-in-laravel-5-1/3/" rel="nofollow">http://dunebook.com/docblock-annotations-in-laravel-5-1/3/</a> for how to use Laravel Annotations if you don't know how to alread...
Verify Records Before Updating in Stored Procedure <p>Let's say I have 2 counties:</p> <ul> <li>A</li> <li>B</li> </ul> <p>Each has it's own URL:</p> <ul> <li>www.A.com</li> <li>www.B.com</li> </ul> <p>I have a stored procedure that accepts 3 variables to enable or disable the service to the URL. The <code>@Enable...
<p>You could do this with another IF statement if I understand what you want correctly... just add these two lines at the bottom of your <code>PROCEDURE</code> just before your <code>END;</code></p> <pre><code>IF(@@ROWCOUNT) &lt; 1 RAISERROR('Nothing Updated Due to Non Matching Records',15,1) </code></pre> <p>So it w...
Counting words from a text-file in Java <p>I'm writing a program that'll scan a text file in, and count the number of words in it. The definition for a word for the assignment is: 'A word is a non-empty string consisting of only of letters (a,. . . ,z,A,. . . ,Z), surrounded by blanks, punctuation, hyphenation, line st...
<p>Quoting from <a href="http://stackoverflow.com/questions/28462719/counting-words-in-text-file">Counting words in text file?</a> </p> <pre><code> int wordCount = 0; while (input.hasNextLine()){ String nextLine = input.nextLine(); Scanner word = new Scanner(nextline); while(word....
How to run multiple background thread tasks one at a time? (Swift 3) <p>First of all, I'm a beginner and I'm about to make a few assumptions of what's causing my problem down here, which may sound really stupid, so please bare with me.</p> <p>I'm trying to loop through an array of String objects containing dates of th...
<p>One approach is to retrieve the results into a structure that is not dependent upon the order that the results come in i.e. a dictionary.</p> <p>So, you could do something like:</p> <pre><code>let syncQueue = DispatchQueue(label: "...") // use dispatch_queue_create() in Swift 2 let group = DispatchGroup() ...
Switch contents of footer based on page <p>Switch contents of footer</p> <p>Is it possible to switch the contents of the footer based on the page number?</p> <p>On the first page, I would like to show a text based footer, and on the last page I would like to show a logo.</p> <p>I've tried adding:</p> <pre><code>=II...
<p>You need to surround the image names with quotes, as mentioned in the comments. Additionally, the image will appear broken in the designer. If you preview or upload to CRM, the image will show correctly.</p> <p>Double-check that both images are embedded in the report:</p> <p><a href="https://i.stack.imgur.com/w7dX...
Unresolved reference: flask_sqlalchemy <p>I have installed flask_sqlalchemy using pip. </p> <p>I try to import it using the following line:</p> <pre><code>from flask_sqlalchemy import SQLAlchemy </code></pre> <p>But PyCharm does not recognize flask_sqlalchemy and when I run the code I get "NameError: name 'SQLalche...
<p>Your error is <code>"NameError: name 'SQLalchemy' is not defined.</code> but what you've done in your file is <code>from flask_sqlalchemy import SQLAlchemy</code></p> <p>The difference is that you forgot to cap the A:</p> <pre><code>SQLAlchemy SQLalchemy </code></pre> <p>Fix that in your file and the error should...
Laravel 5.3 - htmlspecialchars() expects parameter 1 to be string <p>I am new to laravel and I am enjoying it. While working on a social media project I got this error: <code>htmlspecialchars() expects parameter 1 to be string, object given (View: C:\wamp64\www\histoirevraie\resources\views\user\profile.blade.php)</cod...
<p>I think your <code>$user-&gt;website</code> is empty/blank.</p> <p>If you look at the <a href="https://github.com/laravel/framework/blob/5.3/src/Illuminate/Foundation/helpers.php#L808-L810" rel="nofollow"><code>url()</code> helper method</a>, Laravel will return an <em>instance</em> of <code>UrlGenerator</code> if ...
Unable to parse bash output using regex and collect a part of it <p>I am trying to parse out the recent load, from the output of this command - </p> <pre><code>[sandeepan@ip-10-169-92-150 ~]$ w 14:22:21 up 17 days, 51 min, 2 users, load average: 0.00, 0.01, 0.05 USER TTY FROM LOGIN@ IDLE J...
<p>When you know what text comes before and after, it is best to use a look-behind that does this: checks the text in a given place, no matter what is the rest of the line.</p> <p>Given your sample file, I stored it in a file and did this:</p> <pre><code>$ grep -Po '(?&lt;=load average: )[^,]*' file 0.00 </code></pre...
Sitecore Ucommerce - How to access RavenDB Studio <p>I need to access the data in RavenDB shipped with Ucommerce in Sitecore application. The Ucommerce doc page says you can do it. </p> <p><a href="http://docs.ucommerce.net/ucommerce/v7.1/manage-ucommerce/access-ravendb-studio.html" rel="nofollow">http://docs.ucommerc...
<p>Did you perform all the steps outlined in article?</p> <p>If you did there are a few extra things you can check:</p> <ul> <li>Make sure the app pool runs with an identity which is in the admin group.</li> <li>After you change the configuration, make sure you recycle the app pool to force it to pick up the new conf...
How to prompt the user with message when combo box item is changed <p>I am new to C#, I am trying to prompt the user with a message once the <code>combobox</code> item is changed, but the below code doesn't work even though the <code>combobox</code> item is changed.</p> <pre><code> namespace NormingPointTagProgrammer ...
<p>Verify that your event is being subscribed to, a shorthand would be using the below for example,</p> <pre><code>ComboBoxChanged += dataFormatComboBox_SelectedIndexChanged(); </code></pre> <p>Or,</p> <pre><code>ComboBoxChanged += new EventHandler(dataFormatComboBox_SelectedIndexChanged); // This will be called w...
Error with springboard class XCUITesting <p>I have found a link (<a href="http://stackoverflow.com/questions/33107731/is-there-a-way-to-reset-the-app-between-tests-in-swift-xctest-ui-in-xcode-7">Is there a way to reset the app between tests in Swift XCTest UI in Xcode 7?</a>) what was referring to creating a springboa...
<p>One way you can avoid the error is by declaring the method you are trying to access in Objective-C header. Create a bridge header file from Objective-C to Swift and then use the method.</p> <p>In your particular case what you can do is create a Objective-C header file: CustomXCUIApplication.h with contents:</p> <p...
How do I write a doctest in python 3.5 for a function using random to replace characters in a string? <pre><code>def intoxication(text): """This function causes each character to have a 1/5 chance of being replaced by a random letter from the string of letters INSERT DOCTEST HERE """ import random s...
<p>You need to mock the random functions to give something that is predetermined.</p> <pre><code>def intoxication(text): """This function causes each character to have a 1/5 chance of being replaced by a random letter from the string of letters If there is 0% chance of a random character chosen, result will b...
How can I only create a file without opening it <p>I've been trying to create a file without using system commands. This code I wrote has multiple problems, If i create fptr in the start and check it for NULLity then the double free or corruption occurs, otherwise this way it gives memory dump. Even through previous me...
<p>You can use <a href="http://man7.org/linux/man-pages/man2/mknod.2.html" rel="nofollow"><code>mknod()</code></a> on some systems (such as Linux; note this is not portable to all operating systems).</p> <pre><code>if (mknod(filename, S_IFREG|0666, 0) != 0) { throw std::system_error(errno, std::system_category());...
What is the difference between these two codes it seems like they are exactly same but The second one causes a segmentation fault? <p>I am trying to make different 1d arrays from 1d array each of which separated with space .I am using this in a project which is causing a serious problem to my code if i use the second o...
<p>2nd loop lacks re-assignment of <code>i</code>. Deduced by <a href="http://stackoverflow.com/questions/40046270/what-is-the-difference-between-these-two-codes-it-seems-like-they-are-exactly-sa?noredirect=1#comment67383128_40046270">OP</a> after <a href="http://stackoverflow.com/questions/40046270/what-is-the-differ...
Python C Extension: PyEval_GetLocals() returns NULL <p>I need to read local variables from Python in C/C++. When I try to <code>PyEval_GetLocals</code>, I get a NULL. This happens although Python is initialized. The following is a minimal example.</p> <pre><code>#include &lt;iostream&gt; #include &lt;Python.h&gt; Py_...
<p>Turns out the right way to access variables in the scope is:</p> <pre><code>Py_Initialize(); PyObject *main = PyImport_AddModule("__main__"); PyObject *globals = PyModule_GetDict(main); PyObject *a = PyDict_GetItemString(globals, "a"); std::cout&lt;&lt;globals&lt;&lt;std::endl; //Not NULL Py_Finalize(); </code></pr...
Uncaught TypeError: $thirdColumnCells.each is not a function <p>I am running this but I have the console keeps giving me the error in the question title. basically I am reading the <code>href</code> value from a link and I am pushing it into a <code>&lt;ul&gt;</code></p> <p>HTML</p> <pre><code>&lt;div id="link"&gt;&l...
<p>jQuery's <code>.attr()</code> returns a string.</p> <p>jQuery's <code>.each()</code> iterates over objects and arrays, usually array-like objects holding elements</p> <p>What you're doing is </p> <pre><code>var $thirdColumnCells = $(element).attr("href"); $thirdColumnCells.each(... // &lt;- that's a string !!! <...
RecyclerView not showing items. Adapter is not called <p>So I'm sure im making some trivial mistake somewhere and just can't see it. But I am simply trying to create a basic recyclerview list. However when I run the app nothing is shown, I put in log statements and found out that the adapter is created but nothing is e...
<p>If you want to use a <code>RecyclerView</code>, you will need to work with the following:</p> <ul> <li><p><code>RecyclerView.Adapter</code> - To handle the data collection and bind it to the view</p></li> <li><p><code>LayoutManager</code> - Helps in positioning the items</p></li> <li><p><code>ItemAnimator</code> - ...