input
stringlengths
51
42.3k
output
stringlengths
18
55k
Xslt 1.0 check if something exists or empty value? <p>Hi I am wondering is there any function in XSLT 1.0 and XPath 1.0 to behave like java's Appache <strong>StringUtils.isBlank(String str)</strong></p> <p>I use: <strong>Edited:</strong></p> <pre><code>&lt;xsl:variable name="attributeNameValue" select="$sourceObject/...
<p>In XPath/XSLT a common check is <code>not(normalize-space($foo))</code> to check that <code>$foo</code> is an empty string or a pure white space string.</p>
float and wrap content width <p>Why if i add a width to my main content, it no more wrap arount my floated div ?</p> <pre><code>&lt;div style="float:left;width:30%;"&gt; content1 content1 content1 content1 content1 content1 content1 content1 &lt;/div&gt; &lt;div id="mainContent" style="width:30%;"&gt; conten...
<p>Your floated <code>div</code> should be contained within your <code>mainContent</code> <code>div</code>:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;div i...
VBA - Getting unique values from a column without using a split string <p>I'm using the following code to save all unique values in a column of strings into an array, and then I get the amount of unique values by counting the length of the array.</p> <pre><code>Dim tmp As String Dim prNumbers() As String Dim arrLen As...
<p>This check probably is the problem:</p> <pre><code>(InStr(tmp, cell) = 0) </code></pre> <p>If e.g. a cell is <code>hello</code>, and a later cell is <code>ello</code>, it won't be included because <code>ello</code> is part of <code>hello</code> and thus the <code>tmp</code> string.</p> <p>To go with your current ...
Image cropping and image resizing with Xamarin.Ios <p>I need to implement image compressing and maintaining the aspect ratio with Xamarin.iOS. Right now I am using below code to show image from url.</p> <pre><code>uImage.SetImage(new NSUrl(imageUrl)); </code></pre> <p>Above code is showing image from url. But images ...
<p>Set <code>ContentMode</code> of your <code>UIImageView</code> to </p> <ul> <li><code>UIViewContentMode.ScaleAspectFill</code> Scales the contents to fill the new bounaries of the view, while preserving the aspect ratio.</li> <li><code>UIViewContentMode.ScaleAspectFit</code> Scales the contents so that everything is...
Assigning an element of a pointer to another element from the same pointer <p>I'm trying to assign an element from a pointer the same value as another element from the same pointer.</p> <pre><code>int testFunc() { char *p = "123"; p[0] = p[2]; return 0; } </code></pre> <p>Curious as to why the above code ...
<p>You are facing the issue because you're trying to modify a <em><a href="https://en.wikipedia.org/wiki/String_literal" rel="nofollow">string literal</a></em> which invokes <a href="https://en.wikipedia.org/wiki/Undefined_behavior" rel="nofollow">undefined behavior</a>.</p> <p>The problem is in</p> <pre><code> p[0]...
htmlspecialchars() is causing a variable to return blank data? <p>I am pulling data from a database using mysqli and php.</p> <p>this works ok but i get a random char (black question mark) replacing apostrophes in words, so i thought i could use the htmlspecialchars() function to have them display properly, but it doe...
<p>From the website you linked, it is obvious that the page itself uses UTF-8 for character encoding (<code>&lt;meta charset="UTF-8"&gt;</code>). It seems that the database from which you fetch your data uses a character encoding that is not equal to the <code>ini_get("default_charset")</code> value. <a href="http://ph...
Infinite loop in slider with css transition <p>I'm working on a particular type of slider on mobile devices. The idea is to only exploit the css animations to perform the movements. So, I detect the position of the finger through the "touchmove" event and through a particular function I determine the position. Now, the...
<p>Tried to create working example but i don't have enough time. When you reach last li, just take one from top, append it at the end of the list, and remove first one. Something like this:</p> <pre><code>var cloneLi = $(_child.find('li')[0]).clone() _child.append(cloneLi); $(_child.find('li')[0]).remove() </code></pr...
Enabling core data lightweight migration in Swift 3 <p>According to the articles I have read the correct way to enable core data light weight migrations is by passing options to <code>addPersistentStoreWithType</code>:</p> <pre><code>let mOptions = [NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingMod...
<p>You can just start a new project in Xcode 7, and copy and paste the generated core data code to the new new project!</p> <p>I created a project in Xcode 7 and migrated it to Xcode 8, this is the generated code. (I have already added the two options for enabling lightweight stack migration)</p> <pre><code>// MARK: ...
JBoss Deployment Invalid Header File <p>I am getting the following error while trying to deploy a <code>war</code> to <code>JBoss</code> from <code>InteliJ</code>:</p> <pre><code>15:06:46,414 INFO [TomcatDeployer] deploy, ctxPath=/XXXbackend, warUrl=file:C:/Users/XXX/Dropbox/XXX/trunkSource/portalbackend/target/XXX-b...
<p>The generated manifest file seems to contain some lines that don't match the expected "key-colon-value" syntax (the line containing standalone ${BUILD_NUMBER}, and perhaps also the empty line preceding it) which could lead to the parse error in the stacktrace</p>
App crashes when i get all value from all edittext from listview <p>Hello I have implemented listview where i used one edittext in listview,and i am getting all the values from all edittext but i am getting following error and aoo crashes</p> <pre><code>FATAL EXCEPTION: main Process: com.dhruva.eprintpost, PID: 3402 ...
<pre><code>**Please replace this code and this code is not work so please create adapter and get position edit text value and work your project perfect .** for (int k = 0; k &lt; imagelist.size(); k++) { EditText et; Log.v("aaaaaa"," sss "+k); vv ...
UIAlertController background color iOS10 <p>Code that I wrote for iOS9, worked really well:</p> <pre><code>UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"Select source" message:nil ...
<p><strong>For everyone that will bump into the same problem, I've found the solution:</strong></p> <p><code>UIAlertController.view</code> contains one subview, that is only <em>container</em>.</p> <p><em>That subview contains subview that contains two it's own subviews</em>, <strong>one is container</strong>, and an...
Faster version of length(find()) for selecting elements from some range from vectors (MATLAB) <p>I have 1Xn cell array of values. and I want to count values that are in given range in matlab. I implemented it as follows : </p> <pre><code>count1 = length(find(h{1}&lt;ti &amp; h{1}&gt;ti-INT)); </code></pre> <p>h is ...
<p>Sum the occurrence flags:</p> <pre><code> count1 = sum(h{1}&lt;ti &amp; h{1}&gt;ti-INT); </code></pre> <p>I know that I will upset the Gods of MATLAB for using <code>tic</code> and <code>toc</code> for code timig, but:</p> <pre><code>x = rand(10^7,1); tic; sum(x&gt;0.5); toc; tic; nnz(x&gt;0.5); toc; tic; length(...
Clamp RotateAround is not working on Camera in Unity3D <p>My code is not working, I am trying to clamp the camera, but it's not working. It's snapping to 45 instantly. How can I clamp the camera? </p> <p>Here is my Code.</p> <pre><code>using UnityEngine; using System.Collections; public class MoveCamera : MonoBehav...
<p>Here's an example of limiting the Y axis rotation, you can adapt it for X too. You didn't state what the limit should be based on so here it's based on the rotation of another object (public Transform target), this could be your player or whatever.</p> <pre><code>public float sensitivity = 16.0f; public Transform t...
How to check whether the web resource control is loaded or not in Dynamics CRM 2016 <p>Have to access the Webresource control from another webresoucre control Used the following javascript ,</p> <pre><code> var webResource = $(window.parent.Xrm.Page.getControl(webResourceName).getObject().contentWindow.window.docume...
<p>You have a number of options.</p> <h2>Have your web resource trigger code</h2> <p>My favorite approach is to go the other direction: In your web resource, add code to start execution on the parent CRM form. You can use jQuery's ready method or one of the many approaches that you can read about here on SO that doe...
in Xcode 8 throughs some errors After run the project <p>After run the project in console It throughs some errors,</p> <pre><code>subsystem: com.apple.UIKit, category: HIDEventFiltered, enable_level: 0, persist_level: 0, default_ttl: 0, info_ttl: 0, debug_ttl: 0, generate_symptoms: 0, enable_oversize: 1, privacy_setti...
<p>Finally got the answer : Click edit scheme->left choose "Run"->the top right choose "Arguments"->the bottom right add the environemnt variable as stated above "Name->OS_ACTIVITY_MODE value->disable " <img src="http://i.stack.imgur.com/RvQ9y.png" alt="enter image description here"> </p>
It is not safe to use pixmaps outside the GUI thread <p>rebz! This code is not working - icon full transperent. I'll never know what to do.</p> <pre><code>class SystemTrayIcon: def __init__(self, icon_app, icon_pause, icon_work, parent=None): self.STATUS_WORK = 2 self.STATUS_PAUSE = 1 self.STATUS_APP = 0 ...
<p>I'm assuming the title...</p> <blockquote> <p>It is not safe to use pixmaps outside the GUI thread</p> </blockquote> <p>is the error/warning message you see when the code runs.</p> <p>In general, no, it's not safe to manipulate a <code>QPixmap</code> on any thread other that that on which the <code>QApplication...
NSTextField - Allow editing only with force-touch, Cocoa <p>I am developing a OSX app with Force touch support. </p> <p>As default, if you set an NSTextField's behaviour editable, user can click two times or use force touch to start editing. </p> <p>I want to allow user start editing only with Force touch. How can I ...
<p>Subclass NSTextField and override <code>pressureChange(with:)</code>. Then, check <code>event.stage</code> for the level of the pressure (or <code>event.pressure</code> for the accurate value). If event.stage is <code>2</code>, it is the force touch. </p> <pre><code>@available(macOS 10.10.3, *) override func press...
IF Statement to Fill a Cell based on a Reference <p>This is a very weird request:</p> <p>I would like a VBA macro or an IF statement to read where a reference is pulled from and populate another cell showing where the cell was referenced.</p> <p>This is an inspection checklist for a part with hundreds of measurements...
<p>This will give you everything to the left of .xlsm, if indeed the string contains .xlsm. That should be a good starting point</p> <pre><code>Sub t() Dim endrow As Long Dim column As String Dim a As Range column = "A" endrow = ActiveSheet.Range(column &amp; Rows.Count).End(xlUp).Row For Each a In Range(column &a...
Android TCP Server stream reading <p>I have a .Net c# TCPClient socket communicating with Android TCP server. I am sending an Ascii encoded byte array through SSLStream from tcpclient to server, Android server is responding and reading the stream, but after reading it always shows special characters, but not the exact ...
<p>The problem was in C# DataStream class witch used socket. Try to replace your c# code with following. </p> <pre><code> SSLStream _clientSocket; //DataStream class public DataStream(SSLStream clientSocket) { _clientSocket = clientSocket; } public void Write(string message) { ...
Microsoft Bot (webchat channel): 500 Internal Server error: failed to send message <p>We have embedded a Bot on a web page through the web chat channel, if the Bot is <strong>idle</strong> for 10 minutes or so and then a question is asked, the Bot does not respond to it, however when the same question is asked again im...
<p>Are you running the bot in Azure? If so, make sure you have "AlwaysOn" enabled; otherwise the web app will be unloaded if it's idle for a period of time. Check <a href="https://github.com/Microsoft/BotBuilder/issues/1343" rel="nofollow">this</a> for a similar problem.</p> <blockquote> <p><strong>Always On</strong...
Umbraco Belle query syntax <p>Umbraco Belle has a resource entityResource with a method <a href="https://umbraco.github.io/Belle/#/api/umbraco.resources.entityResource#searchAll" rel="nofollow">searchAll</a>. It's takes a query argument. I need to know which syntax has this query.</p> <p>Thanks.</p>
<p>It says so right in the doc. It's a Lucene query: <a href="https://lucene.apache.org/core/2_9_4/queryparsersyntax.html" rel="nofollow">https://lucene.apache.org/core/2_9_4/queryparsersyntax.html</a></p> <p>It's basically something like</p> <pre><code>propertyName:searchValue </code></pre> <p>But that's only for s...
Tweaking Formatting in WebStorm for JSX / React <p>I'm looking for an editor that will aid in Formatting React/JSX Code with no headaches. I'm quite impressed with WebStorm while working with react / jsx, little-to-no setup. The formatter is <em>almost</em> perfect. Can I somehow tweak the formatter?</p> <p><strong>Cu...
<p>JSX formatter uses HTML code style preferences. Please try setting <code>Wrap attributes:</code> to <code>Wrap always</code> in Settings | Editor | Code Style | HTML - does it help? </p>
Why axes handle deleted in Matlab loop? <p>Code which tries to mimic the real dynamic condition</p> <pre><code>clear all; close all; hFig2=figure('Units','inches', 'Name', 'Time'); hax2=axes(hFig2); movegui(hFig2, 'southeast'); index=1; while (index &lt; 7); hFig2=figure(hFig2); u=0:0.01:1+index; ...
<p>When calling <code>axes</code>, the first input should be a parameter/value pair that specifies the parent. If you pass it a single handle graphics input it assumes that input is a <em>handle to an <code>axes</code></em></p> <pre><code>axes(hFig2) % Error using axes % Invalid axes handle </code></pre> <p>Or as yo...
How to access an array using raw_input in python <p>So, I have a python script which requires an input from the terminal. I have 20 different arrays and I want to print the array based on the input.</p> <p>This is the code minus the different arrays.</p> <pre><code>homeTeam = raw_input() awayTeam = raw_input() a =...
<p>You may take input as the comma separated (or anything unique you like) string. And call <code>split</code> on that unique identifier to get <code>list</code> (In Python <a href="https://docs.python.org/2/library/array.html" rel="nofollow"><code>array</code></a> and <a href="https://www.tutorialspoint.com/python/pyt...
How to edit order templates in Magento? <p>I want to edit this HTML page <code>index.php/sales/order/view/order_id/565</code>. Anyone can tell me from where I can edit the HTML that I want to change the 2 labels only from HTML page.</p>
<p>If you want to change the labels on html page, you should make changes in template file(.phtml). To find the template file which renders the output, turn on template path hints.In admin panel navigate to</p> <blockquote> <p>system->configuration->developer->->debug->template path hints</p> </blockquote> <p>Selec...
View class bytecode at runtime <p>I have patching class dynamycly by BCEL, and them I dynamycly reload class. I`m not sure what I really reloading class. </p> <p>How can I check it?</p> <p>How can I view class bytecode without save it as file? </p> <p>Thanks.</p>
<blockquote> <p>I'm not sure what I am really reloading the class. How can I check it?</p> </blockquote> <p>Well, you could print a message to <code>System.out</code> in static initializer in your class. If the message is printed you will know that your class has been reloaded, and the (new) class has been initial...
NoClassDefFoundError eventhough class in in same folder <p>I executed a main class and got the following error and trace.</p> <p>This is the console command:</p> <blockquote> <p>java -cp . net.sf.tinyPayroll.Main</p> </blockquote> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: Could not init...
<p>Your exception is: </p> <blockquote> <p><code>NoClassDefFoundError</code>: <strong>Could not initialize class <code>org.hsqldb.Trace</code></strong></p> </blockquote> <p>Which doesn't mean that it cannot find the class <code>org.hsqldb.Trace</code> in your classpath, it means that <strong>the class could not be...
How to pass varibles in prepared statement function? <p>I have a prepared statement function for <code>INSERT</code>, I got this function in this forum. but I don't know how to pass variables/array to this function. I am new at this, some help would be really useful. </p> <p>I want somehing like this:</p> <pre><code>...
<p>Try this, hope this helps!</p> <pre><code>define('DB_HOST', 'database_host'); define('DB_NAME', 'database_name'); define('DB_USER', 'database_user'); define('DB_PASS', 'database_password'); $dbc = new PDO('mysql:host='. DB_HOST .';dbname='. DB_NAME, DB_USER, DB_PASS); function insert_datas($array) { foreac...
how to make li items overflow hidden instead of dropping into next line <p>I am trying to make images in one line using li tags, they are going into next line when they exceed the width of div or ul, I want them in line and hide when they exceed.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-consol...
<p><a href="https://jsfiddle.net/kirandash/kcstc868/" rel="nofollow">https://jsfiddle.net/kirandash/kcstc868/</a></p> <pre><code>#thumbsUp{ width: 100%; height: 80px; background-color: gray; } #ulThumbs{ margin: 5px; overflow: hidden; background-color: red; padding-left: 0px; white-space: n...
bootstrap image height when resize <p>I am new in html/css/bootstrap. I have aproblem with an image with a class of img-responsive. I can t figure out why it doesn t maintain the full height of the col-md-4 when I resize the window. The image has the size:640x426. It keeps getting smaller in height and looks like is n...
<p>This this can solve it. <code>.img { width :100%}</code></p>
How to query a table efficiently without affecting live transactions <p>I have a high transaction table with millions of records with the structure below:</p> <pre><code>transaction -------------- id int txn_status varchar amount bigint name varchar txn_time datetime --Date and ...
<p>The first solution shouldn't put much load on the database if you have proper indexes i.e. a composite index <code>INDEX(txn_status, txn_time)</code> </p> <p>If most of the rows in your table are not pending, queries like this should be very fast: <code>SELECT * FROM transaction WHERE txn_status = 'pending' AND txn...
break the loop in nodejs <p>I have following setup code</p> <pre><code>var ele = element(by.model(xpath)); var option = ele.isDisplayed().then(function(found) { ele.all(by.tagName('option')).then(function(options) { options.some(function(option) { option.getText().then(function doesOptionMatch(...
<p>As per the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some" rel="nofollow">documentation</a> on <code>Array.some()</code>, it exits the loop if the callback function returns true</p> <blockquote> <p>some() executes the callback function once for each element pr...
Efficient data saving, like system (example) <p>I'm building a school project with several class mates. We've ran into a (minor) problem.</p> <p>There will be a 'forum' where classmates can post questions and where others can give answers/replies to.</p> <p>We're working with an ASP.NET Core application (web api). So...
<p>Something along these lines should get you started. Adopt your Question, Answer and Comment classes:</p> <pre><code>public class Question { public Guid Id { get; set; } public User User { get; set; } public string Title { get; set; } public string Body { get; set; } public List&lt;Answer&gt; Ans...
Autloading Classes in Laravel Through Thread <p>I am working with threads in laravel 5. I have everything setup correctly through Console.</p> <p>I am using a Worker and stacking the Thread onto the Worker and starting the worker like so</p> <pre><code> $worker-&gt;start(PTHREADS_INHERIT_NONE); </code></pre> <p>and ...
<p>On your composer.json you can autoload all classes in a path, like this:</p> <pre><code>"classmap": [ "app/commands", "app/controllers", "app/models", "app/MYLIBS" ] </code></pre>
How to Remove native android style in ionic <p><a href="http://i.stack.imgur.com/cGvTy.png" rel="nofollow"><img src="http://i.stack.imgur.com/cGvTy.png" alt="enter image description here"></a><a href="http://i.stack.imgur.com/j2ioT.png" rel="nofollow"><img src="http://i.stack.imgur.com/j2ioT.png" alt="enter image descr...
<p>Use Your Select Inside list div. </p> <pre><code>&lt;div class="list"&gt; &lt;label class="item item-input item-select"&gt; &lt;select&gt; &lt;option value="volvo"&gt;Volvo&lt;/option&gt; &lt;option value="saab"&gt;Saab&lt;/option&gt; &lt;option value="mercedes"&gt;Mercedes&lt;/option&gt; &lt;opt...
Angular2 with angularfire2 <p>Hello I have an issue with installing angularfire2 with angular2 released version .here is the snapshot</p> <p><a href="http://i.stack.imgur.com/VjVCi.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/VjVCi.jpg" alt="enter image description here"></a></p> <p>here is my package .json...
<p>You will have to install @types/request@0.0.30 for the recent Angular 2 release.</p> <pre><code>npm install @types/request --save </code></pre> <p>As for your <code>fsevents</code> incompatibility, it looks like it's an issue of your node version based on this <a href="https://github.com/npm/npm/issues/10768" rel=...
Error while connecting 2 nodes in grid in Apache Ignite <p>I am getting following error while connecting 2 nodes in grid in Apache Ignite. These 2 nodes detect themselves when I run script <strong>ignite.sh</strong> on both nodes. But when I try to start ignite on one node using <strong>ignite.sh</strong> and on anothe...
<p>See the root cause:</p> <pre><code>Remote node has peer class loading enabled flag different from local [locId8=d9ec5b41, locPeerClassLoading=true, rmtId8=3d11ed2e, rmtPeerClassLoading=false </code></pre> <ul> <li>ignite.sh starts a node with peerClassLoading disabled</li> <li>your Java code starts a node with pee...
Dealing with SciPy fmin_bfgs precision loss <p>I'm currently trying to solve numerically a minimization problem and I tried to use the optimization library available in SciPy. </p> <p>My function and derivative are a bit too complicated to be presented here, but they are based on the following functions, the minimizat...
<p><code>abs(x)</code> is always somewhat dangerous as it is non-differentiable. Most solvers expect problems to be smooth. Note that we can drop the <code>log</code> from your objective function and then drop the <code>1</code>, so we are left with minimizing <code>abs(x)</code>. Often this can be done better by the f...
How can I query for only new data (Parse/Android)? <p>I have the following method that queries a list of items in the onCreate method of my main activity and sets them to my adapter:</p> <pre><code>private void retrieveYeets() { String groupId = ParseUser.getCurrentUser().getString("groupId"); ParseQue...
<p>Here's the way you can do it :</p> <pre><code>private void retrieveYeets(Date date) { String groupId = ParseUser.getCurrentUser().getString("groupId"); ParseQuery&lt;ParseObject&gt; query = new ParseQuery&lt;&gt;(ParseConstants.CLASS_YEET); query.whereContains(ParseConstants.KEY_GROUP_ID, gr...
How to get the data of each line from a file? <p>Here, I want to print the data in each line as 3 separate values with "<code>:</code>" as separator. The file <code>BatmanFile.txt</code> has the following details:</p> <pre><code>Bruce:Batman:bat@bat.com Santosh:Bhaskar:santosh@santosh.com </code></pre> <p>And the out...
<p>You are looping through file line by line. You have stored all lines (after splitting) in an array. Once the loop finishes you have all data in <code>resultarray</code> array, just print whole array after the loop (instead of printing just first 3 indexes which are you doing at the moment).</p> <pre><code>#!/usr/bi...
XML Android diferences between "end edge", "right edge", "toEndOf", "toRightOf" <p>At .xml Android Studio, what are the differences between:</p> <p>1) "<strong>end edge</strong>" and "<strong>right edge</strong>" ?</p> <p>2) "<strong>toEndOf</strong>" and "<strong>toRightOf</strong>" ?</p> <p>3) "<strong>start edge<...
<p>Everything with a direction assigned to it is literal, as in left will always be left, right will always be right. Start and End are dependent on whether a language reads left-to-right or right-to-left, start and end matching those accordingly. </p> <p>alignBaseline will align to the bottom of the text itself, wher...
process complicated conditional checks with XSLT 1.0 <p>I have an XML file like so:</p> <pre><code>&lt;root&gt; &lt;node ID="1" /&gt; &lt;node ID="2" /&gt; &lt;node ID="3" /&gt; &lt;node ID="4" /&gt; &lt;node ID="5" /&gt; &lt;node ID="6" /&gt; &lt;node ID="7" get="1" /&gt; &lt;node ID="...
<blockquote> <p>If it matters, I can modify the format of the <code>get</code> value if there is some other format that'll make it easier to do what I want.</p> </blockquote> <p>Well, if you reformat the <code>get</code> value so that: </p> <ol> <li>a logical AND is written as <code>and</code>; </li> <li>a log...
Launching batch file from within HTA <p>I'm trying to launch a batch file from within a HTA file. The launching of the batch file appears to start properly (or at least the associated CMD prompt), but the batch closes moments later, when it should take approximately 5 minutes. During the brief moment the CMD process is...
<p>Windows doesn't provide an environment variable <code>%curdir%</code>. Its expansion produces a literal string <code>%curdir%</code>, so the Command Prompt probably closes immediatly because a file <code>%curdir%_install.cmd</code> cannot be found. Did you perhaps mean <code>%cd%</code>? That variable is only availa...
Spring initbinder register multiple custom editor String.class <p>I have following initBinder in my ControllerAdvice class</p> <pre><code> @InitBinder public void initBinder(WebDataBinder binder) { binder.registerCustomEditor(String.class, new StringTrimmerEditor(true)); binder.registerCustomEditor...
<p>Perhaps not the most elegant solution, but it worked for me. I have created new class that combined functionalities of both HtmlEscapeStringEditor and StringTrimmerEditor</p>
Running Total in Oracle SQL - insert missing rows <p>Let's assume I have following set of data in Oracle SQL database:</p> <pre><code>Product Year Month Revenue A 2016 1 7 A 2016 5 15 </code></pre> <p>After creating running totals with following code</p> <pre><code>select Product, Ye...
<p>You need a <code>calendar</code> table and <code>Left join</code> with your <code>exemplary_table</code></p> <pre><code>SELECT p.product, c.year, c.month, COALESCE(revenue, 0), Sum(revenue)OVER (partition BY p.product, c.year ORDER BY c.month) Revenue_Running FROM calendar_table ...
The time cost with Multithread to calculate Matrix product <p>I am recently learning thread. And in a little experiment I use pthread to try multithread to calculate the product of two matrix. Then I found that using multithread costs even more time than not to. I have tried to enlarge the volume of the matrix, single ...
<p>The main thread creates and starts the worker thread, and immediately joins it. Joining is blocking operation, meaning that no other thread is started until this one finishes. Effectively the execution is sequential, with all the overhead of memory allocation, thread creation, etc.</p> <p>It is also unlikely that y...
How to get all the text excluding text with specific tags with Nokogiri? <p>I have the following XML:</p> <pre><code>&lt;w:body&gt; &lt;w:p w14:paraId="15812FB6" w14:textId="27A946A1" w:rsidR="001665B3" w:rsidRDefault="00771852"&gt; &lt;w:r&gt; &lt;w:t xml:space="preserve"&gt;I am writing this &lt;/w:t&gt;...
<p>You can try using the following XPath :</p> <pre><code>//text()[not(ancestor::w:del or ancestor::w:ins)] </code></pre> <p><strong><kbd><a href="http://www.xpathtester.com/xpath/5c88266b151845e52541019f2d9973e7" rel="nofollow"><code>xpatheval demo</code></a></kbd></strong></p> <p>This XPath returns all text nodes ...
font awesome not working in ie9 & ie11 compatibility mode <p>Font Awesome renders perfectly in Chrome, Firefox, Safari, Opera, and Internet Explorer 11 in standard mode. When Compatibility Mode turned "On" on IE9 OR IE11 no icon render. </p> <p>Here is my HTML Structure on IE9 (Compatibility Mode turned "On"):</p> <p...
<p>Found the solution. </p> <pre><code>&lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt; </code></pre> <p>Needs to be placed as the FIRST tag in the <code>&lt;head&gt;</code> in order for it to work. </p>
Twilio conference call live streaming in website <p>Hi everyone, I am new to the Twilio API. I have successfully setup call conferencing and recording. But my requirement is to stream live conference call from website. Is it possible...? I have been searching in google from 2 days but no use. Please help.....
<p>Twilio developer evangelist here.</p> <p>You can't exactly stream a conference call, but you could use <a href="https://www.twilio.com/docs/api/client/twilio-js" rel="nofollow">Twilio Client to provide a way for users on a website to dial into the conference</a>. You can then mute all of those callers so they are e...
Using the one-liner syntax for controller specs <p>I'm trying to write terse tests for an API controller, but I'm having trouble with the "one-liner" syntax offered by RSpec.</p> <p>I'm overriding the subject explictly to refer to the <em>action</em> of posting rather than the <em>controller</em>:</p> <pre><code>let ...
<p>You can do it like this <code>subject { -&gt; { post :create, params } }</code> and then <code>it { is_expected.to change(SomeActiveRecordModel, :count).by(1) }</code></p> <p>Here you have very nice discussion about this <a href="https://github.com/rspec/rspec-expectations/issues/805" rel="nofollow">github_topic</a...
Provider $get method is not called in jasmine unit test <p>I am using custom provider in my app.js to make backend call and then in controllers just injecting that provider and getting promise result (I make this because instead to call getLoggedUser in every controller I am just getting results from provider) and inst...
<p>Here is the basic structure:</p> <pre><code>$httpBackend.when('GET', 'localhost:8443/user/current').respond(200, /*optional response callback function*/); $httpBackend.expect('GET', 'localhost:8443/user/current'); //here goes the function that makes the actual http request $httpBackend.flush(); </code></pre> <p...
AKAMAI CCU Fast Purge implementation <p>Am trying to implement the CCU fast purge call via JAVA and am referencing this doucument </p> <blockquote> <p><a href="https://developer.akamai.com/api/purge/ccu/reference.html" rel="nofollow">https://developer.akamai.com/api/purge/ccu/reference.html</a></p> </blockquote> <p...
<p>You need to:</p> <ul> <li>Get credentials for your client using Luna (<a href="https://control.akamai.com" rel="nofollow">https://control.akamai.com</a>) <ul> <li>Click "Configure... Manage APIs"</li> <li>Select "CCU APIs" in the left hand side</li> <li>Create new collection, create new client</li> <li>Create auth...
MS Access VBA, not getting results when running DoCmd to find a record <p>I am not a programmer by any means but I am trying to get a small data collection database going. I need to find a record based on input. Ive got two criteria that I want it to find, and if both arent found together, it is supposed to create a ...
<p>It seems that you already have a form.</p> <p>I recommend you trying this: Add a button with a click event to the form and add following code to the click event:</p> <p><code>dim rs as dao.recordset set rs = currentdb.openrecordset ("SELECT * FROM [yourtable] WHERE ('ShiftDate' = '" &amp; [yourParameter] &amp; "...
Webcam.js upload at laravel <p>I'm getting stuck when using upload with webcam.js with Laravel 5.3</p> <p><a href="https://github.com/jhuckaby/webcamjs#submitting-images-to-a-server" rel="nofollow">https://github.com/jhuckaby/webcamjs#submitting-images-to-a-server</a></p> <p>it's my view</p> <p><div class="snippet" ...
<p>it's how to integrate webcam.js with laravel. 5.3</p> <p><a href="http://laravel.io/bin/NklKG" rel="nofollow">http://laravel.io/bin/NklKG</a></p> <p>[Solved] by me </p>
How to Create a file at a specific path in python? <p>I am writing below code which is not working:</p> <pre><code>cwd = os.getcwd() print (cwd) log = path.join(cwd,'log.out') os.chdir(cwd) and Path(log.out).touch() and os.chmod(log.out, 777) </code></pre> <p>how can I create a log.out into cwd ?</p>
<p>you can call the usual linux <code>touch</code> command via <code>subprocess</code></p> <pre><code>import subprocess subprocess.call(["touch", cwd+"/log.out"]) </code></pre>
How to clear form after ajax submit? <p>I have a small contact form. Sending messages is working but the form stays with text after submitting. I searched and tried some code to clear it with no success.</p> <pre><code>// JavaScript Document $('#contact-form').submit(function (e) { "use strict"; e.preventDefault(); $....
<p>You can achieve it by using jQuery, put it after ajax success response.</p> <pre><code>$('#contact-form')[0].reset(); </code></pre> <p>OR</p> <pre><code>$(this).closest('form').find("input[type=text], textarea").val(""); </code></pre>
MySQL wampserver database date format <p><img src="http://i.stack.imgur.com/L5f42.png" alt="heres my database"></p> <p>how do i change the format in my database like this format 04-Oct-2016?</p>
<p>You can save the date into the table as DATETIME format and while retrieving back use the below query to format in a right way</p> <pre><code>SELECT DATE_FORMAT(datetime, '%d/%b/%Y') datetime FROM table </code></pre> <p>or after you get the actual value you can convert to the format like</p> <pre><code>$php_times...
How to check if readUTF method has some value to receive or not <p>I am implementing a server client application in java. Situation is that client sends some message to server and server may or may not respond(send back some message).</p> <hr> <p>Have a look at this</p> <p><code>is = new DataInputStream(client.getI...
<p>Use <code>DataInputStream.available()</code> to check whether there is data to be read and wrap the socket's <code>InputSteam</code> with a <code>PushbackInputStream</code> as described <a href="http://stackoverflow.com/questions/11982693/available-of-datainputstream-from-socket">here</a>.</p>
What is required to display custom messages in jenkins report? <p>I have Jenkins ver. 2.7.4 and I want to see custom messages in report besides stack trace. What do I need to do for this?</p>
<p>If you are writing a jenkins plugin and you've subclassed <a href="http://javadoc.jenkins-ci.org/hudson/tasks/Notifier.html"><code>Notifier</code></a>, then you can log to the build output using an instance of <a href="http://javadoc.jenkins-ci.org/hudson/model/BuildListener.html"><code>BuildListener</code></a>, lik...
Unable to install Service Bus 1.1 using Web Platform installer <p>Setup: Clean Windows 2012 R2 with latest updates running in Generation 2 VM on Hyper-V enabled Windows 10 pro, IIS and .Net3.5 SP1 all prerequisites installed.</p> <p>Installed WPI v5 and then tried to install Windows Azure Pack: Service Bus 1.1 <a href...
<p>Try to update your .net framework to 4.6 first. You can use the offline installer:</p> <p><a href="https://www.microsoft.com/en-us/download/details.aspx?id=48137" rel="nofollow">https://www.microsoft.com/en-us/download/details.aspx?id=48137</a></p> <p>Then, try once again the service bus 1.1. </p>
Reorderan array using an user defined order <p>i want to reorder, in php, an array using a particular defined list.</p> <p>For example i have this array:</p> <pre><code>['red', 'yellow', 'green', 'black', 'orange', 'white'] </code></pre> <p>The order of this <strong>input array</strong> may be different in some occa...
<p>I don't think there's a built-in way to do this, but you could use <code>usort</code> to sort it according to your preferred order:</p> <pre><code>usort($array, function($a, $b) { $order = ['white', 'black', 'red', 'orange', 'yellow', 'green']; $k1 = array_search($a, $order); $k2 = array_search($b, $ord...
"opaque" pointer in ffmpeg AVFrame <p>In <code>ffmpeg</code> there is a structure <a href="https://libav.org/documentation/doxygen/master/structAVFrame.html" rel="nofollow">AVFrame</a> describing decoded video or audio data.</p> <p>It has a void pointer <code>opaque</code>. The documentation claims it is "for some pri...
<p>It is a field dedicated for user (as opposed to ffmpeg libraries) usage; ffmpeg will not touch this field in any way so you are free to use it as you see fit. There is a caveat though: some ffmpeg functions will make a copy of AVFrame (or maybe move reference from AVFrame to another), which includes copying this fie...
R Create a new column from a header and reorder table using loop <p>I would like to ask for help for extract informations from a header</p> <p>I have a table with hundreds of rows and 1000 columns (equal) in a file (example below) like this one and I would like to make a loop to extract the dates from a header part (n...
<p>Here is a solution, using tips suggested by @Roman Luštrik :</p> <pre><code>library(stringr) # str_sub() function library(reshape2) # melt() function # Modify columns names (if date information is always at the same position) names(data) = paste0(str_sub(names(data), 5,8), "-", str_sub(names(data), 9,10), "-",str...
how to check if date is in certain interval python? <p>I'm importing dates from yahoo finance and want to transform them in a format so that I can compare them with today to check if the date is between 3 and 9 months from now.</p> <p>Here is what I have so far:</p> <pre><code>today = time.strftime("%Y-%m-%d") today ...
<p>You're using <code>transf_date = datetime.datetime.strptime(opt["Expiry"][1],'%b %d, %Y')</code> instead of <code>transf_date = datetime.datetime.strptime(opt["Expiry"][i],'%b %d, %Y')</code>, meaning that even though you're iterating over the entire <code>opt["Expiry"]</code>, you're always processing the same entr...
Runtime 91 & 1004 error in vba code <p>I am trying to get the defect and status from reporting tool. </p> <p>First thing I am getting:</p> <blockquote> <p>Runtime error : 91 object variable or with block variable not set</p> </blockquote> <p>Then if I debug it, I am getting the following error:</p> <blockquote> ...
<p>Try changing this,</p> <pre><code>Sheet2.Rows(i, 1).Value = DefectNo Sheet2.Rows(i, 2).Value = status </code></pre> <p>to this,</p> <pre><code>Sheet2.Cells(i, 1).Value = DefectNo Sheet2.Cells(i, 2).Value = status </code></pre>
Parsing lines from a file containing date-time greater than something <p>I have log files of size of the order of several 100 MBs, containing lines like this, containing the date-time information in the beginning:</p> <pre><code>[Tue Oct 4 11:55:19 2016] [hphp] [25376:7f5d57bff700:279809:000001] [] \nFatal error: syn...
<p>This uses a reference timestamp and compares the timestamp from the log file to it; if the log file's time stamp is more recent, the line gets printed:</p> <pre><code>awk -v refdate="$(date +'%s' -d 'Mon Oct 3 10:00:00 2016')" -F "[][]" ' { cmd = "date +\047%s\047 -d \"" $2 "\"" if ((cmd | getli...
Excel VBA - replace last digit with a 1 if it is 0 <p>I have a spreadsheet with a column of 2 and 3 digit numbers. If it's a 3 digit number that ends in a 0, that final 0 should be replaced with a 1. So 150 becomes 151 and 200 becomes 201.</p> <p>This is what I was using, just to test the functionality, and it's very ...
<p>If cells contain 2-3 digit numbers - do not use text operations on it. Format change should be outside of the loop.</p> <pre><code>Sub FixNumbers() Dim c As Range Selection.NumberFormat = "General" For Each c In Selection.Cells If (c &gt; 99) And (c Mod 10) = 0 Then c = c + 1 Next End Sub </c...
Div transition over div onclick <p>I need to have two div one above the other, and when I click over an image I want the second div slide up over the first.</p> <p>Why I can't get running my code onclick and it runs instead if I change onclick to AboutUs ?</p> <p>Something like this</p> <p><div class="snippet" data...
<pre><code>$('.blue').click(function(){ //expand red div width to 200px $('.red').animate({width: "200px"}, 500); setTimeout(function(){ //after 500 milliseconds expand height to 800px $('.red').animate({height:"800px"}, 500); },500); setTimeout(function(){ //after 1000 milli...
Left and right alignment of text in one row <p>I want to put two labels in one row, the first being aligned to the left border, the second to the right.</p> <p>Like here:</p> <p><a href="http://i.stack.imgur.com/GB6sg.png" rel="nofollow"><img src="http://i.stack.imgur.com/GB6sg.png" alt="enter image description here"...
<p>You used the dockpanel correct but you need align the the label content to right. Try this </p> <pre><code>&lt;DockPanel&gt; &lt;Label Content="left text" DockPanel.Dock="Left"&gt;&lt;/Label&gt; &lt;Label Content="right text" DockPanel.Dock="Right" HorizontalContentAlignment="Right"&gt;&lt;/Label&gt...
How to use LISTAGG to return rows prefixed with quotes <p>I am trying to return rows which would be useful for setting the in condition in a query. Here is my query </p> <pre><code>SELECT LISTAGG(PRODUCTID, ',') WITHIN GROUP (ORDER BY RowSequence) FROM DWRE_ITEM_V </code></pre> <p>which return Order1,Order2</p> <p>I...
<pre><code>SELECT LISTAGG(''''||PRODUCTID||'''', ',') WITHIN GROUP (ORDER BY RowSequence) FROM DWRE_ITEM_V </code></pre>
Parse remote csv on Rails 4 <p>I keep getting the error file name is too long. I am running rails on Heroku so I am trying to have an uploaded file saved on cloud, and then imported so it is not lost on their dyno.</p> <p>I want to create a new object for each row in the csv. Parsing the CSV has worked perfectly befor...
<p>This fixed it</p> <pre><code> def self.import_open_order(file) imported_file = open(file) CSV.parse(self.parse_headers(imported_file), headers: true) do |row| </code></pre> <p>Since <code>open(file).class = Tempfile</code>... I was able to just create the Tempfile and pass it through <code>CSV.parse</cod...
Android: Web Services, Offline Capability <p>I am posting this question because I couldn't find any satisfactory answers online.</p> <p>I am developing an Android App in which the data is fetched from the external server(in my case it's localhost MySQL server now) and displayed on the screen.</p> <p>However, the cons...
<p>I have implemented the same for my app. Have a look at the code and you will understand how to do it. I have used Retrofit for the same. I have checked if the nursejson which is in sharedpreference is null. if it is null then continue further to hit API if not then load data from that sharedpreference.</p> <p>To re...
Extract Sunday of the Week <p>Hi Im working to extract the next Sunday of the week for any given date in PL/SQL. </p> <p>I have the following code</p> <pre><code>select TRUNC(to_date('10-07-2016','mm-dd-yyyy'), 'w') + 8 - 1/86400 from dual; </code></pre> <p>This works good when the date itself does not fall on Sunda...
<p>try </p> <pre><code>select TRUNC(to_date('10-09-2016','mm-dd-yyyy'), 'iw')+6 from dual; </code></pre> <p><code>'iw'</code> returns the first day of the ISO week (Monday)</p>
how to create Model in angular 2 with array of object in it <p>I am trying to create a model for this response to store data into model and the use it as required </p> <h1>Response</h1> <pre><code>[ { "Id": 0, "ApimId": "5746ebcfcd7c3209247edc40", "Name": "Atea Service Desk", "Description": "Service...
<p>You can set object array type using <code>ClassName[]</code>:</p> <pre><code>export class Api{ Id: 0; ApimId: string; Name: string; Description: string; ServiceUrl: string; ScopeId: number; WorkflowId: number; Workflow: any; Scope: any; CreatedDate: string; CreatedBy: str...
sails + waterlock, how to implement the workflow with corresponding HTML templates <h1>Background</h1> <p>About 6 months ago, I started developing a web app with Sails. I was hoping to easily implement Authentication and Permission using <code>sails-auth</code> or <code>sails-generate-auth</code> and <code>sails-perm...
<p><strong>Ad. 2)</strong> Certainly yes. Client shouldn't have access to his encrypted password</p> <p><strong>Ad. 4)</strong> JWT should be in service, no controller, because is more secure way. So, yep. It should be done in server side and client shouldn't have access to JWT logic. More info: <a class='doc-link' hr...
Add total row with sum count <p>I am working with this query:</p> <pre><code>SELECT PAS.NAME, ( SELECT COUNT(*) FROM CUSOMERS WHERE C_ID = 90 AND CONTRACT_TYPE = 80 AND CONTRACT_DATE &gt;= TO_DATE('20160101', 'YYYYMMDD') AND CONTRACT_DATE &lt;= TO_DATE('20161231', 'YYYYMMDD') AND ORDER_ID = ORDERS.ID AND...
<pre><code>with t as ( SELECT PAS.NAME, ( SELECT COUNT(*) FROM CUSOMERS WHERE C_ID = 90 AND CONTRACT_TYPE = 80 AND CONTRACT_DATE &gt;= TO_DATE('20160101', 'YYYYMMDD') AND CONTRACT_DATE &lt;= TO_DATE('20161231', 'YYYYMMDD') AND ORDER_ID = ORDERS.ID AND STATUS = 1 ) AS ORDER_SHIPPED_COUNT FROM ORDERS INNER ...
Obtaining code param from url <p>I have urls with the following form:</p> <pre><code>http://localhost:9999/api/users/COD_MALE http://localhost:9999/api/users/COD_FEMALE </code></pre> <p>I want to obtain match the last param (<code>COD_MALE</code> or <code>COD_FEMALE</code>)</p> <pre><code>\/api\/users\/^[a-z0-9_-]*$...
<p>You can use this regex to capture part after <code>/api/users/</code>:</p> <pre><code>/\/api\/users\/([a-zA-Z0-9_-]*)$/ </code></pre> <p>If your regex flavor allows then use <code>\w</code> instead of `[a-zA-Z0-9_]:</p> <pre><code>/\/api\/users\/([\w-]*)$/ </code></pre>
Nan in summary histogram <p>My program will face this some times(not every run will face this..), then if face this I can always reproduce this error loading from the last model I have saved before program crash due to nan. When rerun from this model, first train process seems fine using the model to generate loss(I ha...
<p>Usually NaN is a sign of model instability, for example, exploding gradients. It may be unnoticed, loss would just stop shrinking. Trying to log weights summary makes the problem explicit. I suggest you to reduce the learning rate as a first measure. If it wouldn't help, post your code here. Without seeing it it's h...
Match same amount of characters as matched by previous group <p>Basically, I need a combination of <code>\k</code> and <code>\g</code>.</p> <p>Here is an example:</p> <p>I have strings in the form of <code>"123045 ; 67089"</code>. I have to match this only if there is a repeating digit in both numbers on the same pos...
<p>What you are facing here is a balancing problem. You can use recursion to solve it, my approach would be:</p> <pre><code>^\d*(\d)(?:(\d(?:(\s*;\s*\d*\1)|\g&lt;2&gt;)\d)|\g&lt;3&gt;)$ </code></pre> <p>This will take <code>\s*;\s*\d*\1</code> as the content between two balanced groups of numbers. To get out of the r...
variables in play views <p>I've found a few answers online to my issue but all for older versions of play which no longer work.</p> <p>I am trying to find a way to use a variable as part of the template path. I understand that this will remove the type checking etc, but its for a generator/prototyping/internal tool an...
<p>I've added an answer here solely to help anyone else hitting this issue.</p> <p>@Mikesname was correct, remove the <code>Some()</code> and it 'should' all work fine.</p> <p>The issue was that I was dynamically loading the class/view name, but I wasn't using the full class name. I was loading <code>something</code>...
Iterating over boost::hana::tuple <p>I could not find a way to access real object with <code>hana::for_each</code> iterating over tuples.</p> <pre><code>struct A { std::string name; } struct B { std::string name; } using type_t = decltype(boost::hana::tuple_t&lt;A, B&gt;); type_t names; boost::hana::for_each(na...
<p><a href="http://boostorg.github.io/hana/structboost_1_1hana_1_1tuple.html#a1997546daf58a48cc15498d338a03da3"><code>tuple_t</code></a> is for a tuple of <code>hana::type</code>s. You want a <code>tuple</code> of normal objects, which is just <code>tuple</code>:</p> <pre><code>boost::hana::tuple&lt;A, B&gt; names; bo...
casting int pointer to char pointer <p>I've read several posts about casting int pointers to char pointers but i'm still confused on one thing. </p> <p>I understand that integers take up four bytes of memory (on most 32 bit machines?) and characters take up on byte of memory. By casting a integer pointer to a char poi...
<blockquote> <p>By casting a integer pointer to a char pointer, will they both contain the same address?</p> </blockquote> <p>Both pointers would point to the same location in memory.</p> <blockquote> <p>Does the cast operation change the value of what the char pointer points to?</p> </blockquote> <p>No, it chan...
c# using arrays as a map <p>I'm relatively new to C# and I'm creating a basic old-school dungeon questing game to help me get to grips with visual studio and windows forms.</p> <p>I would like to use an array of objects as a map which I can then move between (please let me know if there's a better way). <em>(edit for ...
<p>Areas could be considered nodes in a connected graph. The edges are defined by what nodes a particular node is connected to.</p> <p>You could define your area class something like this.</p> <pre><code>public class Area { public string Name {get;set;} public string Left {get;set;} public string Right {...
Connect Lambda to Elasticache using Serverless framework <p>I'm trying to access AWS Elasticache cluster from a Lambda function using Serverless framework (v 0.5.6) without loosing access to Dynamodb. I have tried using this <a href="https://gist.github.com/d4goxn/7322250ffe89f8a8a5c5d62804a8da2a" rel="nofollow">Gist</...
<p>You will have to place the Lambda function inside the VPC that the ElastiCache cluster resides in. Of course once you do that the Lambda function only has access to resources that exist inside the VPC, so it will no longer have access to DynamoDB. The solution to that is to add a NAT gateway to the VPC, which will a...
cannot get sublime text 3 command line tools to work <p>I had sublime text 2 command line tools working. When I downloaded Sublime Text 3, I could not get the command line tools to work. I've tried every answer here: <a href="http://stackoverflow.com/questions/16199581/opening-sublime-text-on-command-line-as-subl-on-...
<p>Remove the existing link first. It must be a broken link.</p> <p>List the contents of the directory and you'll see that the link is broken:</p> <pre><code>$ ls -Al /usr/local/bin/ </code></pre> <p>Output from the above command will show that the existing link is pointing to a non existing file. So delete the brok...
Why this array is not working properly <p>I will in this method descending order number integer</p> <pre><code>package sortarray; public class start { public static void main(String[] args) { int [] numb={10,12,8,6,2}; sortarray(numb); } public static void sortarray(int [] input){ ...
<p>I understand you want to keep some kind of history of max'es?</p> <p><code>sortmax</code> is just referencing to your input array, everything you do on <code>sortmax</code> you do on <code>input</code>. You need to do this:</p> <p><code>int[] sortmax = new int[input.length];</code></p> <p>instead of <code>int[] s...
Max Date between 2 dates <p>How can I find the latest date in a column but constrain it between 2 dates</p> <pre><code>SELECT [Weight] FROM [weighinevent] w WHERE [Date] = (SELECT MAX([Date]) WHERE [Date] BETWEEN @StartDate AND @EndDate AND w.[userid] = @userid ) </code></pre> <p>This is what I have. Is that correct...
<p>No, it is not correct. Subqueries need to define the table too from which they are selecting. But you can order by the date and take only the first record</p> <pre><code>SELECT top 1 Weight FROM weighinevent WHERE Date BETWEEN @StartDate AND @EndDate AND userid = @userid ORDER BY Date DESC </code></pre>
how to set different font for different screen size, such as iPhone 6s and iPhone SE <p>I am making a information collection view for my project, I need to indicate a timer inside. How can I set different font size for different screen? Basically, I want to set the font size to 46 in iPhone 6s and the font size is sup...
<p>Create Macros such as this one that determines that the phone size is 4 or 5:</p> <pre><code>#define is4sOr5 ([[UIScreen mainScreen] bounds].size.height &lt;= 568.0) ? TRUE:FALSE //This one does IPAD label.font = [UIFont systemFontOfSize:(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 12 : 10) weight:.2]...
How to decompress jpeg bytes in Dot Net Core? <p>I'm looking at porting some code to dot net core so I can run it on Linux. One part of the code needs to decompress a jpeg file and read the pixel values.</p> <p>It seems that neither System.Drawing.Bitmap nor System.Windows.Media is available in Dot Net Core. </p> <p>...
<p>You need to use 3rd party library for this purpose; take a look to the <a href="https://github.com/JimBobSquarePants/ImageProcessor/tree/Core" rel="nofollow">ImageProcessorCore</a> (it can be installed from myget: <a href="https://www.myget.org/gallery/imageprocessor" rel="nofollow">https://www.myget.org/gallery/ima...
issue with count variable in Python while loop <p>I have an array of values:</p> <pre><code>increase_pop = [500, -300, 200, 100] </code></pre> <p>I am trying to find the index of the lowest and highest values. Most of my code works and everything seems to be going well except for one problem. The rest of my code look...
<p><code>max_year</code> is assigned when the first <code>if</code> conditional is satisfied. But if that never happens, <code>max_year</code> will never be assigned. That situation will occur when <code>increase_pop[0]</code> (and hence the initial value of <code>max_value</code>) is the largest value in <code>incre...
How to use a service instead of a controller <p>I don't know how to use a service instead of a controller in an AngularJS1 app.</p> <p>this is my controller, and I want to use a service because I want to have 2 controllers in my html, 1 for form and 1 for table list. </p> <p>How should I do this? </p>
<p>If you want to use the service, please check this link: <a href="https://docs.angularjs.org/guide/services" rel="nofollow">https://docs.angularjs.org/guide/services</a></p> <p>In your case:</p> <p>that can be:</p> <pre><code>myApp.service('userService',['$scope',function($scope){ $scope.user = []; $scope....
Getting error while installing SonarQube plugin in eclipse 4.2.2 <p>I am trying to install the sonar in my eclipse but it can not find the url even though the url is working fine in my browser. If any one knows the solution please let me know, thanks.</p> <p><img src="http://i.stack.imgur.com/1R4mJ.png" alt="Eclipse -...
<p>To install the plugin you can also go to <strong>Help > Eclipse Marketplace</strong>... and search for "SonarQube". Check <a href="http://docs.sonarqube.org/display/SONARQUBE53/Installing+SonarQube+in+Eclipse" rel="nofollow">this</a> for more details.</p>
Google Directions API Result is different from Google Maps result <p>I am developing an app that displays the Distance &amp; path between 2 distances. In this case I have used following addresses:</p> <p><strong>Source:</strong> Major Bhola Ram Enclave</p> <p><strong>Destination:</strong> Ring Road Mall, Sector 3, Ro...
<p>Those are not addresses, they are places. If you want a similar result to Google Maps, you need to use the placeId or the coordinates returned for that place from the places service in the directions request.</p> <p><a href="http://www.geocodezip.com/v3_example_geo2.asp?addr1=Major%20Bhola%20Ram%20Enclave&amp;addr2...
Tablesorter doesn't do anything in jQueryUI dialog <p>I am trying to use tablesorter upon a dynamically created table in a jquery ui dialog, but the tablesorter doesn't seem to work. That means the result is a simple html table without sorting or layout like tablesorter's "zebra". My code:</p> <p><div class="snippet"...
<p>I get this Error:</p> <pre><code>Error: { "message": "TypeError: $(...).button is not a function", "filename": "http://stacksnippets.net/js", "lineno": 24, "colno": 1 } </code></pre> <p>This means you have to modify your selector to: (remove the button())</p> <pre><code>$("#searchButton").click(function()...
Remove text qualifier when copying to variable in postman <p>I have an issue using a text variable from a response body and inserting into a request without the text qualifiers. </p> <p>I'm trying this: </p> <pre><code>var data = JSON.parse(responseBody); postman.setGlobalVariable("basketid", responseBody); </code><...
<p>If you are getting "14b5f921-78d9-4ab2-a5a0-828f00fcf63a" as it is in global environment as you said, you can use eval:</p> <pre><code>var jsonObj = JSON.stringify(responseBody); var setObj=eval("("+jsonObj+")"); postman.setGlobalVariable("basketid",setObj); </code></pre>
Repeating characters results in wrong repetition counts <p>My function looks like this:</p> <pre><code>def accum(s): a = [] for i in s: b = s.index(i) a.append(i * (b+1)) x = "-".join(a) return x.title() </code></pre> <p>with the expected input of:</p> <pre><code>'abcd' </code></pre> ...
<p>Don't use <code>str.index()</code>, it'll return the <em>first match</em>. Since <code>c</code> and <code>b</code> and a appear early in the string you get <code>2</code>, <code>1</code> and <code>0</code> back regardless of the position of the <em>current</em> letter.</p> <p>Use the <a href="https://docs.python.or...
Function to check whether a binary tree is binary search tree or not? <p>I attempted writing the following method which tells whether a Binary Tree is Binary Search Tree or not? I pass only half of the test cases. What am I doing wrong?</p> <pre><code>boolean checkBST(Node root) { boolean leftflag = false; bo...
<p>I can see a case where your program could return wrongly false.</p> <p>Imagine you have a tree with 3 branches deep going as follow : </p> <pre><code> 7 / \ 3 8 \ / \ 4 6 9 </code></pre> <p>Your program starts up at 7 (root), creates two boolean at false...
SonarLint 2.2.1 Eclipse not catching a majority of issues (unlike examples online) <p>I want to use the SonarLint plugin for Eclipse. I installed it, but it doesn't seem to be catching everything it should. After installing it, I tried to write code that should trigger SonarLint issues. For example, the picture on t...
<p>Figured it out. For some reason, because I named my Java Project "Test", I think it assumed that the project was filled with Unit Tests based on JUnit class naming conventions. When I made a project with a different name, SonarLint worked as expected.</p>
Symfony 2 AJAX session expire <p>I have an AJAX worker they is called a API url every second. After 250-300 seconds, I don't get a valid response or a profile-token in case of the user was logged out. I have already configured the <code>cookie_lifetime</code> to <strong>0</strong> but it made no difference. Here's also...
<p>I've found an answer for my question by myself.</p> <p>You need to configure the <code>gc_divisor</code>, <code>gc_probability</code> and <code>gc_maxlifetime</code>. For example:</p> <pre><code>session: cookie_lifetime: 0 gc_divisor: 10000 gc_probability: 1 gc_maxlifetime: 604800 </code></pre> <p...
URL encoding "+" character <p>I have an application where the users can upload files. So filenames can contain characters like <strong>+</strong>. I do not want to change the filenames and eliminate these chars.<br> Other users can download these files. I implemented this by creating a form with a link (action) to the ...
<p>Thanks to Quentin for your hint. I found the solution here: <a href="http://www.ifinity.com.au/Blog/EntryId/60/404-Error-in-IIS-7-when-using-a-Url-with-a-plus-sign-in-the-path" rel="nofollow">http://www.ifinity.com.au/Blog/EntryId/60/404-Error-in-IIS-7-when-using-a-Url-with-a-plus-sign-in-the-path</a></p>