input
stringlengths
51
42.3k
output
stringlengths
18
55k
Service return empty promise <p>I have service in which I simulate http request.</p> <p>e.g. I have array of object users:</p> <pre><code>var users = [{ id: 1, name: 'Name1', groupId: 2 }, { id: 2, name: 'Name2', groupId: 1 }]; </code></pre> <p>And I have function which ask for it:</p> <pre>...
<p>You probably need to return a new promise and resolve it in the timeout </p> <pre><code>this._returnLater= function(response) { return new Promise(function(resolve) { $timeout(function() { resolve(response); }, Math.random() * 2000); }); }; </code></pre>
Does the operator [] of std::vector<type> walk through the vector from the beginning on each call <p>I see many programmers using <code>std::vector&lt;type&gt;::operator[]</code> to access the vector's elements in a <code>for</code> loop this way :</p> <pre><code>for (int c=0;c&lt;vect.size();c++) { vect[c] .... }...
<p>The access time in <code>vector</code> with the <code>[]</code> operator is constant.</p> <p>That means it is <em>not</em> working its way through any kind of list.<br> There is no need at all, vector is implemented as a malloced array; all <code>vector</code> adds to it is the automatic resizing, which just means ...
Save data in associative model using one query in django <p>I am working on registration module in django project. for registering user i am using auth_user table for extending this table i have created one more model Profile</p> <pre><code>from django.contrib.auth.models import User class Profile(models.Model): u...
<p>I think you can define a registration form and override the form <code>save</code> method to save the <code>Profile</code> when creating the User model. Sample code for your reference:</p> <pre><code>class RegistrationForm(forms.ModelForm): start_date = forms.DateField() phone_number = forms.CharField() ...
Android 7.0 runnable on View not executing <p>Edit - changed title to reflect real issue.</p> <p>A very strange problem. I have a layout that contains a WebView. It works perefectly apart from one phone that has recently updated to Android 7.0. I'm fairly sure it isn't WebView that's a problem because other webviews i...
<p>I'm not really sure what the issue is but... I read that if a view fails to attach to a window then code attached to a runnable on the view wont be executed. so, this...</p> <pre><code> mWebViewProgress.post(new Runnable() { @Override public void run() { mWebViewProgress.addJava...
c++ - copy constructor for template class <p>My class is a matrix composed out of vectors of vectors, and I seem to have problems in my constructor:</p> <pre><code> #include &lt;vector&gt; #include &lt;exception&gt; #include &lt;iostream&gt; using namespace std; template&lt;clas...
<p>Try with</p> <pre><code>copy(other._matrix[i].begin(), other._matrix[i].end(), std::back_inserter(_matrix[i])); </code></pre> <p>or with</p> <pre><code>Matrix (const Matrix&lt;T&gt; &amp;other) : _rows{other._rows}, _cols{other._cols}, _matrix{other._matrix} { } </code></pre>
Why does my isomorphic Cycle.js app cause an xstream exception when rendering on server? <p>I am trying to write a demo isomorphic <a href="http://cycle.js.org/" rel="nofollow">Cycle.js</a>/<a href="http://hapijs.com/" rel="nofollow">Hapi.js</a> app, but it fails with an exception in xstream while rendering on the serv...
<p>The reason for the error was that the rendered VTree was not a stream. I changed the code to the following and it works:</p> <pre><code>let vtree = sources.context.map(({}) =&gt; { return ( section('.home', [ h1('The homepage'), p('Welcome to our spectacular web page with nothing special here.'),...
JavaScript: extract a URL from a string once a space is encountered <p>I am not good at regex but I want to extract a URL from a string followed by a space. For example I have a string:</p> <pre><code>I am working on a website http://www.example.com/ and I want to find this URL. </code></pre> <p>The closest working r...
<p>I've prepared a little demo for you here: <a href="http://codepen.io/PiotrBerebecki/pen/qaqdNA" rel="nofollow">http://codepen.io/PiotrBerebecki/pen/qaqdNA</a></p> <p>Would the following work in your case?</p> <pre><code>var str = 'I am working on a website http://www.example.com/ and I want to find this URL.' // ...
What is the difference between iostream , stdio.h and conio.h header files in c++? <p>I am confused between all these three header files.I read it in Balagurusamy for C++ that all these files are used for taking input and output .But what is the difference.I know that we use stdio.h for scanf and printf and we use iost...
<p><code>stdio.h</code>/<code>cstdio</code> - standard C input and output , as <code>printf</code>, <code>scanf</code> , <code>fprintf</code> etc. this API is a C API only and based on stateless functions and structures like <code>FILE</code> which hold the state. generally used in a C projects and should be avoided in...
Jquery: How to bind keypress event to an input type 'number' based on attribute value <p>I want to perform a validation only when the input field is of <code>number</code> type and corresponding attribute <code>validate</code> has value <code>checkit</code>. I am not sure what should I pass in place of astrix to bind t...
<p>You can either add a condition inside your event handler, which makes your code like this:</p> <pre><code>$('input[type="number"]').bind('keypress', function(e) { if($(this).prop('validate') == 'checkit') { // do here } }); </code></pre> <p>Or you can assign a class to your <code>input[type='num...
generating same date as bill date php <pre><code>$contract_start_date = strtotime('2016-01-01'); $contract_end_date = strtotime('2016-12-01'); $contract_start_date_last_date = date('t', $contract_start_date); echo "contract last date of any start month: ".$contract_start_date_last_date."&lt;br /&gt;"; $contract_end_da...
<p>That is how I see it. I hope that idea will help you</p> <pre><code>$contract_start_date = strtotime('2016-01-15'); $contract_end_date = strtotime('2016-12-01'); $contract_start_date_last_date = date('t', $contract_start_date); echo "contract last date of any start month: ".$contract_start_date_last_date."&lt;br /...
PHP - Display an error when the time that you enter is not available or hits the unavailable time of a user <p>Pls Help me! im NOOB still studying, I want to make a module that when you enter the unavailable time or the time that you enter hits the unavailable time, it will shows an error an if you enter available time...
<p>If I understand your question, in html if you are using tag "input", exists type like datetime-local, that don't allow the user write a unavailable datetime. In the database is the same thing, you can use in your table/columns the type datetime. But be carefull, you have to send the database a datetime, that allow...
Android cannot generate certificate <p>I have problem while generating certificate. Following is related code.</p> <pre><code>@SuppressLint("SdCardPath") public HttpsURLConnection setUpHttpsConnection(String urlString) { try { CertificateFactory cf = CertificateFactory.getInstance("X.509","BC"); ...
<p>A pfx file is a PKCS#12 file which may contain multiple certificates and keys (unless you changed the file extension). </p> <p>The code you use expects a simple certificate (<code>.cer</code>, <code>.crt</code> or <code>.der</code>) file.</p> <p>Therefore you have to load it directly as PKCS12 keystore and not try...
Call external program on link under cursor with Emacs <p>I use <code>elfeed</code> to read RSS. In each RSS there is an http link to a torrent file. And I want to call an external program (<code>aria2c</code>) to download that torrent link, assuming that there is no such tool within Emacs.</p> <p>How to write a small ...
<p>Here a simple solution:</p> <pre class="lang-el prettyprint-override"><code>(defun open-with-ariac2() (interactive) (shell-command (format (concat "aria2c " (browse-url-url-at-point))))) </code></pre>
netbeans using terminal window <p><a href="http://i.stack.imgur.com/VIsE8.png" rel="nofollow"><img src="http://i.stack.imgur.com/VIsE8.png" alt="image"></a></p> <p>Above is the image from netbeans terminal window. I want to use it to check the version of nodeJS.</p> <p>Problem is when i click on the computer icon(sin...
<p><a href="http://i.stack.imgur.com/Daw4D.png" rel="nofollow"><img src="http://i.stack.imgur.com/Daw4D.png" alt="cgwin "></a></p> <p>You must cgwin in order to resolve your issue here is link <a href="https://www.cygwin.com/" rel="nofollow"> cgwin </a> </p>
Jasper -Java.util.collection paramter from main to Sub report <p>I've chart report which uses the parameter of Type Java.util.collection. When I try to use this chart at group band as subreport to the Main report with similar parameter of Type Java.util.collection, the chart value keep iterates within the group. For e...
<p>Usually the subreport should only get the item it should display, e.g. "P1 ID" for P1 and "P2 ID" for P2. But if you provide a collection it will always cycle through the collection of data.</p> <p>So you should add either the ID to the subreport or put the chart in the main report.</p>
How to obtain line number at the node visitor during tree building in sonarqube plugin <p>For more complex analysis puproses we need to collect some info into Sensor implementation class and next line number binding.</p> <p>Where can I find line number of tree element?</p> <p>java.plugin.version: 3.13.1 sonar.plugin....
<p>Multiple way to answer your question.</p> <p>Let me rephrase it first : how to access line information from a node of the tree. </p> <p>Best way to answer just this question : upgrade to the latest version (4.2) and use the <code>firstSyntaxToken().line()</code> methods available on each node of the tree. </p> <p...
Get all Combination of items <p>I'm stuck with a combination problem. What I got is a <code>Data</code> class which basically holds a <code>name</code> and a list of <code>values</code>:</p> <pre><code>public abstract class DataField : IDataField { public string Name { get; set; } public Lis...
<p>You can use the generic method from my answer to <a href="http://stackoverflow.com/questions/38681866/how-to-iterate-lists-with-different-lengths-to-find-all-permutations/38682745#38682745">How to iterate lists with different lengths to find all permutations?</a>:</p> <pre><code>public static class Algorithms { ...
printing an array js shows only object <p>I need to read large text files and find their length and save their data. I want to save their content as an array.</p> <p>when I debug the program I can see the array isn't empty, and I can see the wanted content. </p> <p>But when I try to print the array all I get is [obj...
<pre><code>var fileGenesDetails = new Array(); ... allFileGenesDetails.push(fileGenesDetails); </code></pre> <p>You are getting [object Object] because your array contains another array and Arrays.prototype.toString() does not go deep into multi-dimensional array.</p> <p>You should iterate throw allFileGenesDetails s...
Confirm Before Form Submission <p>I created a PHP page to delete from my database. This PHP page is the action of a form submission. The form is submitted by clicking a pic of "X" sign. How can I ask user to confirm before the submission of the form and therfore deleting from my database? </p> <p>This is my code:</p>...
<p>From a comment by the OP:</p> <blockquote> <pre><code>echo "onclick='return confirm(\'Are you sure you want to submit this form?\');'" </code></pre> </blockquote> <p>You can't use single quotes in an attribute value delimited with single quotes.</p> <p>Your options are:</p> <p><strong>Use double quotes in the JS...
How to change .jsp processing error page across all applications in IBM WebSphere 7.0 <p>Our application is running on WebSphere application server 7.0. Whenever we hit some invalid url with ending .jsp we are getting JSP processing error page like below. </p> <p>How to disable that.I want to show my own 404 error pag...
<p>The WebSphere WebServer Plugin cannot override/replace error responses generated from the backend application server. If you want it customized, you need to customize it on WAS.</p>
Android Check Box in the Listview un expected behavior <p>I have Custom listview which consist of the check box and the Textview. For some reasons I can not use the ListActivity. Well its pretty easy to use the listview but I do not know why Check box is behaving differently . </p> <p>First let me give you a idea what...
<p>You will need to keep track of checked and unchecked positions and mark it check in your adopter. As in list view it is desired behavior. You have to handle it in code. Create an array for the list items, when a checkbox is clicked, update the array for that position and in adapter mark check/uncheck with the respec...
How to display @Html htmlhelper and @using in same line in MVC views? <ol> <li><p>I am trying to display all these three helpers in same line.</p></li> <li><p>Popup is also not showing up asking for conformation on button click.</p></li> </ol> <p>But the button is displayed in next line which I am creating using @usin...
<p>The button is shown on a next line because of the <code>@using (Html.BeginForm)</code> wrapping around it. Since <code>&lt;form&gt;</code> is a block element, the element will be rendered on a 'new line'.</p> <p>Either wrap the form around all the controls, or change the display of the form to be an inline (or inli...
How to Put Quantile To Macro Variable in SAS using One Data Step Only? <p>I am using the below code to put the 75 percent quantile into a macro variable quant75. I want to do this using one data step only, omitting the extra dataset cap_val created.</p> <pre><code>proc univariate data=site_visits; VAR total_visits ; ;...
<p>Not sure why you want to do this within one data step. But you could try this:</p> <pre><code>data _null_; if _n_=1 then do; call execute('proc univariate data=sashelp.class; var weight; output out=cap_val pctlpts = 75 pctlpre = pcap; '); call execute('data _nu...
NSurlsession is not working in Xcode8 with swift 2.3 <pre><code>let jsonObject:[string:string] = [ "username":"sample", "password":"qwerty" ] let url:NSURL = NSURL(string:&lt;my URL&gt;)! let session = NSURLSession.sharedSession() let request = NSMutableURLRequest(URL: url) request.HTTPMethod = "POST" request...
<p>Xcode disables all unsecured HTTP traffic from iOS apps by default.</p> <p>So, I think the issue could be that you need to serve over https, unless you alter NSAppTransportSecurity.</p> <p>As a temporary solution you can add this to Info.plist, to see if that helps.</p> <pre><code>&lt;key&gt;NSAppTransportSecurit...
large file not getting removed from commit <p>I added and committed a large file by mistake×¥ when trying to push to remote i get an error </p> <blockquote> <p>git push</p> <p>Counting objects: 417, done.</p> <p>Delta compression using up to 8 threads.</p> <p>Compressing objects: 100% (390/390), done....
<p>If I understand your question correctly, you have committed the wrong file locally, but haven't pushed your changes yet.</p> <p>If the commit with the file is the last one, than simple <code>git reset HEAD~</code> will give you an opportunity to remove the file and redo the commit.</p> <p>If the commit is deeper, ...
Difference between Timeline's stop() and jumpTo("end") <p>Could somebody explain me the difference between <code>timeline.stop()</code> and <code>timeline.jumpTo("end")</code>?</p>
<p><code>Timeline.stop()</code> halts the animation and makes sure <code>Timeline.play()</code> starts form the beginning of the animation; no more updates for the "current run" are done.</p> <p><code>timeline.jumpTo("end")</code> goes to the mark <code>"end"</code> which is positioned at the end of the animation. Thi...
Sharing same route with unauthenticated and authenticated users in Laravel 5.3 <p>I have a route that where I'm using an auth middleware and it works great. </p> <pre><code>Route::group(['prefix' =&gt; 'v1','middleware' =&gt; ['auth:api']], function() { Route::resource('user', 'v1\MyController'); }); </code></pre> ...
<p>Just remove this route from current route group (which applies auth middleware). After that you can check if user is authenticated or not in <code>MyController</code>:</p> <pre><code>if (auth()-&gt;user()) { // user is authenticated } else { // user is guest } </code></pre>
Possible values for <w:outlineLvl> in Word OOXML <p>What are the possible values of <code>w:outlineLvl</code> node in Word OXML? As when I am creating a normal word document the value ranges from 0-8 and its value is blank for outline level "Body Text".</p> <p>But for a specific document the value is 9 is it a valid v...
<p>Yes, see <em>ECMA-376, Office Open XML File Formats - Fundamentals and Markup Language Reference</em>, 4th Edition, page 233:</p> <blockquote> <h2>17.3.1.20 <code>outlineLvl</code> (Associated Outline Level)</h2> <p>This element specifies the outline level which shall be associated with the current paragra...
php dynamic pagination logical error <p>I am developing a page where a user can enter the limit of the table in pagination. While I am doing this the data I enter is taken and query is performed according to that. But as I click on another page of that table the value is reset to default which I set to 5 here.</p> <pr...
<p>I think that the $_POST data is missing. You click on the link, so the new page will open without POST infos.</p> <p>You can change this, if you switch to GET instead of POST. You can add the GET parameter to your <code>&lt;a href=""&gt;</code> Tag.</p> <p>For example <code>&lt;a href="pagination.php?page=5&amp;dl...
Synchronous communication microservices <p>I understand that micro-services are a good way to separate contexts and allow us to create smaller models. One of the ways to achieve decoupling is asynchronous publish/subscribe communication between micro-services.</p> <p>Let's say a micro-service <strong>A</strong> is in ...
<blockquote> <p>Could it also be considered as a wrong modeling? Such as - if the data were needed in A context, then it should have been part of that context from start.</p> </blockquote> <p>Yes, it could be.</p> <ul> <li><a href="http://udidahan.com/2010/11/15/the-known-unknowns-of-soa/" rel="nofollow">The Known ...
How to bind an objects property to a Angular2 form item using select <p>I have a problem with angular forms. I am trying to create a form that uses data from a mongo collection and provides it via the <code>&lt;select&gt;</code> directive. I have a FormBuilder that is initialized like this:</p> <pre><code>ngOnInit() ...
<p>Did you tried this?</p> <pre><code>&lt;option [ngValue]="i['propName']" *ngFor="let i of locations"&gt;{{i.name_c}}&lt;/option&gt; </code></pre> <p>or</p> <pre><code>&lt;option [ngValue]="i.propName" *ngFor="let i of locations"&gt;{{i.name_c}}&lt;/option&gt; </code></pre>
Swift Xcode NSURLConnection.sendSynchronousRequest is deprecated <p>I just started with iPhone development and thanks to the many out there I got a simple application working. I was using the following code to pull data from a mysql database. The code is in a commonfun.swift file where I hold all functions and it is ca...
<p>var data: NSData? = nil let semaphore: dispatch_semaphore_t = dispatch_semaphore_create(0) let task = NSURLSession.sharedSession().dataTaskWithRequest(request, completionHandler: { taskData, _, error -> () in data = taskData if data == nil, let error = error {print...
How can i decrypt byte[] of more than 16 bytes from AES <p>So I have a byte[] with a length of 1622 bytes but I want to decrypt it all but AES has only a blocksize of 128 bits. If im trying to split it up to blocks of 16 bytes i get this exception: <strong>System.Security.Cryptography.CryptographicException Additional...
<p>You're executing <code>i += 16</code> two times per loop iteration. You don't need to transform in 16 byte chunks anyway. Use <code>CryptoStream</code> and write any amount you like such as 4KB. Most tutorials do this. Maybe you found a bad tutorial.</p>
Adding a new computed variable back to main dataset in SQL <p>I am trying to compute a variable (say last_week) and add it back to my main dataset (say new_j). I managed to join it to new_j. However, if I want to use that variable (last_week) now for further calculations, it does not recognise it. Here's my code:</p> ...
<p>This normal behaviour of joins..</p> <p>by selecting this </p> <pre><code>select * from #new_j left join #lastweeksales on #lastweeksales.prod_id = #new_j.prod_id' </code></pre> <p>all the columns of newj and lastweekales will be displayed in same order (first new_j columns and then lastweeksales columns )...
Read file from parent project in gradle multi project <p>My Project Structure is something like:</p> <pre><code>Parent: sub 1 src .... sub 2 src myFile.json </code></pre> <p>I need to access this file myFile.json in <code>sub 2</code> which resides in the main(parent) project directory. I tr...
<p>You should give the whole path to the file you want to access.</p> <pre><code>File f = new File("sub 2/src/myFile.json"); </code></pre>
android assign one of two string variables into one string in another class <p>I have 2 classes. in first one I have 2 button and 2 string.two button starts same class. but if user press first button I want to send first string into second class's string. if choose other one I want to send second string.</p> <p>Main C...
<p>When you creating an instance of a class the members of this class are set to <code>null</code> if you have not assigned any value to that particular member of that class. </p> <p>You can make this member <code>static</code> or you can use </p> <pre><code>intent.putExtra("StringName"); </code></pre> <p>to pass t...
Assign Default Request Data in Model Schema on Swagger UI using Swagger 6.0.0-rc1-final <p>Please help me out in implementing default request data to the model schema on the Swagger UI with Swagger 6.0.0 with C#.</p>
<p>Redoing the answer to this to make it more clear.</p> <p>1) you'll need to create a RequestExampleAttribute class that just keeps the example class type similar to the link you sent.</p> <p>2) decorate the action method with the RequestExampleAttribute:</p> <pre><code>[RequestExample(typeof(MyRequestExample))] </...
Java and openssl C different AES CTR encryption result <p>I need to port application from Java to C++. I'm stuck on problem with AES CTR 128. In Java and C it has different encryption result. So my Java code.</p> <pre class="lang-java prettyprint-override"><code>import javax.crypto.Cipher; import javax.crypto.spec.IvP...
<p>Here AES CTR 256 not 128. Java do not explicity define bits it implicity gets from key size. So here key size has 32 bytes - 256 bits. I wrongly think that here AES CTR 128.</p>
MySql strange behaviour - strips characters from right of id in where clause <p>I noticed something strange today. Say you have a mysql table:</p> <pre><code>create table usr( usr_id serial ) </code></pre> <p>And you insert a row:</p> <pre><code>INSERT INTO usr (usr_id) VALUES ('1'); </code></pre> <p>And then you...
<p>Because <code>usr_id</code> is a <code>serial</code> column, it may only contain integers (<a href="http://stackoverflow.com/questions/20021983/what-is-the-difference-between-serial-and-auto-increment-in-mysql#20022067">What is the difference between SERIAL and AUTO_INCREMENT in mysql</a>).</p> <p>MySQL therefore i...
MS Dynamics REST API FetchXML with a paging cookie <p>I am using this approach available at <a href="https://msdn.microsoft.com/en-us/library/gg309717.aspx" rel="nofollow">MSDN</a> to retrieve more than 5000 records. I am using MS Dynamics REST API together with fetchXML. My first request looks like this:</p> <pre><co...
<p>I was having the same issue, my resolution was to uri encode the ampersands in the paging cookie</p> <pre><code>//ROOT.dynamics.com//api/data/v8.1/contacts?fetchXml=&lt;fetch mapping='logical' paging-cookie='%26lt;cookie page=%26quot;1%26quot;%26gt;%26lt;contactid last=%26quot;{UUID}%26quot; first=%26quot;UUID}%26q...
Getting Dropdown CheckBoxList values using javascript <p>I've got a <code>ListBox</code> inside a <code>DropDownEdit</code>.</p> <p>Now I need to get selected values using javascript. The problem is seeing multiple instances of both in debugger, so I don't undestand how to get values I need.</p> <p>My <code>ASP.NET</...
<p>Found a solution. To get chosen options I took <code>dde_ResourceGroup_DDD_lbx_ResourceGroup_0_VI</code> value, which is something like this: <code>"1|21|41|51|62|13"</code>. Of course, it had to be parsed. So, the chosen values are: <code>2, 4, 5, 6, 13</code>. I still wonder, why it has <code>1</code> or <code>2</...
What is the difference between installing regular Firebase & Firebase core in iOS? <p>I am new in Firebase. According to their setup guide for iOS, when I'm creating new app to configure Firebase in console, I should add <code>pod 'Firebase'</code> in the podfile.</p> <p>It was also mentioned that by default, this pod...
<p>You don't need to include pod 'Firebase/Core'. Core is the default subspec for pod 'Firebase' and will be automatically included from pod 'Firebase'. With the current Firebase pod organization, the purpose of Core is to include Analytics. This may change in the future.</p> <p>Details in the <a href="https://github....
Close Bootstrap offcanvas sidebar by clicking outside of it <p>I'm trying to modify Boostrap Offcanvas Template.</p> <p>The working example is <a href="http://getbootstrap.com/examples/offcanvas/" rel="nofollow">http://getbootstrap.com/examples/offcanvas/</a>:</p> <p>It works perfect for me and the only thing I'd lik...
<p>You can try something like this :</p> <pre><code>$(document).click(function(e) { var target = e.target; if (!$(target).is('#sidebar') &amp;&amp; !$(target).parents().is('#sidebar')) { $('.row-offcanvas').removeClass('active') } }); </code></pre>
Service Worker Cache memory <p>In progressive Web App using the service worker the request given is stored in the cache memory. If the content updated in the server whether the same content in the cache memory will updated, how it happens?</p>
<p>Check out Jake Archibald's <a href="https://jakearchibald.com/2016/caching-best-practices/" rel="nofollow">article</a> on caching strategies and service workers. I think this is exactly what you are looking for.</p> <p>Also note that <a href="https://github.com/GoogleChrome/sw-precache" rel="nofollow">sw-precache</...
How can I safely use an un-initialized array in a UITableView and show an empty table <p>How to prevent crashes when an array is empty and you make a request from a UITableView or UIPickerView?</p> <p>My current method is to always initialize my arrays before using them with dummy data but I'm not really happy with th...
<p>There is no need to put "dummy data" in your array. You can just initilize an empty array. like below</p> <pre><code> var myArray = [String]() </code></pre> <p>And in <code>numberOfRowsInSection</code> return myArray.count. If count is zero, <code>cellForRowAtIndexPath</code> will not be called and you are safe...
How does NSURLSession exactly work? <p>The following lines of code are written inside a function and session_id and session_name are global variables.</p> <pre><code>let task = NSURLSession.sharedSession().dataTaskWithRequest(request) { data, response, error in guard let _:NSData = data, let _:NSURLResponse = ...
<p>The code inside that big block (Swift calls it a closure) gets run after the request completes. There's not a way to get a value over the Internet immediately, because it can take up to 90 seconds, and you don't want your entire app blocked for that long (particularly because iOS will kill your app outright after 3...
Replacing PDF fails. Even with File.Delete() success when opened in Edge-Browser <p>The goal is to replace a PDF-File which is currently saved on disk.</p> <p>I am deleting the current PDF file from disk, then recreating a new one. This works fine unless the PDF is currently opened in the Microsoft Edge Browser.</p> ...
<p>If the file does not exist, <code>FileInfo.Delete()</code> does nothing.</p> <p>From <a href="https://msdn.microsoft.com/es-es/library/system.io.fileinfo.delete(v=vs.110).aspx" rel="nofollow">msdn</a></p> <p><strong>WinNt4Family</strong></p> <p>Delete does not delete a file that is open for normal I/O or a file t...
Parse stdout and run command if line matches <p>I would like to parse the stdout of a command and run a command if a line matches. Taking for example the output of <code>cat cities.txt</code> is </p> <pre><code>paris amsterdam munich berlin london brussels </code></pre> <p>I would like to echo this same list, but run...
<p>A simple <code>bash</code> script for this:-</p> <pre><code>#!/bin/bash while IFS= read -r line do [[ $line == b* ]] &amp;&amp; echo -e "$line\n$line starts with b" || echo "$line" done &lt;file </code></pre> <p>Running the script produces</p> <pre><code>$ bash script.sh paris amsterdam munich berlin berlin ...
Objective c handle adding child view controller or remove from parent <p>I have a small question about UIViewController.</p> <p>Is it possible to handle, in a custom UIViewController class, when the controller is added to current view controller using</p> <pre><code>[self addChildViewController:customViewController];...
<p>Your view controller can override this method when it wants to react to being added to a container.</p> <pre><code>- (void)didMoveToParentViewController:(UIViewController *)parent; </code></pre> <p>As by <a href="https://developer.apple.com/reference/uikit/uiviewcontroller/1621405-didmovetoparentviewcontroller?lan...
Google maps don't work in fieldset with jQuery Slide Up/Down <p>For my submit form I used fieldsets they will slide up and slide down with jQuery if the previous fieldset is valid. At fieldset number 3 there will be a map of google maps to locate the address of the customer based on longitude and latitude.</p> <pre><c...
<p>The problem here is the <code>display:none</code> style set on the <code>fieldset</code>. Google map needs the target element to be visible for the correct initialization. In your situation you can do a little trick, and create the element for the google map on the fly, move it using css out of the viewport, wait un...
Stop Emoji Being Entered In Input Fields <p>I need to know how you can stop a tablet or mobile user from entering emojis in any <code>input type="text"</code> field as users abe able to submit my form but it causes errors in my middle tier as they come through as squares and also writes to my DB as squares.</p> <p>Can...
<p>It may be a better idea to make your database compatible by changing encoding.</p> <p>That being said, you could loop over all characters in the textfield and make sure that their ordinal is between 32 and 255 inclusive. This would make it so that you only allow printable ASCII characters, more than enough for any ...
getting InflateException when Clicking on Pay Button Payfort PaymentGateway android SDK < Error inflating class com.shamanland.fonticon.FontIconView > <p>I am integrating <code>Payfort Payment gateway</code> android sdk in my app, every thing is working fine till Payment on Last screen using sdk. When Clicking on PAY ...
<p>are you customizing the payment xml files? and what do you use the setTypeface function for?</p>
How to compare dataframe unique values with a list? <p>I have a Panda dataframe column, and I want to check if all values in my column come from another list.</p> <p>For example, I want to check whether all values in my column are <code>A</code> or <code>B</code> and nothing else. My code should return true for the fo...
<p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.isin.html" rel="nofollow"><code>isin</code></a> and pass your list to generate a boolean array and with <code>all</code> to return whether all values present:</p> <pre><code>In [146]: myValues = ['A','B'] df = pd.DataFrame(...
Solr facet tag exclude does not work with space <p>I am using exclude and tag for faceting. Strange this is it works where I don't have space in value.</p> <p><code>http://192.168.2.114:8983/solr/customer/select?indent=on&amp;q=*:*&amp;fq=(%7B!tag%3DstateName%7DstateName:%22Gujarat%22)&amp;fq=(%7B!tag%3DstateName%7Dst...
<p>Problem is that <a href="https://cwiki.apache.org/confluence/display/solr/Local+Parameters+in+Queries" rel="nofollow">local parameters</a> in query must be at the beginning of the string:</p> <pre><code>{!tag=stateName}(stateName:"Andhra Pradesh") </code></pre> <p>and not</p> <pre><code>({!tag=stateName}stateName...
Query to select and combine uppermost and lowermost value from tables <p>We have the following tables on our SQL Server 2012.</p> <p><strong>Table A</strong> (data):</p> <pre><code>ID, Description --------------- 1 , Bla 1 2 , Bla 2 3 , Bla 3 </code></pre> <p><strong>Table P</strong> (data): </p> <pre><code>ID, Pa...
<p>Try with the below query. I think <code>Table A</code> is not required for getting the desired result.</p> <pre><code>SELECT TOP 1 First_VALUE(x.ID) OVER(ORDER BY x.ID desc) ID ,First_VALUE(Name) OVER(ORDER BY p.ID) Name ,CASE WHEN First_VALUE(Name) OVER(ORDER BY p.ID) = First_VALUE(Name...
'gulp-browser-sync' is not in the npm registry <p>When I try to run <code>gulp</code> I am getting the following errors.</p> <p>Can someone explain where I am going wrong?</p> <pre><code>npm ERR! Windows_NT 10.0.10586 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\b...
<p>Resolved this by running:</p> <p><code>npm install browser-sync gulp --save-dev</code></p>
TestNG - Running same classs with multiple threads in parallel <p>Is there a way to run same class in parallel with multiple threads, like</p> <pre><code>&lt;suite name="myTestSuite" verbose="1"&gt; &lt;test name="myTest" parallel="classes" thread-count="5"&gt; &lt;classes&gt; &lt;class name="m...
<p>What you can do is using a <a href="http://testng.org/doc/documentation-main.html#factories" rel="nofollow"><code>Factory</code></a> to create 5 instances of your test class.</p> <pre><code>public class TestFactory { @Factory public Object[] createInstances() { Object[] result = new Object[5]; for (int ...
Can't POST to /v2/entities <p>We can successfully receive our X-Auth Token by making a call to <a href="https://orion.lab.fiware.org/token" rel="nofollow">https://orion.lab.fiware.org/token</a> but, following the official documentation, we are getting error responses from the global Orion instance</p> <p>Here is a sam...
<p>Note your curl command doesn't include the X-Auth-Token header. You should add <code>--header 'X-Auth-Token: ...'</code> in order to include it. Please have a detailed look to <a href="https://fiware-orion.readthedocs.io/en/develop/quick_start_guide/index.html" rel="nofollow">the quick start guide</a>.</p> <p><stro...
Can not read memory stream c# <p>I am using some data, that goes to a mvc api. In this case, I pass the data using postman. The data format is raw text. The value that I am passing to the API are the following,and represent EDF (<a href="http://www.edfplus.info/" rel="nofollow">http://www.edfplus.info/</a>) data :</p>...
<p>The problem might be hat after the MemoryStream is created, the position is pointed at the end of the array. Have you tried this?</p> <pre><code>// this value comes from raw data, and for this example, lets suppose that it is all right. byte[] data=Base64.bDecodingForString(Value); Stream stream = new MemoryStream(...
how to show text like 2 / 4 "page number / total pages" in css or css3 <p>I wish to show my text like "Current page number / Total pages" using CSS </p> <p><img src="http://i.stack.imgur.com/XIBrE.png" alt="enter image description here"> </p> <p>Html code : </p> <pre><code>&lt;p class="pagenumber&gt; 2 / 5 &lt;/p&gt...
<p>A solution with two extra elements for the numbers and a pseudo element for the dividing line.</p> <p>You still need to adjust it for your design and layout to make it look good.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre c...
User keyboard input in pygame, how to get CAPS input <p>I'm in the process of making my first game and want prompt the user to enter information, eg their name. I've spent the last 3.5 hours writing the function below which I intend to use(slightly modified with a blinking underscore cursor to name one) in my games mov...
<p>Below is the re-worked code with upper case input catered for. I've also put in a blinking underscore. Unsure if it's the most efficient way to do so, but there it is. I had fun doing it.</p> <pre><code>import pygame from pygame.locals import * import sys from itertools import cycle def enter_text(max_length, lowe...
How to connect Mysql Docker to other docker in Dockerfile? <p>I am using these Docker commands:</p> <pre><code>docker network create --subnet=172.18.0.0/16 magentonet docker run -d --name mysql -p 3306:3306 --net magentonet --ip 172.18.0.23 -e MYSQL_ROOT_PASSWORD=magepass -e MYSQL_DATABASE=mySchema mysql:5 docker buil...
<p><code>docker build</code> runs each instruction in an intermediate, temporary container, and there's no way to connect that container to your Docker network. So you can't make use of the <code>mysql</code> container when you build a new image.</p> <p>Instead I'd look at building a custom database image first, with ...
Activity gauge High Chart with Gradient <p>I want to use gradient in below chart.</p> <p>Please help me on this concern.</p> <p>Thanks in advance.</p> <pre><code> Link : http://jsfiddle.net/gh/get/jquery/1.9.1/highslide-software/highcharts.com/tree/master/samples/highcharts/demo/gauge-activity/ </code></pre> <p><a...
<p>You should be able to use small trick for adding gradient to your angular gauge. You can use yAxis.stops for adding color gradients to your chart: </p> <pre><code>yAxis: { min: 0, max: 100, lineWidth: 0, tickPositions: [], stops: [ [0.1, '#55BF3B'], // green [0.5, '#DDDF0D'], // yellow [0.9, '...
Regular expression to match all commas outside double and single quotes <p>I am trying to match commas outside double quotes(") using the following Regular expression</p> <pre><code>,(?=(?:[^"]*"[^"]*")*[^"]*$) </code></pre> <p>for commas outside single quotes(') </p> <pre><code>,(?=(?:[^']*'[^']*')*[^']*$) </code><...
<p>Some alternative workaround is here</p> <pre><code>,(?=\s*(?:"[^"]*"|'[^']*'|\d+)(?:\s*,|\n)) </code></pre> <p>My method emphasizes on validating such a pattern like <code>,"[^"]*",</code>, <code>,'[^']*',</code> or <code>,\d+,</code>. The trick here is if starting point of the matching is correct then the rest of...
mvn liquibase:update results in "Failed to resolve the properties file." <p>When i run <code>mvn liquibase:update</code>, i get these on the stdout:</p> <pre><code>[INFO] Executing on Database: jdbc:postgresql://localhost:5432/PROJECT_NAME INFO 20/09/16 09:41:liquibase: null: null: Successfully acquired change log loc...
<p>Okay, the probem was: I was trying to configure the plugin on my root pom.xml, but I also had two submodules. One had the liquibase.yaml file, the other didn't.</p> <p>That way, when I ran <code>mvn liquibase:update</code> on the parent project, it would successfully run the migration on the first module but would ...
How to download zip files and PDF files by hitting HTTP URL using mulesoft? <p>How to download zip files by hitting http url using mulesoft flow?</p> <p>I want to download few zip files through mule flow and want to save in a file but struggling in getting the files. Please provide me the flow how to do it.</p>
<p>You can use <code>file:outbound-endpoint</code> after your <a href="https://docs.mulesoft.com/mule-user-guide/v/3.7/http-request-connector" rel="nofollow">HTTP request component</a> so that the payload after the HTTP request component can be saved as a file.<br> For reference you can follow the example here :- <a hr...
Parse Connection String into Struct in golang <p>I'm new at golang and I need to parse a connection string into a struct to get specific elements of that. Example:</p> <p>I have this:</p> <pre><code>"Data Source=mysqlserver.local,37001;Initial Catalog=mydatabase;User ID=usertest;Asynchronous Processing=True" </code><...
<p>Well, I did the following to solve my problem (I know its not perfect, but fits my needs very well)</p> <pre><code>func ConnectionStringBuilder(connectionstring string) ConnectionString { splittedcs := strings.Split(connectionstring, ";") csstruct := ConnectionString{} for i := 0; i &lt; len(splitted...
Display method Customer Name <p>I have created a new table with different fields, 1 of them is <code>CustAccount</code>, in the form i want to create a column next of <code>CustAccount</code> showing the <code>CustName</code>.</p> <p>I want to <code>display</code> the Customer Name, based on the selection of the CustA...
<p>You don't want to copy that method to your table. Instead refer to it by putting this method on your table:</p> <pre><code>// BP deviation documented display CustName name() { return CustTable::find(this.CustAcccount).name(); } </code></pre>
How do I deploy an Angular 2 app on Bluemix? <p>I have tried to deploy a few basic Angular 2 projects on Bluemix and got only errors after the build.</p> <p>Did anybody manage to have Angular 2 working on Bluemix? In that case, did you set anything specific in package.json file?</p> <p>I couldn't get over this error ...
<p>It would be great to post a sample or a link to your source code. But from the two log lines it sounds like you are trying to deploy the Angular 2 app including the Node.js tooling it comes with.</p> <p>As pointed by the previous comment, you'd rather build your Angular 2 app and deploy the resulting files, keeping...
Ember: How do I make vendor.css to be generated inside assets/css instead of assets? <p>I have tried doing <code>app.import('bower_components/font-awesome/css/font-awesome.min.css', {destDir: 'css'});</code> without any effect.</p>
<p>By default ember assets would be </p> <pre><code>/assets/application-name.js /assets/application-name.css </code></pre> <p>and if you import </p> <pre><code>/assets/vendor.js /assets/vendor.css </code></pre> <p>To change these paths, specify the <code>outputPaths</code> config option in <code>ember-cli-build.js<...
How to able to set min and max date? <p>I am using below library. For using in DateTime picker control, but i am not able to set min and max date.</p> <pre><code>https://github.com/kineticsocial/angularjs-datetime-picker </code></pre> <p>Download location: <code>https://www.npmjs.com/package/angularjs-datetime-picker...
<p>It is NOT yet supported at the moment: <a href="https://github.com/kineticsocial/angularjs-datetime-picker/issues/2" rel="nofollow">https://github.com/kineticsocial/angularjs-datetime-picker/issues/2</a></p>
MVC how to return VIEW for more than one grid on home page? <p>I have multiple grids I want to put on the home page only but when I return more than one in View, it shows me an error. </p> <p>It said I can try to throw new exception but still an error. How do I get it to show more than one grid?? The grids are created...
<p>There are a number of ways to accomplish this but in and of itself, a View can only have a single model feeding into it.</p> <p>You could create a ViewModel class containing both models or you could refactor your one View into one with several PartialViews in it, each having a model feeding into it.</p>
JSON returns Object Object <p>I currently have a JSON object I am trying to use. Here is me stringifying it because localStorage can only have strings:</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 p...
<p>try <code>console.log(profile)</code>. your approach converts the "profile" to String. hence gives <code>[Object Object]</code> . in your case, to obtain <code>email</code> please use profile[0].email as your call return an array instead of a JSON Object. </p>
adding listview footer when listview scroll reaches the end <p>I need to dynamically footer which can be add or remove when ever scrollview reaches the end. at some point I also need it to be visible and at other times I need it to be invisible , since I can't change visibility is there any other way.</p> <p>I am hav...
<p>You can add your footer view : </p> <pre><code>listViewComments.addFooterView(yourFooterView); </code></pre> <p>and you can remove it : </p> <pre><code>listViewComments.removeFooterView(yourFooterView); </code></pre> <p>Don't forget to inflate your footer view first : </p> <pre><code>View yourFooterView = getLa...
What JRE talks with <p>I have little to no knowledge of Java as a whole. I also tried to find that information by myself, without success though. This is why I decided to ask it here despite the negative attitude I am expecting afterwards. So here it is:</p> <p>Does the JVM have access to the memory registries, or it ...
<p>This lack of clarity is not uncommon and dates back to the early days of Java, nearly 20 years ago now. </p> <p>The term Java can refer to either of two distinct though tightly related things:</p> <ul> <li>a language, object-oriented in nature, compilers for which produce not CPU-specific machine code but an abstr...
Rails - mysql2 installation error <p>I have recently installed rvm to use rails5 along with rails3.x version in my current system. When i tried to create new rails5 application, i have got the below error</p> <pre><code>Could not find proper version of railties (3.2.13) in any of the sources Run `bundle install` to in...
<p>From Terminal try following:</p> <p>For Ubuntu:</p> <pre><code>sudo apt-get install mysql-client libmysqlclient-dev sudo gem install mysql2 </code></pre> <p>For Mac:</p> <pre><code>brew install mysql sudo gem install mysql2 </code></pre>
Functional programming in JS <p>Playing with FP in JS.<br> Suppose I have 2 functions</p> <pre><code>getLine :: () -&gt; IO String cat :: String -&gt; Task Error String </code></pre> <p>What is the proper way of composing this two functions?</p> <p><strong>UPD</strong>: I can't see any other solution except </p> <p...
<p>I'm assuming that you're familiar with Haskell since you're using Haskell idioms. You have the following functions:</p> <pre class="lang-hs prettyprint-override"><code>getLine :: () -&gt; IO String -- why isn't this simply `getLine :: IO String`? cat :: String -&gt; Task Error String </code></pre> <p>The first thi...
Where does R (for Windows) store packages before it installs them? <p>I am aware of where the installed packages go! ICMY, it's nicely outlined here:</p> <p><a href="http://stackoverflow.com/questions/2615128/where-does-r-store-packages">Where does R store packages?</a></p> <p>However, I do wonder where R caches the ...
<p>From the documentation for <code>install.package</code> : </p> <p><code>destdir (parameter, default=NULL) : directory where downloaded packages are stored. If it is NULL (the default) a subdirectory downloaded_packages of the session temporary directory will be used (and the files will be deleted at the end of the ...
Why @OneToMany does not discriminate sub-entities in collections <p>I have 2 collections of different sub-entities in owning entity:</p> <pre><code>@Entity @Table(name = "car") public class Car { @Id private Long id; @OneToMany(mappedBy = "owner", cascade = CascadeType.ALL, orphanRemoval = true, targetE...
<p>You might want to try @DiscriminatorOptions(force = true) on your abstract class "Part".</p> <p>See also: <a href="http://stackoverflow.com/questions/12199874/about-the-use-of-forcediscriminator-discriminatoroptionsforce-true">About the use of @ForceDiscriminator/@DiscriminatorOptions(force=true)</a></p>
Wix - Custom Action Return Code - Handling <p>Please read carefully as I will explain what I'm trying to do. I have a wix installer that calls custom action to validate user input. I want to call next dialog if validation is successful and NOT move if validation is not successful</p> <ol> <li>I have a custom action</l...
<p>The return values from custom actions are intended for use by Windows Installer, not you. Returning ActionResult.Failure tells Windows that your CA failed so badly that the installation needs to finish. If your CA works fine and is not fatal to the installation process then return a success result. Use property val...
How to add Magento extension in other theme except default <p>I want to add extension - <a href="https://www.magentocommerce.com/magento-connect/all-category-product-carousel.html" rel="nofollow">All Category Product Carousel</a> in my Magento Website and it has <strong>RWD theme</strong>.The components of the extensio...
<p>You can paste your extension key <a href="http://freegento.com/ddl-magento-extension.php" rel="nofollow">here</a>. Now you can check if you have copied all the files to RWD. The extension tell to insert below block in cms page. Include it in your cms->home page.</p> <pre><code>{{block type="pcarousel/pcarousel" pca...
Android app did not receive data from SignalR hub <p>I already read these topics:<br> <a href="http://stackoverflow.com/questions/32573823/how-to-use-signalr-in-android/32574829#32574829">how to use SignalR in Android</a><br> <a href="http://stackoverflow.com/questions/32375453/android-client-doesnt-get-data-but-net-cl...
<p>You does not provider parameters in your client-side which should be <strong>same</strong> as your side-site. The code should be below:</p> <pre><code> hub.on("NewMessage", new SubscriptionHandler1&lt;String&gt;() { @Override public void run(String message) { Log.d("&lt;Debug", "ne...
Allow colon (:) in URL on Azure Web App <p>We are trying to expose a URL following the <a href="https://tools.ietf.org/html/draft-kunze-ark-18" rel="nofollow">ARK</a> standard (Archival Resource Key) from an ASP.NET website hosted on an Azure Web App. But it seems Azure Web Apps do not support colons (:) in URL path se...
<p>Sorry for my origin reply. I try it with Azure MVC API. I configure the map route as following:</p> <pre class="lang-html prettyprint-override"><code> config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}:{id}", defaults: new { id = RoutePar...
How to set up a tag to record clicks of sort by categories list of a product page <p>I am very new to gtm and trying to set up a tag that can record clicks of the sort by categories of all product pages.</p> <p>Each category page has the sort by (like any other website), it for example has the options:</p> <ol> <li>P...
<p>You need to identify the click as it happens and then send the information to GA. So you need this two blocks in GTM: an universal analytics tag as "event" and a trigger which listens for clicks.</p> <p>If you don't know CSS selectors the most easy way to find the right values for the trigger is by try and error. A...
jquery just works for the latest button not all button <p>My PHP HTML code is this : </p> <pre><code>&lt;?php foreach($questions as $question){ echo" &lt;div id='postShare'&gt; &lt;div class='col-md-10 col-md-offset-1' id='listPost'&gt; &lt;div class='list-group'&gt; ...
<p>You need to create button with the same <code>class</code>. Creating with a same <code>id</code> will result in only one to be operated on.</p> <p>PHP</p> <pre><code> &lt;?php foreach($questions as $question) { echo " &lt;div id='postShare'&gt; &lt;div class='col-md-10 co...
Angular 1 - Get the module a controller is running in <p>I am working inside a platform where you can create controllers using a web form and write angular code inside of them... but I do not have access to the parent module.</p> <p>So here I am in my module, trying to apply a filter but I cannot apply a filter if I ...
<p>If you inject <code>$rootElement</code> you can use it to find the name of the module under which the current controller is running. e.g.:</p> <pre><code>function ($scope, spUtil, snRecordWatcher, $rootScope, $rootElement) { var module = $rootElement.attr('ng-app'); } </code></pre>
How to make an editable combo box on a form <p>I have an MS-Access table setup like this:</p> <pre><code>ID | Name 1 | Place1 2 | Place2 3 | Place3 </code></pre> <p>I have a form for the user to edit these names. There is a combo box with a control source to .Name field. The combo box loads the data, but whenever ...
<p>You have a couple of options:</p> <ol> <li><p>You can automatically add new items on the combobox's <code>Not in List</code> event. This will do what you want but has a lot of disadvantages. The biggest being that you basically have no control over what goes into your foreign key anymore. People can add new data wi...
grep and valid parenthesis sequence <p>I need to extract all indices from my latex files. But some indices may look like this</p> <blockquote> <p>\index{*3*sqrt*uppersqrt{\hspace{-2.5pt}$\uppersqrt{\;\;\;}$(upper square root)}}</p> </blockquote> <p>So i need to somehow count in regex number of currently opened cu...
<p>There is a limited number of brackets that can be opened? The regex</p> <pre><code>\\index{(?:[^{]|(?:{(?:[^{]|(?:{[^{]*}))*}))*} </code></pre> <p>Will match a max of 3 brackets deep, like: \index{{{}}{{}}}</p>
Force https with www from htaccess <p>I wanted to redirected all non www and non https urls to https with www from htaccess.</p> <p>I tried many codes by googling but could not get solved my problems</p> <p>I am sharing my existing htaccess code </p> <pre><code>php_value post_max_size 2000M php_value upload_max_file...
<p>Try this rule just after <code>RewriteEngine on</code></p> <pre><code>RewriteCond {HTTPS} on RewriteCond {HTTP_HOST} !^www RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R] </code></pre> <p>remove your previous attempt for testing in your code.</p>
how to get auto-populate fields in servicenow <p>I have a requirement that user details should be <strong>auto-populate</strong> from <em>user table</em>. </p> <p>In the incident form when we select a user; contact details and roles assigned to the user have to be shown in next to the fields.</p> <pre><code>function...
<p>So if I understand you correctly you want to display more Information about the Caller in the Incident Form is that right? If so you have a few possibilities: </p> <ul> <li>Since Caller is a reference field you can just put the fields on the form via form designer and make them read-only with a UI-Policy.</li> <li>...
iPython/Jupyter notebooks following deprecation of GoogleDrive "host" <p>For several years, I've been storing iPython/Jupyter notebooks in public folders on my GoogleDrive and then copying a path like this</p> <pre><code>https://www.googledrive.com/host/folder_id/file_name.ipynb </code></pre> <p>into the <a href="htt...
<p>Github support ipyton notebook format. So you can upload your file there.</p> <p>For example, like this <a href="https://github.com/danielfrg/pelican-ipynb/blob/master/tests/pelican/content/with-liquid-tag.ipynb" rel="nofollow">file</a>. <a href="http://i.stack.imgur.com/Yg8NO.png" rel="nofollow"><img src="http://i...
How do I copy all data from a row from a specific number of columns? <p>I am copying data from a large table in one sheet to a smaller table to show only the necessary rows of data needed to request quotes from suppliers for parts. I am using the code below:</p> <pre><code>Private Sub CommandButton1_Click() Dim sh1 A...
<pre><code>Option Explicit Sub main() Dim sh1 As Worksheet, sh2 As Worksheet Dim R As Long Dim c1 As Range Set sh1 = Worksheets("Breakdown &amp; Analysis") Set sh2 = Worksheets("Mail merge") R = 2 With sh1 For Each c1 In .Range("O8", .Cells(.Rows.Count, "O").End(xlUp)) ...
What to do after TYPO3 security update from 13.09.2016? <p>I don't understand the security patch from last week: <a href="https://typo3.org/teams/security/security-bulletins/typo3-core/typo3-core-sa-2016-022/">https://typo3.org/teams/security/security-bulletins/typo3-core/typo3-core-sa-2016-022/</a> . I have an old TYP...
<p>For me it boils down to (after installing the updated TYPO3 version):</p> <p>If you don't use realurl: enable</p> <pre><code>$GLOBALS['TYPO3_CONF_VARS']['FE']['cHashIncludePageId'] = true; </code></pre> <p>&amp; and you are probably "done". Of course all old google hits will be done for, but on a "public" site it...
How to copy/move only new records from Table in dev environment to same table in Test environment <p>I have added some new records in table <code>Table_1</code> in dev database server. I have exactly same table <code>Table_1</code> in test database server. I only want to copy the records from table <code>Table_1</code>...
<pre><code>Insert into servername.testdb.dbo.Table_1 (ID, column1, column2, etc) Select ID, column1, column2, etc From Devdb.dbo.Table_1 Where ID Not IN (Select ID From servername.testdb.dbo.Table_1) </code></pre> <p>If the ID is an Identity column, you will have to Set Identity_Insert before and after your inserts an...
Can't make Loop on Excel VBA and print results <p>I am new to Excel VBA and I want to calculate the distance between two atoms and make a loop to calculate it for all wanted cases</p> <p>with coordinate B(i), C(i), D(i) in the Excel sheet correspond to <strong>x,y,z</strong> cartesian coordinate..</p> <p>these atoms ...
<p>I think that the following should work for you:</p> <pre><code>Sub FindDistances() Dim i As Long, j As Long Dim r As Long, c As Long 'row and column indices for output Dim data As Variant Application.ScreenUpdating = False 'useful when doing a lot of writing data = Range("B4:D1000").Value 'dat...
Compare strings with different spaces and potentially null characters <p>I'm currently making a wikipedia scraper for a project I'm doing. The problem is that my code sometimes produces bugs when trying to compare strings. If I have strings that look identical, they sometimes are still registered as different. For exam...
<p>Remove the quotation marks surrounding the first argument of <code>replace</code>. This is because you are using a regular expression ( <code>/g</code> )for the replace function, which does not need to be wrapped in quotation marks.</p> <pre><code>function replaceBadSpaces(string) { return decodeURIComponent(en...
Android auto reduce data table <p>I am new to Android, and I have a table I made using:</p> <pre><code>&lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/question_list" android:layout_width="match_parent" android:layout_height="wrap_content" android:padding=...
<p>Displaying large information in TableLayout is bad practice. You can use ListView. Because, every time when text changed in your search box, you need to clear all views in TableLayout, then you need to create rows that appropriate your search filter and then you need to add these rows to TableLayout again. Creating ...
complete a future within other future <p>I have an external future operation which I can override it's onOperation complete method . I want to wrap it and complete by closure of a <em>Promise</em>. however I couldn't complete that future within other future. for example :</p> <pre><code>import scala.concurrent.{Future...
<p>I think you are trying to create a function which takes a <code>delay</code> as input and returns a <code>delayed future</code>.</p> <p>If you want to do that, you can do it in a non-sleeping way using <code>Await</code> and <code>Promise</code>.</p> <pre><code>import scala.concurrent.ExecutionContext.Implicits.gl...
Python CSV: Can I do this with one 'with open' instead of two? <p>I am a noobie.</p> <p>I have written a couple of scripts to modify CSV files I work with.</p> <p>The scripts:</p> <p>1.) change the headers of a CSV file then save that to a new CSV file,.</p> <p>2.) Load that CSV File, and change the order of select...
<p><code>csvfile</code> can be any object with a <code>write()</code> method. You could craft a custom element, or use <a href="https://docs.python.org/2/library/stringio.html" rel="nofollow">StringIO</a>. You'd have to verify efficiency yourself.</p>
Not getting required output using findall in python <p>Earlier ,I could not put the exact question.My apologies.</p> <p>Below is what I am looking for :</p> <p>I am reading a string from file as below and there can be multiple such kind of strings in the file.</p> <pre><code>" VEGETABLE 1 POTATOE_PRODUCE ...
<p>Solution in last snippet in this answer.</p> <pre><code>&gt;&gt;&gt; import re &gt;&gt;&gt; str2='d1 talk walk joke' &gt;&gt;&gt; re.findall('(\d\s+)(\w+\s)+',str2) [('1 ', 'walk ')] </code></pre> <p>output is a list with only one occurrence of the given pattern. The tuple in the list contains two strings that ...